Skip to content

delete_bgp_peer async

delete_bgp_peer(
    *,
    config_overrides: Optional[AsyncDirectConnectClientConfig] = None,
    virtual_interface_id: Optional[VirtualInterfaceId] = None,
    asn: Optional[ASN] = None,
    asn_long: Optional[LongAsn] = None,
    customer_address: Optional[CustomerAddress] = None,
    bgp_peer_id: Optional[BGPPeerId] = None,
) -> DeleteBGPPeerResponse

Deletes the specified BGP peer on the specified virtual interface with the specified customer address and ASN.

You cannot delete the last BGP peer from a virtual interface.

Parameters:

  • virtual_interface_id (Optional[VirtualInterfaceId], default: None ) –

    The ID of the virtual interface.

  • asn (Optional[ASN], default: None ) –

    The autonomous system number (ASN). The valid range is from 1 to 2147483646 for Border Gateway Protocol (BGP) configuration. If you provide a number greater than the maximum, an error is returned. Use asnLong instead.

    • You can use asnLong or asn, but not both. We recommend using asnLong as it supports a greater pool of numbers.

    • If you provide a value in the same API call for both asn and asnLong, the API will only accept the value for asnLong.

    • If you enter a 4-byte ASN for the asn parameter, the API returns an error.

    • If you are using a 2-byte ASN, the API response will include the 2-byte value for both the asn and asnLong fields.

  • asn_long (Optional[LongAsn], default: None ) –

    The long ASN for the BGP peer to be deleted from a Direct Connect virtual interface. The valid range is from 1 to 4294967294 for BGP configuration.

    Note the following limitations when using asnLong:

    • You can use asnLong or asn, but not both. We recommend using asnLong as it supports a greater pool of numbers.

    • asnLong accepts any valid ASN value, regardless if it's 2-byte or 4-byte.

    • When using a 4-byte asnLong, the API response returns 0 for the legacy asn attribute since 4-byte ASN values exceed the maximum supported value of 2,147,483,647.

    • If you are using a 2-byte ASN, the API response will include the 2-byte value for both the asn and asnLong fields.

    • If you provide a value in the same API call for both asn and asnLong, the API will only accept the value for asnLong.

  • customer_address (Optional[CustomerAddress], default: None ) –

    The IP address assigned to the customer interface.

  • bgp_peer_id (Optional[BGPPeerId], default: None ) –

    The ID of the BGP peer.

Raises:

Source code in docs_src/capo_direct_connect/_services/async_direct_connect.py
async def delete_bgp_peer(
    self,
    *,
    config_overrides: Optional[AsyncDirectConnectClientConfig] = None,
    virtual_interface_id: Optional[
        "capo_direct_connect.types.virtual_interface_id.VirtualInterfaceId"
    ] = None,
    asn: Optional["capo_direct_connect.types.asn.ASN"] = None,
    asn_long: Optional["capo_direct_connect.types.long_asn.LongAsn"] = None,
    customer_address: Optional[
        "capo_direct_connect.types.customer_address.CustomerAddress"
    ] = None,
    bgp_peer_id: Optional["capo_direct_connect.types.bgp_peer_id.BGPPeerId"] = None,
) -> "capo_direct_connect.types.delete_bgp_peer_response.DeleteBGPPeerResponse":
    """<p>Deletes the specified BGP peer on the specified virtual interface with the specified customer address and ASN.</p> <p>You cannot delete the last BGP peer from a virtual interface.</p>

    Args:
        virtual_interface_id: <p>The ID of the virtual interface.</p>
        asn: <p>The autonomous system number (ASN). The valid range is from 1 to 2147483646 for Border Gateway Protocol (BGP) configuration. If you provide a number greater than the maximum, an error is returned. Use <code>asnLong</code> instead.</p> <ul> <li> <p>You can use <code>asnLong</code> or <code>asn</code>, but not both. We recommend using <code>asnLong</code> as it supports a greater pool of numbers. </p> </li> <li> <p>If you provide a value in the same API call for both <code>asn</code> and <code>asnLong</code>, the API will only accept the value for <code>asnLong</code>. </p> </li> <li> <p>If you enter a 4-byte ASN for the <code>asn</code> parameter, the API returns an error. </p> </li> <li> <p>If you are using a 2-byte ASN, the API response will include the 2-byte value for both the <code>asn</code> and <code>asnLong</code> fields.</p> </li> </ul>
        asn_long: <p>The long ASN for the BGP peer to be deleted from a Direct Connect virtual interface. The valid range is from 1 to 4294967294 for BGP configuration. </p> <p>Note the following limitations when using <code>asnLong</code>:</p> <ul> <li> <p>You can use <code>asnLong</code> or <code>asn</code>, but not both. We recommend using <code>asnLong</code> as it supports a greater pool of numbers. </p> </li> <li> <p> <code>asnLong</code> accepts any valid ASN value, regardless if it's 2-byte or 4-byte. </p> </li> <li> <p>When using a 4-byte <code>asnLong</code>, the API response returns <code>0</code> for the legacy <code>asn</code> attribute since 4-byte ASN values exceed the maximum supported value of 2,147,483,647.</p> </li> <li> <p>If you are using a 2-byte ASN, the API response will include the 2-byte value for both the <code>asn</code> and <code>asnLong</code> fields.</p> </li> <li> <p>If you provide a value in the same API call for both <code>asn</code> and <code>asnLong</code>, the API will only accept the value for <code>asnLong</code>.</p> </li> </ul>
        customer_address: <p>The IP address assigned to the customer interface.</p>
        bgp_peer_id: <p>The ID of the BGP peer.</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.delete_bgp_peer_request.DeleteBGPPeerRequest]",
    ) -> AsyncOperationResponse[
        "capo_direct_connect.types.delete_bgp_peer_response.DeleteBGPPeerResponse"
    ]:
        import capo_direct_connect._operations.overture_service.delete_bgp_peer

        (
            output,
            http_response,
        ) = await capo_direct_connect._operations.overture_service.delete_bgp_peer.async_delete_bgp_peer(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteBGPPeer")
    )
    input_: capo_direct_connect.types.delete_bgp_peer_request.DeleteBGPPeerRequest = {}
    if virtual_interface_id is not None:
        input_["virtual_interface_id"] = virtual_interface_id
    if asn is not None:
        input_["asn"] = asn
    if asn_long is not None:
        input_["asn_long"] = asn_long
    if customer_address is not None:
        input_["customer_address"] = customer_address
    if bgp_peer_id is not None:
        input_["bgp_peer_id"] = bgp_peer_id

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