Skip to content

associate_virtual_interface async

associate_virtual_interface(
    virtual_interface_id: VirtualInterfaceId,
    connection_id: ConnectionId,
    *,
    config_overrides: Optional[AsyncDirectConnectClientConfig] = None,
) -> VirtualInterface

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/async_direct_connect.py
async 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[AsyncDirectConnectClientConfig] = 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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_direct_connect.types.associate_virtual_interface_request.AssociateVirtualInterfaceRequest]",
    ) -> AsyncOperationResponse[
        "capo_direct_connect.types.virtual_interface.VirtualInterface"
    ]:
        import capo_direct_connect._operations.overture_service.associate_virtual_interface

        (
            output,
            http_response,
        ) = await capo_direct_connect._operations.overture_service.associate_virtual_interface.async_associate_virtual_interface(
            req.options, req.input
        )
        return AsyncOperationResponse(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 = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output