createConnection method

Future<CreateConnectionResponse> createConnection({
  1. required String connectedDeviceId,
  2. required String deviceId,
  3. required String globalNetworkId,
  4. String? connectedLinkId,
  5. String? description,
  6. String? linkId,
  7. List<Tag>? tags,
})

Creates a connection between two devices. The devices can be a physical or virtual appliance that connects to a third-party appliance in a VPC, or a physical appliance that connects to another physical appliance in an on-premises network.

May throw ValidationException. May throw ServiceQuotaExceededException. May throw AccessDeniedException. May throw ConflictException. May throw ThrottlingException. May throw InternalServerException.

Parameter connectedDeviceId : The ID of the second device in the connection.

Parameter deviceId : The ID of the first device in the connection.

Parameter globalNetworkId : The ID of the global network.

Parameter connectedLinkId : The ID of the link for the second device.

Parameter description : A description of the connection.

Length Constraints: Maximum length of 256 characters.

Parameter linkId : The ID of the link for the first device.

Parameter tags : The tags to apply to the resource during creation.

Implementation

Future<CreateConnectionResponse> createConnection({
  required String connectedDeviceId,
  required String deviceId,
  required String globalNetworkId,
  String? connectedLinkId,
  String? description,
  String? linkId,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(connectedDeviceId, 'connectedDeviceId');
  ArgumentError.checkNotNull(deviceId, 'deviceId');
  ArgumentError.checkNotNull(globalNetworkId, 'globalNetworkId');
  final $payload = <String, dynamic>{
    'ConnectedDeviceId': connectedDeviceId,
    'DeviceId': deviceId,
    if (connectedLinkId != null) 'ConnectedLinkId': connectedLinkId,
    if (description != null) 'Description': description,
    if (linkId != null) 'LinkId': linkId,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/global-networks/${Uri.encodeComponent(globalNetworkId)}/connections',
    exceptionFnMap: _exceptionFns,
  );
  return CreateConnectionResponse.fromJson(response);
}