Associates a virtual interface with a specified link aggregation group (LAG) or connection. Connectivity to Amazon Web Services is temporarily interrupted as the virtual interface is being migrated. If the target connection or LAG has an associated virtual interface with a conflicting VLAN number or a conflicting IP address, the operation fails.
Virtual interfaces associated with a hosted connection cannot be associated with a LAG; hosted connections must be migrated along with their virtual interfaces using AssociateHostedConnection.
To reassociate a virtual interface to a new connection or LAG, the requester must own either the virtual interface itself or the connection to which the virtual interface is currently associated. Additionally, the requester must own the connection or LAG for the association.
Parameters:
Raises:
Source code in docs_src/capo_direct_connect/_services/direct_connect.py
| def associate_virtual_interface(
self,
virtual_interface_id: "capo_direct_connect.types.virtual_interface_id.VirtualInterfaceId",
connection_id: "capo_direct_connect.types.connection_id.ConnectionId",
*,
config_overrides: Optional[DirectConnectClientConfig] = None,
) -> "capo_direct_connect.types.virtual_interface.VirtualInterface":
"""<p>Associates a virtual interface with a specified link aggregation group (LAG) or connection. Connectivity to Amazon Web Services is temporarily interrupted as the virtual interface is being migrated. If the target connection or LAG has an associated virtual interface with a conflicting VLAN number or a conflicting IP address, the operation fails.</p> <p>Virtual interfaces associated with a hosted connection cannot be associated with a LAG; hosted connections must be migrated along with their virtual interfaces using <a>AssociateHostedConnection</a>.</p> <p>To reassociate a virtual interface to a new connection or LAG, the requester must own either the virtual interface itself or the connection to which the virtual interface is currently associated. Additionally, the requester must own the connection or LAG for the association.</p>
Args:
virtual_interface_id: <p>The ID of the virtual interface.</p>
connection_id: <p>The ID of the LAG or connection.</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.associate_virtual_interface_request.AssociateVirtualInterfaceRequest]",
) -> OperationResponse[
"capo_direct_connect.types.virtual_interface.VirtualInterface"
]:
import capo_direct_connect._operations.overture_service.associate_virtual_interface
output, http_response = (
capo_direct_connect._operations.overture_service.associate_virtual_interface.associate_virtual_interface(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("AssociateVirtualInterface")
)
input_: capo_direct_connect.types.associate_virtual_interface_request.AssociateVirtualInterfaceRequest = {
"virtual_interface_id": virtual_interface_id,
"connection_id": connection_id,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|