createConnection method

Future<Connection> createConnection({
  1. required String bandwidth,
  2. required String connectionName,
  3. required String location,
  4. String? lagId,
  5. String? providerName,
  6. List<Tag>? tags,
})

Creates a connection between a customer network and a specific AWS Direct Connect location.

A connection links your internal network to an AWS Direct Connect location over a standard Ethernet fiber-optic cable. One end of the cable is connected to your router, the other to an AWS Direct Connect router.

To find the locations for your Region, use DescribeLocations.

You can automatically add the new connection to a link aggregation group (LAG) by specifying a LAG ID in the request. This ensures that the new connection is allocated on the same AWS Direct Connect endpoint that hosts the specified LAG. If there are no available ports on the endpoint, the request fails and no connection is created.

May throw DuplicateTagKeysException. May throw TooManyTagsException. May throw DirectConnectServerException. May throw DirectConnectClientException.

Parameter bandwidth : The bandwidth of the connection.

Parameter connectionName : The name of the connection.

Parameter location : The location of the connection.

Parameter lagId : The ID of the LAG.

Parameter providerName : The name of the service provider associated with the requested connection.

Parameter tags : The tags to associate with the lag.

Implementation

Future<Connection> createConnection({
  required String bandwidth,
  required String connectionName,
  required String location,
  String? lagId,
  String? providerName,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(bandwidth, 'bandwidth');
  ArgumentError.checkNotNull(connectionName, 'connectionName');
  ArgumentError.checkNotNull(location, 'location');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OvertureService.CreateConnection'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'bandwidth': bandwidth,
      'connectionName': connectionName,
      'location': location,
      if (lagId != null) 'lagId': lagId,
      if (providerName != null) 'providerName': providerName,
      if (tags != null) 'tags': tags,
    },
  );

  return Connection.fromJson(jsonResponse.body);
}