Skip to content

describe_image_scan_findings

describe_image_scan_findings(
    repository_name: RepositoryName,
    image_id: ImageIdentifier,
    *,
    config_overrides: Optional[ECRPUBLICClientConfig] = None,
    registry_id: Optional[RegistryId] = None,
    repository_type: Optional[RepositoryType] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[HundredMaxResults] = None,
) -> DescribeImageScanFindingsResponse

Returns the scan status and vulnerability findings for an image in a premium repository. Images in premium repositories are scanned automatically when they're pushed, and are rescanned as new vulnerabilities are published. Image scanning isn't currently supported for free repositories.

Parameters:

  • registry_id (Optional[RegistryId], default: None ) –

    The Amazon Web Services account ID that's associated with the public registry that contains the repository where the image is. If you do not specify a registry, the default public registry is assumed. You can specify only your own account ID. Cross-account access through a repository policy isn't supported for this operation.

  • repository_name (RepositoryName) –

    The repository that contains the image to describe scan findings for.

  • repository_type (Optional[RepositoryType], default: None ) –

    The type of the repository. Currently, image scanning is supported only for premium repositories, so you must specify PREMIUM. If you don't specify a type, Amazon ECR uses FREE, and the request fails with ValidationException.

  • image_id (ImageIdentifier) –

    The image ID of the image to describe scan findings for.

  • next_token (Optional[NextToken], default: None ) –

    The nextToken value that's returned from a previous paginated DescribeImageScanFindings request where you used maxResults and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. If there are no more results to return, this value is null.

    This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.

  • max_results (Optional[HundredMaxResults], default: None ) –

    The maximum number of results that DescribeImageScanFindings returns in paginated output. When you use this parameter, DescribeImageScanFindings returns only maxResults results in a single page along with a nextToken response element. To see the remaining results, send another DescribeImageScanFindings request with the returned nextToken value. You can specify a value between 1 and 100. If you don't use this parameter, DescribeImageScanFindings returns up to 100 results and a nextToken value, if applicable.

Raises:

  • ImageNotFoundException –

    The image requested doesn't exist in the specified repository. Check the image tag or digest. To list the images in a repository, use DescribeImages or DescribeImageTags, or for a premium repository that you're entitled to, DescribeEntitledImages or DescribeEntitledImageTags.

  • InvalidParameterException –

    The specified parameter is invalid. Review the available parameters for the API request.

  • RepositoryNotFoundException –

    The specified repository can't be found. Check the spelling of the specified repository and ensure that you're performing operations on the correct registry.

  • ScanNotFoundException –

    The specified image scan can't be found. Make sure that the image has been scanned.

  • ServerException –

    These errors are usually caused by a server-side issue. Retry the request. If it continues to fail, contact Amazon Web Services Support.

  • ValidationException –

    There was an error validating the request. Check the request parameters and try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To describe the scan findings for an image in a premium repository This example describes the vulnerability scan findings for an image in the premium repository my-premium-repository.

