createDirectConnectGatewayAssociation method

Future<CreateDirectConnectGatewayAssociationResult> createDirectConnectGatewayAssociation(
  1. {required String directConnectGatewayId,
  2. List<RouteFilterPrefix>? addAllowedPrefixesToDirectConnectGateway,
  3. String? gatewayId,
  4. String? virtualGatewayId}
)

Creates an association between a Direct Connect gateway and a virtual private gateway. The virtual private gateway must be attached to a VPC and must not be associated with another Direct Connect gateway.

May throw DirectConnectServerException. May throw DirectConnectClientException.

Parameter directConnectGatewayId : The ID of the Direct Connect gateway.

Parameter addAllowedPrefixesToDirectConnectGateway : The Amazon VPC prefixes to advertise to the Direct Connect gateway

This parameter is required when you create an association to a transit gateway.

For information about how to set the prefixes, see Allowed Prefixes in the AWS Direct Connect User Guide.

Parameter gatewayId : The ID of the virtual private gateway or transit gateway.

Parameter virtualGatewayId : The ID of the virtual private gateway.

Implementation

Future<CreateDirectConnectGatewayAssociationResult>
    createDirectConnectGatewayAssociation({
  required String directConnectGatewayId,
  List<RouteFilterPrefix>? addAllowedPrefixesToDirectConnectGateway,
  String? gatewayId,
  String? virtualGatewayId,
}) async {
  ArgumentError.checkNotNull(
      directConnectGatewayId, 'directConnectGatewayId');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OvertureService.CreateDirectConnectGatewayAssociation'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'directConnectGatewayId': directConnectGatewayId,
      if (addAllowedPrefixesToDirectConnectGateway != null)
        'addAllowedPrefixesToDirectConnectGateway':
            addAllowedPrefixesToDirectConnectGateway,
      if (gatewayId != null) 'gatewayId': gatewayId,
      if (virtualGatewayId != null) 'virtualGatewayId': virtualGatewayId,
    },
  );

  return CreateDirectConnectGatewayAssociationResult.fromJson(
      jsonResponse.body);
}