Skip to content

update_image_storage_class async

update_image_storage_class(
    repository_name: RepositoryName,
    image_id: ImageIdentifier,
    target_storage_class: TargetStorageClass,
    *,
    config_overrides: Optional[AsyncECRClientConfig] = None,
    registry_id: Optional[RegistryId] = None,
) -> UpdateImageStorageClassResponse

Transitions an image between storage classes. You can transition images from Amazon ECR standard storage class to Amazon ECR archival storage class for long-term storage, or restore archived images back to Amazon ECR standard.

Parameters:

  • registry_id (Optional[RegistryId], default: None ) –

    The Amazon Web Services account ID associated with the registry that contains the image to transition. If you do not specify a registry, the default registry is assumed.

  • repository_name (RepositoryName) –

    The name of the repository that contains the image to transition.

  • target_storage_class (TargetStorageClass) –

    The target storage class for the image.

Raises:

Examples:

To transition an image to Amazon ECR Archive This example transitions an image with a specific digest in the hello-repository repository to Amazon ECR Archive storage for long-term archival.

>>> await client.update_image_storage_class(registry_id='724772093679', repository_name='hello-repository', image_id={'imageDigest': 'sha256:0b1a4e0c81c434fa7928e5c4a2651a521ebabc4ff200c65f7e25b99373efca3b'}, target_storage_class='ARCHIVE')
To restore an archived image to Amazon ECR Standard
This example restores an archived image with a specific digest back to Amazon ECR Standard storage.
>>> await client.update_image_storage_class(registry_id='724772093679', repository_name='hello-repository', image_id={'imageDigest': 'sha256:0b1a4e0c81c434fa7928e5c4a2651a521ebabc4ff200c65f7e25b99373efca3b'}, target_storage_class='STANDARD')
Source code in docs_src/capo_ecr/_services/async_ecr.py
async def update_image_storage_class(
    self,
    repository_name: "capo_ecr.types.repository_name.RepositoryName",
    image_id: "capo_ecr.types.image_identifier.ImageIdentifier",
    target_storage_class: "capo_ecr.types.target_storage_class.TargetStorageClass",
    *,
    config_overrides: Optional[AsyncECRClientConfig] = None,
    registry_id: Optional["capo_ecr.types.registry_id.RegistryId"] = None,
) -> "capo_ecr.types.update_image_storage_class_response.UpdateImageStorageClassResponse":
    """<p>Transitions an image between storage classes. You can transition images from Amazon ECR standard storage class to Amazon ECR archival storage class for long-term storage, or restore archived images back to Amazon ECR standard.</p>

    Args:
        registry_id: <p>The Amazon Web Services account ID associated with the registry that contains the image to transition. If you do not specify a registry, the default registry is assumed.</p>
        repository_name: <p>The name of the repository that contains the image to transition.</p>
        target_storage_class: <p>The target storage class for the image.</p>

    Raises:
        capo_ecr.errors.image_not_found_exception.ImageNotFoundException: <p>The image requested does not exist in the specified repository.</p>
        capo_ecr.errors.image_storage_class_update_not_supported_exception.ImageStorageClassUpdateNotSupportedException: <p>The requested image storage class update is not supported.</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.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.validation_exception.ValidationException: <p>There was an exception validating this request.</p>
        capo_ecr.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To transition an image to Amazon ECR Archive
        This example transitions an image with a specific digest in the hello-repository repository to Amazon ECR Archive storage for long-term archival.

        >>> await client.update_image_storage_class(registry_id='724772093679', repository_name='hello-repository', image_id={'imageDigest': 'sha256:0b1a4e0c81c434fa7928e5c4a2651a521ebabc4ff200c65f7e25b99373efca3b'}, target_storage_class='ARCHIVE')
        To restore an archived image to Amazon ECR Standard
        This example restores an archived image with a specific digest back to Amazon ECR Standard storage.

        >>> await client.update_image_storage_class(registry_id='724772093679', repository_name='hello-repository', image_id={'imageDigest': 'sha256:0b1a4e0c81c434fa7928e5c4a2651a521ebabc4ff200c65f7e25b99373efca3b'}, target_storage_class='STANDARD')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecr.types.update_image_storage_class_request.UpdateImageStorageClassRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecr.types.update_image_storage_class_response.UpdateImageStorageClassResponse"
    ]:
        import capo_ecr._operations.amazon_ec2_container_registry_v20150921.update_image_storage_class

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateImageStorageClass")
    )
    input_: capo_ecr.types.update_image_storage_class_request.UpdateImageStorageClassRequest = {
        "repository_name": repository_name,
        "image_id": image_id,
        "target_storage_class": target_storage_class,
    }
    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