Skip to content

complete_layer_upload async

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

Informs Amazon ECR that the image layer upload has completed for a specified 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 per each new image layer to verify that the upload has completed.

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[RegistryId], default: None ) –

    The Amazon Web Services account ID associated with the registry to which to upload layers. If you do not specify a registry, the default registry is assumed.

  • repository_name (RepositoryName) –

    The name of the repository 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/_services/async_ecr.py
async def complete_layer_upload(
    self,
    repository_name: "capo_ecr.types.repository_name.RepositoryName",
    upload_id: "capo_ecr.types.upload_id.UploadId",
    layer_digests: "capo_ecr.types.layer_digest_list.LayerDigestList",
    *,
    config_overrides: Optional[AsyncECRClientConfig] = None,
    registry_id: Optional["capo_ecr.types.registry_id.RegistryId"] = None,
) -> "capo_ecr.types.complete_layer_upload_response.CompleteLayerUploadResponse":
    """<p>Informs Amazon ECR that the image layer upload has completed for a specified 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 per each new image layer to verify that the upload has completed.</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 associated with the registry to which to upload layers. If you do not specify a registry, the default registry is assumed.</p>
        repository_name: <p>The name of the repository 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.errors.empty_upload_exception.EmptyUploadException: <p>The specified layer upload does not contain any layer parts.</p>
        capo_ecr.errors.invalid_layer_exception.InvalidLayerException: <p>The layer digest calculation performed by Amazon ECR upon receipt of the image layer does not match the digest specified.</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.kms_exception.KmsException: <p>The operation failed due to a KMS exception.</p>
        capo_ecr.errors.layer_already_exists_exception.LayerAlreadyExistsException: <p>The image layer already exists in the associated repository.</p>
        capo_ecr.errors.layer_part_too_small_exception.LayerPartTooSmallException: <p>Layer parts must be at least 5 MiB in size.</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.upload_not_found_exception.UploadNotFoundException: <p>The upload could not be found, or the specified upload ID is not valid for this repository.</p>
        capo_ecr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecr.types.complete_layer_upload_request.CompleteLayerUploadRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecr.types.complete_layer_upload_response.CompleteLayerUploadResponse"
    ]:
        import capo_ecr._operations.amazon_ec2_container_registry_v20150921.complete_layer_upload

        (
            output,
            http_response,
        ) = await capo_ecr._operations.amazon_ec2_container_registry_v20150921.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.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