Skip to content

Commit 08f3a40

Browse files
LKaemmerlingVanderson Mota dos Santos
andauthored
Add primary IP support (#160)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de> Co-authored-by: Vanderson Mota dos Santos <vanderson.mota@hetzner-cloud.de>
1 parent fad8707 commit 08f3a40

31 files changed

Lines changed: 1159 additions & 125 deletions

File tree

.github/workflows/unit_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [ 3.6, 3.7, 3.8, 3.9, "3.10.0-beta.1" ]
10+
python-version: [ 3.6, 3.7, 3.8, 3.9, "3.10" ]
1111
name: Python ${{ matrix.python-version }}
1212
steps:
1313
- uses: actions/checkout@v2

docs/api.clients.primary_ips.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
PrimaryIPsClient
2+
==================
3+
4+
5+
.. autoclass:: hcloud.primary_ips.client.PrimaryIPsClient
6+
:members:
7+
8+
.. autoclass:: hcloud.primary_ips.client.BoundPrimaryIP
9+
:members:
10+
11+
.. autoclass:: hcloud.primary_ips.domain.PrimaryIP
12+
:members:
13+

docs/api.clients.servers.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ ServersClient
2323
.. autoclass:: hcloud.servers.domain.CreateServerResponse
2424
:members:
2525

26+
.. autoclass:: hcloud.servers.domain.ServerCreatePublicNetwork
27+
:members:
28+
2629
.. autoclass:: hcloud.servers.domain.ResetPasswordResponse
2730
:members:
2831

docs/conf.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
master_doc = "index"
4848

4949
# General information about the project.
50-
project = u"Hetzner Cloud Python"
51-
copyright = u"2019, Hetzner Cloud GmbH"
52-
author = u"Hetzner Cloud GmbH"
50+
project = "Hetzner Cloud Python"
51+
copyright = "2019, Hetzner Cloud GmbH"
52+
author = "Hetzner Cloud GmbH"
5353

5454
# The version info for the project you're documenting, acts as replacement
5555
# for |version| and |release|, also used in various other places throughout
@@ -93,9 +93,7 @@
9393
# theme further. For a list of options available for each theme, see the
9494
# documentation.
9595
#
96-
html_theme_options = {
97-
"logo_only": True,
98-
}
96+
html_theme_options = {"logo_only": True}
9997

10098
# Add any paths that contain custom static files (such as style sheets) here,
10199
# relative to this directory. They are copied after the builtin static files,
@@ -131,17 +129,17 @@
131129
(
132130
master_doc,
133131
"hcloud.tex",
134-
u"Hetzner Cloud Python Documentation",
135-
u"Hetzner Cloud GmbH",
132+
"Hetzner Cloud Python Documentation",
133+
"Hetzner Cloud GmbH",
136134
"manual",
137-
),
135+
)
138136
]
139137

140138
# -- Options for manual page output ------------------------------------
141139

142140
# One entry per manual page. List of tuples
143141
# (source start file, name, description, authors, manual section).
144-
man_pages = [(master_doc, u"Hetzner Cloud Python Documentation", [author], 1)]
142+
man_pages = [(master_doc, "Hetzner Cloud Python Documentation", [author], 1)]
145143

146144
# -- Options for Texinfo output ----------------------------------------
147145

@@ -151,11 +149,11 @@
151149
texinfo_documents = [
152150
(
153151
master_doc,
154-
u"Hetzner Cloud Python Documentation",
152+
"Hetzner Cloud Python Documentation",
155153
author,
156154
"HCloud-python is a library for the Hetzner Cloud API.",
157155
"Miscellaneous",
158-
),
156+
)
159157
]
160158

161159
source_suffix = [".rst"]

hcloud/certificates/domain.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ class CreateManagedCertificateResponse(BaseDomain):
107107
Shows the progress of the certificate creation
108108
"""
109109

110-
__slots__ = (
111-
"certificate",
112-
"action",
113-
)
110+
__slots__ = ("certificate", "action")
114111

115112
def __init__(
116113
self,

hcloud/core/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def _get_all(
3838
**kwargs
3939
):
4040
# type (...) -> List[BoundModelBase]
41+
4142
page = 1
4243

4344
results = []

hcloud/core/domain.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ class Meta(BaseDomain):
5555

5656
__slots__ = ("pagination",)
5757

58-
def __init__(
59-
self,
60-
pagination=None,
61-
):
58+
def __init__(self, pagination=None):
6259
self.pagination = pagination
6360

6461
@classmethod

hcloud/datacenters/domain.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ class Datacenter(BaseDomain, DomainIdentityMixin):
1212
:param server_types: :class:`DatacenterServerTypes <hcloud.datacenters.domain.DatacenterServerTypes>`
1313
"""
1414

15-
__slots__ = (
16-
"id",
17-
"name",
18-
"description",
19-
"location",
20-
"server_types",
21-
)
15+
__slots__ = ("id", "name", "description", "location", "server_types")
2216

2317
def __init__(
2418
self, id=None, name=None, description=None, location=None, server_types=None

hcloud/firewalls/domain.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ def __init__(
137137
self.label_selector = label_selector
138138

139139
def to_payload(self):
140-
payload = {
141-
"type": self.type,
142-
}
140+
payload = {"type": self.type}
143141
if self.server is not None:
144142
payload.update({"server": {"id": self.server.id}})
145143

hcloud/hcloud.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from hcloud.actions.client import ActionsClient
88
from hcloud.certificates.client import CertificatesClient
99
from hcloud.floating_ips.client import FloatingIPsClient
10+
from hcloud.primary_ips.client import PrimaryIPsClient
1011
from hcloud.networks.client import NetworksClient
1112
from hcloud.isos.client import IsosClient
1213
from hcloud.servers.client import ServersClient
@@ -121,6 +122,11 @@ def __init__(
121122
122123
:type: :class:`FloatingIPsClient <hcloud.floating_ips.client.FloatingIPsClient>`
123124
"""
125+
self.primary_ips = PrimaryIPsClient(self)
126+
"""PrimaryIPsClient Instance
127+
128+
:type: :class:`PrimaryIPsClient <hcloud.primary_ips.client.PrimaryIPsClient>`
129+
"""
124130
self.networks = NetworksClient(self)
125131
"""NetworksClient Instance
126132

0 commit comments

Comments
 (0)