Skip to content

unassign_private_ip_addresses

unassign_private_ip_addresses(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    ipv4_prefixes: Optional[IpPrefixList] = None,
    network_interface_id: Optional[NetworkInterfaceId] = None,
    private_ip_addresses: Optional[PrivateIpAddressStringList] = None,
) -> None

Unassigns the specified secondary private IP addresses or IPv4 Prefix Delegation prefixes from a network interface.

Parameters:

  • ipv4_prefixes (Optional[IpPrefixList], default: None ) –

    The IPv4 prefixes to unassign from the network interface.

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

    The ID of the network interface.

  • private_ip_addresses (Optional[PrivateIpAddressStringList], default: None ) –

    The secondary private IP addresses to unassign from the network interface. You can specify this option multiple times to unassign more than one IP address.

Raises:

Examples:

To unassign a secondary private IP address from a network interface This example unassigns the specified private IP address from the specified network interface.

>>> client.unassign_private_ip_addresses(network_interface_id='eni-e5aa89a3', private_ip_addresses=['10.0.0.82'])
Source code in docs_src/capo_ec2/_services/ec2.py
def unassign_private_ip_addresses(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    ipv4_prefixes: Optional["capo_ec2.types.ip_prefix_list.IpPrefixList"] = None,
    network_interface_id: Optional[
        "capo_ec2.types.network_interface_id.NetworkInterfaceId"
    ] = None,
    private_ip_addresses: Optional[
        "capo_ec2.types.private_ip_address_string_list.PrivateIpAddressStringList"
    ] = None,
) -> None:
    """<p>Unassigns the specified secondary private IP addresses or IPv4 Prefix Delegation prefixes from a network interface.</p>

    Args:
        ipv4_prefixes: <p>The IPv4 prefixes to unassign from the network interface.</p>
        network_interface_id: <p>The ID of the network interface.</p>
        private_ip_addresses: <p>The secondary private IP addresses to unassign from the network interface. You can specify this option multiple times to unassign more than one IP address.</p>

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

    Examples:
        To unassign a secondary private IP address from a network interface
        This example unassigns the specified private IP address from the specified network interface.

        >>> client.unassign_private_ip_addresses(network_interface_id='eni-e5aa89a3', private_ip_addresses=['10.0.0.82'])
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.unassign_private_ip_addresses_request.UnassignPrivateIpAddressesRequest]",
    ) -> OperationResponse[None]:
        import capo_ec2._operations.amazon_ec2.unassign_private_ip_addresses

        output, http_response = (
            capo_ec2._operations.amazon_ec2.unassign_private_ip_addresses.unassign_private_ip_addresses(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UnassignPrivateIpAddresses")
    )
    input_: capo_ec2.types.unassign_private_ip_addresses_request.UnassignPrivateIpAddressesRequest = {}
    if ipv4_prefixes is not None:
        input_["ipv4_prefixes"] = ipv4_prefixes
    if network_interface_id is not None:
        input_["network_interface_id"] = network_interface_id
    if private_ip_addresses is not None:
        input_["private_ip_addresses"] = private_ip_addresses

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output