listImageVersions method

Future<ListImageVersionsResponse> listImageVersions({
  1. required String imageName,
  2. DateTime? creationTimeAfter,
  3. DateTime? creationTimeBefore,
  4. DateTime? lastModifiedTimeAfter,
  5. DateTime? lastModifiedTimeBefore,
  6. int? maxResults,
  7. String? nextToken,
  8. ImageVersionSortBy? sortBy,
  9. ImageVersionSortOrder? sortOrder,
})

Lists the versions of a specified image and their properties. The list can be filtered by creation time or modified time.

May throw ResourceNotFound.

Parameter imageName : The name of the image to list the versions of.

Parameter creationTimeAfter : A filter that returns only versions created on or after the specified time.

Parameter creationTimeBefore : A filter that returns only versions created on or before the specified time.

Parameter lastModifiedTimeAfter : A filter that returns only versions modified on or after the specified time.

Parameter lastModifiedTimeBefore : A filter that returns only versions modified on or before the specified time.

Parameter maxResults : The maximum number of versions to return in the response. The default value is 10.

Parameter nextToken : If the previous call to ListImageVersions didn't return the full set of versions, the call returns a token for getting the next set of versions.

Parameter sortBy : The property used to sort results. The default value is CREATION_TIME.

Parameter sortOrder : The sort order. The default value is DESCENDING.

Implementation

Future<ListImageVersionsResponse> listImageVersions({
  required String imageName,
  DateTime? creationTimeAfter,
  DateTime? creationTimeBefore,
  DateTime? lastModifiedTimeAfter,
  DateTime? lastModifiedTimeBefore,
  int? maxResults,
  String? nextToken,
  ImageVersionSortBy? sortBy,
  ImageVersionSortOrder? sortOrder,
}) async {
  ArgumentError.checkNotNull(imageName, 'imageName');
  _s.validateStringLength(
    'imageName',
    imageName,
    1,
    63,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    8192,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListImageVersions'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ImageName': imageName,
      if (creationTimeAfter != null)
        'CreationTimeAfter': unixTimestampToJson(creationTimeAfter),
      if (creationTimeBefore != null)
        'CreationTimeBefore': unixTimestampToJson(creationTimeBefore),
      if (lastModifiedTimeAfter != null)
        'LastModifiedTimeAfter': unixTimestampToJson(lastModifiedTimeAfter),
      if (lastModifiedTimeBefore != null)
        'LastModifiedTimeBefore': unixTimestampToJson(lastModifiedTimeBefore),
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.toValue(),
      if (sortOrder != null) 'SortOrder': sortOrder.toValue(),
    },
  );

  return ListImageVersionsResponse.fromJson(jsonResponse.body);
}