From 6047a6bbea8694328192f32ec5ee79b56bc11fd6 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Mon, 21 Oct 2024 15:02:25 +0000 Subject: [PATCH] feat: update generated APIs --- .../container/v1beta1/__init__.py | 2 + .../scaleway_async/container/v1beta1/api.py | 9 +++ .../container/v1beta1/marshalling.py | 77 ++++++++++++++++--- .../scaleway_async/container/v1beta1/types.py | 47 ++++++++--- .../scaleway/container/v1beta1/__init__.py | 2 + scaleway/scaleway/container/v1beta1/api.py | 9 +++ .../scaleway/container/v1beta1/marshalling.py | 77 ++++++++++++++++--- scaleway/scaleway/container/v1beta1/types.py | 47 ++++++++--- 8 files changed, 222 insertions(+), 48 deletions(-) diff --git a/scaleway-async/scaleway_async/container/v1beta1/__init__.py b/scaleway-async/scaleway_async/container/v1beta1/__init__.py index 02133cc87..edca19aa0 100644 --- a/scaleway-async/scaleway_async/container/v1beta1/__init__.py +++ b/scaleway-async/scaleway_async/container/v1beta1/__init__.py @@ -23,6 +23,7 @@ from .types import TriggerInputType from .types import TriggerStatus from .content import TRIGGER_TRANSIENT_STATUSES +from .types import ContainerScalingOption from .types import SecretHashedValue from .types import TriggerMnqNatsClientConfig from .types import TriggerMnqSqsClientConfig @@ -99,6 +100,7 @@ "TriggerInputType", "TriggerStatus", "TRIGGER_TRANSIENT_STATUSES", + "ContainerScalingOption", "SecretHashedValue", "TriggerMnqNatsClientConfig", "TriggerMnqSqsClientConfig", diff --git a/scaleway-async/scaleway_async/container/v1beta1/api.py b/scaleway-async/scaleway_async/container/v1beta1/api.py index 1efce8bcc..0fb18a3ba 100644 --- a/scaleway-async/scaleway_async/container/v1beta1/api.py +++ b/scaleway-async/scaleway_async/container/v1beta1/api.py @@ -29,6 +29,7 @@ ListTokensRequestOrderBy, ListTriggersRequestOrderBy, Container, + ContainerScalingOption, CreateContainerRequest, CreateCronRequest, CreateDomainRequest, @@ -595,6 +596,7 @@ async def create_container( http_option: Optional[ContainerHttpOption] = None, sandbox: Optional[ContainerSandbox] = None, local_storage_limit: Optional[int] = None, + scaling_option: Optional[ContainerScalingOption] = None, ) -> Container: """ Create a new container. @@ -620,6 +622,8 @@ async def create_container( - enabled: Serve both HTTP and HTTPS traffic. :param sandbox: Execution environment of the container. :param local_storage_limit: Local storage limit of the container (in MB). + :param scaling_option: Possible values: + - concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. :return: :class:`Container ` Usage: @@ -659,6 +663,7 @@ async def create_container( http_option=http_option, sandbox=sandbox, local_storage_limit=local_storage_limit, + scaling_option=scaling_option, ), self.client, ), @@ -689,6 +694,7 @@ async def update_container( http_option: Optional[ContainerHttpOption] = None, sandbox: Optional[ContainerSandbox] = None, local_storage_limit: Optional[int] = None, + scaling_option: Optional[ContainerScalingOption] = None, ) -> Container: """ Update an existing container. @@ -714,6 +720,8 @@ async def update_container( - enabled: Serve both HTTP and HTTPS traffic. :param sandbox: Execution environment of the container. :param local_storage_limit: Local storage limit of the container (in MB). + :param scaling_option: Possible values: + - concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. :return: :class:`Container ` Usage: @@ -753,6 +761,7 @@ async def update_container( http_option=http_option, sandbox=sandbox, local_storage_limit=local_storage_limit, + scaling_option=scaling_option, ), self.client, ), diff --git a/scaleway-async/scaleway_async/container/v1beta1/marshalling.py b/scaleway-async/scaleway_async/container/v1beta1/marshalling.py index 732e7556c..e54f864f6 100644 --- a/scaleway-async/scaleway_async/container/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/container/v1beta1/marshalling.py @@ -10,6 +10,7 @@ resolve_one_of, ) from .types import ( + ContainerScalingOption, SecretHashedValue, Container, Cron, @@ -44,6 +45,23 @@ ) +def unmarshal_ContainerScalingOption(data: Any) -> ContainerScalingOption: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ContainerScalingOption' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("concurrent_requests_threshold", None) + if field is not None: + args["concurrent_requests_threshold"] = field + else: + args["concurrent_requests_threshold"] = None + + return ContainerScalingOption(**args) + + def unmarshal_SecretHashedValue(data: Any) -> SecretHashedValue: if not isinstance(data, dict): raise TypeError( @@ -119,6 +137,18 @@ def unmarshal_Container(data: Any) -> Container: if field is not None: args["max_concurrency"] = field + field = data.get("domain_name", None) + if field is not None: + args["domain_name"] = field + + field = data.get("protocol", None) + if field is not None: + args["protocol"] = field + + field = data.get("port", None) + if field is not None: + args["port"] = field + field = data.get("timeout", None) if field is not None: args["timeout"] = field @@ -137,18 +167,6 @@ def unmarshal_Container(data: Any) -> Container: else: args["description"] = None - field = data.get("domain_name", None) - if field is not None: - args["domain_name"] = field - - field = data.get("protocol", None) - if field is not None: - args["protocol"] = field - - field = data.get("port", None) - if field is not None: - args["port"] = field - field = data.get("secret_environment_variables", None) if field is not None: args["secret_environment_variables"] = ( @@ -173,6 +191,12 @@ def unmarshal_Container(data: Any) -> Container: if field is not None: args["region"] = field + field = data.get("scaling_option", None) + if field is not None: + args["scaling_option"] = unmarshal_ContainerScalingOption(field) + else: + args["scaling_option"] = None + return Container(**args) @@ -644,6 +668,25 @@ def unmarshal_ListTriggersResponse(data: Any) -> ListTriggersResponse: return ListTriggersResponse(**args) +def marshal_ContainerScalingOption( + request: ContainerScalingOption, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + output.update( + resolve_one_of( + [ + OneOfPossibility( + "concurrent_requests_threshold", + request.concurrent_requests_threshold, + ), + ] + ), + ) + + return output + + def marshal_Secret( request: Secret, defaults: ProfileDefaults, @@ -722,6 +765,11 @@ def marshal_CreateContainerRequest( if request.local_storage_limit is not None: output["local_storage_limit"] = request.local_storage_limit + if request.scaling_option is not None: + output["scaling_option"] = marshal_ContainerScalingOption( + request.scaling_option, defaults + ) + return output @@ -958,6 +1006,11 @@ def marshal_UpdateContainerRequest( if request.local_storage_limit is not None: output["local_storage_limit"] = request.local_storage_limit + if request.scaling_option is not None: + output["scaling_option"] = marshal_ContainerScalingOption( + request.scaling_option, defaults + ) + return output diff --git a/scaleway-async/scaleway_async/container/v1beta1/types.py b/scaleway-async/scaleway_async/container/v1beta1/types.py index 3a01d9a60..37f853ab7 100644 --- a/scaleway-async/scaleway_async/container/v1beta1/types.py +++ b/scaleway-async/scaleway_async/container/v1beta1/types.py @@ -191,6 +191,11 @@ def __str__(self) -> str: return str(self.value) +@dataclass +class ContainerScalingOption: + concurrent_requests_threshold: Optional[int] + + @dataclass class SecretHashedValue: key: str @@ -381,34 +386,34 @@ class Container: Number of maximum concurrent executions of the container. """ - timeout: Optional[str] + domain_name: str """ - Processing time limit for the container. + Domain name attributed to the contaioner. """ - error_message: Optional[str] + protocol: ContainerProtocol """ - Last error message of the container. + Protocol the container uses. """ - description: Optional[str] + port: int """ - Description of the container. + Port the container listens on. """ - domain_name: str + timeout: Optional[str] """ - Domain name attributed to the contaioner. + Processing time limit for the container. """ - protocol: ContainerProtocol + error_message: Optional[str] """ - Protocol the container uses. + Last error message of the container. """ - port: int + description: Optional[str] """ - Port the container listens on. + Description of the container. """ secret_environment_variables: List[SecretHashedValue] @@ -438,6 +443,12 @@ class Container: Region in which the container will be deployed. """ + scaling_option: Optional[ContainerScalingOption] + """ + Possible values: +- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. + """ + @dataclass class Cron: @@ -755,6 +766,12 @@ class CreateContainerRequest: Local storage limit of the container (in MB). """ + scaling_option: Optional[ContainerScalingOption] + """ + Possible values: +- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. + """ + @dataclass class CreateCronRequest: @@ -1416,6 +1433,12 @@ class UpdateContainerRequest: Local storage limit of the container (in MB). """ + scaling_option: Optional[ContainerScalingOption] + """ + Possible values: +- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. + """ + @dataclass class UpdateCronRequest: diff --git a/scaleway/scaleway/container/v1beta1/__init__.py b/scaleway/scaleway/container/v1beta1/__init__.py index 02133cc87..edca19aa0 100644 --- a/scaleway/scaleway/container/v1beta1/__init__.py +++ b/scaleway/scaleway/container/v1beta1/__init__.py @@ -23,6 +23,7 @@ from .types import TriggerInputType from .types import TriggerStatus from .content import TRIGGER_TRANSIENT_STATUSES +from .types import ContainerScalingOption from .types import SecretHashedValue from .types import TriggerMnqNatsClientConfig from .types import TriggerMnqSqsClientConfig @@ -99,6 +100,7 @@ "TriggerInputType", "TriggerStatus", "TRIGGER_TRANSIENT_STATUSES", + "ContainerScalingOption", "SecretHashedValue", "TriggerMnqNatsClientConfig", "TriggerMnqSqsClientConfig", diff --git a/scaleway/scaleway/container/v1beta1/api.py b/scaleway/scaleway/container/v1beta1/api.py index c1ff1b605..82cbbda32 100644 --- a/scaleway/scaleway/container/v1beta1/api.py +++ b/scaleway/scaleway/container/v1beta1/api.py @@ -29,6 +29,7 @@ ListTokensRequestOrderBy, ListTriggersRequestOrderBy, Container, + ContainerScalingOption, CreateContainerRequest, CreateCronRequest, CreateDomainRequest, @@ -591,6 +592,7 @@ def create_container( http_option: Optional[ContainerHttpOption] = None, sandbox: Optional[ContainerSandbox] = None, local_storage_limit: Optional[int] = None, + scaling_option: Optional[ContainerScalingOption] = None, ) -> Container: """ Create a new container. @@ -616,6 +618,8 @@ def create_container( - enabled: Serve both HTTP and HTTPS traffic. :param sandbox: Execution environment of the container. :param local_storage_limit: Local storage limit of the container (in MB). + :param scaling_option: Possible values: + - concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. :return: :class:`Container ` Usage: @@ -655,6 +659,7 @@ def create_container( http_option=http_option, sandbox=sandbox, local_storage_limit=local_storage_limit, + scaling_option=scaling_option, ), self.client, ), @@ -685,6 +690,7 @@ def update_container( http_option: Optional[ContainerHttpOption] = None, sandbox: Optional[ContainerSandbox] = None, local_storage_limit: Optional[int] = None, + scaling_option: Optional[ContainerScalingOption] = None, ) -> Container: """ Update an existing container. @@ -710,6 +716,8 @@ def update_container( - enabled: Serve both HTTP and HTTPS traffic. :param sandbox: Execution environment of the container. :param local_storage_limit: Local storage limit of the container (in MB). + :param scaling_option: Possible values: + - concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. :return: :class:`Container ` Usage: @@ -749,6 +757,7 @@ def update_container( http_option=http_option, sandbox=sandbox, local_storage_limit=local_storage_limit, + scaling_option=scaling_option, ), self.client, ), diff --git a/scaleway/scaleway/container/v1beta1/marshalling.py b/scaleway/scaleway/container/v1beta1/marshalling.py index 732e7556c..e54f864f6 100644 --- a/scaleway/scaleway/container/v1beta1/marshalling.py +++ b/scaleway/scaleway/container/v1beta1/marshalling.py @@ -10,6 +10,7 @@ resolve_one_of, ) from .types import ( + ContainerScalingOption, SecretHashedValue, Container, Cron, @@ -44,6 +45,23 @@ ) +def unmarshal_ContainerScalingOption(data: Any) -> ContainerScalingOption: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ContainerScalingOption' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("concurrent_requests_threshold", None) + if field is not None: + args["concurrent_requests_threshold"] = field + else: + args["concurrent_requests_threshold"] = None + + return ContainerScalingOption(**args) + + def unmarshal_SecretHashedValue(data: Any) -> SecretHashedValue: if not isinstance(data, dict): raise TypeError( @@ -119,6 +137,18 @@ def unmarshal_Container(data: Any) -> Container: if field is not None: args["max_concurrency"] = field + field = data.get("domain_name", None) + if field is not None: + args["domain_name"] = field + + field = data.get("protocol", None) + if field is not None: + args["protocol"] = field + + field = data.get("port", None) + if field is not None: + args["port"] = field + field = data.get("timeout", None) if field is not None: args["timeout"] = field @@ -137,18 +167,6 @@ def unmarshal_Container(data: Any) -> Container: else: args["description"] = None - field = data.get("domain_name", None) - if field is not None: - args["domain_name"] = field - - field = data.get("protocol", None) - if field is not None: - args["protocol"] = field - - field = data.get("port", None) - if field is not None: - args["port"] = field - field = data.get("secret_environment_variables", None) if field is not None: args["secret_environment_variables"] = ( @@ -173,6 +191,12 @@ def unmarshal_Container(data: Any) -> Container: if field is not None: args["region"] = field + field = data.get("scaling_option", None) + if field is not None: + args["scaling_option"] = unmarshal_ContainerScalingOption(field) + else: + args["scaling_option"] = None + return Container(**args) @@ -644,6 +668,25 @@ def unmarshal_ListTriggersResponse(data: Any) -> ListTriggersResponse: return ListTriggersResponse(**args) +def marshal_ContainerScalingOption( + request: ContainerScalingOption, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + output.update( + resolve_one_of( + [ + OneOfPossibility( + "concurrent_requests_threshold", + request.concurrent_requests_threshold, + ), + ] + ), + ) + + return output + + def marshal_Secret( request: Secret, defaults: ProfileDefaults, @@ -722,6 +765,11 @@ def marshal_CreateContainerRequest( if request.local_storage_limit is not None: output["local_storage_limit"] = request.local_storage_limit + if request.scaling_option is not None: + output["scaling_option"] = marshal_ContainerScalingOption( + request.scaling_option, defaults + ) + return output @@ -958,6 +1006,11 @@ def marshal_UpdateContainerRequest( if request.local_storage_limit is not None: output["local_storage_limit"] = request.local_storage_limit + if request.scaling_option is not None: + output["scaling_option"] = marshal_ContainerScalingOption( + request.scaling_option, defaults + ) + return output diff --git a/scaleway/scaleway/container/v1beta1/types.py b/scaleway/scaleway/container/v1beta1/types.py index 3a01d9a60..37f853ab7 100644 --- a/scaleway/scaleway/container/v1beta1/types.py +++ b/scaleway/scaleway/container/v1beta1/types.py @@ -191,6 +191,11 @@ def __str__(self) -> str: return str(self.value) +@dataclass +class ContainerScalingOption: + concurrent_requests_threshold: Optional[int] + + @dataclass class SecretHashedValue: key: str @@ -381,34 +386,34 @@ class Container: Number of maximum concurrent executions of the container. """ - timeout: Optional[str] + domain_name: str """ - Processing time limit for the container. + Domain name attributed to the contaioner. """ - error_message: Optional[str] + protocol: ContainerProtocol """ - Last error message of the container. + Protocol the container uses. """ - description: Optional[str] + port: int """ - Description of the container. + Port the container listens on. """ - domain_name: str + timeout: Optional[str] """ - Domain name attributed to the contaioner. + Processing time limit for the container. """ - protocol: ContainerProtocol + error_message: Optional[str] """ - Protocol the container uses. + Last error message of the container. """ - port: int + description: Optional[str] """ - Port the container listens on. + Description of the container. """ secret_environment_variables: List[SecretHashedValue] @@ -438,6 +443,12 @@ class Container: Region in which the container will be deployed. """ + scaling_option: Optional[ContainerScalingOption] + """ + Possible values: +- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. + """ + @dataclass class Cron: @@ -755,6 +766,12 @@ class CreateContainerRequest: Local storage limit of the container (in MB). """ + scaling_option: Optional[ContainerScalingOption] + """ + Possible values: +- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. + """ + @dataclass class CreateCronRequest: @@ -1416,6 +1433,12 @@ class UpdateContainerRequest: Local storage limit of the container (in MB). """ + scaling_option: Optional[ContainerScalingOption] + """ + Possible values: +- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. + """ + @dataclass class UpdateCronRequest: