Skip to content

Commit b229730

Browse files
committed
Add documentation and fix lint errors
1 parent 816abfc commit b229730

9 files changed

Lines changed: 87 additions & 3 deletions

File tree

doc/source/cli/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ documentation of these services:
4242
load_balancer
4343
modelarts
4444
nat
45+
privatenat
46+
natv3
4547
obs
4648
rds_v3
4749
sdrs

doc/source/cli/privatenat.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Private Network Address Translation (Private NAT)
2+
=================================================
3+
4+
The Private NAT client is the command-line interface (CLI) for
5+
the Private NAT API.
6+
7+
For help on a specific `natv3` command, enter:
8+
9+
.. code-block:: console
10+
11+
$ openstack natv3 help SUBCOMMAND
12+
13+
.. _private_gateway:
14+
15+
Private NAT Gateway Operations
16+
------------------------------
17+
18+
.. autoprogram-cliff:: openstack.nat.v3
19+
:command: natv3 private gateway *

doc/source/sdk/proxies/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Service Proxies
2929
MapReduce Service (MRS) <mrs>
3030
Modelarts Service (ModelArts) <modelarts>
3131
Network Address Translation (NAT) <nat>
32+
Private Network Address Translation (Private NAT) <privatenat>
3233
Object Block Storage (OBS) <obs>
3334
Relational Database Service RDS V1 (RDSv1) <rds_v1>
3435
Relational Database Service RDS V3 (RDS) <rds_v3>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Private NAT API
2+
===============
3+
4+
.. automodule:: otcextensions.sdk.natv3.v3._proxy
5+
6+
The Private NAT high-level interface
7+
------------------------------------
8+
9+
The private NAT high-level interface is available through the ``natv3``
10+
member of a :class:`~openstack.connection.Connection` object. The
11+
``natv3`` member will only be added if the
12+
``otcextensions.sdk.register_otc_extensions(conn)`` method is called.
13+
14+
Private NAT Gateway Operations
15+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
17+
.. autoclass:: otcextensions.sdk.natv3.v3._proxy.Proxy
18+
:noindex:
19+
:members: private_nat_gateways

doc/source/sdk/resources/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Open Telekom Cloud Resources
3030
MapReduce Service (MRS) <mrs/index>
3131
ModelArts Service (MA) <modelarts/index>
3232
Network Address Translation (NAT) <nat/index>
33+
Private Network Address Translation (Private NAT) <privatenat/index>
3334
Object Block Storage (OBS) <obs/index>
3435
Relational Database Service (RDS) <rds/index>
3536
Shared File System Turbo (SFS Turbo) <sfsturbo/index>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Private NAT Resources
2+
=====================
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
7+
v3/private_gateway
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
otcextensions.sdk.natv3.v3.gateway
2+
===============================
3+
4+
.. automodule:: otcextensions.sdk.natv3.v3.gateway
5+
6+
The Private NAT Gateway Class
7+
-----------------------------
8+
9+
The ``PrivateNatGateway`` class inherits from
10+
:class:`~openstack.resource.Resource`.
11+
12+
.. autoclass:: otcextensions.sdk.natv3.v3.gateway.PrivateNatGateway
13+
:members:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
3+
# not use this file except in compliance with the License. You may obtain
4+
# a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
# License for the specific language governing permissions and limitations
12+
# under the License.
13+
"""
14+
List all Private NAT Gateways
15+
"""
16+
import openstack
17+
18+
19+
openstack.enable_logging(True)
20+
conn = openstack.connect(cloud='otc')
21+
22+
for gateway in conn.natv3.private_nat_gateways():
23+
print(gateway)

otcextensions/sdk/natv3/v3/gateway.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class DownlinkVpc(resource.Resource):
2424
ngport_ip_address = resource.Body('ngport_ip_address')
2525

2626

27-
2827
class Tag(resource.Resource):
2928
#: Specifies the tag key. Up to 128 Unicode characters. Cannot be blank.
3029
key = resource.Body('key')
@@ -68,7 +67,8 @@ class PrivateNatGateway(resource.Resource):
6867
#: * vpc_id: Specifies the ID of the VPC.
6968
#: * virsubnet_id: Specifies the ID of the subnet.
7069
#: * ngport_ip_address: Specifies the private IP address of the gateway.
71-
downlink_vpcs = resource.Body('downlink_vpcs', type=list, list_type=DownlinkVpc)
70+
downlink_vpcs = resource.Body('downlink_vpcs', type=list,
71+
list_type=DownlinkVpc)
7272
#: Specifies the ID of the enterprise project that is associated
7373
#: with the private NAT gateway when the private NAT gateway is created.
7474
enterprise_project_id = resource.Body('enterprise_project_id')
@@ -108,7 +108,6 @@ class PrivateNatGateway(resource.Resource):
108108
updated_at = resource.Body('updated_at')
109109

110110

111-
112111
class PageInfo(resource.Resource):
113112
next_marker = resource.Body('next_marker')
114113
previous_marker = resource.Body('previous_marker')

0 commit comments

Comments
 (0)