diff --git a/scaleway-async/scaleway_async/domain/v2beta1/__init__.py b/scaleway-async/scaleway_async/domain/v2beta1/__init__.py index f8bbd9dbe..1d2c3e78e 100644 --- a/scaleway-async/scaleway_async/domain/v2beta1/__init__.py +++ b/scaleway-async/scaleway_async/domain/v2beta1/__init__.py @@ -53,6 +53,7 @@ from .types import RecordIdentifier from .types import ContactExtensionEU from .types import ContactExtensionFR +from .types import ContactExtensionIT from .types import ContactExtensionNL from .types import ContactQuestion from .types import TldOffer @@ -167,7 +168,9 @@ from .types import RestoreDNSZoneVersionRequest from .types import RestoreDNSZoneVersionResponse from .types import RetryInboundTransferResponse +from .types import SearchAvailableDomainsConsoleResponse from .types import SearchAvailableDomainsResponse +from .types import UnauthenticatedRegistrarApiSearchAvailableDomainsConsoleRequest from .types import UpdateDNSZoneNameserversRequest from .types import UpdateDNSZoneNameserversResponse from .types import UpdateDNSZoneRecordsRequest @@ -175,6 +178,7 @@ from .types import UpdateDNSZoneRequest from .api import DomainV2Beta1API from .api import DomainV2Beta1RegistrarAPI +from .api import DomainV2Beta1UnauthenticatedRegistrarAPI __all__ = [ "ContactEmailStatus", @@ -230,6 +234,7 @@ "RecordIdentifier", "ContactExtensionEU", "ContactExtensionFR", + "ContactExtensionIT", "ContactExtensionNL", "ContactQuestion", "TldOffer", @@ -344,7 +349,9 @@ "RestoreDNSZoneVersionRequest", "RestoreDNSZoneVersionResponse", "RetryInboundTransferResponse", + "SearchAvailableDomainsConsoleResponse", "SearchAvailableDomainsResponse", + "UnauthenticatedRegistrarApiSearchAvailableDomainsConsoleRequest", "UpdateDNSZoneNameserversRequest", "UpdateDNSZoneNameserversResponse", "UpdateDNSZoneRecordsRequest", @@ -352,4 +359,5 @@ "UpdateDNSZoneRequest", "DomainV2Beta1API", "DomainV2Beta1RegistrarAPI", + "DomainV2Beta1UnauthenticatedRegistrarAPI", ] diff --git a/scaleway-async/scaleway_async/domain/v2beta1/api.py b/scaleway-async/scaleway_async/domain/v2beta1/api.py index 5aa7499ac..26aed8254 100644 --- a/scaleway-async/scaleway_async/domain/v2beta1/api.py +++ b/scaleway-async/scaleway_async/domain/v2beta1/api.py @@ -7,7 +7,9 @@ from scaleway_core.api import API from scaleway_core.bridge import ( ScwFile, + ServiceInfo, unmarshal_ScwFile, + unmarshal_ServiceInfo, ) from scaleway_core.utils import ( WaitForOptions, @@ -35,6 +37,7 @@ Contact, ContactExtensionEU, ContactExtensionFR, + ContactExtensionIT, ContactExtensionNL, ContactRoles, CreateDNSZoneRequest, @@ -96,6 +99,7 @@ RestoreDNSZoneVersionResponse, RetryInboundTransferResponse, SSLCertificate, + SearchAvailableDomainsConsoleResponse, SearchAvailableDomainsResponse, Task, Tld, @@ -145,6 +149,7 @@ unmarshal_RegisterExternalDomainResponse, unmarshal_RestoreDNSZoneVersionResponse, unmarshal_RetryInboundTransferResponse, + unmarshal_SearchAvailableDomainsConsoleResponse, unmarshal_SearchAvailableDomainsResponse, unmarshal_UpdateDNSZoneNameserversResponse, unmarshal_UpdateDNSZoneRecordsResponse, @@ -2087,6 +2092,7 @@ async def update_contact( whois_opt_in: Optional[bool] = None, state: Optional[str] = None, extension_nl: Optional[ContactExtensionNL] = None, + extension_it: Optional[ContactExtensionIT] = None, ) -> Contact: """ Update contact. @@ -2111,6 +2117,7 @@ async def update_contact( :param whois_opt_in: :param state: :param extension_nl: + :param extension_it: :return: :class:`Contact ` Usage: @@ -2148,6 +2155,7 @@ async def update_contact( whois_opt_in=whois_opt_in, state=state, extension_nl=extension_nl, + extension_it=extension_it, ), self.client, ), @@ -2977,3 +2985,65 @@ async def delete_domain_host( self._throw_on_error(res) return unmarshal_Host(res.json()) + + +class DomainV2Beta1UnauthenticatedRegistrarAPI(API): + """ + Unauthenticated Domain search API. + """ + + async def get_service_info( + self, + ) -> ServiceInfo: + """ + + :return: :class:`ServiceInfo ` + + Usage: + :: + + result = await api.get_service_info() + """ + + res = self._request( + "GET", + "/domain/v2beta1/search", + ) + + self._throw_on_error(res) + return unmarshal_ServiceInfo(res.json()) + + async def search_available_domains_console( + self, + *, + domain: str, + strict_search: bool, + tlds: Optional[list[str]] = None, + ) -> SearchAvailableDomainsConsoleResponse: + """ + :param domain: + :param strict_search: + :param tlds: + :return: :class:`SearchAvailableDomainsConsoleResponse ` + + Usage: + :: + + result = await api.search_available_domains_console( + domain="example", + strict_search=False, + ) + """ + + res = self._request( + "GET", + "/domain/v2beta1/search-domains-console", + params={ + "domain": domain, + "strict_search": strict_search, + "tlds": tlds, + }, + ) + + self._throw_on_error(res) + return unmarshal_SearchAvailableDomainsConsoleResponse(res.json()) diff --git a/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py b/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py index 37441a25d..a6f13566c 100644 --- a/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py +++ b/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py @@ -26,6 +26,7 @@ ContactExtensionFRTrademarkInfo, ContactExtensionEU, ContactExtensionFR, + ContactExtensionIT, ContactExtensionNL, ContactQuestion, Contact, @@ -93,6 +94,7 @@ RestoreDNSZoneVersionResponse, RetryInboundTransferResponse, AvailableDomain, + SearchAvailableDomainsConsoleResponse, SearchAvailableDomainsResponse, UpdateDNSZoneNameserversResponse, UpdateDNSZoneRecordsResponse, @@ -300,6 +302,29 @@ def unmarshal_ContactExtensionFR(data: Any) -> ContactExtensionFR: return ContactExtensionFR(**args) +def unmarshal_ContactExtensionIT(data: Any) -> ContactExtensionIT: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ContactExtensionIT' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("european_citizenship", None) + if field is not None: + args["european_citizenship"] = field + else: + args["european_citizenship"] = None + + field = data.get("tax_code", None) + if field is not None: + args["tax_code"] = field + else: + args["tax_code"] = None + + return ContactExtensionIT(**args) + + def unmarshal_ContactExtensionNL(data: Any) -> ContactExtensionNL: if not isinstance(data, dict): raise TypeError( @@ -512,6 +537,12 @@ def unmarshal_Contact(data: Any) -> Contact: else: args["extension_nl"] = None + field = data.get("extension_it", None) + if field is not None: + args["extension_it"] = unmarshal_ContactExtensionIT(field) + else: + args["extension_it"] = None + return Contact(**args) @@ -2581,6 +2612,33 @@ def unmarshal_AvailableDomain(data: Any) -> AvailableDomain: return AvailableDomain(**args) +def unmarshal_SearchAvailableDomainsConsoleResponse( + data: Any, +) -> SearchAvailableDomainsConsoleResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'SearchAvailableDomainsConsoleResponse' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("available_domains", None) + if field is not None: + args["available_domains"] = ( + [unmarshal_AvailableDomain(v) for v in field] if field is not None else None + ) + else: + args["available_domains"] = None + + field = data.get("exact_match_domain", None) + if field is not None: + args["exact_match_domain"] = unmarshal_AvailableDomain(field) + else: + args["exact_match_domain"] = None + + return SearchAvailableDomainsConsoleResponse(**args) + + def unmarshal_SearchAvailableDomainsResponse( data: Any, ) -> SearchAvailableDomainsResponse: @@ -2946,6 +3004,21 @@ def marshal_ContactExtensionFR( return output +def marshal_ContactExtensionIT( + request: ContactExtensionIT, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + 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 + + return output + + def marshal_ContactExtensionNL( request: ContactExtensionNL, defaults: ProfileDefaults, @@ -2996,12 +3069,6 @@ def marshal_NewContact( if request.email is not None: output["email"] = request.email - if request.company_name is not None: - output["company_name"] = request.company_name - - if request.email_alt is not None: - output["email_alt"] = request.email_alt - if request.phone_number is not None: output["phone_number"] = request.phone_number @@ -3014,8 +3081,11 @@ def marshal_NewContact( if request.city is not None: output["city"] = request.city - if request.country is not None: - output["country"] = request.country + if request.company_name is not None: + output["company_name"] = request.company_name + + if request.email_alt is not None: + output["email_alt"] = request.email_alt if request.fax_number is not None: output["fax_number"] = request.fax_number @@ -3023,11 +3093,8 @@ def marshal_NewContact( if request.address_line_2 is not None: output["address_line_2"] = request.address_line_2 - if request.vat_identification_code is not None: - output["vat_identification_code"] = request.vat_identification_code - - if request.company_identification_code is not None: - output["company_identification_code"] = request.company_identification_code + if request.country is not None: + output["country"] = request.country if request.lang is not None: output["lang"] = request.lang @@ -3038,6 +3105,12 @@ def marshal_NewContact( if request.whois_opt_in is not None: output["whois_opt_in"] = request.whois_opt_in + if request.vat_identification_code is not None: + output["vat_identification_code"] = request.vat_identification_code + + if request.company_identification_code is not None: + output["company_identification_code"] = request.company_identification_code + if request.questions is not None: output["questions"] = [ marshal_ContactQuestion(item, defaults) for item in request.questions @@ -3061,6 +3134,11 @@ def marshal_NewContact( request.extension_nl, defaults ) + if request.extension_it is not None: + output["extension_it"] = marshal_ContactExtensionIT( + request.extension_it, defaults + ) + return output @@ -3536,6 +3614,11 @@ def marshal_RegistrarApiUpdateContactRequest( request.extension_nl, defaults ) + if request.extension_it is not None: + output["extension_it"] = marshal_ContactExtensionIT( + request.extension_it, defaults + ) + return output diff --git a/scaleway-async/scaleway_async/domain/v2beta1/types.py b/scaleway-async/scaleway_async/domain/v2beta1/types.py index 75dd1fc09..f071abc39 100644 --- a/scaleway-async/scaleway_async/domain/v2beta1/types.py +++ b/scaleway-async/scaleway_async/domain/v2beta1/types.py @@ -515,6 +515,12 @@ class ContactExtensionFR: code_auth_afnic_info: Optional[ContactExtensionFRCodeAuthAfnicInfo] = None +@dataclass +class ContactExtensionIT: + european_citizenship: str + tax_code: str + + @dataclass class ContactExtensionNL: legal_form: ContactExtensionNLLegalForm @@ -603,6 +609,7 @@ class Contact: extension_fr: Optional[ContactExtensionFR] = None extension_eu: Optional[ContactExtensionEU] = None extension_nl: Optional[ContactExtensionNL] = None + extension_it: Optional[ContactExtensionIT] = None @dataclass @@ -660,6 +667,7 @@ class NewContact: extension_eu: Optional[ContactExtensionEU] = None state: Optional[str] = None extension_nl: Optional[ContactExtensionNL] = None + extension_it: Optional[ContactExtensionIT] = None @dataclass @@ -1768,6 +1776,7 @@ class RegistrarApiUpdateContactRequest: whois_opt_in: Optional[bool] = None state: Optional[str] = None extension_nl: Optional[ContactExtensionNL] = None + extension_it: Optional[ContactExtensionIT] = None @dataclass @@ -1808,6 +1817,12 @@ class RetryInboundTransferResponse: pass +@dataclass +class SearchAvailableDomainsConsoleResponse: + available_domains: list[AvailableDomain] + exact_match_domain: Optional[AvailableDomain] = None + + @dataclass class SearchAvailableDomainsResponse: available_domains: list[AvailableDomain] @@ -1816,6 +1831,13 @@ class SearchAvailableDomainsResponse: """ +@dataclass +class UnauthenticatedRegistrarApiSearchAvailableDomainsConsoleRequest: + domain: str + strict_search: bool + tlds: Optional[list[str]] = field(default_factory=list) + + @dataclass class UpdateDNSZoneNameserversRequest: dns_zone: str diff --git a/scaleway-async/scaleway_async/k8s/v1/__init__.py b/scaleway-async/scaleway_async/k8s/v1/__init__.py index fcfdc43bc..979fda0c4 100644 --- a/scaleway-async/scaleway_async/k8s/v1/__init__.py +++ b/scaleway-async/scaleway_async/k8s/v1/__init__.py @@ -18,12 +18,11 @@ from .types import PoolVolumeType from .types import Runtime from .types import MaintenanceWindow -from .types import PoolUpgradePolicy from .types import CreateClusterRequestPoolConfigUpgradePolicy from .types import ClusterAutoUpgrade from .types import ClusterAutoscalerConfig from .types import ClusterOpenIDConnectConfig -from .types import Pool +from .types import PoolUpgradePolicy from .types import ACLRuleRequest from .types import ACLRule from .types import CreateClusterRequestAutoUpgrade @@ -36,6 +35,7 @@ from .types import Version from .types import Cluster from .types import Node +from .types import Pool from .types import NodeMetadataCoreV1Taint from .types import UpdateClusterRequestAutoUpgrade from .types import UpdateClusterRequestAutoscalerConfig @@ -108,12 +108,11 @@ "PoolVolumeType", "Runtime", "MaintenanceWindow", - "PoolUpgradePolicy", "CreateClusterRequestPoolConfigUpgradePolicy", "ClusterAutoUpgrade", "ClusterAutoscalerConfig", "ClusterOpenIDConnectConfig", - "Pool", + "PoolUpgradePolicy", "ACLRuleRequest", "ACLRule", "CreateClusterRequestAutoUpgrade", @@ -126,6 +125,7 @@ "Version", "Cluster", "Node", + "Pool", "NodeMetadataCoreV1Taint", "UpdateClusterRequestAutoUpgrade", "UpdateClusterRequestAutoscalerConfig", diff --git a/scaleway-async/scaleway_async/k8s/v1/api.py b/scaleway-async/scaleway_async/k8s/v1/api.py index dee71a955..7a61eafa9 100644 --- a/scaleway-async/scaleway_async/k8s/v1/api.py +++ b/scaleway-async/scaleway_async/k8s/v1/api.py @@ -73,10 +73,10 @@ POOL_TRANSIENT_STATUSES, ) from .marshalling import ( - unmarshal_Pool, unmarshal_Version, unmarshal_Cluster, unmarshal_Node, + unmarshal_Pool, unmarshal_AddClusterACLRulesResponse, unmarshal_ExternalNode, unmarshal_ExternalNodeAuth, diff --git a/scaleway-async/scaleway_async/k8s/v1/marshalling.py b/scaleway-async/scaleway_async/k8s/v1/marshalling.py index 49a7e7a69..09df9bdbd 100644 --- a/scaleway-async/scaleway_async/k8s/v1/marshalling.py +++ b/scaleway-async/scaleway_async/k8s/v1/marshalling.py @@ -21,8 +21,6 @@ PoolStatus, PoolVolumeType, Runtime, - PoolUpgradePolicy, - Pool, Version, MaintenanceWindow, ClusterAutoUpgrade, @@ -30,6 +28,8 @@ ClusterOpenIDConnectConfig, Cluster, Node, + PoolUpgradePolicy, + Pool, ACLRule, AddClusterACLRulesResponse, ExternalNodeCoreV1Taint, @@ -71,190 +71,6 @@ ) -def unmarshal_PoolUpgradePolicy(data: Any) -> PoolUpgradePolicy: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'PoolUpgradePolicy' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("max_unavailable", None) - if field is not None: - args["max_unavailable"] = field - else: - args["max_unavailable"] = None - - field = data.get("max_surge", None) - if field is not None: - args["max_surge"] = field - else: - args["max_surge"] = None - - return PoolUpgradePolicy(**args) - - -def unmarshal_Pool(data: Any) -> Pool: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Pool' 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("cluster_id", None) - if field is not None: - args["cluster_id"] = field - else: - args["cluster_id"] = None - - field = data.get("name", None) - if field is not None: - args["name"] = field - else: - args["name"] = None - - field = data.get("status", None) - if field is not None: - args["status"] = field - else: - args["status"] = PoolStatus.UNKNOWN - - field = data.get("version", None) - if field is not None: - args["version"] = field - else: - args["version"] = None - - field = data.get("node_type", None) - if field is not None: - args["node_type"] = field - else: - args["node_type"] = None - - field = data.get("autoscaling", None) - if field is not None: - args["autoscaling"] = field - else: - args["autoscaling"] = False - - field = data.get("size", None) - if field is not None: - args["size"] = field - else: - args["size"] = None - - field = data.get("min_size", None) - if field is not None: - args["min_size"] = field - else: - args["min_size"] = 0 - - field = data.get("max_size", None) - if field is not None: - args["max_size"] = field - else: - args["max_size"] = 0 - - 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("container_runtime", None) - if field is not None: - args["container_runtime"] = field - else: - args["container_runtime"] = Runtime.UNKNOWN_RUNTIME - - field = data.get("autohealing", None) - if field is not None: - args["autohealing"] = field - else: - args["autohealing"] = False - - field = data.get("tags", None) - if field is not None: - args["tags"] = field - else: - args["tags"] = [] - - field = data.get("kubelet_args", None) - if field is not None: - args["kubelet_args"] = field - else: - args["kubelet_args"] = {} - - field = data.get("zone", None) - if field is not None: - args["zone"] = field - else: - args["zone"] = None - - field = data.get("root_volume_type", None) - if field is not None: - args["root_volume_type"] = field - else: - args["root_volume_type"] = PoolVolumeType.DEFAULT_VOLUME_TYPE - - field = data.get("public_ip_disabled", None) - if field is not None: - args["public_ip_disabled"] = field - else: - args["public_ip_disabled"] = False - - field = data.get("security_group_id", None) - if field is not None: - args["security_group_id"] = field - else: - args["security_group_id"] = None - - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - - field = data.get("placement_group_id", None) - if field is not None: - args["placement_group_id"] = field - else: - args["placement_group_id"] = None - - field = data.get("upgrade_policy", None) - if field is not None: - args["upgrade_policy"] = unmarshal_PoolUpgradePolicy(field) - else: - args["upgrade_policy"] = None - - field = data.get("root_volume_size", None) - if field is not None: - args["root_volume_size"] = field - else: - args["root_volume_size"] = 0 - - field = data.get("new_images_enabled", None) - if field is not None: - args["new_images_enabled"] = field - else: - args["new_images_enabled"] = False - - return Pool(**args) - - def unmarshal_Version(data: Any) -> Version: if not isinstance(data, dict): raise TypeError( @@ -792,6 +608,190 @@ def unmarshal_Node(data: Any) -> Node: return Node(**args) +def unmarshal_PoolUpgradePolicy(data: Any) -> PoolUpgradePolicy: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PoolUpgradePolicy' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("max_unavailable", None) + if field is not None: + args["max_unavailable"] = field + else: + args["max_unavailable"] = None + + field = data.get("max_surge", None) + if field is not None: + args["max_surge"] = field + else: + args["max_surge"] = None + + return PoolUpgradePolicy(**args) + + +def unmarshal_Pool(data: Any) -> Pool: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Pool' 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("cluster_id", None) + if field is not None: + args["cluster_id"] = field + else: + args["cluster_id"] = None + + field = data.get("name", None) + if field is not None: + args["name"] = field + else: + args["name"] = None + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = PoolStatus.UNKNOWN + + field = data.get("version", None) + if field is not None: + args["version"] = field + else: + args["version"] = None + + field = data.get("node_type", None) + if field is not None: + args["node_type"] = field + else: + args["node_type"] = None + + field = data.get("autoscaling", None) + if field is not None: + args["autoscaling"] = field + else: + args["autoscaling"] = False + + field = data.get("size", None) + if field is not None: + args["size"] = field + else: + args["size"] = None + + field = data.get("min_size", None) + if field is not None: + args["min_size"] = field + else: + args["min_size"] = 0 + + field = data.get("max_size", None) + if field is not None: + args["max_size"] = field + else: + args["max_size"] = 0 + + 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("container_runtime", None) + if field is not None: + args["container_runtime"] = field + else: + args["container_runtime"] = Runtime.UNKNOWN_RUNTIME + + field = data.get("autohealing", None) + if field is not None: + args["autohealing"] = field + else: + args["autohealing"] = False + + field = data.get("tags", None) + if field is not None: + args["tags"] = field + else: + args["tags"] = [] + + field = data.get("kubelet_args", None) + if field is not None: + args["kubelet_args"] = field + else: + args["kubelet_args"] = {} + + field = data.get("zone", None) + if field is not None: + args["zone"] = field + else: + args["zone"] = None + + field = data.get("root_volume_type", None) + if field is not None: + args["root_volume_type"] = field + else: + args["root_volume_type"] = PoolVolumeType.DEFAULT_VOLUME_TYPE + + field = data.get("public_ip_disabled", None) + if field is not None: + args["public_ip_disabled"] = field + else: + args["public_ip_disabled"] = False + + field = data.get("security_group_id", None) + if field is not None: + args["security_group_id"] = field + else: + args["security_group_id"] = None + + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + + field = data.get("placement_group_id", None) + if field is not None: + args["placement_group_id"] = field + else: + args["placement_group_id"] = None + + field = data.get("upgrade_policy", None) + if field is not None: + args["upgrade_policy"] = unmarshal_PoolUpgradePolicy(field) + else: + args["upgrade_policy"] = None + + field = data.get("root_volume_size", None) + if field is not None: + args["root_volume_size"] = field + else: + args["root_volume_size"] = 0 + + field = data.get("new_images_enabled", None) + if field is not None: + args["new_images_enabled"] = field + else: + args["new_images_enabled"] = False + + return Pool(**args) + + def unmarshal_ACLRule(data: Any) -> ACLRule: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway-async/scaleway_async/k8s/v1/types.py b/scaleway-async/scaleway_async/k8s/v1/types.py index a29e29eba..ffc59092a 100644 --- a/scaleway-async/scaleway_async/k8s/v1/types.py +++ b/scaleway-async/scaleway_async/k8s/v1/types.py @@ -210,12 +210,6 @@ class MaintenanceWindow: """ -@dataclass -class PoolUpgradePolicy: - max_unavailable: int - max_surge: int - - @dataclass class CreateClusterRequestPoolConfigUpgradePolicy: max_unavailable: Optional[int] = 0 @@ -246,7 +240,7 @@ class ClusterAutoUpgrade: class ClusterAutoscalerConfig: scale_down_disabled: bool """ - Disable the cluster autoscaler. + Forbid cluster autoscaler to scale down the cluster, defaults to false. """ scale_down_delay_after_add: str @@ -261,17 +255,17 @@ class ClusterAutoscalerConfig: expander: AutoscalerExpander """ - Type of node group expander to be used in scale up. + Kubernetes autoscaler strategy to fit pods into nodes, see https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders for details. """ ignore_daemonsets_utilization: bool """ - Ignore DaemonSet pods when calculating resource utilization for scaling down. + Ignore DaemonSet pods when calculating resource utilization for scaling down, defaults to false. """ balance_similar_node_groups: bool """ - Detect similar node groups and balance the number of nodes between them. + Detect similar node groups and balance the number of nodes between them, defaults to false. """ expendable_pods_priority_cutoff: int @@ -281,17 +275,17 @@ class ClusterAutoscalerConfig: scale_down_unneeded_time: str """ - How long a node should be unneeded before it is eligible to be scaled down. + How long a node should be unneeded before it is eligible for scale down, defaults to 10 minutes. """ scale_down_utilization_threshold: float """ - Node utilization level, defined as a sum of requested resources divided by capacity, below which a node can be considered for scale down. + Node utilization level, defined as a sum of requested resources divided by allocatable capacity, below which a node can be considered for scale down. """ max_graceful_termination_sec: int """ - Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node. + Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node, defaults to 600 (10 minutes). """ @@ -334,134 +328,9 @@ class ClusterOpenIDConnectConfig: @dataclass -class Pool: - id: str - """ - Pool ID. - """ - - cluster_id: str - """ - Cluster ID of the pool. - """ - - name: str - """ - Pool name. - """ - - status: PoolStatus - """ - Pool status. - """ - - version: str - """ - Pool version. - """ - - node_type: str - """ - Node type is the type of Scaleway Instance wanted for the pool. Nodes with insufficient memory are not eligible (DEV1-S, PLAY2-PICO, STARDUST). 'external' is a special node type used to provision instances from other cloud providers in a Kosmos Cluster. - """ - - autoscaling: bool - """ - Defines whether the autoscaling feature is enabled for the pool. - """ - - size: int - """ - Size (number of nodes) of the pool. - """ - - min_size: int - """ - Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. - """ - - max_size: int - """ - Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. - """ - - container_runtime: Runtime - """ - Customization of the container runtime is available for each pool. - """ - - autohealing: bool - """ - Defines whether the autohealing feature is enabled for the pool. - """ - - tags: list[str] - """ - Tags associated with the pool, see [managing tags](https://www.scaleway.com/en/docs/kubernetes/api-cli/managing-tags). - """ - - kubelet_args: dict[str, str] - """ - Kubelet arguments to be used by this pool. Note that this feature is experimental. - """ - - zone: ScwZone - """ - Zone in which the pool's nodes will be spawned. - """ - - root_volume_type: PoolVolumeType - """ - * `l_ssd` is a local block storage which means your system is stored locally on your node's hypervisor. This type is not available for all node types -* `sbs-5k` is a remote block storage which means your system is stored on a centralized and resilient cluster with 5k IOPS limits -* `sbs-15k` is a faster remote block storage which means your system is stored on a centralized and resilient cluster with 15k IOPS limits -* `b_ssd` is the legacy remote block storage which means your system is stored on a centralized and resilient cluster. Consider using `sbs-5k` or `sbs-15k` instead. - """ - - public_ip_disabled: bool - """ - Defines if the public IP should be removed from Nodes. To use this feature, your Cluster must have an attached Private Network set up with a Public Gateway. - """ - - security_group_id: str - """ - Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone. - """ - - region: ScwRegion - """ - Cluster region of the pool. - """ - - created_at: Optional[datetime] = None - """ - Date on which the pool was created. - """ - - updated_at: Optional[datetime] = None - """ - Date on which the pool was last updated. - """ - - placement_group_id: Optional[str] = None - """ - Placement group ID in which all the nodes of the pool will be created, placement groups are limited to 20 instances. - """ - - upgrade_policy: Optional[PoolUpgradePolicy] = None - """ - Pool upgrade policy. - """ - - root_volume_size: Optional[int] = 0 - """ - System volume disk size. - """ - - new_images_enabled: Optional[bool] = False - """ - Defines whether the pool is migrated to new images. - """ +class PoolUpgradePolicy: + max_unavailable: int + max_surge: int @dataclass @@ -515,12 +384,12 @@ class CreateClusterRequestAutoscalerConfig: expander: AutoscalerExpander """ - Type of node group expander to be used in scale up. + Kubernetes autoscaler strategy to fit pods into nodes, see https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders for details. """ scale_down_disabled: Optional[bool] = False """ - Disable the cluster autoscaler. + Forbid cluster autoscaler to scale down the cluster, defaults to false. """ scale_down_delay_after_add: Optional[str] = None @@ -530,12 +399,12 @@ class CreateClusterRequestAutoscalerConfig: ignore_daemonsets_utilization: Optional[bool] = False """ - Ignore DaemonSet pods when calculating resource utilization for scaling down. + Ignore DaemonSet pods when calculating resource utilization for scaling down, defaults to false. """ balance_similar_node_groups: Optional[bool] = False """ - Detect similar node groups and balance the number of nodes between them. + Detect similar node groups and balance the number of nodes between them, defaults to false. """ expendable_pods_priority_cutoff: Optional[int] = 0 @@ -545,17 +414,17 @@ class CreateClusterRequestAutoscalerConfig: scale_down_unneeded_time: Optional[str] = None """ - How long a node should be unneeded before it is eligible to be scaled down. + How long a node should be unneeded before it is eligible for scale down, defaults to 10 minutes. """ scale_down_utilization_threshold: Optional[float] = 0.0 """ - Node utilization level, defined as a sum of requested resources divided by capacity, below which a node can be considered for scale down. + Node utilization level, defined as a sum of requested resources divided by allocatable capacity, below which a node can be considered for scale down. """ max_graceful_termination_sec: Optional[int] = 0 """ - Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node. + Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node, defaults to 600 (10 minutes). """ @@ -931,7 +800,7 @@ class Cluster: autoscaler_config: Optional[ClusterAutoscalerConfig] = None """ - Autoscaler config for the cluster. + Autoscaler configuration for the cluster, see https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md for details. """ auto_upgrade: Optional[ClusterAutoUpgrade] = None @@ -1033,6 +902,137 @@ class Node: """ +@dataclass +class Pool: + id: str + """ + Pool ID. + """ + + cluster_id: str + """ + Cluster ID of the pool. + """ + + name: str + """ + Pool name. + """ + + status: PoolStatus + """ + Pool status. + """ + + version: str + """ + Pool version. + """ + + node_type: str + """ + Node type is the type of Scaleway Instance wanted for the pool. Nodes with insufficient memory are not eligible (DEV1-S, PLAY2-PICO, STARDUST). 'external' is a special node type used to provision instances from other cloud providers in a Kosmos Cluster. + """ + + autoscaling: bool + """ + Defines whether the autoscaling feature is enabled for the pool. + """ + + size: int + """ + Size (number of nodes) of the pool. + """ + + min_size: int + """ + Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + """ + + max_size: int + """ + Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + """ + + container_runtime: Runtime + """ + Customization of the container runtime is available for each pool. + """ + + autohealing: bool + """ + Defines whether the autohealing feature is enabled for the pool. + """ + + tags: list[str] + """ + Tags associated with the pool, see [managing tags](https://www.scaleway.com/en/docs/kubernetes/api-cli/managing-tags). + """ + + kubelet_args: dict[str, str] + """ + Kubelet arguments to be used by this pool. Note that this feature is experimental. + """ + + zone: ScwZone + """ + Zone in which the pool's nodes will be spawned. + """ + + root_volume_type: PoolVolumeType + """ + * `l_ssd` is a local block storage which means your system is stored locally on your node's hypervisor. This type is not available for all node types +* `sbs-5k` is a remote block storage which means your system is stored on a centralized and resilient cluster with 5k IOPS limits +* `sbs-15k` is a faster remote block storage which means your system is stored on a centralized and resilient cluster with 15k IOPS limits +* `b_ssd` is the legacy remote block storage which means your system is stored on a centralized and resilient cluster. Consider using `sbs-5k` or `sbs-15k` instead. + """ + + public_ip_disabled: bool + """ + Defines if the public IP should be removed from Nodes. To use this feature, your Cluster must have an attached Private Network set up with a Public Gateway. + """ + + security_group_id: str + """ + Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone. + """ + + region: ScwRegion + """ + Cluster region of the pool. + """ + + created_at: Optional[datetime] = None + """ + Date on which the pool was created. + """ + + updated_at: Optional[datetime] = None + """ + Date on which the pool was last updated. + """ + + placement_group_id: Optional[str] = None + """ + Placement group ID in which all the nodes of the pool will be created, placement groups are limited to 20 instances. + """ + + upgrade_policy: Optional[PoolUpgradePolicy] = None + """ + Pool upgrade policy. + """ + + root_volume_size: Optional[int] = 0 + """ + System volume disk size. + """ + + new_images_enabled: Optional[bool] = False + """ + Defines whether the pool is migrated to new images. + """ + + @dataclass class NodeMetadataCoreV1Taint: key: str @@ -1062,12 +1062,12 @@ class UpdateClusterRequestAutoscalerConfig: expander: AutoscalerExpander """ - Type of node group expander to be used in scale up. + Kubernetes autoscaler strategy to fit pods into nodes, see https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders for details. """ scale_down_disabled: Optional[bool] = False """ - Disable the cluster autoscaler. + Forbid cluster autoscaler to scale down the cluster, defaults to false. """ scale_down_delay_after_add: Optional[str] = None @@ -1077,12 +1077,12 @@ class UpdateClusterRequestAutoscalerConfig: ignore_daemonsets_utilization: Optional[bool] = False """ - Ignore DaemonSet pods when calculating resource utilization for scaling down. + Ignore DaemonSet pods when calculating resource utilization for scaling down, defaults to false. """ balance_similar_node_groups: Optional[bool] = False """ - Detect similar node groups and balance the number of nodes between them. + Detect similar node groups and balance the number of nodes between them, defaults to false. """ expendable_pods_priority_cutoff: Optional[int] = 0 @@ -1092,17 +1092,17 @@ class UpdateClusterRequestAutoscalerConfig: scale_down_unneeded_time: Optional[str] = None """ - How long a node should be unneeded before it is eligible to be scaled down. + How long a node should be unneeded before it is eligible for scale down, defaults to 10 minutes. """ scale_down_utilization_threshold: Optional[float] = 0.0 """ - Node utilization level, defined as a sum of requested resources divided by capacity, below which a node can be considered for scale down. + Node utilization level, defined as a sum of requested resources divided by allocatable capacity, below which a node can be considered for scale down. """ max_graceful_termination_sec: Optional[int] = 0 """ - Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node. + Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node, defaults to 600 (10 minutes). """ diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py index 3f6d7aac8..1e1d3d682 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py @@ -21,9 +21,11 @@ from .types import PublicCatalogProductPropertiesGenerativeApis from .types import PublicCatalogProductPropertiesHardware from .types import PublicCatalogProductPropertiesInstance +from .types import PublicCatalogProductPropertiesKeyManager from .types import PublicCatalogProductPropertiesLoadBalancer from .types import PublicCatalogProductPropertiesManagedInference from .types import PublicCatalogProductPropertiesObjectStorage +from .types import PublicCatalogProductPropertiesSecretManager from .types import PublicCatalogProductEnvironmentalImpactEstimation from .types import PublicCatalogProductLocality from .types import PublicCatalogProductPrice @@ -56,9 +58,11 @@ "PublicCatalogProductPropertiesGenerativeApis", "PublicCatalogProductPropertiesHardware", "PublicCatalogProductPropertiesInstance", + "PublicCatalogProductPropertiesKeyManager", "PublicCatalogProductPropertiesLoadBalancer", "PublicCatalogProductPropertiesManagedInference", "PublicCatalogProductPropertiesObjectStorage", + "PublicCatalogProductPropertiesSecretManager", "PublicCatalogProductEnvironmentalImpactEstimation", "PublicCatalogProductLocality", "PublicCatalogProductPrice", diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py index a8644b6f0..0ed2e51b3 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py @@ -25,9 +25,11 @@ PublicCatalogProductPropertiesGenerativeApis, PublicCatalogProductPropertiesHardware, PublicCatalogProductPropertiesInstance, + PublicCatalogProductPropertiesKeyManager, PublicCatalogProductPropertiesLoadBalancer, PublicCatalogProductPropertiesManagedInference, PublicCatalogProductPropertiesObjectStorage, + PublicCatalogProductPropertiesSecretManager, PublicCatalogProductEnvironmentalImpactEstimation, PublicCatalogProductLocality, PublicCatalogProductPrice, @@ -482,6 +484,19 @@ def unmarshal_PublicCatalogProductPropertiesInstance( return PublicCatalogProductPropertiesInstance(**args) +def unmarshal_PublicCatalogProductPropertiesKeyManager( + data: Any, +) -> PublicCatalogProductPropertiesKeyManager: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesKeyManager' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + return PublicCatalogProductPropertiesKeyManager(**args) + + def unmarshal_PublicCatalogProductPropertiesLoadBalancer( data: Any, ) -> PublicCatalogProductPropertiesLoadBalancer: @@ -527,6 +542,19 @@ def unmarshal_PublicCatalogProductPropertiesObjectStorage( return PublicCatalogProductPropertiesObjectStorage(**args) +def unmarshal_PublicCatalogProductPropertiesSecretManager( + data: Any, +) -> PublicCatalogProductPropertiesSecretManager: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesSecretManager' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + return PublicCatalogProductPropertiesSecretManager(**args) + + def unmarshal_PublicCatalogProductEnvironmentalImpactEstimation( data: Any, ) -> PublicCatalogProductEnvironmentalImpactEstimation: @@ -688,6 +716,20 @@ def unmarshal_PublicCatalogProductProperties( else: args["load_balancer"] = None + field = data.get("secret_manager", None) + if field is not None: + args["secret_manager"] = unmarshal_PublicCatalogProductPropertiesSecretManager( + field + ) + else: + args["secret_manager"] = None + + field = data.get("key_manager", None) + if field is not None: + args["key_manager"] = unmarshal_PublicCatalogProductPropertiesKeyManager(field) + else: + args["key_manager"] = None + return PublicCatalogProductProperties(**args) diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py index 11e99e34d..9b1de8d2b 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py @@ -28,6 +28,8 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe MANAGED_INFERENCE = "managed_inference" GENERATIVE_APIS = "generative_apis" LOAD_BALANCER = "load_balancer" + SECRET_MANAGER = "secret_manager" + KEY_MANAGER = "key_manager" def __str__(self) -> str: return str(self.value) @@ -376,6 +378,11 @@ class PublicCatalogProductPropertiesInstance: """ +@dataclass +class PublicCatalogProductPropertiesKeyManager: + pass + + @dataclass class PublicCatalogProductPropertiesLoadBalancer: pass @@ -394,6 +401,11 @@ class PublicCatalogProductPropertiesObjectStorage: pass +@dataclass +class PublicCatalogProductPropertiesSecretManager: + pass + + @dataclass class PublicCatalogProductEnvironmentalImpactEstimation: kg_co2_equivalent: Optional[float] = None @@ -444,6 +456,10 @@ class PublicCatalogProductProperties: load_balancer: Optional[PublicCatalogProductPropertiesLoadBalancer] = None + secret_manager: Optional[PublicCatalogProductPropertiesSecretManager] = None + + key_manager: Optional[PublicCatalogProductPropertiesKeyManager] = None + @dataclass class PublicCatalogProductUnitOfMeasure: diff --git a/scaleway-async/scaleway_async/webhosting/v1/__init__.py b/scaleway-async/scaleway_async/webhosting/v1/__init__.py index 0f38f25e0..ec0d64e0c 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/__init__.py +++ b/scaleway-async/scaleway_async/webhosting/v1/__init__.py @@ -100,6 +100,7 @@ from .types import HostingApiGetHostingRequest from .types import HostingApiGetResourceSummaryRequest from .types import HostingApiListHostingsRequest +from .types import HostingApiMigrateControlPanelRequest from .types import HostingApiRemoveCustomDomainRequest from .types import HostingApiResetHostingPasswordRequest from .types import HostingApiUpdateHostingRequest @@ -242,6 +243,7 @@ "HostingApiGetHostingRequest", "HostingApiGetResourceSummaryRequest", "HostingApiListHostingsRequest", + "HostingApiMigrateControlPanelRequest", "HostingApiRemoveCustomDomainRequest", "HostingApiResetHostingPasswordRequest", "HostingApiUpdateHostingRequest", diff --git a/scaleway-async/scaleway_async/webhosting/v1/api.py b/scaleway-async/scaleway_async/webhosting/v1/api.py index 899e2a8f0..de8d0a547 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/api.py +++ b/scaleway-async/scaleway_async/webhosting/v1/api.py @@ -49,6 +49,7 @@ Hosting, HostingApiAddCustomDomainRequest, HostingApiCreateHostingRequest, + HostingApiMigrateControlPanelRequest, HostingApiRemoveCustomDomainRequest, HostingApiUpdateHostingRequest, HostingSummary, @@ -131,6 +132,7 @@ marshal_FtpAccountApiCreateFtpAccountRequest, marshal_HostingApiAddCustomDomainRequest, marshal_HostingApiCreateHostingRequest, + marshal_HostingApiMigrateControlPanelRequest, marshal_HostingApiRemoveCustomDomainRequest, marshal_HostingApiUpdateHostingRequest, marshal_MailAccountApiChangeMailAccountPasswordRequest, @@ -2032,6 +2034,54 @@ async def remove_custom_domain( self._throw_on_error(res) return unmarshal_HostingSummary(res.json()) + async def migrate_control_panel( + self, + *, + hosting_id: str, + control_panel_name: str, + offer_id: str, + region: Optional[ScwRegion] = None, + ) -> HostingSummary: + """ + Migrate a hosting to a new control panel. + :param hosting_id: Hosting ID to migrate to a new control panel. + :param control_panel_name: Control panel will migrate the hosting to a new server. + :param offer_id: Migration. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`HostingSummary ` + + Usage: + :: + + result = await api.migrate_control_panel( + hosting_id="example", + control_panel_name="example", + offer_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_hosting_id = validate_path_param("hosting_id", hosting_id) + + res = self._request( + "POST", + f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/migrate-control-panel", + body=marshal_HostingApiMigrateControlPanelRequest( + HostingApiMigrateControlPanelRequest( + hosting_id=hosting_id, + control_panel_name=control_panel_name, + offer_id=offer_id, + region=region, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_HostingSummary(res.json()) + class WebhostingV1FreeDomainAPI(API): """ diff --git a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py index 9f41fed49..e7c2b50f3 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py +++ b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py @@ -96,6 +96,7 @@ CreateHostingRequestDomainConfiguration, OfferOptionRequest, HostingApiCreateHostingRequest, + HostingApiMigrateControlPanelRequest, HostingApiRemoveCustomDomainRequest, HostingApiUpdateHostingRequest, MailAccountApiChangeMailAccountPasswordRequest, @@ -2074,6 +2075,21 @@ def marshal_HostingApiCreateHostingRequest( return output +def marshal_HostingApiMigrateControlPanelRequest( + request: HostingApiMigrateControlPanelRequest, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + if request.control_panel_name is not None: + output["control_panel_name"] = request.control_panel_name + + if request.offer_id is not None: + output["offer_id"] = request.offer_id + + return output + + def marshal_HostingApiRemoveCustomDomainRequest( request: HostingApiRemoveCustomDomainRequest, defaults: ProfileDefaults, diff --git a/scaleway-async/scaleway_async/webhosting/v1/types.py b/scaleway-async/scaleway_async/webhosting/v1/types.py index 279320da0..180a53486 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/types.py +++ b/scaleway-async/scaleway_async/webhosting/v1/types.py @@ -1957,6 +1957,29 @@ class HostingApiListHostingsRequest: """ +@dataclass +class HostingApiMigrateControlPanelRequest: + hosting_id: str + """ + Hosting ID to migrate to a new control panel. + """ + + control_panel_name: str + """ + Control panel will migrate the hosting to a new server. + """ + + offer_id: str + """ + Migration. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class HostingApiRemoveCustomDomainRequest: hosting_id: str diff --git a/scaleway/scaleway/domain/v2beta1/__init__.py b/scaleway/scaleway/domain/v2beta1/__init__.py index f8bbd9dbe..1d2c3e78e 100644 --- a/scaleway/scaleway/domain/v2beta1/__init__.py +++ b/scaleway/scaleway/domain/v2beta1/__init__.py @@ -53,6 +53,7 @@ from .types import RecordIdentifier from .types import ContactExtensionEU from .types import ContactExtensionFR +from .types import ContactExtensionIT from .types import ContactExtensionNL from .types import ContactQuestion from .types import TldOffer @@ -167,7 +168,9 @@ from .types import RestoreDNSZoneVersionRequest from .types import RestoreDNSZoneVersionResponse from .types import RetryInboundTransferResponse +from .types import SearchAvailableDomainsConsoleResponse from .types import SearchAvailableDomainsResponse +from .types import UnauthenticatedRegistrarApiSearchAvailableDomainsConsoleRequest from .types import UpdateDNSZoneNameserversRequest from .types import UpdateDNSZoneNameserversResponse from .types import UpdateDNSZoneRecordsRequest @@ -175,6 +178,7 @@ from .types import UpdateDNSZoneRequest from .api import DomainV2Beta1API from .api import DomainV2Beta1RegistrarAPI +from .api import DomainV2Beta1UnauthenticatedRegistrarAPI __all__ = [ "ContactEmailStatus", @@ -230,6 +234,7 @@ "RecordIdentifier", "ContactExtensionEU", "ContactExtensionFR", + "ContactExtensionIT", "ContactExtensionNL", "ContactQuestion", "TldOffer", @@ -344,7 +349,9 @@ "RestoreDNSZoneVersionRequest", "RestoreDNSZoneVersionResponse", "RetryInboundTransferResponse", + "SearchAvailableDomainsConsoleResponse", "SearchAvailableDomainsResponse", + "UnauthenticatedRegistrarApiSearchAvailableDomainsConsoleRequest", "UpdateDNSZoneNameserversRequest", "UpdateDNSZoneNameserversResponse", "UpdateDNSZoneRecordsRequest", @@ -352,4 +359,5 @@ "UpdateDNSZoneRequest", "DomainV2Beta1API", "DomainV2Beta1RegistrarAPI", + "DomainV2Beta1UnauthenticatedRegistrarAPI", ] diff --git a/scaleway/scaleway/domain/v2beta1/api.py b/scaleway/scaleway/domain/v2beta1/api.py index 5ecf1d8c7..69f7f9709 100644 --- a/scaleway/scaleway/domain/v2beta1/api.py +++ b/scaleway/scaleway/domain/v2beta1/api.py @@ -7,7 +7,9 @@ from scaleway_core.api import API from scaleway_core.bridge import ( ScwFile, + ServiceInfo, unmarshal_ScwFile, + unmarshal_ServiceInfo, ) from scaleway_core.utils import ( WaitForOptions, @@ -35,6 +37,7 @@ Contact, ContactExtensionEU, ContactExtensionFR, + ContactExtensionIT, ContactExtensionNL, ContactRoles, CreateDNSZoneRequest, @@ -96,6 +99,7 @@ RestoreDNSZoneVersionResponse, RetryInboundTransferResponse, SSLCertificate, + SearchAvailableDomainsConsoleResponse, SearchAvailableDomainsResponse, Task, Tld, @@ -145,6 +149,7 @@ unmarshal_RegisterExternalDomainResponse, unmarshal_RestoreDNSZoneVersionResponse, unmarshal_RetryInboundTransferResponse, + unmarshal_SearchAvailableDomainsConsoleResponse, unmarshal_SearchAvailableDomainsResponse, unmarshal_UpdateDNSZoneNameserversResponse, unmarshal_UpdateDNSZoneRecordsResponse, @@ -2085,6 +2090,7 @@ def update_contact( whois_opt_in: Optional[bool] = None, state: Optional[str] = None, extension_nl: Optional[ContactExtensionNL] = None, + extension_it: Optional[ContactExtensionIT] = None, ) -> Contact: """ Update contact. @@ -2109,6 +2115,7 @@ def update_contact( :param whois_opt_in: :param state: :param extension_nl: + :param extension_it: :return: :class:`Contact ` Usage: @@ -2146,6 +2153,7 @@ def update_contact( whois_opt_in=whois_opt_in, state=state, extension_nl=extension_nl, + extension_it=extension_it, ), self.client, ), @@ -2975,3 +2983,65 @@ def delete_domain_host( self._throw_on_error(res) return unmarshal_Host(res.json()) + + +class DomainV2Beta1UnauthenticatedRegistrarAPI(API): + """ + Unauthenticated Domain search API. + """ + + def get_service_info( + self, + ) -> ServiceInfo: + """ + + :return: :class:`ServiceInfo ` + + Usage: + :: + + result = api.get_service_info() + """ + + res = self._request( + "GET", + "/domain/v2beta1/search", + ) + + self._throw_on_error(res) + return unmarshal_ServiceInfo(res.json()) + + def search_available_domains_console( + self, + *, + domain: str, + strict_search: bool, + tlds: Optional[list[str]] = None, + ) -> SearchAvailableDomainsConsoleResponse: + """ + :param domain: + :param strict_search: + :param tlds: + :return: :class:`SearchAvailableDomainsConsoleResponse ` + + Usage: + :: + + result = api.search_available_domains_console( + domain="example", + strict_search=False, + ) + """ + + res = self._request( + "GET", + "/domain/v2beta1/search-domains-console", + params={ + "domain": domain, + "strict_search": strict_search, + "tlds": tlds, + }, + ) + + self._throw_on_error(res) + return unmarshal_SearchAvailableDomainsConsoleResponse(res.json()) diff --git a/scaleway/scaleway/domain/v2beta1/marshalling.py b/scaleway/scaleway/domain/v2beta1/marshalling.py index 37441a25d..a6f13566c 100644 --- a/scaleway/scaleway/domain/v2beta1/marshalling.py +++ b/scaleway/scaleway/domain/v2beta1/marshalling.py @@ -26,6 +26,7 @@ ContactExtensionFRTrademarkInfo, ContactExtensionEU, ContactExtensionFR, + ContactExtensionIT, ContactExtensionNL, ContactQuestion, Contact, @@ -93,6 +94,7 @@ RestoreDNSZoneVersionResponse, RetryInboundTransferResponse, AvailableDomain, + SearchAvailableDomainsConsoleResponse, SearchAvailableDomainsResponse, UpdateDNSZoneNameserversResponse, UpdateDNSZoneRecordsResponse, @@ -300,6 +302,29 @@ def unmarshal_ContactExtensionFR(data: Any) -> ContactExtensionFR: return ContactExtensionFR(**args) +def unmarshal_ContactExtensionIT(data: Any) -> ContactExtensionIT: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ContactExtensionIT' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("european_citizenship", None) + if field is not None: + args["european_citizenship"] = field + else: + args["european_citizenship"] = None + + field = data.get("tax_code", None) + if field is not None: + args["tax_code"] = field + else: + args["tax_code"] = None + + return ContactExtensionIT(**args) + + def unmarshal_ContactExtensionNL(data: Any) -> ContactExtensionNL: if not isinstance(data, dict): raise TypeError( @@ -512,6 +537,12 @@ def unmarshal_Contact(data: Any) -> Contact: else: args["extension_nl"] = None + field = data.get("extension_it", None) + if field is not None: + args["extension_it"] = unmarshal_ContactExtensionIT(field) + else: + args["extension_it"] = None + return Contact(**args) @@ -2581,6 +2612,33 @@ def unmarshal_AvailableDomain(data: Any) -> AvailableDomain: return AvailableDomain(**args) +def unmarshal_SearchAvailableDomainsConsoleResponse( + data: Any, +) -> SearchAvailableDomainsConsoleResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'SearchAvailableDomainsConsoleResponse' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("available_domains", None) + if field is not None: + args["available_domains"] = ( + [unmarshal_AvailableDomain(v) for v in field] if field is not None else None + ) + else: + args["available_domains"] = None + + field = data.get("exact_match_domain", None) + if field is not None: + args["exact_match_domain"] = unmarshal_AvailableDomain(field) + else: + args["exact_match_domain"] = None + + return SearchAvailableDomainsConsoleResponse(**args) + + def unmarshal_SearchAvailableDomainsResponse( data: Any, ) -> SearchAvailableDomainsResponse: @@ -2946,6 +3004,21 @@ def marshal_ContactExtensionFR( return output +def marshal_ContactExtensionIT( + request: ContactExtensionIT, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + 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 + + return output + + def marshal_ContactExtensionNL( request: ContactExtensionNL, defaults: ProfileDefaults, @@ -2996,12 +3069,6 @@ def marshal_NewContact( if request.email is not None: output["email"] = request.email - if request.company_name is not None: - output["company_name"] = request.company_name - - if request.email_alt is not None: - output["email_alt"] = request.email_alt - if request.phone_number is not None: output["phone_number"] = request.phone_number @@ -3014,8 +3081,11 @@ def marshal_NewContact( if request.city is not None: output["city"] = request.city - if request.country is not None: - output["country"] = request.country + if request.company_name is not None: + output["company_name"] = request.company_name + + if request.email_alt is not None: + output["email_alt"] = request.email_alt if request.fax_number is not None: output["fax_number"] = request.fax_number @@ -3023,11 +3093,8 @@ def marshal_NewContact( if request.address_line_2 is not None: output["address_line_2"] = request.address_line_2 - if request.vat_identification_code is not None: - output["vat_identification_code"] = request.vat_identification_code - - if request.company_identification_code is not None: - output["company_identification_code"] = request.company_identification_code + if request.country is not None: + output["country"] = request.country if request.lang is not None: output["lang"] = request.lang @@ -3038,6 +3105,12 @@ def marshal_NewContact( if request.whois_opt_in is not None: output["whois_opt_in"] = request.whois_opt_in + if request.vat_identification_code is not None: + output["vat_identification_code"] = request.vat_identification_code + + if request.company_identification_code is not None: + output["company_identification_code"] = request.company_identification_code + if request.questions is not None: output["questions"] = [ marshal_ContactQuestion(item, defaults) for item in request.questions @@ -3061,6 +3134,11 @@ def marshal_NewContact( request.extension_nl, defaults ) + if request.extension_it is not None: + output["extension_it"] = marshal_ContactExtensionIT( + request.extension_it, defaults + ) + return output @@ -3536,6 +3614,11 @@ def marshal_RegistrarApiUpdateContactRequest( request.extension_nl, defaults ) + if request.extension_it is not None: + output["extension_it"] = marshal_ContactExtensionIT( + request.extension_it, defaults + ) + return output diff --git a/scaleway/scaleway/domain/v2beta1/types.py b/scaleway/scaleway/domain/v2beta1/types.py index 75dd1fc09..f071abc39 100644 --- a/scaleway/scaleway/domain/v2beta1/types.py +++ b/scaleway/scaleway/domain/v2beta1/types.py @@ -515,6 +515,12 @@ class ContactExtensionFR: code_auth_afnic_info: Optional[ContactExtensionFRCodeAuthAfnicInfo] = None +@dataclass +class ContactExtensionIT: + european_citizenship: str + tax_code: str + + @dataclass class ContactExtensionNL: legal_form: ContactExtensionNLLegalForm @@ -603,6 +609,7 @@ class Contact: extension_fr: Optional[ContactExtensionFR] = None extension_eu: Optional[ContactExtensionEU] = None extension_nl: Optional[ContactExtensionNL] = None + extension_it: Optional[ContactExtensionIT] = None @dataclass @@ -660,6 +667,7 @@ class NewContact: extension_eu: Optional[ContactExtensionEU] = None state: Optional[str] = None extension_nl: Optional[ContactExtensionNL] = None + extension_it: Optional[ContactExtensionIT] = None @dataclass @@ -1768,6 +1776,7 @@ class RegistrarApiUpdateContactRequest: whois_opt_in: Optional[bool] = None state: Optional[str] = None extension_nl: Optional[ContactExtensionNL] = None + extension_it: Optional[ContactExtensionIT] = None @dataclass @@ -1808,6 +1817,12 @@ class RetryInboundTransferResponse: pass +@dataclass +class SearchAvailableDomainsConsoleResponse: + available_domains: list[AvailableDomain] + exact_match_domain: Optional[AvailableDomain] = None + + @dataclass class SearchAvailableDomainsResponse: available_domains: list[AvailableDomain] @@ -1816,6 +1831,13 @@ class SearchAvailableDomainsResponse: """ +@dataclass +class UnauthenticatedRegistrarApiSearchAvailableDomainsConsoleRequest: + domain: str + strict_search: bool + tlds: Optional[list[str]] = field(default_factory=list) + + @dataclass class UpdateDNSZoneNameserversRequest: dns_zone: str diff --git a/scaleway/scaleway/k8s/v1/__init__.py b/scaleway/scaleway/k8s/v1/__init__.py index fcfdc43bc..979fda0c4 100644 --- a/scaleway/scaleway/k8s/v1/__init__.py +++ b/scaleway/scaleway/k8s/v1/__init__.py @@ -18,12 +18,11 @@ from .types import PoolVolumeType from .types import Runtime from .types import MaintenanceWindow -from .types import PoolUpgradePolicy from .types import CreateClusterRequestPoolConfigUpgradePolicy from .types import ClusterAutoUpgrade from .types import ClusterAutoscalerConfig from .types import ClusterOpenIDConnectConfig -from .types import Pool +from .types import PoolUpgradePolicy from .types import ACLRuleRequest from .types import ACLRule from .types import CreateClusterRequestAutoUpgrade @@ -36,6 +35,7 @@ from .types import Version from .types import Cluster from .types import Node +from .types import Pool from .types import NodeMetadataCoreV1Taint from .types import UpdateClusterRequestAutoUpgrade from .types import UpdateClusterRequestAutoscalerConfig @@ -108,12 +108,11 @@ "PoolVolumeType", "Runtime", "MaintenanceWindow", - "PoolUpgradePolicy", "CreateClusterRequestPoolConfigUpgradePolicy", "ClusterAutoUpgrade", "ClusterAutoscalerConfig", "ClusterOpenIDConnectConfig", - "Pool", + "PoolUpgradePolicy", "ACLRuleRequest", "ACLRule", "CreateClusterRequestAutoUpgrade", @@ -126,6 +125,7 @@ "Version", "Cluster", "Node", + "Pool", "NodeMetadataCoreV1Taint", "UpdateClusterRequestAutoUpgrade", "UpdateClusterRequestAutoscalerConfig", diff --git a/scaleway/scaleway/k8s/v1/api.py b/scaleway/scaleway/k8s/v1/api.py index e65c3bd3f..e99687e5f 100644 --- a/scaleway/scaleway/k8s/v1/api.py +++ b/scaleway/scaleway/k8s/v1/api.py @@ -73,10 +73,10 @@ POOL_TRANSIENT_STATUSES, ) from .marshalling import ( - unmarshal_Pool, unmarshal_Version, unmarshal_Cluster, unmarshal_Node, + unmarshal_Pool, unmarshal_AddClusterACLRulesResponse, unmarshal_ExternalNode, unmarshal_ExternalNodeAuth, diff --git a/scaleway/scaleway/k8s/v1/marshalling.py b/scaleway/scaleway/k8s/v1/marshalling.py index 49a7e7a69..09df9bdbd 100644 --- a/scaleway/scaleway/k8s/v1/marshalling.py +++ b/scaleway/scaleway/k8s/v1/marshalling.py @@ -21,8 +21,6 @@ PoolStatus, PoolVolumeType, Runtime, - PoolUpgradePolicy, - Pool, Version, MaintenanceWindow, ClusterAutoUpgrade, @@ -30,6 +28,8 @@ ClusterOpenIDConnectConfig, Cluster, Node, + PoolUpgradePolicy, + Pool, ACLRule, AddClusterACLRulesResponse, ExternalNodeCoreV1Taint, @@ -71,190 +71,6 @@ ) -def unmarshal_PoolUpgradePolicy(data: Any) -> PoolUpgradePolicy: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'PoolUpgradePolicy' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("max_unavailable", None) - if field is not None: - args["max_unavailable"] = field - else: - args["max_unavailable"] = None - - field = data.get("max_surge", None) - if field is not None: - args["max_surge"] = field - else: - args["max_surge"] = None - - return PoolUpgradePolicy(**args) - - -def unmarshal_Pool(data: Any) -> Pool: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Pool' 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("cluster_id", None) - if field is not None: - args["cluster_id"] = field - else: - args["cluster_id"] = None - - field = data.get("name", None) - if field is not None: - args["name"] = field - else: - args["name"] = None - - field = data.get("status", None) - if field is not None: - args["status"] = field - else: - args["status"] = PoolStatus.UNKNOWN - - field = data.get("version", None) - if field is not None: - args["version"] = field - else: - args["version"] = None - - field = data.get("node_type", None) - if field is not None: - args["node_type"] = field - else: - args["node_type"] = None - - field = data.get("autoscaling", None) - if field is not None: - args["autoscaling"] = field - else: - args["autoscaling"] = False - - field = data.get("size", None) - if field is not None: - args["size"] = field - else: - args["size"] = None - - field = data.get("min_size", None) - if field is not None: - args["min_size"] = field - else: - args["min_size"] = 0 - - field = data.get("max_size", None) - if field is not None: - args["max_size"] = field - else: - args["max_size"] = 0 - - 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("container_runtime", None) - if field is not None: - args["container_runtime"] = field - else: - args["container_runtime"] = Runtime.UNKNOWN_RUNTIME - - field = data.get("autohealing", None) - if field is not None: - args["autohealing"] = field - else: - args["autohealing"] = False - - field = data.get("tags", None) - if field is not None: - args["tags"] = field - else: - args["tags"] = [] - - field = data.get("kubelet_args", None) - if field is not None: - args["kubelet_args"] = field - else: - args["kubelet_args"] = {} - - field = data.get("zone", None) - if field is not None: - args["zone"] = field - else: - args["zone"] = None - - field = data.get("root_volume_type", None) - if field is not None: - args["root_volume_type"] = field - else: - args["root_volume_type"] = PoolVolumeType.DEFAULT_VOLUME_TYPE - - field = data.get("public_ip_disabled", None) - if field is not None: - args["public_ip_disabled"] = field - else: - args["public_ip_disabled"] = False - - field = data.get("security_group_id", None) - if field is not None: - args["security_group_id"] = field - else: - args["security_group_id"] = None - - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - - field = data.get("placement_group_id", None) - if field is not None: - args["placement_group_id"] = field - else: - args["placement_group_id"] = None - - field = data.get("upgrade_policy", None) - if field is not None: - args["upgrade_policy"] = unmarshal_PoolUpgradePolicy(field) - else: - args["upgrade_policy"] = None - - field = data.get("root_volume_size", None) - if field is not None: - args["root_volume_size"] = field - else: - args["root_volume_size"] = 0 - - field = data.get("new_images_enabled", None) - if field is not None: - args["new_images_enabled"] = field - else: - args["new_images_enabled"] = False - - return Pool(**args) - - def unmarshal_Version(data: Any) -> Version: if not isinstance(data, dict): raise TypeError( @@ -792,6 +608,190 @@ def unmarshal_Node(data: Any) -> Node: return Node(**args) +def unmarshal_PoolUpgradePolicy(data: Any) -> PoolUpgradePolicy: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PoolUpgradePolicy' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("max_unavailable", None) + if field is not None: + args["max_unavailable"] = field + else: + args["max_unavailable"] = None + + field = data.get("max_surge", None) + if field is not None: + args["max_surge"] = field + else: + args["max_surge"] = None + + return PoolUpgradePolicy(**args) + + +def unmarshal_Pool(data: Any) -> Pool: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Pool' 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("cluster_id", None) + if field is not None: + args["cluster_id"] = field + else: + args["cluster_id"] = None + + field = data.get("name", None) + if field is not None: + args["name"] = field + else: + args["name"] = None + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = PoolStatus.UNKNOWN + + field = data.get("version", None) + if field is not None: + args["version"] = field + else: + args["version"] = None + + field = data.get("node_type", None) + if field is not None: + args["node_type"] = field + else: + args["node_type"] = None + + field = data.get("autoscaling", None) + if field is not None: + args["autoscaling"] = field + else: + args["autoscaling"] = False + + field = data.get("size", None) + if field is not None: + args["size"] = field + else: + args["size"] = None + + field = data.get("min_size", None) + if field is not None: + args["min_size"] = field + else: + args["min_size"] = 0 + + field = data.get("max_size", None) + if field is not None: + args["max_size"] = field + else: + args["max_size"] = 0 + + 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("container_runtime", None) + if field is not None: + args["container_runtime"] = field + else: + args["container_runtime"] = Runtime.UNKNOWN_RUNTIME + + field = data.get("autohealing", None) + if field is not None: + args["autohealing"] = field + else: + args["autohealing"] = False + + field = data.get("tags", None) + if field is not None: + args["tags"] = field + else: + args["tags"] = [] + + field = data.get("kubelet_args", None) + if field is not None: + args["kubelet_args"] = field + else: + args["kubelet_args"] = {} + + field = data.get("zone", None) + if field is not None: + args["zone"] = field + else: + args["zone"] = None + + field = data.get("root_volume_type", None) + if field is not None: + args["root_volume_type"] = field + else: + args["root_volume_type"] = PoolVolumeType.DEFAULT_VOLUME_TYPE + + field = data.get("public_ip_disabled", None) + if field is not None: + args["public_ip_disabled"] = field + else: + args["public_ip_disabled"] = False + + field = data.get("security_group_id", None) + if field is not None: + args["security_group_id"] = field + else: + args["security_group_id"] = None + + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + + field = data.get("placement_group_id", None) + if field is not None: + args["placement_group_id"] = field + else: + args["placement_group_id"] = None + + field = data.get("upgrade_policy", None) + if field is not None: + args["upgrade_policy"] = unmarshal_PoolUpgradePolicy(field) + else: + args["upgrade_policy"] = None + + field = data.get("root_volume_size", None) + if field is not None: + args["root_volume_size"] = field + else: + args["root_volume_size"] = 0 + + field = data.get("new_images_enabled", None) + if field is not None: + args["new_images_enabled"] = field + else: + args["new_images_enabled"] = False + + return Pool(**args) + + def unmarshal_ACLRule(data: Any) -> ACLRule: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway/scaleway/k8s/v1/types.py b/scaleway/scaleway/k8s/v1/types.py index a29e29eba..ffc59092a 100644 --- a/scaleway/scaleway/k8s/v1/types.py +++ b/scaleway/scaleway/k8s/v1/types.py @@ -210,12 +210,6 @@ class MaintenanceWindow: """ -@dataclass -class PoolUpgradePolicy: - max_unavailable: int - max_surge: int - - @dataclass class CreateClusterRequestPoolConfigUpgradePolicy: max_unavailable: Optional[int] = 0 @@ -246,7 +240,7 @@ class ClusterAutoUpgrade: class ClusterAutoscalerConfig: scale_down_disabled: bool """ - Disable the cluster autoscaler. + Forbid cluster autoscaler to scale down the cluster, defaults to false. """ scale_down_delay_after_add: str @@ -261,17 +255,17 @@ class ClusterAutoscalerConfig: expander: AutoscalerExpander """ - Type of node group expander to be used in scale up. + Kubernetes autoscaler strategy to fit pods into nodes, see https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders for details. """ ignore_daemonsets_utilization: bool """ - Ignore DaemonSet pods when calculating resource utilization for scaling down. + Ignore DaemonSet pods when calculating resource utilization for scaling down, defaults to false. """ balance_similar_node_groups: bool """ - Detect similar node groups and balance the number of nodes between them. + Detect similar node groups and balance the number of nodes between them, defaults to false. """ expendable_pods_priority_cutoff: int @@ -281,17 +275,17 @@ class ClusterAutoscalerConfig: scale_down_unneeded_time: str """ - How long a node should be unneeded before it is eligible to be scaled down. + How long a node should be unneeded before it is eligible for scale down, defaults to 10 minutes. """ scale_down_utilization_threshold: float """ - Node utilization level, defined as a sum of requested resources divided by capacity, below which a node can be considered for scale down. + Node utilization level, defined as a sum of requested resources divided by allocatable capacity, below which a node can be considered for scale down. """ max_graceful_termination_sec: int """ - Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node. + Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node, defaults to 600 (10 minutes). """ @@ -334,134 +328,9 @@ class ClusterOpenIDConnectConfig: @dataclass -class Pool: - id: str - """ - Pool ID. - """ - - cluster_id: str - """ - Cluster ID of the pool. - """ - - name: str - """ - Pool name. - """ - - status: PoolStatus - """ - Pool status. - """ - - version: str - """ - Pool version. - """ - - node_type: str - """ - Node type is the type of Scaleway Instance wanted for the pool. Nodes with insufficient memory are not eligible (DEV1-S, PLAY2-PICO, STARDUST). 'external' is a special node type used to provision instances from other cloud providers in a Kosmos Cluster. - """ - - autoscaling: bool - """ - Defines whether the autoscaling feature is enabled for the pool. - """ - - size: int - """ - Size (number of nodes) of the pool. - """ - - min_size: int - """ - Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. - """ - - max_size: int - """ - Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. - """ - - container_runtime: Runtime - """ - Customization of the container runtime is available for each pool. - """ - - autohealing: bool - """ - Defines whether the autohealing feature is enabled for the pool. - """ - - tags: list[str] - """ - Tags associated with the pool, see [managing tags](https://www.scaleway.com/en/docs/kubernetes/api-cli/managing-tags). - """ - - kubelet_args: dict[str, str] - """ - Kubelet arguments to be used by this pool. Note that this feature is experimental. - """ - - zone: ScwZone - """ - Zone in which the pool's nodes will be spawned. - """ - - root_volume_type: PoolVolumeType - """ - * `l_ssd` is a local block storage which means your system is stored locally on your node's hypervisor. This type is not available for all node types -* `sbs-5k` is a remote block storage which means your system is stored on a centralized and resilient cluster with 5k IOPS limits -* `sbs-15k` is a faster remote block storage which means your system is stored on a centralized and resilient cluster with 15k IOPS limits -* `b_ssd` is the legacy remote block storage which means your system is stored on a centralized and resilient cluster. Consider using `sbs-5k` or `sbs-15k` instead. - """ - - public_ip_disabled: bool - """ - Defines if the public IP should be removed from Nodes. To use this feature, your Cluster must have an attached Private Network set up with a Public Gateway. - """ - - security_group_id: str - """ - Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone. - """ - - region: ScwRegion - """ - Cluster region of the pool. - """ - - created_at: Optional[datetime] = None - """ - Date on which the pool was created. - """ - - updated_at: Optional[datetime] = None - """ - Date on which the pool was last updated. - """ - - placement_group_id: Optional[str] = None - """ - Placement group ID in which all the nodes of the pool will be created, placement groups are limited to 20 instances. - """ - - upgrade_policy: Optional[PoolUpgradePolicy] = None - """ - Pool upgrade policy. - """ - - root_volume_size: Optional[int] = 0 - """ - System volume disk size. - """ - - new_images_enabled: Optional[bool] = False - """ - Defines whether the pool is migrated to new images. - """ +class PoolUpgradePolicy: + max_unavailable: int + max_surge: int @dataclass @@ -515,12 +384,12 @@ class CreateClusterRequestAutoscalerConfig: expander: AutoscalerExpander """ - Type of node group expander to be used in scale up. + Kubernetes autoscaler strategy to fit pods into nodes, see https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders for details. """ scale_down_disabled: Optional[bool] = False """ - Disable the cluster autoscaler. + Forbid cluster autoscaler to scale down the cluster, defaults to false. """ scale_down_delay_after_add: Optional[str] = None @@ -530,12 +399,12 @@ class CreateClusterRequestAutoscalerConfig: ignore_daemonsets_utilization: Optional[bool] = False """ - Ignore DaemonSet pods when calculating resource utilization for scaling down. + Ignore DaemonSet pods when calculating resource utilization for scaling down, defaults to false. """ balance_similar_node_groups: Optional[bool] = False """ - Detect similar node groups and balance the number of nodes between them. + Detect similar node groups and balance the number of nodes between them, defaults to false. """ expendable_pods_priority_cutoff: Optional[int] = 0 @@ -545,17 +414,17 @@ class CreateClusterRequestAutoscalerConfig: scale_down_unneeded_time: Optional[str] = None """ - How long a node should be unneeded before it is eligible to be scaled down. + How long a node should be unneeded before it is eligible for scale down, defaults to 10 minutes. """ scale_down_utilization_threshold: Optional[float] = 0.0 """ - Node utilization level, defined as a sum of requested resources divided by capacity, below which a node can be considered for scale down. + Node utilization level, defined as a sum of requested resources divided by allocatable capacity, below which a node can be considered for scale down. """ max_graceful_termination_sec: Optional[int] = 0 """ - Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node. + Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node, defaults to 600 (10 minutes). """ @@ -931,7 +800,7 @@ class Cluster: autoscaler_config: Optional[ClusterAutoscalerConfig] = None """ - Autoscaler config for the cluster. + Autoscaler configuration for the cluster, see https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md for details. """ auto_upgrade: Optional[ClusterAutoUpgrade] = None @@ -1033,6 +902,137 @@ class Node: """ +@dataclass +class Pool: + id: str + """ + Pool ID. + """ + + cluster_id: str + """ + Cluster ID of the pool. + """ + + name: str + """ + Pool name. + """ + + status: PoolStatus + """ + Pool status. + """ + + version: str + """ + Pool version. + """ + + node_type: str + """ + Node type is the type of Scaleway Instance wanted for the pool. Nodes with insufficient memory are not eligible (DEV1-S, PLAY2-PICO, STARDUST). 'external' is a special node type used to provision instances from other cloud providers in a Kosmos Cluster. + """ + + autoscaling: bool + """ + Defines whether the autoscaling feature is enabled for the pool. + """ + + size: int + """ + Size (number of nodes) of the pool. + """ + + min_size: int + """ + Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + """ + + max_size: int + """ + Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + """ + + container_runtime: Runtime + """ + Customization of the container runtime is available for each pool. + """ + + autohealing: bool + """ + Defines whether the autohealing feature is enabled for the pool. + """ + + tags: list[str] + """ + Tags associated with the pool, see [managing tags](https://www.scaleway.com/en/docs/kubernetes/api-cli/managing-tags). + """ + + kubelet_args: dict[str, str] + """ + Kubelet arguments to be used by this pool. Note that this feature is experimental. + """ + + zone: ScwZone + """ + Zone in which the pool's nodes will be spawned. + """ + + root_volume_type: PoolVolumeType + """ + * `l_ssd` is a local block storage which means your system is stored locally on your node's hypervisor. This type is not available for all node types +* `sbs-5k` is a remote block storage which means your system is stored on a centralized and resilient cluster with 5k IOPS limits +* `sbs-15k` is a faster remote block storage which means your system is stored on a centralized and resilient cluster with 15k IOPS limits +* `b_ssd` is the legacy remote block storage which means your system is stored on a centralized and resilient cluster. Consider using `sbs-5k` or `sbs-15k` instead. + """ + + public_ip_disabled: bool + """ + Defines if the public IP should be removed from Nodes. To use this feature, your Cluster must have an attached Private Network set up with a Public Gateway. + """ + + security_group_id: str + """ + Security group ID in which all the nodes of the pool will be created. If unset, the pool will use default Kapsule security group in current zone. + """ + + region: ScwRegion + """ + Cluster region of the pool. + """ + + created_at: Optional[datetime] = None + """ + Date on which the pool was created. + """ + + updated_at: Optional[datetime] = None + """ + Date on which the pool was last updated. + """ + + placement_group_id: Optional[str] = None + """ + Placement group ID in which all the nodes of the pool will be created, placement groups are limited to 20 instances. + """ + + upgrade_policy: Optional[PoolUpgradePolicy] = None + """ + Pool upgrade policy. + """ + + root_volume_size: Optional[int] = 0 + """ + System volume disk size. + """ + + new_images_enabled: Optional[bool] = False + """ + Defines whether the pool is migrated to new images. + """ + + @dataclass class NodeMetadataCoreV1Taint: key: str @@ -1062,12 +1062,12 @@ class UpdateClusterRequestAutoscalerConfig: expander: AutoscalerExpander """ - Type of node group expander to be used in scale up. + Kubernetes autoscaler strategy to fit pods into nodes, see https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders for details. """ scale_down_disabled: Optional[bool] = False """ - Disable the cluster autoscaler. + Forbid cluster autoscaler to scale down the cluster, defaults to false. """ scale_down_delay_after_add: Optional[str] = None @@ -1077,12 +1077,12 @@ class UpdateClusterRequestAutoscalerConfig: ignore_daemonsets_utilization: Optional[bool] = False """ - Ignore DaemonSet pods when calculating resource utilization for scaling down. + Ignore DaemonSet pods when calculating resource utilization for scaling down, defaults to false. """ balance_similar_node_groups: Optional[bool] = False """ - Detect similar node groups and balance the number of nodes between them. + Detect similar node groups and balance the number of nodes between them, defaults to false. """ expendable_pods_priority_cutoff: Optional[int] = 0 @@ -1092,17 +1092,17 @@ class UpdateClusterRequestAutoscalerConfig: scale_down_unneeded_time: Optional[str] = None """ - How long a node should be unneeded before it is eligible to be scaled down. + How long a node should be unneeded before it is eligible for scale down, defaults to 10 minutes. """ scale_down_utilization_threshold: Optional[float] = 0.0 """ - Node utilization level, defined as a sum of requested resources divided by capacity, below which a node can be considered for scale down. + Node utilization level, defined as a sum of requested resources divided by allocatable capacity, below which a node can be considered for scale down. """ max_graceful_termination_sec: Optional[int] = 0 """ - Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node. + Maximum number of seconds the cluster autoscaler waits for pod termination when trying to scale down a node, defaults to 600 (10 minutes). """ diff --git a/scaleway/scaleway/product_catalog/v2alpha1/__init__.py b/scaleway/scaleway/product_catalog/v2alpha1/__init__.py index 3f6d7aac8..1e1d3d682 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/__init__.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/__init__.py @@ -21,9 +21,11 @@ from .types import PublicCatalogProductPropertiesGenerativeApis from .types import PublicCatalogProductPropertiesHardware from .types import PublicCatalogProductPropertiesInstance +from .types import PublicCatalogProductPropertiesKeyManager from .types import PublicCatalogProductPropertiesLoadBalancer from .types import PublicCatalogProductPropertiesManagedInference from .types import PublicCatalogProductPropertiesObjectStorage +from .types import PublicCatalogProductPropertiesSecretManager from .types import PublicCatalogProductEnvironmentalImpactEstimation from .types import PublicCatalogProductLocality from .types import PublicCatalogProductPrice @@ -56,9 +58,11 @@ "PublicCatalogProductPropertiesGenerativeApis", "PublicCatalogProductPropertiesHardware", "PublicCatalogProductPropertiesInstance", + "PublicCatalogProductPropertiesKeyManager", "PublicCatalogProductPropertiesLoadBalancer", "PublicCatalogProductPropertiesManagedInference", "PublicCatalogProductPropertiesObjectStorage", + "PublicCatalogProductPropertiesSecretManager", "PublicCatalogProductEnvironmentalImpactEstimation", "PublicCatalogProductLocality", "PublicCatalogProductPrice", diff --git a/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py b/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py index a8644b6f0..0ed2e51b3 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py @@ -25,9 +25,11 @@ PublicCatalogProductPropertiesGenerativeApis, PublicCatalogProductPropertiesHardware, PublicCatalogProductPropertiesInstance, + PublicCatalogProductPropertiesKeyManager, PublicCatalogProductPropertiesLoadBalancer, PublicCatalogProductPropertiesManagedInference, PublicCatalogProductPropertiesObjectStorage, + PublicCatalogProductPropertiesSecretManager, PublicCatalogProductEnvironmentalImpactEstimation, PublicCatalogProductLocality, PublicCatalogProductPrice, @@ -482,6 +484,19 @@ def unmarshal_PublicCatalogProductPropertiesInstance( return PublicCatalogProductPropertiesInstance(**args) +def unmarshal_PublicCatalogProductPropertiesKeyManager( + data: Any, +) -> PublicCatalogProductPropertiesKeyManager: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesKeyManager' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + return PublicCatalogProductPropertiesKeyManager(**args) + + def unmarshal_PublicCatalogProductPropertiesLoadBalancer( data: Any, ) -> PublicCatalogProductPropertiesLoadBalancer: @@ -527,6 +542,19 @@ def unmarshal_PublicCatalogProductPropertiesObjectStorage( return PublicCatalogProductPropertiesObjectStorage(**args) +def unmarshal_PublicCatalogProductPropertiesSecretManager( + data: Any, +) -> PublicCatalogProductPropertiesSecretManager: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesSecretManager' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + return PublicCatalogProductPropertiesSecretManager(**args) + + def unmarshal_PublicCatalogProductEnvironmentalImpactEstimation( data: Any, ) -> PublicCatalogProductEnvironmentalImpactEstimation: @@ -688,6 +716,20 @@ def unmarshal_PublicCatalogProductProperties( else: args["load_balancer"] = None + field = data.get("secret_manager", None) + if field is not None: + args["secret_manager"] = unmarshal_PublicCatalogProductPropertiesSecretManager( + field + ) + else: + args["secret_manager"] = None + + field = data.get("key_manager", None) + if field is not None: + args["key_manager"] = unmarshal_PublicCatalogProductPropertiesKeyManager(field) + else: + args["key_manager"] = None + return PublicCatalogProductProperties(**args) diff --git a/scaleway/scaleway/product_catalog/v2alpha1/types.py b/scaleway/scaleway/product_catalog/v2alpha1/types.py index 11e99e34d..9b1de8d2b 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/types.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/types.py @@ -28,6 +28,8 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe MANAGED_INFERENCE = "managed_inference" GENERATIVE_APIS = "generative_apis" LOAD_BALANCER = "load_balancer" + SECRET_MANAGER = "secret_manager" + KEY_MANAGER = "key_manager" def __str__(self) -> str: return str(self.value) @@ -376,6 +378,11 @@ class PublicCatalogProductPropertiesInstance: """ +@dataclass +class PublicCatalogProductPropertiesKeyManager: + pass + + @dataclass class PublicCatalogProductPropertiesLoadBalancer: pass @@ -394,6 +401,11 @@ class PublicCatalogProductPropertiesObjectStorage: pass +@dataclass +class PublicCatalogProductPropertiesSecretManager: + pass + + @dataclass class PublicCatalogProductEnvironmentalImpactEstimation: kg_co2_equivalent: Optional[float] = None @@ -444,6 +456,10 @@ class PublicCatalogProductProperties: load_balancer: Optional[PublicCatalogProductPropertiesLoadBalancer] = None + secret_manager: Optional[PublicCatalogProductPropertiesSecretManager] = None + + key_manager: Optional[PublicCatalogProductPropertiesKeyManager] = None + @dataclass class PublicCatalogProductUnitOfMeasure: diff --git a/scaleway/scaleway/webhosting/v1/__init__.py b/scaleway/scaleway/webhosting/v1/__init__.py index 0f38f25e0..ec0d64e0c 100644 --- a/scaleway/scaleway/webhosting/v1/__init__.py +++ b/scaleway/scaleway/webhosting/v1/__init__.py @@ -100,6 +100,7 @@ from .types import HostingApiGetHostingRequest from .types import HostingApiGetResourceSummaryRequest from .types import HostingApiListHostingsRequest +from .types import HostingApiMigrateControlPanelRequest from .types import HostingApiRemoveCustomDomainRequest from .types import HostingApiResetHostingPasswordRequest from .types import HostingApiUpdateHostingRequest @@ -242,6 +243,7 @@ "HostingApiGetHostingRequest", "HostingApiGetResourceSummaryRequest", "HostingApiListHostingsRequest", + "HostingApiMigrateControlPanelRequest", "HostingApiRemoveCustomDomainRequest", "HostingApiResetHostingPasswordRequest", "HostingApiUpdateHostingRequest", diff --git a/scaleway/scaleway/webhosting/v1/api.py b/scaleway/scaleway/webhosting/v1/api.py index 815e17446..162346688 100644 --- a/scaleway/scaleway/webhosting/v1/api.py +++ b/scaleway/scaleway/webhosting/v1/api.py @@ -49,6 +49,7 @@ Hosting, HostingApiAddCustomDomainRequest, HostingApiCreateHostingRequest, + HostingApiMigrateControlPanelRequest, HostingApiRemoveCustomDomainRequest, HostingApiUpdateHostingRequest, HostingSummary, @@ -131,6 +132,7 @@ marshal_FtpAccountApiCreateFtpAccountRequest, marshal_HostingApiAddCustomDomainRequest, marshal_HostingApiCreateHostingRequest, + marshal_HostingApiMigrateControlPanelRequest, marshal_HostingApiRemoveCustomDomainRequest, marshal_HostingApiUpdateHostingRequest, marshal_MailAccountApiChangeMailAccountPasswordRequest, @@ -2032,6 +2034,54 @@ def remove_custom_domain( self._throw_on_error(res) return unmarshal_HostingSummary(res.json()) + def migrate_control_panel( + self, + *, + hosting_id: str, + control_panel_name: str, + offer_id: str, + region: Optional[ScwRegion] = None, + ) -> HostingSummary: + """ + Migrate a hosting to a new control panel. + :param hosting_id: Hosting ID to migrate to a new control panel. + :param control_panel_name: Control panel will migrate the hosting to a new server. + :param offer_id: Migration. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`HostingSummary ` + + Usage: + :: + + result = api.migrate_control_panel( + hosting_id="example", + control_panel_name="example", + offer_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_hosting_id = validate_path_param("hosting_id", hosting_id) + + res = self._request( + "POST", + f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/migrate-control-panel", + body=marshal_HostingApiMigrateControlPanelRequest( + HostingApiMigrateControlPanelRequest( + hosting_id=hosting_id, + control_panel_name=control_panel_name, + offer_id=offer_id, + region=region, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_HostingSummary(res.json()) + class WebhostingV1FreeDomainAPI(API): """ diff --git a/scaleway/scaleway/webhosting/v1/marshalling.py b/scaleway/scaleway/webhosting/v1/marshalling.py index 9f41fed49..e7c2b50f3 100644 --- a/scaleway/scaleway/webhosting/v1/marshalling.py +++ b/scaleway/scaleway/webhosting/v1/marshalling.py @@ -96,6 +96,7 @@ CreateHostingRequestDomainConfiguration, OfferOptionRequest, HostingApiCreateHostingRequest, + HostingApiMigrateControlPanelRequest, HostingApiRemoveCustomDomainRequest, HostingApiUpdateHostingRequest, MailAccountApiChangeMailAccountPasswordRequest, @@ -2074,6 +2075,21 @@ def marshal_HostingApiCreateHostingRequest( return output +def marshal_HostingApiMigrateControlPanelRequest( + request: HostingApiMigrateControlPanelRequest, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + if request.control_panel_name is not None: + output["control_panel_name"] = request.control_panel_name + + if request.offer_id is not None: + output["offer_id"] = request.offer_id + + return output + + def marshal_HostingApiRemoveCustomDomainRequest( request: HostingApiRemoveCustomDomainRequest, defaults: ProfileDefaults, diff --git a/scaleway/scaleway/webhosting/v1/types.py b/scaleway/scaleway/webhosting/v1/types.py index 279320da0..180a53486 100644 --- a/scaleway/scaleway/webhosting/v1/types.py +++ b/scaleway/scaleway/webhosting/v1/types.py @@ -1957,6 +1957,29 @@ class HostingApiListHostingsRequest: """ +@dataclass +class HostingApiMigrateControlPanelRequest: + hosting_id: str + """ + Hosting ID to migrate to a new control panel. + """ + + control_panel_name: str + """ + Control panel will migrate the hosting to a new server. + """ + + offer_id: str + """ + Migration. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class HostingApiRemoveCustomDomainRequest: hosting_id: str