getLifecyclePolicyPreview method

Future<GetLifecyclePolicyPreviewResponse> getLifecyclePolicyPreview({
  1. required String repositoryName,
  2. LifecyclePolicyPreviewFilter? filter,
  3. List<ImageIdentifier>? imageIds,
  4. int? maxResults,
  5. String? nextToken,
  6. String? registryId,
})

Retrieves the results of the lifecycle policy preview request for the specified repository.

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

Parameter repositoryName : The name of the repository.

Parameter filter : An optional parameter that filters results based on image tag status and all tags, if tagged.

Parameter imageIds : The list of imageIDs to be included.

Parameter maxResults : The maximum number of repository results returned by GetLifecyclePolicyPreviewRequest in
 paginated output. When this parameter is used, GetLifecyclePolicyPreviewRequest 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 GetLifecyclePolicyPreviewRequest request with the returned nextToken
 value. This value can be between 1 and 1000. If this
 parameter is not used, then GetLifecyclePolicyPreviewRequest returns up to
 100 results and a nextToken value, if
 applicable. This option cannot be used when you specify images with imageIds.

Parameter nextToken : The nextToken value returned from a previous paginated
 GetLifecyclePolicyPreviewRequest 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. This option cannot be used when you specify images with imageIds.

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

Implementation

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

  return GetLifecyclePolicyPreviewResponse.fromJson(jsonResponse.body);
}