deleteRepository method

Future<DeleteRepositoryResponse> deleteRepository({
  1. required String repositoryName,
  2. bool? force,
  3. String? registryId,
})

Deletes a repository. If the repository contains images, you must either delete all images in the repository or use the force option to delete the repository.

May throw ServerException. May throw InvalidParameterException. May throw RepositoryNotFoundException. May throw RepositoryNotEmptyException. May throw KmsException.

Parameter repositoryName : The name of the repository to delete.

Parameter force : If a repository contains images, forces the deletion.

Parameter registryId : The AWS account ID associated with the registry that contains the repository to delete. If you do not specify a registry, the default registry is assumed.

Implementation

Future<DeleteRepositoryResponse> deleteRepository({
  required String repositoryName,
  bool? force,
  String? registryId,
}) async {
  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.DeleteRepository'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'repositoryName': repositoryName,
      if (force != null) 'force': force,
      if (registryId != null) 'registryId': registryId,
    },
  );

  return DeleteRepositoryResponse.fromJson(jsonResponse.body);
}