createOdbPeeringConnection method

Future<CreateOdbPeeringConnectionOutput> createOdbPeeringConnection({
  1. required String odbNetworkId,
  2. required String peerNetworkId,
  3. String? clientToken,
  4. String? displayName,
  5. List<String>? peerNetworkCidrsToBeAdded,
  6. List<String>? peerNetworkRouteTableIds,
  7. Map<String, String>? tags,
})

Creates a peering connection between an ODB network and a VPC.

A peering connection enables private connectivity between the networks for application-tier communication.

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

Parameter odbNetworkId : The unique identifier of the ODB network that initiates the peering connection.

Parameter peerNetworkId : The unique identifier of the peer network. This can be either a VPC ID or another ODB network ID.

Parameter clientToken : The client token for the ODB peering connection request.

Constraints:

  • Must be unique for each request.

Parameter displayName : The display name for the ODB peering connection.

Parameter peerNetworkCidrsToBeAdded : A list of CIDR blocks to add to the peering connection. These CIDR blocks define the IP address ranges that can communicate through the peering connection.

Parameter peerNetworkRouteTableIds : The unique identifier of the VPC route table for which a route to the ODB network is automatically created during peering connection establishment.

Parameter tags : The tags to assign to the ODB peering connection.

Implementation

Future<CreateOdbPeeringConnectionOutput> createOdbPeeringConnection({
  required String odbNetworkId,
  required String peerNetworkId,
  String? clientToken,
  String? displayName,
  List<String>? peerNetworkCidrsToBeAdded,
  List<String>? peerNetworkRouteTableIds,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'Odb.CreateOdbPeeringConnection'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'odbNetworkId': odbNetworkId,
      'peerNetworkId': peerNetworkId,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (displayName != null) 'displayName': displayName,
      if (peerNetworkCidrsToBeAdded != null)
        'peerNetworkCidrsToBeAdded': peerNetworkCidrsToBeAdded,
      if (peerNetworkRouteTableIds != null)
        'peerNetworkRouteTableIds': peerNetworkRouteTableIds,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateOdbPeeringConnectionOutput.fromJson(jsonResponse.body);
}