listImages method

Future<ListImagesResponse> listImages({
  1. required String repositoryName,
  2. ListImagesFilter? filter,
  3. int? maxResults,
  4. String? nextToken,
  5. String? registryId,
})

Lists all the image IDs for the specified repository.

You can filter images based on whether or not they are tagged by using the tagStatus filter and specifying either TAGGED, UNTAGGED or ANY. For example, you can filter your results to return only UNTAGGED images and then pipe that result to a BatchDeleteImage operation to delete them. Or, you can filter your results to return only TAGGED images to list all of the tags in your repository.

May throw ServerException. May throw InvalidParameterException. May throw RepositoryNotFoundException.

Parameter repositoryName : The repository with image IDs to be listed.

Parameter filter : The filter key and value with which to filter your ListImages results.

Parameter maxResults : The maximum number of image results returned by ListImages in paginated output. When this parameter is used, ListImages only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListImages request with the returned nextToken value. This value can be between 1 and 1000. If this parameter is not used, then ListImages returns up to 100 results and a nextToken value, if applicable.

Parameter nextToken : The nextToken value returned from a previous paginated ListImages request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.

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

Implementation

Future<ListImagesResponse> listImages({
  required String repositoryName,
  ListImagesFilter? filter,
  int? maxResults,
  String? nextToken,
  String? registryId,
}) async {
  ArgumentError.checkNotNull(repositoryName, 'repositoryName');
  _s.validateStringLength(
    'repositoryName',
    repositoryName,
    2,
    256,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonEC2ContainerRegistry_V20150921.ListImages'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'repositoryName': repositoryName,
      if (filter != null) 'filter': filter,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (registryId != null) 'registryId': registryId,
    },
  );

  return ListImagesResponse.fromJson(jsonResponse.body);
}