Skip to content

Commit d0ddc1b

Browse files
authored
feat(vpc/v2): allow setting PN name on VPC creation (#204)
1 parent cfedaab commit d0ddc1b

File tree

6 files changed

+20
-2
lines changed

6 files changed

+20
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ async def list_vp_cs_all(
166166
async def create_vpc(
167167
self,
168168
*,
169+
default_private_network_name: str,
169170
region: Optional[Region] = None,
170171
name: Optional[str] = None,
171172
project_id: Optional[str] = None,
@@ -176,14 +177,15 @@ async def create_vpc(
176177
Create a new VPC in the specified region.
177178
:param region: Region to target. If none is passed will use default region from the config.
178179
:param name: Name for the VPC.
180+
:param default_private_network_name: Name for the VPC's associated default Private Network.
179181
:param project_id: Scaleway Project in which to create the VPC.
180182
:param tags: Tags for the VPC.
181183
:return: :class:`VPC <VPC>`
182184
183185
Usage:
184186
::
185187
186-
result = await api.create_vpc()
188+
result = await api.create_vpc(default_private_network_name="example")
187189
"""
188190

189191
param_region = validate_path_param(
@@ -195,6 +197,7 @@ async def create_vpc(
195197
f"/vpc/v2/regions/{param_region}/vpcs",
196198
body=marshal_CreateVPCRequest(
197199
CreateVPCRequest(
200+
default_private_network_name=default_private_network_name,
198201
region=region,
199202
name=name or random_name(prefix="vpc"),
200203
project_id=project_id,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ def marshal_CreateVPCRequest(
239239
defaults: ProfileDefaults,
240240
) -> Dict[str, Any]:
241241
return {
242+
"default_private_network_name": request.default_private_network_name,
242243
"name": request.name,
243244
"project_id": request.project_id or defaults.default_project_id,
244245
"tags": request.tags,

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,11 @@ class CreateVPCRequest:
262262
Name for the VPC.
263263
"""
264264

265+
default_private_network_name: str
266+
"""
267+
Name for the VPC's associated default Private Network.
268+
"""
269+
265270
project_id: Optional[str]
266271
"""
267272
Scaleway Project in which to create the VPC.

scaleway/scaleway/vpc/v2/api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ def list_vp_cs_all(
166166
def create_vpc(
167167
self,
168168
*,
169+
default_private_network_name: str,
169170
region: Optional[Region] = None,
170171
name: Optional[str] = None,
171172
project_id: Optional[str] = None,
@@ -176,14 +177,15 @@ def create_vpc(
176177
Create a new VPC in the specified region.
177178
:param region: Region to target. If none is passed will use default region from the config.
178179
:param name: Name for the VPC.
180+
:param default_private_network_name: Name for the VPC's associated default Private Network.
179181
:param project_id: Scaleway Project in which to create the VPC.
180182
:param tags: Tags for the VPC.
181183
:return: :class:`VPC <VPC>`
182184
183185
Usage:
184186
::
185187
186-
result = api.create_vpc()
188+
result = api.create_vpc(default_private_network_name="example")
187189
"""
188190

189191
param_region = validate_path_param(
@@ -195,6 +197,7 @@ def create_vpc(
195197
f"/vpc/v2/regions/{param_region}/vpcs",
196198
body=marshal_CreateVPCRequest(
197199
CreateVPCRequest(
200+
default_private_network_name=default_private_network_name,
198201
region=region,
199202
name=name or random_name(prefix="vpc"),
200203
project_id=project_id,

scaleway/scaleway/vpc/v2/marshalling.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ def marshal_CreateVPCRequest(
239239
defaults: ProfileDefaults,
240240
) -> Dict[str, Any]:
241241
return {
242+
"default_private_network_name": request.default_private_network_name,
242243
"name": request.name,
243244
"project_id": request.project_id or defaults.default_project_id,
244245
"tags": request.tags,

scaleway/scaleway/vpc/v2/types.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,11 @@ class CreateVPCRequest:
262262
Name for the VPC.
263263
"""
264264

265+
default_private_network_name: str
266+
"""
267+
Name for the VPC's associated default Private Network.
268+
"""
269+
265270
project_id: Optional[str]
266271
"""
267272
Scaleway Project in which to create the VPC.

0 commit comments

Comments
 (0)