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, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs) -
create_gateway
(**attrs) Create a new gateway from attributes
-
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 toTrue
, 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
-
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 toTrue
, no exception will be set when attempting to find a nonexistent gateway.
- Returns
One
Gateway
orNone
-
SNAT Rule Operations¶
-
class
otcextensions.sdk.nat.v2._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs) -
create_snat_rule
(**attrs) Create a new SNAT rule from attributes
-
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 toTrue
, 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
-
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, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs) -
create_dnat_rule
(**attrs) Create a new DNAT rule from attributes
-
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 toTrue
, 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
-
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.
-