Skip to content

complete_layer_upload async

complete_layer_upload(
    repository_name: RepositoryName,
    upload_id: UploadId,
    layer_digests: LayerDigestList,
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    registry_id: Optional[RegistryIdOrAlias] = None,
) -> CompleteLayerUploadResponse

Informs Amazon ECR that the image layer upload is complete for a specified public registry, repository name, and upload ID. You can optionally provide a sha256 digest of the image layer for data validation purposes.

When an image is pushed, the CompleteLayerUpload API is called once for each new image layer to verify that the upload is complete.

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 registry where layers are uploaded. If you do not specify a registry, the default public registry is assumed.

  • repository_name (RepositoryName) –

    The name of the repository in a public registry to associate with the image layer.

  • upload_id (UploadId) –

    The upload ID from a previous InitiateLayerUpload operation to associate with the image layer.

  • layer_digests (LayerDigestList) –

    The sha256 digest of the image layer.

Raises:

Source code in docs_src/capo_ecr_public/_services/async_ecrpublic.py
async def complete_layer_upload(
    self,
    repository_name: "capo_ecr_public.types.repository_name.RepositoryName",
    upload_id: "capo_ecr_public.types.upload_id.UploadId",
    layer_digests: "capo_ecr_public.types.layer_digest_list.LayerDigestList",
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    registry_id: Optional[
        "capo_ecr_public.types.registry_id_or_alias.RegistryIdOrAlias"
    ] = None,
) -> "capo_ecr_public.types.complete_layer_upload_response.CompleteLayerUploadResponse":
    """<p>Informs Amazon ECR that the image layer upload is complete for a specified public registry, repository name, and upload ID. You can optionally provide a <code>sha256</code> digest of the image layer for data validation purposes.</p> <p>When an image is pushed, the CompleteLayerUpload API is called once for each new image layer to verify that the upload is complete.</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 registry where layers are uploaded. If you do not specify a registry, the default public registry is assumed.</p>
        repository_name: <p>The name of the repository in a public registry to associate with the image layer.</p>
        upload_id: <p>The upload ID from a previous <a>InitiateLayerUpload</a> operation to associate with the image layer.</p>
        layer_digests: <p>The <code>sha256</code> digest of the image layer.</p>

    Raises:
        capo_ecr_public.errors.empty_upload_exception.EmptyUploadException: <p>The specified layer upload doesn't contain any layer parts.</p>
        capo_ecr_public.errors.invalid_layer_exception.InvalidLayerException: <p>The layer digest calculation performed by Amazon ECR when the image layer doesn't match the digest specified.</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.layer_already_exists_exception.LayerAlreadyExistsException: <p>The image layer already exists in the associated repository.</p>
        capo_ecr_public.errors.layer_part_too_small_exception.LayerPartTooSmallException: <p>Layer parts must be at least 5 MiB in size.</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.</p>
        capo_ecr_public.errors.unsupported_command_exception.UnsupportedCommandException: <p>The action isn't supported in this Region.</p>
        capo_ecr_public.errors.upload_not_found_exception.UploadNotFoundException: <p>The upload can't be found, or the specified upload ID isn't valid for this repository.</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.complete_layer_upload_request.CompleteLayerUploadRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecr_public.types.complete_layer_upload_response.CompleteLayerUploadResponse"
    ]:
        import capo_ecr_public._operations.spencer_frontend_service.complete_layer_upload

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CompleteLayerUpload")
    )
    input_: capo_ecr_public.types.complete_layer_upload_request.CompleteLayerUploadRequest = {
        "repository_name": repository_name,
        "upload_id": upload_id,
        "layer_digests": layer_digests,
    }
    if registry_id is not None:
        input_["registry_id"] = registry_id

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