createGatewayGroup method

Future<CreateGatewayGroupResponse> createGatewayGroup({
  1. required String name,
  2. String? clientRequestToken,
  3. String? description,
})

Creates a gateway group with the specified details.

May throw AlreadyExistsException. May throw LimitExceededException.

Parameter name : The name of the gateway group.

Parameter clientRequestToken : A unique, user-specified identifier for the request that ensures idempotency.

Parameter description : The description of the gateway group.

Implementation

Future<CreateGatewayGroupResponse> createGatewayGroup({
  required String name,
  String? clientRequestToken,
  String? description,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    100,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    10,
    150,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    200,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AlexaForBusiness.CreateGatewayGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (description != null) 'Description': description,
    },
  );

  return CreateGatewayGroupResponse.fromJson(jsonResponse.body);
}