createCollectionGroup method
Creates a collection group within OpenSearch Serverless. Collection groups let you manage OpenSearch Compute Units (OCUs) at a group level, with multiple collections sharing the group's capacity limits.
For more information, see Managing collection groups.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ValidationException.
Parameter name :
The name of the collection group.
Parameter standbyReplicas :
Indicates whether standby replicas should be used for a collection group.
Parameter capacityLimits :
The capacity limits for the collection group, in OpenSearch Compute Units
(OCUs). These limits control the maximum and minimum capacity for
collections within the group.
Parameter clientToken :
Unique, case-sensitive identifier to ensure idempotency of the request.
Parameter description :
A description of the collection group.
Parameter generation :
The generation of Amazon OpenSearch Serverless for the collection group.
Valid values are CLASSIC and NEXTGEN.
Parameter tags :
An arbitrary set of tags (key–value pairs) to associate with the
OpenSearch Serverless collection group.
Implementation
Future<CreateCollectionGroupResponse> createCollectionGroup({
required String name,
required StandbyReplicas standbyReplicas,
CollectionGroupCapacityLimits? capacityLimits,
String? clientToken,
String? description,
ServerlessGeneration? generation,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'OpenSearchServerless.CreateCollectionGroup'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'name': name,
'standbyReplicas': standbyReplicas.value,
if (capacityLimits != null) 'capacityLimits': capacityLimits,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (generation != null) 'generation': generation.value,
if (tags != null) 'tags': tags,
},
);
return CreateCollectionGroupResponse.fromJson(jsonResponse.body);
}