You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scaleway-async/scaleway_async/ipam/v1/api.py
+132Lines changed: 132 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,12 @@
16
16
from .typesimport (
17
17
ListIPsRequestOrderBy,
18
18
ResourceType,
19
+
AttachIPRequest,
19
20
BookIPRequest,
21
+
CustomResource,
20
22
IP,
21
23
ListIPsResponse,
24
+
MoveIPRequest,
22
25
ReleaseIPSetRequest,
23
26
Reverse,
24
27
Source,
@@ -27,7 +30,9 @@
27
30
from .marshallingimport (
28
31
unmarshal_IP,
29
32
unmarshal_ListIPsResponse,
33
+
marshal_AttachIPRequest,
30
34
marshal_BookIPRequest,
35
+
marshal_MoveIPRequest,
31
36
marshal_ReleaseIPSetRequest,
32
37
marshal_UpdateIPRequest,
33
38
)
@@ -47,6 +52,7 @@ async def book_ip(
47
52
project_id: Optional[str] =None,
48
53
address: Optional[str] =None,
49
54
tags: Optional[List[str]] =None,
55
+
resource: Optional[CustomResource] =None,
50
56
) ->IP:
51
57
"""
52
58
Book a new IP.
@@ -57,6 +63,7 @@ async def book_ip(
57
63
:param project_id: When creating an IP in a Private Network, the Project must match the Private Network's Project.
58
64
:param address: The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail.
59
65
:param tags: Tags for the IP.
66
+
:param resource: Custom resource to attach to the IP being booked. An example of a custom resource is a virtual machine hosted on an Elastic Metal server, or an additional user network interface on an Instance. Do not use this for attaching IP addresses to standard Scaleway resources, as it will fail - instead, see the relevant product API for an equivalent method.
60
67
:return: :class:`IP <IP>`
61
68
62
69
Usage:
@@ -83,6 +90,7 @@ async def book_ip(
83
90
project_id=project_id,
84
91
address=address,
85
92
tags=tags,
93
+
resource=resource,
86
94
),
87
95
self.client,
88
96
),
@@ -408,3 +416,127 @@ async def list_i_ps_all(
408
416
"subnet_id": subnet_id,
409
417
},
410
418
)
419
+
420
+
asyncdefattach_ip(
421
+
self,
422
+
*,
423
+
ip_id: str,
424
+
resource: CustomResource,
425
+
region: Optional[Region] =None,
426
+
) ->IP:
427
+
"""
428
+
Attach existing IP to custom resource.
429
+
Attach an existing IP from a Private Network subnet to a custom, named resource via its MAC address. An example of a custom resource is a virtual machine hosted on an Elastic Metal server, or an additional user network interface on an Instance. Do not use this method for attaching IP addresses to standard Scaleway resources as it will fail - see the relevant product API for an equivalent method.
430
+
:param ip_id: IP ID.
431
+
:param resource: Custom resource to be attached to the IP.
432
+
:param region: Region to target. If none is passed will use default region from the config.
Detach a private IP from a custom resource. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for attaching IP addresses to standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method.
474
+
:param ip_id: IP ID.
475
+
:param region: Region to target. If none is passed will use default region from the config.
Move an existing private IP from one custom resource (e.g. a virtual machine hosted on an Elastic Metal server) to another custom resource. This will detach it from the first resource, and attach it to the second. Do not use this method for moving IP addresses between standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method.
510
+
:param ip_id: IP ID.
511
+
:param region: Region to target. If none is passed will use default region from the config.
512
+
:param resource: Custom resource to be attached to the IP.
When the resource is in a Private Network, a DNS record is available to resolve the resource name.
108
+
"""
109
+
110
+
97
111
@dataclass
98
112
classIP:
99
113
id: str
@@ -157,6 +171,24 @@ class IP:
157
171
"""
158
172
159
173
174
+
@dataclass
175
+
classAttachIPRequest:
176
+
ip_id: str
177
+
"""
178
+
IP ID.
179
+
"""
180
+
181
+
resource: CustomResource
182
+
"""
183
+
Custom resource to be attached to the IP.
184
+
"""
185
+
186
+
region: Optional[Region]
187
+
"""
188
+
Region to target. If none is passed will use default region from the config.
189
+
"""
190
+
191
+
160
192
@dataclass
161
193
classBookIPRequest:
162
194
source: Source
@@ -189,6 +221,24 @@ class BookIPRequest:
189
221
Tags for the IP.
190
222
"""
191
223
224
+
resource: Optional[CustomResource]
225
+
"""
226
+
Custom resource to attach to the IP being booked. An example of a custom resource is a virtual machine hosted on an Elastic Metal server, or an additional user network interface on an Instance. Do not use this for attaching IP addresses to standard Scaleway resources, as it will fail - instead, see the relevant product API for an equivalent method.
227
+
"""
228
+
229
+
230
+
@dataclass
231
+
classDetachIPRequest:
232
+
ip_id: str
233
+
"""
234
+
IP ID.
235
+
"""
236
+
237
+
region: Optional[Region]
238
+
"""
239
+
Region to target. If none is passed will use default region from the config.
240
+
"""
241
+
192
242
193
243
@dataclass
194
244
classGetIPRequest:
@@ -294,6 +344,24 @@ class ListIPsResponse:
294
344
ips: List[IP]
295
345
296
346
347
+
@dataclass
348
+
classMoveIPRequest:
349
+
ip_id: str
350
+
"""
351
+
IP ID.
352
+
"""
353
+
354
+
region: Optional[Region]
355
+
"""
356
+
Region to target. If none is passed will use default region from the config.
0 commit comments