Skip to content

get_download_url_for_layer async

get_download_url_for_layer(
    repository_name: RepositoryName,
    layer_digest: LayerDigest,
    *,
    config_overrides: Optional[AsyncECRClientConfig] = None,
    registry_id: Optional[RegistryId] = None,
) -> GetDownloadUrlForLayerResponse

Retrieves the pre-signed Amazon S3 download URL corresponding to an image layer. You can only get URLs for image layers that are referenced in an image.

When an image is pulled, the GetDownloadUrlForLayer API is called once per image layer that is not already cached.

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 that contains the image layer to download. If you do not specify a registry, the default registry is assumed.

  • repository_name (RepositoryName) –

    The name of the repository that is associated with the image layer to download.

  • layer_digest (LayerDigest) –

    The digest of the image layer to download.

Raises:

  • InvalidParameterException –

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

  • LayerInaccessibleException –

    The specified layer is not available because it is not associated with an image. Unassociated image layers may be cleaned up at any time.

  • LayersNotFoundException –

    The specified layers could not be found, or the specified layer is not valid for this repository.

  • RepositoryNotFoundException –

    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.

  • ServerException –

    These errors are usually caused by a server-side issue.

  • UnableToGetUpstreamLayerException –

    There was an issue getting the upstream layer matching the pull through cache rule.

  • UnknownServiceError –

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

Source code in docs_src/capo_ecr/_services/async_ecr.py
async def get_download_url_for_layer(
    self,
    repository_name: "capo_ecr.types.repository_name.RepositoryName",
    layer_digest: "capo_ecr.types.layer_digest.LayerDigest",
    *,
    config_overrides: Optional[AsyncECRClientConfig] = None,
    registry_id: Optional["capo_ecr.types.registry_id.RegistryId"] = None,
) -> "capo_ecr.types.get_download_url_for_layer_response.GetDownloadUrlForLayerResponse":
    """<p>Retrieves the pre-signed Amazon S3 download URL corresponding to an image layer. You can only get URLs for image layers that are referenced in an image.</p> <p>When an image is pulled, the GetDownloadUrlForLayer API is called once per image layer that is not already cached.</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 that contains the image layer to download. If you do not specify a registry, the default registry is assumed.</p>
        repository_name: <p>The name of the repository that is associated with the image layer to download.</p>
        layer_digest: <p>The digest of the image layer to download.</p>

    Raises:
        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.layer_inaccessible_exception.LayerInaccessibleException: <p>The specified layer is not available because it is not associated with an image. Unassociated image layers may be cleaned up at any time.</p>
        capo_ecr.errors.layers_not_found_exception.LayersNotFoundException: <p>The specified layers could not be found, or the specified layer is not valid for this repository.</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.unable_to_get_upstream_layer_exception.UnableToGetUpstreamLayerException: <p>There was an issue getting the upstream layer matching the pull through cache rule.</p>
        capo_ecr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecr.types.get_download_url_for_layer_request.GetDownloadUrlForLayerRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecr.types.get_download_url_for_layer_response.GetDownloadUrlForLayerResponse"
    ]:
        import capo_ecr._operations.amazon_ec2_container_registry_v20150921.get_download_url_for_layer

        (
            output,
            http_response,
        ) = await capo_ecr._operations.amazon_ec2_container_registry_v20150921.get_download_url_for_layer.async_get_download_url_for_layer(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetDownloadUrlForLayer")
    )
    input_: capo_ecr.types.get_download_url_for_layer_request.GetDownloadUrlForLayerRequest = {
        "repository_name": repository_name,
        "layer_digest": layer_digest,
    }
    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