NAT API

The Network Address Translation Class

The nat high-level interface is available through the nat member of a Connection object. The nat member will only be added if the otcextensions.sdk.register_otc_extensions(conn) method is called.

Gateway Operations

class otcextensions.sdk.nat.v2._proxy.Proxy(session: session.Session, *, service_type: str | None = None, service_name: str | None = None, interface: str | None = None, region_name: str | None = None, endpoint_override: str | None = None, version: str | None = None, auth: plugin.BaseAuthPlugin | None = None, user_agent: str | None = None, connect_retries: int | None = None, logger: logging.Logger | None = None, allow: dict[str, ty.Any] | None = None, additional_headers: collections.abc.MutableMapping[str, str] | None = None, client_name: str | None = None, client_version: str | None = None, allow_version_hack: bool | None = None, global_request_id: str | None = None, min_version: str | None = None, max_version: str | None = None, default_microversion: str | None = None, status_code_retries: int | None = None, retriable_status_codes: list[int] | None = None, raise_exc: bool | None = None, rate_limit: float | None = None, concurrency: int | None = None, connect_retry_delay: float | None = None, status_code_retry_delay: float | None = None, statsd_client: statsd_client.StatsClient | None = None, statsd_prefix: str | None = None, prometheus_counter: prometheus_client.Counter | None = None, prometheus_histogram: prometheus_client.Histogram | None = None, influxdb_config: dict[str, ty.Any] | None = None, influxdb_client: influxdb_client.InfluxDBClient | None = None)
create_gateway(**attrs)

Create a new gateway from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Gateway, comprised of the properties on the Gateway class.

Returns:

The results of the Gateway Creation

Return type:

Gateway

delete_gateway(gateway, ignore_missing=True)

Delete a gateway

Parameters:
  • gateway – The value can be the ID of a NAT Gatway or a Gateway instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the gateway does not exist. When set to True, no exception will be set when attempting to delete a nonexistent gateway.

Returns:

None

gateways(**query)

Return a generator of gateways

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned.

Returns:

A generator of gateway objects.

update_gateway(gateway, **attrs)

Update a gateway

Parameters:
  • gateway – The value can be either the ID of a gateway or a Gateway instance.

  • attrs (dict) – The attributes to update on the gateway represented by gateway.

Returns:

The updated gateway.

Return type:

Gateway

find_gateway(name_or_id, ignore_missing=False)

Find a single gateway

Parameters:
  • name_or_id – The name or ID of a gateway

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the gateway does not exist. When set to True, no exception will be set when attempting to find a nonexistent gateway.

Returns:

One Gateway or None

SNAT Rule Operations

class otcextensions.sdk.nat.v2._proxy.Proxy(session: session.Session, *, service_type: str | None = None, service_name: str | None = None, interface: str | None = None, region_name: str | None = None, endpoint_override: str | None = None, version: str | None = None, auth: plugin.BaseAuthPlugin | None = None, user_agent: str | None = None, connect_retries: int | None = None, logger: logging.Logger | None = None, allow: dict[str, ty.Any] | None = None, additional_headers: collections.abc.MutableMapping[str, str] | None = None, client_name: str | None = None, client_version: str | None = None, allow_version_hack: bool | None = None, global_request_id: str | None = None, min_version: str | None = None, max_version: str | None = None, default_microversion: str | None = None, status_code_retries: int | None = None, retriable_status_codes: list[int] | None = None, raise_exc: bool | None = None, rate_limit: float | None = None, concurrency: int | None = None, connect_retry_delay: float | None = None, status_code_retry_delay: float | None = None, statsd_client: statsd_client.StatsClient | None = None, statsd_prefix: str | None = None, prometheus_counter: prometheus_client.Counter | None = None, prometheus_histogram: prometheus_client.Histogram | None = None, influxdb_config: dict[str, ty.Any] | None = None, influxdb_client: influxdb_client.InfluxDBClient | None = None)
create_snat_rule(**attrs)

Create a new SNAT rule from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Snat, comprised of the properties on the Snat class.

Returns:

The result of Snat rule creation

Return type:

Snat

delete_snat_rule(snat, ignore_missing=True)

Delete a SNAT rule

Parameters:
  • gateway – The value can be the ID of a snat rule or a Snat instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the snat rule does not exist. When set to True, no exception will be set when attempting to delete a nonexistent snat rule.

Returns:

None

get_snat_rule(snat_rule)

Get a single SNAT rule

Parameters:

snat_rule – The value can be the ID of a snat rule or a Snat instance.

Returns:

One Snat

Raises:

ResourceNotFound when no resource can be found.

snat_rules(**query)

Return a generator of SNAT rules

Parameters:

query (dict) – Optional query parameters to be sent to limit the snat rules being returned.

Returns:

A generator of Snat objects.

DNAT Rule Operations

class otcextensions.sdk.nat.v2._proxy.Proxy(session: session.Session, *, service_type: str | None = None, service_name: str | None = None, interface: str | None = None, region_name: str | None = None, endpoint_override: str | None = None, version: str | None = None, auth: plugin.BaseAuthPlugin | None = None, user_agent: str | None = None, connect_retries: int | None = None, logger: logging.Logger | None = None, allow: dict[str, ty.Any] | None = None, additional_headers: collections.abc.MutableMapping[str, str] | None = None, client_name: str | None = None, client_version: str | None = None, allow_version_hack: bool | None = None, global_request_id: str | None = None, min_version: str | None = None, max_version: str | None = None, default_microversion: str | None = None, status_code_retries: int | None = None, retriable_status_codes: list[int] | None = None, raise_exc: bool | None = None, rate_limit: float | None = None, concurrency: int | None = None, connect_retry_delay: float | None = None, status_code_retry_delay: float | None = None, statsd_client: statsd_client.StatsClient | None = None, statsd_prefix: str | None = None, prometheus_counter: prometheus_client.Counter | None = None, prometheus_histogram: prometheus_client.Histogram | None = None, influxdb_config: dict[str, ty.Any] | None = None, influxdb_client: influxdb_client.InfluxDBClient | None = None)
create_dnat_rule(**attrs)

Create a new DNAT rule from attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Dnat, comprised of the properties on the Dnat class.

Returns:

The result of Dnat rule creation.

Return type:

Dnat

delete_dnat_rule(dnat, ignore_missing=True)

Delete a DNAT rule

Parameters:
  • gateway – The value can be the ID of a dnat rule or a Dnat instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the dnat rule does not exist. When set to True, no exception will be set when attempting to delete a nonexistent dnat rule.

Returns:

None

get_dnat_rule(dnat_rule)

Get a single DNAT rule

Parameters:

snat_rule – The value can be the ID of a dnat rule or a Dnat instance.

Returns:

One Dnat

Raises:

ResourceNotFound when no resource can be found.

dnat_rules(**query)

Return a generator of DNAT rules

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned.

Returns:

A generator of Dnat objects.