search method

Future<SearchResponse> search({
  1. required ResourceType resource,
  2. int? maxResults,
  3. String? nextToken,
  4. SearchExpression? searchExpression,
  5. String? sortBy,
  6. SearchSortOrder? sortOrder,
})

Finds Amazon SageMaker resources that match a search query. Matching resources are returned as a list of SearchRecord objects in the response. You can sort the search results by any resource property in a ascending or descending order.

You can query against the following value types: numeric, text, Boolean, and timestamp.

Parameter resource : The name of the Amazon SageMaker resource to search for.

Parameter maxResults : The maximum number of results to return.

Parameter nextToken : If more than MaxResults resources match the specified SearchExpression, the response includes a NextToken. The NextToken can be passed to the next SearchRequest to continue retrieving results.

Parameter searchExpression : A Boolean conditional statement. Resources must satisfy this condition to be included in search results. You must provide at least one subexpression, filter, or nested filter. The maximum number of recursive SubExpressions, NestedFilters, and Filters that can be included in a SearchExpression object is 50.

Parameter sortBy : The name of the resource property used to sort the SearchResults. The default is LastModifiedTime.

Parameter sortOrder : How SearchResults are ordered. Valid values are Ascending or Descending. The default is Descending.

Implementation

Future<SearchResponse> search({
  required ResourceType resource,
  int? maxResults,
  String? nextToken,
  SearchExpression? searchExpression,
  String? sortBy,
  SearchSortOrder? sortOrder,
}) async {
  ArgumentError.checkNotNull(resource, 'resource');
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    8192,
  );
  _s.validateStringLength(
    'sortBy',
    sortBy,
    1,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.Search'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Resource': resource.toValue(),
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (searchExpression != null) 'SearchExpression': searchExpression,
      if (sortBy != null) 'SortBy': sortBy,
      if (sortOrder != null) 'SortOrder': sortOrder.toValue(),
    },
  );

  return SearchResponse.fromJson(jsonResponse.body);
}