createRuleGroupsNamespace method

Future<CreateRuleGroupsNamespaceResponse> createRuleGroupsNamespace({
  1. required Uint8List data,
  2. required String name,
  3. required String workspaceId,
  4. String? clientToken,
  5. Map<String, String>? tags,
})

The CreateRuleGroupsNamespace operation creates a rule groups namespace within a workspace. A rule groups namespace is associated with exactly one rules file. A workspace can have multiple rule groups namespaces. Use this operation only to create new rule groups namespaces. To update an existing rule groups namespace, use PutRuleGroupsNamespace.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter data : The rules file to use in the new namespace.

Contains the base64-encoded version of the YAML rules file.

For details about the rule groups namespace structure, see RuleGroupsNamespaceData.

Parameter name : The name for the new rule groups namespace.

Parameter workspaceId : The ID of the workspace to add the rule groups namespace.

Parameter clientToken : A unique identifier that you can provide to ensure the idempotency of the request. Case-sensitive.

Parameter tags : The list of tag keys and values to associate with the rule groups namespace.

Implementation

Future<CreateRuleGroupsNamespaceResponse> createRuleGroupsNamespace({
  required Uint8List data,
  required String name,
  required String workspaceId,
  String? clientToken,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'data': base64Encode(data),
    'name': name,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/workspaces/${Uri.encodeComponent(workspaceId)}/rulegroupsnamespaces',
    exceptionFnMap: _exceptionFns,
  );
  return CreateRuleGroupsNamespaceResponse.fromJson(response);
}