Skip to content

Commit 7be7a6f

Browse files
authored
feat(container): add of sandbox (scaleway#566)
1 parent 1894b18 commit 7be7a6f

File tree

16 files changed

+172
-0
lines changed

16 files changed

+172
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .types import ContainerHttpOption
44
from .types import ContainerPrivacy
55
from .types import ContainerProtocol
6+
from .types import ContainerSandbox
67
from .types import ContainerStatus
78
from .content import CONTAINER_TRANSIENT_STATUSES
89
from .types import CronStatus
@@ -79,6 +80,7 @@
7980
"ContainerHttpOption",
8081
"ContainerPrivacy",
8182
"ContainerProtocol",
83+
"ContainerSandbox",
8284
"ContainerStatus",
8385
"CONTAINER_TRANSIENT_STATUSES",
8486
"CronStatus",

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
ContainerHttpOption,
2222
ContainerPrivacy,
2323
ContainerProtocol,
24+
ContainerSandbox,
2425
ListContainersRequestOrderBy,
2526
ListCronsRequestOrderBy,
2627
ListDomainsRequestOrderBy,
@@ -592,6 +593,7 @@ async def create_container(
592593
port: Optional[int] = None,
593594
secret_environment_variables: Optional[List[Secret]] = None,
594595
http_option: Optional[ContainerHttpOption] = None,
596+
sandbox: Optional[ContainerSandbox] = None,
595597
) -> Container:
596598
"""
597599
Create a new container.
@@ -615,6 +617,7 @@ async def create_container(
615617
:param http_option: Possible values:
616618
- redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS.
617619
- enabled: Serve both HTTP and HTTPS traffic.
620+
:param sandbox: Execution environment of the container.
618621
:return: :class:`Container <Container>`
619622
620623
Usage:
@@ -652,6 +655,7 @@ async def create_container(
652655
port=port,
653656
secret_environment_variables=secret_environment_variables,
654657
http_option=http_option,
658+
sandbox=sandbox,
655659
),
656660
self.client,
657661
),
@@ -680,6 +684,7 @@ async def update_container(
680684
port: Optional[int] = None,
681685
secret_environment_variables: Optional[List[Secret]] = None,
682686
http_option: Optional[ContainerHttpOption] = None,
687+
sandbox: Optional[ContainerSandbox] = None,
683688
) -> Container:
684689
"""
685690
Update an existing container.
@@ -703,6 +708,7 @@ async def update_container(
703708
:param http_option: Possible values:
704709
- redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS.
705710
- enabled: Serve both HTTP and HTTPS traffic.
711+
:param sandbox: Execution environment of the container.
706712
:return: :class:`Container <Container>`
707713
708714
Usage:
@@ -740,6 +746,7 @@ async def update_container(
740746
port=port,
741747
secret_environment_variables=secret_environment_variables,
742748
http_option=http_option,
749+
sandbox=sandbox,
743750
),
744751
self.client,
745752
),

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ def unmarshal_Container(data: Any) -> Container:
161161
if field is not None:
162162
args["http_option"] = field
163163

164+
field = data.get("sandbox", None)
165+
if field is not None:
166+
args["sandbox"] = field
167+
164168
field = data.get("region", None)
165169
if field is not None:
166170
args["region"] = field
@@ -708,6 +712,9 @@ def marshal_CreateContainerRequest(
708712
if request.http_option is not None:
709713
output["http_option"] = str(request.http_option)
710714

715+
if request.sandbox is not None:
716+
output["sandbox"] = str(request.sandbox)
717+
711718
return output
712719

713720

@@ -938,6 +945,9 @@ def marshal_UpdateContainerRequest(
938945
if request.http_option is not None:
939946
output["http_option"] = str(request.http_option)
940947

948+
if request.sandbox is not None:
949+
output["sandbox"] = str(request.sandbox)
950+
941951
return output
942952

943953

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ def __str__(self) -> str:
4242
return str(self.value)
4343

4444

45+
class ContainerSandbox(str, Enum, metaclass=StrEnumMeta):
46+
UNKNOWN_SANDBOX = "unknown_sandbox"
47+
V1 = "v1"
48+
V2 = "v2"
49+
50+
def __str__(self) -> str:
51+
return str(self.value)
52+
53+
4554
class ContainerStatus(str, Enum, metaclass=StrEnumMeta):
4655
UNKNOWN = "unknown"
4756
READY = "ready"
@@ -414,6 +423,11 @@ class Container:
414423
- enabled: Serve both HTTP and HTTPS traffic.
415424
"""
416425

426+
sandbox: ContainerSandbox
427+
"""
428+
Execution environment of the container.
429+
"""
430+
417431
region: Region
418432
"""
419433
Region in which the container will be deployed.
@@ -726,6 +740,11 @@ class CreateContainerRequest:
726740
- enabled: Serve both HTTP and HTTPS traffic.
727741
"""
728742

743+
sandbox: Optional[ContainerSandbox]
744+
"""
745+
Execution environment of the container.
746+
"""
747+
729748

730749
@dataclass
731750
class CreateCronRequest:
@@ -1391,6 +1410,11 @@ class UpdateContainerRequest:
13911410
- enabled: Serve both HTTP and HTTPS traffic.
13921411
"""
13931412

1413+
sandbox: Optional[ContainerSandbox]
1414+
"""
1415+
Execution environment of the container.
1416+
"""
1417+
13941418

13951419
@dataclass
13961420
class UpdateCronRequest:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from .types import FunctionHttpOption
88
from .types import FunctionPrivacy
99
from .types import FunctionRuntime
10+
from .types import FunctionSandbox
1011
from .types import FunctionStatus
1112
from .content import FUNCTION_TRANSIENT_STATUSES
1213
from .types import ListCronsRequestOrderBy
@@ -91,6 +92,7 @@
9192
"FunctionHttpOption",
9293
"FunctionPrivacy",
9394
"FunctionRuntime",
95+
"FunctionSandbox",
9496
"FunctionStatus",
9597
"FUNCTION_TRANSIENT_STATUSES",
9698
"ListCronsRequestOrderBy",

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
FunctionHttpOption,
2222
FunctionPrivacy,
2323
FunctionRuntime,
24+
FunctionSandbox,
2425
ListCronsRequestOrderBy,
2526
ListDomainsRequestOrderBy,
2627
ListFunctionsRequestOrderBy,
@@ -593,6 +594,7 @@ async def create_function(
593594
description: Optional[str] = None,
594595
secret_environment_variables: Optional[List[Secret]] = None,
595596
http_option: Optional[FunctionHttpOption] = None,
597+
sandbox: Optional[FunctionSandbox] = None,
596598
) -> Function:
597599
"""
598600
Create a new function.
@@ -613,6 +615,7 @@ async def create_function(
613615
:param http_option: Possible values:
614616
- redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS.
615617
- enabled: Serve both HTTP and HTTPS traffic.
618+
:param sandbox: Execution environment of the function.
616619
:return: :class:`Function <Function>`
617620
618621
Usage:
@@ -646,6 +649,7 @@ async def create_function(
646649
description=description,
647650
secret_environment_variables=secret_environment_variables,
648651
http_option=http_option,
652+
sandbox=sandbox,
649653
),
650654
self.client,
651655
),
@@ -671,6 +675,7 @@ async def update_function(
671675
description: Optional[str] = None,
672676
secret_environment_variables: Optional[List[Secret]] = None,
673677
http_option: Optional[FunctionHttpOption] = None,
678+
sandbox: Optional[FunctionSandbox] = None,
674679
) -> Function:
675680
"""
676681
Update an existing function.
@@ -691,6 +696,7 @@ async def update_function(
691696
:param http_option: Possible values:
692697
- redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS.
693698
- enabled: Serve both HTTP and HTTPS traffic.
699+
:param sandbox: Execution environment of the function.
694700
:return: :class:`Function <Function>`
695701
696702
Usage:
@@ -725,6 +731,7 @@ async def update_function(
725731
description=description,
726732
secret_environment_variables=secret_environment_variables,
727733
http_option=http_option,
734+
sandbox=sandbox,
728735
),
729736
self.client,
730737
),

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ def unmarshal_Function(data: Any) -> Function:
221221
if field is not None:
222222
args["runtime_message"] = field
223223

224+
field = data.get("sandbox", None)
225+
if field is not None:
226+
args["sandbox"] = field
227+
224228
field = data.get("timeout", None)
225229
if field is not None:
226230
args["timeout"] = field
@@ -851,6 +855,9 @@ def marshal_CreateFunctionRequest(
851855
if request.http_option is not None:
852856
output["http_option"] = str(request.http_option)
853857

858+
if request.sandbox is not None:
859+
output["sandbox"] = str(request.sandbox)
860+
854861
return output
855862

856863

@@ -1057,6 +1064,9 @@ def marshal_UpdateFunctionRequest(
10571064
if request.http_option is not None:
10581065
output["http_option"] = str(request.http_option)
10591066

1067+
if request.sandbox is not None:
1068+
output["sandbox"] = str(request.sandbox)
1069+
10601070
return output
10611071

10621072

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ def __str__(self) -> str:
9494
return str(self.value)
9595

9696

97+
class FunctionSandbox(str, Enum, metaclass=StrEnumMeta):
98+
UNKNOWN_SANDBOX = "unknown_sandbox"
99+
V1 = "v1"
100+
V2 = "v2"
101+
102+
def __str__(self) -> str:
103+
return str(self.value)
104+
105+
97106
class FunctionStatus(str, Enum, metaclass=StrEnumMeta):
98107
UNKNOWN = "unknown"
99108
READY = "ready"
@@ -524,6 +533,11 @@ class Function:
524533

525534
runtime_message: str
526535

536+
sandbox: FunctionSandbox
537+
"""
538+
Execution environment of the function.
539+
"""
540+
527541
timeout: Optional[str]
528542
"""
529543
Request processing time limit for the function.
@@ -813,6 +827,11 @@ class CreateFunctionRequest:
813827
- enabled: Serve both HTTP and HTTPS traffic.
814828
"""
815829

830+
sandbox: Optional[FunctionSandbox]
831+
"""
832+
Execution environment of the function.
833+
"""
834+
816835

817836
@dataclass
818837
class CreateNamespaceRequest:
@@ -1512,6 +1531,11 @@ class UpdateFunctionRequest:
15121531
- enabled: Serve both HTTP and HTTPS traffic.
15131532
"""
15141533

1534+
sandbox: Optional[FunctionSandbox]
1535+
"""
1536+
Execution environment of the function.
1537+
"""
1538+
15151539

15161540
@dataclass
15171541
class UpdateNamespaceRequest:

scaleway/scaleway/container/v1beta1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .types import ContainerHttpOption
44
from .types import ContainerPrivacy
55
from .types import ContainerProtocol
6+
from .types import ContainerSandbox
67
from .types import ContainerStatus
78
from .content import CONTAINER_TRANSIENT_STATUSES
89
from .types import CronStatus
@@ -79,6 +80,7 @@
7980
"ContainerHttpOption",
8081
"ContainerPrivacy",
8182
"ContainerProtocol",
83+
"ContainerSandbox",
8284
"ContainerStatus",
8385
"CONTAINER_TRANSIENT_STATUSES",
8486
"CronStatus",

scaleway/scaleway/container/v1beta1/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
ContainerHttpOption,
2222
ContainerPrivacy,
2323
ContainerProtocol,
24+
ContainerSandbox,
2425
ListContainersRequestOrderBy,
2526
ListCronsRequestOrderBy,
2627
ListDomainsRequestOrderBy,
@@ -588,6 +589,7 @@ def create_container(
588589
port: Optional[int] = None,
589590
secret_environment_variables: Optional[List[Secret]] = None,
590591
http_option: Optional[ContainerHttpOption] = None,
592+
sandbox: Optional[ContainerSandbox] = None,
591593
) -> Container:
592594
"""
593595
Create a new container.
@@ -611,6 +613,7 @@ def create_container(
611613
:param http_option: Possible values:
612614
- redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS.
613615
- enabled: Serve both HTTP and HTTPS traffic.
616+
:param sandbox: Execution environment of the container.
614617
:return: :class:`Container <Container>`
615618
616619
Usage:
@@ -648,6 +651,7 @@ def create_container(
648651
port=port,
649652
secret_environment_variables=secret_environment_variables,
650653
http_option=http_option,
654+
sandbox=sandbox,
651655
),
652656
self.client,
653657
),
@@ -676,6 +680,7 @@ def update_container(
676680
port: Optional[int] = None,
677681
secret_environment_variables: Optional[List[Secret]] = None,
678682
http_option: Optional[ContainerHttpOption] = None,
683+
sandbox: Optional[ContainerSandbox] = None,
679684
) -> Container:
680685
"""
681686
Update an existing container.
@@ -699,6 +704,7 @@ def update_container(
699704
:param http_option: Possible values:
700705
- redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS.
701706
- enabled: Serve both HTTP and HTTPS traffic.
707+
:param sandbox: Execution environment of the container.
702708
:return: :class:`Container <Container>`
703709
704710
Usage:
@@ -736,6 +742,7 @@ def update_container(
736742
port=port,
737743
secret_environment_variables=secret_environment_variables,
738744
http_option=http_option,
745+
sandbox=sandbox,
739746
),
740747
self.client,
741748
),

0 commit comments

Comments
 (0)