listCollectionGroups method

Future<ListCollectionGroupsResponse> listCollectionGroups({
  1. int? maxResults,
  2. String? nextToken,
})

Returns a list of collection groups. For more information, see Creating and managing Amazon OpenSearch Serverless collections.

May throw InternalServerException. May throw ValidationException.

Parameter maxResults : The maximum number of results to return. Default is 20. You can use nextToken to get the next page of results.

Parameter nextToken : If your initial ListCollectionGroups operation returns a nextToken, you can include the returned nextToken in subsequent ListCollectionGroups operations, which returns results in the next page.

Implementation

Future<ListCollectionGroupsResponse> listCollectionGroups({
  int? maxResults,
  String? nextToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'OpenSearchServerless.ListCollectionGroups'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return ListCollectionGroupsResponse.fromJson(jsonResponse.body);
}