Skip to content

initiate_layer_upload async

initiate_layer_upload(
    repository_name: RepositoryName,
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    registry_id: Optional[RegistryIdOrAlias] = None,
    repository_type: Optional[RepositoryType] = 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.

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

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 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,
    repository_type: Optional[
        "capo_ecr_public.types.repository_type.RepositoryType"
    ] = 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>
        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>

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