Skip to content

associate_trunk_interface async

associate_trunk_interface(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    branch_interface_id: Optional[NetworkInterfaceId] = None,
    trunk_interface_id: Optional[NetworkInterfaceId] = None,
    vlan_id: Optional[Integer] = None,
    gre_key: Optional[Integer] = None,
    client_token: Optional[String] = None,
    dry_run: Optional[Boolean] = None,
) -> AssociateTrunkInterfaceResult

Associates a branch network interface with a trunk network interface.

Before you create the association, use CreateNetworkInterface command and set the interface type to trunk. You must also create a network interface for each branch network interface that you want to associate with the trunk network interface.

Parameters:

  • branch_interface_id (Optional[NetworkInterfaceId], default: None ) –

    The ID of the branch network interface.

  • trunk_interface_id (Optional[NetworkInterfaceId], default: None ) –

    The ID of the trunk network interface.

  • vlan_id (Optional[Integer], default: None ) –

    The ID of the VLAN. This applies to the VLAN protocol.

  • gre_key (Optional[Integer], default: None ) –

    The application key. This applies to the GRE protocol.

  • client_token (Optional[String], default: None ) –

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def associate_trunk_interface(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    branch_interface_id: Optional[
        "capo_ec2.types.network_interface_id.NetworkInterfaceId"
    ] = None,
    trunk_interface_id: Optional[
        "capo_ec2.types.network_interface_id.NetworkInterfaceId"
    ] = None,
    vlan_id: Optional["capo_ec2.types.integer.Integer"] = None,
    gre_key: Optional["capo_ec2.types.integer.Integer"] = None,
    client_token: Optional["capo_ec2.types.string.String"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> (
    "capo_ec2.types.associate_trunk_interface_result.AssociateTrunkInterfaceResult"
):
    """<p>Associates a branch network interface with a trunk network interface.</p> <p>Before you create the association, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateNetworkInterface.html">CreateNetworkInterface</a> command and set the interface type to <code>trunk</code>. You must also create a network interface for each branch network interface that you want to associate with the trunk network interface.</p>

    Args:
        branch_interface_id: <p>The ID of the branch network interface.</p>
        trunk_interface_id: <p>The ID of the trunk network interface.</p>
        vlan_id: <p>The ID of the VLAN. This applies to the VLAN protocol.</p>
        gre_key: <p>The application key. This applies to the GRE protocol.</p>
        client_token: <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency</a>.</p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.associate_trunk_interface_request.AssociateTrunkInterfaceRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.associate_trunk_interface_result.AssociateTrunkInterfaceResult"
    ]:
        import capo_ec2._operations.amazon_ec2.associate_trunk_interface

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.associate_trunk_interface.async_associate_trunk_interface(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateTrunkInterface")
    )
    input_: capo_ec2.types.associate_trunk_interface_request.AssociateTrunkInterfaceRequest = {}
    if branch_interface_id is not None:
        input_["branch_interface_id"] = branch_interface_id
    if trunk_interface_id is not None:
        input_["trunk_interface_id"] = trunk_interface_id
    if vlan_id is not None:
        input_["vlan_id"] = vlan_id
    if gre_key is not None:
        input_["gre_key"] = gre_key
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if dry_run is not None:
        input_["dry_run"] = dry_run

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output