Skip to content

Commit 0d9c481

Browse files
authored
feat(serverless): add support for tags (#966)
1 parent 317ceab commit 0d9c481

File tree

12 files changed

+144
-20
lines changed

12 files changed

+144
-20
lines changed

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ async def create_namespace(
284284
:param project_id: UUID of the Project in which the namespace will be created.
285285
:param description: Description of the namespace to create.
286286
:param secret_environment_variables: Secret environment variables of the namespace to create.
287-
:param tags: [ALPHA] Tags of the Serverless Container Namespace.
287+
:param tags: Tags of the Serverless Container Namespace.
288288
:return: :class:`Namespace <Namespace>`
289289
290290
Usage:
@@ -335,7 +335,7 @@ async def update_namespace(
335335
:param environment_variables: Environment variables of the namespace to update.
336336
:param description: Description of the namespace to update.
337337
:param secret_environment_variables: Secret environment variables of the namespace to update.
338-
:param tags: [ALPHA] Tags of the Serverless Container Namespace.
338+
:param tags: Tags of the Serverless Container Namespace.
339339
:return: :class:`Namespace <Namespace>`
340340
341341
Usage:
@@ -605,6 +605,7 @@ async def create_container(
605605
local_storage_limit: Optional[int] = None,
606606
scaling_option: Optional[ContainerScalingOption] = None,
607607
health_check: Optional[ContainerHealthCheckSpec] = None,
608+
tags: Optional[List[str]] = None,
608609
) -> Container:
609610
"""
610611
Create a new container.
@@ -635,6 +636,7 @@ async def create_container(
635636
- cpu_usage_threshold: Scale depending on the CPU usage of a container instance.
636637
- memory_usage_threshold: Scale depending on the memory usage of a container instance.
637638
:param health_check: Health check configuration of the container.
639+
:param tags: Tags of the Serverless Container.
638640
:return: :class:`Container <Container>`
639641
640642
Usage:
@@ -676,6 +678,7 @@ async def create_container(
676678
local_storage_limit=local_storage_limit,
677679
scaling_option=scaling_option,
678680
health_check=health_check,
681+
tags=tags,
679682
),
680683
self.client,
681684
),
@@ -708,6 +711,7 @@ async def update_container(
708711
local_storage_limit: Optional[int] = None,
709712
scaling_option: Optional[ContainerScalingOption] = None,
710713
health_check: Optional[ContainerHealthCheckSpec] = None,
714+
tags: Optional[List[str]] = None,
711715
) -> Container:
712716
"""
713717
Update an existing container.
@@ -738,6 +742,7 @@ async def update_container(
738742
- cpu_usage_threshold: Scale depending on the CPU usage of a container instance.
739743
- memory_usage_threshold: Scale depending on the memory usage of a container instance.
740744
:param health_check: Health check configuration of the container.
745+
:param tags: Tags of the Serverless Container.
741746
:return: :class:`Container <Container>`
742747
743748
Usage:
@@ -779,6 +784,7 @@ async def update_container(
779784
local_storage_limit=local_storage_limit,
780785
scaling_option=scaling_option,
781786
health_check=health_check,
787+
tags=tags,
782788
),
783789
self.client,
784790
),

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

+10
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ def unmarshal_Container(data: Any) -> Container:
269269
if field is not None:
270270
args["region"] = field
271271

272+
field = data.get("tags", None)
273+
if field is not None:
274+
args["tags"] = field
275+
272276
field = data.get("scaling_option", None)
273277
if field is not None:
274278
args["scaling_option"] = unmarshal_ContainerScalingOption(field)
@@ -941,6 +945,9 @@ def marshal_CreateContainerRequest(
941945
request.health_check, defaults
942946
)
943947

948+
if request.tags is not None:
949+
output["tags"] = request.tags
950+
944951
return output
945952

946953

@@ -1190,6 +1197,9 @@ def marshal_UpdateContainerRequest(
11901197
request.health_check, defaults
11911198
)
11921199

1200+
if request.tags is not None:
1201+
output["tags"] = request.tags
1202+
11931203
return output
11941204

11951205

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

+18-3
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,11 @@ class Container:
478478
Region in which the container will be deployed.
479479
"""
480480

481+
tags: List[str]
482+
"""
483+
List of tags applied to the Serverless Container.
484+
"""
485+
481486
scaling_option: Optional[ContainerScalingOption]
482487
"""
483488
Possible values:
@@ -627,7 +632,7 @@ class Namespace:
627632

628633
tags: List[str]
629634
"""
630-
[ALPHA] List of tags applied to the Serverless Container Namespace.
635+
List of tags applied to the Serverless Container Namespace.
631636
"""
632637

633638
error_message: Optional[str]
@@ -851,6 +856,11 @@ class CreateContainerRequest:
851856
Health check configuration of the container.
852857
"""
853858

859+
tags: Optional[List[str]]
860+
"""
861+
Tags of the Serverless Container.
862+
"""
863+
854864

855865
@dataclass
856866
class CreateCronRequest:
@@ -932,7 +942,7 @@ class CreateNamespaceRequest:
932942

933943
tags: Optional[List[str]]
934944
"""
935-
[ALPHA] Tags of the Serverless Container Namespace.
945+
Tags of the Serverless Container Namespace.
936946
"""
937947

938948

@@ -1530,6 +1540,11 @@ class UpdateContainerRequest:
15301540
Health check configuration of the container.
15311541
"""
15321542

1543+
tags: Optional[List[str]]
1544+
"""
1545+
Tags of the Serverless Container.
1546+
"""
1547+
15331548

15341549
@dataclass
15351550
class UpdateCronRequest:
@@ -1593,7 +1608,7 @@ class UpdateNamespaceRequest:
15931608

15941609
tags: Optional[List[str]]
15951610
"""
1596-
[ALPHA] Tags of the Serverless Container Namespace.
1611+
Tags of the Serverless Container Namespace.
15971612
"""
15981613

15991614

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ async def create_namespace(
288288
:param project_id: UUID of the project in which the namespace will be created.
289289
:param description: Description of the namespace.
290290
:param secret_environment_variables: Secret environment variables of the namespace.
291-
:param tags: [ALPHA] Tags of the Serverless Function Namespace.
291+
:param tags: Tags of the Serverless Function Namespace.
292292
:return: :class:`Namespace <Namespace>`
293293
294294
Usage:
@@ -339,7 +339,7 @@ async def update_namespace(
339339
:param environment_variables: Environment variables of the namespace.
340340
:param description: Description of the namespace.
341341
:param secret_environment_variables: Secret environment variables of the namespace.
342-
:param tags: [ALPHA] Tags of the Serverless Function Namespace.
342+
:param tags: Tags of the Serverless Function Namespace.
343343
:return: :class:`Namespace <Namespace>`
344344
345345
Usage:
@@ -601,6 +601,7 @@ async def create_function(
601601
secret_environment_variables: Optional[List[Secret]] = None,
602602
http_option: Optional[FunctionHttpOption] = None,
603603
sandbox: Optional[FunctionSandbox] = None,
604+
tags: Optional[List[str]] = None,
604605
) -> Function:
605606
"""
606607
Create a new function.
@@ -622,6 +623,7 @@ async def create_function(
622623
- redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS.
623624
- enabled: Serve both HTTP and HTTPS traffic.
624625
:param sandbox: Execution environment of the function.
626+
:param tags: Tags of the Serverless Function.
625627
:return: :class:`Function <Function>`
626628
627629
Usage:
@@ -656,6 +658,7 @@ async def create_function(
656658
secret_environment_variables=secret_environment_variables,
657659
http_option=http_option,
658660
sandbox=sandbox,
661+
tags=tags,
659662
),
660663
self.client,
661664
),
@@ -682,6 +685,7 @@ async def update_function(
682685
secret_environment_variables: Optional[List[Secret]] = None,
683686
http_option: Optional[FunctionHttpOption] = None,
684687
sandbox: Optional[FunctionSandbox] = None,
688+
tags: Optional[List[str]] = None,
685689
) -> Function:
686690
"""
687691
Update an existing function.
@@ -703,6 +707,7 @@ async def update_function(
703707
- redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS.
704708
- enabled: Serve both HTTP and HTTPS traffic.
705709
:param sandbox: Execution environment of the function.
710+
:param tags: Tags of the Serverless Function.
706711
:return: :class:`Function <Function>`
707712
708713
Usage:
@@ -738,6 +743,7 @@ async def update_function(
738743
secret_environment_variables=secret_environment_variables,
739744
http_option=http_option,
740745
sandbox=sandbox,
746+
tags=tags,
741747
),
742748
self.client,
743749
),

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

+10
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ def unmarshal_Function(data: Any) -> Function:
249249
if field is not None:
250250
args["sandbox"] = field
251251

252+
field = data.get("tags", None)
253+
if field is not None:
254+
args["tags"] = field
255+
252256
field = data.get("created_at", None)
253257
if field is not None:
254258
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
@@ -892,6 +896,9 @@ def marshal_CreateFunctionRequest(
892896
if request.sandbox is not None:
893897
output["sandbox"] = str(request.sandbox)
894898

899+
if request.tags is not None:
900+
output["tags"] = request.tags
901+
895902
return output
896903

897904

@@ -1104,6 +1111,9 @@ def marshal_UpdateFunctionRequest(
11041111
if request.sandbox is not None:
11051112
output["sandbox"] = str(request.sandbox)
11061113

1114+
if request.tags is not None:
1115+
output["tags"] = request.tags
1116+
11071117
return output
11081118

11091119

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

+18-3
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,11 @@ class Function:
563563
Execution environment of the function.
564564
"""
565565

566+
tags: List[str]
567+
"""
568+
List of tags applied to the Serverless Function.
569+
"""
570+
566571
created_at: Optional[datetime]
567572
"""
568573
Creation date of the function.
@@ -633,7 +638,7 @@ class Namespace:
633638

634639
tags: List[str]
635640
"""
636-
[ALPHA] List of tags applied to the Serverless Function Namespace.
641+
List of tags applied to the Serverless Function Namespace.
637642
"""
638643

639644
error_message: Optional[str]
@@ -867,6 +872,11 @@ class CreateFunctionRequest:
867872
Execution environment of the function.
868873
"""
869874

875+
tags: Optional[List[str]]
876+
"""
877+
Tags of the Serverless Function.
878+
"""
879+
870880

871881
@dataclass
872882
class CreateNamespaceRequest:
@@ -899,7 +909,7 @@ class CreateNamespaceRequest:
899909

900910
tags: Optional[List[str]]
901911
"""
902-
[ALPHA] Tags of the Serverless Function Namespace.
912+
Tags of the Serverless Function Namespace.
903913
"""
904914

905915

@@ -1562,6 +1572,11 @@ class UpdateFunctionRequest:
15621572
Execution environment of the function.
15631573
"""
15641574

1575+
tags: Optional[List[str]]
1576+
"""
1577+
Tags of the Serverless Function.
1578+
"""
1579+
15651580

15661581
@dataclass
15671582
class UpdateNamespaceRequest:
@@ -1592,7 +1607,7 @@ class UpdateNamespaceRequest:
15921607

15931608
tags: Optional[List[str]]
15941609
"""
1595-
[ALPHA] Tags of the Serverless Function Namespace.
1610+
Tags of the Serverless Function Namespace.
15961611
"""
15971612

15981613

scaleway/scaleway/container/v1beta1/api.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def create_namespace(
282282
:param project_id: UUID of the Project in which the namespace will be created.
283283
:param description: Description of the namespace to create.
284284
:param secret_environment_variables: Secret environment variables of the namespace to create.
285-
:param tags: [ALPHA] Tags of the Serverless Container Namespace.
285+
:param tags: Tags of the Serverless Container Namespace.
286286
:return: :class:`Namespace <Namespace>`
287287
288288
Usage:
@@ -333,7 +333,7 @@ def update_namespace(
333333
:param environment_variables: Environment variables of the namespace to update.
334334
:param description: Description of the namespace to update.
335335
:param secret_environment_variables: Secret environment variables of the namespace to update.
336-
:param tags: [ALPHA] Tags of the Serverless Container Namespace.
336+
:param tags: Tags of the Serverless Container Namespace.
337337
:return: :class:`Namespace <Namespace>`
338338
339339
Usage:
@@ -601,6 +601,7 @@ def create_container(
601601
local_storage_limit: Optional[int] = None,
602602
scaling_option: Optional[ContainerScalingOption] = None,
603603
health_check: Optional[ContainerHealthCheckSpec] = None,
604+
tags: Optional[List[str]] = None,
604605
) -> Container:
605606
"""
606607
Create a new container.
@@ -631,6 +632,7 @@ def create_container(
631632
- cpu_usage_threshold: Scale depending on the CPU usage of a container instance.
632633
- memory_usage_threshold: Scale depending on the memory usage of a container instance.
633634
:param health_check: Health check configuration of the container.
635+
:param tags: Tags of the Serverless Container.
634636
:return: :class:`Container <Container>`
635637
636638
Usage:
@@ -672,6 +674,7 @@ def create_container(
672674
local_storage_limit=local_storage_limit,
673675
scaling_option=scaling_option,
674676
health_check=health_check,
677+
tags=tags,
675678
),
676679
self.client,
677680
),
@@ -704,6 +707,7 @@ def update_container(
704707
local_storage_limit: Optional[int] = None,
705708
scaling_option: Optional[ContainerScalingOption] = None,
706709
health_check: Optional[ContainerHealthCheckSpec] = None,
710+
tags: Optional[List[str]] = None,
707711
) -> Container:
708712
"""
709713
Update an existing container.
@@ -734,6 +738,7 @@ def update_container(
734738
- cpu_usage_threshold: Scale depending on the CPU usage of a container instance.
735739
- memory_usage_threshold: Scale depending on the memory usage of a container instance.
736740
:param health_check: Health check configuration of the container.
741+
:param tags: Tags of the Serverless Container.
737742
:return: :class:`Container <Container>`
738743
739744
Usage:
@@ -775,6 +780,7 @@ def update_container(
775780
local_storage_limit=local_storage_limit,
776781
scaling_option=scaling_option,
777782
health_check=health_check,
783+
tags=tags,
778784
),
779785
self.client,
780786
),

0 commit comments

Comments
 (0)