Skip to content

Commit 23ee549

Browse files
authored
feat(chore): new format (#1639)
1 parent 47992c8 commit 23ee549

6 files changed

Lines changed: 70 additions & 66 deletions

File tree

scaleway-async/scaleway_async/function/v1beta1/api.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,32 +271,34 @@ async def wait_for_namespace(
271271
async def create_namespace(
272272
self,
273273
*,
274+
activate_vpc_integration: bool,
274275
region: Optional[ScwRegion] = None,
275276
name: Optional[str] = None,
276277
environment_variables: Optional[dict[str, str]] = None,
277278
project_id: Optional[str] = None,
278279
description: Optional[str] = None,
279280
secret_environment_variables: Optional[list[Secret]] = None,
280281
tags: Optional[list[str]] = None,
281-
activate_vpc_integration: Optional[bool] = None,
282282
) -> Namespace:
283283
"""
284284
Create a new namespace.
285285
Create a new namespace in a specified Organization or Project.
286+
:param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future.
286287
:param region: Region to target. If none is passed will use default region from the config.
287288
:param name:
288289
:param environment_variables: Environment variables of the namespace.
289290
:param project_id: UUID of the project in which the namespace will be created.
290291
:param description: Description of the namespace.
291292
:param secret_environment_variables: Secret environment variables of the namespace.
292293
:param tags: Tags of the Serverless Function Namespace.
293-
:param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future.
294294
:return: :class:`Namespace <Namespace>`
295295
296296
Usage:
297297
::
298298
299-
result = await api.create_namespace()
299+
result = await api.create_namespace(
300+
activate_vpc_integration=False,
301+
)
300302
"""
301303

302304
param_region = validate_path_param(
@@ -308,14 +310,14 @@ async def create_namespace(
308310
f"/functions/v1beta1/regions/{param_region}/namespaces",
309311
body=marshal_CreateNamespaceRequest(
310312
CreateNamespaceRequest(
313+
activate_vpc_integration=activate_vpc_integration,
311314
region=region,
312315
name=name or random_name(prefix="ns"),
313316
environment_variables=environment_variables,
314317
project_id=project_id,
315318
description=description,
316319
secret_environment_variables=secret_environment_variables,
317320
tags=tags,
318-
activate_vpc_integration=activate_vpc_integration,
319321
),
320322
self.client,
321323
),

scaleway-async/scaleway_async/function/v1beta1/marshalling.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,12 @@ def unmarshal_Namespace(data: Any) -> Namespace:
437437
else:
438438
args["tags"] = []
439439

440+
field = data.get("vpc_integration_activated", None)
441+
if field is not None:
442+
args["vpc_integration_activated"] = field
443+
else:
444+
args["vpc_integration_activated"] = False
445+
440446
field = data.get("description", None)
441447
if field is not None:
442448
args["description"] = field
@@ -455,12 +461,6 @@ def unmarshal_Namespace(data: Any) -> Namespace:
455461
else:
456462
args["updated_at"] = None
457463

458-
field = data.get("vpc_integration_activated", None)
459-
if field is not None:
460-
args["vpc_integration_activated"] = field
461-
else:
462-
args["vpc_integration_activated"] = False
463-
464464
return Namespace(**args)
465465

466466

@@ -484,6 +484,12 @@ def unmarshal_Token(data: Any) -> Token:
484484
else:
485485
args["token"] = None
486486

487+
field = data.get("public_key", None)
488+
if field is not None:
489+
args["public_key"] = field
490+
else:
491+
args["public_key"] = None
492+
487493
field = data.get("status", None)
488494
if field is not None:
489495
args["status"] = field
@@ -502,12 +508,6 @@ def unmarshal_Token(data: Any) -> Token:
502508
else:
503509
args["namespace_id"] = None
504510

505-
field = data.get("public_key", None)
506-
if field is not None:
507-
args["public_key"] = field
508-
else:
509-
args["public_key"] = None
510-
511511
field = data.get("description", None)
512512
if field is not None:
513513
args["description"] = field
@@ -1114,6 +1114,9 @@ def marshal_CreateNamespaceRequest(
11141114
) -> dict[str, Any]:
11151115
output: dict[str, Any] = {}
11161116

1117+
if request.activate_vpc_integration is not None:
1118+
output["activate_vpc_integration"] = request.activate_vpc_integration
1119+
11171120
if request.name is not None:
11181121
output["name"] = request.name
11191122

@@ -1137,9 +1140,6 @@ def marshal_CreateNamespaceRequest(
11371140
if request.tags is not None:
11381141
output["tags"] = request.tags
11391142

1140-
if request.activate_vpc_integration is not None:
1141-
output["activate_vpc_integration"] = request.activate_vpc_integration
1142-
11431143
return output
11441144

11451145

scaleway-async/scaleway_async/function/v1beta1/types.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,11 @@ class Namespace:
628628
List of tags applied to the Serverless Function Namespace.
629629
"""
630630

631+
vpc_integration_activated: bool
632+
"""
633+
The value of this field doesn't matter anymore, and will be removed in a near future.
634+
"""
635+
631636
error_message: Optional[str] = None
632637
"""
633638
Error message if the namespace is in "error" state.
@@ -648,11 +653,6 @@ class Namespace:
648653
Last update date of the namespace.
649654
"""
650655

651-
vpc_integration_activated: Optional[bool] = False
652-
"""
653-
The value of this field doesn't matter anymore, and will be removed in a near future.
654-
"""
655-
656656

657657
@dataclass
658658
class Token:
@@ -666,14 +666,14 @@ class Token:
666666
String of the token.
667667
"""
668668

669-
status: TokenStatus
669+
public_key: str
670670
"""
671-
Status of the token.
671+
Public key of the token.
672672
"""
673673

674-
public_key: Optional[str] = None
674+
status: TokenStatus
675675
"""
676-
Public key of the token.
676+
Status of the token.
677677
"""
678678

679679
description: Optional[str] = None
@@ -875,6 +875,11 @@ class CreateFunctionRequest:
875875

876876
@dataclass
877877
class CreateNamespaceRequest:
878+
activate_vpc_integration: bool
879+
"""
880+
Setting this field to true doesn't matter anymore. It will be removed in a near future.
881+
"""
882+
878883
region: Optional[ScwRegion] = None
879884
"""
880885
Region to target. If none is passed will use default region from the config.
@@ -906,11 +911,6 @@ class CreateNamespaceRequest:
906911
Tags of the Serverless Function Namespace.
907912
"""
908913

909-
activate_vpc_integration: Optional[bool] = False
910-
"""
911-
Setting this field to true doesn't matter anymore. It will be removed in a near future.
912-
"""
913-
914914

915915
@dataclass
916916
class CreateTokenRequest:

scaleway/scaleway/function/v1beta1/api.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,32 +269,34 @@ def wait_for_namespace(
269269
def create_namespace(
270270
self,
271271
*,
272+
activate_vpc_integration: bool,
272273
region: Optional[ScwRegion] = None,
273274
name: Optional[str] = None,
274275
environment_variables: Optional[dict[str, str]] = None,
275276
project_id: Optional[str] = None,
276277
description: Optional[str] = None,
277278
secret_environment_variables: Optional[list[Secret]] = None,
278279
tags: Optional[list[str]] = None,
279-
activate_vpc_integration: Optional[bool] = None,
280280
) -> Namespace:
281281
"""
282282
Create a new namespace.
283283
Create a new namespace in a specified Organization or Project.
284+
:param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future.
284285
:param region: Region to target. If none is passed will use default region from the config.
285286
:param name:
286287
:param environment_variables: Environment variables of the namespace.
287288
:param project_id: UUID of the project in which the namespace will be created.
288289
:param description: Description of the namespace.
289290
:param secret_environment_variables: Secret environment variables of the namespace.
290291
:param tags: Tags of the Serverless Function Namespace.
291-
:param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future.
292292
:return: :class:`Namespace <Namespace>`
293293
294294
Usage:
295295
::
296296
297-
result = api.create_namespace()
297+
result = api.create_namespace(
298+
activate_vpc_integration=False,
299+
)
298300
"""
299301

300302
param_region = validate_path_param(
@@ -306,14 +308,14 @@ def create_namespace(
306308
f"/functions/v1beta1/regions/{param_region}/namespaces",
307309
body=marshal_CreateNamespaceRequest(
308310
CreateNamespaceRequest(
311+
activate_vpc_integration=activate_vpc_integration,
309312
region=region,
310313
name=name or random_name(prefix="ns"),
311314
environment_variables=environment_variables,
312315
project_id=project_id,
313316
description=description,
314317
secret_environment_variables=secret_environment_variables,
315318
tags=tags,
316-
activate_vpc_integration=activate_vpc_integration,
317319
),
318320
self.client,
319321
),

scaleway/scaleway/function/v1beta1/marshalling.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,12 @@ def unmarshal_Namespace(data: Any) -> Namespace:
437437
else:
438438
args["tags"] = []
439439

440+
field = data.get("vpc_integration_activated", None)
441+
if field is not None:
442+
args["vpc_integration_activated"] = field
443+
else:
444+
args["vpc_integration_activated"] = False
445+
440446
field = data.get("description", None)
441447
if field is not None:
442448
args["description"] = field
@@ -455,12 +461,6 @@ def unmarshal_Namespace(data: Any) -> Namespace:
455461
else:
456462
args["updated_at"] = None
457463

458-
field = data.get("vpc_integration_activated", None)
459-
if field is not None:
460-
args["vpc_integration_activated"] = field
461-
else:
462-
args["vpc_integration_activated"] = False
463-
464464
return Namespace(**args)
465465

466466

@@ -484,6 +484,12 @@ def unmarshal_Token(data: Any) -> Token:
484484
else:
485485
args["token"] = None
486486

487+
field = data.get("public_key", None)
488+
if field is not None:
489+
args["public_key"] = field
490+
else:
491+
args["public_key"] = None
492+
487493
field = data.get("status", None)
488494
if field is not None:
489495
args["status"] = field
@@ -502,12 +508,6 @@ def unmarshal_Token(data: Any) -> Token:
502508
else:
503509
args["namespace_id"] = None
504510

505-
field = data.get("public_key", None)
506-
if field is not None:
507-
args["public_key"] = field
508-
else:
509-
args["public_key"] = None
510-
511511
field = data.get("description", None)
512512
if field is not None:
513513
args["description"] = field
@@ -1114,6 +1114,9 @@ def marshal_CreateNamespaceRequest(
11141114
) -> dict[str, Any]:
11151115
output: dict[str, Any] = {}
11161116

1117+
if request.activate_vpc_integration is not None:
1118+
output["activate_vpc_integration"] = request.activate_vpc_integration
1119+
11171120
if request.name is not None:
11181121
output["name"] = request.name
11191122

@@ -1137,9 +1140,6 @@ def marshal_CreateNamespaceRequest(
11371140
if request.tags is not None:
11381141
output["tags"] = request.tags
11391142

1140-
if request.activate_vpc_integration is not None:
1141-
output["activate_vpc_integration"] = request.activate_vpc_integration
1142-
11431143
return output
11441144

11451145

scaleway/scaleway/function/v1beta1/types.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,11 @@ class Namespace:
628628
List of tags applied to the Serverless Function Namespace.
629629
"""
630630

631+
vpc_integration_activated: bool
632+
"""
633+
The value of this field doesn't matter anymore, and will be removed in a near future.
634+
"""
635+
631636
error_message: Optional[str] = None
632637
"""
633638
Error message if the namespace is in "error" state.
@@ -648,11 +653,6 @@ class Namespace:
648653
Last update date of the namespace.
649654
"""
650655

651-
vpc_integration_activated: Optional[bool] = False
652-
"""
653-
The value of this field doesn't matter anymore, and will be removed in a near future.
654-
"""
655-
656656

657657
@dataclass
658658
class Token:
@@ -666,14 +666,14 @@ class Token:
666666
String of the token.
667667
"""
668668

669-
status: TokenStatus
669+
public_key: str
670670
"""
671-
Status of the token.
671+
Public key of the token.
672672
"""
673673

674-
public_key: Optional[str] = None
674+
status: TokenStatus
675675
"""
676-
Public key of the token.
676+
Status of the token.
677677
"""
678678

679679
description: Optional[str] = None
@@ -875,6 +875,11 @@ class CreateFunctionRequest:
875875

876876
@dataclass
877877
class CreateNamespaceRequest:
878+
activate_vpc_integration: bool
879+
"""
880+
Setting this field to true doesn't matter anymore. It will be removed in a near future.
881+
"""
882+
878883
region: Optional[ScwRegion] = None
879884
"""
880885
Region to target. If none is passed will use default region from the config.
@@ -906,11 +911,6 @@ class CreateNamespaceRequest:
906911
Tags of the Serverless Function Namespace.
907912
"""
908913

909-
activate_vpc_integration: Optional[bool] = False
910-
"""
911-
Setting this field to true doesn't matter anymore. It will be removed in a near future.
912-
"""
913-
914914

915915
@dataclass
916916
class CreateTokenRequest:

0 commit comments

Comments
 (0)