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.
Parameters:
-
direct_connect_gateway_id
(DirectConnectGatewayId)
–
The ID of the Direct Connect gateway.
-
gateway_id
(Optional[GatewayIdToAssociate], default:
None
)
–
The ID of the virtual private gateway or transit gateway.
-
add_allowed_prefixes_to_direct_connect_gateway
(Optional[RouteFilterPrefixList], default:
None
)
–
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 Direct Connect User Guide.
-
virtual_gateway_id
(Optional[VirtualGatewayId], default:
None
)
–
The ID of the virtual private gateway.
Raises:
Source code in docs_src/capo_direct_connect/_services/direct_connect.py
| def create_direct_connect_gateway_association(
self,
direct_connect_gateway_id: "capo_direct_connect.types.direct_connect_gateway_id.DirectConnectGatewayId",
*,
config_overrides: Optional[DirectConnectClientConfig] = None,
gateway_id: Optional[
"capo_direct_connect.types.gateway_id_to_associate.GatewayIdToAssociate"
] = None,
add_allowed_prefixes_to_direct_connect_gateway: Optional[
"capo_direct_connect.types.route_filter_prefix_list.RouteFilterPrefixList"
] = None,
virtual_gateway_id: Optional[
"capo_direct_connect.types.virtual_gateway_id.VirtualGatewayId"
] = None,
) -> "capo_direct_connect.types.create_direct_connect_gateway_association_result.CreateDirectConnectGatewayAssociationResult":
"""<p>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.</p>
Args:
direct_connect_gateway_id: <p>The ID of the Direct Connect gateway.</p>
gateway_id: <p>The ID of the virtual private gateway or transit gateway.</p>
add_allowed_prefixes_to_direct_connect_gateway: <p>The Amazon VPC prefixes to advertise to the Direct Connect gateway</p> <p>This parameter is required when you create an association to a transit gateway.</p> <p>For information about how to set the prefixes, see <a href="https://docs.aws.amazon.com/directconnect/latest/UserGuide/multi-account-associate-vgw.html#allowed-prefixes">Allowed Prefixes</a> in the <i>Direct Connect User Guide</i>.</p>
virtual_gateway_id: <p>The ID of the virtual private gateway.</p>
Raises:
capo_direct_connect.errors.direct_connect_client_exception.DirectConnectClientException: <p>One or more parameters are not valid.</p>
capo_direct_connect.errors.direct_connect_server_exception.DirectConnectServerException: <p>A server-side error occurred.</p>
capo_direct_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_direct_connect.types.create_direct_connect_gateway_association_request.CreateDirectConnectGatewayAssociationRequest]",
) -> OperationResponse[
"capo_direct_connect.types.create_direct_connect_gateway_association_result.CreateDirectConnectGatewayAssociationResult"
]:
if req.options.protocol == "awsJson1_1":
import capo_direct_connect._operations.overture_service.aws_json1_1.create_direct_connect_gateway_association
output, http_response = (
capo_direct_connect._operations.overture_service.aws_json1_1.create_direct_connect_gateway_association.create_direct_connect_gateway_association(
req.options, req.input
)
)
elif req.options.protocol == "rpcv2Cbor":
import capo_direct_connect._operations.overture_service.rpcv2_cbor.create_direct_connect_gateway_association
output, http_response = (
capo_direct_connect._operations.overture_service.rpcv2_cbor.create_direct_connect_gateway_association.create_direct_connect_gateway_association(
req.options, req.input
)
)
else:
raise ValueError(f"unknown protocol {req.options.protocol!r}")
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateDirectConnectGatewayAssociation")
)
input_: capo_direct_connect.types.create_direct_connect_gateway_association_request.CreateDirectConnectGatewayAssociationRequest = {
"direct_connect_gateway_id": direct_connect_gateway_id
}
if gateway_id is not None:
input_["gateway_id"] = gateway_id
if add_allowed_prefixes_to_direct_connect_gateway is not None:
input_["add_allowed_prefixes_to_direct_connect_gateway"] = (
add_allowed_prefixes_to_direct_connect_gateway
)
if virtual_gateway_id is not None:
input_["virtual_gateway_id"] = virtual_gateway_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|