Skip to content

Commit 6ac7f6b

Browse files
authored
feat(vpc_gw.v1): document behavior of non-ipam_config flags (#291)
1 parent 80375da commit 6ac7f6b

File tree

6 files changed

+132
-104
lines changed

6 files changed

+132
-104
lines changed

scaleway-async/scaleway_async/vpcgw/v1/api.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,11 @@ async def create_gateway_network(
662662
:param zone: Zone to target. If none is passed will use default zone from the config.
663663
:param gateway_id: Public Gateway to connect.
664664
:param private_network_id: Private Network to connect.
665-
:param enable_masquerade: Defines whether to enable masquerade (dynamic NAT) on this network.
666-
:param enable_dhcp: Defines whether to enable DHCP on this Private Network. Defaults to `true` if either `dhcp_id` or `dhcp` are present. If set to `true`, either `dhcp_id` or `dhcp` must be present.
665+
:param enable_masquerade: Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork.
666+
Note: this setting is ignored when passing `ipam_config`.
667+
:param enable_dhcp: Defines whether to enable DHCP on this Private Network.
668+
Defaults to `true` if either `dhcp_id` or `dhcp` are present. If set to `true`, either `dhcp_id` or `dhcp` must be present.
669+
Note: this setting is ignored when passing `ipam_config`.
667670
:param dhcp_id: ID of an existing DHCP configuration object to use for this GatewayNetwork.
668671
669672
One-of ('ip_config'): at most one of 'dhcp_id', 'dhcp', 'address', 'ipam_config' could be set.
@@ -730,14 +733,18 @@ async def update_gateway_network(
730733
:param zone: Zone to target. If none is passed will use default zone from the config.
731734
:param gateway_network_id: ID of the GatewayNetwork to update.
732735
:param enable_masquerade: Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork.
733-
:param enable_dhcp: Defines whether to enable DHCP on the connected Private Network.
736+
Note: this setting is ignored when passing `ipam_config`.
737+
:param enable_dhcp: Defines whether to enable DHCP on this Private Network.
738+
Defaults to `true` if `dhcp_id` is present. If set to `true`, `dhcp_id` must be present.
739+
Note: this setting is ignored when passing `ipam_config`.
734740
:param dhcp_id: ID of the new DHCP configuration object to use with this GatewayNetwork.
735741
736742
One-of ('ip_config'): at most one of 'dhcp_id', 'address', 'ipam_config' could be set.
737743
:param address: New static IP address.
738744
739745
One-of ('ip_config'): at most one of 'dhcp_id', 'address', 'ipam_config' could be set.
740-
:param ipam_config: New IPAM configuration to use for this GatewayNetwork.
746+
:param ipam_config: Auto-configure the GatewayNetwork using Scaleway's IPAM (IP address management service).
747+
Note: all or none of the GatewayNetworks for a single gateway can use the IPAM. DHCP and IPAM configurations cannot be mixed. Some products may require that the Public Gateway uses the IPAM, to ensure correct functionality.
741748
742749
One-of ('ip_config'): at most one of 'dhcp_id', 'address', 'ipam_config' could be set.
743750
:return: :class:`GatewayNetwork <GatewayNetwork>`

scaleway-async/scaleway_async/vpcgw/v1/marshalling.py

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848

4949

5050
def unmarshal_DHCP(data: Any) -> DHCP:
51-
if not isinstance(data, dict):
51+
if type(data) is not dict:
5252
raise TypeError(
53-
"Unmarshalling the type 'DHCP' failed as data isn't a dictionary."
53+
f"Unmarshalling the type 'DHCP' failed as data isn't a dictionary."
5454
)
5555

5656
args: Dict[str, Any] = {}
@@ -59,7 +59,7 @@ def unmarshal_DHCP(data: Any) -> DHCP:
5959
args["address"] = field
6060

6161
field = data.get("created_at", None)
62-
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
62+
args["created_at"] = parser.isoparse(field) if type(field) is str else field
6363

6464
field = data.get("dns_local_name", None)
6565
args["dns_local_name"] = field
@@ -104,7 +104,7 @@ def unmarshal_DHCP(data: Any) -> DHCP:
104104
args["subnet"] = field
105105

106106
field = data.get("updated_at", None)
107-
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
107+
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
108108

109109
field = data.get("valid_lifetime", None)
110110
args["valid_lifetime"] = field
@@ -116,9 +116,9 @@ def unmarshal_DHCP(data: Any) -> DHCP:
116116

117117

118118
def unmarshal_GatewayNetwork(data: Any) -> GatewayNetwork:
119-
if not isinstance(data, dict):
119+
if type(data) is not dict:
120120
raise TypeError(
121-
"Unmarshalling the type 'GatewayNetwork' failed as data isn't a dictionary."
121+
f"Unmarshalling the type 'GatewayNetwork' failed as data isn't a dictionary."
122122
)
123123

124124
args: Dict[str, Any] = {}
@@ -127,7 +127,7 @@ def unmarshal_GatewayNetwork(data: Any) -> GatewayNetwork:
127127
args["address"] = field
128128

129129
field = data.get("created_at", None)
130-
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
130+
args["created_at"] = parser.isoparse(field) if type(field) is str else field
131131

132132
field = data.get("dhcp", None)
133133
args["dhcp"] = unmarshal_DHCP(field) if field is not None else None
@@ -154,7 +154,7 @@ def unmarshal_GatewayNetwork(data: Any) -> GatewayNetwork:
154154
args["status"] = field
155155

156156
field = data.get("updated_at", None)
157-
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
157+
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
158158

159159
field = data.get("zone", None)
160160
args["zone"] = field
@@ -163,9 +163,9 @@ def unmarshal_GatewayNetwork(data: Any) -> GatewayNetwork:
163163

164164

165165
def unmarshal_GatewayType(data: Any) -> GatewayType:
166-
if not isinstance(data, dict):
166+
if type(data) is not dict:
167167
raise TypeError(
168-
"Unmarshalling the type 'GatewayType' failed as data isn't a dictionary."
168+
f"Unmarshalling the type 'GatewayType' failed as data isn't a dictionary."
169169
)
170170

171171
args: Dict[str, Any] = {}
@@ -183,9 +183,9 @@ def unmarshal_GatewayType(data: Any) -> GatewayType:
183183

184184

185185
def unmarshal_IP(data: Any) -> IP:
186-
if not isinstance(data, dict):
186+
if type(data) is not dict:
187187
raise TypeError(
188-
"Unmarshalling the type 'IP' failed as data isn't a dictionary."
188+
f"Unmarshalling the type 'IP' failed as data isn't a dictionary."
189189
)
190190

191191
args: Dict[str, Any] = {}
@@ -194,7 +194,7 @@ def unmarshal_IP(data: Any) -> IP:
194194
args["address"] = field
195195

196196
field = data.get("created_at", None)
197-
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
197+
args["created_at"] = parser.isoparse(field) if type(field) is str else field
198198

199199
field = data.get("gateway_id", None)
200200
args["gateway_id"] = field
@@ -215,7 +215,7 @@ def unmarshal_IP(data: Any) -> IP:
215215
args["tags"] = field
216216

217217
field = data.get("updated_at", None)
218-
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
218+
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
219219

220220
field = data.get("zone", None)
221221
args["zone"] = field
@@ -224,15 +224,15 @@ def unmarshal_IP(data: Any) -> IP:
224224

225225

226226
def unmarshal_DHCPEntry(data: Any) -> DHCPEntry:
227-
if not isinstance(data, dict):
227+
if type(data) is not dict:
228228
raise TypeError(
229-
"Unmarshalling the type 'DHCPEntry' failed as data isn't a dictionary."
229+
f"Unmarshalling the type 'DHCPEntry' failed as data isn't a dictionary."
230230
)
231231

232232
args: Dict[str, Any] = {}
233233

234234
field = data.get("created_at", None)
235-
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
235+
args["created_at"] = parser.isoparse(field) if type(field) is str else field
236236

237237
field = data.get("gateway_network_id", None)
238238
args["gateway_network_id"] = field
@@ -253,7 +253,7 @@ def unmarshal_DHCPEntry(data: Any) -> DHCPEntry:
253253
args["type_"] = field
254254

255255
field = data.get("updated_at", None)
256-
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
256+
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
257257

258258
field = data.get("zone", None)
259259
args["zone"] = field
@@ -262,9 +262,9 @@ def unmarshal_DHCPEntry(data: Any) -> DHCPEntry:
262262

263263

264264
def unmarshal_Gateway(data: Any) -> Gateway:
265-
if not isinstance(data, dict):
265+
if type(data) is not dict:
266266
raise TypeError(
267-
"Unmarshalling the type 'Gateway' failed as data isn't a dictionary."
267+
f"Unmarshalling the type 'Gateway' failed as data isn't a dictionary."
268268
)
269269

270270
args: Dict[str, Any] = {}
@@ -279,7 +279,7 @@ def unmarshal_Gateway(data: Any) -> Gateway:
279279
args["can_upgrade_to"] = field
280280

281281
field = data.get("created_at", None)
282-
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
282+
args["created_at"] = parser.isoparse(field) if type(field) is str else field
283283

284284
field = data.get("gateway_networks", None)
285285
args["gateway_networks"] = (
@@ -314,7 +314,7 @@ def unmarshal_Gateway(data: Any) -> Gateway:
314314
args["type_"] = unmarshal_GatewayType(field) if field is not None else None
315315

316316
field = data.get("updated_at", None)
317-
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
317+
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
318318

319319
field = data.get("upstream_dns_servers", None)
320320
args["upstream_dns_servers"] = field
@@ -329,15 +329,15 @@ def unmarshal_Gateway(data: Any) -> Gateway:
329329

330330

331331
def unmarshal_PATRule(data: Any) -> PATRule:
332-
if not isinstance(data, dict):
332+
if type(data) is not dict:
333333
raise TypeError(
334-
"Unmarshalling the type 'PATRule' failed as data isn't a dictionary."
334+
f"Unmarshalling the type 'PATRule' failed as data isn't a dictionary."
335335
)
336336

337337
args: Dict[str, Any] = {}
338338

339339
field = data.get("created_at", None)
340-
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
340+
args["created_at"] = parser.isoparse(field) if type(field) is str else field
341341

342342
field = data.get("gateway_id", None)
343343
args["gateway_id"] = field
@@ -358,7 +358,7 @@ def unmarshal_PATRule(data: Any) -> PATRule:
358358
args["public_port"] = field
359359

360360
field = data.get("updated_at", None)
361-
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
361+
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
362362

363363
field = data.get("zone", None)
364364
args["zone"] = field
@@ -367,9 +367,9 @@ def unmarshal_PATRule(data: Any) -> PATRule:
367367

368368

369369
def unmarshal_ListDHCPEntriesResponse(data: Any) -> ListDHCPEntriesResponse:
370-
if not isinstance(data, dict):
370+
if type(data) is not dict:
371371
raise TypeError(
372-
"Unmarshalling the type 'ListDHCPEntriesResponse' failed as data isn't a dictionary."
372+
f"Unmarshalling the type 'ListDHCPEntriesResponse' failed as data isn't a dictionary."
373373
)
374374

375375
args: Dict[str, Any] = {}
@@ -386,9 +386,9 @@ def unmarshal_ListDHCPEntriesResponse(data: Any) -> ListDHCPEntriesResponse:
386386

387387

388388
def unmarshal_ListDHCPsResponse(data: Any) -> ListDHCPsResponse:
389-
if not isinstance(data, dict):
389+
if type(data) is not dict:
390390
raise TypeError(
391-
"Unmarshalling the type 'ListDHCPsResponse' failed as data isn't a dictionary."
391+
f"Unmarshalling the type 'ListDHCPsResponse' failed as data isn't a dictionary."
392392
)
393393

394394
args: Dict[str, Any] = {}
@@ -403,9 +403,9 @@ def unmarshal_ListDHCPsResponse(data: Any) -> ListDHCPsResponse:
403403

404404

405405
def unmarshal_ListGatewayNetworksResponse(data: Any) -> ListGatewayNetworksResponse:
406-
if not isinstance(data, dict):
406+
if type(data) is not dict:
407407
raise TypeError(
408-
"Unmarshalling the type 'ListGatewayNetworksResponse' failed as data isn't a dictionary."
408+
f"Unmarshalling the type 'ListGatewayNetworksResponse' failed as data isn't a dictionary."
409409
)
410410

411411
args: Dict[str, Any] = {}
@@ -422,9 +422,9 @@ def unmarshal_ListGatewayNetworksResponse(data: Any) -> ListGatewayNetworksRespo
422422

423423

424424
def unmarshal_ListGatewayTypesResponse(data: Any) -> ListGatewayTypesResponse:
425-
if not isinstance(data, dict):
425+
if type(data) is not dict:
426426
raise TypeError(
427-
"Unmarshalling the type 'ListGatewayTypesResponse' failed as data isn't a dictionary."
427+
f"Unmarshalling the type 'ListGatewayTypesResponse' failed as data isn't a dictionary."
428428
)
429429

430430
args: Dict[str, Any] = {}
@@ -438,9 +438,9 @@ def unmarshal_ListGatewayTypesResponse(data: Any) -> ListGatewayTypesResponse:
438438

439439

440440
def unmarshal_ListGatewaysResponse(data: Any) -> ListGatewaysResponse:
441-
if not isinstance(data, dict):
441+
if type(data) is not dict:
442442
raise TypeError(
443-
"Unmarshalling the type 'ListGatewaysResponse' failed as data isn't a dictionary."
443+
f"Unmarshalling the type 'ListGatewaysResponse' failed as data isn't a dictionary."
444444
)
445445

446446
args: Dict[str, Any] = {}
@@ -457,9 +457,9 @@ def unmarshal_ListGatewaysResponse(data: Any) -> ListGatewaysResponse:
457457

458458

459459
def unmarshal_ListIPsResponse(data: Any) -> ListIPsResponse:
460-
if not isinstance(data, dict):
460+
if type(data) is not dict:
461461
raise TypeError(
462-
"Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary."
462+
f"Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary."
463463
)
464464

465465
args: Dict[str, Any] = {}
@@ -474,9 +474,9 @@ def unmarshal_ListIPsResponse(data: Any) -> ListIPsResponse:
474474

475475

476476
def unmarshal_ListPATRulesResponse(data: Any) -> ListPATRulesResponse:
477-
if not isinstance(data, dict):
477+
if type(data) is not dict:
478478
raise TypeError(
479-
"Unmarshalling the type 'ListPATRulesResponse' failed as data isn't a dictionary."
479+
f"Unmarshalling the type 'ListPATRulesResponse' failed as data isn't a dictionary."
480480
)
481481

482482
args: Dict[str, Any] = {}
@@ -493,9 +493,9 @@ def unmarshal_ListPATRulesResponse(data: Any) -> ListPATRulesResponse:
493493

494494

495495
def unmarshal_SetDHCPEntriesResponse(data: Any) -> SetDHCPEntriesResponse:
496-
if not isinstance(data, dict):
496+
if type(data) is not dict:
497497
raise TypeError(
498-
"Unmarshalling the type 'SetDHCPEntriesResponse' failed as data isn't a dictionary."
498+
f"Unmarshalling the type 'SetDHCPEntriesResponse' failed as data isn't a dictionary."
499499
)
500500

501501
args: Dict[str, Any] = {}
@@ -509,9 +509,9 @@ def unmarshal_SetDHCPEntriesResponse(data: Any) -> SetDHCPEntriesResponse:
509509

510510

511511
def unmarshal_SetPATRulesResponse(data: Any) -> SetPATRulesResponse:
512-
if not isinstance(data, dict):
512+
if type(data) is not dict:
513513
raise TypeError(
514-
"Unmarshalling the type 'SetPATRulesResponse' failed as data isn't a dictionary."
514+
f"Unmarshalling the type 'SetPATRulesResponse' failed as data isn't a dictionary."
515515
)
516516

517517
args: Dict[str, Any] = {}

scaleway-async/scaleway_async/vpcgw/v1/types.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,12 +1054,15 @@ class CreateGatewayNetworkRequest:
10541054

10551055
enable_masquerade: bool
10561056
"""
1057-
Defines whether to enable masquerade (dynamic NAT) on this network.
1057+
Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork.
1058+
Note: this setting is ignored when passing `ipam_config`.
10581059
"""
10591060

10601061
enable_dhcp: Optional[bool]
10611062
"""
1062-
Defines whether to enable DHCP on this Private Network. Defaults to `true` if either `dhcp_id` or `dhcp` are present. If set to `true`, either `dhcp_id` or `dhcp` must be present.
1063+
Defines whether to enable DHCP on this Private Network.
1064+
Defaults to `true` if either `dhcp_id` or `dhcp` are present. If set to `true`, either `dhcp_id` or `dhcp` must be present.
1065+
Note: this setting is ignored when passing `ipam_config`.
10631066
"""
10641067

10651068
dhcp_id: Optional[str]
@@ -1107,11 +1110,14 @@ class UpdateGatewayNetworkRequest:
11071110
enable_masquerade: Optional[bool]
11081111
"""
11091112
Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork.
1113+
Note: this setting is ignored when passing `ipam_config`.
11101114
"""
11111115

11121116
enable_dhcp: Optional[bool]
11131117
"""
1114-
Defines whether to enable DHCP on the connected Private Network.
1118+
Defines whether to enable DHCP on this Private Network.
1119+
Defaults to `true` if `dhcp_id` is present. If set to `true`, `dhcp_id` must be present.
1120+
Note: this setting is ignored when passing `ipam_config`.
11151121
"""
11161122

11171123
dhcp_id: Optional[str]
@@ -1130,7 +1136,8 @@ class UpdateGatewayNetworkRequest:
11301136

11311137
ipam_config: Optional[IpamConfig]
11321138
"""
1133-
New IPAM configuration to use for this GatewayNetwork.
1139+
Auto-configure the GatewayNetwork using Scaleway's IPAM (IP address management service).
1140+
Note: all or none of the GatewayNetworks for a single gateway can use the IPAM. DHCP and IPAM configurations cannot be mixed. Some products may require that the Public Gateway uses the IPAM, to ensure correct functionality.
11341141
11351142
One-of ('ip_config'): at most one of 'dhcp_id', 'address', 'ipam_config' could be set.
11361143
"""

0 commit comments

Comments
 (0)