batchDeleteImage method
- required List<
ImageIdentifier> imageIds, - required String repositoryName,
- String? registryId,
Deletes a list of specified images within a repository. Images are
specified with either an imageTag
or
imageDigest
.
You can remove a tag from an image by specifying the image's tag in your request. When you remove the last tag from an image, the image is deleted from your repository.
You can completely delete an image (and all of its tags) by specifying the image's digest in your request.
May throw ServerException. May throw InvalidParameterException. May throw RepositoryNotFoundException.
Parameter imageIds
:
A list of image ID references that correspond to images to delete. The
format of the imageIds
reference is imageTag=tag
or imageDigest=digest
.
Parameter repositoryName
:
The repository that contains the image to delete.
Parameter registryId
:
The AWS account ID associated with the registry that contains the image to
delete. If you do not specify a registry, the default registry is assumed.
Implementation
Future<BatchDeleteImageResponse> batchDeleteImage({
required List<ImageIdentifier> imageIds,
required String repositoryName,
String? registryId,
}) async {
ArgumentError.checkNotNull(imageIds, 'imageIds');
ArgumentError.checkNotNull(repositoryName, 'repositoryName');
_s.validateStringLength(
'repositoryName',
repositoryName,
2,
256,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonEC2ContainerRegistry_V20150921.BatchDeleteImage'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'imageIds': imageIds,
'repositoryName': repositoryName,
if (registryId != null) 'registryId': registryId,
},
);
return BatchDeleteImageResponse.fromJson(jsonResponse.body);
}