Skip to content

initiate_layer_upload async

initiate_layer_upload(
    repository_name: RepositoryName,
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    registry_id: Optional[RegistryIdOrAlias] = None,
) -> InitiateLayerUploadResponse

Notifies Amazon ECR that you intend to upload an image layer.

When an image is pushed, the InitiateLayerUpload API is called once for each image layer that hasn't already been uploaded. Whether an image layer uploads is determined by the BatchCheckLayerAvailability API action.

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, that's associated with the registry to which you intend to upload layers. If you do not specify a registry, the default public registry is assumed.

  • repository_name (RepositoryName) –

    The name of the repository that you want to upload layers to.

Raises:

Source code in docs_src/capo_ecr_public/_services/async_ecrpublic.py
async def initiate_layer_upload(
    self,
    repository_name: "capo_ecr_public.types.repository_name.RepositoryName",
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    registry_id: Optional[
        "capo_ecr_public.types.registry_id_or_alias.RegistryIdOrAlias"
    ] = None,
) -> "capo_ecr_public.types.initiate_layer_upload_response.InitiateLayerUploadResponse":
    """<p>Notifies Amazon ECR that you intend to upload an image layer.</p> <p>When an image is pushed, the InitiateLayerUpload API is called once for each image layer that hasn't already been uploaded. Whether an image layer uploads is determined by the BatchCheckLayerAvailability API action.</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, that's associated with the registry to which you intend to upload layers. If you do not specify a registry, the default public registry is assumed.</p>
        repository_name: <p>The name of the repository that you want to upload layers to.</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.</p>
        capo_ecr_public.errors.unsupported_command_exception.UnsupportedCommandException: <p>The action isn't supported in this 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.initiate_layer_upload_request.InitiateLayerUploadRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecr_public.types.initiate_layer_upload_response.InitiateLayerUploadResponse"
    ]:
        import capo_ecr_public._operations.spencer_frontend_service.initiate_layer_upload

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("InitiateLayerUpload")
    )
    input_: capo_ecr_public.types.initiate_layer_upload_request.InitiateLayerUploadRequest = {
        "repository_name": repository_name
    }
    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