batchGetCollection method

Future<BatchGetCollectionResponse> batchGetCollection({
  1. List<String>? ids,
  2. List<String>? names,
})

Returns attributes for one or more collections, including the collection endpoint, the OpenSearch Dashboards endpoint, and FIPS-compliant endpoints. For more information, see Creating and managing Amazon OpenSearch Serverless collections.

May throw InternalServerException. May throw ValidationException.

Parameter ids : A list of collection IDs. You can't provide names and IDs in the same request. The ID is part of the collection endpoint. You can also retrieve it using the ListCollections API.

Parameter names : A list of collection names. You can't provide names and IDs in the same request.

Implementation

Future<BatchGetCollectionResponse> batchGetCollection({
  List<String>? ids,
  List<String>? names,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'OpenSearchServerless.BatchGetCollection'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (ids != null) 'ids': ids,
      if (names != null) 'names': names,
    },
  );

  return BatchGetCollectionResponse.fromJson(jsonResponse.body);
}