Skip to content

Commit 8694722

Browse files
authored
feat(vpc): add new call to enable dhcp on private network (#239)
1 parent be775e6 commit 8694722

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

scaleway-async/scaleway_async/vpc/v2/api.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,40 @@ async def migrate_zonal_private_networks(
647647
self._throw_on_error(res)
648648
return None
649649

650+
async def enable_dhcp(
651+
self,
652+
*,
653+
private_network_id: str,
654+
region: Optional[Region] = None,
655+
) -> PrivateNetwork:
656+
"""
657+
Enable DHCP on a Private Network.
658+
Enable DHCP managed on an existing Private Network. Note that you will not be able to deactivate it afterwards.
659+
:param region: Region to target. If none is passed will use default region from the config.
660+
:param private_network_id: Private Network ID.
661+
:return: :class:`PrivateNetwork <PrivateNetwork>`
662+
663+
Usage:
664+
::
665+
666+
result = await api.enable_dhcp(private_network_id="example")
667+
"""
668+
669+
param_region = validate_path_param(
670+
"region", region or self.client.default_region
671+
)
672+
param_private_network_id = validate_path_param(
673+
"private_network_id", private_network_id
674+
)
675+
676+
res = self._request(
677+
"POST",
678+
f"/vpc/v2/regions/{param_region}/private-networks/{param_private_network_id}/enable-dhcp",
679+
)
680+
681+
self._throw_on_error(res)
682+
return unmarshal_PrivateNetwork(res.json())
683+
650684
async def set_subnets(
651685
self,
652686
*,

scaleway-async/scaleway_async/vpc/v2/types.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,19 @@ class MigrateZonalPrivateNetworksRequest:
499499
"""
500500

501501

502+
@dataclass
503+
class EnableDHCPRequest:
504+
region: Optional[Region]
505+
"""
506+
Region to target. If none is passed will use default region from the config.
507+
"""
508+
509+
private_network_id: str
510+
"""
511+
Private Network ID.
512+
"""
513+
514+
502515
@dataclass
503516
class SetSubnetsRequest:
504517
region: Optional[Region]

scaleway/scaleway/vpc/v2/api.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,40 @@ def migrate_zonal_private_networks(
647647
self._throw_on_error(res)
648648
return None
649649

650+
def enable_dhcp(
651+
self,
652+
*,
653+
private_network_id: str,
654+
region: Optional[Region] = None,
655+
) -> PrivateNetwork:
656+
"""
657+
Enable DHCP on a Private Network.
658+
Enable DHCP managed on an existing Private Network. Note that you will not be able to deactivate it afterwards.
659+
:param region: Region to target. If none is passed will use default region from the config.
660+
:param private_network_id: Private Network ID.
661+
:return: :class:`PrivateNetwork <PrivateNetwork>`
662+
663+
Usage:
664+
::
665+
666+
result = api.enable_dhcp(private_network_id="example")
667+
"""
668+
669+
param_region = validate_path_param(
670+
"region", region or self.client.default_region
671+
)
672+
param_private_network_id = validate_path_param(
673+
"private_network_id", private_network_id
674+
)
675+
676+
res = self._request(
677+
"POST",
678+
f"/vpc/v2/regions/{param_region}/private-networks/{param_private_network_id}/enable-dhcp",
679+
)
680+
681+
self._throw_on_error(res)
682+
return unmarshal_PrivateNetwork(res.json())
683+
650684
def set_subnets(
651685
self,
652686
*,

scaleway/scaleway/vpc/v2/types.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,19 @@ class MigrateZonalPrivateNetworksRequest:
499499
"""
500500

501501

502+
@dataclass
503+
class EnableDHCPRequest:
504+
region: Optional[Region]
505+
"""
506+
Region to target. If none is passed will use default region from the config.
507+
"""
508+
509+
private_network_id: str
510+
"""
511+
Private Network ID.
512+
"""
513+
514+
502515
@dataclass
503516
class SetSubnetsRequest:
504517
region: Optional[Region]

0 commit comments

Comments
 (0)