createGateway method

Future<CreateGatewayOutput> createGateway({
  1. required String activationKey,
  2. required String gatewayDisplayName,
  3. required GatewayType gatewayType,
  4. List<Tag>? tags,
})

Creates a backup gateway. After you create a gateway, you can associate it with a server using the AssociateGatewayToServer operation.

Parameter activationKey : The activation key of the created gateway.

Parameter gatewayDisplayName : The display name of the created gateway.

Parameter gatewayType : The type of created gateway.

Parameter tags : A list of up to 50 tags to assign to the gateway. Each tag is a key-value pair.

Implementation

Future<CreateGatewayOutput> createGateway({
  required String activationKey,
  required String gatewayDisplayName,
  required GatewayType gatewayType,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'BackupOnPremises_v20210101.CreateGateway'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ActivationKey': activationKey,
      'GatewayDisplayName': gatewayDisplayName,
      'GatewayType': gatewayType.value,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateGatewayOutput.fromJson(jsonResponse.body);
}