Skip to content

batch_get_image async

batch_get_image(
    repository_name: RepositoryName,
    image_ids: ImageIdentifierList,
    *,
    config_overrides: Optional[AsyncECRClientConfig] = None,
    registry_id: Optional[RegistryId] = None,
    accepted_media_types: Optional[MediaTypeList] = None,
) -> BatchGetImageResponse

Gets detailed information for an image. Images are specified with either an imageTag or imageDigest.

When an image is pulled, the BatchGetImage API is called once to retrieve the image manifest.

Parameters:

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

    The Amazon Web Services account ID associated with the registry that contains the images to describe. If you do not specify a registry, the default registry is assumed.

  • repository_name (RepositoryName) –

    The repository that contains the images to describe.

  • image_ids (ImageIdentifierList) –

    A list of image ID references that correspond to images to describe. The format of the imageIds reference is imageTag=tag or imageDigest=digest.

  • accepted_media_types (Optional[MediaTypeList], default: None ) –

    The accepted media types for the request.

    Valid values: application/vnd.docker.distribution.manifest.v1+json | application/vnd.docker.distribution.manifest.v2+json | application/vnd.oci.image.manifest.v1+json

Raises:

  • InvalidParameterException –

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

  • LimitExceededException –

    The operation did not succeed because it would have exceeded a service limit for your account. For more information, see Amazon ECR service quotas in the Amazon Elastic Container Registry User Guide.

  • RepositoryNotFoundException –

    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.

  • ServerException –

    These errors are usually caused by a server-side issue.

  • UnableToGetUpstreamImageException –

    The image or images were unable to be pulled using the pull through cache rule. This is usually caused because of an issue with the Secrets Manager secret containing the credentials for the upstream registry.

  • UnknownServiceError –

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

Examples:

To obtain multiple images in a single request This example obtains information for an image with a specified image digest ID from the repository named ubuntu in the current account.

>>> await client.batch_get_image(repository_name='ubuntu', image_ids=[{'imageTag': 'precise'}])
Source code in docs_src/capo_ecr/_services/async_ecr.py
async def batch_get_image(
    self,
    repository_name: "capo_ecr.types.repository_name.RepositoryName",
    image_ids: "capo_ecr.types.image_identifier_list.ImageIdentifierList",
    *,
    config_overrides: Optional[AsyncECRClientConfig] = None,
    registry_id: Optional["capo_ecr.types.registry_id.RegistryId"] = None,
    accepted_media_types: Optional[
        "capo_ecr.types.media_type_list.MediaTypeList"
    ] = None,
) -> "capo_ecr.types.batch_get_image_response.BatchGetImageResponse":
    """<p>Gets detailed information for an image. Images are specified with either an <code>imageTag</code> or <code>imageDigest</code>.</p> <p>When an image is pulled, the BatchGetImage API is called once to retrieve the image manifest.</p>

    Args:
        registry_id: <p>The Amazon Web Services account ID associated with the registry that contains the images to describe. If you do not specify a registry, the default registry is assumed.</p>
        repository_name: <p>The repository that contains the images to describe.</p>
        image_ids: <p>A list of image ID references that correspond to images to describe. The format of the <code>imageIds</code> reference is <code>imageTag=tag</code> or <code>imageDigest=digest</code>.</p>
        accepted_media_types: <p>The accepted media types for the request.</p> <p>Valid values: <code>application/vnd.docker.distribution.manifest.v1+json</code> | <code>application/vnd.docker.distribution.manifest.v2+json</code> | <code>application/vnd.oci.image.manifest.v1+json</code> </p>

    Raises:
        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.unable_to_get_upstream_image_exception.UnableToGetUpstreamImageException: <p>The image or images were unable to be pulled using the pull through cache rule. This is usually caused because of an issue with the Secrets Manager secret containing the credentials for the upstream registry.</p>
        capo_ecr.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To obtain multiple images in a single request
        This example obtains information for an image with a specified image digest ID from the repository named ubuntu in the current account.

        >>> await client.batch_get_image(repository_name='ubuntu', image_ids=[{'imageTag': 'precise'}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecr.types.batch_get_image_request.BatchGetImageRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecr.types.batch_get_image_response.BatchGetImageResponse"
    ]:
        import capo_ecr._operations.amazon_ec2_container_registry_v20150921.batch_get_image

        (
            output,
            http_response,
        ) = await capo_ecr._operations.amazon_ec2_container_registry_v20150921.batch_get_image.async_batch_get_image(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("BatchGetImage")
    )
    input_: capo_ecr.types.batch_get_image_request.BatchGetImageRequest = {
        "repository_name": repository_name,
        "image_ids": image_ids,
    }
    if registry_id is not None:
        input_["registry_id"] = registry_id
    if accepted_media_types is not None:
        input_["accepted_media_types"] = accepted_media_types

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output