>>> client.describe_image_scan_findings(repository_name='my-premium-repository', repository_type='PREMIUM', image_id={'imageDigest': 'sha256:f5c12bd3e4b8b1a2a3a5d5d0e6c4b3a2f1e0d9c8b7a6f5e4d3c2b1a0f9e8d7c6'})
Source code in docs_src/capo_ecr_public/_services/ecrpublic.py
def describe_image_scan_findings(
    self,
    repository_name: "capo_ecr_public.types.repository_name.RepositoryName",
    image_id: "capo_ecr_public.types.image_identifier.ImageIdentifier",
    *,
    config_overrides: Optional[ECRPUBLICClientConfig] = None,
    registry_id: Optional["capo_ecr_public.types.registry_id.RegistryId"] = None,
    repository_type: Optional[
        "capo_ecr_public.types.repository_type.RepositoryType"
    ] = None,
    next_token: Optional["capo_ecr_public.types.next_token.NextToken"] = None,
    max_results: Optional[
        "capo_ecr_public.types.hundred_max_results.HundredMaxResults"
    ] = None,
) -> "capo_ecr_public.types.describe_image_scan_findings_response.DescribeImageScanFindingsResponse":
    """<p>Returns the scan status and vulnerability findings for an image in a premium repository. Images in premium repositories are scanned automatically when they're pushed, and are rescanned as new vulnerabilities are published. Image scanning isn't currently supported for free repositories.</p>

    Args:
        registry_id: <p>The Amazon Web Services account ID that's associated with the public registry that contains the repository where the image is. If you do not specify a registry, the default public registry is assumed. You can specify only your own account ID. Cross-account access through a repository policy isn't supported for this operation.</p>
        repository_name: <p>The repository that contains the image to describe scan findings for.</p>
        repository_type: <p>The type of the repository. Currently, image scanning is supported only for premium repositories, so you must specify <code>PREMIUM</code>. If you don't specify a type, Amazon ECR uses <code>FREE</code>, and the request fails with <code>ValidationException</code>.</p>
        image_id: <p>The image ID of the image to describe scan findings for.</p>
        next_token: <p>The <code>nextToken</code> value that's returned from a previous paginated <code>DescribeImageScanFindings</code> request where you used <code>maxResults</code> and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the <code>nextToken</code> value. If there are no more results to return, this value is <code>null</code>.</p> <note> <p>This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.</p> </note>
        max_results: <p>The maximum number of results that <code>DescribeImageScanFindings</code> returns in paginated output. When you use this parameter, <code>DescribeImageScanFindings</code> returns only <code>maxResults</code> results in a single page along with a <code>nextToken</code> response element. To see the remaining results, send another <code>DescribeImageScanFindings</code> request with the returned <code>nextToken</code> value. You can specify a value between 1 and 100. If you don't use this parameter, <code>DescribeImageScanFindings</code> returns up to 100 results and a <code>nextToken</code> value, if applicable.</p>

    Raises:
        capo_ecr_public.errors.image_not_found_exception.ImageNotFoundException: <p>The image requested doesn't exist in the specified repository. Check the image tag or digest. To list the images in a repository, use <code>DescribeImages</code> or <code>DescribeImageTags</code>, or for a premium repository that you're entitled to, <code>DescribeEntitledImages</code> or <code>DescribeEntitledImageTags</code>.</p>
        capo_ecr_public.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
        capo_ecr_public.errors.repository_not_found_exception.RepositoryNotFoundException: <p>The specified repository can't be found. Check the spelling of the specified repository and ensure that you're performing operations on the correct registry.</p>
        capo_ecr_public.errors.scan_not_found_exception.ScanNotFoundException: <p>The specified image scan can't be found. Make sure that the image has been scanned.</p>
        capo_ecr_public.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue. Retry the request. If it continues to fail, contact Amazon Web Services Support.</p>
        capo_ecr_public.errors.validation_exception.ValidationException: <p>There was an error validating the request. Check the request parameters and try again.</p>
        capo_ecr_public.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe the scan findings for an image in a premium repository
        This example describes the vulnerability scan findings for an image in the premium repository my-premium-repository.

        >>> client.describe_image_scan_findings(repository_name='my-premium-repository', repository_type='PREMIUM', image_id={'imageDigest': 'sha256:f5c12bd3e4b8b1a2a3a5d5d0e6c4b3a2f1e0d9c8b7a6f5e4d3c2b1a0f9e8d7c6'})
    """

    def _handler(
        req: "OperationRequest[capo_ecr_public.types.describe_image_scan_findings_request.DescribeImageScanFindingsRequest]",
    ) -> OperationResponse[
        "capo_ecr_public.types.describe_image_scan_findings_response.DescribeImageScanFindingsResponse"
    ]:
        import capo_ecr_public._operations.spencer_frontend_service.describe_image_scan_findings

        output, http_response = (
            capo_ecr_public._operations.spencer_frontend_service.describe_image_scan_findings.describe_image_scan_findings(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeImageScanFindings")
    )
    input_: capo_ecr_public.types.describe_image_scan_findings_request.DescribeImageScanFindingsRequest = {
        "repository_name": repository_name,
        "image_id": image_id,
    }
    if registry_id is not None:
        input_["registry_id"] = registry_id
    if repository_type is not None:
        input_["repository_type"] = repository_type
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output