Skip to content

batch_check_layer_availability async

batch_check_layer_availability(
    repository_name: RepositoryName,
    layer_digests: BatchedOperationLayerDigestList,
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    registry_id: Optional[RegistryIdOrAlias] = None,
    repository_type: Optional[RepositoryType] = None,
) -> BatchCheckLayerAvailabilityResponse

Checks the availability of one or more image layers that are within a repository in a public registry. When an image is pushed to a repository, each image layer is checked to verify if it has been uploaded before. If it has been uploaded, then the image layer is skipped.

This operation is used by the Amazon ECR proxy and is not generally used by customers for pulling and pushing images. In most cases, you should use the docker CLI to pull, tag, and push images.

Parameters:

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

    The Amazon Web Services account ID, or registry alias, associated with the public registry that contains the image layers to check. If you do not specify a registry, the default public registry is assumed.

  • repository_name (RepositoryName) –

    The name of the repository that's associated with the image layers to check.

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

    The type of the repository. If you don't specify a type, Amazon ECR uses FREE. Valid values:

    • FREE: A free repository.

    • PREMIUM: A premium repository that holds paid content.

  • layer_digests (BatchedOperationLayerDigestList) –

    The digests of the image layers to check.

Raises:

  • InvalidParameterException –

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

  • RegistryNotFoundException –

    The registry doesn't exist.

  • 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.

  • ServerException –

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

  • UnsupportedCommandException –

    The action isn't supported in this Region. Check that the action is available in the Amazon Web Services Region that you're using, and try again in a supported Region.

  • UnknownServiceError –

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

Source code in docs_src/capo_ecr_public/_services/async_ecrpublic.py
async def batch_check_layer_availability(
    self,
    repository_name: "capo_ecr_public.types.repository_name.RepositoryName",
    layer_digests: "capo_ecr_public.types.batched_operation_layer_digest_list.BatchedOperationLayerDigestList",
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    registry_id: Optional[
        "capo_ecr_public.types.registry_id_or_alias.RegistryIdOrAlias"
    ] = None,
    repository_type: Optional[
        "capo_ecr_public.types.repository_type.RepositoryType"
    ] = None,
) -> "capo_ecr_public.types.batch_check_layer_availability_response.BatchCheckLayerAvailabilityResponse":
    """<p>Checks the availability of one or more image layers that are within a repository in a public registry. When an image is pushed to a repository, each image layer is checked to verify if it has been uploaded before. If it has been uploaded, then the image layer is skipped.</p> <note> <p>This operation is used by the Amazon ECR proxy and is not generally used by customers for pulling and pushing images. In most cases, you should use the <code>docker</code> CLI to pull, tag, and push images.</p> </note>

    Args:
        registry_id: <p>The Amazon Web Services account ID, or registry alias, associated with the public registry that contains the image layers to check. If you do not specify a registry, the default public registry is assumed.</p>
        repository_name: <p>The name of the repository that's associated with the image layers to check.</p>
        repository_type: <p>The type of the repository. If you don't specify a type, Amazon ECR uses <code>FREE</code>. Valid values:</p> <ul> <li> <p> <code>FREE</code>: A free repository.</p> </li> <li> <p> <code>PREMIUM</code>: A premium repository that holds paid content.</p> </li> </ul>
        layer_digests: <p>The digests of the image layers to check.</p>

    Raises:
        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.registry_not_found_exception.RegistryNotFoundException: <p>The registry doesn't exist.</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.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.unsupported_command_exception.UnsupportedCommandException: <p>The action isn't supported in this Region. Check that the action is available in the Amazon Web Services Region that you're using, and try again in a supported Region.</p>
        capo_ecr_public.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecr_public.types.batch_check_layer_availability_request.BatchCheckLayerAvailabilityRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecr_public.types.batch_check_layer_availability_response.BatchCheckLayerAvailabilityResponse"
    ]:
        import capo_ecr_public._operations.spencer_frontend_service.batch_check_layer_availability

        (
            output,
            http_response,
        ) = await capo_ecr_public._operations.spencer_frontend_service.batch_check_layer_availability.async_batch_check_layer_availability(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("BatchCheckLayerAvailability")
    )
    input_: capo_ecr_public.types.batch_check_layer_availability_request.BatchCheckLayerAvailabilityRequest = {
        "repository_name": repository_name,
        "layer_digests": layer_digests,
    }
    if registry_id is not None:
        input_["registry_id"] = registry_id
    if repository_type is not None:
        input_["repository_type"] = repository_type

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