createUserGroup method

Future<UserGroup> createUserGroup({
  1. required String engine,
  2. required String userGroupId,
  3. List<Tag>? tags,
  4. List<String>? userIds,
})

For Valkey engine version 7.2 onwards and Redis OSS 6.0 to 7.1: Creates a user group. For more information, see Using Role Based Access Control (RBAC)

May throw DefaultUserRequired. May throw DuplicateUserNameFault. May throw InvalidParameterValueException. May throw ServiceLinkedRoleNotFoundFault. May throw TagQuotaPerResourceExceeded. May throw UserGroupAlreadyExistsFault. May throw UserGroupQuotaExceededFault. May throw UserNotFoundFault.

Parameter engine : Sets the engine listed in a user group. The options are valkey or redis.

Parameter userGroupId : The ID of the user group. This value is stored as a lowercase string.

Parameter tags : A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted. Available for Valkey and Redis OSS only.

Parameter userIds : The list of user IDs that belong to the user group.

Implementation

Future<UserGroup> createUserGroup({
  required String engine,
  required String userGroupId,
  List<Tag>? tags,
  List<String>? userIds,
}) async {
  final $request = <String, String>{
    'Engine': engine,
    'UserGroupId': userGroupId,
    if (tags != null)
      if (tags.isEmpty)
        'Tags': ''
      else
        for (var i1 = 0; i1 < tags.length; i1++)
          for (var e3 in tags[i1].toQueryMap().entries)
            'Tags.Tag.${i1 + 1}.${e3.key}': e3.value,
    if (userIds != null)
      if (userIds.isEmpty)
        'UserIds': ''
      else
        for (var i1 = 0; i1 < userIds.length; i1++)
          'UserIds.member.${i1 + 1}': userIds[i1],
  };
  final $result = await _protocol.send(
    $request,
    action: 'CreateUserGroup',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateUserGroupResult',
  );
  return UserGroup.fromXml($result);
}