Skip to content

Commit 72dba11

Browse files
authored
feat(containers): add cpu limit to update/create container request messages (#150)
1 parent a476a28 commit 72dba11

File tree

6 files changed

+38
-2
lines changed

6 files changed

+38
-2
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ async def create_container(
562562
min_scale: Optional[int] = None,
563563
max_scale: Optional[int] = None,
564564
memory_limit: Optional[int] = None,
565+
cpu_limit: Optional[int] = None,
565566
timeout: Optional[str] = None,
566567
description: Optional[str] = None,
567568
registry_image: Optional[str] = None,
@@ -579,6 +580,7 @@ async def create_container(
579580
:param min_scale: Minimum number of instances to scale the container to.
580581
:param max_scale: Maximum number of instances to scale the container to.
581582
:param memory_limit: Memory limit of the container in MB.
583+
:param cpu_limit: CPU limit of the container in mvCPU.
582584
:param timeout: Processing time limit for the container.
583585
:param privacy: Privacy setting of the container.
584586
:param description: Description of the container.
@@ -624,6 +626,7 @@ async def create_container(
624626
min_scale=min_scale,
625627
max_scale=max_scale,
626628
memory_limit=memory_limit,
629+
cpu_limit=cpu_limit,
627630
timeout=timeout,
628631
description=description,
629632
registry_image=registry_image,
@@ -650,6 +653,7 @@ async def update_container(
650653
min_scale: Optional[int] = None,
651654
max_scale: Optional[int] = None,
652655
memory_limit: Optional[int] = None,
656+
cpu_limit: Optional[int] = None,
653657
timeout: Optional[str] = None,
654658
redeploy: Optional[bool] = None,
655659
description: Optional[str] = None,
@@ -667,6 +671,7 @@ async def update_container(
667671
:param min_scale: Minimum number of instances to scale the container to.
668672
:param max_scale: Maximum number of instances to scale the container to.
669673
:param memory_limit: Memory limit of the container in MB.
674+
:param cpu_limit: CPU limit of the container in mvCPU.
670675
:param timeout: Processing time limit for the container.
671676
:param redeploy: Defines whether to redeploy failed containers.
672677
:param privacy: Privacy settings of the container.
@@ -712,6 +717,7 @@ async def update_container(
712717
min_scale=min_scale,
713718
max_scale=max_scale,
714719
memory_limit=memory_limit,
720+
cpu_limit=cpu_limit,
715721
timeout=timeout,
716722
redeploy=redeploy,
717723
description=description,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ def marshal_CreateContainerRequest(
419419
defaults: ProfileDefaults,
420420
) -> Dict[str, Any]:
421421
return {
422+
"cpu_limit": request.cpu_limit,
422423
"description": request.description,
423424
"environment_variables": request.environment_variables,
424425
"http_option": ContainerHttpOption(request.http_option),
@@ -507,6 +508,7 @@ def marshal_UpdateContainerRequest(
507508
defaults: ProfileDefaults,
508509
) -> Dict[str, Any]:
509510
return {
511+
"cpu_limit": request.cpu_limit,
510512
"description": request.description,
511513
"environment_variables": request.environment_variables,
512514
"http_option": ContainerHttpOption(request.http_option),

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class Container:
220220

221221
cpu_limit: int
222222
"""
223-
CPU limit of the container.
223+
CPU limit of the container in mvCPU.
224224
"""
225225

226226
timeout: Optional[str]
@@ -826,6 +826,11 @@ class CreateContainerRequest:
826826
Memory limit of the container in MB.
827827
"""
828828

829+
cpu_limit: Optional[int]
830+
"""
831+
CPU limit of the container in mvCPU.
832+
"""
833+
829834
timeout: Optional[str]
830835
"""
831836
Processing time limit for the container.
@@ -907,6 +912,11 @@ class UpdateContainerRequest:
907912
Memory limit of the container in MB.
908913
"""
909914

915+
cpu_limit: Optional[int]
916+
"""
917+
CPU limit of the container in mvCPU.
918+
"""
919+
910920
timeout: Optional[str]
911921
"""
912922
Processing time limit for the container.

scaleway/scaleway/container/v1beta1/api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ def create_container(
558558
min_scale: Optional[int] = None,
559559
max_scale: Optional[int] = None,
560560
memory_limit: Optional[int] = None,
561+
cpu_limit: Optional[int] = None,
561562
timeout: Optional[str] = None,
562563
description: Optional[str] = None,
563564
registry_image: Optional[str] = None,
@@ -575,6 +576,7 @@ def create_container(
575576
:param min_scale: Minimum number of instances to scale the container to.
576577
:param max_scale: Maximum number of instances to scale the container to.
577578
:param memory_limit: Memory limit of the container in MB.
579+
:param cpu_limit: CPU limit of the container in mvCPU.
578580
:param timeout: Processing time limit for the container.
579581
:param privacy: Privacy setting of the container.
580582
:param description: Description of the container.
@@ -620,6 +622,7 @@ def create_container(
620622
min_scale=min_scale,
621623
max_scale=max_scale,
622624
memory_limit=memory_limit,
625+
cpu_limit=cpu_limit,
623626
timeout=timeout,
624627
description=description,
625628
registry_image=registry_image,
@@ -646,6 +649,7 @@ def update_container(
646649
min_scale: Optional[int] = None,
647650
max_scale: Optional[int] = None,
648651
memory_limit: Optional[int] = None,
652+
cpu_limit: Optional[int] = None,
649653
timeout: Optional[str] = None,
650654
redeploy: Optional[bool] = None,
651655
description: Optional[str] = None,
@@ -663,6 +667,7 @@ def update_container(
663667
:param min_scale: Minimum number of instances to scale the container to.
664668
:param max_scale: Maximum number of instances to scale the container to.
665669
:param memory_limit: Memory limit of the container in MB.
670+
:param cpu_limit: CPU limit of the container in mvCPU.
666671
:param timeout: Processing time limit for the container.
667672
:param redeploy: Defines whether to redeploy failed containers.
668673
:param privacy: Privacy settings of the container.
@@ -708,6 +713,7 @@ def update_container(
708713
min_scale=min_scale,
709714
max_scale=max_scale,
710715
memory_limit=memory_limit,
716+
cpu_limit=cpu_limit,
711717
timeout=timeout,
712718
redeploy=redeploy,
713719
description=description,

scaleway/scaleway/container/v1beta1/marshalling.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ def marshal_CreateContainerRequest(
419419
defaults: ProfileDefaults,
420420
) -> Dict[str, Any]:
421421
return {
422+
"cpu_limit": request.cpu_limit,
422423
"description": request.description,
423424
"environment_variables": request.environment_variables,
424425
"http_option": ContainerHttpOption(request.http_option),
@@ -507,6 +508,7 @@ def marshal_UpdateContainerRequest(
507508
defaults: ProfileDefaults,
508509
) -> Dict[str, Any]:
509510
return {
511+
"cpu_limit": request.cpu_limit,
510512
"description": request.description,
511513
"environment_variables": request.environment_variables,
512514
"http_option": ContainerHttpOption(request.http_option),

scaleway/scaleway/container/v1beta1/types.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class Container:
220220

221221
cpu_limit: int
222222
"""
223-
CPU limit of the container.
223+
CPU limit of the container in mvCPU.
224224
"""
225225

226226
timeout: Optional[str]
@@ -826,6 +826,11 @@ class CreateContainerRequest:
826826
Memory limit of the container in MB.
827827
"""
828828

829+
cpu_limit: Optional[int]
830+
"""
831+
CPU limit of the container in mvCPU.
832+
"""
833+
829834
timeout: Optional[str]
830835
"""
831836
Processing time limit for the container.
@@ -907,6 +912,11 @@ class UpdateContainerRequest:
907912
Memory limit of the container in MB.
908913
"""
909914

915+
cpu_limit: Optional[int]
916+
"""
917+
CPU limit of the container in mvCPU.
918+
"""
919+
910920
timeout: Optional[str]
911921
"""
912922
Processing time limit for the container.

0 commit comments

Comments
 (0)