Starts a basic image vulnerability scan.
A basic image scan can only be started once per 24 hours on an individual image. This limit includes if an image was scanned on initial push. You can start up to 100,000 basic scans per 24 hours. This limit includes both scans on initial push and scans initiated by the StartImageScan API. For more information, see Basic scanning in the Amazon Elastic Container Registry User Guide.
Parameters:
-
registry_id
(Optional[RegistryId], default:
None
)
–
The Amazon Web Services account ID associated with the registry that contains the repository in which to start an image scan request. If you do not specify a registry, the default registry is assumed.
-
repository_name
(RepositoryName)
–
The name of the repository that contains the images to scan.
Raises:
Source code in docs_src/capo_ecr/_services/ecr.py
| def start_image_scan(
self,
repository_name: "capo_ecr.types.repository_name.RepositoryName",
image_id: "capo_ecr.types.image_identifier.ImageIdentifier",
*,
config_overrides: Optional[ECRClientConfig] = None,
registry_id: Optional["capo_ecr.types.registry_id.RegistryId"] = None,
) -> "capo_ecr.types.start_image_scan_response.StartImageScanResponse":
"""<p>Starts a basic image vulnerability scan.</p> <p> A basic image scan can only be started once per 24 hours on an individual image. This limit includes if an image was scanned on initial push. You can start up to 100,000 basic scans per 24 hours. This limit includes both scans on initial push and scans initiated by the StartImageScan API. For more information, see <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning-basic.html">Basic scanning</a> in the <i>Amazon Elastic Container Registry User Guide</i>.</p>
Args:
registry_id: <p>The Amazon Web Services account ID associated with the registry that contains the repository in which to start an image scan request. If you do not specify a registry, the default registry is assumed.</p>
repository_name: <p>The name of the repository that contains the images to scan.</p>
Raises:
capo_ecr.errors.image_archived_exception.ImageArchivedException: <p>The specified image is archived and cannot be scanned.</p>
capo_ecr.errors.image_not_found_exception.ImageNotFoundException: <p>The image requested does not exist in the specified repository.</p>
capo_ecr.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
capo_ecr.errors.limit_exceeded_exception.LimitExceededException: <p>The operation did not succeed because it would have exceeded a service limit for your account. For more information, see <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/service-quotas.html">Amazon ECR service quotas</a> in the Amazon Elastic Container Registry User Guide.</p>
capo_ecr.errors.repository_not_found_exception.RepositoryNotFoundException: <p>The specified repository could not be found. Check the spelling of the specified repository and ensure that you are performing operations on the correct registry.</p>
capo_ecr.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue.</p>
capo_ecr.errors.unsupported_image_type_exception.UnsupportedImageTypeException: <p>The image is of a type that cannot be scanned.</p>
capo_ecr.errors.validation_exception.ValidationException: <p>There was an exception validating this request.</p>
capo_ecr.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_ecr.types.start_image_scan_request.StartImageScanRequest]",
) -> OperationResponse[
"capo_ecr.types.start_image_scan_response.StartImageScanResponse"
]:
import capo_ecr._operations.amazon_ec2_container_registry_v20150921.start_image_scan
output, http_response = (
capo_ecr._operations.amazon_ec2_container_registry_v20150921.start_image_scan.start_image_scan(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("StartImageScan")
)
input_: capo_ecr.types.start_image_scan_request.StartImageScanRequest = {
"repository_name": repository_name,
"image_id": image_id,
}
if registry_id is not None:
input_["registry_id"] = registry_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|