createIpGroup method

Future<CreateIpGroupResult> createIpGroup({
  1. required String groupName,
  2. String? groupDesc,
  3. List<Tag>? tags,
  4. List<IpRuleItem>? userRules,
})

Creates an IP access control group.

An IP access control group provides you with the ability to control the IP addresses from which users are allowed to access their WorkSpaces. To specify the CIDR address ranges, add rules to your IP access control group and then associate the group with your directory. You can add rules when you create the group or at any time using AuthorizeIpRules.

There is a default IP access control group associated with your directory. If you don't associate an IP access control group with your directory, the default group is used. The default group includes a default rule that allows users to access their WorkSpaces from anywhere. You cannot modify the default IP access control group for your directory.

May throw InvalidParameterValuesException. May throw ResourceLimitExceededException. May throw ResourceAlreadyExistsException. May throw ResourceCreationFailedException. May throw AccessDeniedException.

Parameter groupName : The name of the group.

Parameter groupDesc : The description of the group.

Parameter tags : The tags. Each WorkSpaces resource can have a maximum of 50 tags.

Parameter userRules : The rules to add to the group.

Implementation

Future<CreateIpGroupResult> createIpGroup({
  required String groupName,
  String? groupDesc,
  List<Tag>? tags,
  List<IpRuleItem>? userRules,
}) async {
  ArgumentError.checkNotNull(groupName, 'groupName');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkspacesService.CreateIpGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'GroupName': groupName,
      if (groupDesc != null) 'GroupDesc': groupDesc,
      if (tags != null) 'Tags': tags,
      if (userRules != null) 'UserRules': userRules,
    },
  );

  return CreateIpGroupResult.fromJson(jsonResponse.body);
}