From 9e5c6c7359f52f9ed3be288f328868b14507d0e7 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Tue, 17 Mar 2026 12:11:15 +0000 Subject: [PATCH] feat: update generated APIs --- .../applesilicon/v1alpha1/api.py | 5 +- .../scaleway_async/container/v1beta1/api.py | 10 +- .../container/v1beta1/marshalling.py | 30 +- .../scaleway_async/container/v1beta1/types.py | 28 +- .../scaleway_async/dedibox/v1/api.py | 4 +- .../scaleway_async/domain/v2beta1/api.py | 15 +- .../domain/v2beta1/marshalling.py | 44 +-- .../scaleway_async/domain/v2beta1/types.py | 36 +- .../edge_services/v1beta1/api.py | 6 + .../edge_services/v1beta1/marshalling.py | 18 + .../edge_services/v1beta1/types.py | 22 ++ .../environmental_footprint/v1alpha1/types.py | 4 + .../scaleway_async/function/v1beta1/api.py | 10 +- .../function/v1beta1/marshalling.py | 30 +- .../scaleway_async/function/v1beta1/types.py | 28 +- .../iam/v1alpha1/marshalling.py | 24 +- .../scaleway_async/iam/v1alpha1/types.py | 20 +- .../scaleway_async/instance/v1/marshalling.py | 32 +- .../scaleway_async/instance/v1/types.py | 4 +- .../scaleway_async/interlink/v1beta1/api.py | 4 +- .../scaleway_async/jobs/v1alpha2/__init__.py | 22 ++ .../scaleway_async/jobs/v1alpha2/api.py | 252 ++++++++++++ .../jobs/v1alpha2/marshalling.py | 239 +++++++++++- .../scaleway_async/jobs/v1alpha2/types.py | 364 +++++++++++++++++- .../scaleway_async/k8s/v1/marshalling.py | 12 +- scaleway-async/scaleway_async/k8s/v1/types.py | 10 +- .../scaleway_async/lb/v1/marshalling.py | 60 +-- scaleway-async/scaleway_async/lb/v1/types.py | 40 +- .../product_catalog/v2alpha1/types.py | 4 +- .../scaleway_async/rdb/v1/marshalling.py | 24 +- scaleway-async/scaleway_async/rdb/v1/types.py | 12 +- scaleway-async/scaleway_async/vpcgw/v1/api.py | 4 +- scaleway-async/scaleway_async/vpcgw/v2/api.py | 4 +- .../scaleway_async/webhosting/v1/__init__.py | 6 +- .../scaleway_async/webhosting/v1/api.py | 19 +- .../webhosting/v1/marshalling.py | 205 ++++++---- .../scaleway_async/webhosting/v1/types.py | 171 ++++---- .../scaleway/applesilicon/v1alpha1/api.py | 5 +- scaleway/scaleway/container/v1beta1/api.py | 10 +- .../scaleway/container/v1beta1/marshalling.py | 30 +- scaleway/scaleway/container/v1beta1/types.py | 28 +- scaleway/scaleway/dedibox/v1/api.py | 4 +- scaleway/scaleway/domain/v2beta1/api.py | 15 +- .../scaleway/domain/v2beta1/marshalling.py | 44 +-- scaleway/scaleway/domain/v2beta1/types.py | 36 +- .../scaleway/edge_services/v1beta1/api.py | 6 + .../edge_services/v1beta1/marshalling.py | 18 + .../scaleway/edge_services/v1beta1/types.py | 22 ++ .../environmental_footprint/v1alpha1/types.py | 4 + scaleway/scaleway/function/v1beta1/api.py | 10 +- .../scaleway/function/v1beta1/marshalling.py | 30 +- scaleway/scaleway/function/v1beta1/types.py | 28 +- scaleway/scaleway/iam/v1alpha1/marshalling.py | 24 +- scaleway/scaleway/iam/v1alpha1/types.py | 20 +- scaleway/scaleway/instance/v1/custom_api.py | 4 +- scaleway/scaleway/instance/v1/marshalling.py | 32 +- scaleway/scaleway/instance/v1/types.py | 4 +- scaleway/scaleway/interlink/v1beta1/api.py | 4 +- scaleway/scaleway/jobs/v1alpha2/__init__.py | 22 ++ scaleway/scaleway/jobs/v1alpha2/api.py | 252 ++++++++++++ .../scaleway/jobs/v1alpha2/marshalling.py | 239 +++++++++++- scaleway/scaleway/jobs/v1alpha2/types.py | 364 +++++++++++++++++- scaleway/scaleway/k8s/v1/marshalling.py | 12 +- scaleway/scaleway/k8s/v1/types.py | 10 +- scaleway/scaleway/lb/v1/marshalling.py | 60 +-- scaleway/scaleway/lb/v1/types.py | 40 +- .../product_catalog/v2alpha1/types.py | 4 +- scaleway/scaleway/rdb/v1/marshalling.py | 24 +- scaleway/scaleway/rdb/v1/types.py | 12 +- scaleway/scaleway/vpcgw/v1/api.py | 4 +- scaleway/scaleway/vpcgw/v2/api.py | 4 +- scaleway/scaleway/webhosting/v1/__init__.py | 6 +- scaleway/scaleway/webhosting/v1/api.py | 19 +- .../scaleway/webhosting/v1/marshalling.py | 205 ++++++---- scaleway/scaleway/webhosting/v1/types.py | 171 ++++---- 75 files changed, 2786 insertions(+), 862 deletions(-) diff --git a/scaleway-async/scaleway_async/applesilicon/v1alpha1/api.py b/scaleway-async/scaleway_async/applesilicon/v1alpha1/api.py index 8e0879e09..8a49e6f15 100644 --- a/scaleway-async/scaleway_async/applesilicon/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/applesilicon/v1alpha1/api.py @@ -1106,9 +1106,8 @@ async def wait_for_server_private_network( options = WaitForOptions() if not options.stop: - options.stop = ( - lambda res: res.status - not in SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES + options.stop = lambda res: ( + res.status not in SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES ) return await wait_for_resource_async( diff --git a/scaleway-async/scaleway_async/container/v1beta1/api.py b/scaleway-async/scaleway_async/container/v1beta1/api.py index fa0cf522f..3f75db9f2 100644 --- a/scaleway-async/scaleway_async/container/v1beta1/api.py +++ b/scaleway-async/scaleway_async/container/v1beta1/api.py @@ -267,7 +267,6 @@ async def wait_for_namespace( async def create_namespace( self, *, - activate_vpc_integration: bool, region: Optional[ScwRegion] = None, name: Optional[str] = None, environment_variables: Optional[dict[str, str]] = None, @@ -275,11 +274,11 @@ async def create_namespace( description: Optional[str] = None, secret_environment_variables: Optional[list[Secret]] = None, tags: Optional[list[str]] = None, + activate_vpc_integration: Optional[bool] = None, ) -> Namespace: """ Create a new namespace. Create a new namespace in a specified region. - :param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future. :param region: Region to target. If none is passed will use default region from the config. :param name: Name of the namespace to create. :param environment_variables: Environment variables of the namespace to create. @@ -287,14 +286,13 @@ async def create_namespace( :param description: Description of the namespace to create. :param secret_environment_variables: Secret environment variables of the namespace to create. :param tags: Tags of the Serverless Container Namespace. + :param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future. :return: :class:`Namespace ` Usage: :: - result = await api.create_namespace( - activate_vpc_integration=False, - ) + result = await api.create_namespace() """ param_region = validate_path_param( @@ -306,7 +304,6 @@ async def create_namespace( f"/containers/v1beta1/regions/{param_region}/namespaces", body=marshal_CreateNamespaceRequest( CreateNamespaceRequest( - activate_vpc_integration=activate_vpc_integration, region=region, name=name or random_name(prefix="cns"), environment_variables=environment_variables, @@ -314,6 +311,7 @@ async def create_namespace( description=description, secret_environment_variables=secret_environment_variables, tags=tags, + activate_vpc_integration=activate_vpc_integration, ), self.client, ), diff --git a/scaleway-async/scaleway_async/container/v1beta1/marshalling.py b/scaleway-async/scaleway_async/container/v1beta1/marshalling.py index e444dd2d3..6127a1641 100644 --- a/scaleway-async/scaleway_async/container/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/container/v1beta1/marshalling.py @@ -563,12 +563,6 @@ def unmarshal_Namespace(data: Any) -> Namespace: else: args["tags"] = [] - field = data.get("vpc_integration_activated", None) - if field is not None: - args["vpc_integration_activated"] = field - else: - args["vpc_integration_activated"] = False - field = data.get("description", None) if field is not None: args["description"] = field @@ -587,6 +581,12 @@ def unmarshal_Namespace(data: Any) -> Namespace: else: args["updated_at"] = None + field = data.get("vpc_integration_activated", None) + if field is not None: + args["vpc_integration_activated"] = field + else: + args["vpc_integration_activated"] = False + return Namespace(**args) @@ -610,12 +610,6 @@ def unmarshal_Token(data: Any) -> Token: else: args["token"] = None - field = data.get("public_key", None) - if field is not None: - args["public_key"] = field - else: - args["public_key"] = None - field = data.get("status", None) if field is not None: args["status"] = field @@ -634,6 +628,12 @@ def unmarshal_Token(data: Any) -> Token: else: args["namespace_id"] = None + field = data.get("public_key", None) + if field is not None: + args["public_key"] = field + else: + args["public_key"] = None + field = data.get("description", None) if field is not None: args["description"] = field @@ -1208,9 +1208,6 @@ def marshal_CreateNamespaceRequest( ) -> dict[str, Any]: output: dict[str, Any] = {} - if request.activate_vpc_integration is not None: - output["activate_vpc_integration"] = request.activate_vpc_integration - if request.name is not None: output["name"] = request.name @@ -1234,6 +1231,9 @@ def marshal_CreateNamespaceRequest( if request.tags is not None: output["tags"] = request.tags + if request.activate_vpc_integration is not None: + output["activate_vpc_integration"] = request.activate_vpc_integration + return output diff --git a/scaleway-async/scaleway_async/container/v1beta1/types.py b/scaleway-async/scaleway_async/container/v1beta1/types.py index 08e934001..9af1508d9 100644 --- a/scaleway-async/scaleway_async/container/v1beta1/types.py +++ b/scaleway-async/scaleway_async/container/v1beta1/types.py @@ -655,11 +655,6 @@ class Namespace: List of tags applied to the Serverless Container Namespace. """ - vpc_integration_activated: bool - """ - The value of this field doesn't matter anymore, and will be removed in a near future. - """ - error_message: Optional[str] = None """ Last error message of the namesace. @@ -680,6 +675,11 @@ class Namespace: Last update date of the namespace. """ + vpc_integration_activated: Optional[bool] = False + """ + The value of this field doesn't matter anymore, and will be removed in a near future. + """ + @dataclass class Token: @@ -693,14 +693,14 @@ class Token: Identifier of the token. """ - public_key: str + status: TokenStatus """ - Public key of the token. + Status of the token. """ - status: TokenStatus + public_key: Optional[str] = None """ - Status of the token. + Public key of the token. """ description: Optional[str] = None @@ -949,11 +949,6 @@ class CreateDomainRequest: @dataclass class CreateNamespaceRequest: - activate_vpc_integration: bool - """ - Setting this field to true doesn't matter anymore. It will be removed in a near future. - """ - region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. @@ -989,6 +984,11 @@ class CreateNamespaceRequest: Tags of the Serverless Container Namespace. """ + activate_vpc_integration: Optional[bool] = False + """ + Setting this field to true doesn't matter anymore. It will be removed in a near future. + """ + @dataclass class CreateTokenRequest: diff --git a/scaleway-async/scaleway_async/dedibox/v1/api.py b/scaleway-async/scaleway_async/dedibox/v1/api.py index a6cf8a81a..90f3e71cb 100644 --- a/scaleway-async/scaleway_async/dedibox/v1/api.py +++ b/scaleway-async/scaleway_async/dedibox/v1/api.py @@ -1352,8 +1352,8 @@ async def wait_for_server_install( options = WaitForOptions() if not options.stop: - options.stop = ( - lambda res: res.status not in SERVER_INSTALL_TRANSIENT_STATUSES + options.stop = lambda res: ( + res.status not in SERVER_INSTALL_TRANSIENT_STATUSES ) return await wait_for_resource_async( diff --git a/scaleway-async/scaleway_async/domain/v2beta1/api.py b/scaleway-async/scaleway_async/domain/v2beta1/api.py index 8a27d75d6..16f8eb714 100644 --- a/scaleway-async/scaleway_async/domain/v2beta1/api.py +++ b/scaleway-async/scaleway_async/domain/v2beta1/api.py @@ -189,12 +189,12 @@ async def list_dns_zones( self, *, domain: str, - dns_zone: str, organization_id: Optional[str] = None, project_id: Optional[str] = None, order_by: Optional[ListDNSZonesRequestOrderBy] = None, page: Optional[int] = None, page_size: Optional[int] = None, + dns_zone: Optional[str] = None, dns_zones: Optional[list[str]] = None, created_after: Optional[datetime] = None, created_before: Optional[datetime] = None, @@ -205,12 +205,12 @@ async def list_dns_zones( List DNS zones. Retrieve the list of DNS zones you can manage and filter DNS zones associated with specific domain names. :param domain: Domain on which to filter the returned DNS zones. - :param dns_zone: DNS zone on which to filter the returned DNS zones. :param organization_id: Organization ID on which to filter the returned DNS zones. :param project_id: Project ID on which to filter the returned DNS zones. :param order_by: Sort order of the returned DNS zones. :param page: Page number to return, from the paginated results. :param page_size: Maximum number of DNS zones to return per page. + :param dns_zone: DNS zone on which to filter the returned DNS zones. :param dns_zones: DNS zones on which to filter the returned DNS zones. :param created_after: Only list DNS zones created after this date. :param created_before: Only list DNS zones created before this date. @@ -223,7 +223,6 @@ async def list_dns_zones( result = await api.list_dns_zones( domain="example", - dns_zone="example", ) """ @@ -254,12 +253,12 @@ async def list_dns_zones_all( self, *, domain: str, - dns_zone: str, organization_id: Optional[str] = None, project_id: Optional[str] = None, order_by: Optional[ListDNSZonesRequestOrderBy] = None, page: Optional[int] = None, page_size: Optional[int] = None, + dns_zone: Optional[str] = None, dns_zones: Optional[list[str]] = None, created_after: Optional[datetime] = None, created_before: Optional[datetime] = None, @@ -270,12 +269,12 @@ async def list_dns_zones_all( List DNS zones. Retrieve the list of DNS zones you can manage and filter DNS zones associated with specific domain names. :param domain: Domain on which to filter the returned DNS zones. - :param dns_zone: DNS zone on which to filter the returned DNS zones. :param organization_id: Organization ID on which to filter the returned DNS zones. :param project_id: Project ID on which to filter the returned DNS zones. :param order_by: Sort order of the returned DNS zones. :param page: Page number to return, from the paginated results. :param page_size: Maximum number of DNS zones to return per page. + :param dns_zone: DNS zone on which to filter the returned DNS zones. :param dns_zones: DNS zones on which to filter the returned DNS zones. :param created_after: Only list DNS zones created after this date. :param created_before: Only list DNS zones created before this date. @@ -288,7 +287,6 @@ async def list_dns_zones_all( result = await api.list_dns_zones_all( domain="example", - dns_zone="example", ) """ @@ -298,12 +296,12 @@ async def list_dns_zones_all( fetcher=self.list_dns_zones, args={ "domain": domain, - "dns_zone": dns_zone, "organization_id": organization_id, "project_id": project_id, "order_by": order_by, "page": page, "page_size": page_size, + "dns_zone": dns_zone, "dns_zones": dns_zones, "created_after": created_after, "created_before": created_before, @@ -776,7 +774,7 @@ async def import_raw_dns_zone( self, *, dns_zone: str, - content: str, + content: Optional[str] = None, project_id: Optional[str] = None, format: Optional[RawFormat] = None, bind_source: Optional[ImportRawDNSZoneRequestBindSource] = None, @@ -800,7 +798,6 @@ async def import_raw_dns_zone( result = await api.import_raw_dns_zone( dns_zone="example", - content="example", ) """ diff --git a/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py b/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py index 5b723688b..f7c870119 100644 --- a/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py +++ b/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py @@ -316,6 +316,12 @@ def unmarshal_ContactExtensionIT(data: Any) -> ContactExtensionIT: args: dict[str, Any] = {} + field = data.get("pin", None) + if field is not None: + args["pin"] = field + else: + args["pin"] = None + field = data.get("european_citizenship", None) if field is not None: args["european_citizenship"] = field @@ -328,12 +334,6 @@ def unmarshal_ContactExtensionIT(data: Any) -> ContactExtensionIT: else: args["tax_code"] = None - field = data.get("pin", None) - if field is not None: - args["pin"] = field - else: - args["pin"] = None - return ContactExtensionIT(**args) @@ -535,14 +535,6 @@ def unmarshal_Contact(data: Any) -> Contact: else: args["status"] = ContactStatus.STATUS_UNKNOWN - field = data.get("questions", None) - if field is not None: - args["questions"] = ( - [unmarshal_ContactQuestion(v) for v in field] if field is not None else None - ) - else: - args["questions"] = [] - field = data.get("extension_nl", None) if field is not None: args["extension_nl"] = unmarshal_ContactExtensionNL(field) @@ -555,6 +547,14 @@ def unmarshal_Contact(data: Any) -> Contact: else: args["extension_it"] = None + field = data.get("questions", None) + if field is not None: + args["questions"] = ( + [unmarshal_ContactQuestion(v) for v in field] if field is not None else None + ) + else: + args["questions"] = [] + return Contact(**args) @@ -3028,15 +3028,15 @@ def marshal_ContactExtensionIT( ) -> dict[str, Any]: output: dict[str, Any] = {} + if request.pin is not None: + output["pin"] = request.pin + if request.european_citizenship is not None: output["european_citizenship"] = request.european_citizenship if request.tax_code is not None: output["tax_code"] = request.tax_code - if request.pin is not None: - output["pin"] = request.pin - return output @@ -3126,11 +3126,6 @@ def marshal_NewContact( if request.whois_opt_in is not None: output["whois_opt_in"] = request.whois_opt_in - if request.questions is not None: - output["questions"] = [ - marshal_ContactQuestion(item, defaults) for item in request.questions - ] - if request.vat_identification_code is not None: output["vat_identification_code"] = request.vat_identification_code @@ -3160,6 +3155,11 @@ def marshal_NewContact( request.extension_it, defaults ) + if request.questions is not None: + output["questions"] = [ + marshal_ContactQuestion(item, defaults) for item in request.questions + ] + return output diff --git a/scaleway-async/scaleway_async/domain/v2beta1/types.py b/scaleway-async/scaleway_async/domain/v2beta1/types.py index 9a5d68df2..0439afa60 100644 --- a/scaleway-async/scaleway_async/domain/v2beta1/types.py +++ b/scaleway-async/scaleway_async/domain/v2beta1/types.py @@ -518,16 +518,6 @@ class ContactExtensionFR: @dataclass class ContactExtensionIT: - european_citizenship: str - """ - This option is useless anymore. - """ - - tax_code: str - """ - Tax_code is renamed to pin. - """ - pin: str """ Domain name registrant's Taxcode (mandatory / only optional when the trustee is used) @@ -538,6 +528,16 @@ class ContactExtensionIT: * In all other cases it must be equal to VAT number (in the 16 characters format if nationality is IT) or the numeric Codice Fiscale. """ + european_citizenship: Optional[str] = None + """ + This option is useless anymore. + """ + + tax_code: Optional[str] = None + """ + Tax_code is renamed to pin. + """ + @dataclass class ContactExtensionNL: @@ -623,11 +623,11 @@ class Contact: email_status: ContactEmailStatus state: str status: ContactStatus - questions: list[ContactQuestion] extension_fr: Optional[ContactExtensionFR] = None extension_eu: Optional[ContactExtensionEU] = None extension_nl: Optional[ContactExtensionNL] = None extension_it: Optional[ContactExtensionIT] = None + questions: Optional[list[ContactQuestion]] = field(default_factory=list) @dataclass @@ -674,7 +674,6 @@ class NewContact: lang: StdLanguageCode resale: bool whois_opt_in: bool - questions: list[ContactQuestion] company_name: Optional[str] = None email_alt: Optional[str] = None fax_number: Optional[str] = None @@ -686,6 +685,7 @@ class NewContact: state: Optional[str] = None extension_nl: Optional[ContactExtensionNL] = None extension_it: Optional[ContactExtensionIT] = None + questions: Optional[list[ContactQuestion]] = field(default_factory=list) @dataclass @@ -1187,7 +1187,7 @@ class ImportRawDNSZoneRequest: DNS zone to import. """ - content: str + content: Optional[str] = None project_id: Optional[str] = None format: Optional[RawFormat] = RawFormat.UNKNOWN_RAW_FORMAT bind_source: Optional[ImportRawDNSZoneRequestBindSource] = None @@ -1340,11 +1340,6 @@ class ListDNSZonesRequest: Domain on which to filter the returned DNS zones. """ - dns_zone: str - """ - DNS zone on which to filter the returned DNS zones. - """ - organization_id: Optional[str] = None """ Organization ID on which to filter the returned DNS zones. @@ -1372,6 +1367,11 @@ class ListDNSZonesRequest: Maximum number of DNS zones to return per page. """ + dns_zone: Optional[str] = None + """ + DNS zone on which to filter the returned DNS zones. + """ + dns_zones: Optional[list[str]] = field(default_factory=list) """ DNS zones on which to filter the returned DNS zones. diff --git a/scaleway-async/scaleway_async/edge_services/v1beta1/api.py b/scaleway-async/scaleway_async/edge_services/v1beta1/api.py index 72fba252e..2ce6704c3 100644 --- a/scaleway-async/scaleway_async/edge_services/v1beta1/api.py +++ b/scaleway-async/scaleway_async/edge_services/v1beta1/api.py @@ -703,6 +703,7 @@ async def create_dns_stage( cache_stage_id: Optional[str] = None, backend_stage_id: Optional[str] = None, pipeline_id: str, + wildcard_domain: Optional[bool] = None, ) -> DNSStage: """ Create DNS stage. @@ -715,6 +716,7 @@ async def create_dns_stage( :param backend_stage_id: Backend stage ID the DNS stage will be linked to. One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. :param pipeline_id: Pipeline ID the DNS stage belongs to. + :param wildcard_domain: Support of wildcard (subdomains) for the given domain (a wildcard certificate is required to make it work). :return: :class:`DNSStage ` Usage: @@ -734,6 +736,7 @@ async def create_dns_stage( CreateDNSStageRequest( fqdns=fqdns, pipeline_id=pipeline_id, + wildcard_domain=wildcard_domain, tls_stage_id=tls_stage_id, cache_stage_id=cache_stage_id, backend_stage_id=backend_stage_id, @@ -782,6 +785,7 @@ async def update_dns_stage( tls_stage_id: Optional[str] = None, cache_stage_id: Optional[str] = None, backend_stage_id: Optional[str] = None, + wildcard_domain: Optional[bool] = None, ) -> DNSStage: """ Update DNS stage. @@ -794,6 +798,7 @@ async def update_dns_stage( One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. :param backend_stage_id: Backend stage ID the DNS stage will be linked to. One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. + :param wildcard_domain: Support of wildcard (subdomains) for the given domain (a wildcard certificate is required to make it work). :return: :class:`DNSStage ` Usage: @@ -813,6 +818,7 @@ async def update_dns_stage( UpdateDNSStageRequest( dns_stage_id=dns_stage_id, fqdns=fqdns, + wildcard_domain=wildcard_domain, tls_stage_id=tls_stage_id, cache_stage_id=cache_stage_id, backend_stage_id=backend_stage_id, diff --git a/scaleway-async/scaleway_async/edge_services/v1beta1/marshalling.py b/scaleway-async/scaleway_async/edge_services/v1beta1/marshalling.py index c8619cb80..123e36cf2 100644 --- a/scaleway-async/scaleway_async/edge_services/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/edge_services/v1beta1/marshalling.py @@ -405,6 +405,12 @@ def unmarshal_DNSStage(data: Any) -> DNSStage: else: args["pipeline_id"] = None + field = data.get("wildcard_domain", None) + if field is not None: + args["wildcard_domain"] = field + else: + args["wildcard_domain"] = False + field = data.get("created_at", None) if field is not None: args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -1073,6 +1079,12 @@ def unmarshal_PlanDetails(data: Any) -> PlanDetails: else: args["backend_limit"] = 0 + field = data.get("wildcard_domain", None) + if field is not None: + args["wildcard_domain"] = field + else: + args["wildcard_domain"] = False + return PlanDetails(**args) @@ -1942,6 +1954,9 @@ def marshal_CreateDNSStageRequest( if request.fqdns is not None: output["fqdns"] = request.fqdns + if request.wildcard_domain is not None: + output["wildcard_domain"] = request.wildcard_domain + return output @@ -2295,6 +2310,9 @@ def marshal_UpdateDNSStageRequest( if request.fqdns is not None: output["fqdns"] = request.fqdns + if request.wildcard_domain is not None: + output["wildcard_domain"] = request.wildcard_domain + return output diff --git a/scaleway-async/scaleway_async/edge_services/v1beta1/types.py b/scaleway-async/scaleway_async/edge_services/v1beta1/types.py index 18089d3ad..debc78ea7 100644 --- a/scaleway-async/scaleway_async/edge_services/v1beta1/types.py +++ b/scaleway-async/scaleway_async/edge_services/v1beta1/types.py @@ -135,6 +135,8 @@ class PipelineErrorCode(str, Enum, metaclass=StrEnumMeta): TLS_KEY_TOO_MANY = "tls_key_too_many" TLS_MANAGED_DOMAIN_RATE_LIMIT = "tls_managed_domain_rate_limit" TLS_MANAGED_INTERNAL = "tls_managed_internal" + TLS_MANAGED_UNSUPPORTED = "tls_managed_unsupported" + TLS_NOT_WILDCARD = "tls_not_wildcard" TLS_PAIR_MISMATCH = "tls_pair_mismatch" TLS_ROOT_INCONSISTENT = "tls_root_inconsistent" TLS_ROOT_INCORRECT = "tls_root_incorrect" @@ -495,6 +497,11 @@ class DNSStage: Pipeline ID the DNS stage belongs to. """ + wildcard_domain: bool + """ + Support of wildcard (subdomains) for the given domain (a wildcard certificate is required to make it work). + """ + created_at: Optional[datetime] = None """ Date the DNS stage was created. @@ -729,6 +736,11 @@ class PlanDetails: Number of backends per pipeline included in subscription plan. """ + wildcard_domain: bool + """ + Support of wildcard subdomains for the customized domain. + """ + @dataclass class PlanUsageDetails: @@ -935,6 +947,11 @@ class CreateDNSStageRequest: Fully Qualified Domain Name (in the format subdomain.example.com) to attach to the stage. """ + wildcard_domain: Optional[bool] = False + """ + Support of wildcard (subdomains) for the given domain (a wildcard certificate is required to make it work). + """ + tls_stage_id: Optional[str] = None cache_stage_id: Optional[str] = None @@ -1811,6 +1828,11 @@ class UpdateDNSStageRequest: Fully Qualified Domain Name (in the format subdomain.example.com) attached to the stage. """ + wildcard_domain: Optional[bool] = False + """ + Support of wildcard (subdomains) for the given domain (a wildcard certificate is required to make it work). + """ + tls_stage_id: Optional[str] = None cache_stage_id: Optional[str] = None diff --git a/scaleway-async/scaleway_async/environmental_footprint/v1alpha1/types.py b/scaleway-async/scaleway_async/environmental_footprint/v1alpha1/types.py index 5e9d8eddb..429fdbd58 100644 --- a/scaleway-async/scaleway_async/environmental_footprint/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/environmental_footprint/v1alpha1/types.py @@ -26,6 +26,9 @@ class ProductCategory(str, Enum, metaclass=StrEnumMeta): OBJECT_STORAGE = "object_storage" LOAD_BALANCER = "load_balancer" KUBERNETES = "kubernetes" + MANAGED_RELATIONAL_DATABASES = "managed_relational_databases" + MANAGED_MONGODB = "managed_mongodb" + MANAGED_REDIS = "managed_redis" def __str__(self) -> str: return str(self.value) @@ -47,6 +50,7 @@ class ServiceCategory(str, Enum, metaclass=StrEnumMeta): STORAGE = "storage" NETWORK = "network" CONTAINERS = "containers" + DATABASES = "databases" def __str__(self) -> str: return str(self.value) diff --git a/scaleway-async/scaleway_async/function/v1beta1/api.py b/scaleway-async/scaleway_async/function/v1beta1/api.py index a5b36eeb4..cf47a7a5a 100644 --- a/scaleway-async/scaleway_async/function/v1beta1/api.py +++ b/scaleway-async/scaleway_async/function/v1beta1/api.py @@ -271,7 +271,6 @@ async def wait_for_namespace( async def create_namespace( self, *, - activate_vpc_integration: bool, region: Optional[ScwRegion] = None, name: Optional[str] = None, environment_variables: Optional[dict[str, str]] = None, @@ -279,11 +278,11 @@ async def create_namespace( description: Optional[str] = None, secret_environment_variables: Optional[list[Secret]] = None, tags: Optional[list[str]] = None, + activate_vpc_integration: Optional[bool] = None, ) -> Namespace: """ Create a new namespace. Create a new namespace in a specified Organization or Project. - :param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future. :param region: Region to target. If none is passed will use default region from the config. :param name: :param environment_variables: Environment variables of the namespace. @@ -291,14 +290,13 @@ async def create_namespace( :param description: Description of the namespace. :param secret_environment_variables: Secret environment variables of the namespace. :param tags: Tags of the Serverless Function Namespace. + :param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future. :return: :class:`Namespace ` Usage: :: - result = await api.create_namespace( - activate_vpc_integration=False, - ) + result = await api.create_namespace() """ param_region = validate_path_param( @@ -310,7 +308,6 @@ async def create_namespace( f"/functions/v1beta1/regions/{param_region}/namespaces", body=marshal_CreateNamespaceRequest( CreateNamespaceRequest( - activate_vpc_integration=activate_vpc_integration, region=region, name=name or random_name(prefix="ns"), environment_variables=environment_variables, @@ -318,6 +315,7 @@ async def create_namespace( description=description, secret_environment_variables=secret_environment_variables, tags=tags, + activate_vpc_integration=activate_vpc_integration, ), self.client, ), diff --git a/scaleway-async/scaleway_async/function/v1beta1/marshalling.py b/scaleway-async/scaleway_async/function/v1beta1/marshalling.py index 9df8e13b0..80a6e3a9b 100644 --- a/scaleway-async/scaleway_async/function/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/function/v1beta1/marshalling.py @@ -437,12 +437,6 @@ def unmarshal_Namespace(data: Any) -> Namespace: else: args["tags"] = [] - field = data.get("vpc_integration_activated", None) - if field is not None: - args["vpc_integration_activated"] = field - else: - args["vpc_integration_activated"] = False - field = data.get("description", None) if field is not None: args["description"] = field @@ -461,6 +455,12 @@ def unmarshal_Namespace(data: Any) -> Namespace: else: args["updated_at"] = None + field = data.get("vpc_integration_activated", None) + if field is not None: + args["vpc_integration_activated"] = field + else: + args["vpc_integration_activated"] = False + return Namespace(**args) @@ -484,12 +484,6 @@ def unmarshal_Token(data: Any) -> Token: else: args["token"] = None - field = data.get("public_key", None) - if field is not None: - args["public_key"] = field - else: - args["public_key"] = None - field = data.get("status", None) if field is not None: args["status"] = field @@ -508,6 +502,12 @@ def unmarshal_Token(data: Any) -> Token: else: args["namespace_id"] = None + field = data.get("public_key", None) + if field is not None: + args["public_key"] = field + else: + args["public_key"] = None + field = data.get("description", None) if field is not None: args["description"] = field @@ -1114,9 +1114,6 @@ def marshal_CreateNamespaceRequest( ) -> dict[str, Any]: output: dict[str, Any] = {} - if request.activate_vpc_integration is not None: - output["activate_vpc_integration"] = request.activate_vpc_integration - if request.name is not None: output["name"] = request.name @@ -1140,6 +1137,9 @@ def marshal_CreateNamespaceRequest( if request.tags is not None: output["tags"] = request.tags + if request.activate_vpc_integration is not None: + output["activate_vpc_integration"] = request.activate_vpc_integration + return output diff --git a/scaleway-async/scaleway_async/function/v1beta1/types.py b/scaleway-async/scaleway_async/function/v1beta1/types.py index 5d3c4332a..85391b085 100644 --- a/scaleway-async/scaleway_async/function/v1beta1/types.py +++ b/scaleway-async/scaleway_async/function/v1beta1/types.py @@ -628,11 +628,6 @@ class Namespace: List of tags applied to the Serverless Function Namespace. """ - vpc_integration_activated: bool - """ - The value of this field doesn't matter anymore, and will be removed in a near future. - """ - error_message: Optional[str] = None """ Error message if the namespace is in "error" state. @@ -653,6 +648,11 @@ class Namespace: Last update date of the namespace. """ + vpc_integration_activated: Optional[bool] = False + """ + The value of this field doesn't matter anymore, and will be removed in a near future. + """ + @dataclass class Token: @@ -666,14 +666,14 @@ class Token: String of the token. """ - public_key: str + status: TokenStatus """ - Public key of the token. + Status of the token. """ - status: TokenStatus + public_key: Optional[str] = None """ - Status of the token. + Public key of the token. """ description: Optional[str] = None @@ -875,11 +875,6 @@ class CreateFunctionRequest: @dataclass class CreateNamespaceRequest: - activate_vpc_integration: bool - """ - Setting this field to true doesn't matter anymore. It will be removed in a near future. - """ - region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. @@ -911,6 +906,11 @@ class CreateNamespaceRequest: Tags of the Serverless Function Namespace. """ + activate_vpc_integration: Optional[bool] = False + """ + Setting this field to true doesn't matter anymore. It will be removed in a near future. + """ + @dataclass class CreateTokenRequest: diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py index 8b2c87aed..f808bb676 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py @@ -927,18 +927,6 @@ def unmarshal_User(data: Any) -> User: else: args["type_"] = UserType.UNKNOWN_TYPE - field = data.get("two_factor_enabled", None) - if field is not None: - args["two_factor_enabled"] = field - else: - args["two_factor_enabled"] = False - - field = data.get("status", None) - if field is not None: - args["status"] = field - else: - args["status"] = UserStatus.UNKNOWN_STATUS - field = data.get("mfa", None) if field is not None: args["mfa"] = field @@ -963,6 +951,18 @@ def unmarshal_User(data: Any) -> User: else: args["locked"] = False + field = data.get("two_factor_enabled", None) + if field is not None: + args["two_factor_enabled"] = field + else: + args["two_factor_enabled"] = False + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = UserStatus.UNKNOWN_STATUS + return User(**args) diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/types.py b/scaleway-async/scaleway_async/iam/v1alpha1/types.py index 09bb21f20..e8d66f710 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/types.py @@ -977,16 +977,6 @@ class User: Type of user. """ - two_factor_enabled: bool - """ - Deprecated, use "mfa" instead. - """ - - status: UserStatus - """ - Status of user invitation. - """ - mfa: bool """ Defines whether MFA is enabled. @@ -1022,6 +1012,16 @@ class User: Date of the last login. """ + two_factor_enabled: Optional[bool] = False + """ + Deprecated, use "mfa" instead. + """ + + status: Optional[UserStatus] = UserStatus.UNKNOWN_STATUS + """ + Status of user invitation. + """ + @dataclass class SamlServiceProvider: diff --git a/scaleway-async/scaleway_async/instance/v1/marshalling.py b/scaleway-async/scaleway_async/instance/v1/marshalling.py index 2e72fdb36..2055d5a75 100644 --- a/scaleway-async/scaleway_async/instance/v1/marshalling.py +++ b/scaleway-async/scaleway_async/instance/v1/marshalling.py @@ -1905,97 +1905,97 @@ def unmarshal_Dashboard(data: Any) -> Dashboard: if field is not None: args["volumes_count"] = field else: - args["volumes_count"] = None + args["volumes_count"] = 0 field = data.get("running_servers_count", None) if field is not None: args["running_servers_count"] = field else: - args["running_servers_count"] = None + args["running_servers_count"] = 0 field = data.get("servers_by_types", None) if field is not None: args["servers_by_types"] = field else: - args["servers_by_types"] = None + args["servers_by_types"] = {} field = data.get("images_count", None) if field is not None: args["images_count"] = field else: - args["images_count"] = None + args["images_count"] = 0 field = data.get("snapshots_count", None) if field is not None: args["snapshots_count"] = field else: - args["snapshots_count"] = None + args["snapshots_count"] = 0 field = data.get("servers_count", None) if field is not None: args["servers_count"] = field else: - args["servers_count"] = None + args["servers_count"] = 0 field = data.get("ips_count", None) if field is not None: args["ips_count"] = field else: - args["ips_count"] = None + args["ips_count"] = 0 field = data.get("security_groups_count", None) if field is not None: args["security_groups_count"] = field else: - args["security_groups_count"] = None + args["security_groups_count"] = 0 field = data.get("ips_unused", None) if field is not None: args["ips_unused"] = field else: - args["ips_unused"] = None + args["ips_unused"] = 0 field = data.get("volumes_l_ssd_count", None) if field is not None: args["volumes_l_ssd_count"] = field else: - args["volumes_l_ssd_count"] = None + args["volumes_l_ssd_count"] = 0 field = data.get("volumes_l_ssd_total_size", None) if field is not None: args["volumes_l_ssd_total_size"] = field else: - args["volumes_l_ssd_total_size"] = None + args["volumes_l_ssd_total_size"] = 0 field = data.get("private_nics_count", None) if field is not None: args["private_nics_count"] = field else: - args["private_nics_count"] = None + args["private_nics_count"] = 0 field = data.get("placement_groups_count", None) if field is not None: args["placement_groups_count"] = field else: - args["placement_groups_count"] = None + args["placement_groups_count"] = 0 field = data.get("volumes_scratch_count", None) if field is not None: args["volumes_scratch_count"] = field else: - args["volumes_scratch_count"] = None + args["volumes_scratch_count"] = 0 field = data.get("volumes_b_ssd_count", None) if field is not None: args["volumes_b_ssd_count"] = field else: - args["volumes_b_ssd_count"] = None + args["volumes_b_ssd_count"] = 0 field = data.get("volumes_b_ssd_total_size", None) if field is not None: args["volumes_b_ssd_total_size"] = field else: - args["volumes_b_ssd_total_size"] = None + args["volumes_b_ssd_total_size"] = 0 return Dashboard(**args) diff --git a/scaleway-async/scaleway_async/instance/v1/types.py b/scaleway-async/scaleway_async/instance/v1/types.py index 4470ba522..57a918ef8 100644 --- a/scaleway-async/scaleway_async/instance/v1/types.py +++ b/scaleway-async/scaleway_async/instance/v1/types.py @@ -1265,8 +1265,8 @@ class Dashboard: private_nics_count: int placement_groups_count: int volumes_scratch_count: int - volumes_b_ssd_count: Optional[int] = None - volumes_b_ssd_total_size: Optional[int] = None + volumes_b_ssd_count: Optional[int] = 0 + volumes_b_ssd_total_size: Optional[int] = 0 @dataclass diff --git a/scaleway-async/scaleway_async/interlink/v1beta1/api.py b/scaleway-async/scaleway_async/interlink/v1beta1/api.py index e0ac46b7e..f2140b4ec 100644 --- a/scaleway-async/scaleway_async/interlink/v1beta1/api.py +++ b/scaleway-async/scaleway_async/interlink/v1beta1/api.py @@ -253,8 +253,8 @@ async def wait_for_dedicated_connection( options = WaitForOptions() if not options.stop: - options.stop = ( - lambda res: res.status not in DEDICATED_CONNECTION_TRANSIENT_STATUSES + options.stop = lambda res: ( + res.status not in DEDICATED_CONNECTION_TRANSIENT_STATUSES ) return await wait_for_resource_async( diff --git a/scaleway-async/scaleway_async/jobs/v1alpha2/__init__.py b/scaleway-async/scaleway_async/jobs/v1alpha2/__init__.py index 453c9acd3..1e3d1ebdc 100644 --- a/scaleway-async/scaleway_async/jobs/v1alpha2/__init__.py +++ b/scaleway-async/scaleway_async/jobs/v1alpha2/__init__.py @@ -5,26 +5,34 @@ from .content import JOB_RUN_TRANSIENT_STATUSES from .types import ListJobDefinitionsRequestOrderBy from .types import ListJobRunsRequestOrderBy +from .types import ListTriggersRequestOrderBy from .types import SecretEnvVar from .types import SecretFile from .types import CronSchedule from .types import RetryPolicy +from .types import TriggerCronConfig from .types import CreateJobDefinitionRequestCronScheduleConfig from .types import CreateSecretsRequestSecretConfig from .types import Secret +from .types import CreateTriggerRequestCronConfig from .types import JobDefinition from .types import Resource from .types import JobRun +from .types import Trigger from .types import UpdateJobDefinitionRequestCronScheduleConfig +from .types import UpdateTriggerRequestCronConfig from .types import CreateJobDefinitionRequest from .types import CreateSecretsRequest from .types import CreateSecretsResponse +from .types import CreateTriggerRequest from .types import DeleteJobDefinitionRequest from .types import DeleteSecretRequest +from .types import DeleteTriggerRequest from .types import GetJobDefinitionRequest from .types import GetJobLimitsRequest from .types import GetJobRunRequest from .types import GetSecretRequest +from .types import GetTriggerRequest from .types import JobLimits from .types import ListJobDefinitionsRequest from .types import ListJobDefinitionsResponse @@ -34,11 +42,14 @@ from .types import ListJobRunsResponse from .types import ListSecretsRequest from .types import ListSecretsResponse +from .types import ListTriggersRequest +from .types import ListTriggersResponse from .types import StartJobDefinitionRequest from .types import StartJobDefinitionResponse from .types import StopJobRunRequest from .types import UpdateJobDefinitionRequest from .types import UpdateSecretRequest +from .types import UpdateTriggerRequest from .api import JobsV1Alpha2API __all__ = [ @@ -47,26 +58,34 @@ "JOB_RUN_TRANSIENT_STATUSES", "ListJobDefinitionsRequestOrderBy", "ListJobRunsRequestOrderBy", + "ListTriggersRequestOrderBy", "SecretEnvVar", "SecretFile", "CronSchedule", "RetryPolicy", + "TriggerCronConfig", "CreateJobDefinitionRequestCronScheduleConfig", "CreateSecretsRequestSecretConfig", "Secret", + "CreateTriggerRequestCronConfig", "JobDefinition", "Resource", "JobRun", + "Trigger", "UpdateJobDefinitionRequestCronScheduleConfig", + "UpdateTriggerRequestCronConfig", "CreateJobDefinitionRequest", "CreateSecretsRequest", "CreateSecretsResponse", + "CreateTriggerRequest", "DeleteJobDefinitionRequest", "DeleteSecretRequest", + "DeleteTriggerRequest", "GetJobDefinitionRequest", "GetJobLimitsRequest", "GetJobRunRequest", "GetSecretRequest", + "GetTriggerRequest", "JobLimits", "ListJobDefinitionsRequest", "ListJobDefinitionsResponse", @@ -76,10 +95,13 @@ "ListJobRunsResponse", "ListSecretsRequest", "ListSecretsResponse", + "ListTriggersRequest", + "ListTriggersResponse", "StartJobDefinitionRequest", "StartJobDefinitionResponse", "StopJobRunRequest", "UpdateJobDefinitionRequest", "UpdateSecretRequest", + "UpdateTriggerRequest", "JobsV1Alpha2API", ] diff --git a/scaleway-async/scaleway_async/jobs/v1alpha2/api.py b/scaleway-async/scaleway_async/jobs/v1alpha2/api.py index 0057f5cf8..4a7c69ded 100644 --- a/scaleway-async/scaleway_async/jobs/v1alpha2/api.py +++ b/scaleway-async/scaleway_async/jobs/v1alpha2/api.py @@ -17,11 +17,14 @@ JobRunState, ListJobDefinitionsRequestOrderBy, ListJobRunsRequestOrderBy, + ListTriggersRequestOrderBy, CreateJobDefinitionRequest, CreateJobDefinitionRequestCronScheduleConfig, CreateSecretsRequest, CreateSecretsRequestSecretConfig, CreateSecretsResponse, + CreateTriggerRequest, + CreateTriggerRequestCronConfig, JobDefinition, JobLimits, JobRun, @@ -29,30 +32,38 @@ ListJobResourcesResponse, ListJobRunsResponse, ListSecretsResponse, + ListTriggersResponse, RetryPolicy, Secret, StartJobDefinitionRequest, StartJobDefinitionResponse, + Trigger, UpdateJobDefinitionRequest, UpdateJobDefinitionRequestCronScheduleConfig, UpdateSecretRequest, + UpdateTriggerRequest, + UpdateTriggerRequestCronConfig, ) from .marshalling import ( unmarshal_Secret, unmarshal_JobDefinition, unmarshal_JobRun, + unmarshal_Trigger, unmarshal_CreateSecretsResponse, unmarshal_JobLimits, unmarshal_ListJobDefinitionsResponse, unmarshal_ListJobResourcesResponse, unmarshal_ListJobRunsResponse, unmarshal_ListSecretsResponse, + unmarshal_ListTriggersResponse, unmarshal_StartJobDefinitionResponse, marshal_CreateJobDefinitionRequest, marshal_CreateSecretsRequest, + marshal_CreateTriggerRequest, marshal_StartJobDefinitionRequest, marshal_UpdateJobDefinitionRequest, marshal_UpdateSecretRequest, + marshal_UpdateTriggerRequest, ) @@ -814,6 +825,247 @@ async def delete_secret( self._throw_on_error(res) + async def create_trigger( + self, + *, + job_definition_id: str, + name: str, + region: Optional[ScwRegion] = None, + cron_config: Optional[CreateTriggerRequestCronConfig] = None, + ) -> Trigger: + """ + Create a trigger. + :param job_definition_id: UUID of the job definition. + :param name: Name of the trigger. + :param region: Region to target. If none is passed will use default region from the config. + :param cron_config: Configuration of the CRON trigger. + One-Of ('config'): at most one of 'cron_config' could be set. + :return: :class:`Trigger ` + + Usage: + :: + + result = await api.create_trigger( + job_definition_id="example", + name="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "POST", + f"/serverless-jobs/v1alpha2/regions/{param_region}/triggers", + body=marshal_CreateTriggerRequest( + CreateTriggerRequest( + job_definition_id=job_definition_id, + name=name, + region=region, + cron_config=cron_config, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_Trigger(res.json()) + + async def get_trigger( + self, + *, + trigger_id: str, + region: Optional[ScwRegion] = None, + ) -> Trigger: + """ + Get a trigger. + :param trigger_id: UUID of the trigger. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`Trigger ` + + Usage: + :: + + result = await api.get_trigger( + trigger_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_trigger_id = validate_path_param("trigger_id", trigger_id) + + res = self._request( + "GET", + f"/serverless-jobs/v1alpha2/regions/{param_region}/triggers/{param_trigger_id}", + ) + + self._throw_on_error(res) + return unmarshal_Trigger(res.json()) + + async def list_triggers( + self, + *, + job_definition_id: str, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListTriggersRequestOrderBy] = None, + ) -> ListTriggersResponse: + """ + List triggers of a job definition. + :param job_definition_id: UUID of the job definition. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Page number from paginated list of triggers. + :param page_size: Number of triggers per page. + :param order_by: Sorting order of triggers. + :return: :class:`ListTriggersResponse ` + + Usage: + :: + + result = await api.list_triggers( + job_definition_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/serverless-jobs/v1alpha2/regions/{param_region}/triggers", + params={ + "job_definition_id": job_definition_id, + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListTriggersResponse(res.json()) + + async def list_triggers_all( + self, + *, + job_definition_id: str, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListTriggersRequestOrderBy] = None, + ) -> list[Trigger]: + """ + List triggers of a job definition. + :param job_definition_id: UUID of the job definition. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Page number from paginated list of triggers. + :param page_size: Number of triggers per page. + :param order_by: Sorting order of triggers. + :return: :class:`list[Trigger] ` + + Usage: + :: + + result = await api.list_triggers_all( + job_definition_id="example", + ) + """ + + return await fetch_all_pages_async( + type=ListTriggersResponse, + key="triggers", + fetcher=self.list_triggers, + args={ + "job_definition_id": job_definition_id, + "region": region, + "page": page, + "page_size": page_size, + "order_by": order_by, + }, + ) + + async def update_trigger( + self, + *, + trigger_id: str, + region: Optional[ScwRegion] = None, + name: Optional[str] = None, + cron_config: Optional[UpdateTriggerRequestCronConfig] = None, + ) -> Trigger: + """ + Update a trigger. + :param trigger_id: UUID of the trigger. + :param region: Region to target. If none is passed will use default region from the config. + :param name: Name of the trigger. + :param cron_config: Configuration of the CRON trigger. + One-Of ('config'): at most one of 'cron_config' could be set. + :return: :class:`Trigger ` + + Usage: + :: + + result = await api.update_trigger( + trigger_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_trigger_id = validate_path_param("trigger_id", trigger_id) + + res = self._request( + "PATCH", + f"/serverless-jobs/v1alpha2/regions/{param_region}/triggers/{param_trigger_id}", + body=marshal_UpdateTriggerRequest( + UpdateTriggerRequest( + trigger_id=trigger_id, + region=region, + name=name, + cron_config=cron_config, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_Trigger(res.json()) + + async def delete_trigger( + self, + *, + trigger_id: str, + region: Optional[ScwRegion] = None, + ) -> None: + """ + Delete a trigger. + :param trigger_id: UUID of the trigger. + :param region: Region to target. If none is passed will use default region from the config. + + Usage: + :: + + result = await api.delete_trigger( + trigger_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_trigger_id = validate_path_param("trigger_id", trigger_id) + + res = self._request( + "DELETE", + f"/serverless-jobs/v1alpha2/regions/{param_region}/triggers/{param_trigger_id}", + ) + + self._throw_on_error(res) + async def list_job_resources( self, *, diff --git a/scaleway-async/scaleway_async/jobs/v1alpha2/marshalling.py b/scaleway-async/scaleway_async/jobs/v1alpha2/marshalling.py index 6d4729d1e..e1d5675df 100644 --- a/scaleway-async/scaleway_async/jobs/v1alpha2/marshalling.py +++ b/scaleway-async/scaleway_async/jobs/v1alpha2/marshalling.py @@ -10,6 +10,8 @@ resolve_one_of, ) from .types import ( + JobRunReason, + JobRunState, SecretEnvVar, SecretFile, Secret, @@ -17,6 +19,8 @@ RetryPolicy, JobDefinition, JobRun, + TriggerCronConfig, + Trigger, CreateSecretsResponse, JobLimits, ListJobDefinitionsResponse, @@ -24,15 +28,20 @@ ListJobResourcesResponse, ListJobRunsResponse, ListSecretsResponse, + ListTriggersResponse, StartJobDefinitionResponse, CreateJobDefinitionRequestCronScheduleConfig, CreateJobDefinitionRequest, CreateSecretsRequestSecretConfig, CreateSecretsRequest, + CreateTriggerRequestCronConfig, + CreateTriggerRequest, StartJobDefinitionRequest, UpdateJobDefinitionRequestCronScheduleConfig, UpdateJobDefinitionRequest, UpdateSecretRequest, + UpdateTriggerRequestCronConfig, + UpdateTriggerRequest, ) @@ -187,19 +196,19 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition: if field is not None: args["cpu_limit"] = field else: - args["cpu_limit"] = None + args["cpu_limit"] = 0 field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field else: - args["memory_limit"] = None + args["memory_limit"] = 0 field = data.get("local_storage_capacity", None) if field is not None: args["local_storage_capacity"] = field else: - args["local_storage_capacity"] = None + args["local_storage_capacity"] = 0 field = data.get("image_uri", None) if field is not None: @@ -211,7 +220,7 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition: if field is not None: args["environment_variables"] = field else: - args["environment_variables"] = None + args["environment_variables"] = {} field = data.get("created_at", None) if field is not None: @@ -247,13 +256,13 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition: if field is not None: args["startup_command"] = field else: - args["startup_command"] = None + args["startup_command"] = [] field = data.get("args", None) if field is not None: args["args"] = field else: - args["args"] = None + args["args"] = [] field = data.get("region", None) if field is not None: @@ -300,13 +309,13 @@ def unmarshal_JobRun(data: Any) -> JobRun: if field is not None: args["state"] = field else: - args["state"] = None + args["state"] = JobRunState.UNKNOWN_STATE field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field else: - args["cpu_limit"] = None + args["cpu_limit"] = 0 field = data.get("created_at", None) if field is not None: @@ -330,31 +339,31 @@ def unmarshal_JobRun(data: Any) -> JobRun: if field is not None: args["memory_limit"] = field else: - args["memory_limit"] = None + args["memory_limit"] = 0 field = data.get("local_storage_capacity", None) if field is not None: args["local_storage_capacity"] = field else: - args["local_storage_capacity"] = None + args["local_storage_capacity"] = 0 field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field else: - args["environment_variables"] = None + args["environment_variables"] = {} field = data.get("startup_command", None) if field is not None: args["startup_command"] = field else: - args["startup_command"] = None + args["startup_command"] = [] field = data.get("args", None) if field is not None: args["args"] = field else: - args["args"] = None + args["args"] = [] field = data.get("region", None) if field is not None: @@ -380,13 +389,13 @@ def unmarshal_JobRun(data: Any) -> JobRun: if field is not None: args["reason"] = field else: - args["reason"] = None + args["reason"] = JobRunReason.UNKNOWN_REASON field = data.get("exit_code", None) if field is not None: args["exit_code"] = field else: - args["exit_code"] = None + args["exit_code"] = 0 field = data.get("error_message", None) if field is not None: @@ -404,11 +413,93 @@ def unmarshal_JobRun(data: Any) -> JobRun: if field is not None: args["attempts"] = field else: - args["attempts"] = None + args["attempts"] = 0 return JobRun(**args) +def unmarshal_TriggerCronConfig(data: Any) -> TriggerCronConfig: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'TriggerCronConfig' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("schedule", None) + if field is not None: + args["schedule"] = field + else: + args["schedule"] = None + + field = data.get("timezone", None) + if field is not None: + args["timezone"] = field + else: + args["timezone"] = None + + field = data.get("startup_command", None) + if field is not None: + args["startup_command"] = field + else: + args["startup_command"] = [] + + field = data.get("args", None) + if field is not None: + args["args"] = field + else: + args["args"] = [] + + return TriggerCronConfig(**args) + + +def unmarshal_Trigger(data: Any) -> Trigger: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Trigger' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + else: + args["id"] = None + + field = data.get("job_definition_id", None) + if field is not None: + args["job_definition_id"] = field + else: + args["job_definition_id"] = None + + field = data.get("name", None) + if field is not None: + args["name"] = field + else: + args["name"] = None + + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("updated_at", None) + if field is not None: + args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["updated_at"] = None + + field = data.get("cron_config", None) + if field is not None: + args["cron_config"] = unmarshal_TriggerCronConfig(field) + else: + args["cron_config"] = None + + return Trigger(**args) + + def unmarshal_CreateSecretsResponse(data: Any) -> CreateSecretsResponse: if not isinstance(data, dict): raise TypeError( @@ -562,6 +653,31 @@ def unmarshal_ListSecretsResponse(data: Any) -> ListSecretsResponse: return ListSecretsResponse(**args) +def unmarshal_ListTriggersResponse(data: Any) -> ListTriggersResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListTriggersResponse' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("triggers", None) + if field is not None: + args["triggers"] = ( + [unmarshal_Trigger(v) for v in field] if field is not None else None + ) + else: + args["triggers"] = [] + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = 0 + + return ListTriggersResponse(**args) + + def unmarshal_StartJobDefinitionResponse(data: Any) -> StartJobDefinitionResponse: if not isinstance(data, dict): raise TypeError( @@ -708,6 +824,53 @@ def marshal_CreateSecretsRequest( return output +def marshal_CreateTriggerRequestCronConfig( + request: CreateTriggerRequestCronConfig, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + if request.schedule is not None: + output["schedule"] = request.schedule + + if request.timezone is not None: + output["timezone"] = request.timezone + + if request.startup_command is not None: + output["startup_command"] = request.startup_command + + if request.args is not None: + output["args"] = request.args + + return output + + +def marshal_CreateTriggerRequest( + request: CreateTriggerRequest, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + output.update( + resolve_one_of( + [ + OneOfPossibility( + param="cron_config", + value=request.cron_config, + marshal_func=marshal_CreateTriggerRequestCronConfig, + ), + ] + ), + ) + + if request.job_definition_id is not None: + output["job_definition_id"] = request.job_definition_id + + if request.name is not None: + output["name"] = request.name + + return output + + def marshal_StartJobDefinitionRequest( request: StartJobDefinitionRequest, defaults: ProfileDefaults, @@ -817,3 +980,47 @@ def marshal_UpdateSecretRequest( output["secret_manager_version"] = request.secret_manager_version return output + + +def marshal_UpdateTriggerRequestCronConfig( + request: UpdateTriggerRequestCronConfig, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + if request.schedule is not None: + output["schedule"] = request.schedule + + if request.timezone is not None: + output["timezone"] = request.timezone + + if request.startup_command is not None: + output["startup_command"] = request.startup_command + + if request.args is not None: + output["args"] = request.args + + return output + + +def marshal_UpdateTriggerRequest( + request: UpdateTriggerRequest, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + output.update( + resolve_one_of( + [ + OneOfPossibility( + param="cron_config", + value=request.cron_config, + marshal_func=marshal_UpdateTriggerRequestCronConfig, + ), + ] + ), + ) + + if request.name is not None: + output["name"] = request.name + + return output diff --git a/scaleway-async/scaleway_async/jobs/v1alpha2/types.py b/scaleway-async/scaleway_async/jobs/v1alpha2/types.py index 1f13dc4f4..3a6776a36 100644 --- a/scaleway-async/scaleway_async/jobs/v1alpha2/types.py +++ b/scaleway-async/scaleway_async/jobs/v1alpha2/types.py @@ -66,6 +66,14 @@ def __str__(self) -> str: return str(self.value) +class ListTriggersRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_ASC = "created_at_asc" + CREATED_AT_DESC = "created_at_desc" + + def __str__(self) -> str: + return str(self.value) + + @dataclass class SecretEnvVar: name: str @@ -97,6 +105,29 @@ class RetryPolicy: """ +@dataclass +class TriggerCronConfig: + schedule: str + """ + CRON schedule in UNIX format. + """ + + timezone: str + """ + Time zone for the CRON schedule. + """ + + startup_command: list[str] + """ + Startup command that will be used by the triggered job. + """ + + args: list[str] + """ + Arguments passed to the startup command used by the triggered job. + """ + + @dataclass class CreateJobDefinitionRequestCronScheduleConfig: schedule: str @@ -139,30 +170,120 @@ class Secret: env_var: Optional[SecretEnvVar] = None +@dataclass +class CreateTriggerRequestCronConfig: + schedule: str + """ + CRON schedule in UNIX format. + """ + + timezone: str + """ + Time zone for the CRON schedule. + """ + + startup_command: list[str] + """ + Startup command that will be used by the triggered job. + """ + + args: list[str] + """ + Arguments passed to the startup command used by the triggered job. + """ + + @dataclass class JobDefinition: id: str + """ + UUID of the job definition. + """ + name: str + """ + Name of the job definition. + """ + project_id: str + """ + UUID of the Scaleway Project containing the job. + """ + cpu_limit: int + """ + CPU limit of the job (in mvCPU). + """ + memory_limit: int + """ + Memory limit of the job (in MiB). + """ + local_storage_capacity: int + """ + Local storage capacity of the job (in MiB). + """ + image_uri: str + """ + Image to use for the job. + """ + environment_variables: dict[str, str] + """ + Environment variables of the job. + """ + description: str + """ + Description of the job. + """ + startup_command: list[str] + """ + Job startup command. + """ + args: list[str] + """ + Job arguments passed to the startup command at runtime. + """ + region: ScwRegion """ Region to target. If none is passed will use default region from the config. """ created_at: Optional[datetime] = None + """ + Creation date of the job definition. + """ + updated_at: Optional[datetime] = None + """ + Last update date of the job definition. + """ + command: Optional[str] = None + """ + Deprecated, please use startup_command instead. + """ + job_timeout: Optional[str] = None + """ + Timeout of the job in seconds. + """ + cron_schedule: Optional[CronSchedule] = None + """ + Configure a cron for the job. + """ + retry_policy: Optional[RetryPolicy] = None + """ + Retry behaviour in case of job failure. + """ @dataclass @@ -174,29 +295,134 @@ class Resource: @dataclass class JobRun: id: str + """ + UUID of the job run. + """ + job_definition_id: str + """ + UUID of the job definition. + """ + state: JobRunState + """ + State of the job run. + """ + cpu_limit: int + """ + CPU limit of the job (in mvCPU). + """ + memory_limit: int + """ + Memory limit of the job (in MiB). + """ + local_storage_capacity: int + """ + Local storage capacity of the job (in MiB). + """ + environment_variables: dict[str, str] + """ + Environment variables of the job run. + """ + startup_command: list[str] + """ + Job startup command. + """ + args: list[str] + """ + Job arguments passed to the startup command at runtime. + """ + region: ScwRegion """ Region to target. If none is passed will use default region from the config. """ created_at: Optional[datetime] = None + """ + Creation date of the job run. + """ + updated_at: Optional[datetime] = None + """ + Last update date of the job run. + """ + started_at: Optional[datetime] = None + """ + Start date of the job run. + """ + terminated_at: Optional[datetime] = None + """ + Termination date of the job run. + """ + run_duration: Optional[str] = None - reason: Optional[JobRunReason] = None - exit_code: Optional[int] = None + """ + Duration of the job run. + """ + + reason: Optional[JobRunReason] = JobRunReason.UNKNOWN_REASON + """ + Reason for failure if the job failed. + """ + + exit_code: Optional[int] = 0 + """ + Exit code of the job. + """ + error_message: Optional[str] = None + """ + Error message if the job failed. + """ + command: Optional[str] = None - attempts: Optional[int] = None + """ + Deprecated, please use startup_command instead. + """ + + attempts: Optional[int] = 0 + """ + Number of retry attempts. + """ + + +@dataclass +class Trigger: + id: str + """ + UUID of the trigger. + """ + + job_definition_id: str + """ + UUID of the job definition. + """ + + name: str + """ + Human readable name of the trigger. + """ + + created_at: Optional[datetime] = None + """ + Creation time of the trigger. + """ + + updated_at: Optional[datetime] = None + """ + Last update time of the trigger. + """ + + cron_config: Optional[TriggerCronConfig] = None @dataclass @@ -205,6 +431,29 @@ class UpdateJobDefinitionRequestCronScheduleConfig: timezone: Optional[str] = None +@dataclass +class UpdateTriggerRequestCronConfig: + schedule: Optional[str] = None + """ + CRON schedule in UNIX format. + """ + + timezone: Optional[str] = None + """ + Time zone for the CRON schedule. + """ + + startup_command: Optional[list[str]] = field(default_factory=list) + """ + Startup command that will be used by the triggered job. + """ + + args: Optional[list[str]] = field(default_factory=list) + """ + Arguments passed to the startup command used by the triggered job. + """ + + @dataclass class CreateJobDefinitionRequest: cpu_limit: int @@ -311,6 +560,26 @@ class CreateSecretsResponse: """ +@dataclass +class CreateTriggerRequest: + job_definition_id: str + """ + UUID of the job definition. + """ + + name: str + """ + Name of the trigger. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + cron_config: Optional[CreateTriggerRequestCronConfig] = None + + @dataclass class DeleteJobDefinitionRequest: job_definition_id: str @@ -337,6 +606,19 @@ class DeleteSecretRequest: """ +@dataclass +class DeleteTriggerRequest: + trigger_id: str + """ + UUID of the trigger. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class GetJobDefinitionRequest: job_definition_id: str @@ -384,6 +666,19 @@ class GetSecretRequest: """ +@dataclass +class GetTriggerRequest: + trigger_id: str + """ + UUID of the trigger. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class JobLimits: secrets_per_job_definition: int @@ -472,6 +767,49 @@ class ListSecretsResponse: """ +@dataclass +class ListTriggersRequest: + job_definition_id: str + """ + UUID of the job definition. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + page: Optional[int] = 0 + """ + Page number from paginated list of triggers. + """ + + page_size: Optional[int] = 0 + """ + Number of triggers per page. + """ + + order_by: Optional[ListTriggersRequestOrderBy] = ( + ListTriggersRequestOrderBy.CREATED_AT_ASC + ) + """ + Sorting order of triggers. + """ + + +@dataclass +class ListTriggersResponse: + triggers: list[Trigger] + """ + List of triggers. + """ + + total_count: int + """ + Total count of triggers. + """ + + @dataclass class StartJobDefinitionRequest: job_definition_id: str @@ -636,3 +974,23 @@ class UpdateSecretRequest: path: Optional[str] = None env_var_name: Optional[str] = None + + +@dataclass +class UpdateTriggerRequest: + trigger_id: str + """ + UUID of the trigger. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + name: Optional[str] = None + """ + Name of the trigger. + """ + + cron_config: Optional[UpdateTriggerRequestCronConfig] = None diff --git a/scaleway-async/scaleway_async/k8s/v1/marshalling.py b/scaleway-async/scaleway_async/k8s/v1/marshalling.py index c7ba7bf54..7b0f034cb 100644 --- a/scaleway-async/scaleway_async/k8s/v1/marshalling.py +++ b/scaleway-async/scaleway_async/k8s/v1/marshalling.py @@ -470,12 +470,6 @@ def unmarshal_Cluster(data: Any) -> Cluster: else: args["apiserver_cert_sans"] = [] - field = data.get("acl_available", None) - if field is not None: - args["acl_available"] = field - else: - args["acl_available"] = False - field = data.get("iam_nodes_group_id", None) if field is not None: args["iam_nodes_group_id"] = field @@ -514,6 +508,12 @@ def unmarshal_Cluster(data: Any) -> Cluster: else: args["commitment_ends_at"] = None + field = data.get("acl_available", None) + if field is not None: + args["acl_available"] = field + else: + args["acl_available"] = False + return Cluster(**args) diff --git a/scaleway-async/scaleway_async/k8s/v1/types.py b/scaleway-async/scaleway_async/k8s/v1/types.py index ef2d2a05d..5ae02fa07 100644 --- a/scaleway-async/scaleway_async/k8s/v1/types.py +++ b/scaleway-async/scaleway_async/k8s/v1/types.py @@ -814,11 +814,6 @@ class Cluster: Additional Subject Alternative Names for the Kubernetes API server certificate. """ - acl_available: bool - """ - Defines whether ACL is available on the cluster. - """ - iam_nodes_group_id: str """ IAM group that nodes are members of (this field might be empty during early stage of cluster creation). @@ -874,6 +869,11 @@ class Cluster: Date on which it will be possible to switch to a smaller offer. """ + acl_available: Optional[bool] = False + """ + Defines whether ACL is available on the cluster. + """ + @dataclass class Node: diff --git a/scaleway-async/scaleway_async/lb/v1/marshalling.py b/scaleway-async/scaleway_async/lb/v1/marshalling.py index 13215d66e..a1d2aef14 100644 --- a/scaleway-async/scaleway_async/lb/v1/marshalling.py +++ b/scaleway-async/scaleway_async/lb/v1/marshalling.py @@ -167,12 +167,6 @@ def unmarshal_Ip(data: Any) -> Ip: else: args["tags"] = [] - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - field = data.get("zone", None) if field is not None: args["zone"] = field @@ -185,6 +179,12 @@ def unmarshal_Ip(data: Any) -> Ip: else: args["lb_id"] = None + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + return Ip(**args) @@ -515,12 +515,6 @@ def unmarshal_Instance(data: Any) -> Instance: else: args["ip_address"] = None - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - field = data.get("zone", None) if field is not None: args["zone"] = field @@ -539,6 +533,12 @@ def unmarshal_Instance(data: Any) -> Instance: else: args["updated_at"] = None + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + return Instance(**args) @@ -644,12 +644,6 @@ def unmarshal_Lb(data: Any) -> Lb: else: args["route_count"] = 0 - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - field = data.get("zone", None) if field is not None: args["zone"] = field @@ -674,6 +668,12 @@ def unmarshal_Lb(data: Any) -> Lb: else: args["updated_at"] = None + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + return Lb(**args) @@ -733,12 +733,6 @@ def unmarshal_Backend(data: Any) -> Backend: else: args["pool"] = [] - field = data.get("send_proxy_v2", None) - if field is not None: - args["send_proxy_v2"] = field - else: - args["send_proxy_v2"] = False - field = data.get("on_marked_down_action", None) if field is not None: args["on_marked_down_action"] = field @@ -763,6 +757,12 @@ def unmarshal_Backend(data: Any) -> Backend: else: args["lb"] = None + field = data.get("send_proxy_v2", None) + if field is not None: + args["send_proxy_v2"] = field + else: + args["send_proxy_v2"] = False + field = data.get("timeout_server", None) if field is not None: args["timeout_server"] = field @@ -1645,18 +1645,18 @@ def unmarshal_LbType(data: Any) -> LbType: else: args["description"] = None - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - field = data.get("zone", None) if field is not None: args["zone"] = field else: args["zone"] = None + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + return LbType(**args) diff --git a/scaleway-async/scaleway_async/lb/v1/types.py b/scaleway-async/scaleway_async/lb/v1/types.py index 8657f7b6e..f6ab10591 100644 --- a/scaleway-async/scaleway_async/lb/v1/types.py +++ b/scaleway-async/scaleway_async/lb/v1/types.py @@ -393,11 +393,6 @@ class Instance: Instance IP address. """ - region: ScwRegion - """ - The region the Instance is in. - """ - zone: ScwZone """ The zone the Instance is in. @@ -413,6 +408,11 @@ class Instance: Date on which the Instance was last updated. """ + region: Optional[ScwRegion] = None + """ + The region the Instance is in. + """ + @dataclass class Ip: @@ -446,11 +446,6 @@ class Ip: IP tags. """ - region: ScwRegion - """ - The region the IP address is in. - """ - zone: ScwZone """ The zone the IP address is in. @@ -461,6 +456,11 @@ class Ip: Load Balancer ID. """ + region: Optional[ScwRegion] = None + """ + The region the IP address is in. + """ + @dataclass class Subscriber: @@ -607,11 +607,6 @@ class Lb: Number of routes configured on the Load Balancer. """ - region: ScwRegion - """ - The region the Load Balancer is in. - """ - zone: ScwZone """ The zone the Load Balancer is in. @@ -632,6 +627,11 @@ class Lb: Date on which the Load Balancer was last updated. """ + region: Optional[ScwRegion] = None + """ + The region the Load Balancer is in. + """ + @dataclass class AclActionRedirect: @@ -973,7 +973,7 @@ class PrivateNetworkIpamConfig: @dataclass class PrivateNetworkStaticConfig: - ip_address: list[str] + ip_address: Optional[list[str]] = field(default_factory=list) """ Array of a local IP address for the Load Balancer on this Private Network. """ @@ -1151,14 +1151,14 @@ class LbType: Load Balancer commercial offer type description. """ - region: ScwRegion + zone: ScwZone """ - The region the Load Balancer stock is in. + The zone the Load Balancer stock is in. """ - zone: ScwZone + region: Optional[ScwRegion] = None """ - The zone the Load Balancer stock is in. + The region the Load Balancer stock is in. """ diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py index a95c937ca..a68e05b15 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py @@ -447,12 +447,12 @@ class PublicCatalogProductPropertiesAppleSilicon: @dataclass class PublicCatalogProductPropertiesBlockStorage: - min_volume_size: int + min_volume_size: Optional[int] = 0 """ The minimum size of storage volume for this product in bytes. Deprecated. """ - max_volume_size: int + max_volume_size: Optional[int] = 0 """ The maximum size of storage volume for this product in bytes. Deprecated. """ diff --git a/scaleway-async/scaleway_async/rdb/v1/marshalling.py b/scaleway-async/scaleway_async/rdb/v1/marshalling.py index 0ca045b2c..522381ee7 100644 --- a/scaleway-async/scaleway_async/rdb/v1/marshalling.py +++ b/scaleway-async/scaleway_async/rdb/v1/marshalling.py @@ -1625,18 +1625,6 @@ def unmarshal_NodeType(data: Any) -> NodeType: else: args["memory"] = 0 - field = data.get("volume_constraint", None) - if field is not None: - args["volume_constraint"] = unmarshal_NodeTypeVolumeConstraintSizes(field) - else: - args["volume_constraint"] = None - - field = data.get("is_bssd_compatible", None) - if field is not None: - args["is_bssd_compatible"] = field - else: - args["is_bssd_compatible"] = False - field = data.get("disabled", None) if field is not None: args["disabled"] = field @@ -1649,6 +1637,18 @@ def unmarshal_NodeType(data: Any) -> NodeType: else: args["beta"] = False + field = data.get("volume_constraint", None) + if field is not None: + args["volume_constraint"] = unmarshal_NodeTypeVolumeConstraintSizes(field) + else: + args["volume_constraint"] = None + + field = data.get("is_bssd_compatible", None) + if field is not None: + args["is_bssd_compatible"] = field + else: + args["is_bssd_compatible"] = False + field = data.get("available_volume_types", None) if field is not None: args["available_volume_types"] = ( diff --git a/scaleway-async/scaleway_async/rdb/v1/types.py b/scaleway-async/scaleway_async/rdb/v1/types.py index a78e6ac1f..733c78288 100644 --- a/scaleway-async/scaleway_async/rdb/v1/types.py +++ b/scaleway-async/scaleway_async/rdb/v1/types.py @@ -667,7 +667,7 @@ class ACLRule: direction: ACLRuleDirection action: ACLRuleAction description: str - port: int + port: Optional[int] = 0 @dataclass @@ -992,11 +992,6 @@ class NodeType: Quantity of RAM. """ - is_bssd_compatible: bool - """ - The Node Type is compliant with Block Storage. - """ - disabled: bool """ The Node Type is currently disabled. @@ -1037,6 +1032,11 @@ class NodeType: [deprecated] Node Type volume constraints. """ + is_bssd_compatible: Optional[bool] = False + """ + The Node Type is compliant with Block Storage. + """ + @dataclass class Privilege: diff --git a/scaleway-async/scaleway_async/vpcgw/v1/api.py b/scaleway-async/scaleway_async/vpcgw/v1/api.py index abd53c64f..92d912273 100644 --- a/scaleway-async/scaleway_async/vpcgw/v1/api.py +++ b/scaleway-async/scaleway_async/vpcgw/v1/api.py @@ -696,8 +696,8 @@ async def wait_for_gateway_network( options = WaitForOptions() if not options.stop: - options.stop = ( - lambda res: res.status not in GATEWAY_NETWORK_TRANSIENT_STATUSES + options.stop = lambda res: ( + res.status not in GATEWAY_NETWORK_TRANSIENT_STATUSES ) return await wait_for_resource_async( diff --git a/scaleway-async/scaleway_async/vpcgw/v2/api.py b/scaleway-async/scaleway_async/vpcgw/v2/api.py index 7d104ab35..14e427605 100644 --- a/scaleway-async/scaleway_async/vpcgw/v2/api.py +++ b/scaleway-async/scaleway_async/vpcgw/v2/api.py @@ -630,8 +630,8 @@ async def wait_for_gateway_network( options = WaitForOptions() if not options.stop: - options.stop = ( - lambda res: res.status not in GATEWAY_NETWORK_TRANSIENT_STATUSES + options.stop = lambda res: ( + res.status not in GATEWAY_NETWORK_TRANSIENT_STATUSES ) return await wait_for_resource_async( diff --git a/scaleway-async/scaleway_async/webhosting/v1/__init__.py b/scaleway-async/scaleway_async/webhosting/v1/__init__.py index 5321c8e18..2e0a5da2d 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/__init__.py +++ b/scaleway-async/scaleway_async/webhosting/v1/__init__.py @@ -35,8 +35,8 @@ from .types import AutoConfigDomainDns from .types import PlatformControlPanelUrls from .types import HostingDomainCustomDomain -from .types import ControlPanel from .types import OfferCommitment +from .types import ControlPanel from .types import OfferOption from .types import PlatformControlPanel from .types import BackupItem @@ -48,6 +48,7 @@ from .types import SyncDomainDnsRecordsRequestRecord from .types import DnsRecord from .types import Nameserver +from .types import HostingCommitment from .types import HostingUser from .types import Offer from .types import Platform @@ -185,8 +186,8 @@ "AutoConfigDomainDns", "PlatformControlPanelUrls", "HostingDomainCustomDomain", - "ControlPanel", "OfferCommitment", + "ControlPanel", "OfferOption", "PlatformControlPanel", "BackupItem", @@ -198,6 +199,7 @@ "SyncDomainDnsRecordsRequestRecord", "DnsRecord", "Nameserver", + "HostingCommitment", "HostingUser", "Offer", "Platform", diff --git a/scaleway-async/scaleway_async/webhosting/v1/api.py b/scaleway-async/scaleway_async/webhosting/v1/api.py index d1e023bec..dd0f1f70a 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/api.py +++ b/scaleway-async/scaleway_async/webhosting/v1/api.py @@ -1232,22 +1232,22 @@ async def sync_domain_dns_records( self, *, domain: str, - update_web_records: bool, - update_mail_records: bool, - update_all_records: bool, - update_nameservers: bool, region: Optional[ScwRegion] = None, + update_web_records: Optional[bool] = None, + update_mail_records: Optional[bool] = None, + update_all_records: Optional[bool] = None, + update_nameservers: Optional[bool] = None, custom_records: Optional[list[SyncDomainDnsRecordsRequestRecord]] = None, auto_config_domain_dns: Optional[AutoConfigDomainDns] = None, ) -> DnsRecords: """ Synchronize your DNS records on the Elements Console and on cPanel. :param domain: Domain for which the DNS records will be synchronized. + :param region: Region to target. If none is passed will use default region from the config. :param update_web_records: Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns). :param update_mail_records: Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns). :param update_all_records: Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns). :param update_nameservers: Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns). - :param region: Region to target. If none is passed will use default region from the config. :param custom_records: Custom records to synchronize. :param auto_config_domain_dns: Whether or not to synchronize each types of records. :return: :class:`DnsRecords ` @@ -1257,10 +1257,6 @@ async def sync_domain_dns_records( result = await api.sync_domain_dns_records( domain="example", - update_web_records=False, - update_mail_records=False, - update_all_records=False, - update_nameservers=False, ) """ @@ -1275,11 +1271,11 @@ async def sync_domain_dns_records( body=marshal_DnsApiSyncDomainDnsRecordsRequest( DnsApiSyncDomainDnsRecordsRequest( domain=domain, + region=region, update_web_records=update_web_records, update_mail_records=update_mail_records, update_all_records=update_all_records, update_nameservers=update_nameservers, - region=region, custom_records=custom_records, auto_config_domain_dns=auto_config_domain_dns, ), @@ -1517,6 +1513,7 @@ async def create_hosting( domain_configuration: Optional[CreateHostingRequestDomainConfiguration] = None, skip_welcome_email: Optional[bool] = None, auto_config_domain_dns: Optional[AutoConfigDomainDns] = None, + offer_commitment_id: Optional[str] = None, ) -> Hosting: """ Order a Web Hosting plan. @@ -1533,6 +1530,7 @@ async def create_hosting( :param domain_configuration: Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_config_domain_dns instead). :param skip_welcome_email: Indicates whether to skip a welcome email to the contact email containing hosting info. :param auto_config_domain_dns: Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_update_* fields instead). + :param offer_commitment_id: Offer commitment ID to which the hosting will be engaged. :return: :class:`Hosting ` Usage: @@ -1566,6 +1564,7 @@ async def create_hosting( domain_configuration=domain_configuration, skip_welcome_email=skip_welcome_email, auto_config_domain_dns=auto_config_domain_dns, + offer_commitment_id=offer_commitment_id, ), self.client, ), diff --git a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py index e0859b774..abf00f964 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py +++ b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py @@ -51,10 +51,11 @@ DnsRecords, Domain, PlatformControlPanelUrls, - ControlPanel, OfferCommitment, + ControlPanel, OfferOption, PlatformControlPanel, + HostingCommitment, HostingUser, Offer, Platform, @@ -349,36 +350,18 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: else: args["status"] = HostingStatus.UNKNOWN_STATUS - field = data.get("domain", None) - if field is not None: - args["domain"] = field - else: - args["domain"] = None - field = data.get("protected", None) if field is not None: args["protected"] = field else: args["protected"] = False - field = data.get("dns_status", None) - if field is not None: - args["dns_status"] = field - else: - args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS - field = data.get("offer_name", None) if field is not None: args["offer_name"] = field else: args["offer_name"] = None - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - else: - args["domain_status"] = DomainStatus.UNKNOWN_STATUS - field = data.get("region", None) if field is not None: args["region"] = field @@ -397,6 +380,24 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: else: args["updated_at"] = None + field = data.get("domain", None) + if field is not None: + args["domain"] = field + else: + args["domain"] = None + + field = data.get("dns_status", None) + if field is not None: + args["dns_status"] = field + else: + args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS + + field = data.get("domain_status", None) + if field is not None: + args["domain_status"] = field + else: + args["domain_status"] = DomainStatus.UNKNOWN_STATUS + field = data.get("domain_info", None) if field is not None: args["domain_info"] = unmarshal_HostingDomain(field) @@ -740,43 +741,6 @@ def unmarshal_PlatformControlPanelUrls(data: Any) -> PlatformControlPanelUrls: return PlatformControlPanelUrls(**args) -def unmarshal_ControlPanel(data: Any) -> ControlPanel: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ControlPanel' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("name", None) - if field is not None: - args["name"] = field - else: - args["name"] = None - - field = data.get("available", None) - if field is not None: - args["available"] = field - else: - args["available"] = False - - field = data.get("logo_url", None) - if field is not None: - args["logo_url"] = field - else: - args["logo_url"] = None - - field = data.get("available_languages", None) - if field is not None: - args["available_languages"] = ( - [StdLanguageCode(v) for v in field] if field is not None else None - ) - else: - args["available_languages"] = [] - - return ControlPanel(**args) - - def unmarshal_OfferCommitment(data: Any) -> OfferCommitment: if not isinstance(data, dict): raise TypeError( @@ -830,6 +794,43 @@ def unmarshal_OfferCommitment(data: Any) -> OfferCommitment: return OfferCommitment(**args) +def unmarshal_ControlPanel(data: Any) -> ControlPanel: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ControlPanel' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("name", None) + if field is not None: + args["name"] = field + else: + args["name"] = None + + field = data.get("available", None) + if field is not None: + args["available"] = field + else: + args["available"] = False + + field = data.get("logo_url", None) + if field is not None: + args["logo_url"] = field + else: + args["logo_url"] = None + + field = data.get("available_languages", None) + if field is not None: + args["available_languages"] = ( + [StdLanguageCode(v) for v in field] if field is not None else None + ) + else: + args["available_languages"] = [] + + return ControlPanel(**args) + + def unmarshal_OfferOption(data: Any) -> OfferOption: if not isinstance(data, dict): raise TypeError( @@ -912,6 +913,41 @@ def unmarshal_PlatformControlPanel(data: Any) -> PlatformControlPanel: return PlatformControlPanel(**args) +def unmarshal_HostingCommitment(data: Any) -> HostingCommitment: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'HostingCommitment' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("delete_hosting_at_end", None) + if field is not None: + args["delete_hosting_at_end"] = field + else: + args["delete_hosting_at_end"] = False + + field = data.get("offer_commitment", None) + if field is not None: + args["offer_commitment"] = unmarshal_OfferCommitment(field) + else: + args["offer_commitment"] = None + + field = data.get("start_at", None) + if field is not None: + args["start_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["start_at"] = None + + field = data.get("end_at", None) + if field is not None: + args["end_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["end_at"] = None + + return HostingCommitment(**args) + + def unmarshal_HostingUser(data: Any) -> HostingUser: if not isinstance(data, dict): raise TypeError( @@ -1109,12 +1145,6 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["status"] = HostingStatus.UNKNOWN_STATUS - field = data.get("domain", None) - if field is not None: - args["domain"] = field - else: - args["domain"] = None - field = data.get("updated_at", None) if field is not None: args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -1127,6 +1157,12 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["created_at"] = None + field = data.get("domain", None) + if field is not None: + args["domain"] = field + else: + args["domain"] = None + field = data.get("offer", None) if field is not None: args["offer"] = unmarshal_Offer(field) @@ -1145,12 +1181,6 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["tags"] = [] - field = data.get("dns_status", None) - if field is not None: - args["dns_status"] = field - else: - args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS - field = data.get("ipv4", None) if field is not None: args["ipv4"] = field @@ -1163,30 +1193,42 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["protected"] = False - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - else: - args["domain_status"] = DomainStatus.UNKNOWN_STATUS - field = data.get("region", None) if field is not None: args["region"] = field else: args["region"] = None + field = data.get("dns_status", None) + if field is not None: + args["dns_status"] = field + else: + args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS + field = data.get("user", None) if field is not None: args["user"] = unmarshal_HostingUser(field) else: args["user"] = None + field = data.get("domain_status", None) + if field is not None: + args["domain_status"] = field + else: + args["domain_status"] = DomainStatus.UNKNOWN_STATUS + field = data.get("domain_info", None) if field is not None: args["domain_info"] = unmarshal_HostingDomain(field) else: args["domain_info"] = None + field = data.get("commitment", None) + if field is not None: + args["commitment"] = unmarshal_HostingCommitment(field) + else: + args["commitment"] = None + return Hosting(**args) @@ -1634,18 +1676,18 @@ def unmarshal_ResetHostingPasswordResponse(data: Any) -> ResetHostingPasswordRes args: dict[str, Any] = {} - field = data.get("one_time_password", None) - if field is not None: - args["one_time_password"] = field - else: - args["one_time_password"] = None - field = data.get("one_time_password_b64", None) if field is not None: args["one_time_password_b64"] = field else: args["one_time_password_b64"] = None + field = data.get("one_time_password", None) + if field is not None: + args["one_time_password"] = field + else: + args["one_time_password"] = None + return ResetHostingPasswordResponse(**args) @@ -2138,6 +2180,9 @@ def marshal_HostingApiCreateHostingRequest( request.auto_config_domain_dns, defaults ) + if request.offer_commitment_id is not None: + output["offer_commitment_id"] = request.offer_commitment_id + return output diff --git a/scaleway-async/scaleway_async/webhosting/v1/types.py b/scaleway-async/scaleway_async/webhosting/v1/types.py index e1f026571..11a9088d1 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/types.py +++ b/scaleway-async/scaleway_async/webhosting/v1/types.py @@ -385,29 +385,6 @@ class HostingDomainCustomDomain: """ -@dataclass -class ControlPanel: - name: str - """ - Control panel name. - """ - - available: bool - """ - Define if the control panel type is available to order. - """ - - logo_url: str - """ - URL of the control panel's logo. - """ - - available_languages: list[StdLanguageCode] - """ - List of available languages for the control panel. - """ - - @dataclass class OfferCommitment: id: str @@ -446,6 +423,29 @@ class OfferCommitment: """ +@dataclass +class ControlPanel: + name: str + """ + Control panel name. + """ + + available: bool + """ + Define if the control panel type is available to order. + """ + + logo_url: str + """ + URL of the control panel's logo. + """ + + available_languages: list[StdLanguageCode] + """ + List of available languages for the control panel. + """ + + @dataclass class OfferOption: id: str @@ -650,6 +650,31 @@ class Nameserver: """ +@dataclass +class HostingCommitment: + delete_hosting_at_end: bool + """ + The hosting may be deleted, automatically renewed, or switched to +its configured post-commitment offer, which may have a different +price and billing period. + """ + + offer_commitment: Optional[OfferCommitment] = None + """ + Offer commitment for the specified hosting. + """ + + start_at: Optional[datetime] = None + """ + Date and time the commitment started. + """ + + end_at: Optional[datetime] = None + """ + Date and time the commitment ends. + """ + + @dataclass class HostingUser: username: str @@ -866,31 +891,16 @@ class HostingSummary: Status of the Web Hosting plan. """ - domain: str - """ - Main domain associated with the Web Hosting plan (deprecated, use domain_info). - """ - protected: bool """ Whether the hosting is protected or not. """ - dns_status: DnsRecordsStatus - """ - DNS status of the Web Hosting plan. - """ - offer_name: str """ Name of the active offer for the Web Hosting plan. """ - domain_status: DomainStatus - """ - Main domain status of the Web Hosting plan. - """ - region: ScwRegion """ Region where the Web Hosting plan is hosted. @@ -906,6 +916,21 @@ class HostingSummary: Date on which the Web Hosting plan was last updated. """ + domain: Optional[str] = None + """ + Main domain associated with the Web Hosting plan (deprecated, use domain_info). + """ + + dns_status: Optional[DnsRecordsStatus] = DnsRecordsStatus.UNKNOWN_STATUS + """ + DNS status of the Web Hosting plan. + """ + + domain_status: Optional[DomainStatus] = DomainStatus.UNKNOWN_STATUS + """ + Main domain status of the Web Hosting plan. + """ + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). @@ -1498,31 +1523,31 @@ class DnsApiSyncDomainDnsRecordsRequest: Domain for which the DNS records will be synchronized. """ - update_web_records: bool + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + update_web_records: Optional[bool] = False """ Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns). """ - update_mail_records: bool + update_mail_records: Optional[bool] = False """ Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns). """ - update_all_records: bool + update_all_records: Optional[bool] = False """ Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns). """ - update_nameservers: bool + update_nameservers: Optional[bool] = False """ Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns). """ - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - custom_records: Optional[list[SyncDomainDnsRecordsRequestRecord]] = field( default_factory=list ) @@ -1553,7 +1578,7 @@ class DnsRecords: Status of the records. """ - dns_config: list[DomainDnsAction] + dns_config: Optional[list[DomainDnsAction]] = field(default_factory=list) """ Records dns auto configuration settings (deprecated, use auto_config_domain_dns). """ @@ -1591,7 +1616,7 @@ class Domain: A list of actions that can be performed on the domain. """ - available_dns_actions: list[DomainDnsAction] + available_dns_actions: Optional[list[DomainDnsAction]] = field(default_factory=list) """ A list of DNS-related actions that can be auto configured for the domain (deprecated, use auto_config_domain_dns instead). """ @@ -1759,21 +1784,11 @@ class Hosting: Status of the Web Hosting plan. """ - domain: str - """ - Main domain associated with the Web Hosting plan (deprecated, use domain_info). - """ - tags: list[str] """ List of tags associated with the Web Hosting plan. """ - dns_status: DnsRecordsStatus - """ - DNS status of the Web Hosting plan (deprecated, use domain_info). - """ - ipv4: str """ Current IPv4 address of the hosting. @@ -1784,11 +1799,6 @@ class Hosting: Whether the hosting is protected or not. """ - domain_status: DomainStatus - """ - Main domain status of the Web Hosting plan (deprecated, use domain_info). - """ - region: ScwRegion """ Region where the Web Hosting plan is hosted. @@ -1804,6 +1814,11 @@ class Hosting: Date on which the Web Hosting plan was created. """ + domain: Optional[str] = None + """ + Main domain associated with the Web Hosting plan (deprecated, use domain_info). + """ + offer: Optional[Offer] = None """ Details of the Web Hosting plan offer and options. @@ -1814,16 +1829,31 @@ class Hosting: Details of the hosting platform. """ + dns_status: Optional[DnsRecordsStatus] = DnsRecordsStatus.UNKNOWN_STATUS + """ + DNS status of the Web Hosting plan (deprecated, use domain_info). + """ + user: Optional[HostingUser] = None """ Details of the hosting user. """ + domain_status: Optional[DomainStatus] = DomainStatus.UNKNOWN_STATUS + """ + Main domain status of the Web Hosting plan (deprecated, use domain_info). + """ + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). """ + commitment: Optional[HostingCommitment] = None + """ + Commitment details to which the hosting is engaged. + """ + @dataclass class HostingApiAddCustomDomainRequest: @@ -1905,6 +1935,11 @@ class HostingApiCreateHostingRequest: Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_update_* fields instead). """ + offer_commitment_id: Optional[str] = None + """ + Offer commitment ID to which the hosting will be engaged. + """ + @dataclass class HostingApiCreateSessionRequest: @@ -2482,14 +2517,14 @@ class Progress: @dataclass class ResetHostingPasswordResponse: - one_time_password: str + one_time_password_b64: str """ - New temporary password (deprecated, use password_b64 instead). + New temporary password, encoded in base64. """ - one_time_password_b64: str + one_time_password: Optional[str] = None """ - New temporary password, encoded in base64. + New temporary password (deprecated, use password_b64 instead). """ diff --git a/scaleway/scaleway/applesilicon/v1alpha1/api.py b/scaleway/scaleway/applesilicon/v1alpha1/api.py index 00eca7991..1972f3ef8 100644 --- a/scaleway/scaleway/applesilicon/v1alpha1/api.py +++ b/scaleway/scaleway/applesilicon/v1alpha1/api.py @@ -1104,9 +1104,8 @@ def wait_for_server_private_network( options = WaitForOptions() if not options.stop: - options.stop = ( - lambda res: res.status - not in SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES + options.stop = lambda res: ( + res.status not in SERVER_PRIVATE_NETWORK_SERVER_TRANSIENT_STATUSES ) return wait_for_resource( diff --git a/scaleway/scaleway/container/v1beta1/api.py b/scaleway/scaleway/container/v1beta1/api.py index 32ca5401f..2107b60d3 100644 --- a/scaleway/scaleway/container/v1beta1/api.py +++ b/scaleway/scaleway/container/v1beta1/api.py @@ -265,7 +265,6 @@ def wait_for_namespace( def create_namespace( self, *, - activate_vpc_integration: bool, region: Optional[ScwRegion] = None, name: Optional[str] = None, environment_variables: Optional[dict[str, str]] = None, @@ -273,11 +272,11 @@ def create_namespace( description: Optional[str] = None, secret_environment_variables: Optional[list[Secret]] = None, tags: Optional[list[str]] = None, + activate_vpc_integration: Optional[bool] = None, ) -> Namespace: """ Create a new namespace. Create a new namespace in a specified region. - :param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future. :param region: Region to target. If none is passed will use default region from the config. :param name: Name of the namespace to create. :param environment_variables: Environment variables of the namespace to create. @@ -285,14 +284,13 @@ def create_namespace( :param description: Description of the namespace to create. :param secret_environment_variables: Secret environment variables of the namespace to create. :param tags: Tags of the Serverless Container Namespace. + :param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future. :return: :class:`Namespace ` Usage: :: - result = api.create_namespace( - activate_vpc_integration=False, - ) + result = api.create_namespace() """ param_region = validate_path_param( @@ -304,7 +302,6 @@ def create_namespace( f"/containers/v1beta1/regions/{param_region}/namespaces", body=marshal_CreateNamespaceRequest( CreateNamespaceRequest( - activate_vpc_integration=activate_vpc_integration, region=region, name=name or random_name(prefix="cns"), environment_variables=environment_variables, @@ -312,6 +309,7 @@ def create_namespace( description=description, secret_environment_variables=secret_environment_variables, tags=tags, + activate_vpc_integration=activate_vpc_integration, ), self.client, ), diff --git a/scaleway/scaleway/container/v1beta1/marshalling.py b/scaleway/scaleway/container/v1beta1/marshalling.py index e444dd2d3..6127a1641 100644 --- a/scaleway/scaleway/container/v1beta1/marshalling.py +++ b/scaleway/scaleway/container/v1beta1/marshalling.py @@ -563,12 +563,6 @@ def unmarshal_Namespace(data: Any) -> Namespace: else: args["tags"] = [] - field = data.get("vpc_integration_activated", None) - if field is not None: - args["vpc_integration_activated"] = field - else: - args["vpc_integration_activated"] = False - field = data.get("description", None) if field is not None: args["description"] = field @@ -587,6 +581,12 @@ def unmarshal_Namespace(data: Any) -> Namespace: else: args["updated_at"] = None + field = data.get("vpc_integration_activated", None) + if field is not None: + args["vpc_integration_activated"] = field + else: + args["vpc_integration_activated"] = False + return Namespace(**args) @@ -610,12 +610,6 @@ def unmarshal_Token(data: Any) -> Token: else: args["token"] = None - field = data.get("public_key", None) - if field is not None: - args["public_key"] = field - else: - args["public_key"] = None - field = data.get("status", None) if field is not None: args["status"] = field @@ -634,6 +628,12 @@ def unmarshal_Token(data: Any) -> Token: else: args["namespace_id"] = None + field = data.get("public_key", None) + if field is not None: + args["public_key"] = field + else: + args["public_key"] = None + field = data.get("description", None) if field is not None: args["description"] = field @@ -1208,9 +1208,6 @@ def marshal_CreateNamespaceRequest( ) -> dict[str, Any]: output: dict[str, Any] = {} - if request.activate_vpc_integration is not None: - output["activate_vpc_integration"] = request.activate_vpc_integration - if request.name is not None: output["name"] = request.name @@ -1234,6 +1231,9 @@ def marshal_CreateNamespaceRequest( if request.tags is not None: output["tags"] = request.tags + if request.activate_vpc_integration is not None: + output["activate_vpc_integration"] = request.activate_vpc_integration + return output diff --git a/scaleway/scaleway/container/v1beta1/types.py b/scaleway/scaleway/container/v1beta1/types.py index 08e934001..9af1508d9 100644 --- a/scaleway/scaleway/container/v1beta1/types.py +++ b/scaleway/scaleway/container/v1beta1/types.py @@ -655,11 +655,6 @@ class Namespace: List of tags applied to the Serverless Container Namespace. """ - vpc_integration_activated: bool - """ - The value of this field doesn't matter anymore, and will be removed in a near future. - """ - error_message: Optional[str] = None """ Last error message of the namesace. @@ -680,6 +675,11 @@ class Namespace: Last update date of the namespace. """ + vpc_integration_activated: Optional[bool] = False + """ + The value of this field doesn't matter anymore, and will be removed in a near future. + """ + @dataclass class Token: @@ -693,14 +693,14 @@ class Token: Identifier of the token. """ - public_key: str + status: TokenStatus """ - Public key of the token. + Status of the token. """ - status: TokenStatus + public_key: Optional[str] = None """ - Status of the token. + Public key of the token. """ description: Optional[str] = None @@ -949,11 +949,6 @@ class CreateDomainRequest: @dataclass class CreateNamespaceRequest: - activate_vpc_integration: bool - """ - Setting this field to true doesn't matter anymore. It will be removed in a near future. - """ - region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. @@ -989,6 +984,11 @@ class CreateNamespaceRequest: Tags of the Serverless Container Namespace. """ + activate_vpc_integration: Optional[bool] = False + """ + Setting this field to true doesn't matter anymore. It will be removed in a near future. + """ + @dataclass class CreateTokenRequest: diff --git a/scaleway/scaleway/dedibox/v1/api.py b/scaleway/scaleway/dedibox/v1/api.py index f11df7de9..88be35b11 100644 --- a/scaleway/scaleway/dedibox/v1/api.py +++ b/scaleway/scaleway/dedibox/v1/api.py @@ -1350,8 +1350,8 @@ def wait_for_server_install( options = WaitForOptions() if not options.stop: - options.stop = ( - lambda res: res.status not in SERVER_INSTALL_TRANSIENT_STATUSES + options.stop = lambda res: ( + res.status not in SERVER_INSTALL_TRANSIENT_STATUSES ) return wait_for_resource( diff --git a/scaleway/scaleway/domain/v2beta1/api.py b/scaleway/scaleway/domain/v2beta1/api.py index 790677fca..6b4e4401e 100644 --- a/scaleway/scaleway/domain/v2beta1/api.py +++ b/scaleway/scaleway/domain/v2beta1/api.py @@ -189,12 +189,12 @@ def list_dns_zones( self, *, domain: str, - dns_zone: str, organization_id: Optional[str] = None, project_id: Optional[str] = None, order_by: Optional[ListDNSZonesRequestOrderBy] = None, page: Optional[int] = None, page_size: Optional[int] = None, + dns_zone: Optional[str] = None, dns_zones: Optional[list[str]] = None, created_after: Optional[datetime] = None, created_before: Optional[datetime] = None, @@ -205,12 +205,12 @@ def list_dns_zones( List DNS zones. Retrieve the list of DNS zones you can manage and filter DNS zones associated with specific domain names. :param domain: Domain on which to filter the returned DNS zones. - :param dns_zone: DNS zone on which to filter the returned DNS zones. :param organization_id: Organization ID on which to filter the returned DNS zones. :param project_id: Project ID on which to filter the returned DNS zones. :param order_by: Sort order of the returned DNS zones. :param page: Page number to return, from the paginated results. :param page_size: Maximum number of DNS zones to return per page. + :param dns_zone: DNS zone on which to filter the returned DNS zones. :param dns_zones: DNS zones on which to filter the returned DNS zones. :param created_after: Only list DNS zones created after this date. :param created_before: Only list DNS zones created before this date. @@ -223,7 +223,6 @@ def list_dns_zones( result = api.list_dns_zones( domain="example", - dns_zone="example", ) """ @@ -254,12 +253,12 @@ def list_dns_zones_all( self, *, domain: str, - dns_zone: str, organization_id: Optional[str] = None, project_id: Optional[str] = None, order_by: Optional[ListDNSZonesRequestOrderBy] = None, page: Optional[int] = None, page_size: Optional[int] = None, + dns_zone: Optional[str] = None, dns_zones: Optional[list[str]] = None, created_after: Optional[datetime] = None, created_before: Optional[datetime] = None, @@ -270,12 +269,12 @@ def list_dns_zones_all( List DNS zones. Retrieve the list of DNS zones you can manage and filter DNS zones associated with specific domain names. :param domain: Domain on which to filter the returned DNS zones. - :param dns_zone: DNS zone on which to filter the returned DNS zones. :param organization_id: Organization ID on which to filter the returned DNS zones. :param project_id: Project ID on which to filter the returned DNS zones. :param order_by: Sort order of the returned DNS zones. :param page: Page number to return, from the paginated results. :param page_size: Maximum number of DNS zones to return per page. + :param dns_zone: DNS zone on which to filter the returned DNS zones. :param dns_zones: DNS zones on which to filter the returned DNS zones. :param created_after: Only list DNS zones created after this date. :param created_before: Only list DNS zones created before this date. @@ -288,7 +287,6 @@ def list_dns_zones_all( result = api.list_dns_zones_all( domain="example", - dns_zone="example", ) """ @@ -298,12 +296,12 @@ def list_dns_zones_all( fetcher=self.list_dns_zones, args={ "domain": domain, - "dns_zone": dns_zone, "organization_id": organization_id, "project_id": project_id, "order_by": order_by, "page": page, "page_size": page_size, + "dns_zone": dns_zone, "dns_zones": dns_zones, "created_after": created_after, "created_before": created_before, @@ -776,7 +774,7 @@ def import_raw_dns_zone( self, *, dns_zone: str, - content: str, + content: Optional[str] = None, project_id: Optional[str] = None, format: Optional[RawFormat] = None, bind_source: Optional[ImportRawDNSZoneRequestBindSource] = None, @@ -800,7 +798,6 @@ def import_raw_dns_zone( result = api.import_raw_dns_zone( dns_zone="example", - content="example", ) """ diff --git a/scaleway/scaleway/domain/v2beta1/marshalling.py b/scaleway/scaleway/domain/v2beta1/marshalling.py index 5b723688b..f7c870119 100644 --- a/scaleway/scaleway/domain/v2beta1/marshalling.py +++ b/scaleway/scaleway/domain/v2beta1/marshalling.py @@ -316,6 +316,12 @@ def unmarshal_ContactExtensionIT(data: Any) -> ContactExtensionIT: args: dict[str, Any] = {} + field = data.get("pin", None) + if field is not None: + args["pin"] = field + else: + args["pin"] = None + field = data.get("european_citizenship", None) if field is not None: args["european_citizenship"] = field @@ -328,12 +334,6 @@ def unmarshal_ContactExtensionIT(data: Any) -> ContactExtensionIT: else: args["tax_code"] = None - field = data.get("pin", None) - if field is not None: - args["pin"] = field - else: - args["pin"] = None - return ContactExtensionIT(**args) @@ -535,14 +535,6 @@ def unmarshal_Contact(data: Any) -> Contact: else: args["status"] = ContactStatus.STATUS_UNKNOWN - field = data.get("questions", None) - if field is not None: - args["questions"] = ( - [unmarshal_ContactQuestion(v) for v in field] if field is not None else None - ) - else: - args["questions"] = [] - field = data.get("extension_nl", None) if field is not None: args["extension_nl"] = unmarshal_ContactExtensionNL(field) @@ -555,6 +547,14 @@ def unmarshal_Contact(data: Any) -> Contact: else: args["extension_it"] = None + field = data.get("questions", None) + if field is not None: + args["questions"] = ( + [unmarshal_ContactQuestion(v) for v in field] if field is not None else None + ) + else: + args["questions"] = [] + return Contact(**args) @@ -3028,15 +3028,15 @@ def marshal_ContactExtensionIT( ) -> dict[str, Any]: output: dict[str, Any] = {} + if request.pin is not None: + output["pin"] = request.pin + if request.european_citizenship is not None: output["european_citizenship"] = request.european_citizenship if request.tax_code is not None: output["tax_code"] = request.tax_code - if request.pin is not None: - output["pin"] = request.pin - return output @@ -3126,11 +3126,6 @@ def marshal_NewContact( if request.whois_opt_in is not None: output["whois_opt_in"] = request.whois_opt_in - if request.questions is not None: - output["questions"] = [ - marshal_ContactQuestion(item, defaults) for item in request.questions - ] - if request.vat_identification_code is not None: output["vat_identification_code"] = request.vat_identification_code @@ -3160,6 +3155,11 @@ def marshal_NewContact( request.extension_it, defaults ) + if request.questions is not None: + output["questions"] = [ + marshal_ContactQuestion(item, defaults) for item in request.questions + ] + return output diff --git a/scaleway/scaleway/domain/v2beta1/types.py b/scaleway/scaleway/domain/v2beta1/types.py index 9a5d68df2..0439afa60 100644 --- a/scaleway/scaleway/domain/v2beta1/types.py +++ b/scaleway/scaleway/domain/v2beta1/types.py @@ -518,16 +518,6 @@ class ContactExtensionFR: @dataclass class ContactExtensionIT: - european_citizenship: str - """ - This option is useless anymore. - """ - - tax_code: str - """ - Tax_code is renamed to pin. - """ - pin: str """ Domain name registrant's Taxcode (mandatory / only optional when the trustee is used) @@ -538,6 +528,16 @@ class ContactExtensionIT: * In all other cases it must be equal to VAT number (in the 16 characters format if nationality is IT) or the numeric Codice Fiscale. """ + european_citizenship: Optional[str] = None + """ + This option is useless anymore. + """ + + tax_code: Optional[str] = None + """ + Tax_code is renamed to pin. + """ + @dataclass class ContactExtensionNL: @@ -623,11 +623,11 @@ class Contact: email_status: ContactEmailStatus state: str status: ContactStatus - questions: list[ContactQuestion] extension_fr: Optional[ContactExtensionFR] = None extension_eu: Optional[ContactExtensionEU] = None extension_nl: Optional[ContactExtensionNL] = None extension_it: Optional[ContactExtensionIT] = None + questions: Optional[list[ContactQuestion]] = field(default_factory=list) @dataclass @@ -674,7 +674,6 @@ class NewContact: lang: StdLanguageCode resale: bool whois_opt_in: bool - questions: list[ContactQuestion] company_name: Optional[str] = None email_alt: Optional[str] = None fax_number: Optional[str] = None @@ -686,6 +685,7 @@ class NewContact: state: Optional[str] = None extension_nl: Optional[ContactExtensionNL] = None extension_it: Optional[ContactExtensionIT] = None + questions: Optional[list[ContactQuestion]] = field(default_factory=list) @dataclass @@ -1187,7 +1187,7 @@ class ImportRawDNSZoneRequest: DNS zone to import. """ - content: str + content: Optional[str] = None project_id: Optional[str] = None format: Optional[RawFormat] = RawFormat.UNKNOWN_RAW_FORMAT bind_source: Optional[ImportRawDNSZoneRequestBindSource] = None @@ -1340,11 +1340,6 @@ class ListDNSZonesRequest: Domain on which to filter the returned DNS zones. """ - dns_zone: str - """ - DNS zone on which to filter the returned DNS zones. - """ - organization_id: Optional[str] = None """ Organization ID on which to filter the returned DNS zones. @@ -1372,6 +1367,11 @@ class ListDNSZonesRequest: Maximum number of DNS zones to return per page. """ + dns_zone: Optional[str] = None + """ + DNS zone on which to filter the returned DNS zones. + """ + dns_zones: Optional[list[str]] = field(default_factory=list) """ DNS zones on which to filter the returned DNS zones. diff --git a/scaleway/scaleway/edge_services/v1beta1/api.py b/scaleway/scaleway/edge_services/v1beta1/api.py index e4448aae1..c96ed50bd 100644 --- a/scaleway/scaleway/edge_services/v1beta1/api.py +++ b/scaleway/scaleway/edge_services/v1beta1/api.py @@ -701,6 +701,7 @@ def create_dns_stage( cache_stage_id: Optional[str] = None, backend_stage_id: Optional[str] = None, pipeline_id: str, + wildcard_domain: Optional[bool] = None, ) -> DNSStage: """ Create DNS stage. @@ -713,6 +714,7 @@ def create_dns_stage( :param backend_stage_id: Backend stage ID the DNS stage will be linked to. One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. :param pipeline_id: Pipeline ID the DNS stage belongs to. + :param wildcard_domain: Support of wildcard (subdomains) for the given domain (a wildcard certificate is required to make it work). :return: :class:`DNSStage ` Usage: @@ -732,6 +734,7 @@ def create_dns_stage( CreateDNSStageRequest( fqdns=fqdns, pipeline_id=pipeline_id, + wildcard_domain=wildcard_domain, tls_stage_id=tls_stage_id, cache_stage_id=cache_stage_id, backend_stage_id=backend_stage_id, @@ -780,6 +783,7 @@ def update_dns_stage( tls_stage_id: Optional[str] = None, cache_stage_id: Optional[str] = None, backend_stage_id: Optional[str] = None, + wildcard_domain: Optional[bool] = None, ) -> DNSStage: """ Update DNS stage. @@ -792,6 +796,7 @@ def update_dns_stage( One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. :param backend_stage_id: Backend stage ID the DNS stage will be linked to. One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. + :param wildcard_domain: Support of wildcard (subdomains) for the given domain (a wildcard certificate is required to make it work). :return: :class:`DNSStage ` Usage: @@ -811,6 +816,7 @@ def update_dns_stage( UpdateDNSStageRequest( dns_stage_id=dns_stage_id, fqdns=fqdns, + wildcard_domain=wildcard_domain, tls_stage_id=tls_stage_id, cache_stage_id=cache_stage_id, backend_stage_id=backend_stage_id, diff --git a/scaleway/scaleway/edge_services/v1beta1/marshalling.py b/scaleway/scaleway/edge_services/v1beta1/marshalling.py index c8619cb80..123e36cf2 100644 --- a/scaleway/scaleway/edge_services/v1beta1/marshalling.py +++ b/scaleway/scaleway/edge_services/v1beta1/marshalling.py @@ -405,6 +405,12 @@ def unmarshal_DNSStage(data: Any) -> DNSStage: else: args["pipeline_id"] = None + field = data.get("wildcard_domain", None) + if field is not None: + args["wildcard_domain"] = field + else: + args["wildcard_domain"] = False + field = data.get("created_at", None) if field is not None: args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -1073,6 +1079,12 @@ def unmarshal_PlanDetails(data: Any) -> PlanDetails: else: args["backend_limit"] = 0 + field = data.get("wildcard_domain", None) + if field is not None: + args["wildcard_domain"] = field + else: + args["wildcard_domain"] = False + return PlanDetails(**args) @@ -1942,6 +1954,9 @@ def marshal_CreateDNSStageRequest( if request.fqdns is not None: output["fqdns"] = request.fqdns + if request.wildcard_domain is not None: + output["wildcard_domain"] = request.wildcard_domain + return output @@ -2295,6 +2310,9 @@ def marshal_UpdateDNSStageRequest( if request.fqdns is not None: output["fqdns"] = request.fqdns + if request.wildcard_domain is not None: + output["wildcard_domain"] = request.wildcard_domain + return output diff --git a/scaleway/scaleway/edge_services/v1beta1/types.py b/scaleway/scaleway/edge_services/v1beta1/types.py index 18089d3ad..debc78ea7 100644 --- a/scaleway/scaleway/edge_services/v1beta1/types.py +++ b/scaleway/scaleway/edge_services/v1beta1/types.py @@ -135,6 +135,8 @@ class PipelineErrorCode(str, Enum, metaclass=StrEnumMeta): TLS_KEY_TOO_MANY = "tls_key_too_many" TLS_MANAGED_DOMAIN_RATE_LIMIT = "tls_managed_domain_rate_limit" TLS_MANAGED_INTERNAL = "tls_managed_internal" + TLS_MANAGED_UNSUPPORTED = "tls_managed_unsupported" + TLS_NOT_WILDCARD = "tls_not_wildcard" TLS_PAIR_MISMATCH = "tls_pair_mismatch" TLS_ROOT_INCONSISTENT = "tls_root_inconsistent" TLS_ROOT_INCORRECT = "tls_root_incorrect" @@ -495,6 +497,11 @@ class DNSStage: Pipeline ID the DNS stage belongs to. """ + wildcard_domain: bool + """ + Support of wildcard (subdomains) for the given domain (a wildcard certificate is required to make it work). + """ + created_at: Optional[datetime] = None """ Date the DNS stage was created. @@ -729,6 +736,11 @@ class PlanDetails: Number of backends per pipeline included in subscription plan. """ + wildcard_domain: bool + """ + Support of wildcard subdomains for the customized domain. + """ + @dataclass class PlanUsageDetails: @@ -935,6 +947,11 @@ class CreateDNSStageRequest: Fully Qualified Domain Name (in the format subdomain.example.com) to attach to the stage. """ + wildcard_domain: Optional[bool] = False + """ + Support of wildcard (subdomains) for the given domain (a wildcard certificate is required to make it work). + """ + tls_stage_id: Optional[str] = None cache_stage_id: Optional[str] = None @@ -1811,6 +1828,11 @@ class UpdateDNSStageRequest: Fully Qualified Domain Name (in the format subdomain.example.com) attached to the stage. """ + wildcard_domain: Optional[bool] = False + """ + Support of wildcard (subdomains) for the given domain (a wildcard certificate is required to make it work). + """ + tls_stage_id: Optional[str] = None cache_stage_id: Optional[str] = None diff --git a/scaleway/scaleway/environmental_footprint/v1alpha1/types.py b/scaleway/scaleway/environmental_footprint/v1alpha1/types.py index 5e9d8eddb..429fdbd58 100644 --- a/scaleway/scaleway/environmental_footprint/v1alpha1/types.py +++ b/scaleway/scaleway/environmental_footprint/v1alpha1/types.py @@ -26,6 +26,9 @@ class ProductCategory(str, Enum, metaclass=StrEnumMeta): OBJECT_STORAGE = "object_storage" LOAD_BALANCER = "load_balancer" KUBERNETES = "kubernetes" + MANAGED_RELATIONAL_DATABASES = "managed_relational_databases" + MANAGED_MONGODB = "managed_mongodb" + MANAGED_REDIS = "managed_redis" def __str__(self) -> str: return str(self.value) @@ -47,6 +50,7 @@ class ServiceCategory(str, Enum, metaclass=StrEnumMeta): STORAGE = "storage" NETWORK = "network" CONTAINERS = "containers" + DATABASES = "databases" def __str__(self) -> str: return str(self.value) diff --git a/scaleway/scaleway/function/v1beta1/api.py b/scaleway/scaleway/function/v1beta1/api.py index 32fd9dac0..8e80bc8fd 100644 --- a/scaleway/scaleway/function/v1beta1/api.py +++ b/scaleway/scaleway/function/v1beta1/api.py @@ -269,7 +269,6 @@ def wait_for_namespace( def create_namespace( self, *, - activate_vpc_integration: bool, region: Optional[ScwRegion] = None, name: Optional[str] = None, environment_variables: Optional[dict[str, str]] = None, @@ -277,11 +276,11 @@ def create_namespace( description: Optional[str] = None, secret_environment_variables: Optional[list[Secret]] = None, tags: Optional[list[str]] = None, + activate_vpc_integration: Optional[bool] = None, ) -> Namespace: """ Create a new namespace. Create a new namespace in a specified Organization or Project. - :param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future. :param region: Region to target. If none is passed will use default region from the config. :param name: :param environment_variables: Environment variables of the namespace. @@ -289,14 +288,13 @@ def create_namespace( :param description: Description of the namespace. :param secret_environment_variables: Secret environment variables of the namespace. :param tags: Tags of the Serverless Function Namespace. + :param activate_vpc_integration: Setting this field to true doesn't matter anymore. It will be removed in a near future. :return: :class:`Namespace ` Usage: :: - result = api.create_namespace( - activate_vpc_integration=False, - ) + result = api.create_namespace() """ param_region = validate_path_param( @@ -308,7 +306,6 @@ def create_namespace( f"/functions/v1beta1/regions/{param_region}/namespaces", body=marshal_CreateNamespaceRequest( CreateNamespaceRequest( - activate_vpc_integration=activate_vpc_integration, region=region, name=name or random_name(prefix="ns"), environment_variables=environment_variables, @@ -316,6 +313,7 @@ def create_namespace( description=description, secret_environment_variables=secret_environment_variables, tags=tags, + activate_vpc_integration=activate_vpc_integration, ), self.client, ), diff --git a/scaleway/scaleway/function/v1beta1/marshalling.py b/scaleway/scaleway/function/v1beta1/marshalling.py index 9df8e13b0..80a6e3a9b 100644 --- a/scaleway/scaleway/function/v1beta1/marshalling.py +++ b/scaleway/scaleway/function/v1beta1/marshalling.py @@ -437,12 +437,6 @@ def unmarshal_Namespace(data: Any) -> Namespace: else: args["tags"] = [] - field = data.get("vpc_integration_activated", None) - if field is not None: - args["vpc_integration_activated"] = field - else: - args["vpc_integration_activated"] = False - field = data.get("description", None) if field is not None: args["description"] = field @@ -461,6 +455,12 @@ def unmarshal_Namespace(data: Any) -> Namespace: else: args["updated_at"] = None + field = data.get("vpc_integration_activated", None) + if field is not None: + args["vpc_integration_activated"] = field + else: + args["vpc_integration_activated"] = False + return Namespace(**args) @@ -484,12 +484,6 @@ def unmarshal_Token(data: Any) -> Token: else: args["token"] = None - field = data.get("public_key", None) - if field is not None: - args["public_key"] = field - else: - args["public_key"] = None - field = data.get("status", None) if field is not None: args["status"] = field @@ -508,6 +502,12 @@ def unmarshal_Token(data: Any) -> Token: else: args["namespace_id"] = None + field = data.get("public_key", None) + if field is not None: + args["public_key"] = field + else: + args["public_key"] = None + field = data.get("description", None) if field is not None: args["description"] = field @@ -1114,9 +1114,6 @@ def marshal_CreateNamespaceRequest( ) -> dict[str, Any]: output: dict[str, Any] = {} - if request.activate_vpc_integration is not None: - output["activate_vpc_integration"] = request.activate_vpc_integration - if request.name is not None: output["name"] = request.name @@ -1140,6 +1137,9 @@ def marshal_CreateNamespaceRequest( if request.tags is not None: output["tags"] = request.tags + if request.activate_vpc_integration is not None: + output["activate_vpc_integration"] = request.activate_vpc_integration + return output diff --git a/scaleway/scaleway/function/v1beta1/types.py b/scaleway/scaleway/function/v1beta1/types.py index 5d3c4332a..85391b085 100644 --- a/scaleway/scaleway/function/v1beta1/types.py +++ b/scaleway/scaleway/function/v1beta1/types.py @@ -628,11 +628,6 @@ class Namespace: List of tags applied to the Serverless Function Namespace. """ - vpc_integration_activated: bool - """ - The value of this field doesn't matter anymore, and will be removed in a near future. - """ - error_message: Optional[str] = None """ Error message if the namespace is in "error" state. @@ -653,6 +648,11 @@ class Namespace: Last update date of the namespace. """ + vpc_integration_activated: Optional[bool] = False + """ + The value of this field doesn't matter anymore, and will be removed in a near future. + """ + @dataclass class Token: @@ -666,14 +666,14 @@ class Token: String of the token. """ - public_key: str + status: TokenStatus """ - Public key of the token. + Status of the token. """ - status: TokenStatus + public_key: Optional[str] = None """ - Status of the token. + Public key of the token. """ description: Optional[str] = None @@ -875,11 +875,6 @@ class CreateFunctionRequest: @dataclass class CreateNamespaceRequest: - activate_vpc_integration: bool - """ - Setting this field to true doesn't matter anymore. It will be removed in a near future. - """ - region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. @@ -911,6 +906,11 @@ class CreateNamespaceRequest: Tags of the Serverless Function Namespace. """ + activate_vpc_integration: Optional[bool] = False + """ + Setting this field to true doesn't matter anymore. It will be removed in a near future. + """ + @dataclass class CreateTokenRequest: diff --git a/scaleway/scaleway/iam/v1alpha1/marshalling.py b/scaleway/scaleway/iam/v1alpha1/marshalling.py index 8b2c87aed..f808bb676 100644 --- a/scaleway/scaleway/iam/v1alpha1/marshalling.py +++ b/scaleway/scaleway/iam/v1alpha1/marshalling.py @@ -927,18 +927,6 @@ def unmarshal_User(data: Any) -> User: else: args["type_"] = UserType.UNKNOWN_TYPE - field = data.get("two_factor_enabled", None) - if field is not None: - args["two_factor_enabled"] = field - else: - args["two_factor_enabled"] = False - - field = data.get("status", None) - if field is not None: - args["status"] = field - else: - args["status"] = UserStatus.UNKNOWN_STATUS - field = data.get("mfa", None) if field is not None: args["mfa"] = field @@ -963,6 +951,18 @@ def unmarshal_User(data: Any) -> User: else: args["locked"] = False + field = data.get("two_factor_enabled", None) + if field is not None: + args["two_factor_enabled"] = field + else: + args["two_factor_enabled"] = False + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = UserStatus.UNKNOWN_STATUS + return User(**args) diff --git a/scaleway/scaleway/iam/v1alpha1/types.py b/scaleway/scaleway/iam/v1alpha1/types.py index 09bb21f20..e8d66f710 100644 --- a/scaleway/scaleway/iam/v1alpha1/types.py +++ b/scaleway/scaleway/iam/v1alpha1/types.py @@ -977,16 +977,6 @@ class User: Type of user. """ - two_factor_enabled: bool - """ - Deprecated, use "mfa" instead. - """ - - status: UserStatus - """ - Status of user invitation. - """ - mfa: bool """ Defines whether MFA is enabled. @@ -1022,6 +1012,16 @@ class User: Date of the last login. """ + two_factor_enabled: Optional[bool] = False + """ + Deprecated, use "mfa" instead. + """ + + status: Optional[UserStatus] = UserStatus.UNKNOWN_STATUS + """ + Status of user invitation. + """ + @dataclass class SamlServiceProvider: diff --git a/scaleway/scaleway/instance/v1/custom_api.py b/scaleway/scaleway/instance/v1/custom_api.py index 853dcc7af..5c85e86f7 100644 --- a/scaleway/scaleway/instance/v1/custom_api.py +++ b/scaleway/scaleway/instance/v1/custom_api.py @@ -111,7 +111,7 @@ def set_all_server_user_data( server_id: str, user_data: Dict[str, bytes], zone: Optional[ScwZone] = None, - ) -> Optional[None]: + ) -> None: param_zone = validate_path_param("zone", zone or self.client.default_zone) param_server_id = validate_path_param("server_id", server_id) @@ -134,7 +134,7 @@ def set_all_server_user_data( content=user_data[key], ) - return None + return def wait_instance_server(self, server_id: str, zone: ScwZone) -> GetServerResponse: wait_interval = interval diff --git a/scaleway/scaleway/instance/v1/marshalling.py b/scaleway/scaleway/instance/v1/marshalling.py index 2e72fdb36..2055d5a75 100644 --- a/scaleway/scaleway/instance/v1/marshalling.py +++ b/scaleway/scaleway/instance/v1/marshalling.py @@ -1905,97 +1905,97 @@ def unmarshal_Dashboard(data: Any) -> Dashboard: if field is not None: args["volumes_count"] = field else: - args["volumes_count"] = None + args["volumes_count"] = 0 field = data.get("running_servers_count", None) if field is not None: args["running_servers_count"] = field else: - args["running_servers_count"] = None + args["running_servers_count"] = 0 field = data.get("servers_by_types", None) if field is not None: args["servers_by_types"] = field else: - args["servers_by_types"] = None + args["servers_by_types"] = {} field = data.get("images_count", None) if field is not None: args["images_count"] = field else: - args["images_count"] = None + args["images_count"] = 0 field = data.get("snapshots_count", None) if field is not None: args["snapshots_count"] = field else: - args["snapshots_count"] = None + args["snapshots_count"] = 0 field = data.get("servers_count", None) if field is not None: args["servers_count"] = field else: - args["servers_count"] = None + args["servers_count"] = 0 field = data.get("ips_count", None) if field is not None: args["ips_count"] = field else: - args["ips_count"] = None + args["ips_count"] = 0 field = data.get("security_groups_count", None) if field is not None: args["security_groups_count"] = field else: - args["security_groups_count"] = None + args["security_groups_count"] = 0 field = data.get("ips_unused", None) if field is not None: args["ips_unused"] = field else: - args["ips_unused"] = None + args["ips_unused"] = 0 field = data.get("volumes_l_ssd_count", None) if field is not None: args["volumes_l_ssd_count"] = field else: - args["volumes_l_ssd_count"] = None + args["volumes_l_ssd_count"] = 0 field = data.get("volumes_l_ssd_total_size", None) if field is not None: args["volumes_l_ssd_total_size"] = field else: - args["volumes_l_ssd_total_size"] = None + args["volumes_l_ssd_total_size"] = 0 field = data.get("private_nics_count", None) if field is not None: args["private_nics_count"] = field else: - args["private_nics_count"] = None + args["private_nics_count"] = 0 field = data.get("placement_groups_count", None) if field is not None: args["placement_groups_count"] = field else: - args["placement_groups_count"] = None + args["placement_groups_count"] = 0 field = data.get("volumes_scratch_count", None) if field is not None: args["volumes_scratch_count"] = field else: - args["volumes_scratch_count"] = None + args["volumes_scratch_count"] = 0 field = data.get("volumes_b_ssd_count", None) if field is not None: args["volumes_b_ssd_count"] = field else: - args["volumes_b_ssd_count"] = None + args["volumes_b_ssd_count"] = 0 field = data.get("volumes_b_ssd_total_size", None) if field is not None: args["volumes_b_ssd_total_size"] = field else: - args["volumes_b_ssd_total_size"] = None + args["volumes_b_ssd_total_size"] = 0 return Dashboard(**args) diff --git a/scaleway/scaleway/instance/v1/types.py b/scaleway/scaleway/instance/v1/types.py index 4470ba522..57a918ef8 100644 --- a/scaleway/scaleway/instance/v1/types.py +++ b/scaleway/scaleway/instance/v1/types.py @@ -1265,8 +1265,8 @@ class Dashboard: private_nics_count: int placement_groups_count: int volumes_scratch_count: int - volumes_b_ssd_count: Optional[int] = None - volumes_b_ssd_total_size: Optional[int] = None + volumes_b_ssd_count: Optional[int] = 0 + volumes_b_ssd_total_size: Optional[int] = 0 @dataclass diff --git a/scaleway/scaleway/interlink/v1beta1/api.py b/scaleway/scaleway/interlink/v1beta1/api.py index cb5ce9d15..225646c9c 100644 --- a/scaleway/scaleway/interlink/v1beta1/api.py +++ b/scaleway/scaleway/interlink/v1beta1/api.py @@ -251,8 +251,8 @@ def wait_for_dedicated_connection( options = WaitForOptions() if not options.stop: - options.stop = ( - lambda res: res.status not in DEDICATED_CONNECTION_TRANSIENT_STATUSES + options.stop = lambda res: ( + res.status not in DEDICATED_CONNECTION_TRANSIENT_STATUSES ) return wait_for_resource( diff --git a/scaleway/scaleway/jobs/v1alpha2/__init__.py b/scaleway/scaleway/jobs/v1alpha2/__init__.py index 453c9acd3..1e3d1ebdc 100644 --- a/scaleway/scaleway/jobs/v1alpha2/__init__.py +++ b/scaleway/scaleway/jobs/v1alpha2/__init__.py @@ -5,26 +5,34 @@ from .content import JOB_RUN_TRANSIENT_STATUSES from .types import ListJobDefinitionsRequestOrderBy from .types import ListJobRunsRequestOrderBy +from .types import ListTriggersRequestOrderBy from .types import SecretEnvVar from .types import SecretFile from .types import CronSchedule from .types import RetryPolicy +from .types import TriggerCronConfig from .types import CreateJobDefinitionRequestCronScheduleConfig from .types import CreateSecretsRequestSecretConfig from .types import Secret +from .types import CreateTriggerRequestCronConfig from .types import JobDefinition from .types import Resource from .types import JobRun +from .types import Trigger from .types import UpdateJobDefinitionRequestCronScheduleConfig +from .types import UpdateTriggerRequestCronConfig from .types import CreateJobDefinitionRequest from .types import CreateSecretsRequest from .types import CreateSecretsResponse +from .types import CreateTriggerRequest from .types import DeleteJobDefinitionRequest from .types import DeleteSecretRequest +from .types import DeleteTriggerRequest from .types import GetJobDefinitionRequest from .types import GetJobLimitsRequest from .types import GetJobRunRequest from .types import GetSecretRequest +from .types import GetTriggerRequest from .types import JobLimits from .types import ListJobDefinitionsRequest from .types import ListJobDefinitionsResponse @@ -34,11 +42,14 @@ from .types import ListJobRunsResponse from .types import ListSecretsRequest from .types import ListSecretsResponse +from .types import ListTriggersRequest +from .types import ListTriggersResponse from .types import StartJobDefinitionRequest from .types import StartJobDefinitionResponse from .types import StopJobRunRequest from .types import UpdateJobDefinitionRequest from .types import UpdateSecretRequest +from .types import UpdateTriggerRequest from .api import JobsV1Alpha2API __all__ = [ @@ -47,26 +58,34 @@ "JOB_RUN_TRANSIENT_STATUSES", "ListJobDefinitionsRequestOrderBy", "ListJobRunsRequestOrderBy", + "ListTriggersRequestOrderBy", "SecretEnvVar", "SecretFile", "CronSchedule", "RetryPolicy", + "TriggerCronConfig", "CreateJobDefinitionRequestCronScheduleConfig", "CreateSecretsRequestSecretConfig", "Secret", + "CreateTriggerRequestCronConfig", "JobDefinition", "Resource", "JobRun", + "Trigger", "UpdateJobDefinitionRequestCronScheduleConfig", + "UpdateTriggerRequestCronConfig", "CreateJobDefinitionRequest", "CreateSecretsRequest", "CreateSecretsResponse", + "CreateTriggerRequest", "DeleteJobDefinitionRequest", "DeleteSecretRequest", + "DeleteTriggerRequest", "GetJobDefinitionRequest", "GetJobLimitsRequest", "GetJobRunRequest", "GetSecretRequest", + "GetTriggerRequest", "JobLimits", "ListJobDefinitionsRequest", "ListJobDefinitionsResponse", @@ -76,10 +95,13 @@ "ListJobRunsResponse", "ListSecretsRequest", "ListSecretsResponse", + "ListTriggersRequest", + "ListTriggersResponse", "StartJobDefinitionRequest", "StartJobDefinitionResponse", "StopJobRunRequest", "UpdateJobDefinitionRequest", "UpdateSecretRequest", + "UpdateTriggerRequest", "JobsV1Alpha2API", ] diff --git a/scaleway/scaleway/jobs/v1alpha2/api.py b/scaleway/scaleway/jobs/v1alpha2/api.py index ee6b54cc8..ac07f12ed 100644 --- a/scaleway/scaleway/jobs/v1alpha2/api.py +++ b/scaleway/scaleway/jobs/v1alpha2/api.py @@ -17,11 +17,14 @@ JobRunState, ListJobDefinitionsRequestOrderBy, ListJobRunsRequestOrderBy, + ListTriggersRequestOrderBy, CreateJobDefinitionRequest, CreateJobDefinitionRequestCronScheduleConfig, CreateSecretsRequest, CreateSecretsRequestSecretConfig, CreateSecretsResponse, + CreateTriggerRequest, + CreateTriggerRequestCronConfig, JobDefinition, JobLimits, JobRun, @@ -29,30 +32,38 @@ ListJobResourcesResponse, ListJobRunsResponse, ListSecretsResponse, + ListTriggersResponse, RetryPolicy, Secret, StartJobDefinitionRequest, StartJobDefinitionResponse, + Trigger, UpdateJobDefinitionRequest, UpdateJobDefinitionRequestCronScheduleConfig, UpdateSecretRequest, + UpdateTriggerRequest, + UpdateTriggerRequestCronConfig, ) from .marshalling import ( unmarshal_Secret, unmarshal_JobDefinition, unmarshal_JobRun, + unmarshal_Trigger, unmarshal_CreateSecretsResponse, unmarshal_JobLimits, unmarshal_ListJobDefinitionsResponse, unmarshal_ListJobResourcesResponse, unmarshal_ListJobRunsResponse, unmarshal_ListSecretsResponse, + unmarshal_ListTriggersResponse, unmarshal_StartJobDefinitionResponse, marshal_CreateJobDefinitionRequest, marshal_CreateSecretsRequest, + marshal_CreateTriggerRequest, marshal_StartJobDefinitionRequest, marshal_UpdateJobDefinitionRequest, marshal_UpdateSecretRequest, + marshal_UpdateTriggerRequest, ) @@ -814,6 +825,247 @@ def delete_secret( self._throw_on_error(res) + def create_trigger( + self, + *, + job_definition_id: str, + name: str, + region: Optional[ScwRegion] = None, + cron_config: Optional[CreateTriggerRequestCronConfig] = None, + ) -> Trigger: + """ + Create a trigger. + :param job_definition_id: UUID of the job definition. + :param name: Name of the trigger. + :param region: Region to target. If none is passed will use default region from the config. + :param cron_config: Configuration of the CRON trigger. + One-Of ('config'): at most one of 'cron_config' could be set. + :return: :class:`Trigger ` + + Usage: + :: + + result = api.create_trigger( + job_definition_id="example", + name="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "POST", + f"/serverless-jobs/v1alpha2/regions/{param_region}/triggers", + body=marshal_CreateTriggerRequest( + CreateTriggerRequest( + job_definition_id=job_definition_id, + name=name, + region=region, + cron_config=cron_config, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_Trigger(res.json()) + + def get_trigger( + self, + *, + trigger_id: str, + region: Optional[ScwRegion] = None, + ) -> Trigger: + """ + Get a trigger. + :param trigger_id: UUID of the trigger. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`Trigger ` + + Usage: + :: + + result = api.get_trigger( + trigger_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_trigger_id = validate_path_param("trigger_id", trigger_id) + + res = self._request( + "GET", + f"/serverless-jobs/v1alpha2/regions/{param_region}/triggers/{param_trigger_id}", + ) + + self._throw_on_error(res) + return unmarshal_Trigger(res.json()) + + def list_triggers( + self, + *, + job_definition_id: str, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListTriggersRequestOrderBy] = None, + ) -> ListTriggersResponse: + """ + List triggers of a job definition. + :param job_definition_id: UUID of the job definition. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Page number from paginated list of triggers. + :param page_size: Number of triggers per page. + :param order_by: Sorting order of triggers. + :return: :class:`ListTriggersResponse ` + + Usage: + :: + + result = api.list_triggers( + job_definition_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/serverless-jobs/v1alpha2/regions/{param_region}/triggers", + params={ + "job_definition_id": job_definition_id, + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListTriggersResponse(res.json()) + + def list_triggers_all( + self, + *, + job_definition_id: str, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListTriggersRequestOrderBy] = None, + ) -> list[Trigger]: + """ + List triggers of a job definition. + :param job_definition_id: UUID of the job definition. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Page number from paginated list of triggers. + :param page_size: Number of triggers per page. + :param order_by: Sorting order of triggers. + :return: :class:`list[Trigger] ` + + Usage: + :: + + result = api.list_triggers_all( + job_definition_id="example", + ) + """ + + return fetch_all_pages( + type=ListTriggersResponse, + key="triggers", + fetcher=self.list_triggers, + args={ + "job_definition_id": job_definition_id, + "region": region, + "page": page, + "page_size": page_size, + "order_by": order_by, + }, + ) + + def update_trigger( + self, + *, + trigger_id: str, + region: Optional[ScwRegion] = None, + name: Optional[str] = None, + cron_config: Optional[UpdateTriggerRequestCronConfig] = None, + ) -> Trigger: + """ + Update a trigger. + :param trigger_id: UUID of the trigger. + :param region: Region to target. If none is passed will use default region from the config. + :param name: Name of the trigger. + :param cron_config: Configuration of the CRON trigger. + One-Of ('config'): at most one of 'cron_config' could be set. + :return: :class:`Trigger ` + + Usage: + :: + + result = api.update_trigger( + trigger_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_trigger_id = validate_path_param("trigger_id", trigger_id) + + res = self._request( + "PATCH", + f"/serverless-jobs/v1alpha2/regions/{param_region}/triggers/{param_trigger_id}", + body=marshal_UpdateTriggerRequest( + UpdateTriggerRequest( + trigger_id=trigger_id, + region=region, + name=name, + cron_config=cron_config, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_Trigger(res.json()) + + def delete_trigger( + self, + *, + trigger_id: str, + region: Optional[ScwRegion] = None, + ) -> None: + """ + Delete a trigger. + :param trigger_id: UUID of the trigger. + :param region: Region to target. If none is passed will use default region from the config. + + Usage: + :: + + result = api.delete_trigger( + trigger_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_trigger_id = validate_path_param("trigger_id", trigger_id) + + res = self._request( + "DELETE", + f"/serverless-jobs/v1alpha2/regions/{param_region}/triggers/{param_trigger_id}", + ) + + self._throw_on_error(res) + def list_job_resources( self, *, diff --git a/scaleway/scaleway/jobs/v1alpha2/marshalling.py b/scaleway/scaleway/jobs/v1alpha2/marshalling.py index 6d4729d1e..e1d5675df 100644 --- a/scaleway/scaleway/jobs/v1alpha2/marshalling.py +++ b/scaleway/scaleway/jobs/v1alpha2/marshalling.py @@ -10,6 +10,8 @@ resolve_one_of, ) from .types import ( + JobRunReason, + JobRunState, SecretEnvVar, SecretFile, Secret, @@ -17,6 +19,8 @@ RetryPolicy, JobDefinition, JobRun, + TriggerCronConfig, + Trigger, CreateSecretsResponse, JobLimits, ListJobDefinitionsResponse, @@ -24,15 +28,20 @@ ListJobResourcesResponse, ListJobRunsResponse, ListSecretsResponse, + ListTriggersResponse, StartJobDefinitionResponse, CreateJobDefinitionRequestCronScheduleConfig, CreateJobDefinitionRequest, CreateSecretsRequestSecretConfig, CreateSecretsRequest, + CreateTriggerRequestCronConfig, + CreateTriggerRequest, StartJobDefinitionRequest, UpdateJobDefinitionRequestCronScheduleConfig, UpdateJobDefinitionRequest, UpdateSecretRequest, + UpdateTriggerRequestCronConfig, + UpdateTriggerRequest, ) @@ -187,19 +196,19 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition: if field is not None: args["cpu_limit"] = field else: - args["cpu_limit"] = None + args["cpu_limit"] = 0 field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field else: - args["memory_limit"] = None + args["memory_limit"] = 0 field = data.get("local_storage_capacity", None) if field is not None: args["local_storage_capacity"] = field else: - args["local_storage_capacity"] = None + args["local_storage_capacity"] = 0 field = data.get("image_uri", None) if field is not None: @@ -211,7 +220,7 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition: if field is not None: args["environment_variables"] = field else: - args["environment_variables"] = None + args["environment_variables"] = {} field = data.get("created_at", None) if field is not None: @@ -247,13 +256,13 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition: if field is not None: args["startup_command"] = field else: - args["startup_command"] = None + args["startup_command"] = [] field = data.get("args", None) if field is not None: args["args"] = field else: - args["args"] = None + args["args"] = [] field = data.get("region", None) if field is not None: @@ -300,13 +309,13 @@ def unmarshal_JobRun(data: Any) -> JobRun: if field is not None: args["state"] = field else: - args["state"] = None + args["state"] = JobRunState.UNKNOWN_STATE field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field else: - args["cpu_limit"] = None + args["cpu_limit"] = 0 field = data.get("created_at", None) if field is not None: @@ -330,31 +339,31 @@ def unmarshal_JobRun(data: Any) -> JobRun: if field is not None: args["memory_limit"] = field else: - args["memory_limit"] = None + args["memory_limit"] = 0 field = data.get("local_storage_capacity", None) if field is not None: args["local_storage_capacity"] = field else: - args["local_storage_capacity"] = None + args["local_storage_capacity"] = 0 field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field else: - args["environment_variables"] = None + args["environment_variables"] = {} field = data.get("startup_command", None) if field is not None: args["startup_command"] = field else: - args["startup_command"] = None + args["startup_command"] = [] field = data.get("args", None) if field is not None: args["args"] = field else: - args["args"] = None + args["args"] = [] field = data.get("region", None) if field is not None: @@ -380,13 +389,13 @@ def unmarshal_JobRun(data: Any) -> JobRun: if field is not None: args["reason"] = field else: - args["reason"] = None + args["reason"] = JobRunReason.UNKNOWN_REASON field = data.get("exit_code", None) if field is not None: args["exit_code"] = field else: - args["exit_code"] = None + args["exit_code"] = 0 field = data.get("error_message", None) if field is not None: @@ -404,11 +413,93 @@ def unmarshal_JobRun(data: Any) -> JobRun: if field is not None: args["attempts"] = field else: - args["attempts"] = None + args["attempts"] = 0 return JobRun(**args) +def unmarshal_TriggerCronConfig(data: Any) -> TriggerCronConfig: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'TriggerCronConfig' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("schedule", None) + if field is not None: + args["schedule"] = field + else: + args["schedule"] = None + + field = data.get("timezone", None) + if field is not None: + args["timezone"] = field + else: + args["timezone"] = None + + field = data.get("startup_command", None) + if field is not None: + args["startup_command"] = field + else: + args["startup_command"] = [] + + field = data.get("args", None) + if field is not None: + args["args"] = field + else: + args["args"] = [] + + return TriggerCronConfig(**args) + + +def unmarshal_Trigger(data: Any) -> Trigger: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Trigger' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + else: + args["id"] = None + + field = data.get("job_definition_id", None) + if field is not None: + args["job_definition_id"] = field + else: + args["job_definition_id"] = None + + field = data.get("name", None) + if field is not None: + args["name"] = field + else: + args["name"] = None + + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("updated_at", None) + if field is not None: + args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["updated_at"] = None + + field = data.get("cron_config", None) + if field is not None: + args["cron_config"] = unmarshal_TriggerCronConfig(field) + else: + args["cron_config"] = None + + return Trigger(**args) + + def unmarshal_CreateSecretsResponse(data: Any) -> CreateSecretsResponse: if not isinstance(data, dict): raise TypeError( @@ -562,6 +653,31 @@ def unmarshal_ListSecretsResponse(data: Any) -> ListSecretsResponse: return ListSecretsResponse(**args) +def unmarshal_ListTriggersResponse(data: Any) -> ListTriggersResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListTriggersResponse' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("triggers", None) + if field is not None: + args["triggers"] = ( + [unmarshal_Trigger(v) for v in field] if field is not None else None + ) + else: + args["triggers"] = [] + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = 0 + + return ListTriggersResponse(**args) + + def unmarshal_StartJobDefinitionResponse(data: Any) -> StartJobDefinitionResponse: if not isinstance(data, dict): raise TypeError( @@ -708,6 +824,53 @@ def marshal_CreateSecretsRequest( return output +def marshal_CreateTriggerRequestCronConfig( + request: CreateTriggerRequestCronConfig, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + if request.schedule is not None: + output["schedule"] = request.schedule + + if request.timezone is not None: + output["timezone"] = request.timezone + + if request.startup_command is not None: + output["startup_command"] = request.startup_command + + if request.args is not None: + output["args"] = request.args + + return output + + +def marshal_CreateTriggerRequest( + request: CreateTriggerRequest, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + output.update( + resolve_one_of( + [ + OneOfPossibility( + param="cron_config", + value=request.cron_config, + marshal_func=marshal_CreateTriggerRequestCronConfig, + ), + ] + ), + ) + + if request.job_definition_id is not None: + output["job_definition_id"] = request.job_definition_id + + if request.name is not None: + output["name"] = request.name + + return output + + def marshal_StartJobDefinitionRequest( request: StartJobDefinitionRequest, defaults: ProfileDefaults, @@ -817,3 +980,47 @@ def marshal_UpdateSecretRequest( output["secret_manager_version"] = request.secret_manager_version return output + + +def marshal_UpdateTriggerRequestCronConfig( + request: UpdateTriggerRequestCronConfig, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + if request.schedule is not None: + output["schedule"] = request.schedule + + if request.timezone is not None: + output["timezone"] = request.timezone + + if request.startup_command is not None: + output["startup_command"] = request.startup_command + + if request.args is not None: + output["args"] = request.args + + return output + + +def marshal_UpdateTriggerRequest( + request: UpdateTriggerRequest, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + output.update( + resolve_one_of( + [ + OneOfPossibility( + param="cron_config", + value=request.cron_config, + marshal_func=marshal_UpdateTriggerRequestCronConfig, + ), + ] + ), + ) + + if request.name is not None: + output["name"] = request.name + + return output diff --git a/scaleway/scaleway/jobs/v1alpha2/types.py b/scaleway/scaleway/jobs/v1alpha2/types.py index 1f13dc4f4..3a6776a36 100644 --- a/scaleway/scaleway/jobs/v1alpha2/types.py +++ b/scaleway/scaleway/jobs/v1alpha2/types.py @@ -66,6 +66,14 @@ def __str__(self) -> str: return str(self.value) +class ListTriggersRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_ASC = "created_at_asc" + CREATED_AT_DESC = "created_at_desc" + + def __str__(self) -> str: + return str(self.value) + + @dataclass class SecretEnvVar: name: str @@ -97,6 +105,29 @@ class RetryPolicy: """ +@dataclass +class TriggerCronConfig: + schedule: str + """ + CRON schedule in UNIX format. + """ + + timezone: str + """ + Time zone for the CRON schedule. + """ + + startup_command: list[str] + """ + Startup command that will be used by the triggered job. + """ + + args: list[str] + """ + Arguments passed to the startup command used by the triggered job. + """ + + @dataclass class CreateJobDefinitionRequestCronScheduleConfig: schedule: str @@ -139,30 +170,120 @@ class Secret: env_var: Optional[SecretEnvVar] = None +@dataclass +class CreateTriggerRequestCronConfig: + schedule: str + """ + CRON schedule in UNIX format. + """ + + timezone: str + """ + Time zone for the CRON schedule. + """ + + startup_command: list[str] + """ + Startup command that will be used by the triggered job. + """ + + args: list[str] + """ + Arguments passed to the startup command used by the triggered job. + """ + + @dataclass class JobDefinition: id: str + """ + UUID of the job definition. + """ + name: str + """ + Name of the job definition. + """ + project_id: str + """ + UUID of the Scaleway Project containing the job. + """ + cpu_limit: int + """ + CPU limit of the job (in mvCPU). + """ + memory_limit: int + """ + Memory limit of the job (in MiB). + """ + local_storage_capacity: int + """ + Local storage capacity of the job (in MiB). + """ + image_uri: str + """ + Image to use for the job. + """ + environment_variables: dict[str, str] + """ + Environment variables of the job. + """ + description: str + """ + Description of the job. + """ + startup_command: list[str] + """ + Job startup command. + """ + args: list[str] + """ + Job arguments passed to the startup command at runtime. + """ + region: ScwRegion """ Region to target. If none is passed will use default region from the config. """ created_at: Optional[datetime] = None + """ + Creation date of the job definition. + """ + updated_at: Optional[datetime] = None + """ + Last update date of the job definition. + """ + command: Optional[str] = None + """ + Deprecated, please use startup_command instead. + """ + job_timeout: Optional[str] = None + """ + Timeout of the job in seconds. + """ + cron_schedule: Optional[CronSchedule] = None + """ + Configure a cron for the job. + """ + retry_policy: Optional[RetryPolicy] = None + """ + Retry behaviour in case of job failure. + """ @dataclass @@ -174,29 +295,134 @@ class Resource: @dataclass class JobRun: id: str + """ + UUID of the job run. + """ + job_definition_id: str + """ + UUID of the job definition. + """ + state: JobRunState + """ + State of the job run. + """ + cpu_limit: int + """ + CPU limit of the job (in mvCPU). + """ + memory_limit: int + """ + Memory limit of the job (in MiB). + """ + local_storage_capacity: int + """ + Local storage capacity of the job (in MiB). + """ + environment_variables: dict[str, str] + """ + Environment variables of the job run. + """ + startup_command: list[str] + """ + Job startup command. + """ + args: list[str] + """ + Job arguments passed to the startup command at runtime. + """ + region: ScwRegion """ Region to target. If none is passed will use default region from the config. """ created_at: Optional[datetime] = None + """ + Creation date of the job run. + """ + updated_at: Optional[datetime] = None + """ + Last update date of the job run. + """ + started_at: Optional[datetime] = None + """ + Start date of the job run. + """ + terminated_at: Optional[datetime] = None + """ + Termination date of the job run. + """ + run_duration: Optional[str] = None - reason: Optional[JobRunReason] = None - exit_code: Optional[int] = None + """ + Duration of the job run. + """ + + reason: Optional[JobRunReason] = JobRunReason.UNKNOWN_REASON + """ + Reason for failure if the job failed. + """ + + exit_code: Optional[int] = 0 + """ + Exit code of the job. + """ + error_message: Optional[str] = None + """ + Error message if the job failed. + """ + command: Optional[str] = None - attempts: Optional[int] = None + """ + Deprecated, please use startup_command instead. + """ + + attempts: Optional[int] = 0 + """ + Number of retry attempts. + """ + + +@dataclass +class Trigger: + id: str + """ + UUID of the trigger. + """ + + job_definition_id: str + """ + UUID of the job definition. + """ + + name: str + """ + Human readable name of the trigger. + """ + + created_at: Optional[datetime] = None + """ + Creation time of the trigger. + """ + + updated_at: Optional[datetime] = None + """ + Last update time of the trigger. + """ + + cron_config: Optional[TriggerCronConfig] = None @dataclass @@ -205,6 +431,29 @@ class UpdateJobDefinitionRequestCronScheduleConfig: timezone: Optional[str] = None +@dataclass +class UpdateTriggerRequestCronConfig: + schedule: Optional[str] = None + """ + CRON schedule in UNIX format. + """ + + timezone: Optional[str] = None + """ + Time zone for the CRON schedule. + """ + + startup_command: Optional[list[str]] = field(default_factory=list) + """ + Startup command that will be used by the triggered job. + """ + + args: Optional[list[str]] = field(default_factory=list) + """ + Arguments passed to the startup command used by the triggered job. + """ + + @dataclass class CreateJobDefinitionRequest: cpu_limit: int @@ -311,6 +560,26 @@ class CreateSecretsResponse: """ +@dataclass +class CreateTriggerRequest: + job_definition_id: str + """ + UUID of the job definition. + """ + + name: str + """ + Name of the trigger. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + cron_config: Optional[CreateTriggerRequestCronConfig] = None + + @dataclass class DeleteJobDefinitionRequest: job_definition_id: str @@ -337,6 +606,19 @@ class DeleteSecretRequest: """ +@dataclass +class DeleteTriggerRequest: + trigger_id: str + """ + UUID of the trigger. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class GetJobDefinitionRequest: job_definition_id: str @@ -384,6 +666,19 @@ class GetSecretRequest: """ +@dataclass +class GetTriggerRequest: + trigger_id: str + """ + UUID of the trigger. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class JobLimits: secrets_per_job_definition: int @@ -472,6 +767,49 @@ class ListSecretsResponse: """ +@dataclass +class ListTriggersRequest: + job_definition_id: str + """ + UUID of the job definition. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + page: Optional[int] = 0 + """ + Page number from paginated list of triggers. + """ + + page_size: Optional[int] = 0 + """ + Number of triggers per page. + """ + + order_by: Optional[ListTriggersRequestOrderBy] = ( + ListTriggersRequestOrderBy.CREATED_AT_ASC + ) + """ + Sorting order of triggers. + """ + + +@dataclass +class ListTriggersResponse: + triggers: list[Trigger] + """ + List of triggers. + """ + + total_count: int + """ + Total count of triggers. + """ + + @dataclass class StartJobDefinitionRequest: job_definition_id: str @@ -636,3 +974,23 @@ class UpdateSecretRequest: path: Optional[str] = None env_var_name: Optional[str] = None + + +@dataclass +class UpdateTriggerRequest: + trigger_id: str + """ + UUID of the trigger. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + name: Optional[str] = None + """ + Name of the trigger. + """ + + cron_config: Optional[UpdateTriggerRequestCronConfig] = None diff --git a/scaleway/scaleway/k8s/v1/marshalling.py b/scaleway/scaleway/k8s/v1/marshalling.py index c7ba7bf54..7b0f034cb 100644 --- a/scaleway/scaleway/k8s/v1/marshalling.py +++ b/scaleway/scaleway/k8s/v1/marshalling.py @@ -470,12 +470,6 @@ def unmarshal_Cluster(data: Any) -> Cluster: else: args["apiserver_cert_sans"] = [] - field = data.get("acl_available", None) - if field is not None: - args["acl_available"] = field - else: - args["acl_available"] = False - field = data.get("iam_nodes_group_id", None) if field is not None: args["iam_nodes_group_id"] = field @@ -514,6 +508,12 @@ def unmarshal_Cluster(data: Any) -> Cluster: else: args["commitment_ends_at"] = None + field = data.get("acl_available", None) + if field is not None: + args["acl_available"] = field + else: + args["acl_available"] = False + return Cluster(**args) diff --git a/scaleway/scaleway/k8s/v1/types.py b/scaleway/scaleway/k8s/v1/types.py index ef2d2a05d..5ae02fa07 100644 --- a/scaleway/scaleway/k8s/v1/types.py +++ b/scaleway/scaleway/k8s/v1/types.py @@ -814,11 +814,6 @@ class Cluster: Additional Subject Alternative Names for the Kubernetes API server certificate. """ - acl_available: bool - """ - Defines whether ACL is available on the cluster. - """ - iam_nodes_group_id: str """ IAM group that nodes are members of (this field might be empty during early stage of cluster creation). @@ -874,6 +869,11 @@ class Cluster: Date on which it will be possible to switch to a smaller offer. """ + acl_available: Optional[bool] = False + """ + Defines whether ACL is available on the cluster. + """ + @dataclass class Node: diff --git a/scaleway/scaleway/lb/v1/marshalling.py b/scaleway/scaleway/lb/v1/marshalling.py index 13215d66e..a1d2aef14 100644 --- a/scaleway/scaleway/lb/v1/marshalling.py +++ b/scaleway/scaleway/lb/v1/marshalling.py @@ -167,12 +167,6 @@ def unmarshal_Ip(data: Any) -> Ip: else: args["tags"] = [] - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - field = data.get("zone", None) if field is not None: args["zone"] = field @@ -185,6 +179,12 @@ def unmarshal_Ip(data: Any) -> Ip: else: args["lb_id"] = None + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + return Ip(**args) @@ -515,12 +515,6 @@ def unmarshal_Instance(data: Any) -> Instance: else: args["ip_address"] = None - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - field = data.get("zone", None) if field is not None: args["zone"] = field @@ -539,6 +533,12 @@ def unmarshal_Instance(data: Any) -> Instance: else: args["updated_at"] = None + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + return Instance(**args) @@ -644,12 +644,6 @@ def unmarshal_Lb(data: Any) -> Lb: else: args["route_count"] = 0 - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - field = data.get("zone", None) if field is not None: args["zone"] = field @@ -674,6 +668,12 @@ def unmarshal_Lb(data: Any) -> Lb: else: args["updated_at"] = None + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + return Lb(**args) @@ -733,12 +733,6 @@ def unmarshal_Backend(data: Any) -> Backend: else: args["pool"] = [] - field = data.get("send_proxy_v2", None) - if field is not None: - args["send_proxy_v2"] = field - else: - args["send_proxy_v2"] = False - field = data.get("on_marked_down_action", None) if field is not None: args["on_marked_down_action"] = field @@ -763,6 +757,12 @@ def unmarshal_Backend(data: Any) -> Backend: else: args["lb"] = None + field = data.get("send_proxy_v2", None) + if field is not None: + args["send_proxy_v2"] = field + else: + args["send_proxy_v2"] = False + field = data.get("timeout_server", None) if field is not None: args["timeout_server"] = field @@ -1645,18 +1645,18 @@ def unmarshal_LbType(data: Any) -> LbType: else: args["description"] = None - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - field = data.get("zone", None) if field is not None: args["zone"] = field else: args["zone"] = None + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + return LbType(**args) diff --git a/scaleway/scaleway/lb/v1/types.py b/scaleway/scaleway/lb/v1/types.py index 8657f7b6e..f6ab10591 100644 --- a/scaleway/scaleway/lb/v1/types.py +++ b/scaleway/scaleway/lb/v1/types.py @@ -393,11 +393,6 @@ class Instance: Instance IP address. """ - region: ScwRegion - """ - The region the Instance is in. - """ - zone: ScwZone """ The zone the Instance is in. @@ -413,6 +408,11 @@ class Instance: Date on which the Instance was last updated. """ + region: Optional[ScwRegion] = None + """ + The region the Instance is in. + """ + @dataclass class Ip: @@ -446,11 +446,6 @@ class Ip: IP tags. """ - region: ScwRegion - """ - The region the IP address is in. - """ - zone: ScwZone """ The zone the IP address is in. @@ -461,6 +456,11 @@ class Ip: Load Balancer ID. """ + region: Optional[ScwRegion] = None + """ + The region the IP address is in. + """ + @dataclass class Subscriber: @@ -607,11 +607,6 @@ class Lb: Number of routes configured on the Load Balancer. """ - region: ScwRegion - """ - The region the Load Balancer is in. - """ - zone: ScwZone """ The zone the Load Balancer is in. @@ -632,6 +627,11 @@ class Lb: Date on which the Load Balancer was last updated. """ + region: Optional[ScwRegion] = None + """ + The region the Load Balancer is in. + """ + @dataclass class AclActionRedirect: @@ -973,7 +973,7 @@ class PrivateNetworkIpamConfig: @dataclass class PrivateNetworkStaticConfig: - ip_address: list[str] + ip_address: Optional[list[str]] = field(default_factory=list) """ Array of a local IP address for the Load Balancer on this Private Network. """ @@ -1151,14 +1151,14 @@ class LbType: Load Balancer commercial offer type description. """ - region: ScwRegion + zone: ScwZone """ - The region the Load Balancer stock is in. + The zone the Load Balancer stock is in. """ - zone: ScwZone + region: Optional[ScwRegion] = None """ - The zone the Load Balancer stock is in. + The region the Load Balancer stock is in. """ diff --git a/scaleway/scaleway/product_catalog/v2alpha1/types.py b/scaleway/scaleway/product_catalog/v2alpha1/types.py index a95c937ca..a68e05b15 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/types.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/types.py @@ -447,12 +447,12 @@ class PublicCatalogProductPropertiesAppleSilicon: @dataclass class PublicCatalogProductPropertiesBlockStorage: - min_volume_size: int + min_volume_size: Optional[int] = 0 """ The minimum size of storage volume for this product in bytes. Deprecated. """ - max_volume_size: int + max_volume_size: Optional[int] = 0 """ The maximum size of storage volume for this product in bytes. Deprecated. """ diff --git a/scaleway/scaleway/rdb/v1/marshalling.py b/scaleway/scaleway/rdb/v1/marshalling.py index 0ca045b2c..522381ee7 100644 --- a/scaleway/scaleway/rdb/v1/marshalling.py +++ b/scaleway/scaleway/rdb/v1/marshalling.py @@ -1625,18 +1625,6 @@ def unmarshal_NodeType(data: Any) -> NodeType: else: args["memory"] = 0 - field = data.get("volume_constraint", None) - if field is not None: - args["volume_constraint"] = unmarshal_NodeTypeVolumeConstraintSizes(field) - else: - args["volume_constraint"] = None - - field = data.get("is_bssd_compatible", None) - if field is not None: - args["is_bssd_compatible"] = field - else: - args["is_bssd_compatible"] = False - field = data.get("disabled", None) if field is not None: args["disabled"] = field @@ -1649,6 +1637,18 @@ def unmarshal_NodeType(data: Any) -> NodeType: else: args["beta"] = False + field = data.get("volume_constraint", None) + if field is not None: + args["volume_constraint"] = unmarshal_NodeTypeVolumeConstraintSizes(field) + else: + args["volume_constraint"] = None + + field = data.get("is_bssd_compatible", None) + if field is not None: + args["is_bssd_compatible"] = field + else: + args["is_bssd_compatible"] = False + field = data.get("available_volume_types", None) if field is not None: args["available_volume_types"] = ( diff --git a/scaleway/scaleway/rdb/v1/types.py b/scaleway/scaleway/rdb/v1/types.py index a78e6ac1f..733c78288 100644 --- a/scaleway/scaleway/rdb/v1/types.py +++ b/scaleway/scaleway/rdb/v1/types.py @@ -667,7 +667,7 @@ class ACLRule: direction: ACLRuleDirection action: ACLRuleAction description: str - port: int + port: Optional[int] = 0 @dataclass @@ -992,11 +992,6 @@ class NodeType: Quantity of RAM. """ - is_bssd_compatible: bool - """ - The Node Type is compliant with Block Storage. - """ - disabled: bool """ The Node Type is currently disabled. @@ -1037,6 +1032,11 @@ class NodeType: [deprecated] Node Type volume constraints. """ + is_bssd_compatible: Optional[bool] = False + """ + The Node Type is compliant with Block Storage. + """ + @dataclass class Privilege: diff --git a/scaleway/scaleway/vpcgw/v1/api.py b/scaleway/scaleway/vpcgw/v1/api.py index b04c7a0c1..7fa509d97 100644 --- a/scaleway/scaleway/vpcgw/v1/api.py +++ b/scaleway/scaleway/vpcgw/v1/api.py @@ -694,8 +694,8 @@ def wait_for_gateway_network( options = WaitForOptions() if not options.stop: - options.stop = ( - lambda res: res.status not in GATEWAY_NETWORK_TRANSIENT_STATUSES + options.stop = lambda res: ( + res.status not in GATEWAY_NETWORK_TRANSIENT_STATUSES ) return wait_for_resource( diff --git a/scaleway/scaleway/vpcgw/v2/api.py b/scaleway/scaleway/vpcgw/v2/api.py index 29ee499ca..102253a73 100644 --- a/scaleway/scaleway/vpcgw/v2/api.py +++ b/scaleway/scaleway/vpcgw/v2/api.py @@ -628,8 +628,8 @@ def wait_for_gateway_network( options = WaitForOptions() if not options.stop: - options.stop = ( - lambda res: res.status not in GATEWAY_NETWORK_TRANSIENT_STATUSES + options.stop = lambda res: ( + res.status not in GATEWAY_NETWORK_TRANSIENT_STATUSES ) return wait_for_resource( diff --git a/scaleway/scaleway/webhosting/v1/__init__.py b/scaleway/scaleway/webhosting/v1/__init__.py index 5321c8e18..2e0a5da2d 100644 --- a/scaleway/scaleway/webhosting/v1/__init__.py +++ b/scaleway/scaleway/webhosting/v1/__init__.py @@ -35,8 +35,8 @@ from .types import AutoConfigDomainDns from .types import PlatformControlPanelUrls from .types import HostingDomainCustomDomain -from .types import ControlPanel from .types import OfferCommitment +from .types import ControlPanel from .types import OfferOption from .types import PlatformControlPanel from .types import BackupItem @@ -48,6 +48,7 @@ from .types import SyncDomainDnsRecordsRequestRecord from .types import DnsRecord from .types import Nameserver +from .types import HostingCommitment from .types import HostingUser from .types import Offer from .types import Platform @@ -185,8 +186,8 @@ "AutoConfigDomainDns", "PlatformControlPanelUrls", "HostingDomainCustomDomain", - "ControlPanel", "OfferCommitment", + "ControlPanel", "OfferOption", "PlatformControlPanel", "BackupItem", @@ -198,6 +199,7 @@ "SyncDomainDnsRecordsRequestRecord", "DnsRecord", "Nameserver", + "HostingCommitment", "HostingUser", "Offer", "Platform", diff --git a/scaleway/scaleway/webhosting/v1/api.py b/scaleway/scaleway/webhosting/v1/api.py index 33c44373b..dd9cece7b 100644 --- a/scaleway/scaleway/webhosting/v1/api.py +++ b/scaleway/scaleway/webhosting/v1/api.py @@ -1232,22 +1232,22 @@ def sync_domain_dns_records( self, *, domain: str, - update_web_records: bool, - update_mail_records: bool, - update_all_records: bool, - update_nameservers: bool, region: Optional[ScwRegion] = None, + update_web_records: Optional[bool] = None, + update_mail_records: Optional[bool] = None, + update_all_records: Optional[bool] = None, + update_nameservers: Optional[bool] = None, custom_records: Optional[list[SyncDomainDnsRecordsRequestRecord]] = None, auto_config_domain_dns: Optional[AutoConfigDomainDns] = None, ) -> DnsRecords: """ Synchronize your DNS records on the Elements Console and on cPanel. :param domain: Domain for which the DNS records will be synchronized. + :param region: Region to target. If none is passed will use default region from the config. :param update_web_records: Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns). :param update_mail_records: Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns). :param update_all_records: Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns). :param update_nameservers: Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns). - :param region: Region to target. If none is passed will use default region from the config. :param custom_records: Custom records to synchronize. :param auto_config_domain_dns: Whether or not to synchronize each types of records. :return: :class:`DnsRecords ` @@ -1257,10 +1257,6 @@ def sync_domain_dns_records( result = api.sync_domain_dns_records( domain="example", - update_web_records=False, - update_mail_records=False, - update_all_records=False, - update_nameservers=False, ) """ @@ -1275,11 +1271,11 @@ def sync_domain_dns_records( body=marshal_DnsApiSyncDomainDnsRecordsRequest( DnsApiSyncDomainDnsRecordsRequest( domain=domain, + region=region, update_web_records=update_web_records, update_mail_records=update_mail_records, update_all_records=update_all_records, update_nameservers=update_nameservers, - region=region, custom_records=custom_records, auto_config_domain_dns=auto_config_domain_dns, ), @@ -1517,6 +1513,7 @@ def create_hosting( domain_configuration: Optional[CreateHostingRequestDomainConfiguration] = None, skip_welcome_email: Optional[bool] = None, auto_config_domain_dns: Optional[AutoConfigDomainDns] = None, + offer_commitment_id: Optional[str] = None, ) -> Hosting: """ Order a Web Hosting plan. @@ -1533,6 +1530,7 @@ def create_hosting( :param domain_configuration: Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_config_domain_dns instead). :param skip_welcome_email: Indicates whether to skip a welcome email to the contact email containing hosting info. :param auto_config_domain_dns: Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_update_* fields instead). + :param offer_commitment_id: Offer commitment ID to which the hosting will be engaged. :return: :class:`Hosting ` Usage: @@ -1566,6 +1564,7 @@ def create_hosting( domain_configuration=domain_configuration, skip_welcome_email=skip_welcome_email, auto_config_domain_dns=auto_config_domain_dns, + offer_commitment_id=offer_commitment_id, ), self.client, ), diff --git a/scaleway/scaleway/webhosting/v1/marshalling.py b/scaleway/scaleway/webhosting/v1/marshalling.py index e0859b774..abf00f964 100644 --- a/scaleway/scaleway/webhosting/v1/marshalling.py +++ b/scaleway/scaleway/webhosting/v1/marshalling.py @@ -51,10 +51,11 @@ DnsRecords, Domain, PlatformControlPanelUrls, - ControlPanel, OfferCommitment, + ControlPanel, OfferOption, PlatformControlPanel, + HostingCommitment, HostingUser, Offer, Platform, @@ -349,36 +350,18 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: else: args["status"] = HostingStatus.UNKNOWN_STATUS - field = data.get("domain", None) - if field is not None: - args["domain"] = field - else: - args["domain"] = None - field = data.get("protected", None) if field is not None: args["protected"] = field else: args["protected"] = False - field = data.get("dns_status", None) - if field is not None: - args["dns_status"] = field - else: - args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS - field = data.get("offer_name", None) if field is not None: args["offer_name"] = field else: args["offer_name"] = None - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - else: - args["domain_status"] = DomainStatus.UNKNOWN_STATUS - field = data.get("region", None) if field is not None: args["region"] = field @@ -397,6 +380,24 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: else: args["updated_at"] = None + field = data.get("domain", None) + if field is not None: + args["domain"] = field + else: + args["domain"] = None + + field = data.get("dns_status", None) + if field is not None: + args["dns_status"] = field + else: + args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS + + field = data.get("domain_status", None) + if field is not None: + args["domain_status"] = field + else: + args["domain_status"] = DomainStatus.UNKNOWN_STATUS + field = data.get("domain_info", None) if field is not None: args["domain_info"] = unmarshal_HostingDomain(field) @@ -740,43 +741,6 @@ def unmarshal_PlatformControlPanelUrls(data: Any) -> PlatformControlPanelUrls: return PlatformControlPanelUrls(**args) -def unmarshal_ControlPanel(data: Any) -> ControlPanel: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ControlPanel' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("name", None) - if field is not None: - args["name"] = field - else: - args["name"] = None - - field = data.get("available", None) - if field is not None: - args["available"] = field - else: - args["available"] = False - - field = data.get("logo_url", None) - if field is not None: - args["logo_url"] = field - else: - args["logo_url"] = None - - field = data.get("available_languages", None) - if field is not None: - args["available_languages"] = ( - [StdLanguageCode(v) for v in field] if field is not None else None - ) - else: - args["available_languages"] = [] - - return ControlPanel(**args) - - def unmarshal_OfferCommitment(data: Any) -> OfferCommitment: if not isinstance(data, dict): raise TypeError( @@ -830,6 +794,43 @@ def unmarshal_OfferCommitment(data: Any) -> OfferCommitment: return OfferCommitment(**args) +def unmarshal_ControlPanel(data: Any) -> ControlPanel: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ControlPanel' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("name", None) + if field is not None: + args["name"] = field + else: + args["name"] = None + + field = data.get("available", None) + if field is not None: + args["available"] = field + else: + args["available"] = False + + field = data.get("logo_url", None) + if field is not None: + args["logo_url"] = field + else: + args["logo_url"] = None + + field = data.get("available_languages", None) + if field is not None: + args["available_languages"] = ( + [StdLanguageCode(v) for v in field] if field is not None else None + ) + else: + args["available_languages"] = [] + + return ControlPanel(**args) + + def unmarshal_OfferOption(data: Any) -> OfferOption: if not isinstance(data, dict): raise TypeError( @@ -912,6 +913,41 @@ def unmarshal_PlatformControlPanel(data: Any) -> PlatformControlPanel: return PlatformControlPanel(**args) +def unmarshal_HostingCommitment(data: Any) -> HostingCommitment: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'HostingCommitment' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("delete_hosting_at_end", None) + if field is not None: + args["delete_hosting_at_end"] = field + else: + args["delete_hosting_at_end"] = False + + field = data.get("offer_commitment", None) + if field is not None: + args["offer_commitment"] = unmarshal_OfferCommitment(field) + else: + args["offer_commitment"] = None + + field = data.get("start_at", None) + if field is not None: + args["start_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["start_at"] = None + + field = data.get("end_at", None) + if field is not None: + args["end_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["end_at"] = None + + return HostingCommitment(**args) + + def unmarshal_HostingUser(data: Any) -> HostingUser: if not isinstance(data, dict): raise TypeError( @@ -1109,12 +1145,6 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["status"] = HostingStatus.UNKNOWN_STATUS - field = data.get("domain", None) - if field is not None: - args["domain"] = field - else: - args["domain"] = None - field = data.get("updated_at", None) if field is not None: args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -1127,6 +1157,12 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["created_at"] = None + field = data.get("domain", None) + if field is not None: + args["domain"] = field + else: + args["domain"] = None + field = data.get("offer", None) if field is not None: args["offer"] = unmarshal_Offer(field) @@ -1145,12 +1181,6 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["tags"] = [] - field = data.get("dns_status", None) - if field is not None: - args["dns_status"] = field - else: - args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS - field = data.get("ipv4", None) if field is not None: args["ipv4"] = field @@ -1163,30 +1193,42 @@ def unmarshal_Hosting(data: Any) -> Hosting: else: args["protected"] = False - field = data.get("domain_status", None) - if field is not None: - args["domain_status"] = field - else: - args["domain_status"] = DomainStatus.UNKNOWN_STATUS - field = data.get("region", None) if field is not None: args["region"] = field else: args["region"] = None + field = data.get("dns_status", None) + if field is not None: + args["dns_status"] = field + else: + args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS + field = data.get("user", None) if field is not None: args["user"] = unmarshal_HostingUser(field) else: args["user"] = None + field = data.get("domain_status", None) + if field is not None: + args["domain_status"] = field + else: + args["domain_status"] = DomainStatus.UNKNOWN_STATUS + field = data.get("domain_info", None) if field is not None: args["domain_info"] = unmarshal_HostingDomain(field) else: args["domain_info"] = None + field = data.get("commitment", None) + if field is not None: + args["commitment"] = unmarshal_HostingCommitment(field) + else: + args["commitment"] = None + return Hosting(**args) @@ -1634,18 +1676,18 @@ def unmarshal_ResetHostingPasswordResponse(data: Any) -> ResetHostingPasswordRes args: dict[str, Any] = {} - field = data.get("one_time_password", None) - if field is not None: - args["one_time_password"] = field - else: - args["one_time_password"] = None - field = data.get("one_time_password_b64", None) if field is not None: args["one_time_password_b64"] = field else: args["one_time_password_b64"] = None + field = data.get("one_time_password", None) + if field is not None: + args["one_time_password"] = field + else: + args["one_time_password"] = None + return ResetHostingPasswordResponse(**args) @@ -2138,6 +2180,9 @@ def marshal_HostingApiCreateHostingRequest( request.auto_config_domain_dns, defaults ) + if request.offer_commitment_id is not None: + output["offer_commitment_id"] = request.offer_commitment_id + return output diff --git a/scaleway/scaleway/webhosting/v1/types.py b/scaleway/scaleway/webhosting/v1/types.py index e1f026571..11a9088d1 100644 --- a/scaleway/scaleway/webhosting/v1/types.py +++ b/scaleway/scaleway/webhosting/v1/types.py @@ -385,29 +385,6 @@ class HostingDomainCustomDomain: """ -@dataclass -class ControlPanel: - name: str - """ - Control panel name. - """ - - available: bool - """ - Define if the control panel type is available to order. - """ - - logo_url: str - """ - URL of the control panel's logo. - """ - - available_languages: list[StdLanguageCode] - """ - List of available languages for the control panel. - """ - - @dataclass class OfferCommitment: id: str @@ -446,6 +423,29 @@ class OfferCommitment: """ +@dataclass +class ControlPanel: + name: str + """ + Control panel name. + """ + + available: bool + """ + Define if the control panel type is available to order. + """ + + logo_url: str + """ + URL of the control panel's logo. + """ + + available_languages: list[StdLanguageCode] + """ + List of available languages for the control panel. + """ + + @dataclass class OfferOption: id: str @@ -650,6 +650,31 @@ class Nameserver: """ +@dataclass +class HostingCommitment: + delete_hosting_at_end: bool + """ + The hosting may be deleted, automatically renewed, or switched to +its configured post-commitment offer, which may have a different +price and billing period. + """ + + offer_commitment: Optional[OfferCommitment] = None + """ + Offer commitment for the specified hosting. + """ + + start_at: Optional[datetime] = None + """ + Date and time the commitment started. + """ + + end_at: Optional[datetime] = None + """ + Date and time the commitment ends. + """ + + @dataclass class HostingUser: username: str @@ -866,31 +891,16 @@ class HostingSummary: Status of the Web Hosting plan. """ - domain: str - """ - Main domain associated with the Web Hosting plan (deprecated, use domain_info). - """ - protected: bool """ Whether the hosting is protected or not. """ - dns_status: DnsRecordsStatus - """ - DNS status of the Web Hosting plan. - """ - offer_name: str """ Name of the active offer for the Web Hosting plan. """ - domain_status: DomainStatus - """ - Main domain status of the Web Hosting plan. - """ - region: ScwRegion """ Region where the Web Hosting plan is hosted. @@ -906,6 +916,21 @@ class HostingSummary: Date on which the Web Hosting plan was last updated. """ + domain: Optional[str] = None + """ + Main domain associated with the Web Hosting plan (deprecated, use domain_info). + """ + + dns_status: Optional[DnsRecordsStatus] = DnsRecordsStatus.UNKNOWN_STATUS + """ + DNS status of the Web Hosting plan. + """ + + domain_status: Optional[DomainStatus] = DomainStatus.UNKNOWN_STATUS + """ + Main domain status of the Web Hosting plan. + """ + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). @@ -1498,31 +1523,31 @@ class DnsApiSyncDomainDnsRecordsRequest: Domain for which the DNS records will be synchronized. """ - update_web_records: bool + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + update_web_records: Optional[bool] = False """ Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns). """ - update_mail_records: bool + update_mail_records: Optional[bool] = False """ Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns). """ - update_all_records: bool + update_all_records: Optional[bool] = False """ Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns). """ - update_nameservers: bool + update_nameservers: Optional[bool] = False """ Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns). """ - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - custom_records: Optional[list[SyncDomainDnsRecordsRequestRecord]] = field( default_factory=list ) @@ -1553,7 +1578,7 @@ class DnsRecords: Status of the records. """ - dns_config: list[DomainDnsAction] + dns_config: Optional[list[DomainDnsAction]] = field(default_factory=list) """ Records dns auto configuration settings (deprecated, use auto_config_domain_dns). """ @@ -1591,7 +1616,7 @@ class Domain: A list of actions that can be performed on the domain. """ - available_dns_actions: list[DomainDnsAction] + available_dns_actions: Optional[list[DomainDnsAction]] = field(default_factory=list) """ A list of DNS-related actions that can be auto configured for the domain (deprecated, use auto_config_domain_dns instead). """ @@ -1759,21 +1784,11 @@ class Hosting: Status of the Web Hosting plan. """ - domain: str - """ - Main domain associated with the Web Hosting plan (deprecated, use domain_info). - """ - tags: list[str] """ List of tags associated with the Web Hosting plan. """ - dns_status: DnsRecordsStatus - """ - DNS status of the Web Hosting plan (deprecated, use domain_info). - """ - ipv4: str """ Current IPv4 address of the hosting. @@ -1784,11 +1799,6 @@ class Hosting: Whether the hosting is protected or not. """ - domain_status: DomainStatus - """ - Main domain status of the Web Hosting plan (deprecated, use domain_info). - """ - region: ScwRegion """ Region where the Web Hosting plan is hosted. @@ -1804,6 +1814,11 @@ class Hosting: Date on which the Web Hosting plan was created. """ + domain: Optional[str] = None + """ + Main domain associated with the Web Hosting plan (deprecated, use domain_info). + """ + offer: Optional[Offer] = None """ Details of the Web Hosting plan offer and options. @@ -1814,16 +1829,31 @@ class Hosting: Details of the hosting platform. """ + dns_status: Optional[DnsRecordsStatus] = DnsRecordsStatus.UNKNOWN_STATUS + """ + DNS status of the Web Hosting plan (deprecated, use domain_info). + """ + user: Optional[HostingUser] = None """ Details of the hosting user. """ + domain_status: Optional[DomainStatus] = DomainStatus.UNKNOWN_STATUS + """ + Main domain status of the Web Hosting plan (deprecated, use domain_info). + """ + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). """ + commitment: Optional[HostingCommitment] = None + """ + Commitment details to which the hosting is engaged. + """ + @dataclass class HostingApiAddCustomDomainRequest: @@ -1905,6 +1935,11 @@ class HostingApiCreateHostingRequest: Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_update_* fields instead). """ + offer_commitment_id: Optional[str] = None + """ + Offer commitment ID to which the hosting will be engaged. + """ + @dataclass class HostingApiCreateSessionRequest: @@ -2482,14 +2517,14 @@ class Progress: @dataclass class ResetHostingPasswordResponse: - one_time_password: str + one_time_password_b64: str """ - New temporary password (deprecated, use password_b64 instead). + New temporary password, encoded in base64. """ - one_time_password_b64: str + one_time_password: Optional[str] = None """ - New temporary password, encoded in base64. + New temporary password (deprecated, use password_b64 instead). """