Skip to content

describe_nat_gateways async

describe_nat_gateways(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    filter: Optional[FilterList] = None,
    max_results: Optional[DescribeNatGatewaysMaxResults] = None,
    nat_gateway_ids: Optional[NatGatewayIdStringList] = None,
    next_token: Optional[String] = None,
) -> DescribeNatGatewaysResult

Describes your NAT gateways. The default is to describe all your NAT gateways. Alternatively, you can specify specific NAT gateway IDs or filter the results to include only the NAT gateways that match specific criteria.

Parameters:

  • 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.

  • filter (Optional[FilterList], default: None ) –

    The filters.

    • nat-gateway-id - The ID of the NAT gateway.

    • state - The state of the NAT gateway (pending | failed | available | deleting | deleted).

    • subnet-id - The ID of the subnet in which the NAT gateway resides.

    • tag - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value.

    • tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.

    • vpc-id - The ID of the VPC in which the NAT gateway resides.

  • max_results (Optional[DescribeNatGatewaysMaxResults], default: None ) –

    The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.

  • nat_gateway_ids (Optional[NatGatewayIdStringList], default: None ) –

    The IDs of the NAT gateways.

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

    The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.

Raises:

Examples:

To describe a NAT gateway This example describes the NAT gateway for the specified VPC.

>>> await client.describe_nat_gateways(filter=[{'Name': 'vpc-id', 'Values': ['vpc-1a2b3c4d']}])
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def describe_nat_gateways(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    filter: Optional["capo_ec2.types.filter_list.FilterList"] = None,
    max_results: Optional[
        "capo_ec2.types.describe_nat_gateways_max_results.DescribeNatGatewaysMaxResults"
    ] = None,
    nat_gateway_ids: Optional[
        "capo_ec2.types.nat_gateway_id_string_list.NatGatewayIdStringList"
    ] = None,
    next_token: Optional["capo_ec2.types.string.String"] = None,
) -> "capo_ec2.types.describe_nat_gateways_result.DescribeNatGatewaysResult":
    """<p>Describes your NAT gateways. The default is to describe all your NAT gateways. Alternatively, you can specify specific NAT gateway IDs or filter the results to include only the NAT gateways that match specific criteria.</p>

    Args:
        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>
        filter: <p>The filters.</p> <ul> <li> <p> <code>nat-gateway-id</code> - The ID of the NAT gateway.</p> </li> <li> <p> <code>state</code> - The state of the NAT gateway (<code>pending</code> | <code>failed</code> | <code>available</code> | <code>deleting</code> | <code>deleted</code>).</p> </li> <li> <p> <code>subnet-id</code> - The ID of the subnet in which the NAT gateway resides.</p> </li> <li> <p> <code>tag</code> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key <code>Owner</code> and the value <code>TeamA</code>, specify <code>tag:Owner</code> for the filter name and <code>TeamA</code> for the filter value.</p> </li> <li> <p> <code>tag-key</code> - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.</p> </li> <li> <p> <code>vpc-id</code> - The ID of the VPC in which the NAT gateway resides.</p> </li> </ul>
        max_results: <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
        nat_gateway_ids: <p>The IDs of the NAT gateways.</p>
        next_token: <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>

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

    Examples:
        To describe a NAT gateway
        This example describes the NAT gateway for the specified VPC.

        >>> await client.describe_nat_gateways(filter=[{'Name': 'vpc-id', 'Values': ['vpc-1a2b3c4d']}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.describe_nat_gateways_request.DescribeNatGatewaysRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.describe_nat_gateways_result.DescribeNatGatewaysResult"
    ]:
        import capo_ec2._operations.amazon_ec2.describe_nat_gateways

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeNatGateways")
    )
    input_: capo_ec2.types.describe_nat_gateways_request.DescribeNatGatewaysRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if filter is not None:
        input_["filter"] = filter
    if max_results is not None:
        input_["max_results"] = max_results
    if nat_gateway_ids is not None:
        input_["nat_gateway_ids"] = nat_gateway_ids
    if next_token is not None:
        input_["next_token"] = next_token

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