createDirectConnectGateway method

Future<CreateDirectConnectGatewayResult> createDirectConnectGateway({
  1. required String directConnectGatewayName,
  2. int? amazonSideAsn,
})

Creates a Direct Connect gateway, which is an intermediate object that enables you to connect a set of virtual interfaces and virtual private gateways. A Direct Connect gateway is global and visible in any AWS Region after it is created. The virtual interfaces and virtual private gateways that are connected through a Direct Connect gateway can be in different AWS Regions. This enables you to connect to a VPC in any Region, regardless of the Region in which the virtual interfaces are located, and pass traffic between them.

May throw DirectConnectServerException. May throw DirectConnectClientException.

Parameter directConnectGatewayName : The name of the Direct Connect gateway.

Parameter amazonSideAsn : The autonomous system number (ASN) for Border Gateway Protocol (BGP) to be configured on the Amazon side of the connection. The ASN must be in the private range of 64,512 to 65,534 or 4,200,000,000 to 4,294,967,294. The default is 64512.

Implementation

Future<CreateDirectConnectGatewayResult> createDirectConnectGateway({
  required String directConnectGatewayName,
  int? amazonSideAsn,
}) async {
  ArgumentError.checkNotNull(
      directConnectGatewayName, 'directConnectGatewayName');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OvertureService.CreateDirectConnectGateway'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'directConnectGatewayName': directConnectGatewayName,
      if (amazonSideAsn != null) 'amazonSideAsn': amazonSideAsn,
    },
  );

  return CreateDirectConnectGatewayResult.fromJson(jsonResponse.body);
}