listProjects method

Future<ListProjectsOutput> listProjects({
  1. DateTime? creationTimeAfter,
  2. DateTime? creationTimeBefore,
  3. int? maxResults,
  4. String? nameContains,
  5. String? nextToken,
  6. ProjectSortBy? sortBy,
  7. ProjectSortOrder? sortOrder,
})

Gets a list of the projects in an AWS account.

Parameter creationTimeAfter : A filter that returns the projects that were created after a specified time.

Parameter creationTimeBefore : A filter that returns the projects that were created before a specified time.

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

Parameter nameContains : A filter that returns the projects whose name contains a specified string.

Parameter nextToken : If the result of the previous ListProjects request was truncated, the response includes a NextToken. To retrieve the next set of projects, use the token in the next request.

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

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

Implementation

Future<ListProjectsOutput> listProjects({
  DateTime? creationTimeAfter,
  DateTime? creationTimeBefore,
  int? maxResults,
  String? nameContains,
  String? nextToken,
  ProjectSortBy? sortBy,
  ProjectSortOrder? sortOrder,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nameContains',
    nameContains,
    1,
    32,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    8192,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListProjects'
  };
  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 (nameContains != null) 'NameContains': nameContains,
      if (nextToken != null) 'NextToken': nextToken,
      if (sortBy != null) 'SortBy': sortBy.toValue(),
      if (sortOrder != null) 'SortOrder': sortOrder.toValue(),
    },
  );

  return ListProjectsOutput.fromJson(jsonResponse.body);
}