listModelPackages method

Future<ListModelPackagesOutput> listModelPackages({
  1. DateTime? creationTimeAfter,
  2. DateTime? creationTimeBefore,
  3. int? maxResults,
  4. ModelApprovalStatus? modelApprovalStatus,
  5. String? modelPackageGroupName,
  6. ModelPackageType? modelPackageType,
  7. String? nameContains,
  8. String? nextToken,
  9. ModelPackageSortBy? sortBy,
  10. SortOrder? sortOrder,
})

Lists the model packages that have been created.

Parameter creationTimeAfter : A filter that returns only model packages created after the specified time (timestamp).

Parameter creationTimeBefore : A filter that returns only model packages created before the specified time (timestamp).

Parameter maxResults : The maximum number of model packages to return in the response.

Parameter modelApprovalStatus : A filter that returns only the model packages with the specified approval status.

Parameter modelPackageGroupName : A filter that returns only model versions that belong to the specified model group.

Parameter modelPackageType : A filter that returns onlyl the model packages of the specified type. This can be one of the following values.

  • VERSIONED - List only versioned models.
  • UNVERSIONED - List only unversioined models.
  • BOTH - List both versioned and unversioned models.

Parameter nameContains : A string in the model package name. This filter returns only model packages whose name contains the specified string.

Parameter nextToken : If the response to a previous ListModelPackages request was truncated, the response includes a NextToken. To retrieve the next set of model packages, use the token in the next request.

Parameter sortBy : The parameter by which to sort the results. The default is CreationTime.

Parameter sortOrder : The sort order for the results. The default is Ascending.

Implementation

Future<ListModelPackagesOutput> listModelPackages({
  DateTime? creationTimeAfter,
  DateTime? creationTimeBefore,
  int? maxResults,
  ModelApprovalStatus? modelApprovalStatus,
  String? modelPackageGroupName,
  ModelPackageType? modelPackageType,
  String? nameContains,
  String? nextToken,
  ModelPackageSortBy? sortBy,
  SortOrder? sortOrder,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'modelPackageGroupName',
    modelPackageGroupName,
    1,
    170,
  );
  _s.validateStringLength(
    'nameContains',
    nameContains,
    0,
    63,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    8192,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListModelPackages'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (creationTimeAfter != null)
        'CreationTimeAfter': unixTimestampToJson(creationTimeAfter),
      if (creationTimeBefore != null)
        'CreationTimeBefore': unixTimestampToJson(creationTimeBefore),
      if (maxResults != null) 'MaxResults': maxResults,
      if (modelApprovalStatus != null)
        'ModelApprovalStatus': modelApprovalStatus.toValue(),
      if (modelPackageGroupName != null)
        'ModelPackageGroupName': modelPackageGroupName,
      if (modelPackageType != null)
        'ModelPackageType': modelPackageType.toValue(),
      if (nameContains != null) 'NameContains': nameContains,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.toValue(),
      if (sortOrder != null) 'SortOrder': sortOrder.toValue(),
    },
  );

  return ListModelPackagesOutput.fromJson(jsonResponse.body);
}