updateImageStorageClass method

Future<UpdateImageStorageClassResponse> updateImageStorageClass({
  1. required ImageIdentifier imageId,
  2. required String repositoryName,
  3. required TargetStorageClass targetStorageClass,
  4. String? registryId,
})

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.

May throw ImageNotFoundException. May throw ImageStorageClassUpdateNotSupportedException. May throw InvalidParameterException. May throw RepositoryNotFoundException. May throw ServerException. May throw ValidationException.

Parameter repositoryName : The name of the repository that contains the image to transition.

Parameter targetStorageClass : The target storage class for the image.

Parameter registryId : 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.

Implementation

Future<UpdateImageStorageClassResponse> updateImageStorageClass({
  required ImageIdentifier imageId,
  required String repositoryName,
  required TargetStorageClass targetStorageClass,
  String? registryId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AmazonEC2ContainerRegistry_V20150921.UpdateImageStorageClass'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'imageId': imageId,
      'repositoryName': repositoryName,
      'targetStorageClass': targetStorageClass.value,
      if (registryId != null) 'registryId': registryId,
    },
  );

  return UpdateImageStorageClassResponse.fromJson(jsonResponse.body);
}