From 5a28c7b8da7e605d4060ee358422554b6ec98c78 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Wed, 23 Oct 2024 15:28:46 +0000 Subject: [PATCH] feat: update generated APIs --- .../scaleway_async/jobs/v1alpha1/__init__.py | 4 +++ .../scaleway_async/jobs/v1alpha1/api.py | 30 +++++++++++++++++++ .../jobs/v1alpha1/marshalling.py | 16 ++++++++++ .../scaleway_async/jobs/v1alpha1/types.py | 13 ++++++++ scaleway/scaleway/jobs/v1alpha1/__init__.py | 4 +++ scaleway/scaleway/jobs/v1alpha1/api.py | 30 +++++++++++++++++++ .../scaleway/jobs/v1alpha1/marshalling.py | 16 ++++++++++ scaleway/scaleway/jobs/v1alpha1/types.py | 13 ++++++++ 8 files changed, 126 insertions(+) diff --git a/scaleway-async/scaleway_async/jobs/v1alpha1/__init__.py b/scaleway-async/scaleway_async/jobs/v1alpha1/__init__.py index 91ec71677..31880b355 100644 --- a/scaleway-async/scaleway_async/jobs/v1alpha1/__init__.py +++ b/scaleway-async/scaleway_async/jobs/v1alpha1/__init__.py @@ -22,6 +22,8 @@ from .types import GetJobDefinitionRequest from .types import GetJobDefinitionSecretRequest from .types import GetJobRunRequest +from .types import GetJobsLimitsRequest +from .types import JobsLimits from .types import ListJobDefinitionSecretsRequest from .types import ListJobDefinitionSecretsResponse from .types import ListJobDefinitionsRequest @@ -60,6 +62,8 @@ "GetJobDefinitionRequest", "GetJobDefinitionSecretRequest", "GetJobRunRequest", + "GetJobsLimitsRequest", + "JobsLimits", "ListJobDefinitionSecretsRequest", "ListJobDefinitionSecretsResponse", "ListJobDefinitionsRequest", diff --git a/scaleway-async/scaleway_async/jobs/v1alpha1/api.py b/scaleway-async/scaleway_async/jobs/v1alpha1/api.py index a402596fa..cc6881368 100644 --- a/scaleway-async/scaleway_async/jobs/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/jobs/v1alpha1/api.py @@ -22,6 +22,7 @@ CreateJobDefinitionSecretsResponse, JobDefinition, JobRun, + JobsLimits, ListJobDefinitionSecretsResponse, ListJobDefinitionsResponse, ListJobRunsResponse, @@ -38,6 +39,7 @@ unmarshal_JobDefinition, unmarshal_JobRun, unmarshal_CreateJobDefinitionSecretsResponse, + unmarshal_JobsLimits, unmarshal_ListJobDefinitionSecretsResponse, unmarshal_ListJobDefinitionsResponse, unmarshal_ListJobRunsResponse, @@ -802,3 +804,31 @@ async def list_jobs_resources( self._throw_on_error(res) return unmarshal_ListJobsResourcesResponse(res.json()) + + async def get_jobs_limits( + self, + *, + region: Optional[Region] = None, + ) -> JobsLimits: + """ + Get jobs limits for the console. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`JobsLimits ` + + Usage: + :: + + result = await api.get_jobs_limits() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/serverless-jobs/v1alpha1/regions/{param_region}/jobs-limits", + ) + + self._throw_on_error(res) + return unmarshal_JobsLimits(res.json()) diff --git a/scaleway-async/scaleway_async/jobs/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/jobs/v1alpha1/marshalling.py index 649c6a891..17cb1e1d7 100644 --- a/scaleway-async/scaleway_async/jobs/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/jobs/v1alpha1/marshalling.py @@ -17,6 +17,7 @@ JobDefinition, JobRun, CreateJobDefinitionSecretsResponse, + JobsLimits, ListJobDefinitionSecretsResponse, ListJobDefinitionsResponse, ListJobRunsResponse, @@ -305,6 +306,21 @@ def unmarshal_CreateJobDefinitionSecretsResponse( return CreateJobDefinitionSecretsResponse(**args) +def unmarshal_JobsLimits(data: Any) -> JobsLimits: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'JobsLimits' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("secrets_per_job_definition", None) + if field is not None: + args["secrets_per_job_definition"] = field + + return JobsLimits(**args) + + def unmarshal_ListJobDefinitionSecretsResponse( data: Any, ) -> ListJobDefinitionSecretsResponse: diff --git a/scaleway-async/scaleway_async/jobs/v1alpha1/types.py b/scaleway-async/scaleway_async/jobs/v1alpha1/types.py index b1ae41e00..2a0dbbb7d 100644 --- a/scaleway-async/scaleway_async/jobs/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/jobs/v1alpha1/types.py @@ -336,6 +336,19 @@ class GetJobRunRequest: """ +@dataclass +class GetJobsLimitsRequest: + region: Optional[Region] + """ + Region to target. If none is passed will use default region from the config. + """ + + +@dataclass +class JobsLimits: + secrets_per_job_definition: int + + @dataclass class ListJobDefinitionSecretsRequest: job_definition_id: str diff --git a/scaleway/scaleway/jobs/v1alpha1/__init__.py b/scaleway/scaleway/jobs/v1alpha1/__init__.py index 91ec71677..31880b355 100644 --- a/scaleway/scaleway/jobs/v1alpha1/__init__.py +++ b/scaleway/scaleway/jobs/v1alpha1/__init__.py @@ -22,6 +22,8 @@ from .types import GetJobDefinitionRequest from .types import GetJobDefinitionSecretRequest from .types import GetJobRunRequest +from .types import GetJobsLimitsRequest +from .types import JobsLimits from .types import ListJobDefinitionSecretsRequest from .types import ListJobDefinitionSecretsResponse from .types import ListJobDefinitionsRequest @@ -60,6 +62,8 @@ "GetJobDefinitionRequest", "GetJobDefinitionSecretRequest", "GetJobRunRequest", + "GetJobsLimitsRequest", + "JobsLimits", "ListJobDefinitionSecretsRequest", "ListJobDefinitionSecretsResponse", "ListJobDefinitionsRequest", diff --git a/scaleway/scaleway/jobs/v1alpha1/api.py b/scaleway/scaleway/jobs/v1alpha1/api.py index e3944ad03..a58a55290 100644 --- a/scaleway/scaleway/jobs/v1alpha1/api.py +++ b/scaleway/scaleway/jobs/v1alpha1/api.py @@ -22,6 +22,7 @@ CreateJobDefinitionSecretsResponse, JobDefinition, JobRun, + JobsLimits, ListJobDefinitionSecretsResponse, ListJobDefinitionsResponse, ListJobRunsResponse, @@ -38,6 +39,7 @@ unmarshal_JobDefinition, unmarshal_JobRun, unmarshal_CreateJobDefinitionSecretsResponse, + unmarshal_JobsLimits, unmarshal_ListJobDefinitionSecretsResponse, unmarshal_ListJobDefinitionsResponse, unmarshal_ListJobRunsResponse, @@ -802,3 +804,31 @@ def list_jobs_resources( self._throw_on_error(res) return unmarshal_ListJobsResourcesResponse(res.json()) + + def get_jobs_limits( + self, + *, + region: Optional[Region] = None, + ) -> JobsLimits: + """ + Get jobs limits for the console. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`JobsLimits ` + + Usage: + :: + + result = api.get_jobs_limits() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/serverless-jobs/v1alpha1/regions/{param_region}/jobs-limits", + ) + + self._throw_on_error(res) + return unmarshal_JobsLimits(res.json()) diff --git a/scaleway/scaleway/jobs/v1alpha1/marshalling.py b/scaleway/scaleway/jobs/v1alpha1/marshalling.py index 649c6a891..17cb1e1d7 100644 --- a/scaleway/scaleway/jobs/v1alpha1/marshalling.py +++ b/scaleway/scaleway/jobs/v1alpha1/marshalling.py @@ -17,6 +17,7 @@ JobDefinition, JobRun, CreateJobDefinitionSecretsResponse, + JobsLimits, ListJobDefinitionSecretsResponse, ListJobDefinitionsResponse, ListJobRunsResponse, @@ -305,6 +306,21 @@ def unmarshal_CreateJobDefinitionSecretsResponse( return CreateJobDefinitionSecretsResponse(**args) +def unmarshal_JobsLimits(data: Any) -> JobsLimits: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'JobsLimits' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("secrets_per_job_definition", None) + if field is not None: + args["secrets_per_job_definition"] = field + + return JobsLimits(**args) + + def unmarshal_ListJobDefinitionSecretsResponse( data: Any, ) -> ListJobDefinitionSecretsResponse: diff --git a/scaleway/scaleway/jobs/v1alpha1/types.py b/scaleway/scaleway/jobs/v1alpha1/types.py index b1ae41e00..2a0dbbb7d 100644 --- a/scaleway/scaleway/jobs/v1alpha1/types.py +++ b/scaleway/scaleway/jobs/v1alpha1/types.py @@ -336,6 +336,19 @@ class GetJobRunRequest: """ +@dataclass +class GetJobsLimitsRequest: + region: Optional[Region] + """ + Region to target. If none is passed will use default region from the config. + """ + + +@dataclass +class JobsLimits: + secrets_per_job_definition: int + + @dataclass class ListJobDefinitionSecretsRequest: job_definition_id: str