Skip to content

assign_private_nat_gateway_address async

assign_private_nat_gateway_address(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    nat_gateway_id: Optional[NatGatewayId] = None,
    private_ip_addresses: Optional[IpList] = None,
    private_ip_address_count: Optional[PrivateIpAddressCount] = None,
    dry_run: Optional[Boolean] = None,
) -> AssignPrivateNatGatewayAddressResult

Assigns private IPv4 addresses to a private NAT gateway. For more information, see Work with NAT gateways in the Amazon VPC User Guide.

Parameters:

  • nat_gateway_id (Optional[NatGatewayId], default: None ) –

    The ID of the NAT gateway.

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

    The private IPv4 addresses you want to assign to the private NAT gateway.

  • private_ip_address_count (Optional[PrivateIpAddressCount], default: None ) –

    The number of private IP addresses to assign to the NAT gateway. You can't specify this parameter when also specifying private IP addresses.

  • 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 assign_private_nat_gateway_address(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    nat_gateway_id: Optional["capo_ec2.types.nat_gateway_id.NatGatewayId"] = None,
    private_ip_addresses: Optional["capo_ec2.types.ip_list.IpList"] = None,
    private_ip_address_count: Optional[
        "capo_ec2.types.private_ip_address_count.PrivateIpAddressCount"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.assign_private_nat_gateway_address_result.AssignPrivateNatGatewayAddressResult":
    """<p>Assigns private IPv4 addresses to a private NAT gateway. For more information, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateway-working-with.html">Work with NAT gateways</a> in the <i>Amazon VPC User Guide</i>.</p>

    Args:
        nat_gateway_id: <p>The ID of the NAT gateway.</p>
        private_ip_addresses: <p>The private IPv4 addresses you want to assign to the private NAT gateway.</p>
        private_ip_address_count: <p>The number of private IP addresses to assign to the NAT gateway. You can't specify this parameter when also specifying private IP addresses.</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.assign_private_nat_gateway_address_request.AssignPrivateNatGatewayAddressRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.assign_private_nat_gateway_address_result.AssignPrivateNatGatewayAddressResult"
    ]:
        import capo_ec2._operations.amazon_ec2.assign_private_nat_gateway_address

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssignPrivateNatGatewayAddress")
    )
    input_: capo_ec2.types.assign_private_nat_gateway_address_request.AssignPrivateNatGatewayAddressRequest = {}
    if nat_gateway_id is not None:
        input_["nat_gateway_id"] = nat_gateway_id
    if private_ip_addresses is not None:
        input_["private_ip_addresses"] = private_ip_addresses
    if private_ip_address_count is not None:
        input_["private_ip_address_count"] = private_ip_address_count
    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