diff --git a/scaleway-async/scaleway_async/account/v3/marshalling.py b/scaleway-async/scaleway_async/account/v3/marshalling.py index f9262972b..56904ed4b 100644 --- a/scaleway-async/scaleway_async/account/v3/marshalling.py +++ b/scaleway-async/scaleway_async/account/v3/marshalling.py @@ -10,6 +10,8 @@ resolve_one_of, ) from .types import ( + ContractType, + QualificationArchitectureType, Contract, ContractSignature, QualificationAiMachine, @@ -46,18 +48,26 @@ def unmarshal_Contract(data: Any) -> Contract: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ContractType.UNKNOWN_TYPE field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = 0 field = data.get("created_at", None) if field is not None: @@ -85,10 +95,14 @@ def unmarshal_ContractSignature(data: Any) -> ContractSignature: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("created_at", None) if field is not None: @@ -128,6 +142,8 @@ def unmarshal_QualificationAiMachine(data: Any) -> QualificationAiMachine: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationAiMachine(**args) @@ -143,6 +159,8 @@ def unmarshal_QualificationArchiveData(data: Any) -> QualificationArchiveData: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationArchiveData(**args) @@ -158,6 +176,8 @@ def unmarshal_QualificationContainer(data: Any) -> QualificationContainer: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationContainer(**args) @@ -173,6 +193,8 @@ def unmarshal_QualificationDeploySoftware(data: Any) -> QualificationDeploySoftw field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationDeploySoftware(**args) @@ -188,6 +210,8 @@ def unmarshal_QualificationHostApplication(data: Any) -> QualificationHostApplic field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationHostApplication(**args) @@ -203,6 +227,8 @@ def unmarshal_QualificationHostWebsite(data: Any) -> QualificationHostWebsite: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationHostWebsite(**args) @@ -218,6 +244,8 @@ def unmarshal_QualificationOtherUseCase(data: Any) -> QualificationOtherUseCase: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationOtherUseCase(**args) @@ -235,6 +263,8 @@ def unmarshal_QualificationSetScalewayEnvironment( field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationSetScalewayEnvironment(**args) @@ -250,6 +280,8 @@ def unmarshal_QualificationShareData(data: Any) -> QualificationShareData: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationShareData(**args) @@ -265,6 +297,10 @@ def unmarshal_Qualification(data: Any) -> Qualification: field = data.get("architecture_type", None) if field is not None: args["architecture_type"] = field + else: + args["architecture_type"] = ( + QualificationArchitectureType.UNKNOWN_ARCHITECTURE_TYPE + ) field = data.get("host_website", None) if field is not None: @@ -336,18 +372,26 @@ def unmarshal_Project(data: Any) -> Project: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("created_at", None) if field is not None: @@ -383,10 +427,14 @@ def unmarshal_CheckContractSignatureResponse( field = data.get("created", None) if field is not None: args["created"] = field + else: + args["created"] = False field = data.get("validated", None) if field is not None: args["validated"] = field + else: + args["validated"] = False return CheckContractSignatureResponse(**args) @@ -404,6 +452,8 @@ def unmarshal_ListContractSignaturesResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("contract_signatures", None) if field is not None: @@ -412,6 +462,8 @@ def unmarshal_ListContractSignaturesResponse( if field is not None else None ) + else: + args["contract_signatures"] = field(default_factory=list) return ListContractSignaturesResponse(**args) @@ -427,12 +479,16 @@ def unmarshal_ListProjectsResponse(data: Any) -> ListProjectsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("projects", None) if field is not None: args["projects"] = ( [unmarshal_Project(v) for v in field] if field is not None else None ) + else: + args["projects"] = field(default_factory=list) return ListProjectsResponse(**args) @@ -448,6 +504,8 @@ def unmarshal_ProjectQualification(data: Any) -> ProjectQualification: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("qualification", None) if field is not None: @@ -468,12 +526,12 @@ def marshal_ContractApiCheckContractSignatureRequest( output["contract_name"] = request.contract_name if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id if request.contract_type is not None: - output["contract_type"] = str(request.contract_type) + output["contract_type"] = request.contract_type return output @@ -491,12 +549,12 @@ def marshal_ContractApiCreateContractSignatureRequest( output["validated"] = request.validated if request.contract_type is not None: - output["contract_type"] = str(request.contract_type) + output["contract_type"] = request.contract_type if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id return output @@ -514,9 +572,9 @@ def marshal_ProjectApiCreateProjectRequest( output["name"] = request.name if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id return output @@ -528,7 +586,7 @@ def marshal_QualificationAiMachine( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -540,7 +598,7 @@ def marshal_QualificationArchiveData( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -552,7 +610,7 @@ def marshal_QualificationContainer( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -564,7 +622,7 @@ def marshal_QualificationDeploySoftware( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -576,7 +634,7 @@ def marshal_QualificationHostApplication( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -588,7 +646,7 @@ def marshal_QualificationHostWebsite( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -600,7 +658,7 @@ def marshal_QualificationOtherUseCase( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -612,7 +670,7 @@ def marshal_QualificationSetScalewayEnvironment( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -624,7 +682,7 @@ def marshal_QualificationShareData( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -687,7 +745,7 @@ def marshal_Qualification( ) if request.architecture_type is not None: - output["architecture_type"] = str(request.architecture_type) + output["architecture_type"] = request.architecture_type return output diff --git a/scaleway-async/scaleway_async/account/v3/types.py b/scaleway-async/scaleway_async/account/v3/types.py index d8c33dddd..91b87308c 100644 --- a/scaleway-async/scaleway_async/account/v3/types.py +++ b/scaleway-async/scaleway_async/account/v3/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -201,12 +201,12 @@ class Contract: The version of the contract. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ The creation date of the contract. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ The last modification date of the contract. """ @@ -219,23 +219,23 @@ class Qualification: Architecture type of the qualification. """ - host_website: Optional[QualificationHostWebsite] + host_website: Optional[QualificationHostWebsite] = None - host_application: Optional[QualificationHostApplication] + host_application: Optional[QualificationHostApplication] = None - deploy_software: Optional[QualificationDeploySoftware] + deploy_software: Optional[QualificationDeploySoftware] = None - set_scaleway_environment: Optional[QualificationSetScalewayEnvironment] + set_scaleway_environment: Optional[QualificationSetScalewayEnvironment] = None - ai_machine: Optional[QualificationAiMachine] + ai_machine: Optional[QualificationAiMachine] = None - container: Optional[QualificationContainer] + container: Optional[QualificationContainer] = None - archive_data: Optional[QualificationArchiveData] + archive_data: Optional[QualificationArchiveData] = None - share_data: Optional[QualificationShareData] + share_data: Optional[QualificationShareData] = None - other_use_case: Optional[QualificationOtherUseCase] + other_use_case: Optional[QualificationOtherUseCase] = None @dataclass @@ -250,22 +250,22 @@ class ContractSignature: The Organization ID which signed the contract. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ The creation date of the contract signature. """ - signed_at: Optional[datetime] + signed_at: Optional[datetime] = None """ The signing date of the contract signature. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ The expiration date of the contract signature. """ - contract: Optional[Contract] + contract: Optional[Contract] = None """ The contract signed. """ @@ -293,17 +293,17 @@ class Project: Description of the Project. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the Project. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Update date of the Project. """ - qualification: Optional[Qualification] + qualification: Optional[Qualification] = None """ Qualification of the Project. """ @@ -329,12 +329,12 @@ class ContractApiCheckContractSignatureRequest: Filter on contract name. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization to check the contract signature for. """ - contract_type: Optional[ContractType] + contract_type: Optional[ContractType] = ContractType.UNKNOWN_TYPE """ Filter on contract type. """ @@ -352,12 +352,12 @@ class ContractApiCreateContractSignatureRequest: Whether the contract is validated at creation. """ - contract_type: Optional[ContractType] + contract_type: Optional[ContractType] = ContractType.UNKNOWN_TYPE """ The type of the contract. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -370,7 +370,7 @@ class ContractApiDownloadContractSignatureRequest: The contract signature ID. """ - locale: Optional[StdLanguageCode] + locale: Optional[StdLanguageCode] = StdLanguageCode.UNKNOWN_LANGUAGE_CODE """ The locale requested for the content of the contract. """ @@ -378,22 +378,24 @@ class ContractApiDownloadContractSignatureRequest: @dataclass class ContractApiListContractSignaturesRequest: - page: Optional[int] + page: Optional[int] = 0 """ The page number for the returned contracts. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The maximum number of contracts per page. """ - order_by: Optional[ListContractSignaturesRequestOrderBy] + order_by: Optional[ListContractSignaturesRequestOrderBy] = ( + ListContractSignaturesRequestOrderBy.SIGNED_AT_ASC + ) """ How the contracts are ordered in the response. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter on Organization ID. """ @@ -440,12 +442,12 @@ class ProjectApiCreateProjectRequest: Description of the Project. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Project. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID of the Project. """ @@ -453,7 +455,7 @@ class ProjectApiCreateProjectRequest: @dataclass class ProjectApiDeleteProjectRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the Project. """ @@ -461,7 +463,7 @@ class ProjectApiDeleteProjectRequest: @dataclass class ProjectApiGetProjectRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the Project. """ @@ -469,32 +471,34 @@ class ProjectApiGetProjectRequest: @dataclass class ProjectApiListProjectsRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID of the Project. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Project. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned Projects. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Project per page. """ - order_by: Optional[ListProjectsRequestOrderBy] + order_by: Optional[ListProjectsRequestOrderBy] = ( + ListProjectsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the returned Projects. """ - project_ids: Optional[List[str]] + project_ids: Optional[List[str]] = field(default_factory=list) """ Project IDs to filter for. The results will be limited to any Projects with an ID in this array. """ @@ -502,12 +506,12 @@ class ProjectApiListProjectsRequest: @dataclass class ProjectApiSetProjectQualificationRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ - qualification: Optional[Qualification] + qualification: Optional[Qualification] = None """ Use case chosen for the Project. """ @@ -515,17 +519,17 @@ class ProjectApiSetProjectQualificationRequest: @dataclass class ProjectApiUpdateProjectRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the Project. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Project. """ - description: Optional[str] + description: Optional[str] = None """ Description of the Project. """ @@ -538,7 +542,7 @@ class ProjectQualification: Project ID. """ - qualification: Optional[Qualification] + qualification: Optional[Qualification] = None """ Qualification of the Project. """ diff --git a/scaleway-async/scaleway_async/applesilicon/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/applesilicon/v1alpha1/marshalling.py index eb23a6f6d..2be2d6250 100644 --- a/scaleway-async/scaleway_async/applesilicon/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/applesilicon/v1alpha1/marshalling.py @@ -7,6 +7,10 @@ from scaleway_core.profile import ProfileDefaults from .types import ( ConnectivityDiagnosticActionType, + ServerPrivateNetworkServerStatus, + ServerPrivateNetworkStatus, + ServerStatus, + ServerTypeStock, OS, Commitment, Server, @@ -49,38 +53,56 @@ def unmarshal_OS(data: Any) -> OS: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("label", None) if field is not None: args["label"] = field + else: + args["label"] = None field = data.get("image_url", None) if field is not None: args["image_url"] = field + else: + args["image_url"] = None field = data.get("family", None) if field is not None: args["family"] = field + else: + args["family"] = None field = data.get("is_beta", None) if field is not None: args["is_beta"] = field + else: + args["is_beta"] = False field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("xcode_version", None) if field is not None: args["xcode_version"] = field + else: + args["xcode_version"] = None field = data.get("compatible_server_types", None) if field is not None: args["compatible_server_types"] = field + else: + args["compatible_server_types"] = field(default_factory=list) return OS(**args) @@ -96,10 +118,14 @@ def unmarshal_Commitment(data: Any) -> Commitment: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("cancelled", None) if field is not None: args["cancelled"] = field + else: + args["cancelled"] = None return Commitment(**args) @@ -115,46 +141,68 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("vnc_url", None) if field is not None: args["vnc_url"] = field + else: + args["vnc_url"] = None field = data.get("ssh_username", None) if field is not None: args["ssh_username"] = field + else: + args["ssh_username"] = None field = data.get("sudo_password", None) if field is not None: args["sudo_password"] = field + else: + args["sudo_password"] = None field = data.get("vnc_port", None) if field is not None: args["vnc_port"] = field + else: + args["vnc_port"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerStatus.UNKNOWN_STATUS field = data.get("os", None) if field is not None: @@ -185,22 +233,32 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("deletion_scheduled", None) if field is not None: args["deletion_scheduled"] = field + else: + args["deletion_scheduled"] = False field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("delivered", None) if field is not None: args["delivered"] = field + else: + args["delivered"] = False field = data.get("vpc_status", None) if field is not None: args["vpc_status"] = field + else: + args["vpc_status"] = ServerPrivateNetworkStatus.VPC_UNKNOWN_STATUS field = data.get("public_bandwidth_bps", None) if field is not None: args["public_bandwidth_bps"] = field + else: + args["public_bandwidth_bps"] = 0 field = data.get("commitment", None) if field is not None: @@ -222,32 +280,44 @@ def unmarshal_ServerPrivateNetwork(data: Any) -> ServerPrivateNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("server_id", None) if field is not None: args["server_id"] = field + else: + args["server_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerPrivateNetworkServerStatus.UNKNOWN_STATUS field = data.get("ipam_ip_ids", None) if field is not None: args["ipam_ip_ids"] = field + else: + args["ipam_ip_ids"] = field(default_factory=list) field = data.get("vlan", None) if field is not None: args["vlan"] = field else: - args["vlan"] = None + args["vlan"] = 0 field = data.get("created_at", None) if field is not None: @@ -275,14 +345,20 @@ def unmarshal_ServerTypeCPU(data: Any) -> ServerTypeCPU: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("core_count", None) if field is not None: args["core_count"] = field + else: + args["core_count"] = None field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = None return ServerTypeCPU(**args) @@ -298,10 +374,14 @@ def unmarshal_ServerTypeDisk(data: Any) -> ServerTypeDisk: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return ServerTypeDisk(**args) @@ -317,6 +397,8 @@ def unmarshal_ServerTypeGPU(data: Any) -> ServerTypeGPU: field = data.get("count", None) if field is not None: args["count"] = field + else: + args["count"] = None return ServerTypeGPU(**args) @@ -332,10 +414,14 @@ def unmarshal_ServerTypeMemory(data: Any) -> ServerTypeMemory: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return ServerTypeMemory(**args) @@ -351,10 +437,14 @@ def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork: field = data.get("public_bandwidth_bps", None) if field is not None: args["public_bandwidth_bps"] = field + else: + args["public_bandwidth_bps"] = None field = data.get("supported_bandwidth", None) if field is not None: args["supported_bandwidth"] = field + else: + args["supported_bandwidth"] = None return ServerTypeNetwork(**args) @@ -370,10 +460,14 @@ def unmarshal_ServerType(data: Any) -> ServerType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock", None) if field is not None: args["stock"] = field + else: + args["stock"] = ServerTypeStock.UNKNOWN_STOCK field = data.get("cpu", None) if field is not None: @@ -433,6 +527,8 @@ def unmarshal_BatchCreateServersResponse(data: Any) -> BatchCreateServersRespons args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return BatchCreateServersResponse(**args) @@ -450,22 +546,32 @@ def unmarshal_ConnectivityDiagnosticServerHealth( field = data.get("is_server_alive", None) if field is not None: args["is_server_alive"] = field + else: + args["is_server_alive"] = None field = data.get("is_agent_alive", None) if field is not None: args["is_agent_alive"] = field + else: + args["is_agent_alive"] = None field = data.get("is_mdm_alive", None) if field is not None: args["is_mdm_alive"] = field + else: + args["is_mdm_alive"] = None field = data.get("is_ssh_port_up", None) if field is not None: args["is_ssh_port_up"] = field + else: + args["is_ssh_port_up"] = None field = data.get("is_vnc_port_up", None) if field is not None: args["is_vnc_port_up"] = field + else: + args["is_vnc_port_up"] = None field = data.get("last_checkin_date", None) if field is not None: @@ -489,14 +595,20 @@ def unmarshal_ConnectivityDiagnostic(data: Any) -> ConnectivityDiagnostic: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("is_healthy", None) if field is not None: args["is_healthy"] = field + else: + args["is_healthy"] = None field = data.get("supported_actions", None) if field is not None: @@ -505,10 +617,14 @@ def unmarshal_ConnectivityDiagnostic(data: Any) -> ConnectivityDiagnostic: if field is not None else None ) + else: + args["supported_actions"] = None field = data.get("error_message", None) if field is not None: args["error_message"] = field + else: + args["error_message"] = None field = data.get("health_details", None) if field is not None: @@ -530,10 +646,14 @@ def unmarshal_ListOSResponse(data: Any) -> ListOSResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("os", None) if field is not None: args["os"] = [unmarshal_OS(v) for v in field] if field is not None else None + else: + args["os"] = field(default_factory=list) return ListOSResponse(**args) @@ -555,10 +675,14 @@ def unmarshal_ListServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListServerPrivateNetworksResponse(**args) @@ -576,6 +700,8 @@ def unmarshal_ListServerTypesResponse(data: Any) -> ListServerTypesResponse: args["server_types"] = ( [unmarshal_ServerType(v) for v in field] if field is not None else None ) + else: + args["server_types"] = field(default_factory=list) return ListServerTypesResponse(**args) @@ -591,12 +717,16 @@ def unmarshal_ListServersResponse(data: Any) -> ListServersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListServersResponse(**args) @@ -618,6 +748,8 @@ def unmarshal_SetServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None return SetServerPrivateNetworksResponse(**args) @@ -635,6 +767,8 @@ def unmarshal_StartConnectivityDiagnosticResponse( field = data.get("diagnostic_id", None) if field is not None: args["diagnostic_id"] = field + else: + args["diagnostic_id"] = None return StartConnectivityDiagnosticResponse(**args) @@ -667,13 +801,15 @@ def marshal_BatchCreateServersRequest( output["public_bandwidth_bps"] = request.public_bandwidth_bps if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.os_id is not None: output["os_id"] = request.os_id if request.commitment_type is not None: - output["commitment_type"] = str(request.commitment_type) + output["commitment_type"] = request.commitment_type if request.requests is not None: output["requests"] = [ @@ -705,13 +841,15 @@ def marshal_CreateServerRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.os_id is not None: output["os_id"] = request.os_id if request.commitment_type is not None: - output["commitment_type"] = str(request.commitment_type) + output["commitment_type"] = request.commitment_type return output @@ -776,7 +914,7 @@ def marshal_CommitmentTypeValue( output: Dict[str, Any] = {} if request.commitment_type is not None: - output["commitment_type"] = str(request.commitment_type) + output["commitment_type"] = request.commitment_type return output diff --git a/scaleway-async/scaleway_async/applesilicon/v1alpha1/types.py b/scaleway-async/scaleway_async/applesilicon/v1alpha1/types.py index 8831b428f..bd95d4970 100644 --- a/scaleway-async/scaleway_async/applesilicon/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/applesilicon/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -112,7 +112,6 @@ def __str__(self) -> str: @dataclass class Commitment: type_: CommitmentType - cancelled: bool @@ -167,16 +166,13 @@ class OS: @dataclass class ServerTypeCPU: name: str - core_count: int - frequency: int @dataclass class ServerTypeDisk: capacity: int - type_: str @@ -188,14 +184,12 @@ class ServerTypeGPU: @dataclass class ServerTypeMemory: capacity: int - type_: str @dataclass class ServerTypeNetwork: public_bandwidth_bps: int - supported_bandwidth: List[int] @@ -261,52 +255,52 @@ class Server: Current status of the server. """ - os: Optional[OS] + deletion_scheduled: bool """ - Initially installed OS, this does not necessarily reflect the current OS version. + Set to true to mark the server for automatic deletion depending on `deletable_at` date. Set to false to cancel an existing deletion schedule. Leave unset otherwise. """ - created_at: Optional[datetime] + zone: ScwZone """ - Date on which the server was created. + Zone of the server. """ - updated_at: Optional[datetime] + delivered: bool """ - Date on which the server was last updated. + Set to true once the server has completed its provisioning steps and is ready to use. Some OS configurations might require a reinstallation of the server before delivery depending on the available stock. A reinstallation after the initial delivery will not change this flag and can be tracked using the server status. """ - deletable_at: Optional[datetime] + vpc_status: ServerPrivateNetworkStatus """ - Date from which the server can be deleted. + Activation status of optional Private Network feature support for this server. """ - deletion_scheduled: bool + public_bandwidth_bps: int """ - Set to true to mark the server for automatic deletion depending on `deletable_at` date. Set to false to cancel an existing deletion schedule. Leave unset otherwise. + Public bandwidth configured for this server. Expressed in bits per second. """ - zone: ScwZone + os: Optional[OS] = None """ - Zone of the server. + Initially installed OS, this does not necessarily reflect the current OS version. """ - delivered: bool + created_at: Optional[datetime] = None """ - Set to true once the server has completed its provisioning steps and is ready to use. Some OS configurations might require a reinstallation of the server before delivery depending on the available stock. A reinstallation after the initial delivery will not change this flag and can be tracked using the server status. + Date on which the server was created. """ - vpc_status: ServerPrivateNetworkStatus + updated_at: Optional[datetime] = None """ - Activation status of optional Private Network feature support for this server. + Date on which the server was last updated. """ - public_bandwidth_bps: int + deletable_at: Optional[datetime] = None """ - Public bandwidth configured for this server. Expressed in bits per second. + Date from which the server can be deleted. """ - commitment: Optional[Commitment] + commitment: Optional[Commitment] = None """ Commitment scheme applied to this server. """ @@ -315,16 +309,11 @@ class Server: @dataclass class ConnectivityDiagnosticServerHealth: is_server_alive: bool - is_agent_alive: bool - is_mdm_alive: bool - is_ssh_port_up: bool - is_vnc_port_up: bool - - last_checkin_date: Optional[datetime] + last_checkin_date: Optional[datetime] = None @dataclass @@ -359,17 +348,17 @@ class ServerPrivateNetwork: IPAM IP IDs of the server, if it has any. """ - vlan: Optional[int] + vlan: Optional[int] = 0 """ ID of the VLAN associated with the Private Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Private Network creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the Private Network was last modified. """ @@ -387,37 +376,37 @@ class ServerType: Current stock. """ - cpu: Optional[ServerTypeCPU] + cpu: Optional[ServerTypeCPU] = None """ CPU description. """ - disk: Optional[ServerTypeDisk] + disk: Optional[ServerTypeDisk] = None """ Size of the local disk of the server. """ - memory: Optional[ServerTypeMemory] + memory: Optional[ServerTypeMemory] = None """ Size of memory available. """ - minimum_lease_duration: Optional[str] + minimum_lease_duration: Optional[str] = None """ Minimum duration of the lease in seconds (example. 3.4s). """ - gpu: Optional[ServerTypeGPU] + gpu: Optional[ServerTypeGPU] = None """ GPU description. """ - network: Optional[ServerTypeNetwork] + network: Optional[ServerTypeNetwork] = None """ Network description. """ - default_os: Optional[OS] + default_os: Optional[OS] = None """ The default OS for this server type. """ @@ -445,27 +434,29 @@ class BatchCreateServersRequest: Public bandwidth to configure for these servers. This defaults to the minimum bandwidth for the corresponding server type. For compatible server types, the bandwidth can be increased which incurs additional costs. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Create servers in the given project ID. """ - os_id: Optional[str] + os_id: Optional[str] = None """ Create servers & install the given os_id, when no os_id provided the default OS for this server type is chosen. Requesting a non-default OS will induce an extended delivery time. """ - commitment_type: Optional[CommitmentType] + commitment_type: Optional[CommitmentType] = CommitmentType.DURATION_24H """ Activate commitment for these servers. If not specified, there is a 24h commitment due to Apple licensing (commitment_type `duration_24h`). It can be updated with the Update Server request. Available commitment depends on server type. """ - requests: Optional[List[BatchCreateServersRequestBatchInnerCreateServerRequest]] + requests: Optional[List[BatchCreateServersRequestBatchInnerCreateServerRequest]] = ( + field(default_factory=list) + ) """ List of servers to create. """ @@ -482,16 +473,11 @@ class BatchCreateServersResponse: @dataclass class ConnectivityDiagnostic: id: str - status: ConnectivityDiagnosticDiagnosticStatus - is_healthy: bool - supported_actions: List[ConnectivityDiagnosticActionType] - error_message: str - - health_details: Optional[ConnectivityDiagnosticServerHealth] + health_details: Optional[ConnectivityDiagnosticServerHealth] = None @dataclass @@ -511,27 +497,27 @@ class CreateServerRequest: Public bandwidth to configure for this server. This defaults to the minimum bandwidth for this server type. For compatible server types, the bandwidth can be increased which incurs additional costs. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Create a server with this given name. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Create a server in the given project ID. """ - os_id: Optional[str] + os_id: Optional[str] = None """ Create a server & install the given os_id, when no os_id provided the default OS for this server type is chosen. Requesting a non-default OS will induce an extended delivery time. """ - commitment_type: Optional[CommitmentType] + commitment_type: Optional[CommitmentType] = CommitmentType.DURATION_24H """ Activate commitment for this server. If not specified, there is a 24h commitment due to Apple licensing (commitment_type `duration_24h`). It can be updated with the Update Server request. Available commitment depends on server type. """ @@ -544,7 +530,7 @@ class DeleteServerRequest: UUID of the server you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -553,8 +539,7 @@ class DeleteServerRequest: @dataclass class GetConnectivityDiagnosticRequest: diagnostic_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -567,7 +552,7 @@ class GetOSRequest: UUID of the OS you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -580,7 +565,7 @@ class GetServerRequest: UUID of the server you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -593,7 +578,7 @@ class GetServerTypeRequest: Server type identifier. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -601,27 +586,27 @@ class GetServerTypeRequest: @dataclass class ListOSRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Positive integer to choose the page to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - server_type: Optional[str] + server_type: Optional[str] = None """ List of compatible server types. """ - name: Optional[str] + name: Optional[str] = None """ Filter OS by name (note that "11.1" will return "11.1.2" and "11.1" but not "12")). """ @@ -643,13 +628,12 @@ class ListOSResponse: @dataclass class ListServerPrivateNetworksResponse: server_private_networks: List[ServerPrivateNetwork] - total_count: int @dataclass class ListServerTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -665,32 +649,34 @@ class ListServerTypesResponse: @dataclass class ListServersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListServersRequestOrderBy] + order_by: Optional[ListServersRequestOrderBy] = ( + ListServersRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the returned servers. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Only list servers of this project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Only list servers of this Organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Positive integer to choose the page to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ @@ -721,12 +707,12 @@ class PrivateNetworkApiAddServerPrivateNetworkRequest: ID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ipam_ip_ids: Optional[List[str]] + ipam_ip_ids: Optional[List[str]] = field(default_factory=list) """ IPAM IDs of IPs to attach to the server. """ @@ -744,7 +730,7 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: ID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -753,10 +739,8 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: @dataclass class PrivateNetworkApiGetServerPrivateNetworkRequest: server_id: str - private_network_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -764,47 +748,49 @@ class PrivateNetworkApiGetServerPrivateNetworkRequest: @dataclass class PrivateNetworkApiListServerPrivateNetworksRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListServerPrivateNetworksRequestOrderBy] + order_by: Optional[ListServerPrivateNetworksRequestOrderBy] = ( + ListServerPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for the returned Private Networks. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned Private Networks. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Private Networks per page. """ - server_id: Optional[str] + server_id: Optional[str] = None """ Filter Private Networks by server ID. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Filter Private Networks by Private Network ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter Private Networks by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter Private Networks by Project ID. """ - ipam_ip_ids: Optional[List[str]] + ipam_ip_ids: Optional[List[str]] = field(default_factory=list) """ Filter Private Networks by IPAM IP IDs. """ @@ -822,7 +808,7 @@ class PrivateNetworkApiSetServerPrivateNetworksRequest: Object where the keys are the IDs of Private Networks and the values are arrays of IPAM IDs representing the IPs to assign to this Apple silicon server on the Private Network. If the array supplied for a Private Network is empty, the next available IP from the Private Network's CIDR block will automatically be used for attachment. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -835,7 +821,7 @@ class RebootServerRequest: UUID of the server you want to reboot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -848,12 +834,12 @@ class ReinstallServerRequest: UUID of the server you want to reinstall. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - os_id: Optional[str] + os_id: Optional[str] = None """ Reinstall the server with the target OS, when no os_id provided the default OS for the server type is used. """ @@ -867,8 +853,7 @@ class SetServerPrivateNetworksResponse: @dataclass class StartConnectivityDiagnosticRequest: server_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -886,32 +871,32 @@ class UpdateServerRequest: UUID of the server you want to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Updated name for your server. """ - schedule_deletion: Optional[bool] + schedule_deletion: Optional[bool] = False """ Specify whether the server should be flagged for automatic deletion. """ - enable_vpc: Optional[bool] + enable_vpc: Optional[bool] = False """ Activate or deactivate Private Network support for this server. """ - commitment_type: Optional[CommitmentTypeValue] + commitment_type: Optional[CommitmentTypeValue] = None """ Change commitment. Use 'none' to automatically cancel a renewing commitment. """ - public_bandwidth_bps: Optional[int] + public_bandwidth_bps: Optional[int] = 0 """ Public bandwidth to configure for this server. Setting an higher bandwidth incurs additional costs. Supported bandwidth levels depends on server type and can be queried using the `/server-types` endpoint. """ diff --git a/scaleway-async/scaleway_async/audit_trail/v1alpha1/__init__.py b/scaleway-async/scaleway_async/audit_trail/v1alpha1/__init__.py index 6325b9583..baf6c38b5 100644 --- a/scaleway-async/scaleway_async/audit_trail/v1alpha1/__init__.py +++ b/scaleway-async/scaleway_async/audit_trail/v1alpha1/__init__.py @@ -17,6 +17,7 @@ from .types import SecretManagerSecretInfo from .types import SecretManagerSecretVersionInfo from .types import EventPrincipal +from .types import EventSystem from .types import Resource from .types import ProductService from .types import Event @@ -45,6 +46,7 @@ "SecretManagerSecretInfo", "SecretManagerSecretVersionInfo", "EventPrincipal", + "EventSystem", "Resource", "ProductService", "Event", diff --git a/scaleway-async/scaleway_async/audit_trail/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/audit_trail/v1alpha1/marshalling.py index 32ea3154c..90a64449b 100644 --- a/scaleway-async/scaleway_async/audit_trail/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/audit_trail/v1alpha1/marshalling.py @@ -20,6 +20,7 @@ SecretManagerSecretInfo, SecretManagerSecretVersionInfo, EventPrincipal, + EventSystem, Resource, Event, ListEventsResponse, @@ -51,6 +52,8 @@ def unmarshal_AccountProjectInfo(data: Any) -> AccountProjectInfo: field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None return AccountProjectInfo(**args) @@ -66,6 +69,8 @@ def unmarshal_AccountUserInfo(data: Any) -> AccountUserInfo: field = data.get("email", None) if field is not None: args["email"] = field + else: + args["email"] = None field = data.get("phone_number", None) if field is not None: @@ -87,10 +92,14 @@ def unmarshal_AppleSiliconServerInfo(data: Any) -> AppleSiliconServerInfo: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return AppleSiliconServerInfo(**args) @@ -106,10 +115,14 @@ def unmarshal_BaremetalServerInfo(data: Any) -> BaremetalServerInfo: field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = None return BaremetalServerInfo(**args) @@ -125,6 +138,8 @@ def unmarshal_BaremetalSettingInfo(data: Any) -> BaremetalSettingInfo: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return BaremetalSettingInfo(**args) @@ -140,6 +155,8 @@ def unmarshal_InstanceServerInfo(data: Any) -> InstanceServerInfo: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return InstanceServerInfo(**args) @@ -188,10 +205,14 @@ def unmarshal_KubernetesNodeInfo(data: Any) -> KubernetesNodeInfo: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return KubernetesNodeInfo(**args) @@ -207,10 +228,14 @@ def unmarshal_KubernetesPoolInfo(data: Any) -> KubernetesPoolInfo: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return KubernetesPoolInfo(**args) @@ -226,6 +251,8 @@ def unmarshal_SecretManagerSecretInfo(data: Any) -> SecretManagerSecretInfo: field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None field = data.get("key_id", None) if field is not None: @@ -249,6 +276,8 @@ def unmarshal_SecretManagerSecretVersionInfo( field = data.get("revision", None) if field is not None: args["revision"] = field + else: + args["revision"] = None return SecretManagerSecretVersionInfo(**args) @@ -264,10 +293,29 @@ def unmarshal_EventPrincipal(data: Any) -> EventPrincipal: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None return EventPrincipal(**args) +def unmarshal_EventSystem(data: Any) -> EventSystem: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'EventSystem' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("name", None) + if field is not None: + args["name"] = field + else: + args["name"] = None + + return EventSystem(**args) + + def unmarshal_Resource(data: Any) -> Resource: if not isinstance(data, dict): raise TypeError( @@ -279,10 +327,14 @@ def unmarshal_Resource(data: Any) -> Resource: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("created_at", None) if field is not None: @@ -428,22 +480,44 @@ def unmarshal_Event(data: Any) -> Event: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("locality", None) if field is not None: args["locality"] = field + else: + args["locality"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("source_ip", None) if field is not None: args["source_ip"] = field + else: + args["source_ip"] = None field = data.get("product_name", None) if field is not None: args["product_name"] = field + else: + args["product_name"] = None + + field = data.get("service_name", None) + if field is not None: + args["service_name"] = field + else: + args["service_name"] = None + + field = data.get("method_name", None) + if field is not None: + args["method_name"] = field + else: + args["method_name"] = None field = data.get("recorded_at", None) if field is not None: @@ -459,45 +533,49 @@ def unmarshal_Event(data: Any) -> Event: else: args["principal"] = None - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - else: - args["project_id"] = None - - field = data.get("user_agent", None) - if field is not None: - args["user_agent"] = field - else: - args["user_agent"] = None - - field = data.get("service_name", None) - if field is not None: - args["service_name"] = field - - field = data.get("method_name", None) - if field is not None: - args["method_name"] = field - field = data.get("resources", None) if field is not None: args["resources"] = ( [unmarshal_Resource(v) for v in field] if field is not None else None ) + else: + args["resources"] = field(default_factory=list) field = data.get("request_id", None) if field is not None: args["request_id"] = field + else: + args["request_id"] = None field = data.get("status_code", None) if field is not None: args["status_code"] = field + else: + args["status_code"] = 0 + + field = data.get("system", None) + if field is not None: + args["system"] = unmarshal_EventSystem(field) + else: + args["system"] = None + + field = data.get("project_id", None) + if field is not None: + args["project_id"] = field + else: + args["project_id"] = None + + field = data.get("user_agent", None) + if field is not None: + args["user_agent"] = field + else: + args["user_agent"] = None field = data.get("request_body", None) if field is not None: args["request_body"] = field else: - args["request_body"] = None + args["request_body"] = field(default_factory=dict) return Event(**args) @@ -515,6 +593,8 @@ def unmarshal_ListEventsResponse(data: Any) -> ListEventsResponse: args["events"] = ( [unmarshal_Event(v) for v in field] if field is not None else None ) + else: + args["events"] = field(default_factory=list) field = data.get("next_page_token", None) if field is not None: @@ -536,10 +616,14 @@ def unmarshal_ProductService(data: Any) -> ProductService: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("methods", None) if field is not None: args["methods"] = field + else: + args["methods"] = None return ProductService(**args) @@ -555,16 +639,22 @@ def unmarshal_Product(data: Any) -> Product: field = data.get("title", None) if field is not None: args["title"] = field + else: + args["title"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("services", None) if field is not None: args["services"] = ( [unmarshal_ProductService(v) for v in field] if field is not None else None ) + else: + args["services"] = field(default_factory=list) return Product(**args) @@ -582,9 +672,13 @@ def unmarshal_ListProductsResponse(data: Any) -> ListProductsResponse: args["products"] = ( [unmarshal_Product(v) for v in field] if field is not None else None ) + else: + args["products"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListProductsResponse(**args) diff --git a/scaleway-async/scaleway_async/audit_trail/v1alpha1/types.py b/scaleway-async/scaleway_async/audit_trail/v1alpha1/types.py index 16fd831c7..a9dc82b68 100644 --- a/scaleway-async/scaleway_async/audit_trail/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/audit_trail/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Any, Dict, List, Optional @@ -67,21 +67,18 @@ class AccountProjectInfo: @dataclass class AccountUserInfo: email: str - - phone_number: Optional[str] + phone_number: Optional[str] = None @dataclass class AppleSiliconServerInfo: id: str - name: str @dataclass class BaremetalServerInfo: description: str - tags: List[str] @@ -113,22 +110,19 @@ class KubernetesClusterInfo: @dataclass class KubernetesNodeInfo: id: str - name: str @dataclass class KubernetesPoolInfo: id: str - name: str @dataclass class SecretManagerSecretInfo: path: str - - key_id: Optional[str] + key_id: Optional[str] = None @dataclass @@ -141,59 +135,57 @@ class EventPrincipal: id: str +@dataclass +class EventSystem: + name: str + + @dataclass class Resource: id: str - type_: ResourceType + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + deleted_at: Optional[datetime] = None + name: Optional[str] = None + secm_secret_info: Optional[SecretManagerSecretInfo] = None - created_at: Optional[datetime] - - updated_at: Optional[datetime] - - deleted_at: Optional[datetime] + secm_secret_version_info: Optional[SecretManagerSecretVersionInfo] = None - name: Optional[str] + kube_cluster_info: Optional[KubernetesClusterInfo] = None - secm_secret_info: Optional[SecretManagerSecretInfo] + kube_pool_info: Optional[KubernetesPoolInfo] = None - secm_secret_version_info: Optional[SecretManagerSecretVersionInfo] + kube_node_info: Optional[KubernetesNodeInfo] = None - kube_cluster_info: Optional[KubernetesClusterInfo] + kube_acl_info: Optional[KubernetesACLInfo] = None - kube_pool_info: Optional[KubernetesPoolInfo] + keym_key_info: Optional[KeyManagerKeyInfo] = None - kube_node_info: Optional[KubernetesNodeInfo] + secret_manager_secret_info: Optional[SecretManagerSecretInfo] = None - kube_acl_info: Optional[KubernetesACLInfo] + secret_manager_version_info: Optional[SecretManagerSecretVersionInfo] = None - keym_key_info: Optional[KeyManagerKeyInfo] + key_manager_key_info: Optional[KeyManagerKeyInfo] = None - secret_manager_secret_info: Optional[SecretManagerSecretInfo] + account_user_info: Optional[AccountUserInfo] = None - secret_manager_version_info: Optional[SecretManagerSecretVersionInfo] + account_organization_info: Optional[AccountOrganizationInfo] = None - key_manager_key_info: Optional[KeyManagerKeyInfo] + instance_server_info: Optional[InstanceServerInfo] = None - account_user_info: Optional[AccountUserInfo] + apple_silicon_server_info: Optional[AppleSiliconServerInfo] = None - account_organization_info: Optional[AccountOrganizationInfo] + account_project_info: Optional[AccountProjectInfo] = None - instance_server_info: Optional[InstanceServerInfo] + baremetal_server_info: Optional[BaremetalServerInfo] = None - apple_silicon_server_info: Optional[AppleSiliconServerInfo] - - account_project_info: Optional[AccountProjectInfo] - - baremetal_server_info: Optional[BaremetalServerInfo] - - baremetal_setting_info: Optional[BaremetalSettingInfo] + baremetal_setting_info: Optional[BaremetalSettingInfo] = None @dataclass class ProductService: name: str - methods: List[str] @@ -224,26 +216,6 @@ class Event: Product name of the resource attached to the event. """ - recorded_at: Optional[datetime] - """ - Timestamp of the event. - """ - - principal: Optional[EventPrincipal] - """ - User or IAM application at the origin of the event. - """ - - project_id: Optional[str] - """ - (Optional) Project of the resource attached to the event. - """ - - user_agent: Optional[str] - """ - User Agent at the origin of the event. - """ - service_name: str """ API name called to trigger the event. @@ -269,11 +241,30 @@ class Event: HTTP status code resulting of the API call. """ - request_body: Optional[Dict[str, Any]] + recorded_at: Optional[datetime] = None + """ + Timestamp of the event. + """ + + project_id: Optional[str] = None + """ + (Optional) Project of the resource attached to the event. + """ + + user_agent: Optional[str] = None + """ + User Agent at the origin of the event. + """ + + request_body: Optional[Dict[str, Any]] = field(default_factory=dict) """ Request at the origin of the event. """ + principal: Optional[EventPrincipal] = None + + system: Optional[EventSystem] = None + @dataclass class Product: @@ -295,58 +286,57 @@ class Product: @dataclass class ListEventsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ (Optional) ID of the Project containing the Audit Trail events. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization containing the Audit Trail events. """ - resource_type: Optional[ResourceType] + resource_type: Optional[ResourceType] = ResourceType.UNKNOWN_TYPE """ (Optional) Returns a paginated list of Scaleway resources' features. """ - method_name: Optional[str] + method_name: Optional[str] = None """ (Optional) Name of the method of the API call performed. """ - status: Optional[int] + status: Optional[int] = 0 """ (Optional) HTTP status code of the request. Returns either `200` if the request was successful or `403` if the permission was denied. """ - recorded_after: Optional[datetime] + recorded_after: Optional[datetime] = None """ (Optional) The `recorded_after` parameter defines the earliest timestamp from which Audit Trail events are retrieved. Returns `one hour ago` by default. """ - recorded_before: Optional[datetime] + recorded_before: Optional[datetime] = None """ (Optional) The `recorded_before` parameter defines the latest timestamp up to which Audit Trail events are retrieved. Returns `now` by default. """ - order_by: Optional[ListEventsRequestOrderBy] - - page_size: Optional[int] - - page_token: Optional[str] - - product_name: Optional[str] + order_by: Optional[ListEventsRequestOrderBy] = ( + ListEventsRequestOrderBy.RECORDED_AT_DESC + ) + page_size: Optional[int] = 0 + page_token: Optional[str] = None + product_name: Optional[str] = None """ (Optional) Name of the Scaleway resource in a hyphenated format. """ - service_name: Optional[str] + service_name: Optional[str] = None """ (Optional) Name of the service of the API call performed. """ @@ -359,7 +349,7 @@ class ListEventsResponse: Single page of events matching the requested criteria. """ - next_page_token: Optional[str] + next_page_token: Optional[str] = None """ Page token to use in following calls to keep listing. """ @@ -367,12 +357,12 @@ class ListEventsResponse: @dataclass class ListProductsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization containing the Audit Trail events. """ diff --git a/scaleway-async/scaleway_async/autoscaling/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/autoscaling/v1alpha1/marshalling.py index 7db33fe14..e669da533 100644 --- a/scaleway-async/scaleway_async/autoscaling/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/autoscaling/v1alpha1/marshalling.py @@ -10,6 +10,15 @@ resolve_one_of, ) from .types import ( + InstanceGroupEventLevel, + InstanceGroupEventSource, + InstancePolicyAction, + InstancePolicyType, + InstanceTemplateStatus, + MetricAggregate, + MetricManagedMetric, + MetricOperator, + VolumeInstanceTemplateVolumeType, Capacity, Loadbalancer, InstanceGroup, @@ -47,10 +56,14 @@ def unmarshal_Capacity(data: Any) -> Capacity: field = data.get("max_replicas", None) if field is not None: args["max_replicas"] = field + else: + args["max_replicas"] = 0 field = data.get("min_replicas", None) if field is not None: args["min_replicas"] = field + else: + args["min_replicas"] = 0 field = data.get("cooldown_delay", None) if field is not None: @@ -72,14 +85,20 @@ def unmarshal_Loadbalancer(data: Any) -> Loadbalancer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("backend_ids", None) if field is not None: args["backend_ids"] = field + else: + args["backend_ids"] = field(default_factory=list) field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None return Loadbalancer(**args) @@ -95,34 +114,50 @@ def unmarshal_InstanceGroup(data: Any) -> InstanceGroup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("instance_template_id", None) if field is not None: args["instance_template_id"] = field + else: + args["instance_template_id"] = None field = data.get("capacity", None) if field is not None: args["capacity"] = unmarshal_Capacity(field) + else: + args["capacity"] = None field = data.get("loadbalancer", None) if field is not None: args["loadbalancer"] = unmarshal_Loadbalancer(field) + else: + args["loadbalancer"] = None field = data.get("error_messages", None) if field is not None: args["error_messages"] = field + else: + args["error_messages"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -150,28 +185,38 @@ def unmarshal_Metric(data: Any) -> Metric: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("operator", None) if field is not None: args["operator"] = field + else: + args["operator"] = MetricOperator.OPERATOR_UNKNOWN field = data.get("aggregate", None) if field is not None: args["aggregate"] = field + else: + args["aggregate"] = MetricAggregate.AGGREGATE_UNKNOWN field = data.get("sampling_range_min", None) if field is not None: args["sampling_range_min"] = field + else: + args["sampling_range_min"] = 0 field = data.get("threshold", None) if field is not None: args["threshold"] = field + else: + args["threshold"] = 0.0 field = data.get("managed_metric", None) if field is not None: args["managed_metric"] = field else: - args["managed_metric"] = None + args["managed_metric"] = MetricManagedMetric.MANAGED_METRIC_UNKNOWN field = data.get("cockpit_metric_name", None) if field is not None: @@ -193,30 +238,44 @@ def unmarshal_InstancePolicy(data: Any) -> InstancePolicy: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = InstancePolicyAction.UNKNOWN_ACTION field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = InstancePolicyType.UNKNOWN_TYPE field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = 0 field = data.get("priority", None) if field is not None: args["priority"] = field + else: + args["priority"] = 0 field = data.get("instance_group_id", None) if field is not None: args["instance_group_id"] = field + else: + args["instance_group_id"] = None field = data.get("metric", None) if field is not None: @@ -240,6 +299,8 @@ def unmarshal_VolumeInstanceTemplateFromEmpty( field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None return VolumeInstanceTemplateFromEmpty(**args) @@ -257,6 +318,8 @@ def unmarshal_VolumeInstanceTemplateFromSnapshot( field = data.get("snapshot_id", None) if field is not None: args["snapshot_id"] = field + else: + args["snapshot_id"] = None field = data.get("size", None) if field is not None: @@ -278,18 +341,26 @@ def unmarshal_VolumeInstanceTemplate(data: Any) -> VolumeInstanceTemplate: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("boot", None) if field is not None: args["boot"] = field + else: + args["boot"] = False field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = VolumeInstanceTemplateVolumeType.UNKNOWN_VOLUME_TYPE field = data.get("perf_iops", None) if field is not None: @@ -323,10 +394,14 @@ def unmarshal_InstanceTemplate(data: Any) -> InstanceTemplate: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("commercial_type", None) if field is not None: args["commercial_type"] = field + else: + args["commercial_type"] = None field = data.get("volumes", None) if field is not None: @@ -338,22 +413,32 @@ def unmarshal_InstanceTemplate(data: Any) -> InstanceTemplate: if field is not None else None ) + else: + args["volumes"] = field(default_factory=dict) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("private_network_ids", None) if field is not None: args["private_network_ids"] = field + else: + args["private_network_ids"] = field(default_factory=list) field = data.get("image_id", None) if field is not None: @@ -377,17 +462,19 @@ def unmarshal_InstanceTemplate(data: Any) -> InstanceTemplate: if field is not None: args["public_ips_v4_count"] = field else: - args["public_ips_v4_count"] = None + args["public_ips_v4_count"] = 0 field = data.get("public_ips_v6_count", None) if field is not None: args["public_ips_v6_count"] = field else: - args["public_ips_v6_count"] = None + args["public_ips_v6_count"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceTemplateStatus.UNKNOWN_STATUS field = data.get("cloud_init", None) if field is not None: @@ -421,18 +508,26 @@ def unmarshal_InstanceGroupEvent(data: Any) -> InstanceGroupEvent: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("source", None) if field is not None: args["source"] = field + else: + args["source"] = InstanceGroupEventSource.UNKNOWN_SOURCE field = data.get("level", None) if field is not None: args["level"] = field + else: + args["level"] = InstanceGroupEventLevel.INFO field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("created_at", None) if field is not None: @@ -466,10 +561,14 @@ def unmarshal_ListInstanceGroupEventsResponse( if field is not None else None ) + else: + args["instance_events"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstanceGroupEventsResponse(**args) @@ -487,10 +586,14 @@ def unmarshal_ListInstanceGroupsResponse(data: Any) -> ListInstanceGroupsRespons args["instance_groups"] = ( [unmarshal_InstanceGroup(v) for v in field] if field is not None else None ) + else: + args["instance_groups"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstanceGroupsResponse(**args) @@ -508,10 +611,14 @@ def unmarshal_ListInstancePoliciesResponse(data: Any) -> ListInstancePoliciesRes args["policies"] = ( [unmarshal_InstancePolicy(v) for v in field] if field is not None else None ) + else: + args["policies"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstancePoliciesResponse(**args) @@ -527,6 +634,8 @@ def unmarshal_ListInstanceTemplatesResponse(data: Any) -> ListInstanceTemplatesR field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("instance_templates", None) if field is not None: @@ -535,6 +644,8 @@ def unmarshal_ListInstanceTemplatesResponse(data: Any) -> ListInstanceTemplatesR if field is not None else None ) + else: + args["instance_templates"] = field(default_factory=list) return ListInstanceTemplatesResponse(**args) @@ -594,7 +705,9 @@ def marshal_CreateInstanceGroupRequest( output["loadbalancer"] = marshal_Loadbalancer(request.loadbalancer, defaults) if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -628,10 +741,10 @@ def marshal_Metric( output["name"] = request.name if request.operator is not None: - output["operator"] = str(request.operator) + output["operator"] = request.operator if request.aggregate is not None: - output["aggregate"] = str(request.aggregate) + output["aggregate"] = request.aggregate if request.sampling_range_min is not None: output["sampling_range_min"] = request.sampling_range_min @@ -661,10 +774,10 @@ def marshal_CreateInstancePolicyRequest( output["name"] = request.name if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.value is not None: output["value"] = request.value @@ -746,7 +859,7 @@ def marshal_VolumeInstanceTemplate( output["boot"] = request.boot if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -788,7 +901,9 @@ def marshal_CreateInstanceTemplateRequest( output["public_ips_v6_count"] = request.public_ips_v6_count if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.private_network_ids is not None: output["private_network_ids"] = request.private_network_ids @@ -877,10 +992,10 @@ def marshal_UpdateInstancePolicyRequestMetric( ) if request.operator is not None: - output["operator"] = str(request.operator) + output["operator"] = request.operator if request.aggregate is not None: - output["aggregate"] = str(request.aggregate) + output["aggregate"] = request.aggregate if request.name is not None: output["name"] = request.name @@ -915,10 +1030,10 @@ def marshal_UpdateInstancePolicyRequest( output["name"] = request.name if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.value is not None: output["value"] = request.value diff --git a/scaleway-async/scaleway_async/autoscaling/v1alpha1/types.py b/scaleway-async/scaleway_async/autoscaling/v1alpha1/types.py index f1ecfd81d..00fb0513a 100644 --- a/scaleway-async/scaleway_async/autoscaling/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/autoscaling/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -180,8 +180,7 @@ class VolumeInstanceTemplateFromEmpty: @dataclass class VolumeInstanceTemplateFromSnapshot: snapshot_id: str - - size: Optional[int] + size: Optional[int] = None @dataclass @@ -196,7 +195,7 @@ class Capacity: Minimum count of Instances for the Instance group. """ - cooldown_delay: Optional[str] + cooldown_delay: Optional[str] = None """ Time (in seconds) after a scaling action during which requests to carry out a new scaling action will be denied. """ @@ -247,9 +246,11 @@ class Metric: Threshold value to measure the aggregated sampled `metric` value against. Combined with the `operator` field, determines whether a scaling action should be triggered. """ - managed_metric: Optional[MetricManagedMetric] + managed_metric: Optional[MetricManagedMetric] = ( + MetricManagedMetric.MANAGED_METRIC_UNKNOWN + ) - cockpit_metric_name: Optional[str] + cockpit_metric_name: Optional[str] = None @dataclass @@ -274,11 +275,11 @@ class VolumeInstanceTemplate: Type of the volume. """ - from_empty: Optional[VolumeInstanceTemplateFromEmpty] + from_empty: Optional[VolumeInstanceTemplateFromEmpty] = None - from_snapshot: Optional[VolumeInstanceTemplateFromSnapshot] + from_snapshot: Optional[VolumeInstanceTemplateFromSnapshot] = None - perf_iops: Optional[int] + perf_iops: Optional[int] = None @dataclass @@ -303,12 +304,12 @@ class InstanceGroupEvent: Log title. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the log. """ - details: Optional[str] + details: Optional[str] = None """ Full text of the log. """ @@ -356,12 +357,12 @@ class InstanceGroup: Any configuration errors for dependencies (Load Balancer, Private Network, Instance template etc.). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Instance group was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the Instance group was last updated. """ @@ -404,7 +405,7 @@ class InstancePolicy: Instance group ID related to this policy. """ - metric: Optional[Metric] + metric: Optional[Metric] = None @dataclass @@ -444,47 +445,47 @@ class InstanceTemplate: Private Network IDs to attach to the new Instance. """ - image_id: Optional[str] + status: InstanceTemplateStatus + """ + Status of Instance template. + """ + + image_id: Optional[str] = None """ Instance image ID. Can be an ID of a marketplace or personal image. This image must be compatible with `volume` and `commercial_type` template. """ - security_group_id: Optional[str] + security_group_id: Optional[str] = None """ Instance security group ID (optional). """ - placement_group_id: Optional[str] + placement_group_id: Optional[str] = None """ Instance placement group ID. This is optional, but it is highly recommended to set a preference for Instance location within Availability Zone. """ - public_ips_v4_count: Optional[int] + public_ips_v4_count: Optional[int] = 0 """ Number of flexible IPv4 addresses to attach to the new Instance. """ - public_ips_v6_count: Optional[int] + public_ips_v6_count: Optional[int] = 0 """ Number of flexible IPv6 addresses to attach to the new Instance. """ - status: InstanceTemplateStatus - """ - Status of Instance template. - """ - - cloud_init: Optional[str] + cloud_init: Optional[str] = None """ Cloud-config file must be passed in Base64 format. Cloud-config files are special scripts designed to be run by the cloud-init process. These are generally used for initial configuration on the very first boot of a server. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Instance template was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the Instance template was last updated. """ @@ -492,17 +493,17 @@ class InstanceTemplate: @dataclass class UpdateInstanceGroupRequestCapacity: - max_replicas: Optional[int] + max_replicas: Optional[int] = 0 """ Maximum count of Instances for the Instance group. """ - min_replicas: Optional[int] + min_replicas: Optional[int] = 0 """ Minimum count of Instances for the Instance group. """ - cooldown_delay: Optional[str] + cooldown_delay: Optional[str] = None """ Time (in seconds) after a scaling action during which requests to carry out a new scaling action will be denied. """ @@ -510,7 +511,7 @@ class UpdateInstanceGroupRequestCapacity: @dataclass class UpdateInstanceGroupRequestLoadbalancer: - backend_ids: Optional[List[str]] + backend_ids: Optional[List[str]] = field(default_factory=list) """ Load Balancer backend IDs. """ @@ -528,24 +529,26 @@ class UpdateInstancePolicyRequestMetric: How the values sampled for the `metric` should be aggregated. """ - name: Optional[str] + name: Optional[str] = None """ Name or description of your metric policy. """ - sampling_range_min: Optional[int] + sampling_range_min: Optional[int] = 0 """ Interval of time, in minutes, during which metric is sampled. """ - threshold: Optional[float] + threshold: Optional[float] = 0.0 """ Threshold value to measure the aggregated sampled `metric` value against. Combined with the `operator` field, determines whether a scaling action should be triggered. """ - managed_metric: Optional[UpdateInstancePolicyRequestMetricManagedMetric] + managed_metric: Optional[UpdateInstancePolicyRequestMetricManagedMetric] = ( + UpdateInstancePolicyRequestMetricManagedMetric.MANAGED_METRIC_UNKNOWN + ) - cockpit_metric_name: Optional[str] + cockpit_metric_name: Optional[str] = None @dataclass @@ -570,17 +573,17 @@ class CreateInstanceGroupRequest: Specification of the Load Balancer to link to the Instance group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Instance groups from this Project will be returned. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Instance group. """ @@ -618,21 +621,16 @@ class CreateInstancePolicyRequest: Instance group ID related to this policy. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - metric: Optional[Metric] + metric: Optional[Metric] = None @dataclass class CreateInstanceTemplateRequest: - zone: Optional[ScwZone] - """ - Zone to target. If none is passed will use default zone from the config. - """ - commercial_type: str """ Name of Instance commercial type. @@ -643,52 +641,57 @@ class CreateInstanceTemplateRequest: Template of Instance volume. """ - image_id: Optional[str] + name: str """ - Instance image ID. Can be an ID of a marketplace or personal image. This image must be compatible with `volume` and `commercial_type` template. + Name of Instance template. """ - tags: Optional[List[str]] + zone: Optional[ScwZone] = None """ - List of tags for the Instance template. + Zone to target. If none is passed will use default zone from the config. """ - security_group_id: Optional[str] + image_id: Optional[str] = None """ - Instance security group ID (optional). + Instance image ID. Can be an ID of a marketplace or personal image. This image must be compatible with `volume` and `commercial_type` template. """ - name: str + tags: Optional[List[str]] = field(default_factory=list) """ - Name of Instance template. + List of tags for the Instance template. """ - placement_group_id: Optional[str] + security_group_id: Optional[str] = None + """ + Instance security group ID (optional). + """ + + placement_group_id: Optional[str] = None """ Instance placement group ID. This is optional, but it is highly recommended to set a preference for Instance location within Availability Zone. """ - public_ips_v4_count: Optional[int] + public_ips_v4_count: Optional[int] = 0 """ Number of flexible IPv4 addresses to attach to the new Instance. """ - public_ips_v6_count: Optional[int] + public_ips_v6_count: Optional[int] = 0 """ Number of flexible IPv6 addresses to attach to the new Instance. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the Instance template resource. """ - private_network_ids: Optional[List[str]] + private_network_ids: Optional[List[str]] = field(default_factory=list) """ Private Network IDs to attach to the new Instance. """ - cloud_init: Optional[str] + cloud_init: Optional[str] = None """ Cloud-config file must be passed in Base64 format. Cloud-config files are special scripts designed to be run by the cloud-init process. These are generally used for initial configuration on the very first boot of a server. """ @@ -701,7 +704,7 @@ class DeleteInstanceGroupRequest: ID of the Instance group to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -714,7 +717,7 @@ class DeleteInstancePolicyRequest: ID of the policy to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -727,7 +730,7 @@ class DeleteInstanceTemplateRequest: ID of the template to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -740,7 +743,7 @@ class GetInstanceGroupRequest: ID of the requested Instance group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -753,7 +756,7 @@ class GetInstancePolicyRequest: Policy ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -766,7 +769,7 @@ class GetInstanceTemplateRequest: Template ID of the resource. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -779,22 +782,24 @@ class ListInstanceGroupEventsRequest: List all event logs for the Instance group ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListInstanceGroupEventsRequestOrderBy] + order_by: Optional[ListInstanceGroupEventsRequestOrderBy] = ( + ListInstanceGroupEventsRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of Instance groups in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Instance groups to return per page. """ @@ -815,22 +820,24 @@ class ListInstanceGroupEventsResponse: @dataclass class ListInstanceGroupsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListInstanceGroupsRequestOrderBy] + order_by: Optional[ListInstanceGroupsRequestOrderBy] = ( + ListInstanceGroupsRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of Instance groups in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Instance groups to return per page. """ @@ -856,22 +863,24 @@ class ListInstancePoliciesRequest: Instance group ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListInstancePoliciesRequestOrderBy] + order_by: Optional[ListInstancePoliciesRequestOrderBy] = ( + ListInstancePoliciesRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of Instance groups in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of scaling policies to return per page. """ @@ -892,22 +901,24 @@ class ListInstancePoliciesResponse: @dataclass class ListInstanceTemplatesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListInstanceTemplatesRequestOrderBy] + order_by: Optional[ListInstanceTemplatesRequestOrderBy] = ( + ListInstanceTemplatesRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of Instance groups in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Instance groups to return per page. """ @@ -933,27 +944,27 @@ class UpdateInstanceGroupRequest: Instance group ID to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of Instance group. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Load Balancer. """ - capacity: Optional[UpdateInstanceGroupRequestCapacity] + capacity: Optional[UpdateInstanceGroupRequestCapacity] = None """ Specification of the minimum and maximum replicas for the Instance group, and the cooldown interval between two scaling events. """ - loadbalancer: Optional[UpdateInstanceGroupRequestLoadbalancer] + loadbalancer: Optional[UpdateInstanceGroupRequestLoadbalancer] = None """ Specification of the Load Balancer to link to the Instance group. """ @@ -966,37 +977,37 @@ class UpdateInstancePolicyRequest: Policy ID to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Policy name to update. """ - action: Optional[InstancePolicyAction] + action: Optional[InstancePolicyAction] = InstancePolicyAction.UNKNOWN_ACTION """ Action to update (action to execute when the metric-based condition is met). """ - type_: Optional[InstancePolicyType] + type_: Optional[InstancePolicyType] = InstancePolicyType.UNKNOWN_TYPE """ Type to update (how to use the number defined in `value` when determining by how many Instances to scale up/down). """ - value: Optional[int] + value: Optional[int] = 0 """ Value to update (number representing the magnitude of the scaling action to take for the Instance group). """ - priority: Optional[int] + priority: Optional[int] = 0 """ Priority to update (priority of this policy compared to all other scaling policies. The lower the number, the higher the priority). """ - metric: Optional[UpdateInstancePolicyRequestMetric] + metric: Optional[UpdateInstancePolicyRequestMetric] = None @dataclass @@ -1006,62 +1017,62 @@ class UpdateInstanceTemplateRequest: Template ID of the resource. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - commercial_type: Optional[str] + commercial_type: Optional[str] = None """ Name of Instance commercial type. """ - image_id: Optional[str] + image_id: Optional[str] = None """ Instance image ID. Can be an ID of a marketplace or personal image. This image must be compatible with `volume` and `commercial_type` template. """ - volumes: Optional[Dict[str, VolumeInstanceTemplate]] + volumes: Optional[Dict[str, VolumeInstanceTemplate]] = field(default_factory=dict) """ Template of Instance volume. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Instance template. """ - security_group_id: Optional[str] + security_group_id: Optional[str] = None """ Instance security group ID (optional). """ - placement_group_id: Optional[str] + placement_group_id: Optional[str] = None """ Instance placement group ID. This is optional, but it is highly recommended to set a preference for Instance location within Availability Zone. """ - public_ips_v4_count: Optional[int] + public_ips_v4_count: Optional[int] = 0 """ Number of flexible IPv4 addresses to attach to the new Instance. """ - public_ips_v6_count: Optional[int] + public_ips_v6_count: Optional[int] = 0 """ Number of flexible IPv6 addresses to attach to the new Instance. """ - name: Optional[str] + name: Optional[str] = None """ Name of Instance template. """ - private_network_ids: Optional[List[str]] + private_network_ids: Optional[List[str]] = field(default_factory=list) """ Private Network IDs to attach to the new Instance. """ - cloud_init: Optional[str] + cloud_init: Optional[str] = None """ Cloud-config file must be passed in Base64 format. Cloud-config files are special scripts designed to be run by the cloud-init process. These are generally used for initial configuration on the very first boot of a server. """ diff --git a/scaleway-async/scaleway_async/baremetal/v1/marshalling.py b/scaleway-async/scaleway_async/baremetal/v1/marshalling.py index 6420591fc..6cb642053 100644 --- a/scaleway-async/scaleway_async/baremetal/v1/marshalling.py +++ b/scaleway-async/scaleway_async/baremetal/v1/marshalling.py @@ -14,6 +14,17 @@ resolve_one_of, ) from .types import ( + IPReverseStatus, + IPVersion, + OfferStock, + OfferSubscriptionPeriod, + ServerBootType, + ServerInstallStatus, + ServerOptionOptionStatus, + ServerPingStatus, + ServerPrivateNetworkStatus, + ServerStatus, + SettingType, SchemaPartition, SchemaPool, SchemaDisk, @@ -82,18 +93,26 @@ def unmarshal_SchemaPartition(data: Any) -> SchemaPartition: field = data.get("label", None) if field is not None: args["label"] = field + else: + args["label"] = None field = data.get("number", None) if field is not None: args["number"] = field + else: + args["number"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None field = data.get("use_all_available_space", None) if field is not None: args["use_all_available_space"] = field + else: + args["use_all_available_space"] = None return SchemaPartition(**args) @@ -109,22 +128,32 @@ def unmarshal_SchemaPool(data: Any) -> SchemaPool: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("devices", None) if field is not None: args["devices"] = field + else: + args["devices"] = None field = data.get("options", None) if field is not None: args["options"] = field + else: + args["options"] = None field = data.get("filesystem_options", None) if field is not None: args["filesystem_options"] = field + else: + args["filesystem_options"] = None return SchemaPool(**args) @@ -140,12 +169,16 @@ def unmarshal_SchemaDisk(data: Any) -> SchemaDisk: field = data.get("device", None) if field is not None: args["device"] = field + else: + args["device"] = None field = data.get("partitions", None) if field is not None: args["partitions"] = ( [unmarshal_SchemaPartition(v) for v in field] if field is not None else None ) + else: + args["partitions"] = None return SchemaDisk(**args) @@ -161,14 +194,20 @@ def unmarshal_SchemaFilesystem(data: Any) -> SchemaFilesystem: field = data.get("device", None) if field is not None: args["device"] = field + else: + args["device"] = None field = data.get("format", None) if field is not None: args["format"] = field + else: + args["format"] = None field = data.get("mountpoint", None) if field is not None: args["mountpoint"] = field + else: + args["mountpoint"] = None return SchemaFilesystem(**args) @@ -184,14 +223,20 @@ def unmarshal_SchemaRAID(data: Any) -> SchemaRAID: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("level", None) if field is not None: args["level"] = field + else: + args["level"] = None field = data.get("devices", None) if field is not None: args["devices"] = field + else: + args["devices"] = None return SchemaRAID(**args) @@ -209,6 +254,8 @@ def unmarshal_SchemaZFS(data: Any) -> SchemaZFS: args["pools"] = ( [unmarshal_SchemaPool(v) for v in field] if field is not None else None ) + else: + args["pools"] = None return SchemaZFS(**args) @@ -226,12 +273,16 @@ def unmarshal_Schema(data: Any) -> Schema: args["disks"] = ( [unmarshal_SchemaDisk(v) for v in field] if field is not None else None ) + else: + args["disks"] = None field = data.get("raids", None) if field is not None: args["raids"] = ( [unmarshal_SchemaRAID(v) for v in field] if field is not None else None ) + else: + args["raids"] = None field = data.get("filesystems", None) if field is not None: @@ -240,6 +291,8 @@ def unmarshal_Schema(data: Any) -> Schema: if field is not None else None ) + else: + args["filesystems"] = None field = data.get("zfs", None) if field is not None: @@ -261,26 +314,38 @@ def unmarshal_IP(data: Any) -> IP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("reverse", None) if field is not None: args["reverse"] = field + else: + args["reverse"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = IPVersion.IPV4 field = data.get("reverse_status", None) if field is not None: args["reverse_status"] = field + else: + args["reverse_status"] = IPReverseStatus.UNKNOWN field = data.get("reverse_status_message", None) if field is not None: args["reverse_status_message"] = field + else: + args["reverse_status_message"] = None return IP(**args) @@ -307,6 +372,8 @@ def unmarshal_LicenseOption(data: Any) -> LicenseOption: field = data.get("os_id", None) if field is not None: args["os_id"] = field + else: + args["os_id"] = None return LicenseOption(**args) @@ -322,6 +389,8 @@ def unmarshal_PrivateNetworkOption(data: Any) -> PrivateNetworkOption: field = data.get("bandwidth_in_bps", None) if field is not None: args["bandwidth_in_bps"] = field + else: + args["bandwidth_in_bps"] = None return PrivateNetworkOption(**args) @@ -337,6 +406,8 @@ def unmarshal_PublicBandwidthOption(data: Any) -> PublicBandwidthOption: field = data.get("bandwidth_in_bps", None) if field is not None: args["bandwidth_in_bps"] = field + else: + args["bandwidth_in_bps"] = None return PublicBandwidthOption(**args) @@ -363,30 +434,44 @@ def unmarshal_ServerInstall(data: Any) -> ServerInstall: field = data.get("os_id", None) if field is not None: args["os_id"] = field + else: + args["os_id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("ssh_key_ids", None) if field is not None: args["ssh_key_ids"] = field + else: + args["ssh_key_ids"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerInstallStatus.UNKNOWN field = data.get("user", None) if field is not None: args["user"] = field + else: + args["user"] = None field = data.get("service_user", None) if field is not None: args["service_user"] = field + else: + args["service_user"] = None field = data.get("service_url", None) if field is not None: args["service_url"] = field + else: + args["service_url"] = None field = data.get("partitioning_schema", None) if field is not None: @@ -408,18 +493,26 @@ def unmarshal_ServerOption(data: Any) -> ServerOption: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["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"] = ServerOptionOptionStatus.OPTION_STATUS_UNKNOWN field = data.get("manageable", None) if field is not None: args["manageable"] = field + else: + args["manageable"] = False field = data.get("expires_at", None) if field is not None: @@ -471,10 +564,14 @@ def unmarshal_ServerRescueServer(data: Any) -> ServerRescueServer: field = data.get("user", None) if field is not None: args["user"] = field + else: + args["user"] = None field = data.get("password", None) if field is not None: args["password"] = field + else: + args["password"] = None return ServerRescueServer(**args) @@ -490,34 +587,50 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerStatus.UNKNOWN field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = None field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = None field = data.get("updated_at", None) if field is not None: @@ -534,36 +647,52 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_IP(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("boot_type", None) if field is not None: args["boot_type"] = field + else: + args["boot_type"] = ServerBootType.UNKNOWN_BOOT_TYPE field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("ping_status", None) if field is not None: args["ping_status"] = field + else: + args["ping_status"] = ServerPingStatus.PING_STATUS_UNKNOWN field = data.get("options", None) if field is not None: args["options"] = ( [unmarshal_ServerOption(v) for v in field] if field is not None else None ) + else: + args["options"] = field(default_factory=list) field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("install", None) if field is not None: @@ -591,10 +720,14 @@ def unmarshal_OSOSField(data: Any) -> OSOSField: field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = None field = data.get("required", None) if field is not None: args["required"] = field + else: + args["required"] = None field = data.get("default_value", None) if field is not None: @@ -616,18 +749,26 @@ def unmarshal_OS(data: Any) -> OS: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("ssh", None) if field is not None: @@ -662,18 +803,26 @@ def unmarshal_OS(data: Any) -> OS: field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("license_required", None) if field is not None: args["license_required"] = field + else: + args["license_required"] = False field = data.get("allowed", None) if field is not None: args["allowed"] = field + else: + args["allowed"] = False field = data.get("custom_partitioning_supported", None) if field is not None: args["custom_partitioning_supported"] = field + else: + args["custom_partitioning_supported"] = False return OS(**args) @@ -689,22 +838,32 @@ def unmarshal_CPU(data: Any) -> CPU: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("core_count", None) if field is not None: args["core_count"] = field + else: + args["core_count"] = 0 field = data.get("thread_count", None) if field is not None: args["thread_count"] = field + else: + args["thread_count"] = 0 field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("benchmark", None) if field is not None: args["benchmark"] = field + else: + args["benchmark"] = None return CPU(**args) @@ -720,10 +879,14 @@ def unmarshal_Disk(data: Any) -> Disk: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return Disk(**args) @@ -739,10 +902,14 @@ def unmarshal_GPU(data: Any) -> GPU: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("vram", None) if field is not None: args["vram"] = field + else: + args["vram"] = 0 return GPU(**args) @@ -758,18 +925,26 @@ def unmarshal_Memory(data: Any) -> Memory: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("is_ecc", None) if field is not None: args["is_ecc"] = field + else: + args["is_ecc"] = False return Memory(**args) @@ -785,22 +960,34 @@ def unmarshal_OfferOptionOffer(data: Any) -> OfferOptionOffer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("subscription_period", None) if field is not None: args["subscription_period"] = field + else: + args["subscription_period"] = ( + OfferSubscriptionPeriod.UNKNOWN_SUBSCRIPTION_PERIOD + ) field = data.get("manageable", None) if field is not None: args["manageable"] = field + else: + args["manageable"] = False field = data.get("price", None) if field is not None: @@ -858,14 +1045,20 @@ def unmarshal_PersistentMemory(data: Any) -> PersistentMemory: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 return PersistentMemory(**args) @@ -881,10 +1074,14 @@ def unmarshal_RaidController(data: Any) -> RaidController: field = data.get("model", None) if field is not None: args["model"] = field + else: + args["model"] = None field = data.get("raid_level", None) if field is not None: args["raid_level"] = field + else: + args["raid_level"] = None return RaidController(**args) @@ -900,46 +1097,66 @@ def unmarshal_Offer(data: Any) -> Offer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock", None) if field is not None: args["stock"] = field + else: + args["stock"] = OfferStock.EMPTY field = data.get("bandwidth", None) if field is not None: args["bandwidth"] = field + else: + args["bandwidth"] = 0 field = data.get("max_bandwidth", None) if field is not None: args["max_bandwidth"] = field + else: + args["max_bandwidth"] = 0 field = data.get("commercial_range", None) if field is not None: args["commercial_range"] = field + else: + args["commercial_range"] = None field = data.get("disks", None) if field is not None: args["disks"] = ( [unmarshal_Disk(v) for v in field] if field is not None else None ) + else: + args["disks"] = field(default_factory=list) field = data.get("enable", None) if field is not None: args["enable"] = field + else: + args["enable"] = False field = data.get("cpus", None) if field is not None: args["cpus"] = [unmarshal_CPU(v) for v in field] if field is not None else None + else: + args["cpus"] = field(default_factory=list) field = data.get("memories", None) if field is not None: args["memories"] = ( [unmarshal_Memory(v) for v in field] if field is not None else None ) + else: + args["memories"] = field(default_factory=list) field = data.get("price_per_hour", None) if field is not None: @@ -956,6 +1173,8 @@ def unmarshal_Offer(data: Any) -> Offer: field = data.get("quota_name", None) if field is not None: args["quota_name"] = field + else: + args["quota_name"] = None field = data.get("persistent_memories", None) if field is not None: @@ -964,24 +1183,36 @@ def unmarshal_Offer(data: Any) -> Offer: if field is not None else None ) + else: + args["persistent_memories"] = field(default_factory=list) field = data.get("raid_controllers", None) if field is not None: args["raid_controllers"] = ( [unmarshal_RaidController(v) for v in field] if field is not None else None ) + else: + args["raid_controllers"] = field(default_factory=list) field = data.get("incompatible_os_ids", None) if field is not None: args["incompatible_os_ids"] = field + else: + args["incompatible_os_ids"] = field(default_factory=list) field = data.get("subscription_period", None) if field is not None: args["subscription_period"] = field + else: + args["subscription_period"] = ( + OfferSubscriptionPeriod.UNKNOWN_SUBSCRIPTION_PERIOD + ) field = data.get("operation_path", None) if field is not None: args["operation_path"] = field + else: + args["operation_path"] = None field = data.get("options", None) if field is not None: @@ -990,22 +1221,32 @@ def unmarshal_Offer(data: Any) -> Offer: if field is not None else None ) + else: + args["options"] = field(default_factory=list) field = data.get("private_bandwidth", None) if field is not None: args["private_bandwidth"] = field + else: + args["private_bandwidth"] = 0 field = data.get("shared_bandwidth", None) if field is not None: args["shared_bandwidth"] = field + else: + args["shared_bandwidth"] = False field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("gpus", None) if field is not None: args["gpus"] = [unmarshal_GPU(v) for v in field] if field is not None else None + else: + args["gpus"] = field(default_factory=list) field = data.get("fee", None) if field is not None: @@ -1033,14 +1274,20 @@ def unmarshal_Option(data: Any) -> Option: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("manageable", None) if field is not None: args["manageable"] = field + else: + args["manageable"] = False field = data.get("license", None) if field is not None: @@ -1086,28 +1333,38 @@ def unmarshal_ServerPrivateNetwork(data: Any) -> ServerPrivateNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("server_id", None) if field is not None: args["server_id"] = field + else: + args["server_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerPrivateNetworkStatus.UNKNOWN field = data.get("vlan", None) if field is not None: args["vlan"] = field else: - args["vlan"] = None + args["vlan"] = 0 field = data.get("created_at", None) if field is not None: @@ -1135,18 +1392,26 @@ def unmarshal_Setting(data: Any) -> Setting: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = SettingType.UNKNOWN field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False return Setting(**args) @@ -1162,14 +1427,20 @@ def unmarshal_BMCAccess(data: Any) -> BMCAccess: field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("login", None) if field is not None: args["login"] = field + else: + args["login"] = None field = data.get("password", None) if field is not None: args["password"] = field + else: + args["password"] = None field = data.get("expires_at", None) if field is not None: @@ -1208,10 +1479,14 @@ def unmarshal_ListOSResponse(data: Any) -> ListOSResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("os", None) if field is not None: args["os"] = [unmarshal_OS(v) for v in field] if field is not None else None + else: + args["os"] = field(default_factory=list) return ListOSResponse(**args) @@ -1227,12 +1502,16 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("offers", None) if field is not None: args["offers"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["offers"] = field(default_factory=list) return ListOffersResponse(**args) @@ -1248,12 +1527,16 @@ def unmarshal_ListOptionsResponse(data: Any) -> ListOptionsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("options", None) if field is not None: args["options"] = ( [unmarshal_Option(v) for v in field] if field is not None else None ) + else: + args["options"] = field(default_factory=list) return ListOptionsResponse(**args) @@ -1269,10 +1552,14 @@ def unmarshal_ServerEvent(data: Any) -> ServerEvent: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = None field = data.get("updated_at", None) if field is not None: @@ -1300,12 +1587,16 @@ def unmarshal_ListServerEventsResponse(data: Any) -> ListServerEventsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("events", None) if field is not None: args["events"] = ( [unmarshal_ServerEvent(v) for v in field] if field is not None else None ) + else: + args["events"] = field(default_factory=list) return ListServerEventsResponse(**args) @@ -1327,10 +1618,14 @@ def unmarshal_ListServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListServerPrivateNetworksResponse(**args) @@ -1346,12 +1641,16 @@ def unmarshal_ListServersResponse(data: Any) -> ListServersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListServersResponse(**args) @@ -1367,12 +1666,16 @@ def unmarshal_ListSettingsResponse(data: Any) -> ListSettingsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("settings", None) if field is not None: args["settings"] = ( [unmarshal_Setting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) return ListSettingsResponse(**args) @@ -1394,6 +1697,8 @@ def unmarshal_SetServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None return SetServerPrivateNetworksResponse(**args) @@ -1405,7 +1710,7 @@ def marshal_SchemaPartition( output: Dict[str, Any] = {} if request.label is not None: - output["label"] = str(request.label) + output["label"] = request.label if request.number is not None: output["number"] = request.number @@ -1429,7 +1734,7 @@ def marshal_SchemaPool( output["name"] = request.name if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.devices is not None: output["devices"] = request.devices @@ -1470,7 +1775,7 @@ def marshal_SchemaFilesystem( output["device"] = request.device if request.format is not None: - output["format"] = str(request.format) + output["format"] = request.format if request.mountpoint is not None: output["mountpoint"] = request.mountpoint @@ -1488,7 +1793,7 @@ def marshal_SchemaRAID( output["name"] = request.name if request.level is not None: - output["level"] = str(request.level) + output["level"] = request.level if request.devices is not None: output["devices"] = request.devices @@ -1694,7 +1999,7 @@ def marshal_RebootServerRequest( output: Dict[str, Any] = {} if request.boot_type is not None: - output["boot_type"] = str(request.boot_type) + output["boot_type"] = request.boot_type return output @@ -1718,7 +2023,7 @@ def marshal_StartServerRequest( output: Dict[str, Any] = {} if request.boot_type is not None: - output["boot_type"] = str(request.boot_type) + output["boot_type"] = request.boot_type return output diff --git a/scaleway-async/scaleway_async/baremetal/v1/types.py b/scaleway-async/scaleway_async/baremetal/v1/types.py index fd3933cf2..7a88b59b0 100644 --- a/scaleway-async/scaleway_async/baremetal/v1/types.py +++ b/scaleway-async/scaleway_async/baremetal/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -220,49 +220,37 @@ def __str__(self) -> str: @dataclass class SchemaPartition: label: SchemaPartitionLabel - number: int - size: int - use_all_available_space: bool @dataclass class SchemaPool: name: str - type_: SchemaPoolType - devices: List[str] - options: List[str] - filesystem_options: List[str] @dataclass class SchemaDisk: device: str - partitions: List[SchemaPartition] @dataclass class SchemaFilesystem: device: str - format: SchemaFilesystemFormat - mountpoint: str @dataclass class SchemaRAID: name: str - level: SchemaRAIDLevel - devices: List[str] @@ -274,12 +262,9 @@ class SchemaZFS: @dataclass class Schema: disks: List[SchemaDisk] - raids: List[SchemaRAID] - filesystems: List[SchemaFilesystem] - - zfs: Optional[SchemaZFS] + zfs: Optional[SchemaZFS] = None @dataclass @@ -324,27 +309,27 @@ class CreateServerRequestInstall: SSH key IDs authorized on the server. """ - user: Optional[str] + user: Optional[str] = None """ User for the installation. """ - password: Optional[str] + password: Optional[str] = None """ Password for the installation. """ - service_user: Optional[str] + service_user: Optional[str] = None """ Regular user that runs the service to be installed on the server. """ - service_password: Optional[str] + service_password: Optional[str] = None """ Password used for the service to install. """ - partitioning_schema: Optional[Schema] + partitioning_schema: Optional[Schema] = None """ Partitioning schema. """ @@ -420,7 +405,7 @@ class ServerInstall: Address of the installed service. """ - partitioning_schema: Optional[Schema] + partitioning_schema: Optional[Schema] = None """ Partitioning schema. """ @@ -448,20 +433,20 @@ class ServerOption: Defines whether the option can be managed (added or removed). """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Auto expiration date for compatible options. """ - license: Optional[LicenseOption] + license: Optional[LicenseOption] = None - public_bandwidth: Optional[PublicBandwidthOption] + public_bandwidth: Optional[PublicBandwidthOption] = None - private_network: Optional[PrivateNetworkOption] + private_network: Optional[PrivateNetworkOption] = None - remote_access: Optional[RemoteAccessOption] + remote_access: Optional[RemoteAccessOption] = None - certification: Optional[CertificationOption] + certification: Optional[CertificationOption] = None @dataclass @@ -480,10 +465,8 @@ class ServerRescueServer: @dataclass class OSOSField: editable: bool - required: bool - - default_value: Optional[str] + default_value: Optional[str] = None @dataclass @@ -591,25 +574,25 @@ class OfferOptionOffer: Boolean to know if option could be managed. """ - price: Optional[Money] + price: Optional[Money] = None """ Price of the option. """ - os_id: Optional[str] + os_id: Optional[str] = None """ Deprecated, use LicenseOptionVars.os_id instead. """ - license: Optional[LicenseOption] + license: Optional[LicenseOption] = None - public_bandwidth: Optional[PublicBandwidthOption] + public_bandwidth: Optional[PublicBandwidthOption] = None - private_network: Optional[PrivateNetworkOption] + private_network: Optional[PrivateNetworkOption] = None - remote_access: Optional[RemoteAccessOption] + remote_access: Optional[RemoteAccessOption] = None - certification: Optional[CertificationOption] + certification: Optional[CertificationOption] = None @dataclass @@ -633,7 +616,6 @@ class PersistentMemory: @dataclass class RaidController: model: str - raid_level: List[str] @@ -659,29 +641,29 @@ class CreateServerRequest: If enabled, the server can not be deleted. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to associate to the server. """ - install: Optional[CreateServerRequestInstall] + install: Optional[CreateServerRequestInstall] = None """ Object describing the configuration details of the OS installation on the server. """ - option_ids: Optional[List[str]] + option_ids: Optional[List[str]] = field(default_factory=list) """ IDs of options to enable on server. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -726,16 +708,6 @@ class Server: Offer name of the server. """ - updated_at: Optional[datetime] - """ - Last modification date of the server. - """ - - created_at: Optional[datetime] - """ - Creation date of the server. - """ - tags: List[str] """ Array of custom tags attached to the server. @@ -776,12 +748,22 @@ class Server: If enabled, the server can not be deleted. """ - install: Optional[ServerInstall] + updated_at: Optional[datetime] = None + """ + Last modification date of the server. + """ + + created_at: Optional[datetime] = None + """ + Creation date of the server. + """ + + install: Optional[ServerInstall] = None """ Configuration of the installation. """ - rescue_server: Optional[ServerRescueServer] + rescue_server: Optional[ServerRescueServer] = None """ Configuration of rescue boot. """ @@ -809,49 +791,49 @@ class OS: URL of this OS's logo. """ - ssh: Optional[OSOSField] + enabled: bool """ - Object defining the SSH requirements to install the OS. + Defines if the operating system is enabled or not. """ - user: Optional[OSOSField] + license_required: bool """ - Object defining the username requirements to install the OS. + License required (check server options for pricing details). """ - password: Optional[OSOSField] + allowed: bool """ - Object defining the password requirements to install the OS. + Defines if a specific Organization is allowed to install this OS type. """ - service_user: Optional[OSOSField] + custom_partitioning_supported: bool """ - Object defining the username requirements to install the service. + Defines if custom partitioning is supported by this OS. """ - service_password: Optional[OSOSField] + ssh: Optional[OSOSField] = None """ - Object defining the password requirements to install the service. + Object defining the SSH requirements to install the OS. """ - enabled: bool + user: Optional[OSOSField] = None """ - Defines if the operating system is enabled or not. + Object defining the username requirements to install the OS. """ - license_required: bool + password: Optional[OSOSField] = None """ - License required (check server options for pricing details). + Object defining the password requirements to install the OS. """ - allowed: bool + service_user: Optional[OSOSField] = None """ - Defines if a specific Organization is allowed to install this OS type. + Object defining the username requirements to install the service. """ - custom_partitioning_supported: bool + service_password: Optional[OSOSField] = None """ - Defines if custom partitioning is supported by this OS. + Object defining the password requirements to install the service. """ @@ -907,16 +889,6 @@ class Offer: Memory specifications of the offer. """ - price_per_hour: Optional[Money] - """ - Price of the offer for the next 60 minutes (a server order at 11h32 will be paid until 12h32). - """ - - price_per_month: Optional[Money] - """ - Monthly price of the offer, if subscribing on a monthly basis. - """ - quota_name: str """ Name of the quota associated to the offer. @@ -972,12 +944,22 @@ class Offer: GPU specifications of the offer. """ - fee: Optional[Money] + price_per_hour: Optional[Money] = None + """ + Price of the offer for the next 60 minutes (a server order at 11h32 will be paid until 12h32). + """ + + price_per_month: Optional[Money] = None + """ + Monthly price of the offer, if subscribing on a monthly basis. + """ + + fee: Optional[Money] = None """ One time fee invoiced by Scaleway for the setup and activation of the server. """ - monthly_offer_id: Optional[str] + monthly_offer_id: Optional[str] = None """ Exist only for hourly offers, to migrate to the monthly offer. """ @@ -1000,15 +982,15 @@ class Option: Defines whether the option is manageable (could be added or removed). """ - license: Optional[LicenseOption] + license: Optional[LicenseOption] = None - public_bandwidth: Optional[PublicBandwidthOption] + public_bandwidth: Optional[PublicBandwidthOption] = None - private_network: Optional[PrivateNetworkOption] + private_network: Optional[PrivateNetworkOption] = None - remote_access: Optional[RemoteAccessOption] + remote_access: Optional[RemoteAccessOption] = None - certification: Optional[CertificationOption] + certification: Optional[CertificationOption] = None @dataclass @@ -1023,12 +1005,12 @@ class ServerEvent: The action that will be applied to the server. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date of last modification of the action. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date of creation of the action. """ @@ -1061,17 +1043,17 @@ class ServerPrivateNetwork: The configuration status of the Private Network. """ - vlan: Optional[int] + vlan: Optional[int] = 0 """ The VLAN ID associated to the Private Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ The Private Network creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ The date the Private Network was last modified. """ @@ -1112,12 +1094,12 @@ class AddOptionServerRequest: ID of the option to add. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Auto expire the option after this date. """ @@ -1140,7 +1122,7 @@ class BMCAccess: The password to use for the BMC (Baseboard Management Controller) access authentification. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ The date after which the BMC (Baseboard Management Controller) access will be closed. """ @@ -1158,7 +1140,7 @@ class DeleteOptionServerRequest: ID of the option to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1171,7 +1153,7 @@ class DeleteServerRequest: ID of the server to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1184,7 +1166,7 @@ class GetBMCAccessRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1202,7 +1184,7 @@ class GetDefaultPartitioningSchemaRequest: ID of the OS. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1215,7 +1197,7 @@ class GetOSRequest: ID of the OS. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1228,7 +1210,7 @@ class GetOfferRequest: ID of the researched Offer. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1241,7 +1223,7 @@ class GetOptionRequest: ID of the option. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1254,7 +1236,7 @@ class GetServerMetricsRequest: Server ID to get the metrics. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1262,7 +1244,7 @@ class GetServerMetricsRequest: @dataclass class GetServerMetricsResponse: - pings: Optional[TimeSeries] + pings: Optional[TimeSeries] = None """ Timeseries object representing pings on the server. """ @@ -1275,7 +1257,7 @@ class GetServerRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1303,32 +1285,32 @@ class InstallServerRequest: SSH key IDs authorized on the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - user: Optional[str] + user: Optional[str] = None """ User used for the installation. """ - password: Optional[str] + password: Optional[str] = None """ Password used for the installation. """ - service_user: Optional[str] + service_user: Optional[str] = None """ User used for the service to install. """ - service_password: Optional[str] + service_password: Optional[str] = None """ Password used for the service to install. """ - partitioning_schema: Optional[Schema] + partitioning_schema: Optional[Schema] = None """ Partitioning schema. """ @@ -1336,22 +1318,22 @@ class InstallServerRequest: @dataclass class ListOSRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of OS per page. """ - offer_id: Optional[str] + offer_id: Optional[str] = None """ Offer IDs to filter OSes for. """ @@ -1372,27 +1354,29 @@ class ListOSResponse: @dataclass class ListOffersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of offers per page. """ - subscription_period: Optional[OfferSubscriptionPeriod] + subscription_period: Optional[OfferSubscriptionPeriod] = ( + OfferSubscriptionPeriod.UNKNOWN_SUBSCRIPTION_PERIOD + ) """ Subscription period type to filter offers by. """ - name: Optional[str] + name: Optional[str] = None """ Offer name to filter offers by. """ @@ -1413,27 +1397,27 @@ class ListOffersResponse: @dataclass class ListOptionsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of options per page. """ - offer_id: Optional[str] + offer_id: Optional[str] = None """ Offer ID to filter options for. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter options for. """ @@ -1459,22 +1443,24 @@ class ListServerEventsRequest: ID of the server events searched. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of server events per page. """ - order_by: Optional[ListServerEventsRequestOrderBy] + order_by: Optional[ListServerEventsRequestOrderBy] = ( + ListServerEventsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the server events. """ @@ -1496,58 +1482,59 @@ class ListServerEventsResponse: @dataclass class ListServerPrivateNetworksResponse: server_private_networks: List[ServerPrivateNetwork] - total_count: int @dataclass class ListServersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of servers per page. """ - order_by: Optional[ListServersRequestOrderBy] + order_by: Optional[ListServersRequestOrderBy] = ( + ListServersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the servers. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. """ - status: Optional[List[str]] + status: Optional[List[str]] = field(default_factory=list) """ Status to filter for. """ - name: Optional[str] + name: Optional[str] = None """ Names to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. """ - option_id: Optional[str] + option_id: Optional[str] = None """ Option ID to filter for. """ @@ -1568,27 +1555,29 @@ class ListServersResponse: @dataclass class ListSettingsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Set the maximum list size. """ - order_by: Optional[ListSettingsRequestOrderBy] + order_by: Optional[ListSettingsRequestOrderBy] = ( + ListSettingsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for items in the response. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1614,7 +1603,7 @@ class MigrateServerToMonthlyOfferRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1632,7 +1621,7 @@ class PrivateNetworkApiAddServerPrivateNetworkRequest: The ID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1650,7 +1639,7 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: The ID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1658,42 +1647,44 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: @dataclass class PrivateNetworkApiListServerPrivateNetworksRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListServerPrivateNetworksRequestOrderBy] + order_by: Optional[ListServerPrivateNetworksRequestOrderBy] = ( + ListServerPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ The sort order for the returned Private Networks. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number for the returned Private Networks. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The maximum number of Private Networks per page. """ - server_id: Optional[str] + server_id: Optional[str] = None """ Filter Private Networks by server ID. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Filter Private Networks by Private Network ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter Private Networks by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter Private Networks by Project ID. """ @@ -1711,7 +1702,7 @@ class PrivateNetworkApiSetServerPrivateNetworksRequest: The IDs of the Private Networks. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1724,12 +1715,12 @@ class RebootServerRequest: ID of the server to reboot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - boot_type: Optional[ServerBootType] + boot_type: Optional[ServerBootType] = ServerBootType.UNKNOWN_BOOT_TYPE """ The type of boot. """ @@ -1752,7 +1743,7 @@ class StartBMCAccessRequest: The IP authorized to connect to the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1765,12 +1756,12 @@ class StartServerRequest: ID of the server to start. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - boot_type: Optional[ServerBootType] + boot_type: Optional[ServerBootType] = ServerBootType.UNKNOWN_BOOT_TYPE """ The type of boot. """ @@ -1783,7 +1774,7 @@ class StopBMCAccessRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1796,7 +1787,7 @@ class StopServerRequest: ID of the server to stop. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1814,12 +1805,12 @@ class UpdateIPRequest: ID of the IP to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ New reverse IP to update, not updated if null. """ @@ -1832,27 +1823,27 @@ class UpdateServerRequest: ID of the server to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the server (≠hostname), not updated if null. """ - description: Optional[str] + description: Optional[str] = None """ Description associated with the server, max 255 characters, not updated if null. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the server, not updated if null. """ - protected: Optional[bool] + protected: Optional[bool] = False """ If enabled, the server can not be deleted. """ @@ -1865,12 +1856,12 @@ class UpdateSettingRequest: ID of the setting. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - enabled: Optional[bool] + enabled: Optional[bool] = False """ Defines whether the setting is enabled. """ @@ -1888,12 +1879,12 @@ class ValidatePartitioningSchemaRequest: OS ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - partitioning_schema: Optional[Schema] + partitioning_schema: Optional[Schema] = None """ Partitioning schema. """ diff --git a/scaleway-async/scaleway_async/baremetal/v3/marshalling.py b/scaleway-async/scaleway_async/baremetal/v3/marshalling.py index d1c8dee32..cb4ab0df0 100644 --- a/scaleway-async/scaleway_async/baremetal/v3/marshalling.py +++ b/scaleway-async/scaleway_async/baremetal/v3/marshalling.py @@ -6,6 +6,7 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + ServerPrivateNetworkStatus, ServerPrivateNetwork, ListServerPrivateNetworksResponse, SetServerPrivateNetworksResponse, @@ -25,32 +26,44 @@ def unmarshal_ServerPrivateNetwork(data: Any) -> ServerPrivateNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("server_id", None) if field is not None: args["server_id"] = field + else: + args["server_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerPrivateNetworkStatus.UNKNOWN_STATUS field = data.get("ipam_ip_ids", None) if field is not None: args["ipam_ip_ids"] = field + else: + args["ipam_ip_ids"] = field(default_factory=list) field = data.get("vlan", None) if field is not None: args["vlan"] = field else: - args["vlan"] = None + args["vlan"] = 0 field = data.get("created_at", None) if field is not None: @@ -84,10 +97,14 @@ def unmarshal_ListServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListServerPrivateNetworksResponse(**args) @@ -109,6 +126,8 @@ def unmarshal_SetServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None return SetServerPrivateNetworksResponse(**args) diff --git a/scaleway-async/scaleway_async/baremetal/v3/types.py b/scaleway-async/scaleway_async/baremetal/v3/types.py index e48318896..e90848794 100644 --- a/scaleway-async/scaleway_async/baremetal/v3/types.py +++ b/scaleway-async/scaleway_async/baremetal/v3/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -69,17 +69,17 @@ class ServerPrivateNetwork: IPAM IP IDs of the server, if it has any. """ - vlan: Optional[int] + vlan: Optional[int] = 0 """ VLAN UUID associated with the Private Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Private Network creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the Private Network was last modified. """ @@ -88,7 +88,6 @@ class ServerPrivateNetwork: @dataclass class ListServerPrivateNetworksResponse: server_private_networks: List[ServerPrivateNetwork] - total_count: int @@ -104,12 +103,12 @@ class PrivateNetworkApiAddServerPrivateNetworkRequest: UUID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ipam_ip_ids: Optional[List[str]] + ipam_ip_ids: Optional[List[str]] = field(default_factory=list) """ IPAM IDs of an IPs to attach to the server. """ @@ -127,7 +126,7 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: UUID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -135,47 +134,49 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: @dataclass class PrivateNetworkApiListServerPrivateNetworksRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListServerPrivateNetworksRequestOrderBy] + order_by: Optional[ListServerPrivateNetworksRequestOrderBy] = ( + ListServerPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for the returned Private Networks. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned Private Networks. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Private Networks per page. """ - server_id: Optional[str] + server_id: Optional[str] = None """ Filter Private Networks by server UUID. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Filter Private Networks by Private Network UUID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter Private Networks by organization UUID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter Private Networks by project UUID. """ - ipam_ip_ids: Optional[List[str]] + ipam_ip_ids: Optional[List[str]] = field(default_factory=list) """ Filter Private Networks by IPAM IP UUIDs. """ @@ -193,7 +194,7 @@ class PrivateNetworkApiSetServerPrivateNetworksRequest: Object where the keys are the UUIDs of Private Networks and the values are arrays of IPAM IDs representing the IPs to assign to this Elastic Metal server on the Private Network. If the array supplied for a Private Network is empty, the next available IP from the Private Network's CIDR block will automatically be used for attachment. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ diff --git a/scaleway-async/scaleway_async/billing/v2beta1/marshalling.py b/scaleway-async/scaleway_async/billing/v2beta1/marshalling.py index 57b1d89a7..fb3c240ce 100644 --- a/scaleway-async/scaleway_async/billing/v2beta1/marshalling.py +++ b/scaleway-async/scaleway_async/billing/v2beta1/marshalling.py @@ -8,6 +8,9 @@ unmarshal_Money, ) from .types import ( + DiscountDiscountMode, + DiscountFilterType, + InvoiceType, DiscountCoupon, DiscountFilter, Discount, @@ -49,14 +52,20 @@ def unmarshal_DiscountFilter(data: Any) -> DiscountFilter: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = DiscountFilterType.UNKNOWN_TYPE field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None field = data.get("exclude", None) if field is not None: args["exclude"] = field + else: + args["exclude"] = False return DiscountFilter(**args) @@ -72,36 +81,52 @@ def unmarshal_Discount(data: Any) -> Discount: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = 0.0 field = data.get("value_used", None) if field is not None: args["value_used"] = field + else: + args["value_used"] = 0.0 field = data.get("value_remaining", None) if field is not None: args["value_remaining"] = field + else: + args["value_remaining"] = 0.0 field = data.get("mode", None) if field is not None: args["mode"] = field + else: + args["mode"] = DiscountDiscountMode.UNKNOWN_DISCOUNT_MODE field = data.get("filters", None) if field is not None: args["filters"] = ( [unmarshal_DiscountFilter(v) for v in field] if field is not None else None ) + else: + args["filters"] = field(default_factory=list) field = data.get("creation_date", None) if field is not None: @@ -143,14 +168,20 @@ def unmarshal_Invoice(data: Any) -> Invoice: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("organization_name", None) if field is not None: args["organization_name"] = field + else: + args["organization_name"] = None field = data.get("start_date", None) if field is not None: @@ -189,18 +220,26 @@ def unmarshal_Invoice(data: Any) -> Invoice: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = InvoiceType.UNKNOWN_TYPE field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None field = data.get("number", None) if field is not None: args["number"] = field + else: + args["number"] = 0 field = data.get("seller_name", None) if field is not None: args["seller_name"] = field + else: + args["seller_name"] = None field = data.get("total_untaxed", None) if field is not None: @@ -248,30 +287,44 @@ def unmarshal_ListConsumptionsResponseConsumption( field = data.get("product_name", None) if field is not None: args["product_name"] = field + else: + args["product_name"] = None field = data.get("resource_name", None) if field is not None: args["resource_name"] = field + else: + args["resource_name"] = None field = data.get("sku", None) if field is not None: args["sku"] = field + else: + args["sku"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("category_name", None) if field is not None: args["category_name"] = field + else: + args["category_name"] = None field = data.get("unit", None) if field is not None: args["unit"] = field + else: + args["unit"] = None field = data.get("billed_quantity", None) if field is not None: args["billed_quantity"] = field + else: + args["billed_quantity"] = None field = data.get("value", None) if field is not None: @@ -297,14 +350,20 @@ def unmarshal_ListConsumptionsResponse(data: Any) -> ListConsumptionsResponse: if field is not None else None ) + else: + args["consumptions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("total_discount_untaxed_value", None) if field is not None: args["total_discount_untaxed_value"] = field + else: + args["total_discount_untaxed_value"] = 0.0 field = data.get("updated_at", None) if field is not None: @@ -326,12 +385,16 @@ def unmarshal_ListDiscountsResponse(data: Any) -> ListDiscountsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("discounts", None) if field is not None: args["discounts"] = ( [unmarshal_Discount(v) for v in field] if field is not None else None ) + else: + args["discounts"] = field(default_factory=list) return ListDiscountsResponse(**args) @@ -347,12 +410,16 @@ def unmarshal_ListInvoicesResponse(data: Any) -> ListInvoicesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("invoices", None) if field is not None: args["invoices"] = ( [unmarshal_Invoice(v) for v in field] if field is not None else None ) + else: + args["invoices"] = field(default_factory=list) return ListInvoicesResponse(**args) @@ -368,22 +435,26 @@ def unmarshal_ListTaxesResponseTax(data: Any) -> ListTaxesResponseTax: field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("currency", None) if field is not None: args["currency"] = field + else: + args["currency"] = None field = data.get("rate", None) if field is not None: args["rate"] = field else: - args["rate"] = None + args["rate"] = 0.0 field = data.get("total_tax_value", None) if field is not None: args["total_tax_value"] = field else: - args["total_tax_value"] = None + args["total_tax_value"] = 0.0 return ListTaxesResponseTax(**args) @@ -403,10 +474,14 @@ def unmarshal_ListTaxesResponse(data: Any) -> ListTaxesResponse: if field is not None else None ) + else: + args["taxes"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("updated_at", None) if field is not None: diff --git a/scaleway-async/scaleway_async/billing/v2beta1/types.py b/scaleway-async/scaleway_async/billing/v2beta1/types.py index acb11d3e7..0ec8f5fbd 100644 --- a/scaleway-async/scaleway_async/billing/v2beta1/types.py +++ b/scaleway-async/scaleway_async/billing/v2beta1/types.py @@ -135,7 +135,7 @@ def __str__(self) -> str: @dataclass class DiscountCoupon: - description: Optional[str] + description: Optional[str] = None """ The description of the coupon. """ @@ -196,7 +196,7 @@ class ListConsumptionsResponseConsumption: Consumed quantity. """ - value: Optional[Money] + value: Optional[Money] = None """ Monetary value of the consumption. """ @@ -244,22 +244,22 @@ class Discount: List of the discount scopes. """ - creation_date: Optional[datetime] + creation_date: Optional[datetime] = None """ The creation date of the discount. """ - start_date: Optional[datetime] + start_date: Optional[datetime] = None """ The start date of the discount. """ - stop_date: Optional[datetime] + stop_date: Optional[datetime] = None """ The stop date of the discount. """ - coupon: Optional[DiscountCoupon] + coupon: Optional[DiscountCoupon] = None """ The description of the coupon. """ @@ -273,72 +273,69 @@ class Invoice: """ organization_id: str - organization_name: str - - start_date: Optional[datetime] + type_: InvoiceType """ - Start date of the billing period. + Type of invoice, either periodic or purchase. """ - stop_date: Optional[datetime] - - billing_period: Optional[datetime] + state: str """ - The billing period of the invoice in the YYYY-MM format. + The state of the Invoice. """ - issued_date: Optional[datetime] + number: int """ - Date when the invoice was sent to the customer. + Invoice number. """ - due_date: Optional[datetime] + seller_name: str """ - Payment time limit, set according to the Organization's payment conditions. + The name of the seller (Scaleway). """ - type_: InvoiceType + start_date: Optional[datetime] = None """ - Type of invoice, either periodic or purchase. + Start date of the billing period. """ - state: str + stop_date: Optional[datetime] = None + billing_period: Optional[datetime] = None """ - The state of the Invoice. + The billing period of the invoice in the YYYY-MM format. """ - number: int + issued_date: Optional[datetime] = None """ - Invoice number. + Date when the invoice was sent to the customer. """ - seller_name: str + due_date: Optional[datetime] = None """ - The name of the seller (Scaleway). + Payment time limit, set according to the Organization's payment conditions. """ - total_untaxed: Optional[Money] + total_untaxed: Optional[Money] = None """ Total amount, untaxed. """ - total_taxed: Optional[Money] + total_taxed: Optional[Money] = None """ Total amount, taxed. """ - total_tax: Optional[Money] + total_tax: Optional[Money] = None """ The total tax amount of the invoice. """ - total_discount: Optional[Money] + total_discount: Optional[Money] = None """ The total discount amount of the invoice. """ - total_undiscount: Optional[Money] + total_undiscount: Optional[Money] = None """ The total amount of the invoice before applying the discount. """ @@ -356,12 +353,12 @@ class ListTaxesResponseTax: The three-letter currency code. """ - rate: Optional[float] + rate: Optional[float] = 0.0 """ Applied tax rate (0.2 means a VAT of 20%). """ - total_tax_value: Optional[float] + total_tax_value: Optional[float] = 0.0 """ The total tax value of the consumption. """ @@ -374,7 +371,9 @@ class DownloadInvoiceRequest: Invoice ID. """ - file_type: Optional[DownloadInvoiceRequestFileType] + file_type: Optional[DownloadInvoiceRequestFileType] = ( + DownloadInvoiceRequestFileType.PDF + ) """ File type. PDF by default. """ @@ -382,42 +381,46 @@ class DownloadInvoiceRequest: @dataclass class ExportInvoicesRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID. If specified, only invoices from this Organization will be returned. """ - billing_period_start_after: Optional[datetime] + billing_period_start_after: Optional[datetime] = None """ Return only invoice with start date greater than billing_period_start. """ - billing_period_start_before: Optional[datetime] + billing_period_start_before: Optional[datetime] = None """ Return only invoice with start date less than billing_period_start. """ - invoice_type: Optional[InvoiceType] + invoice_type: Optional[InvoiceType] = InvoiceType.UNKNOWN_TYPE """ Invoice type. It can either be `periodic` or `purchase`. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - order_by: Optional[ExportInvoicesRequestOrderBy] + order_by: Optional[ExportInvoicesRequestOrderBy] = ( + ExportInvoicesRequestOrderBy.INVOICE_NUMBER_DESC + ) """ How invoices are ordered in the response. """ - file_type: Optional[ExportInvoicesRequestFileType] + file_type: Optional[ExportInvoicesRequestFileType] = ( + ExportInvoicesRequestFileType.CSV + ) """ File format for exporting the invoice list. """ @@ -433,34 +436,36 @@ class GetInvoiceRequest: @dataclass class ListConsumptionsRequest: - order_by: Optional[ListConsumptionsRequestOrderBy] + order_by: Optional[ListConsumptionsRequestOrderBy] = ( + ListConsumptionsRequestOrderBy.UPDATED_AT_DESC + ) """ Order consumptions list in the response by their update date. """ - page: Optional[int] + page: Optional[int] = 0 """ Positive integer to choose the page to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - category_name: Optional[str] + category_name: Optional[str] = None """ Filter by name of a Category as they are shown in the invoice (Compute, Network, Observability). """ - billing_period: Optional[str] + billing_period: Optional[str] = None """ Filter by the billing period in the YYYY-MM format. If it is empty the current billing period will be used as default. """ - organization_id: Optional[str] + organization_id: Optional[str] = None - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -480,7 +485,7 @@ class ListConsumptionsResponse: Sum of all discounts, displayed only when no category or project ID filter is applied. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last consumption update date. """ @@ -488,22 +493,24 @@ class ListConsumptionsResponse: @dataclass class ListDiscountsRequest: - order_by: Optional[ListDiscountsRequestOrderBy] + order_by: Optional[ListDiscountsRequestOrderBy] = ( + ListDiscountsRequestOrderBy.CREATION_DATE_DESC + ) """ Order discounts in the response by their description. """ - page: Optional[int] + page: Optional[int] = 0 """ Positive integer to choose the page to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the organization. """ @@ -524,37 +531,39 @@ class ListDiscountsResponse: @dataclass class ListInvoicesRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID. If specified, only invoices from this Organization will be returned. """ - billing_period_start_after: Optional[datetime] + billing_period_start_after: Optional[datetime] = None """ Return only invoice with start date greater than billing_period_start. """ - billing_period_start_before: Optional[datetime] + billing_period_start_before: Optional[datetime] = None """ Return only invoice with start date less than billing_period_start. """ - invoice_type: Optional[InvoiceType] + invoice_type: Optional[InvoiceType] = InvoiceType.UNKNOWN_TYPE """ Invoice type. It can either be `periodic` or `purchase`. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - order_by: Optional[ListInvoicesRequestOrderBy] + order_by: Optional[ListInvoicesRequestOrderBy] = ( + ListInvoicesRequestOrderBy.INVOICE_NUMBER_DESC + ) """ How invoices are ordered in the response. """ @@ -575,27 +584,29 @@ class ListInvoicesResponse: @dataclass class ListTaxesRequest: - order_by: Optional[ListTaxesRequestOrderBy] + order_by: Optional[ListTaxesRequestOrderBy] = ( + ListTaxesRequestOrderBy.UPDATED_AT_DESC + ) """ Order consumed taxes list in the response by their update date. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - billing_period: Optional[str] + billing_period: Optional[str] = None """ Filter by the billing period in the YYYY-MM format. If it is empty the current billing period will be used as default. """ @@ -613,7 +624,7 @@ class ListTaxesResponse: Total number of returned items. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last consumption update date. """ @@ -626,7 +637,7 @@ class RedeemCouponRequest: The code of the coupon to redeem. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ The Organization ID of the discount. """ diff --git a/scaleway-async/scaleway_async/block/v1/marshalling.py b/scaleway-async/scaleway_async/block/v1/marshalling.py index 31e50d261..47a10f260 100644 --- a/scaleway-async/scaleway_async/block/v1/marshalling.py +++ b/scaleway-async/scaleway_async/block/v1/marshalling.py @@ -13,6 +13,11 @@ resolve_one_of, ) from .types import ( + ReferenceStatus, + ReferenceType, + SnapshotStatus, + StorageClass, + VolumeStatus, Reference, SnapshotParentVolume, Snapshot, @@ -44,22 +49,32 @@ def unmarshal_Reference(data: Any) -> Reference: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("product_resource_type", None) if field is not None: args["product_resource_type"] = field + else: + args["product_resource_type"] = None field = data.get("product_resource_id", None) if field is not None: args["product_resource_id"] = field + else: + args["product_resource_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ReferenceType.UNKNOWN_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ReferenceStatus.UNKNOWN_STATUS field = data.get("created_at", None) if field is not None: @@ -81,18 +96,26 @@ def unmarshal_SnapshotParentVolume(data: Any) -> SnapshotParentVolume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = VolumeStatus.UNKNOWN_STATUS return SnapshotParentVolume(**args) @@ -108,40 +131,58 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("references", None) if field is not None: args["references"] = ( [unmarshal_Reference(v) for v in field] if field is not None else None ) + else: + args["references"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SnapshotStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = StorageClass.UNKNOWN_STORAGE_CLASS field = data.get("parent_volume", None) if field is not None: @@ -175,12 +216,14 @@ def unmarshal_VolumeSpecifications(data: Any) -> VolumeSpecifications: field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = StorageClass.UNKNOWN_STORAGE_CLASS field = data.get("perf_iops", None) if field is not None: args["perf_iops"] = field else: - args["perf_iops"] = None + args["perf_iops"] = 0 return VolumeSpecifications(**args) @@ -196,28 +239,40 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("references", None) if field is not None: args["references"] = ( [unmarshal_Reference(v) for v in field] if field is not None else None ) + else: + args["references"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -240,14 +295,20 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = VolumeStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("specs", None) if field is not None: @@ -279,10 +340,14 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSnapshotsResponse(**args) @@ -298,6 +363,8 @@ def unmarshal_VolumeType(data: Any) -> VolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("pricing", None) if field is not None: @@ -333,10 +400,14 @@ def unmarshal_ListVolumeTypesResponse(data: Any) -> ListVolumeTypesResponse: args["volume_types"] = ( [unmarshal_VolumeType(v) for v in field] if field is not None else None ) + else: + args["volume_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVolumeTypesResponse(**args) @@ -354,10 +425,14 @@ def unmarshal_ListVolumesResponse(data: Any) -> ListVolumesResponse: args["volumes"] = ( [unmarshal_Volume(v) for v in field] if field is not None else None ) + else: + args["volumes"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVolumesResponse(**args) @@ -375,7 +450,9 @@ def marshal_CreateSnapshotRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -445,7 +522,9 @@ def marshal_CreateVolumeRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -484,7 +563,9 @@ def marshal_ImportSnapshotFromObjectStorageRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway-async/scaleway_async/block/v1/types.py b/scaleway-async/scaleway_async/block/v1/types.py index d666ce94c..935a2bbe8 100644 --- a/scaleway-async/scaleway_async/block/v1/types.py +++ b/scaleway-async/scaleway_async/block/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -128,7 +128,7 @@ class Reference: Status of the reference. Statuses include `attaching`, `attached`, and `detaching`. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the reference. """ @@ -164,7 +164,7 @@ class VolumeSpecifications: The storage class of the volume. """ - perf_iops: Optional[int] + perf_iops: Optional[int] = 0 """ The maximum IO/s expected, according to the different options available in stock (`5000 | 15000`). """ @@ -185,7 +185,7 @@ class CreateVolumeRequestFromSnapshot: Source snapshot from which volume will be created. """ - size: Optional[int] + size: Optional[int] = 0 """ Must be compliant with the minimum (1 GB) and maximum (10 TB) allowed size. Size is optional and is used only if a resize of the volume is requested, otherwise original snapshot size will be used. @@ -239,17 +239,17 @@ class Snapshot: Storage class of the snapshot. """ - parent_volume: Optional[SnapshotParentVolume] + parent_volume: Optional[SnapshotParentVolume] = None """ If the parent volume was deleted, value is null. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the snapshot. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the properties of a snapshot. """ @@ -262,17 +262,17 @@ class VolumeType: Volume type. """ - pricing: Optional[Money] + pricing: Optional[Money] = None """ Price of the volume billed in GB/hour. """ - snapshot_pricing: Optional[Money] + snapshot_pricing: Optional[Money] = None """ Price of the snapshot billed in GB/hour. """ - specs: Optional[VolumeSpecifications] + specs: Optional[VolumeSpecifications] = None """ Volume specifications of the volume type. """ @@ -310,42 +310,42 @@ class Volume: List of the references to the volume. """ - created_at: Optional[datetime] + status: VolumeStatus """ - Creation date of the volume. + Current status of the volume (available, in_use, ...). """ - updated_at: Optional[datetime] + tags: List[str] """ - Last update of the properties of a volume. + List of tags assigned to the volume. """ - parent_snapshot_id: Optional[str] + zone: ScwZone """ - When a volume is created from a snapshot, is the UUID of the snapshot from which the volume has been created. + Volume zone. """ - status: VolumeStatus + created_at: Optional[datetime] = None """ - Current status of the volume (available, in_use, ...). + Creation date of the volume. """ - tags: List[str] + updated_at: Optional[datetime] = None """ - List of tags assigned to the volume. + Last update of the properties of a volume. """ - zone: ScwZone + parent_snapshot_id: Optional[str] = None """ - Volume zone. + When a volume is created from a snapshot, is the UUID of the snapshot from which the volume has been created. """ - specs: Optional[VolumeSpecifications] + specs: Optional[VolumeSpecifications] = None """ Specifications of the volume. """ - last_detached_at: Optional[datetime] + last_detached_at: Optional[datetime] = None """ Last time the volume was detached. """ @@ -358,22 +358,22 @@ class CreateSnapshotRequest: UUID of the volume to snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project to which the volume and the snapshot belong. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ @@ -381,31 +381,31 @@ class CreateSnapshotRequest: @dataclass class CreateVolumeRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the volume. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project the volume belongs to. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the volume. """ - from_empty: Optional[CreateVolumeRequestFromEmpty] + from_empty: Optional[CreateVolumeRequestFromEmpty] = None - from_snapshot: Optional[CreateVolumeRequestFromSnapshot] + from_snapshot: Optional[CreateVolumeRequestFromSnapshot] = None - perf_iops: Optional[int] + perf_iops: Optional[int] = None @dataclass @@ -415,7 +415,7 @@ class DeleteSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -428,7 +428,7 @@ class DeleteVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -451,7 +451,7 @@ class ExportSnapshotToObjectStorageRequest: The object key inside the given bucket. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -464,7 +464,7 @@ class GetSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -477,7 +477,7 @@ class GetVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -500,22 +500,22 @@ class ImportSnapshotFromObjectStorageRequest: Name of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project to which the volume and the snapshot belong. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ - size: Optional[int] + size: Optional[int] = 0 """ Size of the snapshot. """ @@ -523,47 +523,49 @@ class ImportSnapshotFromObjectStorageRequest: @dataclass class ListSnapshotsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListSnapshotsRequestOrderBy] + order_by: Optional[ListSnapshotsRequestOrderBy] = ( + ListSnapshotsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ - volume_id: Optional[str] + volume_id: Optional[str] = None """ Filter snapshots by the ID of the original volume. """ - name: Optional[str] + name: Optional[str] = None """ Filter snapshots by their names. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. Only snapshots with one or more matching tags will be returned. """ @@ -584,17 +586,17 @@ class ListSnapshotsResponse: @dataclass class ListVolumeTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ @@ -615,47 +617,49 @@ class ListVolumeTypesResponse: @dataclass class ListVolumesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListVolumesRequestOrderBy] + order_by: Optional[ListVolumesRequestOrderBy] = ( + ListVolumesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ - name: Optional[str] + name: Optional[str] = None """ Filter the return volumes by their names. """ - product_resource_id: Optional[str] + product_resource_id: Optional[str] = None """ Filter by a product resource ID linked to this volume (such as an Instance ID). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. Only volumes with one or more matching tags will be returned. """ @@ -681,17 +685,17 @@ class UpdateSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ When defined, is the name of the snapshot. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ @@ -704,28 +708,28 @@ class UpdateVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ When defined, is the new name of the volume. """ - size: Optional[int] + size: Optional[int] = 0 """ Size in bytes of the volume, with a granularity of 1 GB (10^9 bytes). Must be compliant with the minimum (1GB) and maximum (10TB) allowed size. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the volume. """ - perf_iops: Optional[int] + perf_iops: Optional[int] = 0 """ The selected value must be available for the volume's current storage class. """ diff --git a/scaleway-async/scaleway_async/block/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/block/v1alpha1/marshalling.py index a2ae2b31e..3d00c18d2 100644 --- a/scaleway-async/scaleway_async/block/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/block/v1alpha1/marshalling.py @@ -13,6 +13,11 @@ resolve_one_of, ) from .types import ( + ReferenceStatus, + ReferenceType, + SnapshotStatus, + StorageClass, + VolumeStatus, Reference, SnapshotParentVolume, Snapshot, @@ -45,22 +50,32 @@ def unmarshal_Reference(data: Any) -> Reference: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("product_resource_type", None) if field is not None: args["product_resource_type"] = field + else: + args["product_resource_type"] = None field = data.get("product_resource_id", None) if field is not None: args["product_resource_id"] = field + else: + args["product_resource_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ReferenceType.UNKNOWN_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ReferenceStatus.UNKNOWN_STATUS field = data.get("created_at", None) if field is not None: @@ -82,18 +97,26 @@ def unmarshal_SnapshotParentVolume(data: Any) -> SnapshotParentVolume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = VolumeStatus.UNKNOWN_STATUS return SnapshotParentVolume(**args) @@ -109,40 +132,58 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("references", None) if field is not None: args["references"] = ( [unmarshal_Reference(v) for v in field] if field is not None else None ) + else: + args["references"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SnapshotStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = StorageClass.UNKNOWN_STORAGE_CLASS field = data.get("parent_volume", None) if field is not None: @@ -176,12 +217,14 @@ def unmarshal_VolumeSpecifications(data: Any) -> VolumeSpecifications: field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = StorageClass.UNKNOWN_STORAGE_CLASS field = data.get("perf_iops", None) if field is not None: args["perf_iops"] = field else: - args["perf_iops"] = None + args["perf_iops"] = 0 return VolumeSpecifications(**args) @@ -197,28 +240,40 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("references", None) if field is not None: args["references"] = ( [unmarshal_Reference(v) for v in field] if field is not None else None ) + else: + args["references"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -241,14 +296,20 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = VolumeStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("specs", None) if field is not None: @@ -280,10 +341,14 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSnapshotsResponse(**args) @@ -299,6 +364,8 @@ def unmarshal_VolumeType(data: Any) -> VolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("pricing", None) if field is not None: @@ -334,10 +401,14 @@ def unmarshal_ListVolumeTypesResponse(data: Any) -> ListVolumeTypesResponse: args["volume_types"] = ( [unmarshal_VolumeType(v) for v in field] if field is not None else None ) + else: + args["volume_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVolumeTypesResponse(**args) @@ -355,10 +426,14 @@ def unmarshal_ListVolumesResponse(data: Any) -> ListVolumesResponse: args["volumes"] = ( [unmarshal_Volume(v) for v in field] if field is not None else None ) + else: + args["volumes"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVolumesResponse(**args) @@ -376,7 +451,9 @@ def marshal_CreateSnapshotRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -446,7 +523,9 @@ def marshal_CreateVolumeRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -485,7 +564,9 @@ def marshal_ImportSnapshotFromObjectStorageRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -512,7 +593,9 @@ def marshal_ImportSnapshotFromS3Request( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway-async/scaleway_async/block/v1alpha1/types.py b/scaleway-async/scaleway_async/block/v1alpha1/types.py index 2f15d1ec0..282599100 100644 --- a/scaleway-async/scaleway_async/block/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/block/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -128,7 +128,7 @@ class Reference: Status of the reference. Statuses include `attaching`, `attached`, and `detaching`. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the reference. """ @@ -164,7 +164,7 @@ class VolumeSpecifications: The storage class of the volume. """ - perf_iops: Optional[int] + perf_iops: Optional[int] = 0 """ The maximum IO/s expected, according to the different options available in stock (`5000 | 15000`). """ @@ -185,7 +185,7 @@ class CreateVolumeRequestFromSnapshot: Source snapshot from which volume will be created. """ - size: Optional[int] + size: Optional[int] = 0 """ Must be compliant with the minimum (1 GB) and maximum (10 TB) allowed size. Size is optional and is used only if a resize of the volume is requested, otherwise original snapshot size will be used. @@ -239,17 +239,17 @@ class Snapshot: Storage class of the snapshot. """ - parent_volume: Optional[SnapshotParentVolume] + parent_volume: Optional[SnapshotParentVolume] = None """ If the parent volume was deleted, value is null. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the snapshot. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the properties of a snapshot. """ @@ -262,17 +262,17 @@ class VolumeType: Volume type. """ - pricing: Optional[Money] + pricing: Optional[Money] = None """ Price of the volume billed in GB/hour. """ - snapshot_pricing: Optional[Money] + snapshot_pricing: Optional[Money] = None """ Price of the snapshot billed in GB/hour. """ - specs: Optional[VolumeSpecifications] + specs: Optional[VolumeSpecifications] = None """ Volume specifications of the volume type. """ @@ -310,42 +310,42 @@ class Volume: List of the references to the volume. """ - created_at: Optional[datetime] + status: VolumeStatus """ - Creation date of the volume. + Current status of the volume (available, in_use, ...). """ - updated_at: Optional[datetime] + tags: List[str] """ - Last update of the properties of a volume. + List of tags assigned to the volume. """ - parent_snapshot_id: Optional[str] + zone: ScwZone """ - When a volume is created from a snapshot, is the UUID of the snapshot from which the volume has been created. + Volume zone. """ - status: VolumeStatus + created_at: Optional[datetime] = None """ - Current status of the volume (available, in_use, ...). + Creation date of the volume. """ - tags: List[str] + updated_at: Optional[datetime] = None """ - List of tags assigned to the volume. + Last update of the properties of a volume. """ - zone: ScwZone + parent_snapshot_id: Optional[str] = None """ - Volume zone. + When a volume is created from a snapshot, is the UUID of the snapshot from which the volume has been created. """ - specs: Optional[VolumeSpecifications] + specs: Optional[VolumeSpecifications] = None """ Specifications of the volume. """ - last_detached_at: Optional[datetime] + last_detached_at: Optional[datetime] = None """ Last time the volume was detached. """ @@ -358,22 +358,22 @@ class CreateSnapshotRequest: UUID of the volume to snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project to which the volume and the snapshot belong. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ @@ -381,31 +381,31 @@ class CreateSnapshotRequest: @dataclass class CreateVolumeRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the volume. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project the volume belongs to. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the volume. """ - from_empty: Optional[CreateVolumeRequestFromEmpty] + from_empty: Optional[CreateVolumeRequestFromEmpty] = None - from_snapshot: Optional[CreateVolumeRequestFromSnapshot] + from_snapshot: Optional[CreateVolumeRequestFromSnapshot] = None - perf_iops: Optional[int] + perf_iops: Optional[int] = None @dataclass @@ -415,7 +415,7 @@ class DeleteSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -428,7 +428,7 @@ class DeleteVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -451,7 +451,7 @@ class ExportSnapshotToObjectStorageRequest: The object key inside the given bucket. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -464,7 +464,7 @@ class GetSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -477,7 +477,7 @@ class GetVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -500,22 +500,22 @@ class ImportSnapshotFromObjectStorageRequest: Name of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project to which the volume and the snapshot belong. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ - size: Optional[int] + size: Optional[int] = 0 """ Size of the snapshot. """ @@ -538,22 +538,22 @@ class ImportSnapshotFromS3Request: Name of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project to which the volume and the snapshot belong. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ - size: Optional[int] + size: Optional[int] = 0 """ Size of the snapshot. """ @@ -561,47 +561,49 @@ class ImportSnapshotFromS3Request: @dataclass class ListSnapshotsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListSnapshotsRequestOrderBy] + order_by: Optional[ListSnapshotsRequestOrderBy] = ( + ListSnapshotsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ - volume_id: Optional[str] + volume_id: Optional[str] = None """ Filter snapshots by the ID of the original volume. """ - name: Optional[str] + name: Optional[str] = None """ Filter snapshots by their names. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. Only snapshots with one or more matching tags will be returned. """ @@ -622,17 +624,17 @@ class ListSnapshotsResponse: @dataclass class ListVolumeTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ @@ -653,47 +655,49 @@ class ListVolumeTypesResponse: @dataclass class ListVolumesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListVolumesRequestOrderBy] + order_by: Optional[ListVolumesRequestOrderBy] = ( + ListVolumesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ - name: Optional[str] + name: Optional[str] = None """ Filter the return volumes by their names. """ - product_resource_id: Optional[str] + product_resource_id: Optional[str] = None """ Filter by a product resource ID linked to this volume (such as an Instance ID). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. Only volumes with one or more matching tags will be returned. """ @@ -719,17 +723,17 @@ class UpdateSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ When defined, is the name of the snapshot. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ @@ -742,28 +746,28 @@ class UpdateVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ When defined, is the new name of the volume. """ - size: Optional[int] + size: Optional[int] = 0 """ Size in bytes of the volume, with a granularity of 1 GB (10^9 bytes). Must be compliant with the minimum (1GB) and maximum (10TB) allowed size. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the volume. """ - perf_iops: Optional[int] + perf_iops: Optional[int] = 0 """ The selected value must be available for the volume's current storage class. """ diff --git a/scaleway-async/scaleway_async/cockpit/v1/marshalling.py b/scaleway-async/scaleway_async/cockpit/v1/marshalling.py index c40e5ff04..f2e0843f8 100644 --- a/scaleway-async/scaleway_async/cockpit/v1/marshalling.py +++ b/scaleway-async/scaleway_async/cockpit/v1/marshalling.py @@ -10,7 +10,14 @@ resolve_one_of, ) from .types import ( + AlertState, + AlertStatus, + DataSourceOrigin, + DataSourceType, + GrafanaUserRole, + PlanName, TokenScope, + UsageUnit, ContactPointEmail, ContactPoint, DataSource, @@ -68,6 +75,8 @@ def unmarshal_ContactPointEmail(data: Any) -> ContactPointEmail: field = data.get("to", None) if field is not None: args["to"] = field + else: + args["to"] = None return ContactPointEmail(**args) @@ -83,10 +92,14 @@ def unmarshal_ContactPoint(data: Any) -> ContactPoint: field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("send_resolved_notifications", None) if field is not None: args["send_resolved_notifications"] = field + else: + args["send_resolved_notifications"] = False field = data.get("email", None) if field is not None: @@ -108,38 +121,56 @@ def unmarshal_DataSource(data: Any) -> DataSource: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = DataSourceType.UNKNOWN_TYPE field = data.get("origin", None) if field is not None: args["origin"] = field + else: + args["origin"] = DataSourceOrigin.UNKNOWN_ORIGIN field = data.get("synchronized_with_grafana", None) if field is not None: args["synchronized_with_grafana"] = field + else: + args["synchronized_with_grafana"] = False field = data.get("retention_days", None) if field is not None: args["retention_days"] = field + else: + args["retention_days"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -167,22 +198,32 @@ def unmarshal_GrafanaProductDashboard(data: Any) -> GrafanaProductDashboard: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("title", None) if field is not None: args["title"] = field + else: + args["title"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("variables", None) if field is not None: args["variables"] = field + else: + args["variables"] = field(default_factory=list) return GrafanaProductDashboard(**args) @@ -198,14 +239,20 @@ def unmarshal_GrafanaUser(data: Any) -> GrafanaUser: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("login", None) if field is not None: args["login"] = field + else: + args["login"] = None field = data.get("role", None) if field is not None: args["role"] = field + else: + args["role"] = GrafanaUserRole.UNKNOWN_ROLE field = data.get("password", None) if field is not None: @@ -227,22 +274,32 @@ def unmarshal_Plan(data: Any) -> Plan: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = PlanName.UNKNOWN_NAME field = data.get("sample_ingestion_price", None) if field is not None: args["sample_ingestion_price"] = field + else: + args["sample_ingestion_price"] = 0 field = data.get("logs_ingestion_price", None) if field is not None: args["logs_ingestion_price"] = field + else: + args["logs_ingestion_price"] = 0 field = data.get("traces_ingestion_price", None) if field is not None: args["traces_ingestion_price"] = field + else: + args["traces_ingestion_price"] = 0 field = data.get("monthly_price", None) if field is not None: args["monthly_price"] = field + else: + args["monthly_price"] = 0 field = data.get("retention_metrics_interval", None) if field is not None: @@ -276,22 +333,32 @@ def unmarshal_Token(data: Any) -> Token: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("scopes", None) if field is not None: args["scopes"] = [TokenScope(v) for v in field] if field is not None else None + else: + args["scopes"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -325,14 +392,20 @@ def unmarshal_AlertManager(data: Any) -> AlertManager: field = data.get("alert_manager_enabled", None) if field is not None: args["alert_manager_enabled"] = field + else: + args["alert_manager_enabled"] = False field = data.get("managed_alerts_enabled", None) if field is not None: args["managed_alerts_enabled"] = field + else: + args["managed_alerts_enabled"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("alert_manager_url", None) if field is not None: @@ -354,6 +427,8 @@ def unmarshal_DisableAlertRulesResponse(data: Any) -> DisableAlertRulesResponse: field = data.get("disabled_rule_ids", None) if field is not None: args["disabled_rule_ids"] = field + else: + args["disabled_rule_ids"] = field(default_factory=list) return DisableAlertRulesResponse(**args) @@ -369,6 +444,8 @@ def unmarshal_EnableAlertRulesResponse(data: Any) -> EnableAlertRulesResponse: field = data.get("enabled_rule_ids", None) if field is not None: args["enabled_rule_ids"] = field + else: + args["enabled_rule_ids"] = field(default_factory=list) return EnableAlertRulesResponse(**args) @@ -384,14 +461,20 @@ def unmarshal_GetConfigResponseRetention(data: Any) -> GetConfigResponseRetentio field = data.get("min_days", None) if field is not None: args["min_days"] = field + else: + args["min_days"] = None field = data.get("max_days", None) if field is not None: args["max_days"] = field + else: + args["max_days"] = None field = data.get("default_days", None) if field is not None: args["default_days"] = field + else: + args["default_days"] = None return GetConfigResponseRetention(**args) @@ -448,14 +531,20 @@ def unmarshal_RulesCount(data: Any) -> RulesCount: field = data.get("data_source_id", None) if field is not None: args["data_source_id"] = field + else: + args["data_source_id"] = None field = data.get("data_source_name", None) if field is not None: args["data_source_name"] = field + else: + args["data_source_name"] = None field = data.get("rules_count", None) if field is not None: args["rules_count"] = field + else: + args["rules_count"] = 0 return RulesCount(**args) @@ -473,14 +562,20 @@ def unmarshal_GetRulesCountResponse(data: Any) -> GetRulesCountResponse: args["rules_count_by_datasource"] = ( [unmarshal_RulesCount(v) for v in field] if field is not None else None ) + else: + args["rules_count_by_datasource"] = field(default_factory=list) field = data.get("preconfigured_rules_count", None) if field is not None: args["preconfigured_rules_count"] = field + else: + args["preconfigured_rules_count"] = 0 field = data.get("custom_rules_count", None) if field is not None: args["custom_rules_count"] = field + else: + args["custom_rules_count"] = 0 return GetRulesCountResponse(**args) @@ -496,6 +591,8 @@ def unmarshal_Grafana(data: Any) -> Grafana: field = data.get("grafana_url", None) if field is not None: args["grafana_url"] = field + else: + args["grafana_url"] = None return Grafana(**args) @@ -511,22 +608,32 @@ def unmarshal_PreconfiguredAlertData(data: Any) -> PreconfiguredAlertData: field = data.get("preconfigured_rule_id", None) if field is not None: args["preconfigured_rule_id"] = field + else: + args["preconfigured_rule_id"] = None field = data.get("display_name", None) if field is not None: args["display_name"] = field + else: + args["display_name"] = None field = data.get("display_description", None) if field is not None: args["display_description"] = field + else: + args["display_description"] = None field = data.get("product_name", None) if field is not None: args["product_name"] = field + else: + args["product_name"] = None field = data.get("product_family", None) if field is not None: args["product_family"] = field + else: + args["product_family"] = None return PreconfiguredAlertData(**args) @@ -542,40 +649,56 @@ def unmarshal_Alert(data: Any) -> Alert: field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("preconfigured", None) if field is not None: args["preconfigured"] = field + else: + args["preconfigured"] = False field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("rule", None) if field is not None: args["rule"] = field + else: + args["rule"] = None field = data.get("duration", None) if field is not None: args["duration"] = field + else: + args["duration"] = None field = data.get("rule_status", None) if field is not None: args["rule_status"] = field + else: + args["rule_status"] = AlertStatus.UNKNOWN_STATUS field = data.get("annotations", None) if field is not None: args["annotations"] = field + else: + args["annotations"] = field(default_factory=dict) field = data.get("data_source_id", None) if field is not None: args["data_source_id"] = field + else: + args["data_source_id"] = None field = data.get("state", None) if field is not None: args["state"] = field else: - args["state"] = None + args["state"] = AlertState.UNKNOWN_STATE field = data.get("preconfigured_data", None) if field is not None: @@ -597,12 +720,16 @@ def unmarshal_ListAlertsResponse(data: Any) -> ListAlertsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("alerts", None) if field is not None: args["alerts"] = ( [unmarshal_Alert(v) for v in field] if field is not None else None ) + else: + args["alerts"] = field(default_factory=list) return ListAlertsResponse(**args) @@ -618,20 +745,28 @@ def unmarshal_ListContactPointsResponse(data: Any) -> ListContactPointsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("contact_points", None) if field is not None: args["contact_points"] = ( [unmarshal_ContactPoint(v) for v in field] if field is not None else None ) + else: + args["contact_points"] = field(default_factory=list) field = data.get("has_additional_receivers", None) if field is not None: args["has_additional_receivers"] = field + else: + args["has_additional_receivers"] = False field = data.get("has_additional_contact_points", None) if field is not None: args["has_additional_contact_points"] = field + else: + args["has_additional_contact_points"] = False return ListContactPointsResponse(**args) @@ -647,12 +782,16 @@ def unmarshal_ListDataSourcesResponse(data: Any) -> ListDataSourcesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("data_sources", None) if field is not None: args["data_sources"] = ( [unmarshal_DataSource(v) for v in field] if field is not None else None ) + else: + args["data_sources"] = field(default_factory=list) return ListDataSourcesResponse(**args) @@ -670,6 +809,8 @@ def unmarshal_ListGrafanaProductDashboardsResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("dashboards", None) if field is not None: @@ -678,6 +819,8 @@ def unmarshal_ListGrafanaProductDashboardsResponse( if field is not None else None ) + else: + args["dashboards"] = field(default_factory=list) return ListGrafanaProductDashboardsResponse(**args) @@ -693,12 +836,16 @@ def unmarshal_ListGrafanaUsersResponse(data: Any) -> ListGrafanaUsersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("grafana_users", None) if field is not None: args["grafana_users"] = ( [unmarshal_GrafanaUser(v) for v in field] if field is not None else None ) + else: + args["grafana_users"] = field(default_factory=list) return ListGrafanaUsersResponse(**args) @@ -714,12 +861,16 @@ def unmarshal_ListPlansResponse(data: Any) -> ListPlansResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("plans", None) if field is not None: args["plans"] = ( [unmarshal_Plan(v) for v in field] if field is not None else None ) + else: + args["plans"] = field(default_factory=list) return ListPlansResponse(**args) @@ -735,12 +886,16 @@ def unmarshal_ListTokensResponse(data: Any) -> ListTokensResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("tokens", None) if field is not None: args["tokens"] = ( [unmarshal_Token(v) for v in field] if field is not None else None ) + else: + args["tokens"] = field(default_factory=list) return ListTokensResponse(**args) @@ -756,26 +911,38 @@ def unmarshal_Usage(data: Any) -> Usage: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("data_source_origin", None) if field is not None: args["data_source_origin"] = field + else: + args["data_source_origin"] = DataSourceOrigin.UNKNOWN_ORIGIN field = data.get("data_source_type", None) if field is not None: args["data_source_type"] = field + else: + args["data_source_type"] = DataSourceType.UNKNOWN_TYPE field = data.get("unit", None) if field is not None: args["unit"] = field + else: + args["unit"] = UsageUnit.UNKNOWN_UNIT field = data.get("quantity_over_interval", None) if field is not None: args["quantity_over_interval"] = field + else: + args["quantity_over_interval"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("data_source_id", None) if field is not None: @@ -843,10 +1010,12 @@ def marshal_GlobalApiCreateGrafanaUserRequest( output["login"] = request.login if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.role is not None: - output["role"] = str(request.role) + output["role"] = request.role return output @@ -858,7 +1027,9 @@ def marshal_GlobalApiResetGrafanaUserPasswordRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -870,10 +1041,12 @@ def marshal_GlobalApiSelectPlanRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.plan_name is not None: - output["plan_name"] = str(request.plan_name) + output["plan_name"] = request.plan_name return output @@ -885,7 +1058,9 @@ def marshal_GlobalApiSyncGrafanaDataSourcesRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -920,7 +1095,9 @@ def marshal_RegionalApiCreateContactPointRequest( ) if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.send_resolved_notifications is not None: output["send_resolved_notifications"] = request.send_resolved_notifications @@ -938,10 +1115,12 @@ def marshal_RegionalApiCreateDataSourceRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.retention_days is not None: output["retention_days"] = request.retention_days @@ -959,7 +1138,9 @@ def marshal_RegionalApiCreateTokenRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.token_scopes is not None: output["token_scopes"] = [str(item) for item in request.token_scopes] @@ -985,7 +1166,9 @@ def marshal_RegionalApiDeleteContactPointRequest( ) if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -997,7 +1180,9 @@ def marshal_RegionalApiDisableAlertManagerRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1009,7 +1194,9 @@ def marshal_RegionalApiDisableAlertRulesRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.rule_ids is not None: output["rule_ids"] = request.rule_ids @@ -1024,7 +1211,9 @@ def marshal_RegionalApiDisableManagedAlertsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1036,7 +1225,9 @@ def marshal_RegionalApiEnableAlertManagerRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1048,7 +1239,9 @@ def marshal_RegionalApiEnableAlertRulesRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.rule_ids is not None: output["rule_ids"] = request.rule_ids @@ -1063,7 +1256,9 @@ def marshal_RegionalApiEnableManagedAlertsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1075,7 +1270,9 @@ def marshal_RegionalApiTriggerTestAlertRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1098,7 +1295,9 @@ def marshal_RegionalApiUpdateContactPointRequest( ) if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.send_resolved_notifications is not None: output["send_resolved_notifications"] = request.send_resolved_notifications diff --git a/scaleway-async/scaleway_async/cockpit/v1/types.py b/scaleway-async/scaleway_async/cockpit/v1/types.py index b953f921c..2ed41cfcc 100644 --- a/scaleway-async/scaleway_async/cockpit/v1/types.py +++ b/scaleway-async/scaleway_async/cockpit/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -178,9 +178,7 @@ class ContactPointEmail: @dataclass class GetConfigResponseRetention: min_days: int - max_days: int - default_days: int @@ -248,12 +246,12 @@ class Alert: ID of the data source containing the alert rule. """ - state: Optional[AlertState] + state: Optional[AlertState] = AlertState.UNKNOWN_STATE """ Current state of the alert. Possible states are `inactive`, `pending`, and `firing`. """ - preconfigured_data: Optional[PreconfiguredAlertData] + preconfigured_data: Optional[PreconfiguredAlertData] = None """ Contains additional data for preconfigured alerts, such as the rule ID, display name, and description. Only present if the alert is preconfigured. """ @@ -275,7 +273,7 @@ class ContactPoint: Send an email notification when an alert is marked as resolved. """ - email: Optional[ContactPointEmail] + email: Optional[ContactPointEmail] = None @dataclass @@ -329,12 +327,12 @@ class DataSource: Region of the data source. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the data source was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the data source was last updated. """ @@ -393,7 +391,7 @@ class GrafanaUser: Role assigned to the Grafana user. """ - password: Optional[str] + password: Optional[str] = None """ Grafana user's password. """ @@ -430,17 +428,17 @@ class Plan: Retention price in euros per month. """ - retention_metrics_interval: Optional[str] + retention_metrics_interval: Optional[str] = None """ Interval of time during which Scaleway's Cockpit keeps your metrics. """ - retention_logs_interval: Optional[str] + retention_logs_interval: Optional[str] = None """ Interval of time during which Scaleway's Cockpit keeps your logs. """ - retention_traces_interval: Optional[str] + retention_traces_interval: Optional[str] = None """ Interval of time during which Scaleway's Cockpit keeps your traces. """ @@ -477,17 +475,17 @@ class Token: Regions where the token is located. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Token creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Token last modification date. """ - secret_key: Optional[str] + secret_key: Optional[str] = None """ Token secret key. """ @@ -529,12 +527,12 @@ class Usage: Region of the data source usage. """ - data_source_id: Optional[str] + data_source_id: Optional[str] = None """ ID of the data source. """ - interval: Optional[str] + interval: Optional[str] = None """ Interval for the data source usage. """ @@ -561,7 +559,7 @@ class AlertManager: Regions where the Alert manager is enabled. """ - alert_manager_url: Optional[str] + alert_manager_url: Optional[str] = None """ Alert manager URL. """ @@ -597,27 +595,27 @@ class GetConfigResponse: Cockpit configuration. """ - custom_metrics_retention: Optional[GetConfigResponseRetention] + custom_metrics_retention: Optional[GetConfigResponseRetention] = None """ Custom metrics retention configuration. """ - custom_logs_retention: Optional[GetConfigResponseRetention] + custom_logs_retention: Optional[GetConfigResponseRetention] = None """ Custom logs retention configuration. """ - custom_traces_retention: Optional[GetConfigResponseRetention] + custom_traces_retention: Optional[GetConfigResponseRetention] = None """ Custom traces retention configuration. """ - product_metrics_retention: Optional[GetConfigResponseRetention] + product_metrics_retention: Optional[GetConfigResponseRetention] = None """ Scaleway metrics retention configuration. """ - product_logs_retention: Optional[GetConfigResponseRetention] + product_logs_retention: Optional[GetConfigResponseRetention] = None """ Scaleway logs retention configuration. """ @@ -652,12 +650,12 @@ class GlobalApiCreateGrafanaUserRequest: Username of the Grafana user. Note that the `admin` username is not available for creation. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project in which to create the Grafana user. """ - role: Optional[GrafanaUserRole] + role: Optional[GrafanaUserRole] = GrafanaUserRole.UNKNOWN_ROLE """ Role assigned to the Grafana user. """ @@ -669,14 +667,14 @@ class GlobalApiDeleteGrafanaUserRequest: Delete a Grafana user. """ - project_id: Optional[str] + grafana_user_id: int """ - ID of the Project to target. + ID of the Grafana user. """ - grafana_user_id: int + project_id: Optional[str] = None """ - ID of the Grafana user. + ID of the Project to target. """ @@ -686,7 +684,7 @@ class GlobalApiGetCurrentPlanRequest: Retrieve a pricing plan for the given Project. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -698,14 +696,14 @@ class GlobalApiGetGrafanaProductDashboardRequest: Retrieve a specific dashboard. """ - project_id: Optional[str] + dashboard_name: str """ - ID of the Project the dashboard belongs to. + Name of the dashboard. """ - dashboard_name: str + project_id: Optional[str] = None """ - Name of the dashboard. + ID of the Project the dashboard belongs to. """ @@ -715,7 +713,7 @@ class GlobalApiGetGrafanaRequest: Request a Grafana. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -727,22 +725,22 @@ class GlobalApiListGrafanaProductDashboardsRequest: Retrieve a list of available product dashboards. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. """ @@ -754,22 +752,24 @@ class GlobalApiListGrafanaUsersRequest: List all Grafana users. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size. """ - order_by: Optional[ListGrafanaUsersRequestOrderBy] + order_by: Optional[ListGrafanaUsersRequestOrderBy] = ( + ListGrafanaUsersRequestOrderBy.LOGIN_ASC + ) """ Order of the Grafana users. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ @@ -781,17 +781,17 @@ class GlobalApiListPlansRequest: Retrieve a list of available pricing plans. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size. """ - order_by: Optional[ListPlansRequestOrderBy] + order_by: Optional[ListPlansRequestOrderBy] = ListPlansRequestOrderBy.NAME_ASC @dataclass @@ -800,14 +800,14 @@ class GlobalApiResetGrafanaUserPasswordRequest: Reset a Grafana user's password. """ - project_id: Optional[str] + grafana_user_id: int """ - ID of the Project to target. + ID of the Grafana user. """ - grafana_user_id: int + project_id: Optional[str] = None """ - ID of the Grafana user. + ID of the Project to target. """ @@ -817,12 +817,12 @@ class GlobalApiSelectPlanRequest: Select a specific pricing plan. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ - plan_name: Optional[PlanName] + plan_name: Optional[PlanName] = PlanName.UNKNOWN_NAME """ Name of the pricing plan. """ @@ -834,7 +834,7 @@ class GlobalApiSyncGrafanaDataSourcesRequest: Trigger the synchronization of all data sources created in the relevant regions. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ @@ -987,22 +987,22 @@ class RegionalApiCreateContactPointRequest: Create a contact point. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to create the contact point in. """ - send_resolved_notifications: Optional[bool] + send_resolved_notifications: Optional[bool] = False """ Send an email notification when an alert is marked as resolved. """ - email: Optional[ContactPointEmail] + email: Optional[ContactPointEmail] = None @dataclass @@ -1016,22 +1016,22 @@ class RegionalApiCreateDataSourceRequest: Data source name. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project the data source belongs to. """ - type_: Optional[DataSourceType] + type_: Optional[DataSourceType] = DataSourceType.UNKNOWN_TYPE """ Data source type. """ - retention_days: Optional[int] + retention_days: Optional[int] = 0 """ Default values are 31 days for metrics, 7 days for logs and traces. """ @@ -1048,17 +1048,17 @@ class RegionalApiCreateTokenRequest: Name of the token. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project the token belongs to. """ - token_scopes: Optional[List[TokenScope]] + token_scopes: Optional[List[TokenScope]] = field(default_factory=list) """ Token permission scopes. """ @@ -1070,17 +1070,17 @@ class RegionalApiDeleteContactPointRequest: Delete a contact point. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the contact point to delete. """ - email: Optional[ContactPointEmail] + email: Optional[ContactPointEmail] = None @dataclass @@ -1094,7 +1094,7 @@ class RegionalApiDeleteDataSourceRequest: ID of the data source to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1111,7 +1111,7 @@ class RegionalApiDeleteTokenRequest: ID of the token to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1123,12 +1123,12 @@ class RegionalApiDisableAlertManagerRequest: Disable the Alert manager. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to disable the Alert manager in. """ @@ -1136,17 +1136,17 @@ class RegionalApiDisableAlertManagerRequest: @dataclass class RegionalApiDisableAlertRulesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ - rule_ids: Optional[List[str]] + rule_ids: Optional[List[str]] = field(default_factory=list) """ List of IDs of the rules to enable. If empty, disables all preconfigured rules. """ @@ -1158,12 +1158,12 @@ class RegionalApiDisableManagedAlertsRequest: Disable the sending of managed alerts. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1175,12 +1175,12 @@ class RegionalApiEnableAlertManagerRequest: Enable the Alert manager. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to enable the Alert manager in. """ @@ -1188,17 +1188,17 @@ class RegionalApiEnableAlertManagerRequest: @dataclass class RegionalApiEnableAlertRulesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ - rule_ids: Optional[List[str]] + rule_ids: Optional[List[str]] = field(default_factory=list) """ List of IDs of the rules to enable. If empty, enables all preconfigured rules. """ @@ -1210,12 +1210,12 @@ class RegionalApiEnableManagedAlertsRequest: Enable the sending of managed alerts. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1227,12 +1227,12 @@ class RegionalApiGetAlertManagerRequest: Get the Alert manager. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the requested Alert manager. """ @@ -1244,7 +1244,7 @@ class RegionalApiGetConfigRequest: Get Cockpit configuration. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1261,7 +1261,7 @@ class RegionalApiGetDataSourceRequest: ID of the relevant data source. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1269,12 +1269,12 @@ class RegionalApiGetDataSourceRequest: @dataclass class RegionalApiGetRulesCountRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to retrieve the rule count for. """ @@ -1291,7 +1291,7 @@ class RegionalApiGetTokenRequest: Token ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1299,14 +1299,13 @@ class RegionalApiGetTokenRequest: @dataclass class RegionalApiGetUsageOverviewRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] - - interval: Optional[str] + project_id: Optional[str] = None + interval: Optional[str] = None @dataclass @@ -1315,32 +1314,32 @@ class RegionalApiListAlertsRequest: Retrieve a list of alerts. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only alerts from this Project will be returned. """ - rule_status: Optional[AlertStatus] + rule_status: Optional[AlertStatus] = AlertStatus.UNKNOWN_STATUS """ Returns only alerts with the given activation status. If omitted, no alert filtering is applied. Other filters may still apply. """ - is_preconfigured: Optional[bool] + is_preconfigured: Optional[bool] = False """ True returns only preconfigured alerts. False returns only custom alerts. If omitted, no filtering is applied on alert types. Other filters may still apply. """ - state: Optional[AlertState] + state: Optional[AlertState] = AlertState.UNKNOWN_STATE """ Valid values to filter on are `inactive`, `pending` and `firing`. If omitted, no filtering is applied on alert states. Other filters may still apply. """ - data_source_id: Optional[str] + data_source_id: Optional[str] = None """ If omitted, only alerts from the default Scaleway metrics data source will be listed. """ @@ -1352,22 +1351,22 @@ class RegionalApiListContactPointsRequest: List contact points. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Total count of contact points to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the contact points to list. """ @@ -1379,37 +1378,39 @@ class RegionalApiListDataSourcesRequest: List data sources. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of data sources to return per page. """ - order_by: Optional[ListDataSourcesRequestOrderBy] + order_by: Optional[ListDataSourcesRequestOrderBy] = ( + ListDataSourcesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for data sources in the response. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only data sources from this Project will be returned. """ - origin: Optional[DataSourceOrigin] + origin: Optional[DataSourceOrigin] = DataSourceOrigin.UNKNOWN_ORIGIN """ Origin to filter for, only data sources with matching origin will be returned. If omitted, all types will be returned. """ - types: Optional[List[DataSourceType]] + types: Optional[List[DataSourceType]] = field(default_factory=list) """ Types to filter for (metrics, logs, traces), only data sources with matching types will be returned. If omitted, all types will be returned. """ @@ -1421,32 +1422,34 @@ class RegionalApiListTokensRequest: List tokens. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of tokens to return per page. """ - order_by: Optional[ListTokensRequestOrderBy] + order_by: Optional[ListTokensRequestOrderBy] = ( + ListTokensRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project the tokens belong to. """ - token_scopes: Optional[List[TokenScope]] + token_scopes: Optional[List[TokenScope]] = field(default_factory=list) """ Token scopes to filter for. """ @@ -1458,12 +1461,12 @@ class RegionalApiTriggerTestAlertRequest: Request to trigger a test alert. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1475,22 +1478,22 @@ class RegionalApiUpdateContactPointRequest: Update a contact point. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the contact point to update. """ - send_resolved_notifications: Optional[bool] + send_resolved_notifications: Optional[bool] = False """ Enable or disable notifications when alert is resolved. """ - email: Optional[ContactPointEmail] + email: Optional[ContactPointEmail] = None @dataclass @@ -1504,17 +1507,17 @@ class RegionalApiUpdateDataSourceRequest: ID of the data source to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Updated name of the data source. """ - retention_days: Optional[int] + retention_days: Optional[int] = 0 """ Duration for which the data will be retained in the data source. """ @@ -1522,12 +1525,8 @@ class RegionalApiUpdateDataSourceRequest: @dataclass class UsageOverview: - scaleway_metrics_usage: Optional[Usage] - - scaleway_logs_usage: Optional[Usage] - - external_metrics_usage: Optional[Usage] - - external_logs_usage: Optional[Usage] - - external_traces_usage: Optional[Usage] + scaleway_metrics_usage: Optional[Usage] = None + scaleway_logs_usage: Optional[Usage] = None + external_metrics_usage: Optional[Usage] = None + external_logs_usage: Optional[Usage] = None + external_traces_usage: Optional[Usage] = None diff --git a/scaleway-async/scaleway_async/container/v1beta1/marshalling.py b/scaleway-async/scaleway_async/container/v1beta1/marshalling.py index 3e059aede..5326db212 100644 --- a/scaleway-async/scaleway_async/container/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/container/v1beta1/marshalling.py @@ -10,6 +10,17 @@ resolve_one_of, ) from .types import ( + ContainerHttpOption, + ContainerPrivacy, + ContainerProtocol, + ContainerSandbox, + ContainerStatus, + CronStatus, + DomainStatus, + NamespaceStatus, + TokenStatus, + TriggerInputType, + TriggerStatus, ContainerHealthCheckSpecHTTPProbe, ContainerHealthCheckSpecTCPProbe, ContainerHealthCheckSpec, @@ -61,6 +72,8 @@ def unmarshal_ContainerHealthCheckSpecHTTPProbe( field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None return ContainerHealthCheckSpecHTTPProbe(**args) @@ -89,6 +102,8 @@ def unmarshal_ContainerHealthCheckSpec(data: Any) -> ContainerHealthCheckSpec: field = data.get("failure_threshold", None) if field is not None: args["failure_threshold"] = field + else: + args["failure_threshold"] = 0 field = data.get("http", None) if field is not None: @@ -151,10 +166,14 @@ def unmarshal_SecretHashedValue(data: Any) -> SecretHashedValue: field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None field = data.get("hashed_value", None) if field is not None: args["hashed_value"] = field + else: + args["hashed_value"] = None return SecretHashedValue(**args) @@ -170,54 +189,80 @@ def unmarshal_Container(data: Any) -> Container: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("namespace_id", None) if field is not None: args["namespace_id"] = field + else: + args["namespace_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ContainerStatus.UNKNOWN field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = field(default_factory=dict) field = data.get("min_scale", None) if field is not None: args["min_scale"] = field + else: + args["min_scale"] = 0 field = data.get("max_scale", None) if field is not None: args["max_scale"] = field + else: + args["max_scale"] = 0 field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field + else: + args["memory_limit"] = 0 field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field + else: + args["cpu_limit"] = 0 field = data.get("privacy", None) if field is not None: args["privacy"] = field + else: + args["privacy"] = ContainerPrivacy.UNKNOWN_PRIVACY field = data.get("registry_image", None) if field is not None: args["registry_image"] = field + else: + args["registry_image"] = None field = data.get("max_concurrency", None) if field is not None: args["max_concurrency"] = field + else: + args["max_concurrency"] = 0 field = data.get("domain_name", None) if field is not None: args["domain_name"] = field + else: + args["domain_name"] = None field = data.get("timeout", None) if field is not None: @@ -240,10 +285,14 @@ def unmarshal_Container(data: Any) -> Container: field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = ContainerProtocol.UNKNOWN_PROTOCOL field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("secret_environment_variables", None) if field is not None: @@ -252,18 +301,26 @@ def unmarshal_Container(data: Any) -> Container: if field is not None else None ) + else: + args["secret_environment_variables"] = field(default_factory=list) field = data.get("http_option", None) if field is not None: args["http_option"] = field + else: + args["http_option"] = ContainerHttpOption.UNKNOWN_HTTP_OPTION field = data.get("sandbox", None) if field is not None: args["sandbox"] = field + else: + args["sandbox"] = ContainerSandbox.UNKNOWN_SANDBOX field = data.get("local_storage_limit", None) if field is not None: args["local_storage_limit"] = field + else: + args["local_storage_limit"] = 0 field = data.get("scaling_option", None) if field is not None: @@ -274,18 +331,26 @@ def unmarshal_Container(data: Any) -> Container: field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("command", None) if field is not None: args["command"] = field + else: + args["command"] = field(default_factory=list) field = data.get("args", None) if field is not None: args["args"] = field + else: + args["args"] = field(default_factory=list) field = data.get("health_check", None) if field is not None: @@ -331,28 +396,38 @@ def unmarshal_Cron(data: Any) -> Cron: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("container_id", None) if field is not None: args["container_id"] = field + else: + args["container_id"] = None field = data.get("schedule", None) if field is not None: args["schedule"] = field + else: + args["schedule"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = CronStatus.UNKNOWN field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("args", None) if field is not None: args["args"] = field else: - args["args"] = None + args["args"] = field(default_factory=dict) return Cron(**args) @@ -368,22 +443,32 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("container_id", None) if field is not None: args["container_id"] = field + else: + args["container_id"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainStatus.UNKNOWN field = data.get("error_message", None) if field is not None: @@ -405,30 +490,44 @@ def unmarshal_Namespace(data: Any) -> Namespace: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = field(default_factory=dict) field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = NamespaceStatus.UNKNOWN field = data.get("registry_namespace_id", None) if field is not None: args["registry_namespace_id"] = field + else: + args["registry_namespace_id"] = None field = data.get("error_message", None) if field is not None: @@ -439,6 +538,8 @@ def unmarshal_Namespace(data: Any) -> Namespace: field = data.get("registry_endpoint", None) if field is not None: args["registry_endpoint"] = field + else: + args["registry_endpoint"] = None field = data.get("secret_environment_variables", None) if field is not None: @@ -447,14 +548,20 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None else None ) + else: + args["secret_environment_variables"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("description", None) if field is not None: @@ -478,7 +585,7 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None: args["vpc_integration_activated"] = field else: - args["vpc_integration_activated"] = None + args["vpc_integration_activated"] = False return Namespace(**args) @@ -494,14 +601,20 @@ def unmarshal_Token(data: Any) -> Token: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("token", None) if field is not None: args["token"] = field + else: + args["token"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TokenStatus.UNKNOWN field = data.get("container_id", None) if field is not None: @@ -547,18 +660,26 @@ def unmarshal_TriggerMnqNatsClientConfig(data: Any) -> TriggerMnqNatsClientConfi field = data.get("subject", None) if field is not None: args["subject"] = field + else: + args["subject"] = None field = data.get("mnq_nats_account_id", None) if field is not None: args["mnq_nats_account_id"] = field + else: + args["mnq_nats_account_id"] = None field = data.get("mnq_project_id", None) if field is not None: args["mnq_project_id"] = field + else: + args["mnq_project_id"] = None field = data.get("mnq_region", None) if field is not None: args["mnq_region"] = field + else: + args["mnq_region"] = None field = data.get("mnq_credential_id", None) if field is not None: @@ -580,14 +701,20 @@ def unmarshal_TriggerMnqSqsClientConfig(data: Any) -> TriggerMnqSqsClientConfig: field = data.get("queue", None) if field is not None: args["queue"] = field + else: + args["queue"] = None field = data.get("mnq_project_id", None) if field is not None: args["mnq_project_id"] = field + else: + args["mnq_project_id"] = None field = data.get("mnq_region", None) if field is not None: args["mnq_region"] = field + else: + args["mnq_region"] = None field = data.get("mnq_credential_id", None) if field is not None: @@ -609,18 +736,26 @@ def unmarshal_TriggerSqsClientConfig(data: Any) -> TriggerSqsClientConfig: field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("queue_url", None) if field is not None: args["queue_url"] = field + else: + args["queue_url"] = None field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None field = data.get("secret_key", None) if field is not None: args["secret_key"] = field + else: + args["secret_key"] = None return TriggerSqsClientConfig(**args) @@ -636,26 +771,38 @@ def unmarshal_Trigger(data: Any) -> Trigger: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("container_id", None) if field is not None: args["container_id"] = field + else: + args["container_id"] = None field = data.get("input_type", None) if field is not None: args["input_type"] = field + else: + args["input_type"] = TriggerInputType.UNKNOWN_INPUT_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TriggerStatus.UNKNOWN_STATUS field = data.get("error_message", None) if field is not None: @@ -697,10 +844,14 @@ def unmarshal_ListContainersResponse(data: Any) -> ListContainersResponse: args["containers"] = ( [unmarshal_Container(v) for v in field] if field is not None else None ) + else: + args["containers"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListContainersResponse(**args) @@ -718,10 +869,14 @@ def unmarshal_ListCronsResponse(data: Any) -> ListCronsResponse: args["crons"] = ( [unmarshal_Cron(v) for v in field] if field is not None else None ) + else: + args["crons"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListCronsResponse(**args) @@ -739,10 +894,14 @@ def unmarshal_ListDomainsResponse(data: Any) -> ListDomainsResponse: args["domains"] = ( [unmarshal_Domain(v) for v in field] if field is not None else None ) + else: + args["domains"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDomainsResponse(**args) @@ -760,10 +919,14 @@ def unmarshal_ListNamespacesResponse(data: Any) -> ListNamespacesResponse: args["namespaces"] = ( [unmarshal_Namespace(v) for v in field] if field is not None else None ) + else: + args["namespaces"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNamespacesResponse(**args) @@ -781,10 +944,14 @@ def unmarshal_ListTokensResponse(data: Any) -> ListTokensResponse: args["tokens"] = ( [unmarshal_Token(v) for v in field] if field is not None else None ) + else: + args["tokens"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListTokensResponse(**args) @@ -800,12 +967,16 @@ def unmarshal_ListTriggersResponse(data: Any) -> ListTriggersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("triggers", None) if field is not None: args["triggers"] = ( [unmarshal_Trigger(v) for v in field] if field is not None else None ) + else: + args["triggers"] = field(default_factory=list) return ListTriggersResponse(**args) @@ -938,7 +1109,7 @@ def marshal_CreateContainerRequest( output["timeout"] = request.timeout if request.privacy is not None: - output["privacy"] = str(request.privacy) + output["privacy"] = request.privacy if request.description is not None: output["description"] = request.description @@ -950,7 +1121,7 @@ def marshal_CreateContainerRequest( output["max_concurrency"] = request.max_concurrency if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.port is not None: output["port"] = request.port @@ -962,10 +1133,10 @@ def marshal_CreateContainerRequest( ] if request.http_option is not None: - output["http_option"] = str(request.http_option) + output["http_option"] = request.http_option if request.sandbox is not None: - output["sandbox"] = str(request.sandbox) + output["sandbox"] = request.sandbox if request.local_storage_limit is not None: output["local_storage_limit"] = request.local_storage_limit @@ -1047,7 +1218,9 @@ def marshal_CreateNamespaceRequest( output["environment_variables"] = request.environment_variables if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.description is not None: output["description"] = request.description @@ -1218,7 +1391,7 @@ def marshal_UpdateContainerRequest( output["redeploy"] = request.redeploy if request.privacy is not None: - output["privacy"] = str(request.privacy) + output["privacy"] = request.privacy if request.description is not None: output["description"] = request.description @@ -1230,7 +1403,7 @@ def marshal_UpdateContainerRequest( output["max_concurrency"] = request.max_concurrency if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.port is not None: output["port"] = request.port @@ -1242,10 +1415,10 @@ def marshal_UpdateContainerRequest( ] if request.http_option is not None: - output["http_option"] = str(request.http_option) + output["http_option"] = request.http_option if request.sandbox is not None: - output["sandbox"] = str(request.sandbox) + output["sandbox"] = request.sandbox if request.local_storage_limit is not None: output["local_storage_limit"] = request.local_storage_limit diff --git a/scaleway-async/scaleway_async/container/v1beta1/types.py b/scaleway-async/scaleway_async/container/v1beta1/types.py index f782b8c8f..7545093fa 100644 --- a/scaleway-async/scaleway_async/container/v1beta1/types.py +++ b/scaleway-async/scaleway_async/container/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Any, Dict, List, Optional @@ -212,29 +212,28 @@ class ContainerHealthCheckSpec: As a result, lowering this value can help to reduce the time it takes to detect a failed deployment. """ - interval: Optional[str] + interval: Optional[str] = None """ Period between health checks. """ - http: Optional[ContainerHealthCheckSpecHTTPProbe] + http: Optional[ContainerHealthCheckSpecHTTPProbe] = None - tcp: Optional[ContainerHealthCheckSpecTCPProbe] + tcp: Optional[ContainerHealthCheckSpecTCPProbe] = None @dataclass class ContainerScalingOption: - concurrent_requests_threshold: Optional[int] + concurrent_requests_threshold: Optional[int] = None - cpu_usage_threshold: Optional[int] + cpu_usage_threshold: Optional[int] = None - memory_usage_threshold: Optional[int] + memory_usage_threshold: Optional[int] = None @dataclass class SecretHashedValue: key: str - hashed_value: str @@ -260,7 +259,7 @@ class TriggerMnqNatsClientConfig: Currently, only the `fr-par` and `nl-ams` regions are available. """ - mnq_credential_id: Optional[str] + mnq_credential_id: Optional[str] = None """ ID of the Messaging and Queuing credentials used to subscribe to the NATS subject. """ @@ -283,7 +282,7 @@ class TriggerMnqSqsClientConfig: Currently, only the `fr-par` and `nl-ams` regions are available. """ - mnq_credential_id: Optional[str] + mnq_credential_id: Optional[str] = None """ ID of the Messaging and Queuing credentials used to read from the SQS queue. """ @@ -292,19 +291,15 @@ class TriggerMnqSqsClientConfig: @dataclass class TriggerSqsClientConfig: endpoint: str - queue_url: str - access_key: str - secret_key: str @dataclass class Secret: key: str - - value: Optional[str] + value: Optional[str] = None @dataclass @@ -351,11 +346,8 @@ class CreateTriggerRequestMnqSqsClientConfig: @dataclass class CreateTriggerRequestSqsClientConfig: endpoint: str - queue_url: str - access_key: str - secret_key: str @@ -426,21 +418,6 @@ class Container: Domain name attributed to the contaioner. """ - timeout: Optional[str] - """ - Processing time limit for the container. - """ - - error_message: Optional[str] - """ - Last error message of the container. - """ - - description: Optional[str] - """ - Description of the container. - """ - protocol: ContainerProtocol """ Protocol the container uses. @@ -473,14 +450,6 @@ class Container: Local storage limit of the container (in MB). """ - scaling_option: Optional[ContainerScalingOption] - """ - Possible values: -- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. -- cpu_usage_threshold: Scale depending on the CPU usage of a container instance. -- memory_usage_threshold: Scale depending on the memory usage of a container instance. - """ - region: ScwRegion """ Region in which the container will be deployed. @@ -501,27 +470,50 @@ class Container: Arguments passed to the command specified in the "command" field. These override the default arguments from the container image, and behave like command-line parameters. """ - health_check: Optional[ContainerHealthCheckSpec] + timeout: Optional[str] = None + """ + Processing time limit for the container. + """ + + error_message: Optional[str] = None + """ + Last error message of the container. + """ + + description: Optional[str] = None + """ + Description of the container. + """ + + scaling_option: Optional[ContainerScalingOption] = None + """ + Possible values: +- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. +- cpu_usage_threshold: Scale depending on the CPU usage of a container instance. +- memory_usage_threshold: Scale depending on the memory usage of a container instance. + """ + + health_check: Optional[ContainerHealthCheckSpec] = None """ Health check configuration of the container. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the container. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the container. """ - ready_at: Optional[datetime] + ready_at: Optional[datetime] = None """ Last date when the container was successfully deployed and set to ready. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the container can access other Scaleway resources in this Private Network. """ @@ -554,7 +546,7 @@ class Cron: Name of the cron. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to pass with the cron. """ @@ -587,7 +579,7 @@ class Domain: Status of the domain. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Last error message of the domain. """ @@ -630,11 +622,6 @@ class Namespace: UUID of the registry namespace. """ - error_message: Optional[str] - """ - Last error message of the namesace. - """ - registry_endpoint: str """ Registry endpoint of the namespace. @@ -655,22 +642,27 @@ class Namespace: List of tags applied to the Serverless Container Namespace. """ - description: Optional[str] + error_message: Optional[str] = None + """ + Last error message of the namesace. + """ + + description: Optional[str] = None """ Description of the endpoint. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the namespace. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the namespace. """ - vpc_integration_activated: Optional[bool] + vpc_integration_activated: Optional[bool] = False """ When activated, containers in the namespace can be connected to a Private Network. Note that activating the VPC integration can only be done when creating a new namespace. @@ -694,24 +686,24 @@ class Token: Status of the token. """ - public_key: Optional[str] + public_key: Optional[str] = None """ Public key of the token. """ - description: Optional[str] + description: Optional[str] = None """ Description of the token. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiry date of the token. """ - container_id: Optional[str] + container_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None @dataclass @@ -746,23 +738,22 @@ class Trigger: Status of the trigger. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Error message of the trigger. """ - scw_sqs_config: Optional[TriggerMnqSqsClientConfig] + scw_sqs_config: Optional[TriggerMnqSqsClientConfig] = None - scw_nats_config: Optional[TriggerMnqNatsClientConfig] + scw_nats_config: Optional[TriggerMnqNatsClientConfig] = None - sqs_config: Optional[TriggerSqsClientConfig] + sqs_config: Optional[TriggerSqsClientConfig] = None @dataclass class UpdateTriggerRequestSqsClientConfig: - access_key: Optional[str] - - secret_key: Optional[str] + access_key: Optional[str] = None + secret_key: Optional[str] = None @dataclass @@ -777,94 +768,94 @@ class CreateContainerRequest: Name of the container. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the container. """ - min_scale: Optional[int] + min_scale: Optional[int] = 0 """ Minimum number of instances to scale the container to. """ - max_scale: Optional[int] + max_scale: Optional[int] = 0 """ Maximum number of instances to scale the container to. """ - memory_limit: Optional[int] + memory_limit: Optional[int] = 0 """ Memory limit of the container in MB. """ - cpu_limit: Optional[int] + cpu_limit: Optional[int] = 0 """ CPU limit of the container in mvCPU. """ - timeout: Optional[str] + timeout: Optional[str] = None """ Processing time limit for the container. """ - privacy: Optional[ContainerPrivacy] + privacy: Optional[ContainerPrivacy] = ContainerPrivacy.UNKNOWN_PRIVACY """ Privacy setting of the container. """ - description: Optional[str] + description: Optional[str] = None """ Description of the container. """ - registry_image: Optional[str] + registry_image: Optional[str] = None """ Name of the registry image (e.g. "rg.fr-par.scw.cloud/something/image:tag"). """ - max_concurrency: Optional[int] + max_concurrency: Optional[int] = 0 """ Number of maximum concurrent executions of the container. """ - protocol: Optional[ContainerProtocol] + protocol: Optional[ContainerProtocol] = ContainerProtocol.UNKNOWN_PROTOCOL """ Protocol the container uses. """ - port: Optional[int] + port: Optional[int] = 0 """ Port the container listens on. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the container. """ - http_option: Optional[ContainerHttpOption] + http_option: Optional[ContainerHttpOption] = ContainerHttpOption.UNKNOWN_HTTP_OPTION """ Possible values: - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. - enabled: Serve both HTTP and HTTPS traffic. """ - sandbox: Optional[ContainerSandbox] + sandbox: Optional[ContainerSandbox] = ContainerSandbox.UNKNOWN_SANDBOX """ Execution environment of the container. """ - local_storage_limit: Optional[int] + local_storage_limit: Optional[int] = 0 """ Local storage limit of the container (in MB). """ - scaling_option: Optional[ContainerScalingOption] + scaling_option: Optional[ContainerScalingOption] = None """ Possible values: - concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. @@ -872,29 +863,29 @@ class CreateContainerRequest: - memory_usage_threshold: Scale depending on the memory usage of a container instance. """ - health_check: Optional[ContainerHealthCheckSpec] + health_check: Optional[ContainerHealthCheckSpec] = None """ Health check configuration of the container. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Container. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the container can access other Scaleway resources in this Private Network. Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. """ - command: Optional[List[str]] + command: Optional[List[str]] = field(default_factory=list) """ Command executed when the container starts. This overrides the default command defined in the container image. This is usually the main executable, or entry point script to run. """ - args: Optional[List[str]] + args: Optional[List[str]] = field(default_factory=list) """ Arguments passed to the command specified in the "command" field. These override the default arguments from the container image, and behave like command-line parameters. """ @@ -912,17 +903,17 @@ class CreateCronRequest: UNIX cron shedule. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to pass with the cron. """ - name: Optional[str] + name: Optional[str] = None """ Name of the cron to create. """ @@ -940,7 +931,7 @@ class CreateDomainRequest: UUID of the container to assign the domain to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -953,37 +944,37 @@ class CreateNamespaceRequest: When activated, containers in the namespace can be connected to a Private Network. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the namespace to create. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the namespace to create. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project in which the namespace will be created. """ - description: Optional[str] + description: Optional[str] = None """ Description of the namespace to create. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the namespace to create. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Container Namespace. """ @@ -991,24 +982,24 @@ class CreateNamespaceRequest: @dataclass class CreateTokenRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the token. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiry date of the token. """ - container_id: Optional[str] + container_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None @dataclass @@ -1023,21 +1014,21 @@ class CreateTriggerRequest: ID of the container to trigger. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the trigger. """ - scw_sqs_config: Optional[CreateTriggerRequestMnqSqsClientConfig] + scw_sqs_config: Optional[CreateTriggerRequestMnqSqsClientConfig] = None - scw_nats_config: Optional[CreateTriggerRequestMnqNatsClientConfig] + scw_nats_config: Optional[CreateTriggerRequestMnqNatsClientConfig] = None - sqs_config: Optional[CreateTriggerRequestSqsClientConfig] + sqs_config: Optional[CreateTriggerRequestSqsClientConfig] = None @dataclass @@ -1047,7 +1038,7 @@ class DeleteContainerRequest: UUID of the container to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1060,7 +1051,7 @@ class DeleteCronRequest: UUID of the cron to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1073,7 +1064,7 @@ class DeleteDomainRequest: UUID of the domain to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1086,7 +1077,7 @@ class DeleteNamespaceRequest: UUID of the namespace to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1099,7 +1090,7 @@ class DeleteTokenRequest: UUID of the token to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1112,7 +1103,7 @@ class DeleteTriggerRequest: ID of the trigger to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1125,7 +1116,7 @@ class DeployContainerRequest: UUID of the container to deploy. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1138,7 +1129,7 @@ class GetContainerRequest: UUID of the container to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1151,7 +1142,7 @@ class GetCronRequest: UUID of the cron to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1164,7 +1155,7 @@ class GetDomainRequest: UUID of the domain to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1177,7 +1168,7 @@ class GetNamespaceRequest: UUID of the namespace to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1190,7 +1181,7 @@ class GetTokenRequest: UUID of the token to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1203,7 +1194,7 @@ class GetTriggerRequest: ID of the trigger to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1216,37 +1207,39 @@ class ListContainersRequest: UUID of the namespace the container belongs to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of containers per page. """ - order_by: Optional[ListContainersRequestOrderBy] + order_by: Optional[ListContainersRequestOrderBy] = ( + ListContainersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the containers. """ - name: Optional[str] + name: Optional[str] = None """ Name of the container. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ UUID of the Organization the container belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project the container belongs to. """ @@ -1272,22 +1265,22 @@ class ListCronsRequest: UUID of the container invoked by the cron. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of crons per page. """ - order_by: Optional[ListCronsRequestOrderBy] + order_by: Optional[ListCronsRequestOrderBy] = ListCronsRequestOrderBy.CREATED_AT_ASC """ Order of the crons. """ @@ -1313,22 +1306,24 @@ class ListDomainsRequest: UUID of the container the domain belongs to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of domains per page. """ - order_by: Optional[ListDomainsRequestOrderBy] + order_by: Optional[ListDomainsRequestOrderBy] = ( + ListDomainsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the domains. """ @@ -1349,37 +1344,39 @@ class ListDomainsResponse: @dataclass class ListNamespacesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of namespaces per page. """ - order_by: Optional[ListNamespacesRequestOrderBy] + order_by: Optional[ListNamespacesRequestOrderBy] = ( + ListNamespacesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the namespaces. """ - name: Optional[str] + name: Optional[str] = None """ Name of the namespaces. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ UUID of the Organization the namespace belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project the namespace belongs to. """ @@ -1400,32 +1397,34 @@ class ListNamespacesResponse: @dataclass class ListTokensRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of tokens per page. """ - order_by: Optional[ListTokensRequestOrderBy] + order_by: Optional[ListTokensRequestOrderBy] = ( + ListTokensRequestOrderBy.CREATED_AT_ASC + ) """ Order of the tokens. """ - container_id: Optional[str] + container_id: Optional[str] = None """ UUID of the container the token belongs to. """ - namespace_id: Optional[str] + namespace_id: Optional[str] = None """ UUID of the namespace the token belongs to. """ @@ -1434,37 +1433,38 @@ class ListTokensRequest: @dataclass class ListTokensResponse: tokens: List[Token] - total_count: int @dataclass class ListTriggersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of triggers to return per page. """ - order_by: Optional[ListTriggersRequestOrderBy] + order_by: Optional[ListTriggersRequestOrderBy] = ( + ListTriggersRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - container_id: Optional[str] + container_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -1487,99 +1487,99 @@ class UpdateContainerRequest: UUID of the container to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the container. """ - min_scale: Optional[int] + min_scale: Optional[int] = 0 """ Minimum number of instances to scale the container to. """ - max_scale: Optional[int] + max_scale: Optional[int] = 0 """ Maximum number of instances to scale the container to. """ - memory_limit: Optional[int] + memory_limit: Optional[int] = 0 """ Memory limit of the container in MB. """ - cpu_limit: Optional[int] + cpu_limit: Optional[int] = 0 """ CPU limit of the container in mvCPU. """ - timeout: Optional[str] + timeout: Optional[str] = None """ Processing time limit for the container. """ - redeploy: Optional[bool] + redeploy: Optional[bool] = False """ Defines whether to redeploy failed containers. """ - privacy: Optional[ContainerPrivacy] + privacy: Optional[ContainerPrivacy] = ContainerPrivacy.UNKNOWN_PRIVACY """ Privacy settings of the container. """ - description: Optional[str] + description: Optional[str] = None """ Description of the container. """ - registry_image: Optional[str] + registry_image: Optional[str] = None """ Name of the registry image (e.g. "rg.fr-par.scw.cloud/something/image:tag"). """ - max_concurrency: Optional[int] + max_concurrency: Optional[int] = 0 """ Number of maximum concurrent executions of the container. """ - protocol: Optional[ContainerProtocol] + protocol: Optional[ContainerProtocol] = ContainerProtocol.UNKNOWN_PROTOCOL """ Protocol the container uses. """ - port: Optional[int] + port: Optional[int] = 0 """ Port the container listens on. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the container. """ - http_option: Optional[ContainerHttpOption] + http_option: Optional[ContainerHttpOption] = ContainerHttpOption.UNKNOWN_HTTP_OPTION """ Possible values: - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. - enabled: Serve both HTTP and HTTPS traffic. """ - sandbox: Optional[ContainerSandbox] + sandbox: Optional[ContainerSandbox] = ContainerSandbox.UNKNOWN_SANDBOX """ Execution environment of the container. """ - local_storage_limit: Optional[int] + local_storage_limit: Optional[int] = 0 """ Local storage limit of the container (in MB). """ - scaling_option: Optional[ContainerScalingOption] + scaling_option: Optional[ContainerScalingOption] = None """ Possible values: - concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. @@ -1587,29 +1587,29 @@ class UpdateContainerRequest: - memory_usage_threshold: Scale depending on the memory usage of a container instance. """ - health_check: Optional[ContainerHealthCheckSpec] + health_check: Optional[ContainerHealthCheckSpec] = None """ Health check configuration of the container. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Container. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the container can access other Scaleway resources in this Private Network. Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. """ - command: Optional[List[str]] + command: Optional[List[str]] = field(default_factory=list) """ Command executed when the container starts. This overrides the default command defined in the container image. This is usually the main executable, or entry point script to run. """ - args: Optional[List[str]] + args: Optional[List[str]] = field(default_factory=list) """ Arguments passed to the command specified in the "command" field. These override the default arguments from the container image, and behave like command-line parameters. """ @@ -1622,27 +1622,27 @@ class UpdateCronRequest: UUID of the cron to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - container_id: Optional[str] + container_id: Optional[str] = None """ UUID of the container invoked by the cron. """ - schedule: Optional[str] + schedule: Optional[str] = None """ UNIX cron schedule. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to pass with the cron. """ - name: Optional[str] + name: Optional[str] = None """ Name of the cron. """ @@ -1655,27 +1655,27 @@ class UpdateNamespaceRequest: UUID of the namespace to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the namespace to update. """ - description: Optional[str] + description: Optional[str] = None """ Description of the namespace to update. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the namespace to update. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Container Namespace. """ @@ -1688,19 +1688,19 @@ class UpdateTriggerRequest: ID of the trigger to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the trigger. """ - description: Optional[str] + description: Optional[str] = None """ Description of the trigger. """ - sqs_config: Optional[UpdateTriggerRequestSqsClientConfig] + sqs_config: Optional[UpdateTriggerRequestSqsClientConfig] = None diff --git a/scaleway-async/scaleway_async/dedibox/v1/marshalling.py b/scaleway-async/scaleway_async/dedibox/v1/marshalling.py index ddee241c4..09063735f 100644 --- a/scaleway-async/scaleway_async/dedibox/v1/marshalling.py +++ b/scaleway-async/scaleway_async/dedibox/v1/marshalling.py @@ -9,8 +9,43 @@ unmarshal_Money, ) from .types import ( + BMCAccessStatus, + BackupStatus, + FailoverBlockVersion, + FailoverIPInterfaceType, + FailoverIPStatus, + FailoverIPVersion, + GetRpnStatusResponseStatus, + IPSemantic, + IPStatus, + IPVersion, + IPv6BlockDelegationStatus, + LogAction, + LogStatus, + MemoryType, + NetworkInterfaceInterfaceType, + OSArch, + OSType, + OfferCatalog, + OfferPaymentFrequency, + OfferSANInfoType, OfferServerInfoStock, PartitionFileSystem, + PartitionType, + RaidArrayRaidLevel, + RescueProtocol, + RpnGroupMemberStatus, + RpnGroupType, + RpnSanIpType, + RpnSanStatus, + RpnV2GroupStatus, + RpnV2GroupType, + RpnV2MemberStatus, + ServerDiskType, + ServerStatus, + ServiceLevelLevel, + ServiceProvisioningStatus, + ServiceType, IP, CPU, Disk, @@ -147,38 +182,56 @@ def unmarshal_IP(data: Any) -> IP: field = data.get("ip_id", None) if field is not None: args["ip_id"] = field + else: + args["ip_id"] = 0 field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("reverse", None) if field is not None: args["reverse"] = field + else: + args["reverse"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = IPVersion.IPV4 field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = 0 field = data.get("netmask", None) if field is not None: args["netmask"] = field + else: + args["netmask"] = None field = data.get("semantic", None) if field is not None: args["semantic"] = field + else: + args["semantic"] = IPSemantic.UNKNOWN field = data.get("gateway", None) if field is not None: args["gateway"] = field + else: + args["gateway"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = IPStatus.UNKNOWN_STATUS return IP(**args) @@ -194,18 +247,26 @@ def unmarshal_CPU(data: Any) -> CPU: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("core_count", None) if field is not None: args["core_count"] = field + else: + args["core_count"] = 0 field = data.get("thread_count", None) if field is not None: args["thread_count"] = field + else: + args["thread_count"] = 0 field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 return CPU(**args) @@ -221,10 +282,14 @@ def unmarshal_Disk(data: Any) -> Disk: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ServerDiskType.SATA return Disk(**args) @@ -240,18 +305,26 @@ def unmarshal_Memory(data: Any) -> Memory: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = MemoryType.DDR2 field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("is_ecc", None) if field is not None: args["is_ecc"] = field + else: + args["is_ecc"] = False return Memory(**args) @@ -267,14 +340,20 @@ def unmarshal_PersistentMemory(data: Any) -> PersistentMemory: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("model", None) if field is not None: args["model"] = field + else: + args["model"] = None return PersistentMemory(**args) @@ -290,10 +369,14 @@ def unmarshal_RaidController(data: Any) -> RaidController: field = data.get("model", None) if field is not None: args["model"] = field + else: + args["model"] = None field = data.get("raid_level", None) if field is not None: args["raid_level"] = field + else: + args["raid_level"] = field(default_factory=list) return RaidController(**args) @@ -309,6 +392,8 @@ def unmarshal_OfferAntiDosInfo(data: Any) -> OfferAntiDosInfo: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return OfferAntiDosInfo(**args) @@ -324,6 +409,8 @@ def unmarshal_OfferBackupInfo(data: Any) -> OfferBackupInfo: field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None return OfferBackupInfo(**args) @@ -339,6 +426,8 @@ def unmarshal_OfferBandwidthInfo(data: Any) -> OfferBandwidthInfo: field = data.get("speed", None) if field is not None: args["speed"] = field + else: + args["speed"] = None return OfferBandwidthInfo(**args) @@ -388,6 +477,8 @@ def unmarshal_OfferLicenseInfo(data: Any) -> OfferLicenseInfo: field = data.get("bound_to_ip", None) if field is not None: args["bound_to_ip"] = field + else: + args["bound_to_ip"] = None return OfferLicenseInfo(**args) @@ -403,6 +494,8 @@ def unmarshal_OfferRPNInfo(data: Any) -> OfferRPNInfo: field = data.get("speed", None) if field is not None: args["speed"] = field + else: + args["speed"] = None return OfferRPNInfo(**args) @@ -418,14 +511,20 @@ def unmarshal_OfferSANInfo(data: Any) -> OfferSANInfo: field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("ha", None) if field is not None: args["ha"] = field + else: + args["ha"] = False field = data.get("device_type", None) if field is not None: args["device_type"] = field + else: + args["device_type"] = OfferSANInfoType.HDD return OfferSANInfo(**args) @@ -441,30 +540,42 @@ def unmarshal_OfferServerInfo(data: Any) -> OfferServerInfo: field = data.get("bandwidth", None) if field is not None: args["bandwidth"] = field + else: + args["bandwidth"] = None field = data.get("stock", None) if field is not None: args["stock"] = field + else: + args["stock"] = None field = data.get("commercial_range", None) if field is not None: args["commercial_range"] = field + else: + args["commercial_range"] = None field = data.get("disks", None) if field is not None: args["disks"] = ( [unmarshal_Disk(v) for v in field] if field is not None else None ) + else: + args["disks"] = None field = data.get("cpus", None) if field is not None: args["cpus"] = [unmarshal_CPU(v) for v in field] if field is not None else None + else: + args["cpus"] = None field = data.get("memories", None) if field is not None: args["memories"] = ( [unmarshal_Memory(v) for v in field] if field is not None else None ) + else: + args["memories"] = None field = data.get("persistent_memories", None) if field is not None: @@ -473,22 +584,30 @@ def unmarshal_OfferServerInfo(data: Any) -> OfferServerInfo: if field is not None else None ) + else: + args["persistent_memories"] = None field = data.get("raid_controllers", None) if field is not None: args["raid_controllers"] = ( [unmarshal_RaidController(v) for v in field] if field is not None else None ) + else: + args["raid_controllers"] = None field = data.get("available_options", None) if field is not None: args["available_options"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["available_options"] = None field = data.get("connectivity", None) if field is not None: args["connectivity"] = field + else: + args["connectivity"] = None field = data.get("stock_by_datacenter", None) if field is not None: @@ -497,6 +616,8 @@ def unmarshal_OfferServerInfo(data: Any) -> OfferServerInfo: if field is not None else None ) + else: + args["stock_by_datacenter"] = None field = data.get("rpn_version", None) if field is not None: @@ -524,48 +645,70 @@ def unmarshal_OfferServiceLevelInfo(data: Any) -> OfferServiceLevelInfo: field = data.get("support_ticket", None) if field is not None: args["support_ticket"] = field + else: + args["support_ticket"] = None field = data.get("support_phone", None) if field is not None: args["support_phone"] = field + else: + args["support_phone"] = None field = data.get("sales_support", None) if field is not None: args["sales_support"] = field + else: + args["sales_support"] = None field = data.get("git", None) if field is not None: args["git"] = field + else: + args["git"] = None field = data.get("sla", None) if field is not None: args["sla"] = field + else: + args["sla"] = None field = data.get("priority_support", None) if field is not None: args["priority_support"] = field + else: + args["priority_support"] = None field = data.get("high_rpn_bandwidth", None) if field is not None: args["high_rpn_bandwidth"] = field + else: + args["high_rpn_bandwidth"] = None field = data.get("customization", None) if field is not None: args["customization"] = field + else: + args["customization"] = None field = data.get("antidos", None) if field is not None: args["antidos"] = field + else: + args["antidos"] = None field = data.get("extra_failover_quota", None) if field is not None: args["extra_failover_quota"] = field + else: + args["extra_failover_quota"] = None field = data.get("available_options", None) if field is not None: args["available_options"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["available_options"] = None return OfferServiceLevelInfo(**args) @@ -581,10 +724,14 @@ def unmarshal_OfferStorageInfo(data: Any) -> OfferStorageInfo: field = data.get("max_quota", None) if field is not None: args["max_quota"] = field + else: + args["max_quota"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None return OfferStorageInfo(**args) @@ -600,18 +747,26 @@ def unmarshal_Offer(data: Any) -> Offer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("catalog", None) if field is not None: args["catalog"] = field + else: + args["catalog"] = OfferCatalog.ALL field = data.get("payment_frequency", None) if field is not None: args["payment_frequency"] = field + else: + args["payment_frequency"] = OfferPaymentFrequency.MONTHLY field = data.get("pricing", None) if field is not None: @@ -705,76 +860,108 @@ def unmarshal_OS(data: Any) -> OS: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = OSType.UNKNOWN_TYPE field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = OSArch.UNKNOWN_ARCH field = data.get("allow_custom_partitioning", None) if field is not None: args["allow_custom_partitioning"] = field + else: + args["allow_custom_partitioning"] = False field = data.get("allow_ssh_keys", None) if field is not None: args["allow_ssh_keys"] = field + else: + args["allow_ssh_keys"] = False field = data.get("requires_user", None) if field is not None: args["requires_user"] = field + else: + args["requires_user"] = False field = data.get("requires_admin_password", None) if field is not None: args["requires_admin_password"] = field + else: + args["requires_admin_password"] = False field = data.get("requires_panel_password", None) if field is not None: args["requires_panel_password"] = field + else: + args["requires_panel_password"] = False field = data.get("allowed_filesystems", None) if field is not None: args["allowed_filesystems"] = ( [PartitionFileSystem(v) for v in field] if field is not None else None ) + else: + args["allowed_filesystems"] = field(default_factory=list) field = data.get("requires_license", None) if field is not None: args["requires_license"] = field + else: + args["requires_license"] = False field = data.get("license_offers", None) if field is not None: args["license_offers"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["license_offers"] = field(default_factory=list) field = data.get("display_name", None) if field is not None: args["display_name"] = field + else: + args["display_name"] = None field = data.get("password_regex", None) if field is not None: args["password_regex"] = field + else: + args["password_regex"] = None field = data.get("hostname_max_length", None) if field is not None: args["hostname_max_length"] = field + else: + args["hostname_max_length"] = 0 field = data.get("max_partitions", None) if field is not None: args["max_partitions"] = field else: - args["max_partitions"] = None + args["max_partitions"] = 0 field = data.get("panel_password_regex", None) if field is not None: @@ -786,7 +973,7 @@ def unmarshal_OS(data: Any) -> OS: if field is not None: args["requires_valid_hostname"] = field else: - args["requires_valid_hostname"] = None + args["requires_valid_hostname"] = False field = data.get("hostname_regex", None) if field is not None: @@ -816,30 +1003,44 @@ def unmarshal_RpnSan(data: Any) -> RpnSan: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("server_hostname", None) if field is not None: args["server_hostname"] = field + else: + args["server_hostname"] = None field = data.get("iqn_suffix", None) if field is not None: args["iqn_suffix"] = field + else: + args["iqn_suffix"] = None field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = 0 field = data.get("created_at", None) if field is not None: @@ -850,26 +1051,38 @@ def unmarshal_RpnSan(data: Any) -> RpnSan: field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = RpnSanStatus.UNKNOWN_STATUS field = data.get("storage_size", None) if field is not None: args["storage_size"] = field + else: + args["storage_size"] = 0 field = data.get("iqn", None) if field is not None: args["iqn"] = field + else: + args["iqn"] = None field = data.get("rpnv1_compatible", None) if field is not None: args["rpnv1_compatible"] = field + else: + args["rpnv1_compatible"] = False field = data.get("rpnv1_implicit", None) if field is not None: args["rpnv1_implicit"] = field + else: + args["rpnv1_implicit"] = False field = data.get("offer", None) if field is not None: @@ -913,34 +1126,50 @@ def unmarshal_RpnGroup(data: Any) -> RpnGroup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = RpnGroupType.UNKNOWN field = data.get("active", None) if field is not None: args["active"] = field + else: + args["active"] = False field = data.get("owner", None) if field is not None: args["owner"] = field + else: + args["owner"] = None field = data.get("members_count", None) if field is not None: args["members_count"] = field + else: + args["members_count"] = 0 field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("created_at", None) if field is not None: @@ -962,22 +1191,32 @@ def unmarshal_NetworkInterface(data: Any) -> NetworkInterface: field = data.get("card_id", None) if field is not None: args["card_id"] = field + else: + args["card_id"] = 0 field = data.get("device_id", None) if field is not None: args["device_id"] = field + else: + args["device_id"] = 0 field = data.get("mac", None) if field is not None: args["mac"] = field + else: + args["mac"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = NetworkInterfaceInterfaceType.UNKNOWN field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_IP(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) return NetworkInterface(**args) @@ -993,14 +1232,20 @@ def unmarshal_ServerLocation(data: Any) -> ServerLocation: field = data.get("rack", None) if field is not None: args["rack"] = field + else: + args["rack"] = None field = data.get("room", None) if field is not None: args["room"] = field + else: + args["room"] = None field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None return ServerLocation(**args) @@ -1018,6 +1263,8 @@ def unmarshal_ServerOption(data: Any) -> ServerOption: args["options"] = ( [unmarshal_ServerOption(v) for v in field] if field is not None else None ) + else: + args["options"] = None field = data.get("offer", None) if field is not None: @@ -1057,10 +1304,14 @@ def unmarshal_ServiceLevel(data: Any) -> ServiceLevel: field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = 0 field = data.get("level", None) if field is not None: args["level"] = field + else: + args["level"] = ServiceLevelLevel.UNKNOWN return ServiceLevel(**args) @@ -1076,22 +1327,32 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerStatus.UNKNOWN field = data.get("rebooted_at", None) if field is not None: @@ -1104,6 +1365,8 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("abuse_contact", None) if field is not None: args["abuse_contact"] = field + else: + args["abuse_contact"] = None field = data.get("interfaces", None) if field is not None: @@ -1112,44 +1375,64 @@ def unmarshal_Server(data: Any) -> Server: if field is not None else None ) + else: + args["interfaces"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("options", None) if field is not None: args["options"] = ( [unmarshal_ServerOption(v) for v in field] if field is not None else None ) + else: + args["options"] = field(default_factory=list) field = data.get("has_bmc", None) if field is not None: args["has_bmc"] = field + else: + args["has_bmc"] = False field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("is_outsourced", None) if field is not None: args["is_outsourced"] = field + else: + args["is_outsourced"] = False field = data.get("ipv6_slaac", None) if field is not None: args["ipv6_slaac"] = field + else: + args["ipv6_slaac"] = False field = data.get("qinq", None) if field is not None: args["qinq"] = field + else: + args["qinq"] = False field = data.get("is_rpnv2_member", None) if field is not None: args["is_rpnv2_member"] = field + else: + args["is_rpnv2_member"] = False field = data.get("is_hds", None) if field is not None: args["is_hds"] = field + else: + args["is_hds"] = False field = data.get("created_at", None) if field is not None: @@ -1213,10 +1496,14 @@ def unmarshal_RpnV2GroupSubnet(data: Any) -> RpnV2GroupSubnet: field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = None return RpnV2GroupSubnet(**args) @@ -1232,42 +1519,62 @@ def unmarshal_RpnV2Group(data: Any) -> RpnV2Group: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("compatible_rpnv1", None) if field is not None: args["compatible_rpnv1"] = field + else: + args["compatible_rpnv1"] = False field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = RpnV2GroupType.UNKNOWN_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = RpnV2GroupStatus.UNKNOWN_GROUP_STATUS field = data.get("owner", None) if field is not None: args["owner"] = field + else: + args["owner"] = None field = data.get("members_count", None) if field is not None: args["members_count"] = field + else: + args["members_count"] = 0 field = data.get("gateway", None) if field is not None: args["gateway"] = field + else: + args["gateway"] = None field = data.get("subnet", None) if field is not None: @@ -1295,20 +1602,26 @@ def unmarshal_Service(data: Any) -> Service: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("provisioning_status", None) if field is not None: args["provisioning_status"] = field + else: + args["provisioning_status"] = ServiceProvisioningStatus.UNKNOWN field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ServiceType.UNKNOWN_TYPE field = data.get("resource_id", None) if field is not None: args["resource_id"] = field else: - args["resource_id"] = None + args["resource_id"] = 0 field = data.get("offer", None) if field is not None: @@ -1358,30 +1671,44 @@ def unmarshal_FailoverBlock(data: Any) -> FailoverBlock: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("nameservers", None) if field is not None: args["nameservers"] = field + else: + args["nameservers"] = field(default_factory=list) field = data.get("ip_version", None) if field is not None: args["ip_version"] = field + else: + args["ip_version"] = FailoverBlockVersion.UNKNOWN_VERSION field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = 0 field = data.get("netmask", None) if field is not None: args["netmask"] = field + else: + args["netmask"] = None field = data.get("gateway_ip", None) if field is not None: args["gateway_ip"] = field + else: + args["gateway_ip"] = None return FailoverBlock(**args) @@ -1397,38 +1724,56 @@ def unmarshal_FailoverIP(data: Any) -> FailoverIP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("reverse", None) if field is not None: args["reverse"] = field + else: + args["reverse"] = None field = data.get("ip_version", None) if field is not None: args["ip_version"] = field + else: + args["ip_version"] = FailoverIPVersion.UNKNOWN_VERSION field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = 0 field = data.get("netmask", None) if field is not None: args["netmask"] = field + else: + args["netmask"] = None field = data.get("gateway_ip", None) if field is not None: args["gateway_ip"] = field + else: + args["gateway_ip"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = FailoverIPStatus.UNKNOWN_STATUS field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = FailoverIPInterfaceType.UNKNOWN field = data.get("mac", None) if field is not None: @@ -1440,7 +1785,7 @@ def unmarshal_FailoverIP(data: Any) -> FailoverIP: if field is not None: args["server_id"] = field else: - args["server_id"] = None + args["server_id"] = 0 field = data.get("block", None) if field is not None: @@ -1468,18 +1813,26 @@ def unmarshal_BMCAccess(data: Any) -> BMCAccess: field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("login", None) if field is not None: args["login"] = field + else: + args["login"] = None field = data.get("password", None) if field is not None: args["password"] = field + else: + args["password"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = BMCAccessStatus.UNKNOWN field = data.get("expires_at", None) if field is not None: @@ -1501,42 +1854,62 @@ def unmarshal_Backup(data: Any) -> Backup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("login", None) if field is not None: args["login"] = field + else: + args["login"] = None field = data.get("server", None) if field is not None: args["server"] = field + else: + args["server"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = BackupStatus.UNKNOWN_BACKUP_STATUS field = data.get("acl_enabled", None) if field is not None: args["acl_enabled"] = field + else: + args["acl_enabled"] = False field = data.get("autologin", None) if field is not None: args["autologin"] = field + else: + args["autologin"] = False field = data.get("quota_space", None) if field is not None: args["quota_space"] = field + else: + args["quota_space"] = 0 field = data.get("quota_space_used", None) if field is not None: args["quota_space_used"] = field + else: + args["quota_space_used"] = 0 field = data.get("quota_files", None) if field is not None: args["quota_files"] = field + else: + args["quota_files"] = 0 field = data.get("quota_files_used", None) if field is not None: args["quota_files_used"] = field + else: + args["quota_files_used"] = 0 return Backup(**args) @@ -1552,30 +1925,44 @@ def unmarshal_CanOrderResponse(data: Any) -> CanOrderResponse: field = data.get("can_order", None) if field is not None: args["can_order"] = field + else: + args["can_order"] = None field = data.get("quota_ok", None) if field is not None: args["quota_ok"] = field + else: + args["quota_ok"] = None field = data.get("phone_confirmed", None) if field is not None: args["phone_confirmed"] = field + else: + args["phone_confirmed"] = None field = data.get("email_confirmed", None) if field is not None: args["email_confirmed"] = field + else: + args["email_confirmed"] = None field = data.get("user_confirmed", None) if field is not None: args["user_confirmed"] = field + else: + args["user_confirmed"] = None field = data.get("payment_mode", None) if field is not None: args["payment_mode"] = field + else: + args["payment_mode"] = None field = data.get("billing_ok", None) if field is not None: args["billing_ok"] = field + else: + args["billing_ok"] = None field = data.get("message", None) if field is not None: @@ -1597,12 +1984,16 @@ def unmarshal_CreateFailoverIPsResponse(data: Any) -> CreateFailoverIPsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("services", None) if field is not None: args["services"] = ( [unmarshal_Service(v) for v in field] if field is not None else None ) + else: + args["services"] = None return CreateFailoverIPsResponse(**args) @@ -1620,10 +2011,14 @@ def unmarshal_GetIPv6BlockQuotasResponseQuota( field = data.get("quota", None) if field is not None: args["quota"] = field + else: + args["quota"] = None field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = None return GetIPv6BlockQuotasResponseQuota(**args) @@ -1643,10 +2038,14 @@ def unmarshal_GetIPv6BlockQuotasResponse(data: Any) -> GetIPv6BlockQuotasRespons if field is not None else None ) + else: + args["quotas"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return GetIPv6BlockQuotasResponse(**args) @@ -1662,18 +2061,26 @@ def unmarshal_GetRemainingQuotaResponse(data: Any) -> GetRemainingQuotaResponse: field = data.get("failover_ip_quota", None) if field is not None: args["failover_ip_quota"] = field + else: + args["failover_ip_quota"] = 0 field = data.get("failover_ip_remaining_quota", None) if field is not None: args["failover_ip_remaining_quota"] = field + else: + args["failover_ip_remaining_quota"] = 0 field = data.get("failover_block_quota", None) if field is not None: args["failover_block_quota"] = field + else: + args["failover_block_quota"] = 0 field = data.get("failover_block_remaining_quota", None) if field is not None: args["failover_block_remaining_quota"] = field + else: + args["failover_block_remaining_quota"] = 0 return GetRemainingQuotaResponse(**args) @@ -1689,12 +2096,14 @@ def unmarshal_GetRpnStatusResponse(data: Any) -> GetRpnStatusResponse: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = GetRpnStatusResponseStatus.UNKNOWN_STATUS field = data.get("operations_left", None) if field is not None: args["operations_left"] = field else: - args["operations_left"] = None + args["operations_left"] = 0 return GetRpnStatusResponse(**args) @@ -1710,32 +2119,46 @@ def unmarshal_IPv6Block(data: Any) -> IPv6Block: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("duid", None) if field is not None: args["duid"] = field + else: + args["duid"] = None field = data.get("nameservers", None) if field is not None: args["nameservers"] = field + else: + args["nameservers"] = field(default_factory=list) field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = 0 field = data.get("subnets", None) if field is not None: args["subnets"] = ( [unmarshal_IPv6Block(v) for v in field] if field is not None else None ) + else: + args["subnets"] = field(default_factory=list) field = data.get("delegation_status", None) if field is not None: args["delegation_status"] = field + else: + args["delegation_status"] = IPv6BlockDelegationStatus.UNKNOWN_STATUS return IPv6Block(**args) @@ -1751,22 +2174,32 @@ def unmarshal_Invoice(data: Any) -> Invoice: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("payment_method", None) if field is not None: args["payment_method"] = field + else: + args["payment_method"] = None field = data.get("content", None) if field is not None: args["content"] = field + else: + args["content"] = None field = data.get("transaction_id", None) if field is not None: args["transaction_id"] = field + else: + args["transaction_id"] = None field = data.get("total_with_taxes", None) if field is not None: @@ -1806,12 +2239,16 @@ def unmarshal_ListFailoverIPsResponse(data: Any) -> ListFailoverIPsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("failover_ips", None) if field is not None: args["failover_ips"] = ( [unmarshal_FailoverIP(v) for v in field] if field is not None else None ) + else: + args["failover_ips"] = field(default_factory=list) return ListFailoverIPsResponse(**args) @@ -1829,10 +2266,14 @@ def unmarshal_ListIPv6BlockSubnetsAvailableResponseSubnet( field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = None return ListIPv6BlockSubnetsAvailableResponseSubnet(**args) @@ -1854,10 +2295,14 @@ def unmarshal_ListIPv6BlockSubnetsAvailableResponse( if field is not None else None ) + else: + args["subnet_availables"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListIPv6BlockSubnetsAvailableResponse(**args) @@ -1873,18 +2318,26 @@ def unmarshal_InvoiceSummary(data: Any) -> InvoiceSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("payment_method", None) if field is not None: args["payment_method"] = field + else: + args["payment_method"] = None field = data.get("transaction_id", None) if field is not None: args["transaction_id"] = field + else: + args["transaction_id"] = None field = data.get("total_with_taxes", None) if field is not None: @@ -1924,12 +2377,16 @@ def unmarshal_ListInvoicesResponse(data: Any) -> ListInvoicesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("invoices", None) if field is not None: args["invoices"] = ( [unmarshal_InvoiceSummary(v) for v in field] if field is not None else None ) + else: + args["invoices"] = None return ListInvoicesResponse(**args) @@ -1945,10 +2402,14 @@ def unmarshal_RpnSanIpRpnV2Group(data: Any) -> RpnSanIpRpnV2Group: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return RpnSanIpRpnV2Group(**args) @@ -1964,14 +2425,20 @@ def unmarshal_RpnSanIpServer(data: Any) -> RpnSanIpServer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None return RpnSanIpServer(**args) @@ -1987,6 +2454,8 @@ def unmarshal_RpnSanIp(data: Any) -> RpnSanIp: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = RpnSanIpType.UNKNOWN field = data.get("server", None) if field is not None: @@ -2020,12 +2489,16 @@ def unmarshal_ListIpsResponse(data: Any) -> ListIpsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("ips", None) if field is not None: args["ips"] = ( [unmarshal_RpnSanIp(v) for v in field] if field is not None else None ) + else: + args["ips"] = field(default_factory=list) return ListIpsResponse(**args) @@ -2041,10 +2514,14 @@ def unmarshal_ListOSResponse(data: Any) -> ListOSResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("os", None) if field is not None: args["os"] = [unmarshal_OS(v) for v in field] if field is not None else None + else: + args["os"] = field(default_factory=list) return ListOSResponse(**args) @@ -2060,12 +2537,16 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("offers", None) if field is not None: args["offers"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["offers"] = field(default_factory=list) return ListOffersResponse(**args) @@ -2081,14 +2562,20 @@ def unmarshal_RefundSummary(data: Any) -> RefundSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("method", None) if field is not None: args["method"] = field + else: + args["method"] = None field = data.get("total_with_taxes", None) if field is not None: @@ -2130,12 +2617,16 @@ def unmarshal_ListRefundsResponse(data: Any) -> ListRefundsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("refunds", None) if field is not None: args["refunds"] = ( [unmarshal_RefundSummary(v) for v in field] if field is not None else None ) + else: + args["refunds"] = None return ListRefundsResponse(**args) @@ -2151,24 +2642,34 @@ def unmarshal_RpnSanServer(data: Any) -> RpnSanServer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("sans", None) if field is not None: args["sans"] = ( [unmarshal_RpnSan(v) for v in field] if field is not None else None ) + else: + args["sans"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return RpnSanServer(**args) @@ -2186,12 +2687,16 @@ def unmarshal_ListRpnCapableSanServersResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("san_servers", None) if field is not None: args["san_servers"] = ( [unmarshal_RpnSanServer(v) for v in field] if field is not None else None ) + else: + args["san_servers"] = field(default_factory=list) return ListRpnCapableSanServersResponse(**args) @@ -2207,12 +2712,16 @@ def unmarshal_ListRpnCapableServersResponse(data: Any) -> ListRpnCapableServersR field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListRpnCapableServersResponse(**args) @@ -2228,26 +2737,38 @@ def unmarshal_RpnGroupMember(data: Any) -> RpnGroupMember: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = RpnGroupMemberStatus.UNKNOWN_RPN_MEMBER_STATUS field = data.get("group_id", None) if field is not None: args["group_id"] = field + else: + args["group_id"] = 0 field = data.get("group_name", None) if field is not None: args["group_name"] = field + else: + args["group_name"] = None field = data.get("group_owner", None) if field is not None: args["group_owner"] = field + else: + args["group_owner"] = None field = data.get("owner", None) if field is not None: args["owner"] = field + else: + args["owner"] = None field = data.get("san_server", None) if field is not None: @@ -2265,7 +2786,7 @@ def unmarshal_RpnGroupMember(data: Any) -> RpnGroupMember: if field is not None: args["speed"] = field else: - args["speed"] = None + args["speed"] = 0 return RpnGroupMember(**args) @@ -2281,12 +2802,16 @@ def unmarshal_ListRpnGroupMembersResponse(data: Any) -> ListRpnGroupMembersRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("members", None) if field is not None: args["members"] = ( [unmarshal_RpnGroupMember(v) for v in field] if field is not None else None ) + else: + args["members"] = field(default_factory=list) return ListRpnGroupMembersResponse(**args) @@ -2302,12 +2827,16 @@ def unmarshal_ListRpnGroupsResponse(data: Any) -> ListRpnGroupsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("rpn_groups", None) if field is not None: args["rpn_groups"] = ( [unmarshal_RpnGroup(v) for v in field] if field is not None else None ) + else: + args["rpn_groups"] = field(default_factory=list) return ListRpnGroupsResponse(**args) @@ -2323,12 +2852,16 @@ def unmarshal_ListRpnInvitesResponse(data: Any) -> ListRpnInvitesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("members", None) if field is not None: args["members"] = ( [unmarshal_RpnGroupMember(v) for v in field] if field is not None else None ) + else: + args["members"] = field(default_factory=list) return ListRpnInvitesResponse(**args) @@ -2344,30 +2877,44 @@ def unmarshal_RpnSanSummary(data: Any) -> RpnSanSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("server_hostname", None) if field is not None: args["server_hostname"] = field + else: + args["server_hostname"] = None field = data.get("iqn_suffix", None) if field is not None: args["iqn_suffix"] = field + else: + args["iqn_suffix"] = None field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = 0 field = data.get("created_at", None) if field is not None: @@ -2378,22 +2925,32 @@ def unmarshal_RpnSanSummary(data: Any) -> RpnSanSummary: field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = RpnSanStatus.UNKNOWN_STATUS field = data.get("storage_size", None) if field is not None: args["storage_size"] = field + else: + args["storage_size"] = 0 field = data.get("rpnv1_compatible", None) if field is not None: args["rpnv1_compatible"] = field + else: + args["rpnv1_compatible"] = False field = data.get("rpnv1_implicit", None) if field is not None: args["rpnv1_implicit"] = field + else: + args["rpnv1_implicit"] = False field = data.get("delivered_at", None) if field is not None: @@ -2431,12 +2988,16 @@ def unmarshal_ListRpnSansResponse(data: Any) -> ListRpnSansResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("rpn_sans", None) if field is not None: args["rpn_sans"] = ( [unmarshal_RpnSanSummary(v) for v in field] if field is not None else None ) + else: + args["rpn_sans"] = field(default_factory=list) return ListRpnSansResponse(**args) @@ -2452,38 +3013,56 @@ def unmarshal_RpnServerCapability(data: Any) -> RpnServerCapability: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("compatible_qinq", None) if field is not None: args["compatible_qinq"] = field + else: + args["compatible_qinq"] = False field = data.get("can_join_qinq_group", None) if field is not None: args["can_join_qinq_group"] = field + else: + args["can_join_qinq_group"] = False field = data.get("rpnv1_group_count", None) if field is not None: args["rpnv1_group_count"] = field + else: + args["rpnv1_group_count"] = 0 field = data.get("rpnv2_group_count", None) if field is not None: args["rpnv2_group_count"] = field + else: + args["rpnv2_group_count"] = 0 field = data.get("can_join_rpnv2_group", None) if field is not None: args["can_join_rpnv2_group"] = field + else: + args["can_join_rpnv2_group"] = False field = data.get("ip_address", None) if field is not None: @@ -2495,7 +3074,7 @@ def unmarshal_RpnServerCapability(data: Any) -> RpnServerCapability: if field is not None: args["rpn_version"] = field else: - args["rpn_version"] = None + args["rpn_version"] = 0 return RpnServerCapability(**args) @@ -2513,6 +3092,8 @@ def unmarshal_ListRpnServerCapabilitiesResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: @@ -2521,6 +3102,8 @@ def unmarshal_ListRpnServerCapabilitiesResponse( if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListRpnServerCapabilitiesResponse(**args) @@ -2538,12 +3121,16 @@ def unmarshal_ListRpnV2CapableResourcesResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListRpnV2CapableResourcesResponse(**args) @@ -2559,14 +3146,20 @@ def unmarshal_RpnV2Member(data: Any) -> RpnV2Member: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = RpnV2MemberStatus.UNKNOWN_MEMBER_STATUS field = data.get("vlan", None) if field is not None: args["vlan"] = field + else: + args["vlan"] = None field = data.get("server", None) if field is not None: @@ -2584,7 +3177,7 @@ def unmarshal_RpnV2Member(data: Any) -> RpnV2Member: if field is not None: args["speed"] = field else: - args["speed"] = None + args["speed"] = 0 return RpnV2Member(**args) @@ -2600,14 +3193,20 @@ def unmarshal_Log(data: Any) -> Log: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = LogAction.UNKNOWN_LOG_ACTION field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = LogStatus.UNKNOWN_LOG_STATUS field = data.get("group", None) if field is not None: @@ -2649,10 +3248,14 @@ def unmarshal_ListRpnV2GroupLogsResponse(data: Any) -> ListRpnV2GroupLogsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("logs", None) if field is not None: args["logs"] = [unmarshal_Log(v) for v in field] if field is not None else None + else: + args["logs"] = field(default_factory=list) return ListRpnV2GroupLogsResponse(**args) @@ -2668,12 +3271,16 @@ def unmarshal_ListRpnV2GroupsResponse(data: Any) -> ListRpnV2GroupsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("rpn_groups", None) if field is not None: args["rpn_groups"] = ( [unmarshal_RpnV2Group(v) for v in field] if field is not None else None ) + else: + args["rpn_groups"] = field(default_factory=list) return ListRpnV2GroupsResponse(**args) @@ -2689,12 +3296,16 @@ def unmarshal_ListRpnV2MembersResponse(data: Any) -> ListRpnV2MembersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("members", None) if field is not None: args["members"] = ( [unmarshal_RpnV2Member(v) for v in field] if field is not None else None ) + else: + args["members"] = field(default_factory=list) return ListRpnV2MembersResponse(**args) @@ -2710,22 +3321,32 @@ def unmarshal_ServerDisk(data: Any) -> ServerDisk: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("connector", None) if field is not None: args["connector"] = field + else: + args["connector"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = None field = data.get("is_addon", None) if field is not None: args["is_addon"] = field + else: + args["is_addon"] = None return ServerDisk(**args) @@ -2741,12 +3362,16 @@ def unmarshal_ListServerDisksResponse(data: Any) -> ListServerDisksResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("disks", None) if field is not None: args["disks"] = ( [unmarshal_ServerDisk(v) for v in field] if field is not None else None ) + else: + args["disks"] = field(default_factory=list) return ListServerDisksResponse(**args) @@ -2762,10 +3387,14 @@ def unmarshal_ServerEvent(data: Any) -> ServerEvent: field = data.get("event_id", None) if field is not None: args["event_id"] = field + else: + args["event_id"] = 0 field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("date", None) if field is not None: @@ -2787,12 +3416,16 @@ def unmarshal_ListServerEventsResponse(data: Any) -> ListServerEventsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("events", None) if field is not None: args["events"] = ( [unmarshal_ServerEvent(v) for v in field] if field is not None else None ) + else: + args["events"] = field(default_factory=list) return ListServerEventsResponse(**args) @@ -2808,22 +3441,32 @@ def unmarshal_ServerSummary(data: Any) -> ServerSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("created_at", None) if field is not None: @@ -2846,14 +3489,20 @@ def unmarshal_ServerSummary(data: Any) -> ServerSummary: field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = 0 field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerStatus.UNKNOWN field = data.get("interfaces", None) if field is not None: @@ -2862,28 +3511,38 @@ def unmarshal_ServerSummary(data: Any) -> ServerSummary: if field is not None else None ) + else: + args["interfaces"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("is_outsourced", None) if field is not None: args["is_outsourced"] = field + else: + args["is_outsourced"] = False field = data.get("qinq", None) if field is not None: args["qinq"] = field + else: + args["qinq"] = False field = data.get("is_hds", None) if field is not None: args["is_hds"] = field + else: + args["is_hds"] = False field = data.get("os_id", None) if field is not None: args["os_id"] = field else: - args["os_id"] = None + args["os_id"] = 0 field = data.get("level", None) if field is not None: @@ -2895,7 +3554,7 @@ def unmarshal_ServerSummary(data: Any) -> ServerSummary: if field is not None: args["rpn_version"] = field else: - args["rpn_version"] = None + args["rpn_version"] = 0 return ServerSummary(**args) @@ -2911,12 +3570,16 @@ def unmarshal_ListServersResponse(data: Any) -> ListServersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_ServerSummary(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListServersResponse(**args) @@ -2932,12 +3595,16 @@ def unmarshal_ListServicesResponse(data: Any) -> ListServicesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("services", None) if field is not None: args["services"] = ( [unmarshal_Service(v) for v in field] if field is not None else None ) + else: + args["services"] = field(default_factory=list) return ListServicesResponse(**args) @@ -2955,12 +3622,16 @@ def unmarshal_ListSubscribableServerOptionsResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("server_options", None) if field is not None: args["server_options"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["server_options"] = field(default_factory=list) return ListSubscribableServerOptionsResponse(**args) @@ -2976,12 +3647,16 @@ def unmarshal_RaidArray(data: Any) -> RaidArray: field = data.get("raid_level", None) if field is not None: args["raid_level"] = field + else: + args["raid_level"] = RaidArrayRaidLevel.NO_RAID field = data.get("disks", None) if field is not None: args["disks"] = ( [unmarshal_ServerDisk(v) for v in field] if field is not None else None ) + else: + args["disks"] = field(default_factory=list) return RaidArray(**args) @@ -2999,6 +3674,8 @@ def unmarshal_Raid(data: Any) -> Raid: args["raid_arrays"] = ( [unmarshal_RaidArray(v) for v in field] if field is not None else None ) + else: + args["raid_arrays"] = field(default_factory=list) return Raid(**args) @@ -3014,18 +3691,26 @@ def unmarshal_Refund(data: Any) -> Refund: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("method", None) if field is not None: args["method"] = field + else: + args["method"] = None field = data.get("content", None) if field is not None: args["content"] = field + else: + args["content"] = None field = data.get("total_with_taxes", None) if field is not None: @@ -3067,18 +3752,26 @@ def unmarshal_Rescue(data: Any) -> Rescue: field = data.get("os_id", None) if field is not None: args["os_id"] = field + else: + args["os_id"] = 0 field = data.get("login", None) if field is not None: args["login"] = field + else: + args["login"] = None field = data.get("password", None) if field is not None: args["password"] = field + else: + args["password"] = None field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = RescueProtocol.VNC return Rescue(**args) @@ -3094,22 +3787,32 @@ def unmarshal_Partition(data: Any) -> Partition: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = PartitionType.PRIMARY field = data.get("file_system", None) if field is not None: args["file_system"] = field + else: + args["file_system"] = PartitionFileSystem.UNKNOWN field = data.get("raid_level", None) if field is not None: args["raid_level"] = field + else: + args["raid_level"] = RaidArrayRaidLevel.NO_RAID field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("connectors", None) if field is not None: args["connectors"] = field + else: + args["connectors"] = field(default_factory=list) field = data.get("mount_point", None) if field is not None: @@ -3133,6 +3836,8 @@ def unmarshal_ServerDefaultPartitioning(data: Any) -> ServerDefaultPartitioning: args["partitions"] = ( [unmarshal_Partition(v) for v in field] if field is not None else None ) + else: + args["partitions"] = field(default_factory=list) return ServerDefaultPartitioning(**args) @@ -3148,24 +3853,34 @@ def unmarshal_ServerInstall(data: Any) -> ServerInstall: field = data.get("os_id", None) if field is not None: args["os_id"] = field + else: + args["os_id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("partitions", None) if field is not None: args["partitions"] = ( [unmarshal_Partition(v) for v in field] if field is not None else None ) + else: + args["partitions"] = None field = data.get("ssh_key_ids", None) if field is not None: args["ssh_key_ids"] = field + else: + args["ssh_key_ids"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("user_login", None) if field is not None: @@ -3197,6 +3912,8 @@ def unmarshal_SubscribeStorageOptionsResponse( args["services"] = ( [unmarshal_Service(v) for v in field] if field is not None else None ) + else: + args["services"] = field(default_factory=list) return SubscribeStorageOptionsResponse(**args) @@ -3208,7 +3925,7 @@ def marshal_AttachFailoverIPToMacAddressRequest( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.mac is not None: output["mac"] = request.mac @@ -3244,7 +3961,9 @@ def marshal_CreateFailoverIPsRequest( output["quantity"] = request.quantity if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3262,7 +3981,9 @@ def marshal_CreateServerRequest( output["server_option_ids"] = request.server_option_ids if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.datacenter_name is not None: output["datacenter_name"] = request.datacenter_name @@ -3328,10 +4049,10 @@ def marshal_InstallPartition( output: Dict[str, Any] = {} if request.file_system is not None: - output["file_system"] = str(request.file_system) + output["file_system"] = request.file_system if request.raid_level is not None: - output["raid_level"] = str(request.raid_level) + output["raid_level"] = request.raid_level if request.capacity is not None: output["capacity"] = request.capacity @@ -3408,7 +4129,9 @@ def marshal_RpnSanApiCreateRpnSanRequest( output["offer_id"] = request.offer_id if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3456,7 +4179,9 @@ def marshal_RpnV1ApiCreateRpnGroupRequest( output["san_server_ids"] = request.san_server_ids if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3483,7 +4208,9 @@ def marshal_RpnV1ApiLeaveRpnGroupRequest( output["member_ids"] = request.member_ids if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3498,7 +4225,9 @@ def marshal_RpnV1ApiRpnGroupInviteRequest( output["server_ids"] = request.server_ids if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3540,10 +4269,12 @@ def marshal_RpnV2ApiCreateRpnV2GroupRequest( output["servers"] = request.servers if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ return output @@ -3654,7 +4385,7 @@ def marshal_UpdatableRaidArray( output: Dict[str, Any] = {} if request.raid_level is not None: - output["raid_level"] = str(request.raid_level) + output["raid_level"] = request.raid_level if request.disk_ids is not None: output["disk_ids"] = request.disk_ids diff --git a/scaleway-async/scaleway_async/dedibox/v1/types.py b/scaleway-async/scaleway_async/dedibox/v1/types.py index 4c4b12292..1ff06034d 100644 --- a/scaleway-async/scaleway_async/dedibox/v1/types.py +++ b/scaleway-async/scaleway_async/dedibox/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -707,7 +707,6 @@ class OfferSANInfo: @dataclass class OfferStorageInfo: max_quota: int - size: int @@ -781,34 +780,34 @@ class Offer: Payment frequency of the offer. """ - pricing: Optional[Money] + pricing: Optional[Money] = None """ Price of the offer. """ - server_info: Optional[OfferServerInfo] + server_info: Optional[OfferServerInfo] = None - service_level_info: Optional[OfferServiceLevelInfo] + service_level_info: Optional[OfferServiceLevelInfo] = None - rpn_info: Optional[OfferRPNInfo] + rpn_info: Optional[OfferRPNInfo] = None - san_info: Optional[OfferSANInfo] + san_info: Optional[OfferSANInfo] = None - antidos_info: Optional[OfferAntiDosInfo] + antidos_info: Optional[OfferAntiDosInfo] = None - backup_info: Optional[OfferBackupInfo] + backup_info: Optional[OfferBackupInfo] = None - usb_storage_info: Optional[OfferStorageInfo] + usb_storage_info: Optional[OfferStorageInfo] = None - storage_info: Optional[OfferStorageInfo] + storage_info: Optional[OfferStorageInfo] = None - license_info: Optional[OfferLicenseInfo] + license_info: Optional[OfferLicenseInfo] = None - failover_ip_info: Optional[OfferFailoverIpInfo] + failover_ip_info: Optional[OfferFailoverIpInfo] = None - failover_block_info: Optional[OfferFailoverBlockInfo] + failover_block_info: Optional[OfferFailoverBlockInfo] = None - bandwidth_info: Optional[OfferBandwidthInfo] + bandwidth_info: Optional[OfferBandwidthInfo] = None @dataclass @@ -921,27 +920,27 @@ class OS: Hostname max length. """ - max_partitions: Optional[int] + max_partitions: Optional[int] = 0 """ Maximum number of partitions which can be created. """ - panel_password_regex: Optional[str] + panel_password_regex: Optional[str] = None """ Regex used to validate the panel installation password. """ - requires_valid_hostname: Optional[bool] + requires_valid_hostname: Optional[bool] = False """ If both requires_valid_hostname & hostname_regex are set, it means that at least one of the criteria must be valid. """ - hostname_regex: Optional[str] + hostname_regex: Optional[str] = None """ If both requires_valid_hostname & hostname_regex are set, it means that at least one of the criteria must be valid. """ - released_at: Optional[datetime] + released_at: Optional[datetime] = None """ OS release date. """ @@ -950,23 +949,17 @@ class OS: @dataclass class ServerLocation: rack: str - room: str - datacenter_name: str @dataclass class ServerOption: options: List[ServerOption] - - offer: Optional[Offer] - - created_at: Optional[datetime] - - updated_at: Optional[datetime] - - expired_at: Optional[datetime] + offer: Optional[Offer] = None + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + expired_at: Optional[datetime] = None @dataclass @@ -1019,11 +1012,6 @@ class RpnSan: Offer ID. """ - created_at: Optional[datetime] - """ - Date of creation of the RPN SAN. - """ - offer_name: str """ Offer description. @@ -1040,7 +1028,6 @@ class RpnSan: """ iqn: str - rpnv1_compatible: bool """ True if the SAN is compatible with the RPNv1 technology. @@ -1051,19 +1038,23 @@ class RpnSan: True if the offer supports the RPNv1 implicitly, false if it must to be added to a group to support RPNv1. """ - offer: Optional[Offer] + created_at: Optional[datetime] = None + """ + Date of creation of the RPN SAN. + """ - delivered_at: Optional[datetime] + offer: Optional[Offer] = None + delivered_at: Optional[datetime] = None """ RPN SAN delivery date. """ - terminated_at: Optional[datetime] + terminated_at: Optional[datetime] = None """ RPN SAN termination date. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ RPN SAN expiration date. """ @@ -1111,7 +1102,7 @@ class RpnGroup: Rpn group project ID. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Rpn group creation date. """ @@ -1120,7 +1111,6 @@ class RpnGroup: @dataclass class RpnV2GroupSubnet: address: str - cidr: int @@ -1151,11 +1141,6 @@ class Server: Status of the server. """ - rebooted_at: Optional[datetime] - """ - Date of last reboot of the server. - """ - abuse_contact: str """ Abuse contact of the server. @@ -1211,42 +1196,47 @@ class Server: Whether or not the server is HDS. """ - created_at: Optional[datetime] + rebooted_at: Optional[datetime] = None + """ + Date of last reboot of the server. + """ + + created_at: Optional[datetime] = None """ Date of creation of the server. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date of last modification of the server. """ - expired_at: Optional[datetime] + expired_at: Optional[datetime] = None """ Date of release of the server. """ - offer: Optional[Offer] + offer: Optional[Offer] = None """ Offer of the server. """ - location: Optional[ServerLocation] + location: Optional[ServerLocation] = None """ Location of the server. """ - os: Optional[OS] + os: Optional[OS] = None """ OS installed on the server. """ - level: Optional[ServiceLevel] + level: Optional[ServiceLevel] = None """ Service level of the server. """ - rescue_os: Optional[OS] + rescue_os: Optional[OS] = None """ Rescue OS of the server. """ @@ -1293,16 +1283,13 @@ class FailoverBlock: @dataclass class RpnSanIpRpnV2Group: id: int - name: str @dataclass class RpnSanIpServer: id: int - hostname: str - datacenter_name: str @@ -1386,12 +1373,12 @@ class RpnV2Group: RPN V2 gateway. """ - subnet: Optional[RpnV2GroupSubnet] + subnet: Optional[RpnV2GroupSubnet] = None """ RPN V2 subnet. """ - rpnv1_group: Optional[RpnGroup] + rpnv1_group: Optional[RpnGroup] = None """ The RPNv1 group (if the compatibility was enabled). """ @@ -1414,26 +1401,22 @@ class RpnV2Member: RPN V2 member VLAN. """ - speed: Optional[int] + speed: Optional[int] = 0 """ RPN speed. """ - server: Optional[Server] + server: Optional[Server] = None - rpnv1_group: Optional[RpnGroup] + rpnv1_group: Optional[RpnGroup] = None @dataclass class ServerDisk: id: int - connector: str - type_: ServerDiskType - capacity: int - is_addon: bool @@ -1454,32 +1437,32 @@ class Service: Service type, either order or service. """ - resource_id: Optional[int] + resource_id: Optional[int] = 0 """ Resource ID of the service. """ - offer: Optional[Offer] + offer: Optional[Offer] = None """ Offer of the service. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the service. """ - delivered_at: Optional[datetime] + delivered_at: Optional[datetime] = None """ Delivery date of the service. """ - terminated_at: Optional[datetime] + terminated_at: Optional[datetime] = None """ Terminatation date of the service. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the service. """ @@ -1488,7 +1471,6 @@ class Service: @dataclass class GetIPv6BlockQuotasResponseQuota: quota: int - cidr: int @@ -1514,7 +1496,7 @@ class InstallPartition: Connectors of the installation partition. """ - mount_point: Optional[str] + mount_point: Optional[str] = None """ Mount point of the installation partition. """ @@ -1567,22 +1549,22 @@ class FailoverIP: The interface type. """ - mac: Optional[str] + mac: Optional[str] = None """ MAC address of the IP failover. """ - server_id: Optional[int] + server_id: Optional[int] = 0 """ Server ID linked to the IP failover. """ - block: Optional[FailoverBlock] + block: Optional[FailoverBlock] = None """ Block of the IP failover. """ - server_zone: Optional[str] + server_zone: Optional[str] = None """ The server zone (if assigned). """ @@ -1591,27 +1573,19 @@ class FailoverIP: @dataclass class ListIPv6BlockSubnetsAvailableResponseSubnet: address: str - cidr: int @dataclass class InvoiceSummary: id: int - status: InvoiceStatus - payment_method: InvoicePaymentMethod - transaction_id: int - - total_with_taxes: Optional[Money] - - total_without_taxes: Optional[Money] - - created_at: Optional[datetime] - - paid_at: Optional[datetime] + total_with_taxes: Optional[Money] = None + total_without_taxes: Optional[Money] = None + created_at: Optional[datetime] = None + paid_at: Optional[datetime] = None @dataclass @@ -1621,31 +1595,25 @@ class RpnSanIp: IP type (server | rpnv2_subnet). """ - ip: Optional[IP] + ip: Optional[IP] = None """ An IP object. """ - server: Optional[RpnSanIpServer] + server: Optional[RpnSanIpServer] = None - rpnv2_group: Optional[RpnSanIpRpnV2Group] + rpnv2_group: Optional[RpnSanIpRpnV2Group] = None @dataclass class RefundSummary: id: int - status: RefundStatus - method: RefundMethod - - total_with_taxes: Optional[Money] - - total_without_taxes: Optional[Money] - - created_at: Optional[datetime] - - refunded_at: Optional[datetime] + total_with_taxes: Optional[Money] = None + total_without_taxes: Optional[Money] = None + created_at: Optional[datetime] = None + refunded_at: Optional[datetime] = None @dataclass @@ -1680,17 +1648,17 @@ class RpnGroupMember: RPN member owner. """ - san_server: Optional[RpnSanServer] + san_server: Optional[RpnSanServer] = None """ Authorized RPN SAN server. """ - server: Optional[Server] + server: Optional[Server] = None """ Authorized rpn v1 capable server. """ - speed: Optional[int] + speed: Optional[int] = 0 """ RPN speed. """ @@ -1733,11 +1701,6 @@ class RpnSanSummary: Offer ID. """ - created_at: Optional[datetime] - """ - Date of creation of the RPN SAN. - """ - offer_name: str """ Offer description. @@ -1763,17 +1726,22 @@ class RpnSanSummary: True if the offer supports the RPNv1 implicitly, false if it must to be added to a group to support RPNv1. """ - delivered_at: Optional[datetime] + created_at: Optional[datetime] = None + """ + Date of creation of the RPN SAN. + """ + + delivered_at: Optional[datetime] = None """ RPN SAN delivery date. """ - terminated_at: Optional[datetime] + terminated_at: Optional[datetime] = None """ RPN SAN termination date. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ RPN SAN expiration date. """ @@ -1826,12 +1794,12 @@ class RpnServerCapability: True if server can join an rpnv2 group. """ - ip_address: Optional[str] + ip_address: Optional[str] = None """ Private IP address (if rpn compatiblle). """ - rpn_version: Optional[int] + rpn_version: Optional[int] = 0 """ Supported rpn version. """ @@ -1854,22 +1822,22 @@ class Log: Action status. """ - group: Optional[RpnV2Group] + group: Optional[RpnV2Group] = None """ RPN V2 group. """ - member: Optional[RpnV2Member] + member: Optional[RpnV2Member] = None """ RPN V2 member (if appliable). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date. """ - finished_at: Optional[datetime] + finished_at: Optional[datetime] = None """ Completion date. """ @@ -1887,7 +1855,7 @@ class ServerEvent: Description of the event. """ - date: Optional[datetime] + date: Optional[datetime] = None """ Date of the event. """ @@ -1920,21 +1888,6 @@ class ServerSummary: Hostname of the server. """ - created_at: Optional[datetime] - """ - Date of creation of the server. - """ - - updated_at: Optional[datetime] - """ - Date of last modification of the server. - """ - - expired_at: Optional[datetime] - """ - Date of release of the server. - """ - offer_id: int """ Offer ID of the server. @@ -1975,17 +1928,32 @@ class ServerSummary: Whether or not the server is HDS. """ - os_id: Optional[int] + created_at: Optional[datetime] = None + """ + Date of creation of the server. + """ + + updated_at: Optional[datetime] = None + """ + Date of last modification of the server. + """ + + expired_at: Optional[datetime] = None + """ + Date of release of the server. + """ + + os_id: Optional[int] = 0 """ OS ID installed on server. """ - level: Optional[ServiceLevel] + level: Optional[ServiceLevel] = None """ Service level of the server. """ - rpn_version: Optional[int] + rpn_version: Optional[int] = 0 """ Supported RPN version. """ @@ -2121,7 +2089,7 @@ class Partition: Connectors of the partition. """ - mount_point: Optional[str] + mount_point: Optional[str] = None """ Mount point of the partition. """ @@ -2147,17 +2115,19 @@ class AttachFailoverIPToMacAddressRequest: ID of the failover IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - type_: Optional[AttachFailoverIPToMacAddressRequestMacType] + type_: Optional[AttachFailoverIPToMacAddressRequestMacType] = ( + AttachFailoverIPToMacAddressRequestMacType.MAC_TYPE_UNKNOWN + ) """ A mac type. """ - mac: Optional[str] + mac: Optional[str] = None """ A valid mac address (existing or not). """ @@ -2175,7 +2145,7 @@ class AttachFailoverIPsRequest: List of ID of failovers IP to attach. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2203,7 +2173,7 @@ class BMCAccess: Status of the connection. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ The date after which the BMC (Baseboard Management Controller) access will be closed. """ @@ -2264,7 +2234,7 @@ class Backup: @dataclass class BillingApiCanOrderRequest: - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -2289,43 +2259,30 @@ class BillingApiGetRefundRequest: @dataclass class BillingApiListInvoicesRequest: - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListInvoicesRequestOrderBy] - - project_id: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListInvoicesRequestOrderBy] = None + project_id: Optional[str] = None @dataclass class BillingApiListRefundsRequest: - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListRefundsRequestOrderBy] - - project_id: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListRefundsRequestOrderBy] = None + project_id: Optional[str] = None @dataclass class CanOrderResponse: can_order: bool - quota_ok: bool - phone_confirmed: bool - email_confirmed: bool - user_confirmed: bool - payment_mode: bool - billing_ok: bool - - message: Optional[str] + message: Optional[str] = None @dataclass @@ -2335,7 +2292,7 @@ class CancelServerInstallRequest: Server ID of the server to cancel install. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2353,12 +2310,12 @@ class CreateFailoverIPsRequest: Quantity. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -2367,7 +2324,6 @@ class CreateFailoverIPsRequest: @dataclass class CreateFailoverIPsResponse: total_count: int - services: List[Service] @@ -2383,17 +2339,17 @@ class CreateServerRequest: Server option IDs of the new server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the new server. """ - datacenter_name: Optional[str] + datacenter_name: Optional[str] = None """ Datacenter name of the new server. """ @@ -2406,7 +2362,7 @@ class DeleteFailoverIPRequest: ID of the failover IP to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2419,7 +2375,7 @@ class DeleteServerRequest: Server ID to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2432,7 +2388,7 @@ class DeleteServiceRequest: ID of the service. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2445,7 +2401,7 @@ class DetachFailoverIPFromMacAddressRequest: ID of the failover IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2458,7 +2414,7 @@ class DetachFailoverIPsRequest: List of IDs of failovers IP to detach. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2471,7 +2427,7 @@ class GetBMCAccessRequest: ID of the server to get BMC access. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2484,7 +2440,7 @@ class GetFailoverIPRequest: ID of the failover IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2515,12 +2471,12 @@ class GetOSRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -2533,12 +2489,12 @@ class GetOfferRequest: ID of offer. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -2547,8 +2503,7 @@ class GetOfferRequest: @dataclass class GetOrderedServiceRequest: ordered_service_id: int - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2561,7 +2516,7 @@ class GetRaidRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2569,12 +2524,12 @@ class GetRaidRequest: @dataclass class GetRemainingQuotaRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -2610,7 +2565,7 @@ class GetRescueRequest: ID of the server to get rescue. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2623,7 +2578,7 @@ class GetRpnStatusResponse: If status = 'operational', you can perform rpn actions in write. """ - operations_left: Optional[int] + operations_left: Optional[int] = 0 """ Number of operations left to perform before being operational. """ @@ -2636,7 +2591,7 @@ class GetServerBackupRequest: Server ID of the backup. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2654,7 +2609,7 @@ class GetServerDefaultPartitioningRequest: OS ID of the default partitioning. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2667,7 +2622,7 @@ class GetServerInstallRequest: Server ID of the server to install. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2680,7 +2635,7 @@ class GetServerRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2693,7 +2648,7 @@ class GetServiceRequest: ID of the service. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2739,7 +2694,7 @@ class IPv6Block: @dataclass class IPv6BlockApiCreateIPv6BlockRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ @@ -2773,7 +2728,7 @@ class IPv6BlockApiDeleteIPv6BlockRequest: @dataclass class IPv6BlockApiGetIPv6BlockQuotasRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ @@ -2781,7 +2736,7 @@ class IPv6BlockApiGetIPv6BlockQuotasRequest: @dataclass class IPv6BlockApiGetIPv6BlockRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ @@ -2802,7 +2757,7 @@ class IPv6BlockApiUpdateIPv6BlockRequest: ID of the IPv6 block. """ - nameservers: Optional[List[str]] + nameservers: Optional[List[str]] = field(default_factory=list) """ DNS to link to the IPv6. """ @@ -2825,47 +2780,47 @@ class InstallServerRequest: Hostname of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - user_login: Optional[str] + user_login: Optional[str] = None """ User to install on the server. """ - user_password: Optional[str] + user_password: Optional[str] = None """ User password to install on the server. """ - panel_password: Optional[str] + panel_password: Optional[str] = None """ Panel password to install on the server. """ - root_password: Optional[str] + root_password: Optional[str] = None """ Root password to install on the server. """ - partitions: Optional[List[InstallPartition]] + partitions: Optional[List[InstallPartition]] = field(default_factory=list) """ Partitions to install on the server. """ - ssh_key_ids: Optional[List[str]] + ssh_key_ids: Optional[List[str]] = field(default_factory=list) """ SSH key IDs authorized on the server. """ - license_offer_id: Optional[int] + license_offer_id: Optional[int] = 0 """ Offer ID of license to install on server. """ - ip_id: Optional[int] + ip_id: Optional[int] = 0 """ IP to link at the license to install on server. """ @@ -2874,57 +2829,51 @@ class InstallServerRequest: @dataclass class Invoice: id: int - status: InvoiceStatus - payment_method: InvoicePaymentMethod - content: str - transaction_id: int - - total_with_taxes: Optional[Money] - - total_without_taxes: Optional[Money] - - created_at: Optional[datetime] - - paid_at: Optional[datetime] + total_with_taxes: Optional[Money] = None + total_without_taxes: Optional[Money] = None + created_at: Optional[datetime] = None + paid_at: Optional[datetime] = None @dataclass class ListFailoverIPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of failovers IP per page. """ - order_by: Optional[ListFailoverIPsRequestOrderBy] + order_by: Optional[ListFailoverIPsRequestOrderBy] = ( + ListFailoverIPsRequestOrderBy.IP_ASC + ) """ Order of the failovers IP. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter failovers IP by project ID. """ - search: Optional[str] + search: Optional[str] = None """ Filter failovers IP which matching with this field. """ - only_available: Optional[bool] + only_available: Optional[bool] = False """ True: return all failovers IP not attached on server false: return all failovers IP attached on server. @@ -2960,7 +2909,6 @@ class ListIPv6BlockSubnetsAvailableResponse: @dataclass class ListInvoicesResponse: total_count: int - invoices: List[InvoiceSummary] @@ -2984,32 +2932,32 @@ class ListOSRequest: Filter OS by compatible server ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of OS per page. """ - order_by: Optional[ListOSRequestOrderBy] + order_by: Optional[ListOSRequestOrderBy] = ListOSRequestOrderBy.CREATED_AT_ASC """ Order of the OS. """ - type_: Optional[OSType] + type_: Optional[OSType] = OSType.UNKNOWN_TYPE """ Type of the OS. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -3030,62 +2978,64 @@ class ListOSResponse: @dataclass class ListOffersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of offer per page. """ - order_by: Optional[ListOffersRequestOrderBy] + order_by: Optional[ListOffersRequestOrderBy] = ( + ListOffersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the offers. """ - commercial_range: Optional[str] + commercial_range: Optional[str] = None """ Filter on commercial range. """ - catalog: Optional[OfferCatalog] + catalog: Optional[OfferCatalog] = OfferCatalog.ALL """ Filter on catalog. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ - is_failover_ip: Optional[bool] + is_failover_ip: Optional[bool] = False """ Get the current failover IP offer. """ - is_failover_block: Optional[bool] + is_failover_block: Optional[bool] = False """ Get the current failover IP block offer. """ - sold_in: Optional[List[str]] + sold_in: Optional[List[str]] = None """ Filter offers depending on their datacenter. """ - available_only: Optional[bool] + available_only: Optional[bool] = False """ Set this filter to true to only return available offers. """ - is_rpn_san: Optional[bool] + is_rpn_san: Optional[bool] = False """ Get the RPN SAN offers. """ @@ -3107,7 +3057,6 @@ class ListOffersResponse: @dataclass class ListRefundsResponse: total_count: int - refunds: List[RefundSummary] @@ -3261,22 +3210,24 @@ class ListServerDisksRequest: Server ID of the server disks. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of server disk per page. """ - order_by: Optional[ListServerDisksRequestOrderBy] + order_by: Optional[ListServerDisksRequestOrderBy] = ( + ListServerDisksRequestOrderBy.CREATED_AT_ASC + ) """ Order of the server disks. """ @@ -3302,22 +3253,24 @@ class ListServerEventsRequest: Server ID of the server events. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of server event per page. """ - order_by: Optional[ListServerEventsRequestOrderBy] + order_by: Optional[ListServerEventsRequestOrderBy] = ( + ListServerEventsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the server events. """ @@ -3338,32 +3291,34 @@ class ListServerEventsResponse: @dataclass class ListServersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of server per page. """ - order_by: Optional[ListServersRequestOrderBy] + order_by: Optional[ListServersRequestOrderBy] = ( + ListServersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the servers. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter servers by project ID. """ - search: Optional[str] + search: Optional[str] = None """ Filter servers by hostname. """ @@ -3384,27 +3339,29 @@ class ListServersResponse: @dataclass class ListServicesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of service per page. """ - order_by: Optional[ListServicesRequestOrderBy] + order_by: Optional[ListServicesRequestOrderBy] = ( + ListServicesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the services. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -3430,17 +3387,17 @@ class ListSubscribableServerOptionsRequest: Server ID of the subscribable server options. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of subscribable server option per page. """ @@ -3461,65 +3418,43 @@ class ListSubscribableServerOptionsResponse: @dataclass class OfferFailoverBlockInfo: - onetime_fees: Optional[Offer] + onetime_fees: Optional[Offer] = None @dataclass class OfferFailoverIpInfo: - onetime_fees: Optional[Offer] + onetime_fees: Optional[Offer] = None @dataclass class OfferServerInfo: bandwidth: int - stock: OfferServerInfoStock - commercial_range: str - disks: List[Disk] - cpus: List[CPU] - memories: List[Memory] - persistent_memories: List[PersistentMemory] - raid_controllers: List[RaidController] - available_options: List[Offer] - connectivity: int - stock_by_datacenter: Dict[str, OfferServerInfoStock] - - rpn_version: Optional[int] - - onetime_fees: Optional[Offer] + rpn_version: Optional[int] = None + onetime_fees: Optional[Offer] = None @dataclass class OfferServiceLevelInfo: support_ticket: bool - support_phone: bool - sales_support: bool - git: str - sla: float - priority_support: bool - high_rpn_bandwidth: bool - customization: bool - antidos: bool - extra_failover_quota: int - available_options: List[Offer] @@ -3538,7 +3473,7 @@ class RebootServerRequest: Server ID to reboot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3547,20 +3482,13 @@ class RebootServerRequest: @dataclass class Refund: id: int - status: RefundStatus - method: RefundMethod - content: str - - total_with_taxes: Optional[Money] - - total_without_taxes: Optional[Money] - - created_at: Optional[datetime] - - refunded_at: Optional[datetime] + total_with_taxes: Optional[Money] = None + total_without_taxes: Optional[Money] = None + created_at: Optional[datetime] = None + refunded_at: Optional[datetime] = None @dataclass @@ -3588,17 +3516,17 @@ class Rescue: @dataclass class RpnApiGetRpnStatusRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ A project ID. """ - rpnv1_group_id: Optional[int] + rpnv1_group_id: Optional[int] = 0 """ An RPN v1 group ID. """ - rpnv2_group_id: Optional[int] + rpnv2_group_id: Optional[int] = 0 """ An RPN v2 group ID. """ @@ -3606,22 +3534,24 @@ class RpnApiGetRpnStatusRequest: @dataclass class RpnApiListRpnServerCapabilitiesRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of servers per page. """ - order_by: Optional[ListRpnServerCapabilitiesRequestOrderBy] + order_by: Optional[ListRpnServerCapabilitiesRequestOrderBy] = ( + ListRpnServerCapabilitiesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the servers. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter servers by project ID. """ @@ -3647,7 +3577,7 @@ class RpnSanApiCreateRpnSanRequest: Offer ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Your project ID. """ @@ -3676,7 +3606,7 @@ class RpnSanApiListAvailableIpsRequest: RPN SAN ID. """ - type_: Optional[RpnSanIpType] + type_: Optional[RpnSanIpType] = RpnSanIpType.UNKNOWN """ Filter by IP type (server | rpnv2_subnet). """ @@ -3689,7 +3619,7 @@ class RpnSanApiListIpsRequest: RPN SAN ID. """ - type_: Optional[RpnSanIpType] + type_: Optional[RpnSanIpType] = RpnSanIpType.UNKNOWN """ Filter by IP type (server | rpnv2_subnet). """ @@ -3697,22 +3627,24 @@ class RpnSanApiListIpsRequest: @dataclass class RpnSanApiListRpnSansRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of RPN SANs per page. """ - order_by: Optional[ListRpnSansRequestOrderBy] + order_by: Optional[ListRpnSansRequestOrderBy] = ( + ListRpnSansRequestOrderBy.CREATED_AT_ASC + ) """ Order of the RPN SANs. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter RPN SANs by project ID. """ @@ -3746,12 +3678,12 @@ class RpnV1ApiAddRpnGroupMembersRequest: The rpn v1 group ID. """ - server_ids: Optional[List[int]] + server_ids: Optional[List[int]] = field(default_factory=list) """ A collection of rpn v1 capable server IDs. """ - san_server_ids: Optional[List[int]] + san_server_ids: Optional[List[int]] = field(default_factory=list) """ A collection of rpn v1 capable RPN SAN server IDs. """ @@ -3764,17 +3696,17 @@ class RpnV1ApiCreateRpnGroupRequest: Rpn v1 group name. """ - server_ids: Optional[List[int]] + server_ids: Optional[List[int]] = field(default_factory=list) """ A collection of rpn v1 capable servers. """ - san_server_ids: Optional[List[int]] + san_server_ids: Optional[List[int]] = field(default_factory=list) """ A collection of rpn v1 capable rpn sans servers. """ - project_id: Optional[str] + project_id: Optional[str] = None """ A project ID. """ @@ -3821,7 +3753,7 @@ class RpnV1ApiLeaveRpnGroupRequest: A collection of rpn v1 group members IDs. """ - project_id: Optional[str] + project_id: Optional[str] = None """ A project ID. """ @@ -3829,22 +3761,24 @@ class RpnV1ApiLeaveRpnGroupRequest: @dataclass class RpnV1ApiListRpnCapableSanServersRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn capable resources per page. """ - order_by: Optional[ListRpnCapableSanServersRequestOrderBy] + order_by: Optional[ListRpnCapableSanServersRequestOrderBy] = ( + ListRpnCapableSanServersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn capable resources. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn capable resources by project ID. """ @@ -3852,22 +3786,24 @@ class RpnV1ApiListRpnCapableSanServersRequest: @dataclass class RpnV1ApiListRpnCapableServersRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn capable resources per page. """ - order_by: Optional[ListRpnCapableServersRequestOrderBy] + order_by: Optional[ListRpnCapableServersRequestOrderBy] = ( + ListRpnCapableServersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn capable resources. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn capable resources by project ID. """ @@ -3875,27 +3811,29 @@ class RpnV1ApiListRpnCapableServersRequest: @dataclass class RpnV1ApiListRpnGroupMembersRequest: - page: Optional[int] + group_id: int """ - Page number. + Filter rpn v1 group members by group ID. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of rpn v1 group members per page. + Page number. """ - order_by: Optional[ListRpnGroupMembersRequestOrderBy] + page_size: Optional[int] = 0 """ - Order of the rpn v1 group members. + Number of rpn v1 group members per page. """ - group_id: int + order_by: Optional[ListRpnGroupMembersRequestOrderBy] = ( + ListRpnGroupMembersRequestOrderBy.CREATED_AT_ASC + ) """ - Filter rpn v1 group members by group ID. + Order of the rpn v1 group members. """ - project_id: Optional[str] + project_id: Optional[str] = None """ A project ID. """ @@ -3903,22 +3841,24 @@ class RpnV1ApiListRpnGroupMembersRequest: @dataclass class RpnV1ApiListRpnGroupsRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn v1 groups per page. """ - order_by: Optional[ListRpnGroupsRequestOrderBy] + order_by: Optional[ListRpnGroupsRequestOrderBy] = ( + ListRpnGroupsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn v1 groups. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn v1 groups by project ID. """ @@ -3926,22 +3866,24 @@ class RpnV1ApiListRpnGroupsRequest: @dataclass class RpnV1ApiListRpnInvitesRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn capable resources per page. """ - order_by: Optional[ListRpnInvitesRequestOrderBy] + order_by: Optional[ListRpnInvitesRequestOrderBy] = ( + ListRpnInvitesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn capable resources. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn capable resources by project ID. """ @@ -3967,7 +3909,7 @@ class RpnV1ApiRpnGroupInviteRequest: A collection of external server IDs. """ - project_id: Optional[str] + project_id: Optional[str] = None """ A project ID. """ @@ -3980,7 +3922,7 @@ class RpnV1ApiUpdateRpnGroupNameRequest: Rpn v1 group ID. """ - name: Optional[str] + name: Optional[str] = None """ New rpn v1 group name. """ @@ -4011,12 +3953,12 @@ class RpnV2ApiCreateRpnV2GroupRequest: A collection of server IDs. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the RPN V2 group. """ - type_: Optional[RpnV2GroupType] + type_: Optional[RpnV2GroupType] = RpnV2GroupType.UNKNOWN_TYPE """ RPN V2 group type (qing / standard). """ @@ -4074,22 +4016,24 @@ class RpnV2ApiGetRpnV2GroupRequest: @dataclass class RpnV2ApiListRpnV2CapableResourcesRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn v2 capable resources per page. """ - order_by: Optional[ListRpnV2CapableResourcesRequestOrderBy] + order_by: Optional[ListRpnV2CapableResourcesRequestOrderBy] = ( + ListRpnV2CapableResourcesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn v2 capable resources. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn v2 capable resources by project ID. """ @@ -4097,45 +4041,49 @@ class RpnV2ApiListRpnV2CapableResourcesRequest: @dataclass class RpnV2ApiListRpnV2GroupLogsRequest: - page: Optional[int] + group_id: int """ - Page number. + RPN V2 group ID. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of rpn v2 group logs per page. + Page number. """ - order_by: Optional[ListRpnV2GroupLogsRequestOrderBy] + page_size: Optional[int] = 0 """ - Order of the rpn v2 group logs. + Number of rpn v2 group logs per page. """ - group_id: int + order_by: Optional[ListRpnV2GroupLogsRequestOrderBy] = ( + ListRpnV2GroupLogsRequestOrderBy.CREATED_AT_ASC + ) """ - RPN V2 group ID. + Order of the rpn v2 group logs. """ @dataclass class RpnV2ApiListRpnV2GroupsRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn v2 groups per page. """ - order_by: Optional[ListRpnV2GroupsRequestOrderBy] + order_by: Optional[ListRpnV2GroupsRequestOrderBy] = ( + ListRpnV2GroupsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn v2 groups. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn v2 groups by project ID. """ @@ -4143,27 +4091,31 @@ class RpnV2ApiListRpnV2GroupsRequest: @dataclass class RpnV2ApiListRpnV2MembersRequest: - page: Optional[int] + group_id: int """ - Page number. + RPN V2 group ID. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of rpn v2 group members per page. + Page number. """ - order_by: Optional[ListRpnV2MembersRequestOrderBy] + page_size: Optional[int] = 0 """ - Order of the rpn v2 group members. + Number of rpn v2 group members per page. """ - group_id: int + order_by: Optional[ListRpnV2MembersRequestOrderBy] = ( + ListRpnV2MembersRequestOrderBy.CREATED_AT_ASC + ) """ - RPN V2 group ID. + Order of the rpn v2 group members. """ - type_: Optional[ListRpnV2MembersRequestType] + type_: Optional[ListRpnV2MembersRequestType] = ( + ListRpnV2MembersRequestType.UNKNOWN_TYPE + ) """ Filter members by type. """ @@ -4176,7 +4128,7 @@ class RpnV2ApiUpdateRpnV2GroupNameRequest: RPN V2 group ID. """ - name: Optional[str] + name: Optional[str] = None """ RPN V2 group name. """ @@ -4194,7 +4146,7 @@ class RpnV2ApiUpdateRpnV2VlanForMembersRequest: RPN V2 member IDs. """ - vlan: Optional[int] + vlan: Optional[int] = 0 """ Min: 0. Max: 3967. @@ -4212,18 +4164,12 @@ class ServerDefaultPartitioning: @dataclass class ServerInstall: os_id: int - hostname: str - partitions: List[Partition] - ssh_key_ids: List[str] - status: ServerInstallStatus - - user_login: Optional[str] - - panel_url: Optional[str] + user_login: Optional[str] = None + panel_url: Optional[str] = None @dataclass @@ -4238,7 +4184,7 @@ class StartBMCAccessRequest: The IP authorized to connect to the given server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4256,7 +4202,7 @@ class StartRescueRequest: OS ID to use to start rescue. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4269,7 +4215,7 @@ class StartServerRequest: Server ID to start. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4282,7 +4228,7 @@ class StopBMCAccessRequest: ID of the server to stop BMC access. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4295,7 +4241,7 @@ class StopRescueRequest: ID of the server to stop rescue. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4308,7 +4254,7 @@ class StopServerRequest: Server ID to stop. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4326,7 +4272,7 @@ class SubscribeServerOptionRequest: Option ID to subscribe. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4344,7 +4290,7 @@ class SubscribeStorageOptionsRequest: Option IDs of the storage options to subscribe. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4370,7 +4316,7 @@ class UpdateRaidRequest: RAIDs to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4388,7 +4334,7 @@ class UpdateReverseRequest: Reverse to apply on the IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4401,22 +4347,22 @@ class UpdateServerBackupRequest: Server ID to update backup. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - password: Optional[str] + password: Optional[str] = None """ Password of the server backup. """ - autologin: Optional[bool] + autologin: Optional[bool] = False """ Autologin of the server backup. """ - acl_enabled: Optional[bool] + acl_enabled: Optional[bool] = False """ Boolean to enable or disable ACL. """ @@ -4429,17 +4375,17 @@ class UpdateServerRequest: Server ID to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - hostname: Optional[str] + hostname: Optional[str] = None """ Hostname of the server to update. """ - enable_ipv6: Optional[bool] + enable_ipv6: Optional[bool] = False """ Flag to enable or not the IPv6 of server. """ @@ -4452,12 +4398,12 @@ class UpdateServerTagsRequest: Server ID to update the tags. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of server to update. """ diff --git a/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py b/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py index 079c77d2e..a5722c6cc 100644 --- a/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py +++ b/scaleway-async/scaleway_async/domain/v2beta1/marshalling.py @@ -13,7 +13,11 @@ resolve_one_of, ) from .types import ( + DomainFeatureStatus, + DomainStatus, LinkedProduct, + TaskStatus, + TaskType, ContactExtensionFRAssociationInfo, ContactExtensionFRCodeAuthAfnicInfo, ContactExtensionFRDunsInfo, @@ -131,6 +135,8 @@ def unmarshal_ContactExtensionFRAssociationInfo( field = data.get("publication_jo_page", None) if field is not None: args["publication_jo_page"] = field + else: + args["publication_jo_page"] = None field = data.get("publication_jo", None) if field is not None: @@ -156,6 +162,8 @@ def unmarshal_ContactExtensionFRCodeAuthAfnicInfo( field = data.get("code_auth_afnic", None) if field is not None: args["code_auth_afnic"] = field + else: + args["code_auth_afnic"] = None return ContactExtensionFRCodeAuthAfnicInfo(**args) @@ -171,10 +179,14 @@ def unmarshal_ContactExtensionFRDunsInfo(data: Any) -> ContactExtensionFRDunsInf field = data.get("duns_id", None) if field is not None: args["duns_id"] = field + else: + args["duns_id"] = None field = data.get("local_id", None) if field is not None: args["local_id"] = field + else: + args["local_id"] = None return ContactExtensionFRDunsInfo(**args) @@ -192,6 +204,8 @@ def unmarshal_ContactExtensionFRIndividualInfo( field = data.get("whois_opt_in", None) if field is not None: args["whois_opt_in"] = field + else: + args["whois_opt_in"] = None return ContactExtensionFRIndividualInfo(**args) @@ -209,6 +223,8 @@ def unmarshal_ContactExtensionFRTrademarkInfo( field = data.get("trademark_inpi", None) if field is not None: args["trademark_inpi"] = field + else: + args["trademark_inpi"] = None return ContactExtensionFRTrademarkInfo(**args) @@ -224,6 +240,8 @@ def unmarshal_ContactExtensionEU(data: Any) -> ContactExtensionEU: field = data.get("european_citizenship", None) if field is not None: args["european_citizenship"] = field + else: + args["european_citizenship"] = None return ContactExtensionEU(**args) @@ -239,6 +257,8 @@ def unmarshal_ContactExtensionFR(data: Any) -> ContactExtensionFR: field = data.get("mode", None) if field is not None: args["mode"] = field + else: + args["mode"] = None field = data.get("individual_info", None) if field is not None: @@ -286,10 +306,14 @@ def unmarshal_ContactExtensionNL(data: Any) -> ContactExtensionNL: field = data.get("legal_form", None) if field is not None: args["legal_form"] = field + else: + args["legal_form"] = None field = data.get("legal_form_registration_number", None) if field is not None: args["legal_form_registration_number"] = field + else: + args["legal_form_registration_number"] = None return ContactExtensionNL(**args) @@ -305,10 +329,14 @@ def unmarshal_ContactQuestion(data: Any) -> ContactQuestion: field = data.get("question", None) if field is not None: args["question"] = field + else: + args["question"] = None field = data.get("answer", None) if field is not None: args["answer"] = field + else: + args["answer"] = None return ContactQuestion(**args) @@ -324,78 +352,116 @@ def unmarshal_Contact(data: Any) -> Contact: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("legal_form", None) if field is not None: args["legal_form"] = field + else: + args["legal_form"] = None field = data.get("firstname", None) if field is not None: args["firstname"] = field + else: + args["firstname"] = None field = data.get("lastname", None) if field is not None: args["lastname"] = field + else: + args["lastname"] = None field = data.get("company_name", None) if field is not None: args["company_name"] = field + else: + args["company_name"] = None field = data.get("email", None) if field is not None: args["email"] = field + else: + args["email"] = None field = data.get("email_alt", None) if field is not None: args["email_alt"] = field + else: + args["email_alt"] = None field = data.get("phone_number", None) if field is not None: args["phone_number"] = field + else: + args["phone_number"] = None field = data.get("fax_number", None) if field is not None: args["fax_number"] = field + else: + args["fax_number"] = None field = data.get("address_line_1", None) if field is not None: args["address_line_1"] = field + else: + args["address_line_1"] = None field = data.get("address_line_2", None) if field is not None: args["address_line_2"] = field + else: + args["address_line_2"] = None field = data.get("zip", None) if field is not None: args["zip"] = field + else: + args["zip"] = None field = data.get("city", None) if field is not None: args["city"] = field + else: + args["city"] = None field = data.get("country", None) if field is not None: args["country"] = field + else: + args["country"] = None field = data.get("vat_identification_code", None) if field is not None: args["vat_identification_code"] = field + else: + args["vat_identification_code"] = None field = data.get("company_identification_code", None) if field is not None: args["company_identification_code"] = field + else: + args["company_identification_code"] = None field = data.get("lang", None) if field is not None: args["lang"] = field + else: + args["lang"] = None field = data.get("resale", None) if field is not None: args["resale"] = field + else: + args["resale"] = None field = data.get("whois_opt_in", None) if field is not None: args["whois_opt_in"] = field + else: + args["whois_opt_in"] = None field = data.get("questions", None) if field is not None: @@ -420,14 +486,20 @@ def unmarshal_Contact(data: Any) -> Contact: field = data.get("email_status", None) if field is not None: args["email_status"] = field + else: + args["email_status"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("extension_nl", None) if field is not None: @@ -449,36 +521,52 @@ def unmarshal_DNSZone(data: Any) -> DNSZone: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("subdomain", None) if field is not None: args["subdomain"] = field + else: + args["subdomain"] = None field = data.get("ns", None) if field is not None: args["ns"] = field + else: + args["ns"] = None field = data.get("ns_default", None) if field is not None: args["ns_default"] = field + else: + args["ns_default"] = None field = data.get("ns_master", None) if field is not None: args["ns_master"] = field + else: + args["ns_master"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("linked_products", None) if field is not None: args["linked_products"] = ( [LinkedProduct(v) for v in field] if field is not None else None ) + else: + args["linked_products"] = None field = data.get("message", None) if field is not None: @@ -506,18 +594,26 @@ def unmarshal_Host(data: Any) -> Host: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("ips", None) if field is not None: args["ips"] = field + else: + args["ips"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None return Host(**args) @@ -533,22 +629,32 @@ def unmarshal_SSLCertificate(data: Any) -> SSLCertificate: field = data.get("dns_zone", None) if field is not None: args["dns_zone"] = field + else: + args["dns_zone"] = None field = data.get("alternative_dns_zones", None) if field is not None: args["alternative_dns_zones"] = field + else: + args["alternative_dns_zones"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("private_key", None) if field is not None: args["private_key"] = field + else: + args["private_key"] = None field = data.get("certificate_chain", None) if field is not None: args["certificate_chain"] = field + else: + args["certificate_chain"] = None field = data.get("created_at", None) if field is not None: @@ -578,6 +684,8 @@ def unmarshal_CheckContactsCompatibilityResponseContactCheckResult( field = data.get("compatible", None) if field is not None: args["compatible"] = field + else: + args["compatible"] = None field = data.get("error_message", None) if field is not None: @@ -601,6 +709,8 @@ def unmarshal_CheckContactsCompatibilityResponse( field = data.get("compatible", None) if field is not None: args["compatible"] = field + else: + args["compatible"] = None field = data.get("owner_check_result", None) if field is not None: @@ -684,6 +794,8 @@ def unmarshal_DSRecordPublicKey(data: Any) -> DSRecordPublicKey: field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None return DSRecordPublicKey(**args) @@ -699,10 +811,14 @@ def unmarshal_DSRecordDigest(data: Any) -> DSRecordDigest: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("digest", None) if field is not None: args["digest"] = field + else: + args["digest"] = None field = data.get("public_key", None) if field is not None: @@ -724,10 +840,14 @@ def unmarshal_DSRecord(data: Any) -> DSRecord: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("algorithm", None) if field is not None: args["algorithm"] = field + else: + args["algorithm"] = None field = data.get("digest", None) if field is not None: @@ -755,10 +875,14 @@ def unmarshal_TldOffer(data: Any) -> TldOffer: field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = None field = data.get("operation_path", None) if field is not None: args["operation_path"] = field + else: + args["operation_path"] = None field = data.get("price", None) if field is not None: @@ -780,12 +904,16 @@ def unmarshal_DomainDNSSEC(data: Any) -> DomainDNSSEC: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("ds_records", None) if field is not None: args["ds_records"] = ( [unmarshal_DSRecord(v) for v in field] if field is not None else None ) + else: + args["ds_records"] = None return DomainDNSSEC(**args) @@ -803,6 +931,8 @@ def unmarshal_DomainRegistrationStatusExternalDomain( field = data.get("validation_token", None) if field is not None: args["validation_token"] = field + else: + args["validation_token"] = None return DomainRegistrationStatusExternalDomain(**args) @@ -820,14 +950,20 @@ def unmarshal_DomainRegistrationStatusTransfer( field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("vote_current_owner", None) if field is not None: args["vote_current_owner"] = field + else: + args["vote_current_owner"] = None field = data.get("vote_new_owner", None) if field is not None: args["vote_new_owner"] = field + else: + args["vote_new_owner"] = None return DomainRegistrationStatusTransfer(**args) @@ -843,22 +979,32 @@ def unmarshal_Tld(data: Any) -> Tld: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("dnssec_support", None) if field is not None: args["dnssec_support"] = field + else: + args["dnssec_support"] = None field = data.get("duration_in_years_min", None) if field is not None: args["duration_in_years_min"] = field + else: + args["duration_in_years_min"] = None field = data.get("duration_in_years_max", None) if field is not None: args["duration_in_years_max"] = field + else: + args["duration_in_years_max"] = None field = data.get("idn_support", None) if field is not None: args["idn_support"] = field + else: + args["idn_support"] = None field = data.get("offers", None) if field is not None: @@ -867,10 +1013,14 @@ def unmarshal_Tld(data: Any) -> Tld: if field is not None else None ) + else: + args["offers"] = None field = data.get("specifications", None) if field is not None: args["specifications"] = field + else: + args["specifications"] = None return Tld(**args) @@ -886,30 +1036,44 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("auto_renew_status", None) if field is not None: args["auto_renew_status"] = field + else: + args["auto_renew_status"] = DomainFeatureStatus.FEATURE_STATUS_UNKNOWN field = data.get("epp_code", None) if field is not None: args["epp_code"] = field + else: + args["epp_code"] = field(default_factory=list) field = data.get("registrar", None) if field is not None: args["registrar"] = field + else: + args["registrar"] = None field = data.get("is_external", None) if field is not None: args["is_external"] = field + else: + args["is_external"] = False field = data.get("dnssec", None) if field is not None: @@ -932,22 +1096,30 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainStatus.STATUS_UNKNOWN field = data.get("dns_zones", None) if field is not None: args["dns_zones"] = ( [unmarshal_DNSZone(v) for v in field] if field is not None else None ) + else: + args["dns_zones"] = field(default_factory=list) field = data.get("linked_products", None) if field is not None: args["linked_products"] = ( [LinkedProduct(v) for v in field] if field is not None else None ) + else: + args["linked_products"] = field(default_factory=list) field = data.get("pending_trade", None) if field is not None: args["pending_trade"] = field + else: + args["pending_trade"] = False field = data.get("owner_contact", None) if field is not None: @@ -1003,14 +1175,20 @@ def unmarshal_GetDNSZoneTsigKeyResponse(data: Any) -> GetDNSZoneTsigKeyResponse: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None field = data.get("algorithm", None) if field is not None: args["algorithm"] = field + else: + args["algorithm"] = None return GetDNSZoneTsigKeyResponse(**args) @@ -1026,14 +1204,20 @@ def unmarshal_RecordGeoIPConfigMatch(data: Any) -> RecordGeoIPConfigMatch: field = data.get("countries", None) if field is not None: args["countries"] = field + else: + args["countries"] = None field = data.get("continents", None) if field is not None: args["continents"] = field + else: + args["continents"] = None field = data.get("data", None) if field is not None: args["data"] = field + else: + args["data"] = None return RecordGeoIPConfigMatch(**args) @@ -1049,10 +1233,14 @@ def unmarshal_RecordViewConfigView(data: Any) -> RecordViewConfigView: field = data.get("subnet", None) if field is not None: args["subnet"] = field + else: + args["subnet"] = None field = data.get("data", None) if field is not None: args["data"] = field + else: + args["data"] = None return RecordViewConfigView(**args) @@ -1070,10 +1258,14 @@ def unmarshal_RecordWeightedConfigWeightedIP( field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("weight", None) if field is not None: args["weight"] = field + else: + args["weight"] = None return RecordWeightedConfigWeightedIP(**args) @@ -1093,10 +1285,14 @@ def unmarshal_RecordGeoIPConfig(data: Any) -> RecordGeoIPConfig: if field is not None else None ) + else: + args["matches"] = None field = data.get("default", None) if field is not None: args["default"] = field + else: + args["default"] = None return RecordGeoIPConfig(**args) @@ -1112,14 +1308,20 @@ def unmarshal_RecordHTTPServiceConfig(data: Any) -> RecordHTTPServiceConfig: field = data.get("ips", None) if field is not None: args["ips"] = field + else: + args["ips"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("strategy", None) if field is not None: args["strategy"] = field + else: + args["strategy"] = None field = data.get("must_contain", None) if field is not None: @@ -1151,6 +1353,8 @@ def unmarshal_RecordViewConfig(data: Any) -> RecordViewConfig: if field is not None else None ) + else: + args["views"] = None return RecordViewConfig(**args) @@ -1170,6 +1374,8 @@ def unmarshal_RecordWeightedConfig(data: Any) -> RecordWeightedConfig: if field is not None else None ) + else: + args["weighted_ips"] = None return RecordWeightedConfig(**args) @@ -1185,26 +1391,38 @@ def unmarshal_Record(data: Any) -> Record: field = data.get("data", None) if field is not None: args["data"] = field + else: + args["data"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("priority", None) if field is not None: args["priority"] = field + else: + args["priority"] = None field = data.get("ttl", None) if field is not None: args["ttl"] = field + else: + args["ttl"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("comment", None) if field is not None: @@ -1250,10 +1468,14 @@ def unmarshal_RecordIdentifier(data: Any) -> RecordIdentifier: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("data", None) if field is not None: @@ -1283,6 +1505,8 @@ def unmarshal_RecordChangeAdd(data: Any) -> RecordChangeAdd: args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = None return RecordChangeAdd(**args) @@ -1334,6 +1558,8 @@ def unmarshal_RecordChangeSet(data: Any) -> RecordChangeSet: args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = None field = data.get("id", None) if field is not None: @@ -1398,6 +1624,8 @@ def unmarshal_GetDNSZoneVersionDiffResponse(data: Any) -> GetDNSZoneVersionDiffR args["changes"] = ( [unmarshal_RecordChange(v) for v in field] if field is not None else None ) + else: + args["changes"] = None return GetDNSZoneVersionDiffResponse(**args) @@ -1413,6 +1641,8 @@ def unmarshal_GetDomainAuthCodeResponse(data: Any) -> GetDomainAuthCodeResponse: field = data.get("auth_code", None) if field is not None: args["auth_code"] = field + else: + args["auth_code"] = None return GetDomainAuthCodeResponse(**args) @@ -1430,6 +1660,8 @@ def unmarshal_ImportProviderDNSZoneResponse(data: Any) -> ImportProviderDNSZoneR args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = None return ImportProviderDNSZoneResponse(**args) @@ -1447,6 +1679,8 @@ def unmarshal_ImportRawDNSZoneResponse(data: Any) -> ImportRawDNSZoneResponse: args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = None return ImportRawDNSZoneResponse(**args) @@ -1462,14 +1696,20 @@ def unmarshal_ContactRolesRoles(data: Any) -> ContactRolesRoles: field = data.get("is_owner", None) if field is not None: args["is_owner"] = field + else: + args["is_owner"] = None field = data.get("is_administrative", None) if field is not None: args["is_administrative"] = field + else: + args["is_administrative"] = None field = data.get("is_technical", None) if field is not None: args["is_technical"] = field + else: + args["is_technical"] = None return ContactRolesRoles(**args) @@ -1489,6 +1729,8 @@ def unmarshal_ContactRoles(data: Any) -> ContactRoles: if field is not None else None ) + else: + args["roles"] = None field = data.get("contact", None) if field is not None: @@ -1510,12 +1752,16 @@ def unmarshal_ListContactsResponse(data: Any) -> ListContactsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("contacts", None) if field is not None: args["contacts"] = ( [unmarshal_ContactRoles(v) for v in field] if field is not None else None ) + else: + args["contacts"] = None return ListContactsResponse(**args) @@ -1531,10 +1777,14 @@ def unmarshal_Nameserver(data: Any) -> Nameserver: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None return Nameserver(**args) @@ -1554,6 +1804,8 @@ def unmarshal_ListDNSZoneNameserversResponse( args["ns"] = ( [unmarshal_Nameserver(v) for v in field] if field is not None else None ) + else: + args["ns"] = field(default_factory=list) return ListDNSZoneNameserversResponse(**args) @@ -1569,12 +1821,16 @@ def unmarshal_ListDNSZoneRecordsResponse(data: Any) -> ListDNSZoneRecordsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("records", None) if field is not None: args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = field(default_factory=list) return ListDNSZoneRecordsResponse(**args) @@ -1592,12 +1848,16 @@ def unmarshal_ListDNSZoneVersionRecordsResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("records", None) if field is not None: args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = field(default_factory=list) return ListDNSZoneVersionRecordsResponse(**args) @@ -1613,6 +1873,8 @@ def unmarshal_DNSZoneVersion(data: Any) -> DNSZoneVersion: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("created_at", None) if field is not None: @@ -1634,12 +1896,16 @@ def unmarshal_ListDNSZoneVersionsResponse(data: Any) -> ListDNSZoneVersionsRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("versions", None) if field is not None: args["versions"] = ( [unmarshal_DNSZoneVersion(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) return ListDNSZoneVersionsResponse(**args) @@ -1655,12 +1921,16 @@ def unmarshal_ListDNSZonesResponse(data: Any) -> ListDNSZonesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("dns_zones", None) if field is not None: args["dns_zones"] = ( [unmarshal_DNSZone(v) for v in field] if field is not None else None ) + else: + args["dns_zones"] = field(default_factory=list) return ListDNSZonesResponse(**args) @@ -1676,12 +1946,16 @@ def unmarshal_ListDomainHostsResponse(data: Any) -> ListDomainHostsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("hosts", None) if field is not None: args["hosts"] = ( [unmarshal_Host(v) for v in field] if field is not None else None ) + else: + args["hosts"] = None return ListDomainHostsResponse(**args) @@ -1697,30 +1971,44 @@ def unmarshal_DomainSummary(data: Any) -> DomainSummary: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("auto_renew_status", None) if field is not None: args["auto_renew_status"] = field + else: + args["auto_renew_status"] = None field = data.get("dnssec_status", None) if field is not None: args["dnssec_status"] = field + else: + args["dnssec_status"] = None field = data.get("epp_code", None) if field is not None: args["epp_code"] = field + else: + args["epp_code"] = None field = data.get("registrar", None) if field is not None: args["registrar"] = field + else: + args["registrar"] = None field = data.get("is_external", None) if field is not None: args["is_external"] = field + else: + args["is_external"] = None field = data.get("expired_at", None) if field is not None: @@ -1737,14 +2025,20 @@ def unmarshal_DomainSummary(data: Any) -> DomainSummary: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("pending_trade", None) if field is not None: args["pending_trade"] = field + else: + args["pending_trade"] = None field = data.get("external_domain_registration_status", None) if field is not None: @@ -1782,12 +2076,16 @@ def unmarshal_ListDomainsResponse(data: Any) -> ListDomainsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("domains", None) if field is not None: args["domains"] = ( [unmarshal_DomainSummary(v) for v in field] if field is not None else None ) + else: + args["domains"] = None return ListDomainsResponse(**args) @@ -1803,18 +2101,26 @@ def unmarshal_RenewableDomain(data: Any) -> RenewableDomain: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("renewable_duration_in_years", None) if field is not None: @@ -1872,12 +2178,16 @@ def unmarshal_ListRenewableDomainsResponse(data: Any) -> ListRenewableDomainsRes field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("domains", None) if field is not None: args["domains"] = ( [unmarshal_RenewableDomain(v) for v in field] if field is not None else None ) + else: + args["domains"] = None return ListRenewableDomainsResponse(**args) @@ -1893,12 +2203,16 @@ def unmarshal_ListSSLCertificatesResponse(data: Any) -> ListSSLCertificatesRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("certificates", None) if field is not None: args["certificates"] = ( [unmarshal_SSLCertificate(v) for v in field] if field is not None else None ) + else: + args["certificates"] = None return ListSSLCertificatesResponse(**args) @@ -1914,22 +2228,32 @@ def unmarshal_Task(data: Any) -> Task: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = TaskType.UNKNOWN field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TaskStatus.UNAVAILABLE field = data.get("domain", None) if field is not None: @@ -1975,12 +2299,16 @@ def unmarshal_ListTasksResponse(data: Any) -> ListTasksResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("tasks", None) if field is not None: args["tasks"] = ( [unmarshal_Task(v) for v in field] if field is not None else None ) + else: + args["tasks"] = None return ListTasksResponse(**args) @@ -1996,10 +2324,14 @@ def unmarshal_ListTldsResponse(data: Any) -> ListTldsResponse: field = data.get("tlds", None) if field is not None: args["tlds"] = [unmarshal_Tld(v) for v in field] if field is not None else None + else: + args["tlds"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListTldsResponse(**args) @@ -2015,18 +2347,26 @@ def unmarshal_OrderResponse(data: Any) -> OrderResponse: field = data.get("domains", None) if field is not None: args["domains"] = field + else: + args["domains"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("task_id", None) if field is not None: args["task_id"] = field + else: + args["task_id"] = None field = data.get("created_at", None) if field is not None: @@ -2050,6 +2390,8 @@ def unmarshal_RefreshDNSZoneResponse(data: Any) -> RefreshDNSZoneResponse: args["dns_zones"] = ( [unmarshal_DNSZone(v) for v in field] if field is not None else None ) + else: + args["dns_zones"] = field(default_factory=list) return RefreshDNSZoneResponse(**args) @@ -2067,18 +2409,26 @@ def unmarshal_RegisterExternalDomainResponse( field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("validation_token", None) if field is not None: args["validation_token"] = field + else: + args["validation_token"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("created_at", None) if field is not None: @@ -2111,10 +2461,14 @@ def unmarshal_AvailableDomain(data: Any) -> AvailableDomain: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("available", None) if field is not None: args["available"] = field + else: + args["available"] = None field = data.get("tld", None) if field is not None: @@ -2140,6 +2494,8 @@ def unmarshal_SearchAvailableDomainsResponse( args["available_domains"] = ( [unmarshal_AvailableDomain(v) for v in field] if field is not None else None ) + else: + args["available_domains"] = field(default_factory=list) return SearchAvailableDomainsResponse(**args) @@ -2159,6 +2515,8 @@ def unmarshal_UpdateDNSZoneNameserversResponse( args["ns"] = ( [unmarshal_Nameserver(v) for v in field] if field is not None else None ) + else: + args["ns"] = field(default_factory=list) return UpdateDNSZoneNameserversResponse(**args) @@ -2176,6 +2534,8 @@ def unmarshal_UpdateDNSZoneRecordsResponse(data: Any) -> UpdateDNSZoneRecordsRes args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = field(default_factory=list) return UpdateDNSZoneRecordsResponse(**args) @@ -2211,7 +2571,9 @@ def marshal_CreateDNSZoneRequest( output["subdomain"] = request.subdomain if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -2336,10 +2698,12 @@ def marshal_ImportRawDNSZoneRequest( output["content"] = request.content if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.format is not None: - output["format"] = str(request.format) + output["format"] = request.format return output @@ -2475,7 +2839,7 @@ def marshal_ContactExtensionFR( ) if request.mode is not None: - output["mode"] = str(request.mode) + output["mode"] = request.mode return output @@ -2487,7 +2851,7 @@ def marshal_ContactExtensionNL( output: Dict[str, Any] = {} if request.legal_form is not None: - output["legal_form"] = str(request.legal_form) + output["legal_form"] = request.legal_form if request.legal_form_registration_number is not None: output["legal_form_registration_number"] = ( @@ -2519,7 +2883,7 @@ def marshal_NewContact( output: Dict[str, Any] = {} if request.legal_form is not None: - output["legal_form"] = str(request.legal_form) + output["legal_form"] = request.legal_form if request.firstname is not None: output["firstname"] = request.firstname @@ -2564,7 +2928,7 @@ def marshal_NewContact( output["company_identification_code"] = request.company_identification_code if request.lang is not None: - output["lang"] = str(request.lang) + output["lang"] = request.lang if request.resale is not None: output["resale"] = request.resale @@ -2659,7 +3023,9 @@ def marshal_RegistrarApiBuyDomainsRequest( output["duration_in_years"] = request.duration_in_years if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -2761,7 +3127,7 @@ def marshal_DSRecordDigest( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.digest is not None: output["digest"] = request.digest @@ -2798,7 +3164,7 @@ def marshal_DSRecord( output["key_id"] = request.key_id if request.algorithm is not None: - output["algorithm"] = str(request.algorithm) + output["algorithm"] = request.algorithm return output @@ -2825,7 +3191,9 @@ def marshal_RegistrarApiRegisterExternalDomainRequest( output["domain"] = request.domain if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -2952,7 +3320,9 @@ def marshal_RegistrarApiTransferInDomainRequest( ] if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3012,7 +3382,7 @@ def marshal_RegistrarApiUpdateContactRequest( output["company_identification_code"] = request.company_identification_code if request.lang is not None: - output["lang"] = str(request.lang) + output["lang"] = request.lang if request.resale is not None: output["resale"] = request.resale @@ -3221,7 +3591,7 @@ def marshal_RecordHTTPServiceConfig( output["url"] = request.url if request.strategy is not None: - output["strategy"] = str(request.strategy) + output["strategy"] = request.strategy if request.must_contain is not None: output["must_contain"] = request.must_contain @@ -3306,7 +3676,7 @@ def marshal_Record( output["ttl"] = request.ttl if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.id is not None: output["id"] = request.id @@ -3327,7 +3697,7 @@ def marshal_RecordIdentifier( output["name"] = request.name if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.data is not None: output["data"] = request.data @@ -3470,6 +3840,8 @@ def marshal_UpdateDNSZoneRequest( output["new_dns_zone"] = request.new_dns_zone if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output diff --git a/scaleway-async/scaleway_async/domain/v2beta1/types.py b/scaleway-async/scaleway_async/domain/v2beta1/types.py index 2b10de0a1..5a7233a45 100644 --- a/scaleway-async/scaleway_async/domain/v2beta1/types.py +++ b/scaleway-async/scaleway_async/domain/v2beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -373,23 +373,19 @@ def __str__(self) -> str: @dataclass class RecordGeoIPConfigMatch: countries: List[str] - continents: List[str] - data: str @dataclass class RecordViewConfigView: subnet: str - data: str @dataclass class RecordWeightedConfigWeightedIP: ip: str - weight: int @@ -401,21 +397,16 @@ class DSRecordPublicKey: @dataclass class RecordGeoIPConfig: matches: List[RecordGeoIPConfigMatch] - default: str @dataclass class RecordHTTPServiceConfig: ips: List[str] - url: str - strategy: RecordHTTPServiceConfigStrategy - - must_contain: Optional[str] - - user_agent: Optional[str] + must_contain: Optional[str] = None + user_agent: Optional[str] = None @dataclass @@ -431,8 +422,7 @@ class RecordWeightedConfig: @dataclass class ContactExtensionFRAssociationInfo: publication_jo_page: int - - publication_jo: Optional[datetime] + publication_jo: Optional[datetime] = None @dataclass @@ -443,7 +433,6 @@ class ContactExtensionFRCodeAuthAfnicInfo: @dataclass class ContactExtensionFRDunsInfo: duns_id: str - local_id: str @@ -460,46 +449,34 @@ class ContactExtensionFRTrademarkInfo: @dataclass class DSRecordDigest: type_: DSRecordDigestType - digest: str - - public_key: Optional[DSRecordPublicKey] + public_key: Optional[DSRecordPublicKey] = None @dataclass class Record: data: str - name: str - priority: int - ttl: int - type_: RecordType - id: str + comment: Optional[str] = None + geo_ip_config: Optional[RecordGeoIPConfig] = None - comment: Optional[str] - - geo_ip_config: Optional[RecordGeoIPConfig] + http_service_config: Optional[RecordHTTPServiceConfig] = None - http_service_config: Optional[RecordHTTPServiceConfig] + weighted_config: Optional[RecordWeightedConfig] = None - weighted_config: Optional[RecordWeightedConfig] - - view_config: Optional[RecordViewConfig] + view_config: Optional[RecordViewConfig] = None @dataclass class RecordIdentifier: name: str - type_: RecordType - - data: Optional[str] - - ttl: Optional[int] + data: Optional[str] = None + ttl: Optional[int] = None @dataclass @@ -510,50 +487,43 @@ class ContactExtensionEU: @dataclass class ContactExtensionFR: mode: ContactExtensionFRMode + individual_info: Optional[ContactExtensionFRIndividualInfo] = None - individual_info: Optional[ContactExtensionFRIndividualInfo] - - duns_info: Optional[ContactExtensionFRDunsInfo] + duns_info: Optional[ContactExtensionFRDunsInfo] = None - association_info: Optional[ContactExtensionFRAssociationInfo] + association_info: Optional[ContactExtensionFRAssociationInfo] = None - trademark_info: Optional[ContactExtensionFRTrademarkInfo] + trademark_info: Optional[ContactExtensionFRTrademarkInfo] = None - code_auth_afnic_info: Optional[ContactExtensionFRCodeAuthAfnicInfo] + code_auth_afnic_info: Optional[ContactExtensionFRCodeAuthAfnicInfo] = None @dataclass class ContactExtensionNL: legal_form: ContactExtensionNLLegalForm - legal_form_registration_number: str @dataclass class ContactQuestion: question: str - answer: str @dataclass class TldOffer: action: str - operation_path: str - - price: Optional[Money] + price: Optional[Money] = None @dataclass class DSRecord: key_id: int - algorithm: DSRecordAlgorithm + digest: Optional[DSRecordDigest] = None - digest: Optional[DSRecordDigest] - - public_key: Optional[DSRecordPublicKey] + public_key: Optional[DSRecordPublicKey] = None @dataclass @@ -568,90 +538,60 @@ class RecordChangeClear: @dataclass class RecordChangeDelete: - id: Optional[str] + id: Optional[str] = None - id_fields: Optional[RecordIdentifier] + id_fields: Optional[RecordIdentifier] = None @dataclass class RecordChangeSet: records: List[Record] + id: Optional[str] = None - id: Optional[str] - - id_fields: Optional[RecordIdentifier] + id_fields: Optional[RecordIdentifier] = None @dataclass class ImportRawDNSZoneRequestTsigKey: name: str - key: str - algorithm: str @dataclass class Contact: id: str - legal_form: ContactLegalForm - firstname: str - lastname: str - company_name: str - email: str - email_alt: str - phone_number: str - fax_number: str - address_line_1: str - address_line_2: str - zip: str - city: str - country: str - vat_identification_code: str - company_identification_code: str - lang: StdLanguageCode - resale: bool - whois_opt_in: bool - - questions: Optional[List[ContactQuestion]] - - extension_fr: Optional[ContactExtensionFR] - - extension_eu: Optional[ContactExtensionEU] - email_status: ContactEmailStatus - state: str - status: ContactStatus - - extension_nl: Optional[ContactExtensionNL] + questions: Optional[List[ContactQuestion]] = None + extension_fr: Optional[ContactExtensionFR] = None + extension_eu: Optional[ContactExtensionEU] = None + extension_nl: Optional[ContactExtensionNL] = None @dataclass class ContactRolesRoles: is_owner: bool - is_administrative: bool - is_technical: bool @@ -663,124 +603,83 @@ class DomainRegistrationStatusExternalDomain: @dataclass class DomainRegistrationStatusTransfer: status: DomainRegistrationStatusTransferStatus - vote_current_owner: bool - vote_new_owner: bool @dataclass class Tld: name: str - dnssec_support: bool - duration_in_years_min: int - duration_in_years_max: int - idn_support: bool - offers: Dict[str, TldOffer] - specifications: Dict[str, str] @dataclass class NewContact: legal_form: ContactLegalForm - firstname: str - lastname: str - email: str - - company_name: Optional[str] - - email_alt: Optional[str] - phone_number: str - address_line_1: str - zip: str - city: str - country: str - - fax_number: Optional[str] - - address_line_2: Optional[str] - - vat_identification_code: Optional[str] - - company_identification_code: Optional[str] - lang: StdLanguageCode - resale: bool - whois_opt_in: bool - - questions: Optional[List[ContactQuestion]] - - extension_fr: Optional[ContactExtensionFR] - - extension_eu: Optional[ContactExtensionEU] - - state: Optional[str] - - extension_nl: Optional[ContactExtensionNL] + company_name: Optional[str] = None + email_alt: Optional[str] = None + fax_number: Optional[str] = None + address_line_2: Optional[str] = None + vat_identification_code: Optional[str] = None + company_identification_code: Optional[str] = None + questions: Optional[List[ContactQuestion]] = None + extension_fr: Optional[ContactExtensionFR] = None + extension_eu: Optional[ContactExtensionEU] = None + state: Optional[str] = None + extension_nl: Optional[ContactExtensionNL] = None @dataclass class CheckContactsCompatibilityResponseContactCheckResult: compatible: bool - - error_message: Optional[str] + error_message: Optional[str] = None @dataclass class DNSZone: domain: str - subdomain: str - ns: List[str] - ns_default: List[str] - ns_master: List[str] - status: DNSZoneStatus - project_id: str - linked_products: List[LinkedProduct] - - message: Optional[str] - - updated_at: Optional[datetime] + message: Optional[str] = None + updated_at: Optional[datetime] = None @dataclass class DomainDNSSEC: status: DomainFeatureStatus - ds_records: List[DSRecord] @dataclass class RecordChange: - add: Optional[RecordChangeAdd] + add: Optional[RecordChangeAdd] = None - set_: Optional[RecordChangeSet] + set_: Optional[RecordChangeSet] = None - delete: Optional[RecordChangeDelete] + delete: Optional[RecordChangeDelete] = None - clear: Optional[RecordChangeClear] + clear: Optional[RecordChangeClear] = None @dataclass @@ -791,8 +690,7 @@ class ImportProviderDNSZoneRequestOnlineV1: @dataclass class ImportRawDNSZoneRequestAXFRSource: name_server: str - - tsig_key: Optional[ImportRawDNSZoneRequestTsigKey] + tsig_key: Optional[ImportRawDNSZoneRequestTsigKey] = None @dataclass @@ -803,108 +701,74 @@ class ImportRawDNSZoneRequestBindSource: @dataclass class ContactRoles: roles: Dict[str, ContactRolesRoles] - - contact: Optional[Contact] + contact: Optional[Contact] = None @dataclass class Nameserver: name: str - ip: List[str] @dataclass class DNSZoneVersion: id: str - - created_at: Optional[datetime] + created_at: Optional[datetime] = None @dataclass class Host: domain: str - name: str - ips: List[str] - status: HostStatus @dataclass class DomainSummary: domain: str - project_id: str - auto_renew_status: DomainFeatureStatus - dnssec_status: DomainFeatureStatus - epp_code: List[str] - registrar: str - is_external: bool - - expired_at: Optional[datetime] - - updated_at: Optional[datetime] - status: DomainStatus - organization_id: str - pending_trade: bool - - created_at: Optional[datetime] - + expired_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + created_at: Optional[datetime] = None external_domain_registration_status: Optional[ DomainRegistrationStatusExternalDomain - ] + ] = None - transfer_registration_status: Optional[DomainRegistrationStatusTransfer] + transfer_registration_status: Optional[DomainRegistrationStatusTransfer] = None @dataclass class RenewableDomain: domain: str - project_id: str - organization_id: str - status: RenewableDomainStatus - - renewable_duration_in_years: Optional[int] - - expired_at: Optional[datetime] - - limit_renew_at: Optional[datetime] - - limit_redemption_at: Optional[datetime] - - estimated_delete_at: Optional[datetime] - - tld: Optional[Tld] + renewable_duration_in_years: Optional[int] = None + expired_at: Optional[datetime] = None + limit_renew_at: Optional[datetime] = None + limit_redemption_at: Optional[datetime] = None + estimated_delete_at: Optional[datetime] = None + tld: Optional[Tld] = None @dataclass class SSLCertificate: dns_zone: str - alternative_dns_zones: List[str] - status: SSLCertificateStatus - private_key: str - certificate_chain: str - - created_at: Optional[datetime] - - expired_at: Optional[datetime] + created_at: Optional[datetime] = None + expired_at: Optional[datetime] = None @dataclass @@ -934,27 +798,27 @@ class Task: The status of the task. """ - domain: Optional[str] + domain: Optional[str] = None """ The domain name associated to the task. """ - started_at: Optional[datetime] + started_at: Optional[datetime] = None """ Start date of the task. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update of the task. """ - message: Optional[str] + message: Optional[str] = None """ Error message associated to the task. """ - contact_identifier: Optional[str] + contact_identifier: Optional[str] = None """ Human-friendly contact identifier used when the task concerns a contact. """ @@ -963,39 +827,34 @@ class Task: @dataclass class TransferInDomainRequestTransferRequest: domain: str - auth_code: str @dataclass class UpdateContactRequestQuestion: - question: Optional[str] - - answer: Optional[str] + question: Optional[str] = None + answer: Optional[str] = None @dataclass class AvailableDomain: domain: str - available: bool - - tld: Optional[Tld] + tld: Optional[Tld] = None @dataclass class CheckContactsCompatibilityResponse: compatible: bool - - owner_check_result: Optional[CheckContactsCompatibilityResponseContactCheckResult] - + owner_check_result: Optional[ + CheckContactsCompatibilityResponseContactCheckResult + ] = None administrative_check_result: Optional[ CheckContactsCompatibilityResponseContactCheckResult - ] - + ] = None technical_check_result: Optional[ CheckContactsCompatibilityResponseContactCheckResult - ] + ] = None @dataclass @@ -1028,7 +887,7 @@ class CloneDNSZoneRequest: Specifies whether or not the destination DNS zone will be overwritten. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the destination DNS zone. """ @@ -1046,7 +905,7 @@ class CreateDNSZoneRequest: Subdomain of the DNS zone to create. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID in which to create the DNS zone. """ @@ -1055,8 +914,7 @@ class CreateDNSZoneRequest: @dataclass class CreateSSLCertificateRequest: dns_zone: str - - alternative_dns_zones: Optional[List[str]] + alternative_dns_zones: Optional[List[str]] = field(default_factory=list) @dataclass @@ -1066,7 +924,7 @@ class DeleteDNSZoneRequest: DNS zone to delete. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the DNS zone to delete. """ @@ -1100,11 +958,8 @@ class DeleteSSLCertificateResponse: @dataclass class Domain: domain: str - organization_id: str - project_id: str - auto_renew_status: DomainFeatureStatus """ Status of the automatic renewal of the domain. @@ -1115,23 +970,7 @@ class Domain: List of the domain's EPP codes. """ - dnssec: Optional[DomainDNSSEC] - """ - Status of the DNSSEC configuration of the domain. - """ - - expired_at: Optional[datetime] - """ - Date of expiration of the domain. - """ - - updated_at: Optional[datetime] - """ - Domain's last modification date. - """ - registrar: str - is_external: bool """ Indicates whether Scaleway is the domain's registrar. @@ -1157,31 +996,46 @@ class Domain: Indicates if a trade is ongoing. """ - owner_contact: Optional[Contact] + dnssec: Optional[DomainDNSSEC] = None + """ + Status of the DNSSEC configuration of the domain. + """ + + expired_at: Optional[datetime] = None + """ + Date of expiration of the domain. + """ + + updated_at: Optional[datetime] = None + """ + Domain's last modification date. + """ + + owner_contact: Optional[Contact] = None """ Contact information of the domain's owner. """ - technical_contact: Optional[Contact] + technical_contact: Optional[Contact] = None """ Contact information of the domain's technical contact. """ - administrative_contact: Optional[Contact] + administrative_contact: Optional[Contact] = None """ Contact information of the domain's administrative contact. """ - tld: Optional[Tld] + tld: Optional[Tld] = None """ Domain's TLD information. """ external_domain_registration_status: Optional[ DomainRegistrationStatusExternalDomain - ] + ] = None - transfer_registration_status: Optional[DomainRegistrationStatusTransfer] + transfer_registration_status: Optional[DomainRegistrationStatusTransfer] = None @dataclass @@ -1191,7 +1045,7 @@ class ExportRawDNSZoneRequest: DNS zone to export. """ - format: Optional[RawFormat] + format: Optional[RawFormat] = RawFormat.UNKNOWN_RAW_FORMAT """ DNS zone format. """ @@ -1205,9 +1059,7 @@ class GetDNSZoneTsigKeyRequest: @dataclass class GetDNSZoneTsigKeyResponse: name: str - key: str - algorithm: str @@ -1234,8 +1086,7 @@ class GetSSLCertificateRequest: @dataclass class ImportProviderDNSZoneRequest: dns_zone: str - - online_v1: Optional[ImportProviderDNSZoneRequestOnlineV1] + online_v1: Optional[ImportProviderDNSZoneRequestOnlineV1] = None @dataclass @@ -1250,15 +1101,12 @@ class ImportRawDNSZoneRequest: DNS zone to import. """ - content: Optional[str] - - project_id: Optional[str] - - format: Optional[RawFormat] - - bind_source: Optional[ImportRawDNSZoneRequestBindSource] + content: Optional[str] = None + project_id: Optional[str] = None + format: Optional[RawFormat] = RawFormat.UNKNOWN_RAW_FORMAT + bind_source: Optional[ImportRawDNSZoneRequestBindSource] = None - axfr_source: Optional[ImportRawDNSZoneRequestAXFRSource] + axfr_source: Optional[ImportRawDNSZoneRequestAXFRSource] = None @dataclass @@ -1269,20 +1117,19 @@ class ImportRawDNSZoneResponse: @dataclass class ListContactsResponse: total_count: int - contacts: List[ContactRoles] @dataclass class ListDNSZoneNameserversRequest: - project_id: Optional[str] + dns_zone: str """ - Project ID on which to filter the returned DNS zone name servers. + DNS zone on which to filter the returned DNS zone name servers. """ - dns_zone: str + project_id: Optional[str] = None """ - DNS zone on which to filter the returned DNS zone name servers. + Project ID on which to filter the returned DNS zone name servers. """ @@ -1296,42 +1143,44 @@ class ListDNSZoneNameserversResponse: @dataclass class ListDNSZoneRecordsRequest: - project_id: Optional[str] + dns_zone: str """ - Project ID on which to filter the returned DNS zone records. + DNS zone on which to filter the returned DNS zone records. """ - order_by: Optional[ListDNSZoneRecordsRequestOrderBy] + name: str """ - Sort order of the returned DNS zone records. + Name on which to filter the returned DNS zone records. """ - page: Optional[int] + project_id: Optional[str] = None """ - Page number to return, from the paginated results. + Project ID on which to filter the returned DNS zone records. """ - page_size: Optional[int] + order_by: Optional[ListDNSZoneRecordsRequestOrderBy] = ( + ListDNSZoneRecordsRequestOrderBy.NAME_ASC + ) """ - Maximum number of DNS zone records per page. + Sort order of the returned DNS zone records. """ - dns_zone: str + page: Optional[int] = 0 """ - DNS zone on which to filter the returned DNS zone records. + Page number to return, from the paginated results. """ - name: str + page_size: Optional[int] = 0 """ - Name on which to filter the returned DNS zone records. + Maximum number of DNS zone records per page. """ - type_: Optional[RecordType] + type_: Optional[RecordType] = RecordType.UNKNOWN """ Record type on which to filter the returned DNS zone records. """ - id: Optional[str] + id: Optional[str] = None """ Record ID on which to filter the returned DNS zone records. """ @@ -1352,18 +1201,17 @@ class ListDNSZoneRecordsResponse: @dataclass class ListDNSZoneVersionRecordsRequest: - page: Optional[int] + dns_zone_version_id: str + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of DNS zones versions records per page. """ - dns_zone_version_id: str - @dataclass class ListDNSZoneVersionRecordsResponse: @@ -1377,18 +1225,17 @@ class ListDNSZoneVersionRecordsResponse: @dataclass class ListDNSZoneVersionsRequest: - page: Optional[int] + dns_zone: str + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of DNS zones versions per page. """ - dns_zone: str - @dataclass class ListDNSZoneVersionsResponse: @@ -1407,57 +1254,59 @@ class ListDNSZonesRequest: Domain on which to filter the returned DNS zones. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID on which to filter the returned DNS zones. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID on which to filter the returned DNS zones. """ - order_by: Optional[ListDNSZonesRequestOrderBy] + order_by: Optional[ListDNSZonesRequestOrderBy] = ( + ListDNSZonesRequestOrderBy.DOMAIN_ASC + ) """ Sort order of the returned DNS zones. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of DNS zones to return per page. """ - dns_zone: Optional[str] + dns_zone: Optional[str] = None """ DNS zone on which to filter the returned DNS zones. """ - dns_zones: Optional[List[str]] + dns_zones: Optional[List[str]] = field(default_factory=list) """ DNS zones on which to filter the returned DNS zones. """ - created_after: Optional[datetime] + created_after: Optional[datetime] = None """ Only list DNS zones created after this date. """ - created_before: Optional[datetime] + created_before: Optional[datetime] = None """ Only list DNS zones created before this date. """ - updated_after: Optional[datetime] + updated_after: Optional[datetime] = None """ Only list DNS zones updated after this date. """ - updated_before: Optional[datetime] + updated_before: Optional[datetime] = None """ Only list DNS zones updated before this date. """ @@ -1479,46 +1328,38 @@ class ListDNSZonesResponse: @dataclass class ListDomainHostsResponse: total_count: int - hosts: List[Host] @dataclass class ListDomainsResponse: total_count: int - domains: List[DomainSummary] @dataclass class ListRenewableDomainsResponse: total_count: int - domains: List[RenewableDomain] @dataclass class ListSSLCertificatesRequest: dns_zone: str - - page: Optional[int] - - page_size: Optional[int] - - project_id: Optional[str] + page: Optional[int] = 0 + page_size: Optional[int] = 0 + project_id: Optional[str] = None @dataclass class ListSSLCertificatesResponse: total_count: int - certificates: List[SSLCertificate] @dataclass class ListTasksResponse: total_count: int - tasks: List[Task] @@ -1538,14 +1379,10 @@ class ListTldsResponse: @dataclass class OrderResponse: domains: List[str] - organization_id: str - project_id: str - task_id: str - - created_at: Optional[datetime] + created_at: Optional[datetime] = None @dataclass @@ -1577,69 +1414,57 @@ class RefreshDNSZoneResponse: @dataclass class RegisterExternalDomainResponse: domain: str - organization_id: str - validation_token: str - project_id: str - - created_at: Optional[datetime] + created_at: Optional[datetime] = None @dataclass class RegistrarApiBuyDomainsRequest: domains: List[str] - duration_in_years: int + project_id: Optional[str] = None + owner_contact_id: Optional[str] = None - project_id: Optional[str] - - owner_contact_id: Optional[str] + owner_contact: Optional[NewContact] = None - owner_contact: Optional[NewContact] + administrative_contact_id: Optional[str] = None - administrative_contact_id: Optional[str] + administrative_contact: Optional[NewContact] = None - administrative_contact: Optional[NewContact] + technical_contact_id: Optional[str] = None - technical_contact_id: Optional[str] - - technical_contact: Optional[NewContact] + technical_contact: Optional[NewContact] = None @dataclass class RegistrarApiCheckContactsCompatibilityRequest: - domains: Optional[List[str]] - - tlds: Optional[List[str]] - - owner_contact_id: Optional[str] + domains: Optional[List[str]] = None + tlds: Optional[List[str]] = None + owner_contact_id: Optional[str] = None - owner_contact: Optional[NewContact] + owner_contact: Optional[NewContact] = None - administrative_contact_id: Optional[str] + administrative_contact_id: Optional[str] = None - administrative_contact: Optional[NewContact] + administrative_contact: Optional[NewContact] = None - technical_contact_id: Optional[str] + technical_contact_id: Optional[str] = None - technical_contact: Optional[NewContact] + technical_contact: Optional[NewContact] = None @dataclass class RegistrarApiCreateDomainHostRequest: domain: str - name: str - - ips: Optional[List[str]] + ips: Optional[List[str]] = None @dataclass class RegistrarApiDeleteDomainHostRequest: domain: str - name: str @@ -1666,8 +1491,7 @@ class RegistrarApiEnableDomainAutoRenewRequest: @dataclass class RegistrarApiEnableDomainDNSSECRequest: domain: str - - ds_record: Optional[DSRecord] + ds_record: Optional[DSRecord] = None @dataclass @@ -1687,101 +1511,74 @@ class RegistrarApiGetDomainRequest: @dataclass class RegistrarApiListContactsRequest: - page: Optional[int] - - page_size: Optional[int] - - domain: Optional[str] - - project_id: Optional[str] - - organization_id: Optional[str] - - role: Optional[ListContactsRequestRole] - - email_status: Optional[ContactEmailStatus] + page: Optional[int] = None + page_size: Optional[int] = None + domain: Optional[str] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None + role: Optional[ListContactsRequestRole] = None + email_status: Optional[ContactEmailStatus] = None @dataclass class RegistrarApiListDomainHostsRequest: - page: Optional[int] - - page_size: Optional[int] - domain: str + page: Optional[int] = None + page_size: Optional[int] = None @dataclass class RegistrarApiListDomainsRequest: - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListDomainsRequestOrderBy] - - registrar: Optional[str] - - status: Optional[DomainStatus] - - project_id: Optional[str] - - organization_id: Optional[str] - - is_external: Optional[bool] - - domain: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListDomainsRequestOrderBy] = None + registrar: Optional[str] = None + status: Optional[DomainStatus] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None + is_external: Optional[bool] = None + domain: Optional[str] = None @dataclass class RegistrarApiListRenewableDomainsRequest: - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListRenewableDomainsRequestOrderBy] - - project_id: Optional[str] - - organization_id: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListRenewableDomainsRequestOrderBy] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None @dataclass class RegistrarApiListTasksRequest: - page: Optional[int] - - page_size: Optional[int] - - project_id: Optional[str] - - organization_id: Optional[str] - - domain: Optional[str] - - types: Optional[List[TaskType]] - - statuses: Optional[List[TaskStatus]] - - order_by: Optional[ListTasksRequestOrderBy] + page: Optional[int] = None + page_size: Optional[int] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None + domain: Optional[str] = None + types: Optional[List[TaskType]] = None + statuses: Optional[List[TaskStatus]] = None + order_by: Optional[ListTasksRequestOrderBy] = None @dataclass class RegistrarApiListTldsRequest: - tlds: Optional[List[str]] + tlds: Optional[List[str]] = field(default_factory=list) """ Array of TLDs to return. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned Projects. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Project per page. """ - order_by: Optional[ListTldsRequestOrderBy] + order_by: Optional[ListTldsRequestOrderBy] = ListTldsRequestOrderBy.NAME_ASC """ Sort order of the returned TLDs. """ @@ -1795,17 +1592,14 @@ class RegistrarApiLockDomainTransferRequest: @dataclass class RegistrarApiRegisterExternalDomainRequest: domain: str - - project_id: Optional[str] + project_id: Optional[str] = None @dataclass class RegistrarApiRenewDomainsRequest: domains: List[str] - duration_in_years: int - - force_late_renewal: Optional[bool] + force_late_renewal: Optional[bool] = False @dataclass @@ -1820,7 +1614,7 @@ class RegistrarApiSearchAvailableDomainsRequest: Search exact match. """ - tlds: Optional[List[str]] + tlds: Optional[List[str]] = field(default_factory=list) """ Array of tlds to search on. """ @@ -1829,31 +1623,27 @@ class RegistrarApiSearchAvailableDomainsRequest: @dataclass class RegistrarApiTradeDomainRequest: domain: str + project_id: Optional[str] = None + new_owner_contact_id: Optional[str] = None - project_id: Optional[str] - - new_owner_contact_id: Optional[str] - - new_owner_contact: Optional[NewContact] + new_owner_contact: Optional[NewContact] = None @dataclass class RegistrarApiTransferInDomainRequest: domains: List[TransferInDomainRequestTransferRequest] + project_id: Optional[str] = None + owner_contact_id: Optional[str] = None - project_id: Optional[str] - - owner_contact_id: Optional[str] - - owner_contact: Optional[NewContact] + owner_contact: Optional[NewContact] = None - administrative_contact_id: Optional[str] + administrative_contact_id: Optional[str] = None - administrative_contact: Optional[NewContact] + administrative_contact: Optional[NewContact] = None - technical_contact_id: Optional[str] + technical_contact_id: Optional[str] = None - technical_contact: Optional[NewContact] + technical_contact: Optional[NewContact] = None @dataclass @@ -1864,70 +1654,48 @@ class RegistrarApiUnlockDomainTransferRequest: @dataclass class RegistrarApiUpdateContactRequest: contact_id: str - - email: Optional[str] - - email_alt: Optional[str] - - phone_number: Optional[str] - - fax_number: Optional[str] - - address_line_1: Optional[str] - - address_line_2: Optional[str] - - zip: Optional[str] - - city: Optional[str] - - country: Optional[str] - - vat_identification_code: Optional[str] - - company_identification_code: Optional[str] - - lang: Optional[StdLanguageCode] - - resale: Optional[bool] - - questions: Optional[List[UpdateContactRequestQuestion]] - - extension_fr: Optional[ContactExtensionFR] - - extension_eu: Optional[ContactExtensionEU] - - whois_opt_in: Optional[bool] - - state: Optional[str] - - extension_nl: Optional[ContactExtensionNL] + email: Optional[str] = None + email_alt: Optional[str] = None + phone_number: Optional[str] = None + fax_number: Optional[str] = None + address_line_1: Optional[str] = None + address_line_2: Optional[str] = None + zip: Optional[str] = None + city: Optional[str] = None + country: Optional[str] = None + vat_identification_code: Optional[str] = None + company_identification_code: Optional[str] = None + lang: Optional[StdLanguageCode] = None + resale: Optional[bool] = None + questions: Optional[List[UpdateContactRequestQuestion]] = None + extension_fr: Optional[ContactExtensionFR] = None + extension_eu: Optional[ContactExtensionEU] = None + whois_opt_in: Optional[bool] = None + state: Optional[str] = None + extension_nl: Optional[ContactExtensionNL] = None @dataclass class RegistrarApiUpdateDomainHostRequest: domain: str - name: str - - ips: Optional[List[str]] + ips: Optional[List[str]] = None @dataclass class RegistrarApiUpdateDomainRequest: domain: str + technical_contact_id: Optional[str] = None - technical_contact_id: Optional[str] - - technical_contact: Optional[NewContact] + technical_contact: Optional[NewContact] = None - owner_contact_id: Optional[str] + owner_contact_id: Optional[str] = None - owner_contact: Optional[NewContact] + owner_contact: Optional[NewContact] = None - administrative_contact_id: Optional[str] + administrative_contact_id: Optional[str] = None - administrative_contact: Optional[NewContact] + administrative_contact: Optional[NewContact] = None @dataclass @@ -1986,12 +1754,12 @@ class UpdateDNSZoneRecordsRequest: Disable the creation of the target zone if it does not exist. Target zone creation is disabled by default. """ - return_all_records: Optional[bool] + return_all_records: Optional[bool] = False """ Specifies whether or not to return all the records. """ - serial: Optional[int] + serial: Optional[int] = 0 """ Use the provided serial (0) instead of the auto-increment serial. """ @@ -2012,12 +1780,12 @@ class UpdateDNSZoneRequest: DNS zone to update. """ - new_dns_zone: Optional[str] + new_dns_zone: Optional[str] = None """ Name of the new DNS zone to create. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID in which to create the new DNS zone. """ diff --git a/scaleway-async/scaleway_async/edge_services/v1beta1/marshalling.py b/scaleway-async/scaleway_async/edge_services/v1beta1/marshalling.py index d70c3e757..813894394 100644 --- a/scaleway-async/scaleway_async/edge_services/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/edge_services/v1beta1/marshalling.py @@ -13,7 +13,13 @@ resolve_one_of, ) from .types import ( + DNSStageType, + PipelineStatus, + PlanName, + PurgeRequestStatus, RuleHttpMatchMethodFilter, + RuleHttpMatchPathFilterPathFilterType, + WafStageMode, ScalewayLb, ScalewayLbBackendConfig, ScalewayS3BackendConfig, @@ -97,20 +103,26 @@ def unmarshal_ScalewayLb(data: Any) -> ScalewayLb: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("frontend_id", None) if field is not None: args["frontend_id"] = field + else: + args["frontend_id"] = None field = data.get("is_ssl", None) if field is not None: args["is_ssl"] = field else: - args["is_ssl"] = None + args["is_ssl"] = False field = data.get("domain_name", None) if field is not None: @@ -134,6 +146,8 @@ def unmarshal_ScalewayLbBackendConfig(data: Any) -> ScalewayLbBackendConfig: args["lbs"] = ( [unmarshal_ScalewayLb(v) for v in field] if field is not None else None ) + else: + args["lbs"] = field(default_factory=list) return ScalewayLbBackendConfig(**args) @@ -162,7 +176,7 @@ def unmarshal_ScalewayS3BackendConfig(data: Any) -> ScalewayS3BackendConfig: if field is not None: args["is_website"] = field else: - args["is_website"] = None + args["is_website"] = False return ScalewayS3BackendConfig(**args) @@ -178,10 +192,14 @@ def unmarshal_BackendStage(data: Any) -> BackendStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("created_at", None) if field is not None: @@ -221,14 +239,20 @@ def unmarshal_CacheStage(data: Any) -> CacheStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("include_cookies", None) if field is not None: args["include_cookies"] = field + else: + args["include_cookies"] = False field = data.get("fallback_ttl", None) if field is not None: @@ -280,18 +304,26 @@ def unmarshal_DNSStage(data: Any) -> DNSStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("fqdns", None) if field is not None: args["fqdns"] = field + else: + args["fqdns"] = field(default_factory=list) field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = DNSStageType.UNKNOWN_TYPE field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("created_at", None) if field is not None: @@ -337,22 +369,32 @@ def unmarshal_PipelineError(data: Any) -> PipelineError: field = data.get("stage", None) if field is not None: args["stage"] = field + else: + args["stage"] = None field = data.get("code", None) if field is not None: args["code"] = field + else: + args["code"] = None field = data.get("severity", None) if field is not None: args["severity"] = field + else: + args["severity"] = None field = data.get("message", None) if field is not None: args["message"] = field + else: + args["message"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return PipelineError(**args) @@ -368,32 +410,46 @@ def unmarshal_Pipeline(data: Any) -> Pipeline: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = PipelineStatus.UNKNOWN_STATUS field = data.get("errors", None) if field is not None: args["errors"] = ( [unmarshal_PipelineError(v) for v in field] if field is not None else None ) + else: + args["errors"] = field(default_factory=list) field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("created_at", None) if field is not None: @@ -421,10 +477,14 @@ def unmarshal_RouteStage(data: Any) -> RouteStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("waf_stage_id", None) if field is not None: @@ -458,10 +518,14 @@ def unmarshal_TLSSecret(data: Any) -> TLSSecret: field = data.get("secret_id", None) if field is not None: args["secret_id"] = field + else: + args["secret_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None return TLSSecret(**args) @@ -477,20 +541,28 @@ def unmarshal_TLSStage(data: Any) -> TLSStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("secrets", None) if field is not None: args["secrets"] = ( [unmarshal_TLSSecret(v) for v in field] if field is not None else None ) + else: + args["secrets"] = field(default_factory=list) field = data.get("managed_certificate", None) if field is not None: args["managed_certificate"] = field + else: + args["managed_certificate"] = False field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("certificate_expires_at", None) if field is not None: @@ -550,18 +622,26 @@ def unmarshal_WafStage(data: Any) -> WafStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("mode", None) if field is not None: args["mode"] = field + else: + args["mode"] = WafStageMode.UNKNOWN_MODE field = data.get("paranoia_level", None) if field is not None: args["paranoia_level"] = field + else: + args["paranoia_level"] = 0 field = data.get("created_at", None) if field is not None: @@ -597,36 +677,48 @@ def unmarshal_PipelineStages(data: Any) -> PipelineStages: args["dns_stages"] = ( [unmarshal_DNSStage(v) for v in field] if field is not None else None ) + else: + args["dns_stages"] = None field = data.get("tls_stages", None) if field is not None: args["tls_stages"] = ( [unmarshal_TLSStage(v) for v in field] if field is not None else None ) + else: + args["tls_stages"] = None field = data.get("cache_stages", None) if field is not None: args["cache_stages"] = ( [unmarshal_CacheStage(v) for v in field] if field is not None else None ) + else: + args["cache_stages"] = None field = data.get("backend_stages", None) if field is not None: args["backend_stages"] = ( [unmarshal_BackendStage(v) for v in field] if field is not None else None ) + else: + args["backend_stages"] = None field = data.get("waf_stages", None) if field is not None: args["waf_stages"] = ( [unmarshal_WafStage(v) for v in field] if field is not None else None ) + else: + args["waf_stages"] = None field = data.get("route_stages", None) if field is not None: args["route_stages"] = ( [unmarshal_RouteStage(v) for v in field] if field is not None else None ) + else: + args["route_stages"] = None field = data.get("pipeline", None) if field is not None: @@ -648,26 +740,32 @@ def unmarshal_PurgeRequest(data: Any) -> PurgeRequest: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = PurgeRequestStatus.UNKNOWN_STATUS field = data.get("assets", None) if field is not None: args["assets"] = field else: - args["assets"] = None + args["assets"] = field(default_factory=list) field = data.get("all", None) if field is not None: args["all"] = field else: - args["all"] = None + args["all"] = False field = data.get("created_at", None) if field is not None: @@ -695,10 +793,16 @@ def unmarshal_RuleHttpMatchPathFilter(data: Any) -> RuleHttpMatchPathFilter: field = data.get("path_filter_type", None) if field is not None: args["path_filter_type"] = field + else: + args["path_filter_type"] = ( + RuleHttpMatchPathFilterPathFilterType.UNKNOWN_PATH_FILTER + ) field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None return RuleHttpMatchPathFilter(**args) @@ -716,6 +820,8 @@ def unmarshal_RuleHttpMatch(data: Any) -> RuleHttpMatch: args["method_filters"] = ( [RuleHttpMatchMethodFilter(v) for v in field] if field is not None else None ) + else: + args["method_filters"] = field(default_factory=list) field = data.get("path_filter", None) if field is not None: @@ -737,10 +843,14 @@ def unmarshal_RouteRule(data: Any) -> RouteRule: field = data.get("position", None) if field is not None: args["position"] = field + else: + args["position"] = 0 field = data.get("route_stage_id", None) if field is not None: args["route_stage_id"] = field + else: + args["route_stage_id"] = None field = data.get("rule_http_match", None) if field is not None: @@ -770,6 +880,8 @@ def unmarshal_AddRouteRulesResponse(data: Any) -> AddRouteRulesResponse: args["route_rules"] = ( [unmarshal_RouteRule(v) for v in field] if field is not None else None ) + else: + args["route_rules"] = field(default_factory=list) return AddRouteRulesResponse(**args) @@ -785,6 +897,8 @@ def unmarshal_CheckDomainResponse(data: Any) -> CheckDomainResponse: field = data.get("is_valid", None) if field is not None: args["is_valid"] = field + else: + args["is_valid"] = None return CheckDomainResponse(**args) @@ -800,10 +914,14 @@ def unmarshal_CheckLbOriginResponse(data: Any) -> CheckLbOriginResponse: field = data.get("is_valid", None) if field is not None: args["is_valid"] = field + else: + args["is_valid"] = None field = data.get("error_type", None) if field is not None: args["error_type"] = field + else: + args["error_type"] = None return CheckLbOriginResponse(**args) @@ -819,6 +937,8 @@ def unmarshal_CheckPEMChainResponse(data: Any) -> CheckPEMChainResponse: field = data.get("is_valid", None) if field is not None: args["is_valid"] = field + else: + args["is_valid"] = None return CheckPEMChainResponse(**args) @@ -834,18 +954,26 @@ def unmarshal_PlanDetails(data: Any) -> PlanDetails: field = data.get("plan_name", None) if field is not None: args["plan_name"] = field + else: + args["plan_name"] = PlanName.UNKNOWN_NAME field = data.get("package_gb", None) if field is not None: args["package_gb"] = field + else: + args["package_gb"] = 0 field = data.get("pipeline_limit", None) if field is not None: args["pipeline_limit"] = field + else: + args["pipeline_limit"] = 0 field = data.get("waf_requests", None) if field is not None: args["waf_requests"] = field + else: + args["waf_requests"] = 0 return PlanDetails(**args) @@ -884,22 +1012,32 @@ def unmarshal_GetBillingResponse(data: Any) -> GetBillingResponse: field = data.get("pipeline_number", None) if field is not None: args["pipeline_number"] = field + else: + args["pipeline_number"] = 0 field = data.get("current_plan_cache_usage", None) if field is not None: args["current_plan_cache_usage"] = field + else: + args["current_plan_cache_usage"] = 0 field = data.get("extra_cache_usage", None) if field is not None: args["extra_cache_usage"] = field + else: + args["extra_cache_usage"] = 0 field = data.get("current_plan_waf_usage", None) if field is not None: args["current_plan_waf_usage"] = field + else: + args["current_plan_waf_usage"] = 0 field = data.get("extra_waf_usage", None) if field is not None: args["extra_waf_usage"] = field + else: + args["extra_waf_usage"] = 0 field = data.get("plan_cost", None) if field is not None: @@ -920,6 +1058,8 @@ def unmarshal_GetBillingResponse(data: Any) -> GetBillingResponse: if field is not None else None ) + else: + args["plans_usage_details"] = field(default_factory=dict) field = data.get("extra_cache_cost", None) if field is not None: @@ -995,10 +1135,14 @@ def unmarshal_ListBackendStagesResponse(data: Any) -> ListBackendStagesResponse: args["stages"] = ( [unmarshal_BackendStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListBackendStagesResponse(**args) @@ -1016,10 +1160,14 @@ def unmarshal_ListCacheStagesResponse(data: Any) -> ListCacheStagesResponse: args["stages"] = ( [unmarshal_CacheStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListCacheStagesResponse(**args) @@ -1037,10 +1185,14 @@ def unmarshal_ListDNSStagesResponse(data: Any) -> ListDNSStagesResponse: args["stages"] = ( [unmarshal_DNSStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDNSStagesResponse(**args) @@ -1079,10 +1231,14 @@ def unmarshal_ListHeadStagesResponse(data: Any) -> ListHeadStagesResponse: if field is not None else None ) + else: + args["head_stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListHeadStagesResponse(**args) @@ -1100,10 +1256,14 @@ def unmarshal_ListPipelinesResponse(data: Any) -> ListPipelinesResponse: args["pipelines"] = ( [unmarshal_Pipeline(v) for v in field] if field is not None else None ) + else: + args["pipelines"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPipelinesResponse(**args) @@ -1123,10 +1283,14 @@ def unmarshal_ListPipelinesWithStagesResponse( args["pipelines"] = ( [unmarshal_PipelineStages(v) for v in field] if field is not None else None ) + else: + args["pipelines"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListPipelinesWithStagesResponse(**args) @@ -1142,12 +1306,16 @@ def unmarshal_ListPlansResponse(data: Any) -> ListPlansResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("plans", None) if field is not None: args["plans"] = ( [unmarshal_PlanDetails(v) for v in field] if field is not None else None ) + else: + args["plans"] = None return ListPlansResponse(**args) @@ -1165,10 +1333,14 @@ def unmarshal_ListPurgeRequestsResponse(data: Any) -> ListPurgeRequestsResponse: args["purge_requests"] = ( [unmarshal_PurgeRequest(v) for v in field] if field is not None else None ) + else: + args["purge_requests"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPurgeRequestsResponse(**args) @@ -1186,10 +1358,14 @@ def unmarshal_ListRouteRulesResponse(data: Any) -> ListRouteRulesResponse: args["route_rules"] = ( [unmarshal_RouteRule(v) for v in field] if field is not None else None ) + else: + args["route_rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListRouteRulesResponse(**args) @@ -1207,10 +1383,14 @@ def unmarshal_ListRouteStagesResponse(data: Any) -> ListRouteStagesResponse: args["stages"] = ( [unmarshal_RouteStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListRouteStagesResponse(**args) @@ -1228,10 +1408,14 @@ def unmarshal_ListTLSStagesResponse(data: Any) -> ListTLSStagesResponse: args["stages"] = ( [unmarshal_TLSStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListTLSStagesResponse(**args) @@ -1249,10 +1433,14 @@ def unmarshal_ListWafStagesResponse(data: Any) -> ListWafStagesResponse: args["stages"] = ( [unmarshal_WafStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListWafStagesResponse(**args) @@ -1268,6 +1456,8 @@ def unmarshal_Plan(data: Any) -> Plan: field = data.get("plan_name", None) if field is not None: args["plan_name"] = field + else: + args["plan_name"] = None return Plan(**args) @@ -1285,6 +1475,8 @@ def unmarshal_SetRouteRulesResponse(data: Any) -> SetRouteRulesResponse: args["route_rules"] = ( [unmarshal_RouteRule(v) for v in field] if field is not None else None ) + else: + args["route_rules"] = field(default_factory=list) return SetRouteRulesResponse(**args) @@ -1296,7 +1488,7 @@ def marshal_RuleHttpMatchPathFilter( output: Dict[str, Any] = {} if request.path_filter_type is not None: - output["path_filter_type"] = str(request.path_filter_type) + output["path_filter_type"] = request.path_filter_type if request.value is not None: output["value"] = request.value @@ -1396,7 +1588,9 @@ def marshal_CheckDomainRequest( output["cname"] = request.cname if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1411,7 +1605,9 @@ def marshal_ScalewayLb( output["id"] = request.id if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone if request.frontend_id is not None: output["frontend_id"] = request.frontend_id @@ -1474,7 +1670,9 @@ def marshal_CheckPEMChainRequest( output["fqdn"] = request.fqdn if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1612,7 +1810,9 @@ def marshal_CreatePipelineRequest( output["description"] = request.description if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1667,7 +1867,9 @@ def marshal_TLSSecret( output["secret_id"] = request.secret_id if request.region is not None: - output["region"] = request.region or defaults.default_region + output["region"] = request.region + else: + output["region"] = defaults.default_region return output @@ -1734,7 +1936,7 @@ def marshal_CreateWafStageRequest( output["paranoia_level"] = request.paranoia_level if request.mode is not None: - output["mode"] = str(request.mode) + output["mode"] = request.mode return output @@ -1746,10 +1948,12 @@ def marshal_SelectPlanRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.plan_name is not None: - output["plan_name"] = str(request.plan_name) + output["plan_name"] = request.plan_name return output @@ -2037,7 +2241,7 @@ def marshal_UpdateWafStageRequest( ) if request.mode is not None: - output["mode"] = str(request.mode) + output["mode"] = request.mode if request.paranoia_level is not None: output["paranoia_level"] = request.paranoia_level diff --git a/scaleway-async/scaleway_async/edge_services/v1beta1/types.py b/scaleway-async/scaleway_async/edge_services/v1beta1/types.py index 21c36aa24..a62e46e2d 100644 --- a/scaleway-async/scaleway_async/edge_services/v1beta1/types.py +++ b/scaleway-async/scaleway_async/edge_services/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -282,12 +282,12 @@ class ScalewayLb: ID of the frontend linked to the Load Balancer. """ - is_ssl: Optional[bool] + is_ssl: Optional[bool] = False """ Defines whether the Load Balancer's frontend handles SSL connections. """ - domain_name: Optional[str] + domain_name: Optional[str] = None """ Fully Qualified Domain Name (in the format subdomain.example.com) to use in HTTP requests sent towards your Load Balancer. """ @@ -316,17 +316,17 @@ class ScalewayLbBackendConfig: @dataclass class ScalewayS3BackendConfig: - bucket_name: Optional[str] + bucket_name: Optional[str] = None """ Name of the Bucket. """ - bucket_region: Optional[str] + bucket_region: Optional[str] = None """ Region of the Bucket. """ - is_website: Optional[bool] + is_website: Optional[bool] = False """ Defines whether the bucket website feature is enabled. """ @@ -335,13 +335,9 @@ class ScalewayS3BackendConfig: @dataclass class PipelineError: stage: PipelineErrorStage - code: PipelineErrorCode - severity: PipelineErrorSeverity - message: str - type_: PipelineErrorType @@ -365,7 +361,7 @@ class RuleHttpMatch: HTTP methods to filter for. A request using any of these methods will be considered to match the rule. Possible values are `get`, `post`, `put`, `patch`, `delete`, `head`, `options`. All methods will match if none is provided. """ - path_filter: Optional[RuleHttpMatchPathFilter] + path_filter: Optional[RuleHttpMatchPathFilter] = None """ HTTP URL path to filter for. A request whose path matches the given filter will be considered to match the rule. All paths will match if none is provided. """ @@ -383,19 +379,19 @@ class BackendStage: Pipeline ID the backend stage belongs to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the backend stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the backend stage was last updated. """ - scaleway_s3: Optional[ScalewayS3BackendConfig] + scaleway_s3: Optional[ScalewayS3BackendConfig] = None - scaleway_lb: Optional[ScalewayLbBackendConfig] + scaleway_lb: Optional[ScalewayLbBackendConfig] = None @dataclass @@ -415,26 +411,26 @@ class CacheStage: Defines whether responses to requests with cookies must be stored in the cache. """ - fallback_ttl: Optional[str] + fallback_ttl: Optional[str] = None """ Time To Live (TTL) in seconds. Defines how long content is cached. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the cache stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the cache stage was last updated. """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None @dataclass @@ -459,21 +455,21 @@ class DNSStage: Pipeline ID the DNS stage belongs to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the DNS stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the DNS stage was last updated. """ - tls_stage_id: Optional[str] + tls_stage_id: Optional[str] = None - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass @@ -513,12 +509,12 @@ class Pipeline: Organization ID of the pipeline. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the pipeline was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the pipeline was last updated. """ @@ -536,17 +532,17 @@ class RouteStage: Pipeline ID the route stage belongs to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the route stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the route stage was last updated. """ - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None @dataclass @@ -571,28 +567,28 @@ class TLSStage: Pipeline ID the TLS stage belongs to. """ - certificate_expires_at: Optional[datetime] + certificate_expires_at: Optional[datetime] = None """ Expiration date of the certificate. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the TLS stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the TLS stage was last updated. """ - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None @dataclass @@ -617,24 +613,24 @@ class WafStage: Sensitivity level (`1`,`2`,`3`,`4`) to use when classifying requests as malicious. With a high level, requests are more likely to be classed as malicious, and false positives are expected. With a lower level, requests are more likely to be classed as benign. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the WAF stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the WAF stage was last updated. """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass class SetRouteRulesRequestRouteRule: - rule_http_match: Optional[RuleHttpMatch] + rule_http_match: Optional[RuleHttpMatch] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass @@ -649,15 +645,14 @@ class RouteRule: Route stage ID the route rule belongs to. """ - rule_http_match: Optional[RuleHttpMatch] + rule_http_match: Optional[RuleHttpMatch] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass class CheckPEMChainRequestSecretChain: secret_id: str - secret_region: str @@ -686,7 +681,7 @@ class PlanDetails: @dataclass class PlanUsageDetails: - plan_cost: Optional[Money] + plan_cost: Optional[Money] = None """ Cost to date (this month) for the corresponding Edge Services subscription plan. """ @@ -694,29 +689,23 @@ class PlanUsageDetails: @dataclass class HeadStageResponseHeadStage: - dns_stage_id: Optional[str] + dns_stage_id: Optional[str] = None @dataclass class ListHeadStagesResponseHeadStage: - dns_stage_id: Optional[str] + dns_stage_id: Optional[str] = None @dataclass class PipelineStages: dns_stages: List[DNSStage] - tls_stages: List[TLSStage] - cache_stages: List[CacheStage] - backend_stages: List[BackendStage] - waf_stages: List[WafStage] - route_stages: List[RouteStage] - - pipeline: Optional[Pipeline] + pipeline: Optional[Pipeline] = None @dataclass @@ -736,19 +725,19 @@ class PurgeRequest: Status of the purge request. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the purge request was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the purge request was last updated. """ - assets: Optional[List[str]] + assets: Optional[List[str]] = field(default_factory=list) - all: Optional[bool] + all: Optional[bool] = False @dataclass @@ -764,7 +753,6 @@ class SetHeadStageRequestRemoveHeadStage: @dataclass class SetHeadStageRequestSwapHeadStage: new_stage_id: str - current_stage_id: str @@ -783,14 +771,16 @@ class AddRouteRulesRequest: ID of the route stage to update. """ - route_rules: Optional[List[SetRouteRulesRequestRouteRule]] + route_rules: Optional[List[SetRouteRulesRequestRouteRule]] = field( + default_factory=list + ) """ List of rules to be checked against every HTTP request. The first matching rule will forward the request to its specified backend stage. If no rules are matched, the request is forwarded to the WAF stage defined by `waf_stage_id`. """ - after_position: Optional[int] + after_position: Optional[int] = 0 - before_position: Optional[int] + before_position: Optional[int] = 0 @dataclass @@ -804,10 +794,8 @@ class AddRouteRulesResponse: @dataclass class CheckDomainRequest: fqdn: str - cname: str - - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -817,25 +805,22 @@ class CheckDomainResponse: @dataclass class CheckLbOriginRequest: - lb: Optional[ScalewayLb] + lb: Optional[ScalewayLb] = None @dataclass class CheckLbOriginResponse: is_valid: bool - error_type: LbOriginError @dataclass class CheckPEMChainRequest: fqdn: str + project_id: Optional[str] = None + secret: Optional[CheckPEMChainRequestSecretChain] = None - project_id: Optional[str] - - secret: Optional[CheckPEMChainRequestSecretChain] - - raw: Optional[str] + raw: Optional[str] = None @dataclass @@ -850,52 +835,52 @@ class CreateBackendStageRequest: Pipeline ID the Backend stage belongs to. """ - scaleway_s3: Optional[ScalewayS3BackendConfig] + scaleway_s3: Optional[ScalewayS3BackendConfig] = None - scaleway_lb: Optional[ScalewayLbBackendConfig] + scaleway_lb: Optional[ScalewayLbBackendConfig] = None @dataclass class CreateCacheStageRequest: - fallback_ttl: Optional[str] + pipeline_id: str """ - Time To Live (TTL) in seconds. Defines how long content is cached. + Pipeline ID the Cache stage belongs to. """ - include_cookies: Optional[bool] + fallback_ttl: Optional[str] = None """ - Defines whether responses to requests with cookies must be stored in the cache. + Time To Live (TTL) in seconds. Defines how long content is cached. """ - pipeline_id: str + include_cookies: Optional[bool] = False """ - Pipeline ID the Cache stage belongs to. + Defines whether responses to requests with cookies must be stored in the cache. """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None @dataclass class CreateDNSStageRequest: - fqdns: Optional[List[str]] + pipeline_id: str """ - Fully Qualified Domain Name (in the format subdomain.example.com) to attach to the stage. + Pipeline ID the DNS stage belongs to. """ - pipeline_id: str + fqdns: Optional[List[str]] = field(default_factory=list) """ - Pipeline ID the DNS stage belongs to. + Fully Qualified Domain Name (in the format subdomain.example.com) to attach to the stage. """ - tls_stage_id: Optional[str] + tls_stage_id: Optional[str] = None - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass @@ -910,7 +895,7 @@ class CreatePipelineRequest: Description of the pipeline. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID in which the pipeline will be created. """ @@ -923,9 +908,9 @@ class CreatePurgeRequestRequest: Pipeline ID in which the purge request will be created. """ - assets: Optional[List[str]] + assets: Optional[List[str]] = field(default_factory=list) - all: Optional[bool] + all: Optional[bool] = False @dataclass @@ -935,33 +920,33 @@ class CreateRouteStageRequest: Pipeline ID the route stage belongs to. """ - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None @dataclass class CreateTLSStageRequest: - secrets: Optional[List[TLSSecret]] + pipeline_id: str """ - Secret (from Scaleway Secret Manager) containing your custom certificate. + Pipeline ID the TLS stage belongs to. """ - managed_certificate: Optional[bool] + secrets: Optional[List[TLSSecret]] = field(default_factory=list) """ - True when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint. + Secret (from Scaleway Secret Manager) containing your custom certificate. """ - pipeline_id: str + managed_certificate: Optional[bool] = False """ - Pipeline ID the TLS stage belongs to. + True when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint. """ - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None @dataclass @@ -976,12 +961,12 @@ class CreateWafStageRequest: Sensitivity level (`1`,`2`,`3`,`4`) to use when classifying requests as malicious. With a high level, requests are more likely to be classed as malicious, and false positives are expected. With a lower level, requests are more likely to be classed as benign. """ - mode: Optional[WafStageMode] + mode: Optional[WafStageMode] = WafStageMode.UNKNOWN_MODE """ Mode defining WAF behavior (`disable`/`log_only`/`enable`). """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass @@ -1002,7 +987,7 @@ class DeleteCacheStageRequest: @dataclass class DeleteCurrentPlanRequest: - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -1055,16 +1040,11 @@ class GetBackendStageRequest: @dataclass class GetBillingRequest: - project_id: Optional[str] + project_id: Optional[str] = None @dataclass class GetBillingResponse: - current_plan: Optional[PlanDetails] - """ - Information on the currently-selected, active Edge Services subscription plan. - """ - pipeline_number: int """ Total number of pipelines currently configured. @@ -1090,37 +1070,42 @@ class GetBillingResponse: Total number of extra requests processed by the WAF from the beginning of the month, not included in the subscription plans. """ - plan_cost: Optional[Money] + plans_usage_details: Dict[str, PlanUsageDetails] """ - Cost to date (this month) for Edge Service subscription plans. This comprises the pro-rata cost of the current subscription plan, and any previous subscription plans that were active earlier in the month. + Detailed costs and usage for all Edge Services subscription plans that were activated during the month. """ - extra_pipelines_cost: Optional[Money] + current_plan: Optional[PlanDetails] = None """ - Cost to date (this month) of pipelines not included in the subscription plans. + Information on the currently-selected, active Edge Services subscription plan. """ - plans_usage_details: Dict[str, PlanUsageDetails] + plan_cost: Optional[Money] = None """ - Detailed costs and usage for all Edge Services subscription plans that were activated during the month. + Cost to date (this month) for Edge Service subscription plans. This comprises the pro-rata cost of the current subscription plan, and any previous subscription plans that were active earlier in the month. """ - extra_cache_cost: Optional[Money] + extra_pipelines_cost: Optional[Money] = None + """ + Cost to date (this month) of pipelines not included in the subscription plans. + """ + + extra_cache_cost: Optional[Money] = None """ Cost to date (this month) of the data egressed from the cache that is not included in the subscription plans. """ - extra_waf_cost: Optional[Money] + extra_waf_cost: Optional[Money] = None """ Cost to date (this month) of the extra requests processed by the WAF that were not included in the subscription plans. """ - waf_add_on: Optional[Money] + waf_add_on: Optional[Money] = None """ Cost of activating WAF add-on (where subscription plan does not include WAF). """ - total_cost: Optional[Money] + total_cost: Optional[Money] = None """ Total cost to date (this month) of all Edge Services resources including active subscription plan, previously active plans, extra pipelines and extra egress cache data. """ @@ -1136,7 +1121,7 @@ class GetCacheStageRequest: @dataclass class GetCurrentPlanRequest: - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -1189,7 +1174,7 @@ class GetWafStageRequest: @dataclass class HeadStageResponse: - head_stage: Optional[HeadStageResponseHeadStage] + head_stage: Optional[HeadStageResponseHeadStage] = None """ Modified or created head stage. """ @@ -1197,37 +1182,39 @@ class HeadStageResponse: @dataclass class ListBackendStagesRequest: - order_by: Optional[ListBackendStagesRequestOrderBy] + pipeline_id: str """ - Sort order of backend stages in the response. + Pipeline ID to filter for. Only backend stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListBackendStagesRequestOrderBy] = ( + ListBackendStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of backend stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of backend stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only backend stages from this pipeline will be returned. + Number of backend stages to return per page. """ - bucket_name: Optional[str] + bucket_name: Optional[str] = None """ Bucket name to filter for. Only backend stages from this Bucket will be returned. """ - bucket_region: Optional[str] + bucket_region: Optional[str] = None """ Bucket region to filter for. Only backend stages with buckets in this region will be returned. """ - lb_id: Optional[str] + lb_id: Optional[str] = None """ Load Balancer ID to filter for. Only backend stages with this Load Balancer will be returned. """ @@ -1248,24 +1235,26 @@ class ListBackendStagesResponse: @dataclass class ListCacheStagesRequest: - order_by: Optional[ListCacheStagesRequestOrderBy] + pipeline_id: str """ - Sort order of cache stages in the response. + Pipeline ID to filter for. Only cache stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListCacheStagesRequestOrderBy] = ( + ListCacheStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of cache stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of cache stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only cache stages from this pipeline will be returned. + Number of cache stages to return per page. """ @@ -1284,27 +1273,29 @@ class ListCacheStagesResponse: @dataclass class ListDNSStagesRequest: - order_by: Optional[ListDNSStagesRequestOrderBy] + pipeline_id: str """ - Sort order of DNS stages in the response. + Pipeline ID to filter for. Only DNS stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListDNSStagesRequestOrderBy] = ( + ListDNSStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of DNS stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of DNS stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only DNS stages from this pipeline will be returned. + Number of DNS stages to return per page. """ - fqdn: Optional[str] + fqdn: Optional[str] = None """ Fully Qualified Domain Name to filter for (in the format subdomain.example.com). Only DNS stages with this FQDN will be returned. """ @@ -1330,12 +1321,12 @@ class ListHeadStagesRequest: ID of the pipeline to update. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of head stages to return per page. """ @@ -1356,37 +1347,39 @@ class ListHeadStagesResponse: @dataclass class ListPipelinesRequest: - order_by: Optional[ListPipelinesRequestOrderBy] + order_by: Optional[ListPipelinesRequestOrderBy] = ( + ListPipelinesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of pipelines in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of pipelines to return per page. """ - name: Optional[str] + name: Optional[str] = None """ Pipeline name to filter for. Only pipelines with this string within their name will be returned. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. Only pipelines from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. Only pipelines from this Project will be returned. """ - has_backend_stage_lb: Optional[bool] + has_backend_stage_lb: Optional[bool] = False """ Filter on backend stage. Only pipelines with a Load Balancer origin will be returned. """ @@ -1407,61 +1400,56 @@ class ListPipelinesResponse: @dataclass class ListPipelinesWithStagesRequest: - order_by: Optional[ListPipelinesWithStagesRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - name: Optional[str] - - organization_id: Optional[str] - - project_id: Optional[str] + order_by: Optional[ListPipelinesWithStagesRequestOrderBy] = None + page: Optional[int] = None + page_size: Optional[int] = None + name: Optional[str] = None + organization_id: Optional[str] = None + project_id: Optional[str] = None @dataclass class ListPipelinesWithStagesResponse: pipelines: List[PipelineStages] - total_count: int @dataclass class ListPlansResponse: total_count: int - plans: List[PlanDetails] @dataclass class ListPurgeRequestsRequest: - order_by: Optional[ListPurgeRequestsRequestOrderBy] + order_by: Optional[ListPurgeRequestsRequestOrderBy] = ( + ListPurgeRequestsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of purge requests in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of purge requests to return per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. Only purge requests from this Project will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. Only purge requests from this Project will be returned. """ - pipeline_id: Optional[str] + pipeline_id: Optional[str] = None """ Pipeline ID to filter for. Only purge requests from this pipeline will be returned. """ @@ -1503,24 +1491,26 @@ class ListRouteRulesResponse: @dataclass class ListRouteStagesRequest: - order_by: Optional[ListRouteStagesRequestOrderBy] + pipeline_id: str """ - Sort order of route stages in the response. + Pipeline ID to filter for. Only route stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListRouteStagesRequestOrderBy] = ( + ListRouteStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of route stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of route stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only route stages from this pipeline will be returned. + Number of route stages to return per page. """ @@ -1539,32 +1529,34 @@ class ListRouteStagesResponse: @dataclass class ListTLSStagesRequest: - order_by: Optional[ListTLSStagesRequestOrderBy] + pipeline_id: str """ - Sort order of TLS stages in the response. + Pipeline ID to filter for. Only TLS stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListTLSStagesRequestOrderBy] = ( + ListTLSStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of TLS stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of TLS stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only TLS stages from this pipeline will be returned. + Number of TLS stages to return per page. """ - secret_id: Optional[str] + secret_id: Optional[str] = None """ Secret ID to filter for. Only TLS stages with this Secret ID will be returned. """ - secret_region: Optional[str] + secret_region: Optional[str] = None """ Secret region to filter for. Only TLS stages with a Secret in this region will be returned. """ @@ -1585,24 +1577,26 @@ class ListTLSStagesResponse: @dataclass class ListWafStagesRequest: - order_by: Optional[ListWafStagesRequestOrderBy] + pipeline_id: str """ - Sort order of WAF stages in the response. + Pipeline ID to filter for. Only WAF stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListWafStagesRequestOrderBy] = ( + ListWafStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of WAF stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of WAF stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only WAF stages from this pipeline will be returned. + Number of WAF stages to return per page. """ @@ -1626,50 +1620,36 @@ class Plan: @dataclass class SearchBackendStagesRequest: - order_by: Optional[SearchBackendStagesRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - project_id: Optional[str] - - bucket_name: Optional[str] - - bucket_region: Optional[str] - - lb_id: Optional[str] + order_by: Optional[SearchBackendStagesRequestOrderBy] = None + page: Optional[int] = None + page_size: Optional[int] = None + project_id: Optional[str] = None + bucket_name: Optional[str] = None + bucket_region: Optional[str] = None + lb_id: Optional[str] = None @dataclass class SearchRouteRulesRequest: - order_by: Optional[SearchRouteRulesRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - organization_id: Optional[str] - - project_id: Optional[str] + order_by: Optional[SearchRouteRulesRequestOrderBy] = None + page: Optional[int] = None + page_size: Optional[int] = None + organization_id: Optional[str] = None + project_id: Optional[str] = None @dataclass class SearchWafStagesRequest: - order_by: Optional[SearchWafStagesRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - project_id: Optional[str] + order_by: Optional[SearchWafStagesRequestOrderBy] = None + page: Optional[int] = None + page_size: Optional[int] = None + project_id: Optional[str] = None @dataclass class SelectPlanRequest: - project_id: Optional[str] - - plan_name: Optional[PlanName] + project_id: Optional[str] = None + plan_name: Optional[PlanName] = None @dataclass @@ -1679,11 +1659,11 @@ class SetHeadStageRequest: ID of the pipeline to update. """ - add_new_head_stage: Optional[SetHeadStageRequestAddNewHeadStage] + add_new_head_stage: Optional[SetHeadStageRequestAddNewHeadStage] = None - remove_head_stage: Optional[SetHeadStageRequestRemoveHeadStage] + remove_head_stage: Optional[SetHeadStageRequestRemoveHeadStage] = None - swap_head_stage: Optional[SetHeadStageRequestSwapHeadStage] + swap_head_stage: Optional[SetHeadStageRequestSwapHeadStage] = None @dataclass @@ -1693,7 +1673,9 @@ class SetRouteRulesRequest: ID of the route stage to update. """ - route_rules: Optional[List[SetRouteRulesRequestRouteRule]] + route_rules: Optional[List[SetRouteRulesRequestRouteRule]] = field( + default_factory=list + ) """ List of rules to be checked against every HTTP request. The first matching rule will forward the request to its specified backend stage. If no rules are matched, the request is forwarded to the WAF stage defined by `waf_stage_id`. """ @@ -1719,9 +1701,9 @@ class UpdateBackendStageRequest: Pipeline ID the Backend stage belongs to. """ - scaleway_s3: Optional[ScalewayS3BackendConfig] + scaleway_s3: Optional[ScalewayS3BackendConfig] = None - scaleway_lb: Optional[ScalewayLbBackendConfig] + scaleway_lb: Optional[ScalewayLbBackendConfig] = None @dataclass @@ -1731,21 +1713,21 @@ class UpdateCacheStageRequest: ID of the cache stage to update. """ - fallback_ttl: Optional[str] + fallback_ttl: Optional[str] = None """ Time To Live (TTL) in seconds. Defines how long content is cached. """ - include_cookies: Optional[bool] + include_cookies: Optional[bool] = False """ Defines whether responses to requests with cookies must be stored in the cache. """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None @dataclass @@ -1755,16 +1737,16 @@ class UpdateDNSStageRequest: ID of the DNS stage to update. """ - fqdns: Optional[List[str]] + fqdns: Optional[List[str]] = field(default_factory=list) """ Fully Qualified Domain Name (in the format subdomain.example.com) attached to the stage. """ - tls_stage_id: Optional[str] + tls_stage_id: Optional[str] = None - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass @@ -1774,12 +1756,12 @@ class UpdatePipelineRequest: ID of the pipeline to update. """ - name: Optional[str] + name: Optional[str] = None """ Name of the pipeline. """ - description: Optional[str] + description: Optional[str] = None """ Description of the pipeline. """ @@ -1792,7 +1774,7 @@ class UpdateRouteStageRequest: ID of the route stage to update. """ - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None @dataclass @@ -1802,23 +1784,23 @@ class UpdateTLSStageRequest: ID of the TLS stage to update. """ - tls_secrets_config: Optional[TLSSecretsConfig] + tls_secrets_config: Optional[TLSSecretsConfig] = None """ Secret (from Scaleway Secret-Manager) containing your custom certificate. """ - managed_certificate: Optional[bool] + managed_certificate: Optional[bool] = False """ True when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint. """ - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None @dataclass @@ -1828,14 +1810,14 @@ class UpdateWafStageRequest: ID of the WAF stage to update. """ - mode: Optional[WafStageMode] + mode: Optional[WafStageMode] = WafStageMode.UNKNOWN_MODE """ Mode defining WAF behavior (`disable`/`log_only`/`enable`). """ - paranoia_level: Optional[int] + paranoia_level: Optional[int] = 0 """ Sensitivity level (`1`,`2`,`3`,`4`) to use when classifying requests as malicious. With a high level, requests are more likely to be classed as malicious, and false positives are expected. With a lower level, requests are more likely to be classed as benign. """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None diff --git a/scaleway-async/scaleway_async/file/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/file/v1alpha1/marshalling.py index e9b6d39da..d81d3a312 100644 --- a/scaleway-async/scaleway_async/file/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/file/v1alpha1/marshalling.py @@ -6,6 +6,8 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + AttachmentResourceType, + FileSystemStatus, FileSystem, Attachment, ListAttachmentsResponse, @@ -26,38 +28,56 @@ def unmarshal_FileSystem(data: Any) -> FileSystem: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = FileSystemStatus.UNKNOWN_STATUS field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("number_of_attachments", None) if field is not None: args["number_of_attachments"] = field + else: + args["number_of_attachments"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -85,18 +105,26 @@ def unmarshal_Attachment(data: Any) -> Attachment: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("filesystem_id", None) if field is not None: args["filesystem_id"] = field + else: + args["filesystem_id"] = None field = data.get("resource_id", None) if field is not None: args["resource_id"] = field + else: + args["resource_id"] = None field = data.get("resource_type", None) if field is not None: args["resource_type"] = field + else: + args["resource_type"] = AttachmentResourceType.UNKNOWN_RESOURCE_TYPE field = data.get("zone", None) if field is not None: @@ -120,10 +148,14 @@ def unmarshal_ListAttachmentsResponse(data: Any) -> ListAttachmentsResponse: args["attachments"] = ( [unmarshal_Attachment(v) for v in field] if field is not None else None ) + else: + args["attachments"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListAttachmentsResponse(**args) @@ -141,10 +173,14 @@ def unmarshal_ListFileSystemsResponse(data: Any) -> ListFileSystemsResponse: args["filesystems"] = ( [unmarshal_FileSystem(v) for v in field] if field is not None else None ) + else: + args["filesystems"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListFileSystemsResponse(**args) @@ -162,7 +198,9 @@ def marshal_CreateFileSystemRequest( output["size"] = request.size if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway-async/scaleway_async/file/v1alpha1/types.py b/scaleway-async/scaleway_async/file/v1alpha1/types.py index a4a542aa8..58fc14222 100644 --- a/scaleway-async/scaleway_async/file/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/file/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -71,7 +71,7 @@ class Attachment: The type of the attached resource. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ The zone where the resource is located. """ @@ -128,12 +128,12 @@ class FileSystem: Region where the filesystem is located. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the filesystem. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the properties of the filesystem. """ @@ -155,17 +155,17 @@ class CreateFileSystemRequest: Must be compliant with the minimum (100 GB) and maximum (10 TB) allowed size. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project the filesystem belongs to. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the filesystem. """ @@ -182,7 +182,7 @@ class DeleteFileSystemRequest: UUID of the filesystem. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -199,7 +199,7 @@ class GetFileSystemRequest: UUID of the filesystem. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -211,37 +211,39 @@ class ListAttachmentsRequest: Request to list filesystem attachments with filtering and pagination options. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - filesystem_id: Optional[str] + filesystem_id: Optional[str] = None """ UUID of the File Storage volume. """ - resource_id: Optional[str] + resource_id: Optional[str] = None """ Filter by resource ID. """ - resource_type: Optional[AttachmentResourceType] + resource_type: Optional[AttachmentResourceType] = ( + AttachmentResourceType.UNKNOWN_RESOURCE_TYPE + ) """ Filter by resource type. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Filter by resource zone. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (starting at 1). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of entries per page (default: 20, max: 100). """ @@ -270,42 +272,44 @@ class ListFileSystemsRequest: Request to list filesystems with filtering and pagination options. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListFileSystemsRequestOrderBy] + order_by: Optional[ListFileSystemsRequestOrderBy] = ( + ListFileSystemsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (starting at 1). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of entries per page (default: 20, max: 100). """ - name: Optional[str] + name: Optional[str] = None """ Filter the returned filesystems by their names. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. Only filesystems with one or more matching tags will be returned. """ @@ -339,23 +343,23 @@ class UpdateFileSystemRequest: UUID of the filesystem. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ When defined, is the new name of the filesystem. """ - size: Optional[int] + size: Optional[int] = 0 """ Size in bytes, with a granularity of 100 GB (10^11 bytes). Must be compliant with the minimum (100 GB) and maximum (10 TB) allowed size. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the filesystem. """ diff --git a/scaleway-async/scaleway_async/flexibleip/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/flexibleip/v1alpha1/marshalling.py index 6f754d003..bf8d63426 100644 --- a/scaleway-async/scaleway_async/flexibleip/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/flexibleip/v1alpha1/marshalling.py @@ -6,6 +6,9 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + FlexibleIPStatus, + MACAddressStatus, + MACAddressType, MACAddress, FlexibleIP, AttachFlexibleIPsResponse, @@ -32,22 +35,32 @@ def unmarshal_MACAddress(data: Any) -> MACAddress: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("mac_address", None) if field is not None: args["mac_address"] = field + else: + args["mac_address"] = None field = data.get("mac_type", None) if field is not None: args["mac_type"] = field + else: + args["mac_type"] = MACAddressType.UNKNOWN_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = MACAddressStatus.UNKNOWN field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("updated_at", None) if field is not None: @@ -75,30 +88,44 @@ def unmarshal_FlexibleIP(data: Any) -> FlexibleIP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = FlexibleIPStatus.UNKNOWN field = data.get("ip_address", None) if field is not None: args["ip_address"] = field + else: + args["ip_address"] = None field = data.get("updated_at", None) if field is not None: @@ -109,10 +136,14 @@ def unmarshal_FlexibleIP(data: Any) -> FlexibleIP: field = data.get("reverse", None) if field is not None: args["reverse"] = field + else: + args["reverse"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -146,12 +177,16 @@ def unmarshal_AttachFlexibleIPsResponse(data: Any) -> AttachFlexibleIPsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("flexible_ips", None) if field is not None: args["flexible_ips"] = ( [unmarshal_FlexibleIP(v) for v in field] if field is not None else None ) + else: + args["flexible_ips"] = field(default_factory=list) return AttachFlexibleIPsResponse(**args) @@ -167,12 +202,16 @@ def unmarshal_DetachFlexibleIPsResponse(data: Any) -> DetachFlexibleIPsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("flexible_ips", None) if field is not None: args["flexible_ips"] = ( [unmarshal_FlexibleIP(v) for v in field] if field is not None else None ) + else: + args["flexible_ips"] = field(default_factory=list) return DetachFlexibleIPsResponse(**args) @@ -188,12 +227,16 @@ def unmarshal_ListFlexibleIPsResponse(data: Any) -> ListFlexibleIPsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("flexible_ips", None) if field is not None: args["flexible_ips"] = ( [unmarshal_FlexibleIP(v) for v in field] if field is not None else None ) + else: + args["flexible_ips"] = field(default_factory=list) return ListFlexibleIPsResponse(**args) @@ -226,7 +269,9 @@ def marshal_CreateFlexibleIPRequest( output["is_ipv6"] = request.is_ipv6 if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -271,7 +316,7 @@ def marshal_GenerateMACAddrRequest( output: Dict[str, Any] = {} if request.mac_type is not None: - output["mac_type"] = str(request.mac_type) + output["mac_type"] = request.mac_type return output diff --git a/scaleway-async/scaleway_async/flexibleip/v1alpha1/types.py b/scaleway-async/scaleway_async/flexibleip/v1alpha1/types.py index 623c8c4e5..460c4611d 100644 --- a/scaleway-async/scaleway_async/flexibleip/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/flexibleip/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -85,12 +85,12 @@ class MACAddress: MAC address IP Availability Zone. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the virtual MAC was last updated. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the virtual MAC was created. """ @@ -138,11 +138,6 @@ class FlexibleIP: IP of the flexible IP. """ - updated_at: Optional[datetime] - """ - Date on which the flexible IP was last updated. - """ - reverse: str """ Reverse DNS value. @@ -153,17 +148,22 @@ class FlexibleIP: Availability Zone of the flexible IP. """ - created_at: Optional[datetime] + updated_at: Optional[datetime] = None + """ + Date on which the flexible IP was last updated. + """ + + created_at: Optional[datetime] = None """ Date on which the flexible IP was created. """ - mac_address: Optional[MACAddress] + mac_address: Optional[MACAddress] = None """ MAC address of the flexible IP. """ - server_id: Optional[str] + server_id: Optional[str] = None """ ID of the server linked to the flexible IP. """ @@ -181,7 +181,7 @@ class AttachFlexibleIPRequest: ID of the server on which to attach the flexible IPs. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -212,27 +212,27 @@ class CreateFlexibleIPRequest: Defines whether the flexible IP has an IPv6 address. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project to associate with the Flexible IP. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to associate to the flexible IP. """ - server_id: Optional[str] + server_id: Optional[str] = None """ ID of the server to which the newly created flexible IP will be attached. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Value of the reverse DNS. """ @@ -245,7 +245,7 @@ class DeleteFlexibleIPRequest: ID of the flexible IP to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -258,7 +258,7 @@ class DeleteMACAddrRequest: If the flexible IP belongs to a MAC group, the MAC will be removed from both the MAC group and flexible IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -271,7 +271,7 @@ class DetachFlexibleIPRequest: List of flexible IP IDs to detach from a server. Multiple IDs can be provided. Note that flexible IPs must belong to the same MAC group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -302,7 +302,7 @@ class DuplicateMACAddrRequest: Note that flexible IPs need to be attached to the same server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -320,7 +320,7 @@ class GenerateMACAddrRequest: TODO. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -333,7 +333,7 @@ class GetFlexibleIPRequest: ID of the flexible IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -341,47 +341,49 @@ class GetFlexibleIPRequest: @dataclass class ListFlexibleIPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListFlexibleIPsRequestOrderBy] + order_by: Optional[ListFlexibleIPsRequestOrderBy] = ( + ListFlexibleIPsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the returned flexible IPs. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of flexible IPs per page. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tag, only flexible IPs with one or more matching tags will be returned. """ - status: Optional[List[FlexibleIPStatus]] + status: Optional[List[FlexibleIPStatus]] = field(default_factory=list) """ Filter by status, only flexible IPs with this status will be returned. """ - server_ids: Optional[List[str]] + server_ids: Optional[List[str]] = field(default_factory=list) """ Filter by server IDs, only flexible IPs with these server IDs will be returned. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID, only flexible IPs from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID, only flexible IPs from this Project will be returned. """ @@ -403,10 +405,8 @@ class ListFlexibleIPsResponse: @dataclass class MoveMACAddrRequest: fip_id: str - dst_fip_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -419,22 +419,22 @@ class UpdateFlexibleIPRequest: ID of the flexible IP to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - description: Optional[str] + description: Optional[str] = None """ Flexible IP description (max. 255 characters). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the flexible IP. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Value of the reverse DNS. """ diff --git a/scaleway-async/scaleway_async/function/v1beta1/marshalling.py b/scaleway-async/scaleway_async/function/v1beta1/marshalling.py index 2d4accbd8..b2cd891d2 100644 --- a/scaleway-async/scaleway_async/function/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/function/v1beta1/marshalling.py @@ -10,6 +10,17 @@ resolve_one_of, ) from .types import ( + CronStatus, + DomainStatus, + FunctionHttpOption, + FunctionPrivacy, + FunctionRuntime, + FunctionSandbox, + FunctionStatus, + NamespaceStatus, + TokenStatus, + TriggerInputType, + TriggerStatus, Cron, Domain, SecretHashedValue, @@ -59,28 +70,38 @@ def unmarshal_Cron(data: Any) -> Cron: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("function_id", None) if field is not None: args["function_id"] = field + else: + args["function_id"] = None field = data.get("schedule", None) if field is not None: args["schedule"] = field + else: + args["schedule"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = CronStatus.UNKNOWN field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("args", None) if field is not None: args["args"] = field else: - args["args"] = None + args["args"] = field(default_factory=dict) return Cron(**args) @@ -96,22 +117,32 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("function_id", None) if field is not None: args["function_id"] = field + else: + args["function_id"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainStatus.UNKNOWN field = data.get("error_message", None) if field is not None: @@ -133,10 +164,14 @@ def unmarshal_SecretHashedValue(data: Any) -> SecretHashedValue: field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None field = data.get("hashed_value", None) if field is not None: args["hashed_value"] = field + else: + args["hashed_value"] = None return SecretHashedValue(**args) @@ -152,54 +187,80 @@ def unmarshal_Function(data: Any) -> Function: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("namespace_id", None) if field is not None: args["namespace_id"] = field + else: + args["namespace_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = FunctionStatus.UNKNOWN field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = field(default_factory=dict) field = data.get("min_scale", None) if field is not None: args["min_scale"] = field + else: + args["min_scale"] = 0 field = data.get("max_scale", None) if field is not None: args["max_scale"] = field + else: + args["max_scale"] = 0 field = data.get("runtime", None) if field is not None: args["runtime"] = field + else: + args["runtime"] = FunctionRuntime.UNKNOWN_RUNTIME field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field + else: + args["memory_limit"] = 0 field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field + else: + args["cpu_limit"] = 0 field = data.get("handler", None) if field is not None: args["handler"] = field + else: + args["handler"] = None field = data.get("privacy", None) if field is not None: args["privacy"] = field + else: + args["privacy"] = FunctionPrivacy.UNKNOWN_PRIVACY field = data.get("domain_name", None) if field is not None: args["domain_name"] = field + else: + args["domain_name"] = None field = data.get("secret_environment_variables", None) if field is not None: @@ -208,6 +269,8 @@ def unmarshal_Function(data: Any) -> Function: if field is not None else None ) + else: + args["secret_environment_variables"] = field(default_factory=list) field = data.get("timeout", None) if field is not None: @@ -236,22 +299,32 @@ def unmarshal_Function(data: Any) -> Function: field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("http_option", None) if field is not None: args["http_option"] = field + else: + args["http_option"] = FunctionHttpOption.UNKNOWN_HTTP_OPTION field = data.get("runtime_message", None) if field is not None: args["runtime_message"] = field + else: + args["runtime_message"] = None field = data.get("sandbox", None) if field is not None: args["sandbox"] = field + else: + args["sandbox"] = FunctionSandbox.UNKNOWN_SANDBOX field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -291,30 +364,44 @@ def unmarshal_Namespace(data: Any) -> Namespace: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = field(default_factory=dict) field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = NamespaceStatus.UNKNOWN field = data.get("registry_namespace_id", None) if field is not None: args["registry_namespace_id"] = field + else: + args["registry_namespace_id"] = None field = data.get("error_message", None) if field is not None: @@ -325,6 +412,8 @@ def unmarshal_Namespace(data: Any) -> Namespace: field = data.get("registry_endpoint", None) if field is not None: args["registry_endpoint"] = field + else: + args["registry_endpoint"] = None field = data.get("secret_environment_variables", None) if field is not None: @@ -333,14 +422,20 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None else None ) + else: + args["secret_environment_variables"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("description", None) if field is not None: @@ -364,7 +459,7 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None: args["vpc_integration_activated"] = field else: - args["vpc_integration_activated"] = None + args["vpc_integration_activated"] = False return Namespace(**args) @@ -380,14 +475,20 @@ def unmarshal_Token(data: Any) -> Token: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("token", None) if field is not None: args["token"] = field + else: + args["token"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TokenStatus.UNKNOWN field = data.get("function_id", None) if field is not None: @@ -433,18 +534,26 @@ def unmarshal_TriggerMnqNatsClientConfig(data: Any) -> TriggerMnqNatsClientConfi field = data.get("subject", None) if field is not None: args["subject"] = field + else: + args["subject"] = None field = data.get("mnq_nats_account_id", None) if field is not None: args["mnq_nats_account_id"] = field + else: + args["mnq_nats_account_id"] = None field = data.get("mnq_project_id", None) if field is not None: args["mnq_project_id"] = field + else: + args["mnq_project_id"] = None field = data.get("mnq_region", None) if field is not None: args["mnq_region"] = field + else: + args["mnq_region"] = None field = data.get("mnq_credential_id", None) if field is not None: @@ -466,14 +575,20 @@ def unmarshal_TriggerMnqSqsClientConfig(data: Any) -> TriggerMnqSqsClientConfig: field = data.get("queue", None) if field is not None: args["queue"] = field + else: + args["queue"] = None field = data.get("mnq_project_id", None) if field is not None: args["mnq_project_id"] = field + else: + args["mnq_project_id"] = None field = data.get("mnq_region", None) if field is not None: args["mnq_region"] = field + else: + args["mnq_region"] = None field = data.get("mnq_credential_id", None) if field is not None: @@ -495,18 +610,26 @@ def unmarshal_TriggerSqsClientConfig(data: Any) -> TriggerSqsClientConfig: field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("queue_url", None) if field is not None: args["queue_url"] = field + else: + args["queue_url"] = None field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None field = data.get("secret_key", None) if field is not None: args["secret_key"] = field + else: + args["secret_key"] = None return TriggerSqsClientConfig(**args) @@ -522,26 +645,38 @@ def unmarshal_Trigger(data: Any) -> Trigger: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("function_id", None) if field is not None: args["function_id"] = field + else: + args["function_id"] = None field = data.get("input_type", None) if field is not None: args["input_type"] = field + else: + args["input_type"] = TriggerInputType.UNKNOWN_INPUT_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TriggerStatus.UNKNOWN_STATUS field = data.get("error_message", None) if field is not None: @@ -581,10 +716,14 @@ def unmarshal_DownloadURL(data: Any) -> DownloadURL: field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("headers", None) if field is not None: args["headers"] = field + else: + args["headers"] = None return DownloadURL(**args) @@ -602,10 +741,14 @@ def unmarshal_ListCronsResponse(data: Any) -> ListCronsResponse: args["crons"] = ( [unmarshal_Cron(v) for v in field] if field is not None else None ) + else: + args["crons"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListCronsResponse(**args) @@ -623,10 +766,14 @@ def unmarshal_ListDomainsResponse(data: Any) -> ListDomainsResponse: args["domains"] = ( [unmarshal_Domain(v) for v in field] if field is not None else None ) + else: + args["domains"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDomainsResponse(**args) @@ -642,42 +789,62 @@ def unmarshal_Runtime(data: Any) -> Runtime: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("language", None) if field is not None: args["language"] = field + else: + args["language"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("default_handler", None) if field is not None: args["default_handler"] = field + else: + args["default_handler"] = None field = data.get("code_sample", None) if field is not None: args["code_sample"] = field + else: + args["code_sample"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("status_message", None) if field is not None: args["status_message"] = field + else: + args["status_message"] = None field = data.get("extension", None) if field is not None: args["extension"] = field + else: + args["extension"] = None field = data.get("implementation", None) if field is not None: args["implementation"] = field + else: + args["implementation"] = None field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None return Runtime(**args) @@ -695,10 +862,14 @@ def unmarshal_ListFunctionRuntimesResponse(data: Any) -> ListFunctionRuntimesRes args["runtimes"] = ( [unmarshal_Runtime(v) for v in field] if field is not None else None ) + else: + args["runtimes"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListFunctionRuntimesResponse(**args) @@ -716,10 +887,14 @@ def unmarshal_ListFunctionsResponse(data: Any) -> ListFunctionsResponse: args["functions"] = ( [unmarshal_Function(v) for v in field] if field is not None else None ) + else: + args["functions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListFunctionsResponse(**args) @@ -737,10 +912,14 @@ def unmarshal_ListNamespacesResponse(data: Any) -> ListNamespacesResponse: args["namespaces"] = ( [unmarshal_Namespace(v) for v in field] if field is not None else None ) + else: + args["namespaces"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNamespacesResponse(**args) @@ -758,10 +937,14 @@ def unmarshal_ListTokensResponse(data: Any) -> ListTokensResponse: args["tokens"] = ( [unmarshal_Token(v) for v in field] if field is not None else None ) + else: + args["tokens"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListTokensResponse(**args) @@ -777,12 +960,16 @@ def unmarshal_ListTriggersResponse(data: Any) -> ListTriggersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("triggers", None) if field is not None: args["triggers"] = ( [unmarshal_Trigger(v) for v in field] if field is not None else None ) + else: + args["triggers"] = field(default_factory=list) return ListTriggersResponse(**args) @@ -798,10 +985,14 @@ def unmarshal_UploadURL(data: Any) -> UploadURL: field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("headers", None) if field is not None: args["headers"] = field + else: + args["headers"] = field(default_factory=dict) return UploadURL(**args) @@ -879,7 +1070,7 @@ def marshal_CreateFunctionRequest( output["max_scale"] = request.max_scale if request.runtime is not None: - output["runtime"] = str(request.runtime) + output["runtime"] = request.runtime if request.memory_limit is not None: output["memory_limit"] = request.memory_limit @@ -891,7 +1082,7 @@ def marshal_CreateFunctionRequest( output["handler"] = request.handler if request.privacy is not None: - output["privacy"] = str(request.privacy) + output["privacy"] = request.privacy if request.description is not None: output["description"] = request.description @@ -903,10 +1094,10 @@ def marshal_CreateFunctionRequest( ] if request.http_option is not None: - output["http_option"] = str(request.http_option) + output["http_option"] = request.http_option if request.sandbox is not None: - output["sandbox"] = str(request.sandbox) + output["sandbox"] = request.sandbox if request.tags is not None: output["tags"] = request.tags @@ -933,7 +1124,9 @@ def marshal_CreateNamespaceRequest( output["environment_variables"] = request.environment_variables if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.description is not None: output["description"] = request.description @@ -1113,7 +1306,7 @@ def marshal_UpdateFunctionRequest( output["max_scale"] = request.max_scale if request.runtime is not None: - output["runtime"] = str(request.runtime) + output["runtime"] = request.runtime if request.memory_limit is not None: output["memory_limit"] = request.memory_limit @@ -1128,7 +1321,7 @@ def marshal_UpdateFunctionRequest( output["handler"] = request.handler if request.privacy is not None: - output["privacy"] = str(request.privacy) + output["privacy"] = request.privacy if request.description is not None: output["description"] = request.description @@ -1140,10 +1333,10 @@ def marshal_UpdateFunctionRequest( ] if request.http_option is not None: - output["http_option"] = str(request.http_option) + output["http_option"] = request.http_option if request.sandbox is not None: - output["sandbox"] = str(request.sandbox) + output["sandbox"] = request.sandbox if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway-async/scaleway_async/function/v1beta1/types.py b/scaleway-async/scaleway_async/function/v1beta1/types.py index 7d97d0aad..dcdb017e9 100644 --- a/scaleway-async/scaleway_async/function/v1beta1/types.py +++ b/scaleway-async/scaleway_async/function/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Any, Dict, List, Optional @@ -238,7 +238,6 @@ def __str__(self) -> str: @dataclass class SecretHashedValue: key: str - hashed_value: str @@ -264,7 +263,7 @@ class TriggerMnqNatsClientConfig: Currently, only the `fr-par` and `nl-ams` regions are available. """ - mnq_credential_id: Optional[str] + mnq_credential_id: Optional[str] = None """ ID of the Messaging and Queuing credentials used to subscribe to the NATS subject. """ @@ -287,7 +286,7 @@ class TriggerMnqSqsClientConfig: Currently, only the `fr-par` and `nl-ams` regions are available. """ - mnq_credential_id: Optional[str] + mnq_credential_id: Optional[str] = None """ ID of the Messaging and Queuing credentials used to read from the SQS queue. """ @@ -296,19 +295,15 @@ class TriggerMnqSqsClientConfig: @dataclass class TriggerSqsClientConfig: endpoint: str - queue_url: str - access_key: str - secret_key: str @dataclass class Secret: key: str - - value: Optional[str] + value: Optional[str] = None @dataclass @@ -355,11 +350,8 @@ class CreateTriggerRequestMnqSqsClientConfig: @dataclass class CreateTriggerRequestSqsClientConfig: endpoint: str - queue_url: str - access_key: str - secret_key: str @@ -390,7 +382,7 @@ class Cron: Name of the cron. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to pass with the cron. """ @@ -423,7 +415,7 @@ class Domain: State of the doamin. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Error message if the domain is in "error" state. """ @@ -432,23 +424,14 @@ class Domain: @dataclass class Runtime: name: str - language: str - version: str - default_handler: str - code_sample: str - status: RuntimeStatus - status_message: str - extension: str - implementation: str - logo_url: str @@ -524,66 +507,65 @@ class Function: Secret environment variables of the function. """ - timeout: Optional[str] + region: ScwRegion """ - Request processing time limit for the function. + Region in which the function is deployed. """ - error_message: Optional[str] + http_option: FunctionHttpOption """ - Error message if the function is in "error" state. + Possible values: + - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. + - enabled: Serve both HTTP and HTTPS traffic. """ - build_message: Optional[str] + runtime_message: str + sandbox: FunctionSandbox """ - Description of the current build step. + Execution environment of the function. """ - description: Optional[str] + tags: List[str] """ - Description of the function. + List of tags applied to the Serverless Function. """ - region: ScwRegion + timeout: Optional[str] = None """ - Region in which the function is deployed. + Request processing time limit for the function. """ - http_option: FunctionHttpOption + error_message: Optional[str] = None """ - Possible values: - - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. - - enabled: Serve both HTTP and HTTPS traffic. + Error message if the function is in "error" state. """ - runtime_message: str - - sandbox: FunctionSandbox + build_message: Optional[str] = None """ - Execution environment of the function. + Description of the current build step. """ - tags: List[str] + description: Optional[str] = None """ - List of tags applied to the Serverless Function. + Description of the function. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the function. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the function. """ - ready_at: Optional[datetime] + ready_at: Optional[datetime] = None """ Last date when the function was successfully deployed and set to ready. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the function can access other Scaleway resources in this Private Network. """ @@ -626,11 +608,6 @@ class Namespace: UUID of the registry namespace. """ - error_message: Optional[str] - """ - Error message if the namespace is in "error" state. - """ - registry_endpoint: str """ Registry endpoint of the namespace. @@ -651,22 +628,27 @@ class Namespace: List of tags applied to the Serverless Function Namespace. """ - description: Optional[str] + error_message: Optional[str] = None + """ + Error message if the namespace is in "error" state. + """ + + description: Optional[str] = None """ Description of the namespace. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the namespace. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the namespace. """ - vpc_integration_activated: Optional[bool] + vpc_integration_activated: Optional[bool] = False """ When activated, functions in the namespace can be connected to a Private Network. Note that activating the VPC integration can only be done when creating a new namespace. @@ -690,24 +672,24 @@ class Token: Status of the token. """ - public_key: Optional[str] + public_key: Optional[str] = None """ Public key of the token. """ - description: Optional[str] + description: Optional[str] = None """ Description of the token. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Date on which the token expires. """ - function_id: Optional[str] + function_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None @dataclass @@ -742,23 +724,22 @@ class Trigger: Status of the trigger. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Error message of the trigger. """ - scw_sqs_config: Optional[TriggerMnqSqsClientConfig] + scw_sqs_config: Optional[TriggerMnqSqsClientConfig] = None - scw_nats_config: Optional[TriggerMnqNatsClientConfig] + scw_nats_config: Optional[TriggerMnqNatsClientConfig] = None - sqs_config: Optional[TriggerSqsClientConfig] + sqs_config: Optional[TriggerSqsClientConfig] = None @dataclass class UpdateTriggerRequestSqsClientConfig: - access_key: Optional[str] - - secret_key: Optional[str] + access_key: Optional[str] = None + secret_key: Optional[str] = None @dataclass @@ -773,17 +754,17 @@ class CreateCronRequest: Schedule of the cron in UNIX cron format. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to use with the cron. """ - name: Optional[str] + name: Optional[str] = None """ Name of the cron. """ @@ -801,7 +782,7 @@ class CreateDomainRequest: UUID of the function to associate the domain with. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -814,81 +795,80 @@ class CreateFunctionRequest: UUID of the namespace the function will be created in. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the function to create. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the function. """ - min_scale: Optional[int] + min_scale: Optional[int] = 0 """ Minimum number of instances to scale the function to. """ - max_scale: Optional[int] + max_scale: Optional[int] = 0 """ Maximum number of instances to scale the function to. """ - runtime: Optional[FunctionRuntime] + runtime: Optional[FunctionRuntime] = FunctionRuntime.UNKNOWN_RUNTIME """ Runtime to use with the function. """ - memory_limit: Optional[int] + memory_limit: Optional[int] = 0 """ Memory limit of the function in MB. """ - timeout: Optional[str] + timeout: Optional[str] = None """ Request processing time limit for the function. """ - handler: Optional[str] + handler: Optional[str] = None """ Handler to use with the function. """ - privacy: Optional[FunctionPrivacy] + privacy: Optional[FunctionPrivacy] = FunctionPrivacy.UNKNOWN_PRIVACY """ Privacy setting of the function. """ - description: Optional[str] + description: Optional[str] = None """ Description of the function. """ - secret_environment_variables: Optional[List[Secret]] - - http_option: Optional[FunctionHttpOption] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) + http_option: Optional[FunctionHttpOption] = FunctionHttpOption.UNKNOWN_HTTP_OPTION """ Possible values: - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. - enabled: Serve both HTTP and HTTPS traffic. """ - sandbox: Optional[FunctionSandbox] + sandbox: Optional[FunctionSandbox] = FunctionSandbox.UNKNOWN_SANDBOX """ Execution environment of the function. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Function. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the function can access other Scaleway resources in this Private Network. @@ -903,34 +883,33 @@ class CreateNamespaceRequest: When activated, functions in the namespace can be connected to a Private Network. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] - - environment_variables: Optional[Dict[str, str]] + name: Optional[str] = None + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the namespace. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project in which the namespace will be created. """ - description: Optional[str] + description: Optional[str] = None """ Description of the namespace. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the namespace. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Function Namespace. """ @@ -938,24 +917,24 @@ class CreateNamespaceRequest: @dataclass class CreateTokenRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the token. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Date on which the token expires. """ - function_id: Optional[str] + function_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None @dataclass @@ -970,21 +949,21 @@ class CreateTriggerRequest: ID of the function to trigger. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the trigger. """ - scw_sqs_config: Optional[CreateTriggerRequestMnqSqsClientConfig] + scw_sqs_config: Optional[CreateTriggerRequestMnqSqsClientConfig] = None - scw_nats_config: Optional[CreateTriggerRequestMnqNatsClientConfig] + scw_nats_config: Optional[CreateTriggerRequestMnqNatsClientConfig] = None - sqs_config: Optional[CreateTriggerRequestSqsClientConfig] + sqs_config: Optional[CreateTriggerRequestSqsClientConfig] = None @dataclass @@ -994,7 +973,7 @@ class DeleteCronRequest: UUID of the cron to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1007,7 +986,7 @@ class DeleteDomainRequest: UUID of the domain to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1020,7 +999,7 @@ class DeleteFunctionRequest: UUID of the function to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1033,7 +1012,7 @@ class DeleteNamespaceRequest: UUID of the namespace. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1046,7 +1025,7 @@ class DeleteTokenRequest: UUID of the token to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1059,7 +1038,7 @@ class DeleteTriggerRequest: ID of the trigger to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1072,7 +1051,7 @@ class DeployFunctionRequest: UUID of the function to deploy. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1081,7 +1060,6 @@ class DeployFunctionRequest: @dataclass class DownloadURL: url: str - headers: Dict[str, List[str]] @@ -1092,7 +1070,7 @@ class GetCronRequest: UUID of the cron to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1105,7 +1083,7 @@ class GetDomainRequest: UUID of the domain to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1118,7 +1096,7 @@ class GetFunctionDownloadURLRequest: UUID of the function to get the download URL for. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1131,7 +1109,7 @@ class GetFunctionRequest: UUID of the function. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1149,7 +1127,7 @@ class GetFunctionUploadURLRequest: Size of the archive to upload in bytes. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1162,7 +1140,7 @@ class GetNamespaceRequest: UUID of the namespace. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1175,7 +1153,7 @@ class GetTokenRequest: UUID of the token to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1188,7 +1166,7 @@ class GetTriggerRequest: ID of the trigger to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1201,22 +1179,22 @@ class ListCronsRequest: UUID of the function. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of crons per page. """ - order_by: Optional[ListCronsRequestOrderBy] + order_by: Optional[ListCronsRequestOrderBy] = ListCronsRequestOrderBy.CREATED_AT_ASC """ Order of the crons. """ @@ -1242,22 +1220,24 @@ class ListDomainsRequest: UUID of the function the domain is associated with. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of domains per page. """ - order_by: Optional[ListDomainsRequestOrderBy] + order_by: Optional[ListDomainsRequestOrderBy] = ( + ListDomainsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the domains. """ @@ -1278,7 +1258,7 @@ class ListDomainsResponse: @dataclass class ListFunctionRuntimesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1304,37 +1284,39 @@ class ListFunctionsRequest: UUID of the namespace the function belongs to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of functions per page. """ - order_by: Optional[ListFunctionsRequestOrderBy] + order_by: Optional[ListFunctionsRequestOrderBy] = ( + ListFunctionsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the functions. """ - name: Optional[str] + name: Optional[str] = None """ Name of the function. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ UUID of the Organization the function belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project the function belongs to. """ @@ -1355,37 +1337,39 @@ class ListFunctionsResponse: @dataclass class ListNamespacesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of namespaces per page. """ - order_by: Optional[ListNamespacesRequestOrderBy] + order_by: Optional[ListNamespacesRequestOrderBy] = ( + ListNamespacesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the namespaces. """ - name: Optional[str] + name: Optional[str] = None """ Name of the namespace. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ UUID of the Organization the namespace belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project the namespace belongs to. """ @@ -1394,7 +1378,6 @@ class ListNamespacesRequest: @dataclass class ListNamespacesResponse: namespaces: List[Namespace] - total_count: int """ Total number of namespaces. @@ -1403,32 +1386,34 @@ class ListNamespacesResponse: @dataclass class ListTokensRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of tokens per page. """ - order_by: Optional[ListTokensRequestOrderBy] + order_by: Optional[ListTokensRequestOrderBy] = ( + ListTokensRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for the tokens. """ - function_id: Optional[str] + function_id: Optional[str] = None """ UUID of the function the token is associated with. """ - namespace_id: Optional[str] + namespace_id: Optional[str] = None """ UUID of the namespace the token is associated with. """ @@ -1437,37 +1422,38 @@ class ListTokensRequest: @dataclass class ListTokensResponse: tokens: List[Token] - total_count: int @dataclass class ListTriggersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of triggers to return per page. """ - order_by: Optional[ListTriggersRequestOrderBy] + order_by: Optional[ListTriggersRequestOrderBy] = ( + ListTriggersRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - function_id: Optional[str] + function_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -1490,27 +1476,27 @@ class UpdateCronRequest: UUID of the cron to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - function_id: Optional[str] + function_id: Optional[str] = None """ UUID of the function to use the cron with. """ - schedule: Optional[str] + schedule: Optional[str] = None """ Schedule of the cron in UNIX cron format. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to use with the cron. """ - name: Optional[str] + name: Optional[str] = None """ Name of the cron. """ @@ -1523,84 +1509,84 @@ class UpdateFunctionRequest: UUID of the function to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the function to update. """ - min_scale: Optional[int] + min_scale: Optional[int] = 0 """ Minimum number of instances to scale the function to. """ - max_scale: Optional[int] + max_scale: Optional[int] = 0 """ Maximum number of instances to scale the function to. """ - runtime: Optional[FunctionRuntime] + runtime: Optional[FunctionRuntime] = FunctionRuntime.UNKNOWN_RUNTIME """ Runtime to use with the function. """ - memory_limit: Optional[int] + memory_limit: Optional[int] = 0 """ Memory limit of the function in MB. """ - timeout: Optional[str] + timeout: Optional[str] = None """ Processing time limit for the function. """ - redeploy: Optional[bool] + redeploy: Optional[bool] = False """ Redeploy failed function. """ - handler: Optional[str] + handler: Optional[str] = None """ Handler to use with the function. """ - privacy: Optional[FunctionPrivacy] + privacy: Optional[FunctionPrivacy] = FunctionPrivacy.UNKNOWN_PRIVACY """ Privacy setting of the function. """ - description: Optional[str] + description: Optional[str] = None """ Description of the function. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the function. """ - http_option: Optional[FunctionHttpOption] + http_option: Optional[FunctionHttpOption] = FunctionHttpOption.UNKNOWN_HTTP_OPTION """ Possible values: - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. - enabled: Serve both HTTP and HTTPS traffic. """ - sandbox: Optional[FunctionSandbox] + sandbox: Optional[FunctionSandbox] = FunctionSandbox.UNKNOWN_SANDBOX """ Execution environment of the function. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Function. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the function can access other Scaleway resources in this Private Network. @@ -1615,27 +1601,27 @@ class UpdateNamespaceRequest: UUID of the namespapce. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the namespace. """ - description: Optional[str] + description: Optional[str] = None """ Description of the namespace. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the namespace. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Function Namespace. """ @@ -1648,22 +1634,22 @@ class UpdateTriggerRequest: ID of the trigger to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the trigger. """ - description: Optional[str] + description: Optional[str] = None """ Description of the trigger. """ - sqs_config: Optional[UpdateTriggerRequestSqsClientConfig] + sqs_config: Optional[UpdateTriggerRequestSqsClientConfig] = None @dataclass diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py index 1ae7efd46..2010e2740 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py @@ -10,6 +10,15 @@ resolve_one_of, ) from .types import ( + GracePeriodType, + LocalityType, + LogAction, + LogResourceType, + PermissionSetScopeType, + SamlCertificateOrigin, + SamlCertificateType, + UserStatus, + UserType, JWT, APIKey, Application, @@ -93,22 +102,32 @@ def unmarshal_JWT(data: Any) -> JWT: field = data.get("jti", None) if field is not None: args["jti"] = field + else: + args["jti"] = None field = data.get("issuer_id", None) if field is not None: args["issuer_id"] = field + else: + args["issuer_id"] = None field = data.get("audience_id", None) if field is not None: args["audience_id"] = field + else: + args["audience_id"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("user_agent", None) if field is not None: args["user_agent"] = field + else: + args["user_agent"] = None field = data.get("created_at", None) if field is not None: @@ -142,14 +161,20 @@ def unmarshal_APIKey(data: Any) -> APIKey: field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("default_project_id", None) if field is not None: args["default_project_id"] = field + else: + args["default_project_id"] = None field = data.get("secret_key", None) if field is not None: @@ -166,18 +191,26 @@ def unmarshal_APIKey(data: Any) -> APIKey: field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = False field = data.get("deletable", None) if field is not None: args["deletable"] = field + else: + args["deletable"] = False field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("creation_ip", None) if field is not None: args["creation_ip"] = field + else: + args["creation_ip"] = None field = data.get("user_id", None) if field is not None: @@ -217,38 +250,56 @@ def unmarshal_Application(data: Any) -> Application: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = False field = data.get("deletable", None) if field is not None: args["deletable"] = field + else: + args["deletable"] = False field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("nb_api_keys", None) if field is not None: args["nb_api_keys"] = field + else: + args["nb_api_keys"] = 0 field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -276,42 +327,62 @@ def unmarshal_Group(data: Any) -> Group: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("user_ids", None) if field is not None: args["user_ids"] = field + else: + args["user_ids"] = field(default_factory=list) field = data.get("application_ids", None) if field is not None: args["application_ids"] = field + else: + args["application_ids"] = field(default_factory=list) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = False field = data.get("deletable", None) if field is not None: args["deletable"] = field + else: + args["deletable"] = False field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("created_at", None) if field is not None: @@ -339,34 +410,50 @@ def unmarshal_Log(data: Any) -> Log: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("user_agent", None) if field is not None: args["user_agent"] = field + else: + args["user_agent"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = LogAction.UNKNOWN_ACTION field = data.get("bearer_id", None) if field is not None: args["bearer_id"] = field + else: + args["bearer_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("resource_type", None) if field is not None: args["resource_type"] = field + else: + args["resource_type"] = LogResourceType.UNKNOWN_RESOURCE_TYPE field = data.get("resource_id", None) if field is not None: args["resource_id"] = field + else: + args["resource_id"] = None field = data.get("created_at", None) if field is not None: @@ -388,42 +475,62 @@ def unmarshal_Policy(data: Any) -> Policy: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = False field = data.get("deletable", None) if field is not None: args["deletable"] = field + else: + args["deletable"] = False field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("nb_rules", None) if field is not None: args["nb_rules"] = field + else: + args["nb_rules"] = 0 field = data.get("nb_scopes", None) if field is not None: args["nb_scopes"] = field + else: + args["nb_scopes"] = 0 field = data.get("nb_permission_sets", None) if field is not None: args["nb_permission_sets"] = field + else: + args["nb_permission_sets"] = 0 field = data.get("created_at", None) if field is not None: @@ -440,6 +547,8 @@ def unmarshal_Policy(data: Any) -> Policy: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("user_id", None) if field is not None: @@ -463,7 +572,7 @@ def unmarshal_Policy(data: Any) -> Policy: if field is not None: args["no_principal"] = field else: - args["no_principal"] = None + args["no_principal"] = False return Policy(**args) @@ -480,7 +589,7 @@ def unmarshal_QuotumLimit(data: Any) -> QuotumLimit: if field is not None: args["global_"] = field else: - args["global_"] = None + args["global_"] = False field = data.get("region", None) if field is not None: @@ -498,13 +607,13 @@ def unmarshal_QuotumLimit(data: Any) -> QuotumLimit: if field is not None: args["limit"] = field else: - args["limit"] = None + args["limit"] = 0 field = data.get("unlimited", None) if field is not None: args["unlimited"] = field else: - args["unlimited"] = None + args["unlimited"] = False return QuotumLimit(**args) @@ -520,40 +629,52 @@ def unmarshal_Quotum(data: Any) -> Quotum: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("pretty_name", None) if field is not None: args["pretty_name"] = field + else: + args["pretty_name"] = None field = data.get("unit", None) if field is not None: args["unit"] = field + else: + args["unit"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("locality_type", None) if field is not None: args["locality_type"] = field + else: + args["locality_type"] = LocalityType.GLOBAL field = data.get("limits", None) if field is not None: args["limits"] = ( [unmarshal_QuotumLimit(v) for v in field] if field is not None else None ) + else: + args["limits"] = field(default_factory=list) field = data.get("limit", None) if field is not None: args["limit"] = field else: - args["limit"] = None + args["limit"] = 0 field = data.get("unlimited", None) if field is not None: args["unlimited"] = field else: - args["unlimited"] = None + args["unlimited"] = False return Quotum(**args) @@ -569,30 +690,44 @@ def unmarshal_SSHKey(data: Any) -> SSHKey: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("public_key", None) if field is not None: args["public_key"] = field + else: + args["public_key"] = None field = data.get("fingerprint", None) if field is not None: args["fingerprint"] = field + else: + args["fingerprint"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("created_at", None) if field is not None: @@ -620,18 +755,26 @@ def unmarshal_SamlCertificate(data: Any) -> SamlCertificate: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = SamlCertificateType.UNKNOWN_CERTIFICATE_TYPE field = data.get("origin", None) if field is not None: args["origin"] = field + else: + args["origin"] = SamlCertificateOrigin.UNKNOWN_CERTIFICATE_ORIGIN field = data.get("content", None) if field is not None: args["content"] = field + else: + args["content"] = None field = data.get("expires_at", None) if field is not None: @@ -653,38 +796,56 @@ def unmarshal_User(data: Any) -> User: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("email", None) if field is not None: args["email"] = field + else: + args["email"] = None field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("first_name", None) if field is not None: args["first_name"] = field + else: + args["first_name"] = None field = data.get("last_name", None) if field is not None: args["last_name"] = field + else: + args["last_name"] = None field = data.get("phone_number", None) if field is not None: args["phone_number"] = field + else: + args["phone_number"] = None field = data.get("locale", None) if field is not None: args["locale"] = field + else: + args["locale"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("deletable", None) if field is not None: args["deletable"] = field + else: + args["deletable"] = False field = data.get("created_at", None) if field is not None: @@ -709,34 +870,44 @@ def unmarshal_User(data: Any) -> User: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = UserType.UNKNOWN_TYPE field = data.get("mfa", None) if field is not None: args["mfa"] = field + else: + args["mfa"] = False field = data.get("account_root_user_id", None) if field is not None: args["account_root_user_id"] = field + else: + args["account_root_user_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("locked", None) if field is not None: args["locked"] = field + else: + args["locked"] = False field = data.get("two_factor_enabled", None) if field is not None: args["two_factor_enabled"] = field else: - args["two_factor_enabled"] = None + args["two_factor_enabled"] = False field = data.get("status", None) if field is not None: args["status"] = field else: - args["status"] = None + args["status"] = UserStatus.UNKNOWN_STATUS return User(**args) @@ -752,10 +923,14 @@ def unmarshal_EncodedJWT(data: Any) -> EncodedJWT: field = data.get("token", None) if field is not None: args["token"] = field + else: + args["token"] = None field = data.get("renew_token", None) if field is not None: args["renew_token"] = field + else: + args["renew_token"] = None field = data.get("jwt", None) if field is not None: @@ -779,14 +954,20 @@ def unmarshal_ConnectionConnectedOrganization( field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("locked", None) if field is not None: args["locked"] = field + else: + args["locked"] = None return ConnectionConnectedOrganization(**args) @@ -802,14 +983,20 @@ def unmarshal_ConnectionConnectedUser(data: Any) -> ConnectionConnectedUser: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return ConnectionConnectedUser(**args) @@ -850,6 +1037,8 @@ def unmarshal_GetUserConnectionsResponse(data: Any) -> GetUserConnectionsRespons args["connections"] = ( [unmarshal_Connection(v) for v in field] if field is not None else None ) + else: + args["connections"] = field(default_factory=list) return GetUserConnectionsResponse(**args) @@ -867,6 +1056,8 @@ def unmarshal_InitiateUserConnectionResponse( field = data.get("token", None) if field is not None: args["token"] = field + else: + args["token"] = None return InitiateUserConnectionResponse(**args) @@ -884,10 +1075,14 @@ def unmarshal_ListAPIKeysResponse(data: Any) -> ListAPIKeysResponse: args["api_keys"] = ( [unmarshal_APIKey(v) for v in field] if field is not None else None ) + else: + args["api_keys"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListAPIKeysResponse(**args) @@ -905,10 +1100,14 @@ def unmarshal_ListApplicationsResponse(data: Any) -> ListApplicationsResponse: args["applications"] = ( [unmarshal_Application(v) for v in field] if field is not None else None ) + else: + args["applications"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListApplicationsResponse(**args) @@ -924,6 +1123,8 @@ def unmarshal_GracePeriod(data: Any) -> GracePeriod: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = GracePeriodType.UNKNOWN_GRACE_PERIOD_TYPE field = data.get("created_at", None) if field is not None: @@ -953,6 +1154,8 @@ def unmarshal_ListGracePeriodsResponse(data: Any) -> ListGracePeriodsResponse: args["grace_periods"] = ( [unmarshal_GracePeriod(v) for v in field] if field is not None else None ) + else: + args["grace_periods"] = field(default_factory=list) return ListGracePeriodsResponse(**args) @@ -970,10 +1173,14 @@ def unmarshal_ListGroupsResponse(data: Any) -> ListGroupsResponse: args["groups"] = ( [unmarshal_Group(v) for v in field] if field is not None else None ) + else: + args["groups"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListGroupsResponse(**args) @@ -989,10 +1196,14 @@ def unmarshal_ListJWTsResponse(data: Any) -> ListJWTsResponse: field = data.get("jwts", None) if field is not None: args["jwts"] = [unmarshal_JWT(v) for v in field] if field is not None else None + else: + args["jwts"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListJWTsResponse(**args) @@ -1008,10 +1219,14 @@ def unmarshal_ListLogsResponse(data: Any) -> ListLogsResponse: field = data.get("logs", None) if field is not None: args["logs"] = [unmarshal_Log(v) for v in field] if field is not None else None + else: + args["logs"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListLogsResponse(**args) @@ -1027,24 +1242,32 @@ def unmarshal_PermissionSet(data: Any) -> PermissionSet: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("scope_type", None) if field is not None: args["scope_type"] = field + else: + args["scope_type"] = PermissionSetScopeType.UNKNOWN_SCOPE_TYPE field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("categories", None) if field is not None: args["categories"] = field else: - args["categories"] = None + args["categories"] = field(default_factory=list) return PermissionSet(**args) @@ -1062,10 +1285,14 @@ def unmarshal_ListPermissionSetsResponse(data: Any) -> ListPermissionSetsRespons args["permission_sets"] = ( [unmarshal_PermissionSet(v) for v in field] if field is not None else None ) + else: + args["permission_sets"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPermissionSetsResponse(**args) @@ -1083,10 +1310,14 @@ def unmarshal_ListPoliciesResponse(data: Any) -> ListPoliciesResponse: args["policies"] = ( [unmarshal_Policy(v) for v in field] if field is not None else None ) + else: + args["policies"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPoliciesResponse(**args) @@ -1104,10 +1335,14 @@ def unmarshal_ListQuotaResponse(data: Any) -> ListQuotaResponse: args["quota"] = ( [unmarshal_Quotum(v) for v in field] if field is not None else None ) + else: + args["quota"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListQuotaResponse(**args) @@ -1123,26 +1358,32 @@ def unmarshal_Rule(data: Any) -> Rule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("permission_sets_scope_type", None) if field is not None: args["permission_sets_scope_type"] = field + else: + args["permission_sets_scope_type"] = PermissionSetScopeType.UNKNOWN_SCOPE_TYPE field = data.get("condition", None) if field is not None: args["condition"] = field + else: + args["condition"] = None field = data.get("permission_set_names", None) if field is not None: args["permission_set_names"] = field else: - args["permission_set_names"] = None + args["permission_set_names"] = field(default_factory=list) field = data.get("project_ids", None) if field is not None: args["project_ids"] = field else: - args["project_ids"] = None + args["project_ids"] = field(default_factory=list) field = data.get("organization_id", None) if field is not None: @@ -1172,10 +1413,14 @@ def unmarshal_ListRulesResponse(data: Any) -> ListRulesResponse: args["rules"] = ( [unmarshal_Rule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListRulesResponse(**args) @@ -1193,10 +1438,14 @@ def unmarshal_ListSSHKeysResponse(data: Any) -> ListSSHKeysResponse: args["ssh_keys"] = ( [unmarshal_SSHKey(v) for v in field] if field is not None else None ) + else: + args["ssh_keys"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSSHKeysResponse(**args) @@ -1214,6 +1463,8 @@ def unmarshal_ListSamlCertificatesResponse(data: Any) -> ListSamlCertificatesRes args["certificates"] = ( [unmarshal_SamlCertificate(v) for v in field] if field is not None else None ) + else: + args["certificates"] = field(default_factory=list) return ListSamlCertificatesResponse(**args) @@ -1231,10 +1482,14 @@ def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse: args["users"] = ( [unmarshal_User(v) for v in field] if field is not None else None ) + else: + args["users"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListUsersResponse(**args) @@ -1250,6 +1505,8 @@ def unmarshal_MFAOTP(data: Any) -> MFAOTP: field = data.get("secret", None) if field is not None: args["secret"] = field + else: + args["secret"] = None return MFAOTP(**args) @@ -1265,14 +1522,20 @@ def unmarshal_Organization(data: Any) -> Organization: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("alias", None) if field is not None: args["alias"] = field + else: + args["alias"] = None return Organization(**args) @@ -1288,10 +1551,14 @@ def unmarshal_OrganizationSecuritySettings(data: Any) -> OrganizationSecuritySet field = data.get("enforce_password_renewal", None) if field is not None: args["enforce_password_renewal"] = field + else: + args["enforce_password_renewal"] = False field = data.get("login_attempts_before_locked", None) if field is not None: args["login_attempts_before_locked"] = field + else: + args["login_attempts_before_locked"] = 0 field = data.get("grace_period_duration", None) if field is not None: @@ -1313,14 +1580,20 @@ def unmarshal_Saml(data: Any) -> Saml: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("entity_id", None) if field is not None: args["entity_id"] = field + else: + args["entity_id"] = None field = data.get("single_sign_on_url", None) if field is not None: args["single_sign_on_url"] = field + else: + args["single_sign_on_url"] = None return Saml(**args) @@ -1338,6 +1611,8 @@ def unmarshal_SetRulesResponse(data: Any) -> SetRulesResponse: args["rules"] = ( [unmarshal_Rule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return SetRulesResponse(**args) @@ -1353,6 +1628,8 @@ def unmarshal_ValidateUserMFAOTPResponse(data: Any) -> ValidateUserMFAOTPRespons field = data.get("recovery_codes", None) if field is not None: args["recovery_codes"] = field + else: + args["recovery_codes"] = field(default_factory=list) return ValidateUserMFAOTPResponse(**args) @@ -1402,7 +1679,7 @@ def marshal_AddSamlCertificateRequest( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.content is not None: output["content"] = request.content @@ -1455,9 +1732,9 @@ def marshal_CreateApplicationRequest( output["name"] = request.name if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id if request.tags is not None: output["tags"] = request.tags @@ -1475,9 +1752,9 @@ def marshal_CreateGroupRequest( output["description"] = request.description if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id if request.name is not None: output["name"] = request.name @@ -1581,9 +1858,9 @@ def marshal_CreatePolicyRequest( output["name"] = request.name if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id if request.rules is not None: output["rules"] = [marshal_RuleSpecs(item, defaults) for item in request.rules] @@ -1607,7 +1884,9 @@ def marshal_CreateSSHKeyRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1667,9 +1946,9 @@ def marshal_CreateUserRequest( ) if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/types.py b/scaleway-async/scaleway_async/iam/v1alpha1/types.py index 1708bdffc..2d3746817 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -227,32 +227,28 @@ def __str__(self) -> str: @dataclass class ConnectionConnectedOrganization: id: str - name: str - locked: bool @dataclass class ConnectionConnectedUser: id: str - username: str - type_: UserType @dataclass class QuotumLimit: - global_: Optional[bool] + global_: Optional[bool] = False - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None - limit: Optional[int] + limit: Optional[int] = 0 - unlimited: Optional[bool] + unlimited: Optional[bool] = False @dataclass @@ -282,17 +278,17 @@ class JWT: User-agent used during the creation of the JWT. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the JWT. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the JWT. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the JWT. """ @@ -305,14 +301,14 @@ class RuleSpecs: Condition expression to evaluate. """ - permission_set_names: Optional[List[str]] + permission_set_names: Optional[List[str]] = field(default_factory=list) """ Names of permission sets bound to the rule. """ - project_ids: Optional[List[str]] + project_ids: Optional[List[str]] = field(default_factory=list) - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -365,12 +361,12 @@ class CreateUserRequestMember: @dataclass class Connection: - organization: Optional[ConnectionConnectedOrganization] + organization: Optional[ConnectionConnectedOrganization] = None """ Information about the connected organization. """ - user: Optional[ConnectionConnectedUser] + user: Optional[ConnectionConnectedUser] = None """ Information about the connected user. """ @@ -413,29 +409,29 @@ class APIKey: IP address of the device that created the API key. """ - secret_key: Optional[str] + secret_key: Optional[str] = None """ Secret key of the API Key. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of API key creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last API key update. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Date and time of API key expiration. """ - application_id: Optional[str] + application_id: Optional[str] = None - user_id: Optional[str] + user_id: Optional[str] = None @dataclass @@ -485,12 +481,12 @@ class Application: Tags associated with the user. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time application was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last application update. """ @@ -503,12 +499,12 @@ class GracePeriod: Type of grace period. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time the grace period was created. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Date and time the grace period expires. """ @@ -566,12 +562,12 @@ class Group: Defines whether or not the group is managed. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of group creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last group update. """ @@ -619,7 +615,7 @@ class Log: ID of the resource linked to the log. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the log. """ @@ -647,7 +643,7 @@ class PermissionSet: Description of the permission set. """ - categories: Optional[List[str]] + categories: Optional[List[str]] = field(default_factory=list) """ Categories of the permission set. """ @@ -675,16 +671,6 @@ class Policy: Organization ID of the policy. """ - created_at: Optional[datetime] - """ - Date and time of policy creation. - """ - - updated_at: Optional[datetime] - """ - Date and time of last policy update. - """ - editable: bool """ Defines whether or not a policy is editable. @@ -720,13 +706,23 @@ class Policy: Tags associated with the policy. """ - user_id: Optional[str] + created_at: Optional[datetime] = None + """ + Date and time of policy creation. + """ + + updated_at: Optional[datetime] = None + """ + Date and time of last policy update. + """ + + user_id: Optional[str] = None - group_id: Optional[str] + group_id: Optional[str] = None - application_id: Optional[str] + application_id: Optional[str] = None - no_principal: Optional[bool] + no_principal: Optional[bool] = False @dataclass @@ -761,9 +757,9 @@ class Quotum: Limits per locality. """ - limit: Optional[int] + limit: Optional[int] = 0 - unlimited: Optional[bool] + unlimited: Optional[bool] = False @dataclass @@ -783,16 +779,16 @@ class Rule: Condition expression to evaluate. """ - permission_set_names: Optional[List[str]] + permission_set_names: Optional[List[str]] = field(default_factory=list) """ Names of permission sets bound to the rule. """ - project_ids: Optional[List[str]] + project_ids: Optional[List[str]] = field(default_factory=list) - organization_id: Optional[str] + organization_id: Optional[str] = None - account_root_user_id: Optional[str] + account_root_user_id: Optional[str] = None @dataclass @@ -832,12 +828,12 @@ class SSHKey: SSH key status. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of SSH key. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of SSH key. """ @@ -865,7 +861,7 @@ class SamlCertificate: Content of the SAML certificate. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Date and time of the SAML certificate expiration. """ @@ -918,21 +914,6 @@ class User: Deletion status of user. Owners cannot be deleted. """ - created_at: Optional[datetime] - """ - Date user was created. - """ - - updated_at: Optional[datetime] - """ - Date of last user update. - """ - - last_login_at: Optional[datetime] - """ - Date of the last login. - """ - type_: UserType """ Type of user. @@ -958,12 +939,27 @@ class User: Defines whether the user is locked. """ - two_factor_enabled: Optional[bool] + created_at: Optional[datetime] = None + """ + Date user was created. + """ + + updated_at: Optional[datetime] = None + """ + Date of last user update. + """ + + last_login_at: Optional[datetime] = None + """ + Date of the last login. + """ + + two_factor_enabled: Optional[bool] = False """ Deprecated, use "mfa" instead. """ - status: Optional[UserStatus] + status: Optional[UserStatus] = UserStatus.UNKNOWN_STATUS """ Status of user invitation. """ @@ -976,9 +972,9 @@ class AddGroupMemberRequest: ID of the group. """ - user_id: Optional[str] + user_id: Optional[str] = None - application_id: Optional[str] + application_id: Optional[str] = None @dataclass @@ -988,12 +984,12 @@ class AddGroupMembersRequest: ID of the group. """ - user_ids: Optional[List[str]] + user_ids: Optional[List[str]] = field(default_factory=list) """ IDs of the users to add. """ - application_ids: Optional[List[str]] + application_ids: Optional[List[str]] = field(default_factory=list) """ IDs of the applications to add. """ @@ -1029,19 +1025,19 @@ class CreateAPIKeyRequest: Description of the API key (max length is 200 characters). """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the API key. """ - default_project_id: Optional[str] + default_project_id: Optional[str] = None """ Default Project ID to use with Object Storage. """ - application_id: Optional[str] + application_id: Optional[str] = None - user_id: Optional[str] + user_id: Optional[str] = None @dataclass @@ -1051,17 +1047,17 @@ class CreateApplicationRequest: Description of the application (max length is 200 characters). """ - name: Optional[str] + name: Optional[str] = None """ Name of the application to create (max length is 64 characters). """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the application (maximum of 10 tags). """ @@ -1074,17 +1070,17 @@ class CreateGroupRequest: Description of the group to create (max length is 200 chars). """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of Organization linked to the group. """ - name: Optional[str] + name: Optional[str] = None """ Name of the group to create (max length is 64 chars). MUST be unique inside an Organization. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the group (maximum of 10 tags). """ @@ -1115,7 +1111,7 @@ class CreateOrganizationSamlRequest: Single Sign-On URL of the SAML Identity Provider. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1128,33 +1124,33 @@ class CreatePolicyRequest: Description of the policy to create (max length is 200 characters). """ - name: Optional[str] + name: Optional[str] = None """ Name of the policy to create (max length is 64 characters). """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ - rules: Optional[List[RuleSpecs]] + rules: Optional[List[RuleSpecs]] = field(default_factory=list) """ Rules of the policy to create. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the policy (maximum of 10 tags). """ - user_id: Optional[str] + user_id: Optional[str] = None - group_id: Optional[str] + group_id: Optional[str] = None - application_id: Optional[str] + application_id: Optional[str] = None - no_principal: Optional[bool] + no_principal: Optional[bool] = False @dataclass @@ -1164,12 +1160,12 @@ class CreateSSHKeyRequest: SSH public key. Currently only the ssh-rsa, ssh-dss (DSA), ssh-ed25519 and ecdsa keys with NIST curves are supported. Max length is 65000. """ - name: Optional[str] + name: Optional[str] = None """ Name of the SSH key. Max length is 1000. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project the resource is attributed to. """ @@ -1185,19 +1181,19 @@ class CreateUserMFAOTPRequest: @dataclass class CreateUserRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the user. """ - email: Optional[str] + email: Optional[str] = None - member: Optional[CreateUserRequestMember] + member: Optional[CreateUserRequestMember] = None @dataclass @@ -1234,7 +1230,7 @@ class DeleteJWTRequest: @dataclass class DeleteOrganizationSamlRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1289,7 +1285,7 @@ class EncodedJWT: The encoded renew token. This token is necessary to renew the JWT. """ - jwt: Optional[JWT] + jwt: Optional[JWT] = None """ The renewed JWT. """ @@ -1337,7 +1333,7 @@ class GetLogRequest: @dataclass class GetOrganizationRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1345,7 +1341,7 @@ class GetOrganizationRequest: @dataclass class GetOrganizationSamlRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1353,7 +1349,7 @@ class GetOrganizationSamlRequest: @dataclass class GetOrganizationSecuritySettingsRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1374,7 +1370,7 @@ class GetQuotumRequest: Name of the quota to get. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1443,64 +1439,66 @@ class JoinUserConnectionRequest: @dataclass class ListAPIKeysRequest: - order_by: Optional[ListAPIKeysRequestOrderBy] + order_by: Optional[ListAPIKeysRequestOrderBy] = ( + ListAPIKeysRequestOrderBy.CREATED_AT_ASC + ) """ Criteria for sorting results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of Organization. """ - editable: Optional[bool] + editable: Optional[bool] = False """ Defines whether to filter out editable API keys or not. """ - expired: Optional[bool] + expired: Optional[bool] = False """ Defines whether to filter out expired API keys or not. """ - access_key: Optional[str] + access_key: Optional[str] = None """ Filter by access key (deprecated in favor of `access_keys`). """ - description: Optional[str] + description: Optional[str] = None """ Filter by description. """ - bearer_id: Optional[str] + bearer_id: Optional[str] = None """ Filter by bearer ID. """ - bearer_type: Optional[BearerType] + bearer_type: Optional[BearerType] = BearerType.UNKNOWN_BEARER_TYPE """ Filter by type of bearer. """ - access_keys: Optional[List[str]] + access_keys: Optional[List[str]] = field(default_factory=list) """ Filter by a list of access keys. """ - application_id: Optional[str] + application_id: Optional[str] = None - user_id: Optional[str] + user_id: Optional[str] = None @dataclass @@ -1518,42 +1516,44 @@ class ListAPIKeysResponse: @dataclass class ListApplicationsRequest: - order_by: Optional[ListApplicationsRequestOrderBy] + order_by: Optional[ListApplicationsRequestOrderBy] = ( + ListApplicationsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater than 1. """ - name: Optional[str] + name: Optional[str] = None """ Name of the application to filter. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization to filter. """ - editable: Optional[bool] + editable: Optional[bool] = False """ Defines whether to filter out editable applications or not. """ - application_ids: Optional[List[str]] + application_ids: Optional[List[str]] = field(default_factory=list) """ Filter by list of IDs. """ - tag: Optional[str] + tag: Optional[str] = None """ Filter by tags containing a given string. """ @@ -1574,7 +1574,7 @@ class ListApplicationsResponse: @dataclass class ListGracePeriodsRequest: - user_id: Optional[str] + user_id: Optional[str] = None """ ID of the user to list grace periods for. """ @@ -1590,47 +1590,49 @@ class ListGracePeriodsResponse: @dataclass class ListGroupsRequest: - order_by: Optional[ListGroupsRequestOrderBy] + order_by: Optional[ListGroupsRequestOrderBy] = ( + ListGroupsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of groups. """ - page: Optional[int] + page: Optional[int] = 0 """ Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of items per page. Value must be between 1 and 100. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - name: Optional[str] + name: Optional[str] = None """ Name of group to find. """ - application_ids: Optional[List[str]] + application_ids: Optional[List[str]] = field(default_factory=list) """ Filter by a list of application IDs. """ - user_ids: Optional[List[str]] + user_ids: Optional[List[str]] = field(default_factory=list) """ Filter by a list of user IDs. """ - group_ids: Optional[List[str]] + group_ids: Optional[List[str]] = field(default_factory=list) """ Filter by a list of group IDs. """ - tag: Optional[str] + tag: Optional[str] = None """ Filter by tags containing a given string. """ @@ -1656,22 +1658,22 @@ class ListJWTsRequest: ID of the user to search. """ - order_by: Optional[ListJWTsRequestOrderBy] + order_by: Optional[ListJWTsRequestOrderBy] = ListJWTsRequestOrderBy.CREATED_AT_ASC """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater to 1. """ - expired: Optional[bool] + expired: Optional[bool] = False """ Filter out expired JWTs or not. """ @@ -1680,53 +1682,52 @@ class ListJWTsRequest: @dataclass class ListJWTsResponse: jwts: List[JWT] - total_count: int @dataclass class ListLogsRequest: - order_by: Optional[ListLogsRequestOrderBy] + order_by: Optional[ListLogsRequestOrderBy] = ListLogsRequestOrderBy.CREATED_AT_ASC """ Criteria for sorting results. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater to 1. """ - created_after: Optional[datetime] + created_after: Optional[datetime] = None """ Defined whether or not to filter out logs created after this timestamp. """ - created_before: Optional[datetime] + created_before: Optional[datetime] = None """ Defined whether or not to filter out logs created before this timestamp. """ - action: Optional[LogAction] + action: Optional[LogAction] = LogAction.UNKNOWN_ACTION """ Defined whether or not to filter out by a specific action. """ - resource_type: Optional[LogResourceType] + resource_type: Optional[LogResourceType] = LogResourceType.UNKNOWN_RESOURCE_TYPE """ Defined whether or not to filter out by a specific type of resource. """ - search: Optional[str] + search: Optional[str] = None """ Defined whether or not to filter out log by bearer ID or resource ID. """ @@ -1747,22 +1748,24 @@ class ListLogsResponse: @dataclass class ListPermissionSetsRequest: - order_by: Optional[ListPermissionSetsRequestOrderBy] + order_by: Optional[ListPermissionSetsRequestOrderBy] = ( + ListPermissionSetsRequestOrderBy.NAME_ASC + ) """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater than 1. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ @@ -1783,62 +1786,64 @@ class ListPermissionSetsResponse: @dataclass class ListPoliciesRequest: - order_by: Optional[ListPoliciesRequestOrderBy] + order_by: Optional[ListPoliciesRequestOrderBy] = ( + ListPoliciesRequestOrderBy.POLICY_NAME_ASC + ) """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater than 1. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization to filter. """ - editable: Optional[bool] + editable: Optional[bool] = False """ Defines whether or not filter out editable policies. """ - user_ids: Optional[List[str]] + user_ids: Optional[List[str]] = field(default_factory=list) """ Defines whether or not to filter by list of user IDs. """ - group_ids: Optional[List[str]] + group_ids: Optional[List[str]] = field(default_factory=list) """ Defines whether or not to filter by list of group IDs. """ - application_ids: Optional[List[str]] + application_ids: Optional[List[str]] = field(default_factory=list) """ Filter by a list of application IDs. """ - no_principal: Optional[bool] + no_principal: Optional[bool] = False """ Defines whether or not the policy is attributed to a principal. """ - policy_name: Optional[str] + policy_name: Optional[str] = None """ Name of the policy to fetch. """ - tag: Optional[str] + tag: Optional[str] = None """ Filter by tags containing a given string. """ - policy_ids: Optional[List[str]] + policy_ids: Optional[List[str]] = field(default_factory=list) """ Filter by a list of IDs. """ @@ -1859,27 +1864,27 @@ class ListPoliciesResponse: @dataclass class ListQuotaRequest: - order_by: Optional[ListQuotaRequestOrderBy] + order_by: Optional[ListQuotaRequestOrderBy] = ListQuotaRequestOrderBy.NAME_ASC """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater than 1. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - quotum_names: Optional[List[str]] + quotum_names: Optional[List[str]] = field(default_factory=list) """ List of quotum names to filter from. """ @@ -1905,12 +1910,12 @@ class ListRulesRequest: Id of policy to search. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater than 1. """ @@ -1931,37 +1936,39 @@ class ListRulesResponse: @dataclass class ListSSHKeysRequest: - order_by: Optional[ListSSHKeysRequestOrderBy] + order_by: Optional[ListSSHKeysRequestOrderBy] = ( + ListSSHKeysRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the SSH keys. """ - page: Optional[int] + page: Optional[int] = 0 """ Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of items per page. Value must be between 1 and 100. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - name: Optional[str] + name: Optional[str] = None """ Name of group to find. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - disabled: Optional[bool] + disabled: Optional[bool] = False """ Defines whether to include disabled SSH keys or not. """ @@ -1998,42 +2005,42 @@ class ListSamlCertificatesResponse: @dataclass class ListUsersRequest: - order_by: Optional[ListUsersRequestOrderBy] + order_by: Optional[ListUsersRequestOrderBy] = ListUsersRequestOrderBy.CREATED_AT_ASC """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater or equal to 1. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization to filter. """ - user_ids: Optional[List[str]] + user_ids: Optional[List[str]] = field(default_factory=list) """ Filter by list of IDs. """ - mfa: Optional[bool] + mfa: Optional[bool] = False """ Filter by MFA status. """ - tag: Optional[str] + tag: Optional[str] = None """ Filter by tags containing a given string. """ - type_: Optional[UserType] + type_: Optional[UserType] = UserType.UNKNOWN_TYPE """ Filter by user type. """ @@ -2067,7 +2074,7 @@ class MFAOTP: @dataclass class MigrateOrganizationGuestsRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -2103,7 +2110,7 @@ class OrganizationSecuritySettings: Number of login attempts before the account is locked. """ - grace_period_duration: Optional[str] + grace_period_duration: Optional[str] = None """ Duration of the grace period to renew password or enable MFA. """ @@ -2116,9 +2123,9 @@ class RemoveGroupMemberRequest: ID of the group. """ - user_id: Optional[str] + user_id: Optional[str] = None - application_id: Optional[str] + application_id: Optional[str] = None @dataclass @@ -2155,9 +2162,7 @@ class Saml: @dataclass class SetGroupMembersRequest: group_id: str - user_ids: List[str] - application_ids: List[str] @@ -2168,7 +2173,7 @@ class SetOrganizationAliasRequest: Alias of the Organization. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -2210,12 +2215,12 @@ class UpdateAPIKeyRequest: Access key to update. """ - default_project_id: Optional[str] + default_project_id: Optional[str] = None """ New default Project ID to set. """ - description: Optional[str] + description: Optional[str] = None """ New description to update. """ @@ -2228,17 +2233,17 @@ class UpdateApplicationRequest: ID of the application to update. """ - name: Optional[str] + name: Optional[str] = None """ New name for the application (max length is 64 chars). """ - description: Optional[str] + description: Optional[str] = None """ New description for the application (max length is 200 chars). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags for the application (maximum of 10 tags). """ @@ -2251,17 +2256,17 @@ class UpdateGroupRequest: ID of the group to update. """ - name: Optional[str] + name: Optional[str] = None """ New name for the group (max length is 64 chars). MUST be unique inside an Organization. """ - description: Optional[str] + description: Optional[str] = None """ New description for the group (max length is 200 chars). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags for the group (maximum of 10 tags). """ @@ -2269,17 +2274,17 @@ class UpdateGroupRequest: @dataclass class UpdateOrganizationSamlRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ - entity_id: Optional[str] + entity_id: Optional[str] = None """ Entity ID of the SAML Identity Provider. """ - single_sign_on_url: Optional[str] + single_sign_on_url: Optional[str] = None """ Single Sign-On URL of the SAML Identity Provider. """ @@ -2287,22 +2292,22 @@ class UpdateOrganizationSamlRequest: @dataclass class UpdateOrganizationSecuritySettingsRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ - enforce_password_renewal: Optional[bool] + enforce_password_renewal: Optional[bool] = False """ Defines whether password renewal is enforced during first login. """ - grace_period_duration: Optional[str] + grace_period_duration: Optional[str] = None """ Duration of the grace period to renew password or enable MFA. """ - login_attempts_before_locked: Optional[int] + login_attempts_before_locked: Optional[int] = 0 """ Number of login attempts before the account is locked. """ @@ -2315,40 +2320,39 @@ class UpdatePolicyRequest: Id of policy to update. """ - name: Optional[str] + name: Optional[str] = None """ New name for the policy (max length is 64 characters). """ - description: Optional[str] + description: Optional[str] = None """ New description of policy (max length is 200 characters). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags for the policy (maximum of 10 tags). """ - user_id: Optional[str] + user_id: Optional[str] = None - group_id: Optional[str] + group_id: Optional[str] = None - application_id: Optional[str] + application_id: Optional[str] = None - no_principal: Optional[bool] + no_principal: Optional[bool] = False @dataclass class UpdateSSHKeyRequest: ssh_key_id: str - - name: Optional[str] + name: Optional[str] = None """ Name of the SSH key. Max length is 1000. """ - disabled: Optional[bool] + disabled: Optional[bool] = False """ Enable or disable the SSH key. """ @@ -2374,32 +2378,32 @@ class UpdateUserRequest: ID of the user to update. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags for the user (maximum of 10 tags). """ - email: Optional[str] + email: Optional[str] = None """ IAM member email. """ - first_name: Optional[str] + first_name: Optional[str] = None """ IAM member first name. """ - last_name: Optional[str] + last_name: Optional[str] = None """ IAM member last name. """ - phone_number: Optional[str] + phone_number: Optional[str] = None """ IAM member phone number. """ - locale: Optional[str] + locale: Optional[str] = None """ IAM member locale. """ diff --git a/scaleway-async/scaleway_async/inference/v1/marshalling.py b/scaleway-async/scaleway_async/inference/v1/marshalling.py index 8fc4b104f..b28aeed98 100644 --- a/scaleway-async/scaleway_async/inference/v1/marshalling.py +++ b/scaleway-async/scaleway_async/inference/v1/marshalling.py @@ -10,6 +10,9 @@ resolve_one_of, ) from .types import ( + DeploymentStatus, + ModelStatus, + NodeTypeStock, EndpointPrivateNetworkDetails, EndpointPublicNetworkDetails, Endpoint, @@ -44,6 +47,8 @@ def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetwork field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None return EndpointPrivateNetworkDetails(**args) @@ -70,14 +75,20 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("disable_auth", None) if field is not None: args["disable_auth"] = field + else: + args["disable_auth"] = False field = data.get("public_network", None) if field is not None: @@ -105,14 +116,20 @@ def unmarshal_ModelSupportedQuantization(data: Any) -> ModelSupportedQuantizatio field = data.get("quantization_bits", None) if field is not None: args["quantization_bits"] = field + else: + args["quantization_bits"] = 0 field = data.get("allowed", None) if field is not None: args["allowed"] = field + else: + args["allowed"] = False field = data.get("max_context_size", None) if field is not None: args["max_context_size"] = field + else: + args["max_context_size"] = 0 return ModelSupportedQuantization(**args) @@ -128,6 +145,8 @@ def unmarshal_ModelSupportedNode(data: Any) -> ModelSupportedNode: field = data.get("node_type_name", None) if field is not None: args["node_type_name"] = field + else: + args["node_type_name"] = None field = data.get("quantizations", None) if field is not None: @@ -136,6 +155,8 @@ def unmarshal_ModelSupportedNode(data: Any) -> ModelSupportedNode: if field is not None else None ) + else: + args["quantizations"] = field(default_factory=list) return ModelSupportedNode(**args) @@ -155,6 +176,8 @@ def unmarshal_ModelSupportInfo(data: Any) -> ModelSupportInfo: if field is not None else None ) + else: + args["nodes"] = field(default_factory=list) return ModelSupportInfo(**args) @@ -170,6 +193,8 @@ def unmarshal_DeploymentQuantization(data: Any) -> DeploymentQuantization: field = data.get("bits", None) if field is not None: args["bits"] = field + else: + args["bits"] = None return DeploymentQuantization(**args) @@ -185,56 +210,82 @@ def unmarshal_Deployment(data: Any) -> Deployment: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DeploymentStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("node_type_name", None) if field is not None: args["node_type_name"] = field + else: + args["node_type_name"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 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("model_id", None) if field is not None: args["model_id"] = field + else: + args["model_id"] = None field = data.get("model_name", None) if field is not None: args["model_name"] = field + else: + args["model_name"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("error_message", None) if field is not None: @@ -274,34 +325,50 @@ def unmarshal_Model(data: Any) -> Model: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ModelStatus.UNKNOWN_STATUS field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("has_eula", None) if field is not None: args["has_eula"] = field + else: + args["has_eula"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("nodes_support", None) if field is not None: @@ -310,14 +377,20 @@ def unmarshal_Model(data: Any) -> Model: if field is not None else None ) + else: + args["nodes_support"] = field(default_factory=list) field = data.get("parameter_size_bits", None) if field is not None: args["parameter_size_bits"] = field + else: + args["parameter_size_bits"] = 0 field = data.get("size_bytes", None) if field is not None: args["size_bytes"] = field + else: + args["size_bytes"] = 0 field = data.get("error_message", None) if field is not None: @@ -353,10 +426,14 @@ def unmarshal_ListDeploymentsResponse(data: Any) -> ListDeploymentsResponse: args["deployments"] = ( [unmarshal_Deployment(v) for v in field] if field is not None else None ) + else: + args["deployments"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDeploymentsResponse(**args) @@ -374,10 +451,14 @@ def unmarshal_ListModelsResponse(data: Any) -> ListModelsResponse: args["models"] = ( [unmarshal_Model(v) for v in field] if field is not None else None ) + else: + args["models"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListModelsResponse(**args) @@ -393,42 +474,62 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN_STOCK field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("vram", None) if field is not None: args["vram"] = field + else: + args["vram"] = 0 field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("gpus", None) if field is not None: args["gpus"] = field + else: + args["gpus"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -458,10 +559,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -548,7 +653,9 @@ def marshal_CreateDeploymentRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.accept_eula is not None: output["accept_eula"] = request.accept_eula @@ -619,7 +726,9 @@ def marshal_CreateModelRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output diff --git a/scaleway-async/scaleway_async/inference/v1/types.py b/scaleway-async/scaleway_async/inference/v1/types.py index d69897b6a..38e55ab0b 100644 --- a/scaleway-async/scaleway_async/inference/v1/types.py +++ b/scaleway-async/scaleway_async/inference/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -139,9 +139,9 @@ class Endpoint: Defines whether the authentication is disabled. """ - public_network: Optional[EndpointPublicNetworkDetails] + public_network: Optional[EndpointPublicNetworkDetails] = None - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None @dataclass @@ -160,16 +160,15 @@ class EndpointSpec: When setting this field to true, the authentication will be disabled. """ - public_network: Optional[EndpointPublicNetworkDetails] + public_network: Optional[EndpointPublicNetworkDetails] = None - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None @dataclass class ModelSource: url: str - - secret: Optional[str] + secret: Optional[str] = None @dataclass @@ -239,22 +238,22 @@ class Deployment: Region of the deployment. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Displays information if your deployment is in error state. """ - quantization: Optional[DeploymentQuantization] + quantization: Optional[DeploymentQuantization] = None """ Quantization parameters for this deployment. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the deployment. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the deployment. """ @@ -317,17 +316,17 @@ class Model: Total size, in bytes, of the model files. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Displays information if your model is in error state. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the model. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the model. """ @@ -385,12 +384,12 @@ class NodeType: Region of the node type. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the node type. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the node type. """ @@ -413,43 +412,43 @@ class CreateDeploymentRequest: List of endpoints to create. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the deployment. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to create the deployment in. """ - accept_eula: Optional[bool] + accept_eula: Optional[bool] = False """ If the model has an EULA, you must accept it before proceeding. The terms of the EULA can be retrieved using the `GetModelEula` API call. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the deployment. """ - min_size: Optional[int] + min_size: Optional[int] = 0 """ Defines the minimum size of the pool. """ - max_size: Optional[int] + max_size: Optional[int] = 0 """ Defines the maximum size of the pool. """ - quantization: Optional[DeploymentQuantization] + quantization: Optional[DeploymentQuantization] = None """ Quantization settings to apply to this deployment. """ @@ -467,7 +466,7 @@ class CreateEndpointRequest: Specification of the endpoint. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -480,17 +479,17 @@ class CreateModelRequest: Where to import the model from. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the model. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to import the model in. """ @@ -503,7 +502,7 @@ class DeleteDeploymentRequest: ID of the deployment to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -516,7 +515,7 @@ class DeleteEndpointRequest: ID of the endpoint to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -529,7 +528,7 @@ class DeleteModelRequest: ID of the model to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -538,8 +537,7 @@ class DeleteModelRequest: @dataclass class GetDeploymentCertificateRequest: deployment_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -552,7 +550,7 @@ class GetDeploymentRequest: ID of the deployment to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -565,7 +563,7 @@ class GetModelRequest: ID of the model to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -573,42 +571,44 @@ class GetModelRequest: @dataclass class ListDeploymentsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of deployments to return per page. """ - order_by: Optional[ListDeploymentsRequestOrderBy] + order_by: Optional[ListDeploymentsRequestOrderBy] = ( + ListDeploymentsRequestOrderBy.CREATED_AT_DESC + ) """ Order in which to return results. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by deployment name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. """ @@ -629,37 +629,39 @@ class ListDeploymentsResponse: @dataclass class ListModelsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListModelsRequestOrderBy] + order_by: Optional[ListModelsRequestOrderBy] = ( + ListModelsRequestOrderBy.DISPLAY_RANK_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of models to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by model name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. """ @@ -685,17 +687,17 @@ class ListNodeTypesRequest: Include disabled node types in the response. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of node types to return per page. """ @@ -721,37 +723,37 @@ class UpdateDeploymentRequest: ID of the deployment to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the deployment. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the deployment. """ - min_size: Optional[int] + min_size: Optional[int] = 0 """ Defines the new minimum size of the pool. """ - max_size: Optional[int] + max_size: Optional[int] = 0 """ Defines the new maximum size of the pool. """ - model_id: Optional[str] + model_id: Optional[str] = None """ Id of the model to set to the deployment. """ - quantization: Optional[DeploymentQuantization] + quantization: Optional[DeploymentQuantization] = None """ Quantization to use to the deployment. """ @@ -764,12 +766,12 @@ class UpdateEndpointRequest: ID of the endpoint to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - disable_auth: Optional[bool] + disable_auth: Optional[bool] = False """ By default, deployments are protected by IAM authentication. When setting this field to true, the authentication will be disabled. diff --git a/scaleway-async/scaleway_async/inference/v1beta1/marshalling.py b/scaleway-async/scaleway_async/inference/v1beta1/marshalling.py index 8930c95d9..543130c27 100644 --- a/scaleway-async/scaleway_async/inference/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/inference/v1beta1/marshalling.py @@ -10,6 +10,8 @@ resolve_one_of, ) from .types import ( + DeploymentStatus, + NodeTypeStock, EndpointPrivateNetworkDetails, EndpointPublicAccessDetails, Endpoint, @@ -49,6 +51,8 @@ def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetwork field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None return EndpointPrivateNetworkDetails(**args) @@ -75,14 +79,20 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("disable_auth", None) if field is not None: args["disable_auth"] = field + else: + args["disable_auth"] = False field = data.get("public_access", None) if field is not None: @@ -110,56 +120,82 @@ def unmarshal_Deployment(data: Any) -> Deployment: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DeploymentStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 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("model_name", None) if field is not None: args["model_name"] = field + else: + args["model_name"] = None field = data.get("model_id", None) if field is not None: args["model_id"] = field + else: + args["model_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("error_message", None) if field is not None: @@ -193,10 +229,14 @@ def unmarshal_ModelS3Model(data: Any) -> ModelS3Model: field = data.get("s3_url", None) if field is not None: args["s3_url"] = field + else: + args["s3_url"] = None field = data.get("python_dependencies", None) if field is not None: args["python_dependencies"] = field + else: + args["python_dependencies"] = None field = data.get("node_type", None) if field is not None: @@ -224,46 +264,68 @@ def unmarshal_Model(data: Any) -> Model: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("provider", None) if field is not None: args["provider"] = field + else: + args["provider"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("has_eula", None) if field is not None: args["has_eula"] = field + else: + args["has_eula"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("is_public", None) if field is not None: args["is_public"] = field + else: + args["is_public"] = False field = data.get("compatible_node_types", None) if field is not None: args["compatible_node_types"] = field + else: + args["compatible_node_types"] = field(default_factory=list) field = data.get("quantization_level", None) if field is not None: args["quantization_level"] = field + else: + args["quantization_level"] = None field = data.get("created_at", None) if field is not None: @@ -297,14 +359,20 @@ def unmarshal_ACLRule(data: Any) -> ACLRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None return ACLRule(**args) @@ -322,6 +390,8 @@ def unmarshal_AddDeploymentACLRulesResponse(data: Any) -> AddDeploymentACLRulesR args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return AddDeploymentACLRulesResponse(**args) @@ -337,6 +407,8 @@ def unmarshal_Eula(data: Any) -> Eula: field = data.get("content", None) if field is not None: args["content"] = field + else: + args["content"] = None return Eula(**args) @@ -356,10 +428,14 @@ def unmarshal_ListDeploymentACLRulesResponse( args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDeploymentACLRulesResponse(**args) @@ -377,10 +453,14 @@ def unmarshal_ListDeploymentsResponse(data: Any) -> ListDeploymentsResponse: args["deployments"] = ( [unmarshal_Deployment(v) for v in field] if field is not None else None ) + else: + args["deployments"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDeploymentsResponse(**args) @@ -398,10 +478,14 @@ def unmarshal_ListModelsResponse(data: Any) -> ListModelsResponse: args["models"] = ( [unmarshal_Model(v) for v in field] if field is not None else None ) + else: + args["models"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListModelsResponse(**args) @@ -417,42 +501,62 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN_STOCK field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("vram", None) if field is not None: args["vram"] = field + else: + args["vram"] = 0 field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("gpus", None) if field is not None: args["gpus"] = field + else: + args["gpus"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -482,10 +586,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -503,6 +611,8 @@ def unmarshal_SetDeploymentACLRulesResponse(data: Any) -> SetDeploymentACLRulesR args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return SetDeploymentACLRulesResponse(**args) @@ -606,7 +716,9 @@ def marshal_CreateDeploymentRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.accept_eula is not None: output["accept_eula"] = request.accept_eula diff --git a/scaleway-async/scaleway_async/inference/v1beta1/types.py b/scaleway-async/scaleway_async/inference/v1beta1/types.py index 1befe869c..86ea67df1 100644 --- a/scaleway-async/scaleway_async/inference/v1beta1/types.py +++ b/scaleway-async/scaleway_async/inference/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -105,20 +105,17 @@ class Endpoint: Defines whether the authentication is disabled. """ - public_access: Optional[EndpointPublicAccessDetails] + public_access: Optional[EndpointPublicAccessDetails] = None - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None @dataclass class ModelS3Model: s3_url: str - python_dependencies: Dict[str, str] - - node_type: Optional[str] - - triton_server_version: Optional[str] + node_type: Optional[str] = None + triton_server_version: Optional[str] = None @dataclass @@ -160,9 +157,9 @@ class EndpointSpec: When setting this field to true, the authentication will be disabled. """ - public: Optional[EndpointSpecPublic] + public: Optional[EndpointSpecPublic] = None - private_network: Optional[EndpointSpecPrivateNetwork] + private_network: Optional[EndpointSpecPrivateNetwork] = None @dataclass @@ -232,17 +229,17 @@ class Deployment: Region of the deployment. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Displays information if your deployment is in error state. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the deployment. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the deployment. """ @@ -305,17 +302,17 @@ class Model: Quantization level of the model. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the model. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the model. """ - s3_model: Optional[ModelS3Model] + s3_model: Optional[ModelS3Model] = None @dataclass @@ -370,12 +367,12 @@ class NodeType: Region of the node type. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the node type. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the node type. """ @@ -388,12 +385,12 @@ class AddDeploymentACLRulesRequest: ID of the deployment to add ACL rules to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - acls: Optional[List[ACLRuleRequest]] + acls: Optional[List[ACLRuleRequest]] = field(default_factory=list) """ List of ACL rules to add. """ @@ -424,38 +421,38 @@ class CreateDeploymentRequest: List of endpoints to create. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the deployment. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to create the deployment in. """ - accept_eula: Optional[bool] + accept_eula: Optional[bool] = False """ If the model has an EULA, you must accept it before proceeding. The terms of the EULA can be retrieved using the `GetModelEula` API call. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the deployment. """ - min_size: Optional[int] + min_size: Optional[int] = 0 """ Defines the minimum size of the pool. """ - max_size: Optional[int] + max_size: Optional[int] = 0 """ Defines the maximum size of the pool. """ @@ -473,7 +470,7 @@ class CreateEndpointRequest: Specification of the endpoint. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -486,7 +483,7 @@ class DeleteDeploymentACLRuleRequest: ID of the ACL rule to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -499,7 +496,7 @@ class DeleteDeploymentRequest: ID of the deployment to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -512,7 +509,7 @@ class DeleteEndpointRequest: ID of the endpoint to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -529,8 +526,7 @@ class Eula: @dataclass class GetDeploymentCertificateRequest: deployment_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -543,7 +539,7 @@ class GetDeploymentRequest: ID of the deployment to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -552,8 +548,7 @@ class GetDeploymentRequest: @dataclass class GetModelEulaRequest: model_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -566,7 +561,7 @@ class GetModelRequest: ID of the model to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -579,17 +574,17 @@ class ListDeploymentACLRulesRequest: ID of the deployment to list ACL rules for. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of ACL rules to return per page. """ @@ -610,42 +605,44 @@ class ListDeploymentACLRulesResponse: @dataclass class ListDeploymentsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of deployments to return per page. """ - order_by: Optional[ListDeploymentsRequestOrderBy] + order_by: Optional[ListDeploymentsRequestOrderBy] = ( + ListDeploymentsRequestOrderBy.CREATED_AT_DESC + ) """ Order in which to return results. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by deployment name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. """ @@ -666,37 +663,39 @@ class ListDeploymentsResponse: @dataclass class ListModelsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListModelsRequestOrderBy] + order_by: Optional[ListModelsRequestOrderBy] = ( + ListModelsRequestOrderBy.DISPLAY_RANK_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of models to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by model name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. """ @@ -722,17 +721,17 @@ class ListNodeTypesRequest: Include disabled node types in the response. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of node types to return per page. """ @@ -758,12 +757,12 @@ class SetDeploymentACLRulesRequest: ID of the deployment to set ACL rules for. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - acls: Optional[List[ACLRuleRequest]] + acls: Optional[List[ACLRuleRequest]] = field(default_factory=list) """ All existing ACL rules will be replaced by the new ones. """ @@ -784,27 +783,27 @@ class UpdateDeploymentRequest: ID of the deployment to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the deployment. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the deployment. """ - min_size: Optional[int] + min_size: Optional[int] = 0 """ Defines the new minimum size of the pool. """ - max_size: Optional[int] + max_size: Optional[int] = 0 """ Defines the new maximum size of the pool. """ @@ -817,12 +816,12 @@ class UpdateEndpointRequest: ID of the endpoint to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - disable_auth: Optional[bool] + disable_auth: Optional[bool] = False """ By default, deployments are protected by IAM authentication. When setting this field to true, the authentication will be disabled. diff --git a/scaleway-async/scaleway_async/instance/v1/marshalling.py b/scaleway-async/scaleway_async/instance/v1/marshalling.py index efcebf457..3384c73d2 100644 --- a/scaleway-async/scaleway_async/instance/v1/marshalling.py +++ b/scaleway-async/scaleway_async/instance/v1/marshalling.py @@ -21,8 +21,22 @@ _SetSnapshotRequest, ) from .types import ( + Arch, BootType, + PlacementGroupPolicyMode, + PlacementGroupPolicyType, + PrivateNICState, + SecurityGroupPolicy, + SecurityGroupState, ServerAction, + ServerIpIpFamily, + ServerIpProvisioningMode, + ServerIpState, + ServerState, + SnapshotState, + TaskStatus, + VolumeState, + VolumeVolumeType, PrivateNIC, ServerSummary, Bootscript, @@ -163,26 +177,38 @@ def unmarshal_PrivateNIC(data: Any) -> PrivateNIC: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("server_id", None) if field is not None: args["server_id"] = field + else: + args["server_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("mac_address", None) if field is not None: args["mac_address"] = field + else: + args["mac_address"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = PrivateNICState.AVAILABLE field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) return PrivateNIC(**args) @@ -198,10 +224,14 @@ def unmarshal_ServerSummary(data: Any) -> ServerSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return ServerSummary(**args) @@ -217,50 +247,74 @@ def unmarshal_Bootscript(data: Any) -> Bootscript: field = data.get("architecture", None) if field is not None: args["architecture"] = field + else: + args["architecture"] = None field = data.get("bootcmdargs", None) if field is not None: args["bootcmdargs"] = field + else: + args["bootcmdargs"] = None field = data.get("default", None) if field is not None: args["default"] = field + else: + args["default"] = None field = data.get("dtb", None) if field is not None: args["dtb"] = field + else: + args["dtb"] = None field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("initrd", None) if field is not None: args["initrd"] = field + else: + args["initrd"] = None field = data.get("kernel", None) if field is not None: args["kernel"] = field + else: + args["kernel"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("public", None) if field is not None: args["public"] = field + else: + args["public"] = None field = data.get("title", None) if field is not None: args["title"] = field + else: + args["title"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return Bootscript(**args) @@ -276,26 +330,38 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = VolumeVolumeType.L_SSD field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("export_uri", None) if field is not None: @@ -322,14 +388,20 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = VolumeState.AVAILABLE field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("server", None) if field is not None: @@ -351,18 +423,26 @@ def unmarshal_VolumeSummary(data: Any) -> VolumeSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = None return VolumeSummary(**args) @@ -378,14 +458,20 @@ def unmarshal_Image(data: Any) -> Image: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = None field = data.get("extra_volumes", None) if field is not None: @@ -394,14 +480,20 @@ def unmarshal_Image(data: Any) -> Image: if field is not None else None ) + else: + args["extra_volumes"] = None field = data.get("from_server", None) if field is not None: args["from_server"] = field + else: + args["from_server"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("creation_date", None) if field is not None: @@ -428,22 +520,32 @@ def unmarshal_Image(data: Any) -> Image: field = data.get("public", None) if field is not None: args["public"] = field + else: + args["public"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("root_volume", None) if field is not None: @@ -465,38 +567,56 @@ def unmarshal_PlacementGroup(data: Any) -> PlacementGroup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("policy_mode", None) if field is not None: args["policy_mode"] = field + else: + args["policy_mode"] = PlacementGroupPolicyMode.OPTIONAL field = data.get("policy_type", None) if field is not None: args["policy_type"] = field + else: + args["policy_type"] = PlacementGroupPolicyType.MAX_AVAILABILITY field = data.get("policy_respected", None) if field is not None: args["policy_respected"] = field + else: + args["policy_respected"] = False field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return PlacementGroup(**args) @@ -512,10 +632,14 @@ def unmarshal_SecurityGroupSummary(data: Any) -> SecurityGroupSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return SecurityGroupSummary(**args) @@ -531,10 +655,14 @@ def unmarshal_ServerFilesystem(data: Any) -> ServerFilesystem: field = data.get("filesystem_id", None) if field is not None: args["filesystem_id"] = field + else: + args["filesystem_id"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None return ServerFilesystem(**args) @@ -550,42 +678,62 @@ def unmarshal_ServerIp(data: Any) -> ServerIp: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("gateway", None) if field is not None: args["gateway"] = field + else: + args["gateway"] = None field = data.get("netmask", None) if field is not None: args["netmask"] = field + else: + args["netmask"] = None field = data.get("family", None) if field is not None: args["family"] = field + else: + args["family"] = ServerIpIpFamily.INET field = data.get("dynamic", None) if field is not None: args["dynamic"] = field + else: + args["dynamic"] = False field = data.get("provisioning_mode", None) if field is not None: args["provisioning_mode"] = field + else: + args["provisioning_mode"] = ServerIpProvisioningMode.MANUAL field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("ipam_id", None) if field is not None: args["ipam_id"] = field + else: + args["ipam_id"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = ServerIpState.UNKNOWN_STATE return ServerIp(**args) @@ -601,14 +749,20 @@ def unmarshal_ServerIpv6(data: Any) -> ServerIpv6: field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("gateway", None) if field is not None: args["gateway"] = field + else: + args["gateway"] = None field = data.get("netmask", None) if field is not None: args["netmask"] = field + else: + args["netmask"] = None return ServerIpv6(**args) @@ -624,22 +778,32 @@ def unmarshal_ServerLocation(data: Any) -> ServerLocation: field = data.get("cluster_id", None) if field is not None: args["cluster_id"] = field + else: + args["cluster_id"] = None field = data.get("hypervisor_id", None) if field is not None: args["hypervisor_id"] = field + else: + args["hypervisor_id"] = None field = data.get("node_id", None) if field is not None: args["node_id"] = field + else: + args["node_id"] = None field = data.get("platform_id", None) if field is not None: args["platform_id"] = field + else: + args["platform_id"] = None field = data.get("zone_id", None) if field is not None: args["zone_id"] = field + else: + args["zone_id"] = None return ServerLocation(**args) @@ -655,6 +819,8 @@ def unmarshal_ServerMaintenance(data: Any) -> ServerMaintenance: field = data.get("reason", None) if field is not None: args["reason"] = field + else: + args["reason"] = None field = data.get("start_date", None) if field is not None: @@ -676,6 +842,8 @@ def unmarshal_VolumeServer(data: Any) -> VolumeServer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: @@ -710,14 +878,20 @@ def unmarshal_VolumeServer(data: Any) -> VolumeServer: field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = None field = data.get("boot", None) if field is not None: args["boot"] = field + else: + args["boot"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("creation_date", None) if field is not None: @@ -761,32 +935,46 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("allowed_actions", None) if field is not None: args["allowed_actions"] = ( [ServerAction(v) for v in field] if field is not None else None ) + else: + args["allowed_actions"] = field(default_factory=list) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("commercial_type", None) if field is not None: args["commercial_type"] = field + else: + args["commercial_type"] = None field = data.get("creation_date", None) if field is not None: @@ -799,26 +987,32 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("dynamic_ip_required", None) if field is not None: args["dynamic_ip_required"] = field + else: + args["dynamic_ip_required"] = False field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("routed_ip_enabled", None) if field is not None: args["routed_ip_enabled"] = field else: - args["routed_ip_enabled"] = None + args["routed_ip_enabled"] = False field = data.get("enable_ipv6", None) if field is not None: args["enable_ipv6"] = field else: - args["enable_ipv6"] = None + args["enable_ipv6"] = False field = data.get("image", None) if field is not None: @@ -843,18 +1037,26 @@ def unmarshal_Server(data: Any) -> Server: args["public_ips"] = ( [unmarshal_ServerIp(v) for v in field] if field is not None else None ) + else: + args["public_ips"] = field(default_factory=list) field = data.get("mac_address", None) if field is not None: args["mac_address"] = field + else: + args["mac_address"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = ServerState.RUNNING field = data.get("boot_type", None) if field is not None: args["boot_type"] = field + else: + args["boot_type"] = BootType.LOCAL field = data.get("volumes", None) if field is not None: @@ -863,6 +1065,8 @@ def unmarshal_Server(data: Any) -> Server: if field is not None else None ) + else: + args["volumes"] = field(default_factory=dict) field = data.get("maintenances", None) if field is not None: @@ -871,14 +1075,20 @@ def unmarshal_Server(data: Any) -> Server: if field is not None else None ) + else: + args["maintenances"] = field(default_factory=list) field = data.get("state_detail", None) if field is not None: args["state_detail"] = field + else: + args["state_detail"] = None field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = Arch.UNKNOWN_ARCH field = data.get("modification_date", None) if field is not None: @@ -917,10 +1127,14 @@ def unmarshal_Server(data: Any) -> Server: args["private_nics"] = ( [unmarshal_PrivateNIC(v) for v in field] if field is not None else None ) + else: + args["private_nics"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("filesystems", None) if field is not None: @@ -929,10 +1143,14 @@ def unmarshal_Server(data: Any) -> Server: if field is not None else None ) + else: + args["filesystems"] = field(default_factory=list) field = data.get("end_of_service", None) if field is not None: args["end_of_service"] = field + else: + args["end_of_service"] = False field = data.get("admin_password_encryption_ssh_key_id", None) if field is not None: @@ -1013,42 +1231,62 @@ def unmarshal_Ip(data: Any) -> Ip: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None field = data.get("prefix", None) if field is not None: args["prefix"] = field + else: + args["prefix"] = None field = data.get("ipam_id", None) if field is not None: args["ipam_id"] = field + else: + args["ipam_id"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("reverse", None) if field is not None: @@ -1127,66 +1365,94 @@ def unmarshal_SecurityGroup(data: Any) -> SecurityGroup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("enable_default_security", None) if field is not None: args["enable_default_security"] = field + else: + args["enable_default_security"] = False field = data.get("inbound_default_policy", None) if field is not None: args["inbound_default_policy"] = field + else: + args["inbound_default_policy"] = SecurityGroupPolicy.UNKNOWN_POLICY field = data.get("outbound_default_policy", None) if field is not None: args["outbound_default_policy"] = field + else: + args["outbound_default_policy"] = SecurityGroupPolicy.UNKNOWN_POLICY field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("project_default", None) if field is not None: args["project_default"] = field + else: + args["project_default"] = False field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_ServerSummary(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) field = data.get("stateful", None) if field is not None: args["stateful"] = field + else: + args["stateful"] = False field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = SecurityGroupState.AVAILABLE field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("organization_default", None) if field is not None: args["organization_default"] = field else: - args["organization_default"] = None + args["organization_default"] = False field = data.get("creation_date", None) if field is not None: @@ -1235,34 +1501,50 @@ def unmarshal_SecurityGroupRule(data: Any) -> SecurityGroupRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = None field = data.get("direction", None) if field is not None: args["direction"] = field + else: + args["direction"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = None field = data.get("ip_range", None) if field is not None: args["ip_range"] = field + else: + args["ip_range"] = None field = data.get("position", None) if field is not None: args["position"] = field + else: + args["position"] = None field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("dest_port_from", None) if field is not None: @@ -1326,10 +1608,14 @@ def unmarshal_SnapshotBaseVolume(data: Any) -> SnapshotBaseVolume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return SnapshotBaseVolume(**args) @@ -1345,38 +1631,56 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = VolumeVolumeType.L_SSD field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = SnapshotState.AVAILABLE field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("base_volume", None) if field is not None: @@ -1420,30 +1724,44 @@ def unmarshal_Task(data: Any) -> Task: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("progress", None) if field is not None: args["progress"] = field + else: + args["progress"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TaskStatus.PENDING field = data.get("href_from", None) if field is not None: args["href_from"] = field + else: + args["href_from"] = None field = data.get("href_result", None) if field is not None: args["href_result"] = field + else: + args["href_result"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("started_at", None) if field is not None: @@ -1566,54 +1884,80 @@ def unmarshal_Dashboard(data: Any) -> Dashboard: field = data.get("volumes_count", None) if field is not None: args["volumes_count"] = field + else: + args["volumes_count"] = None field = data.get("running_servers_count", None) if field is not None: args["running_servers_count"] = field + else: + args["running_servers_count"] = None field = data.get("servers_by_types", None) if field is not None: args["servers_by_types"] = field + else: + args["servers_by_types"] = None field = data.get("images_count", None) if field is not None: args["images_count"] = field + else: + args["images_count"] = None field = data.get("snapshots_count", None) if field is not None: args["snapshots_count"] = field + else: + args["snapshots_count"] = None field = data.get("servers_count", None) if field is not None: args["servers_count"] = field + else: + args["servers_count"] = None field = data.get("ips_count", None) if field is not None: args["ips_count"] = field + else: + args["ips_count"] = None field = data.get("security_groups_count", None) if field is not None: args["security_groups_count"] = field + else: + args["security_groups_count"] = None field = data.get("ips_unused", None) if field is not None: args["ips_unused"] = field + else: + args["ips_unused"] = None field = data.get("volumes_l_ssd_count", None) if field is not None: args["volumes_l_ssd_count"] = field + else: + args["volumes_l_ssd_count"] = None field = data.get("volumes_l_ssd_total_size", None) if field is not None: args["volumes_l_ssd_total_size"] = field + else: + args["volumes_l_ssd_total_size"] = None field = data.get("private_nics_count", None) if field is not None: args["private_nics_count"] = field + else: + args["private_nics_count"] = None field = data.get("placement_groups_count", None) if field is not None: args["placement_groups_count"] = field + else: + args["placement_groups_count"] = None field = data.get("volumes_b_ssd_count", None) if field is not None: @@ -1709,14 +2053,20 @@ def unmarshal_PlacementGroupServer(data: Any) -> PlacementGroupServer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("policy_respected", None) if field is not None: args["policy_respected"] = field + else: + args["policy_respected"] = False return PlacementGroupServer(**args) @@ -1738,6 +2088,8 @@ def unmarshal_GetPlacementGroupServersResponse( if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return GetPlacementGroupServersResponse(**args) @@ -1823,6 +2175,8 @@ def unmarshal_GetServerTypesAvailabilityResponseAvailability( field = data.get("availability", None) if field is not None: args["availability"] = field + else: + args["availability"] = None return GetServerTypesAvailabilityResponseAvailability(**args) @@ -1847,10 +2201,14 @@ def unmarshal_GetServerTypesAvailabilityResponse( if field is not None else None ) + else: + args["servers"] = field(default_factory=dict) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return GetServerTypesAvailabilityResponse(**args) @@ -1900,12 +2258,16 @@ def unmarshal_ListImagesResponse(data: Any) -> ListImagesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("images", None) if field is not None: args["images"] = ( [unmarshal_Image(v) for v in field] if field is not None else None ) + else: + args["images"] = field(default_factory=list) return ListImagesResponse(**args) @@ -1921,10 +2283,14 @@ def unmarshal_ListIpsResponse(data: Any) -> ListIpsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_Ip(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) return ListIpsResponse(**args) @@ -1940,12 +2306,16 @@ def unmarshal_ListPlacementGroupsResponse(data: Any) -> ListPlacementGroupsRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("placement_groups", None) if field is not None: args["placement_groups"] = ( [unmarshal_PlacementGroup(v) for v in field] if field is not None else None ) + else: + args["placement_groups"] = field(default_factory=list) return ListPlacementGroupsResponse(**args) @@ -1963,10 +2333,14 @@ def unmarshal_ListPrivateNICsResponse(data: Any) -> ListPrivateNICsResponse: args["private_nics"] = ( [unmarshal_PrivateNIC(v) for v in field] if field is not None else None ) + else: + args["private_nics"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListPrivateNICsResponse(**args) @@ -1984,6 +2358,8 @@ def unmarshal_ListSecurityGroupRulesResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("rules", None) if field is not None: @@ -1992,6 +2368,8 @@ def unmarshal_ListSecurityGroupRulesResponse( if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return ListSecurityGroupRulesResponse(**args) @@ -2007,12 +2385,16 @@ def unmarshal_ListSecurityGroupsResponse(data: Any) -> ListSecurityGroupsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("security_groups", None) if field is not None: args["security_groups"] = ( [unmarshal_SecurityGroup(v) for v in field] if field is not None else None ) + else: + args["security_groups"] = field(default_factory=list) return ListSecurityGroupsResponse(**args) @@ -2030,6 +2412,8 @@ def unmarshal_ListServerActionsResponse(data: Any) -> ListServerActionsResponse: args["actions"] = ( [ServerAction(v) for v in field] if field is not None else None ) + else: + args["actions"] = None return ListServerActionsResponse(**args) @@ -2045,6 +2429,8 @@ def unmarshal_ListServerUserDataResponse(data: Any) -> ListServerUserDataRespons field = data.get("user_data", None) if field is not None: args["user_data"] = field + else: + args["user_data"] = None return ListServerUserDataResponse(**args) @@ -2060,12 +2446,16 @@ def unmarshal_ListServersResponse(data: Any) -> ListServersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListServersResponse(**args) @@ -2082,13 +2472,13 @@ def unmarshal_ServerTypeNetworkInterface(data: Any) -> ServerTypeNetworkInterfac if field is not None: args["internal_bandwidth"] = field else: - args["internal_bandwidth"] = None + args["internal_bandwidth"] = 0 field = data.get("internet_bandwidth", None) if field is not None: args["internet_bandwidth"] = field else: - args["internet_bandwidth"] = None + args["internet_bandwidth"] = 0 return ServerTypeNetworkInterface(**args) @@ -2106,10 +2496,14 @@ def unmarshal_ServerTypeVolumeConstraintSizes( 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 return ServerTypeVolumeConstraintSizes(**args) @@ -2125,16 +2519,20 @@ def unmarshal_ServerTypeCapabilities(data: Any) -> ServerTypeCapabilities: field = data.get("boot_types", None) if field is not None: args["boot_types"] = [BootType(v) for v in field] if field is not None else None + else: + args["boot_types"] = field(default_factory=list) field = data.get("max_file_systems", None) if field is not None: args["max_file_systems"] = field + else: + args["max_file_systems"] = 0 field = data.get("block_storage", None) if field is not None: args["block_storage"] = field else: - args["block_storage"] = None + args["block_storage"] = False return ServerTypeCapabilities(**args) @@ -2150,14 +2548,20 @@ def unmarshal_ServerTypeGPUInfo(data: Any) -> ServerTypeGPUInfo: field = data.get("gpu_manufacturer", None) if field is not None: args["gpu_manufacturer"] = field + else: + args["gpu_manufacturer"] = None field = data.get("gpu_name", None) if field is not None: args["gpu_name"] = field + else: + args["gpu_name"] = None field = data.get("gpu_memory", None) if field is not None: args["gpu_memory"] = field + else: + args["gpu_memory"] = 0 return ServerTypeGPUInfo(**args) @@ -2177,22 +2581,26 @@ def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork: if field is not None else None ) + else: + args["interfaces"] = field(default_factory=list) field = data.get("ipv6_support", None) if field is not None: args["ipv6_support"] = field + else: + args["ipv6_support"] = False field = data.get("sum_internal_bandwidth", None) if field is not None: args["sum_internal_bandwidth"] = field else: - args["sum_internal_bandwidth"] = None + args["sum_internal_bandwidth"] = 0 field = data.get("sum_internet_bandwidth", None) if field is not None: args["sum_internet_bandwidth"] = field else: - args["sum_internet_bandwidth"] = None + args["sum_internet_bandwidth"] = 0 return ServerTypeNetwork(**args) @@ -2228,31 +2636,43 @@ def unmarshal_ServerType(data: Any) -> ServerType: if field is not None: args["monthly_price"] = field else: - args["monthly_price"] = None + args["monthly_price"] = 0.0 field = data.get("hourly_price", None) if field is not None: args["hourly_price"] = field + else: + args["hourly_price"] = 0.0 field = data.get("alt_names", None) if field is not None: args["alt_names"] = field + else: + args["alt_names"] = field(default_factory=list) field = data.get("ncpus", None) if field is not None: args["ncpus"] = field + else: + args["ncpus"] = 0 field = data.get("ram", None) if field is not None: args["ram"] = field + else: + args["ram"] = 0 field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = Arch.UNKNOWN_ARCH field = data.get("end_of_service", None) if field is not None: args["end_of_service"] = field + else: + args["end_of_service"] = False field = data.get("per_volume_constraint", None) if field is not None: @@ -2272,7 +2692,7 @@ def unmarshal_ServerType(data: Any) -> ServerType: if field is not None: args["gpu"] = field else: - args["gpu"] = None + args["gpu"] = 0 field = data.get("gpu_info", None) if field is not None: @@ -2296,13 +2716,13 @@ def unmarshal_ServerType(data: Any) -> ServerType: if field is not None: args["scratch_storage_max_size"] = field else: - args["scratch_storage_max_size"] = None + args["scratch_storage_max_size"] = 0 field = data.get("block_bandwidth", None) if field is not None: args["block_bandwidth"] = field else: - args["block_bandwidth"] = None + args["block_bandwidth"] = 0 return ServerType(**args) @@ -2318,6 +2738,8 @@ def unmarshal_ListServersTypesResponse(data: Any) -> ListServersTypesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: @@ -2326,6 +2748,8 @@ def unmarshal_ListServersTypesResponse(data: Any) -> ListServersTypesResponse: if field is not None else None ) + else: + args["servers"] = field(default_factory=dict) return ListServersTypesResponse(**args) @@ -2341,12 +2765,16 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("snapshots", None) if field is not None: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) return ListSnapshotsResponse(**args) @@ -2362,12 +2790,16 @@ def unmarshal_ListVolumesResponse(data: Any) -> ListVolumesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("volumes", None) if field is not None: args["volumes"] = ( [unmarshal_Volume(v) for v in field] if field is not None else None ) + else: + args["volumes"] = field(default_factory=list) return ListVolumesResponse(**args) @@ -2383,6 +2815,8 @@ def unmarshal_VolumeTypeCapabilities(data: Any) -> VolumeTypeCapabilities: field = data.get("snapshot", None) if field is not None: args["snapshot"] = field + else: + args["snapshot"] = None return VolumeTypeCapabilities(**args) @@ -2398,10 +2832,14 @@ def unmarshal_VolumeTypeConstraints(data: Any) -> VolumeTypeConstraints: field = data.get("min", None) if field is not None: args["min"] = field + else: + args["min"] = None field = data.get("max", None) if field is not None: args["max"] = field + else: + args["max"] = None return VolumeTypeConstraints(**args) @@ -2417,6 +2855,8 @@ def unmarshal_VolumeType(data: Any) -> VolumeType: field = data.get("display_name", None) if field is not None: args["display_name"] = field + else: + args["display_name"] = None field = data.get("capabilities", None) if field is not None: @@ -2444,6 +2884,8 @@ def unmarshal_ListVolumesTypesResponse(data: Any) -> ListVolumesTypesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("volumes", None) if field is not None: @@ -2452,6 +2894,8 @@ def unmarshal_ListVolumesTypesResponse(data: Any) -> ListVolumesTypesResponse: if field is not None else None ) + else: + args["volumes"] = field(default_factory=dict) return ListVolumesTypesResponse(**args) @@ -2469,10 +2913,14 @@ def unmarshal_MigrationPlan(data: Any) -> MigrationPlan: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("validation_key", None) if field is not None: args["validation_key"] = field + else: + args["validation_key"] = None field = data.get("volume", None) if field is not None: @@ -2511,6 +2959,8 @@ def unmarshal_ServerCompatibleTypes(data: Any) -> ServerCompatibleTypes: field = data.get("compatible_types", None) if field is not None: args["compatible_types"] = field + else: + args["compatible_types"] = field(default_factory=list) return ServerCompatibleTypes(**args) @@ -2549,6 +2999,8 @@ def unmarshal_SetPlacementGroupServersResponse( if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return SetPlacementGroupServersResponse(**args) @@ -2568,6 +3020,8 @@ def unmarshal_SetSecurityGroupRulesResponse(data: Any) -> SetSecurityGroupRulesR if field is not None else None ) + else: + args["rules"] = None return SetSecurityGroupRulesResponse(**args) @@ -2640,6 +3094,8 @@ def unmarshal_UpdatePlacementGroupServersResponse( if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return UpdatePlacementGroupServersResponse(**args) @@ -2862,7 +3318,7 @@ def marshal_AttachServerVolumeRequest( output["volume_id"] = request.volume_id if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.boot is not None: output["boot"] = request.boot @@ -2877,9 +3333,9 @@ def marshal_CheckBlockMigrationOrganizationQuotasRequest( output: Dict[str, Any] = {} if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id return output @@ -2918,7 +3374,7 @@ def marshal_VolumeTemplate( output["size"] = request.size if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -2951,7 +3407,7 @@ def marshal_CreateImageRequest( output["root_volume"] = request.root_volume if request.arch is not None: - output["arch"] = str(request.arch) + output["arch"] = request.arch if request.name is not None: output["name"] = request.name @@ -3002,7 +3458,7 @@ def marshal_CreateIpRequest( output["server"] = request.server if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ return output @@ -3038,10 +3494,10 @@ def marshal_CreatePlacementGroupRequest( output["tags"] = request.tags if request.policy_mode is not None: - output["policy_mode"] = str(request.policy_mode) + output["policy_mode"] = request.policy_mode if request.policy_type is not None: - output["policy_type"] = str(request.policy_type) + output["policy_type"] = request.policy_type return output @@ -3120,10 +3576,10 @@ def marshal_CreateSecurityGroupRequest( output["tags"] = request.tags if request.inbound_default_policy is not None: - output["inbound_default_policy"] = str(request.inbound_default_policy) + output["inbound_default_policy"] = request.inbound_default_policy if request.outbound_default_policy is not None: - output["outbound_default_policy"] = str(request.outbound_default_policy) + output["outbound_default_policy"] = request.outbound_default_policy if request.enable_default_security is not None: output["enable_default_security"] = request.enable_default_security @@ -3138,13 +3594,13 @@ def marshal_CreateSecurityGroupRuleRequest( output: Dict[str, Any] = {} if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.direction is not None: - output["direction"] = str(request.direction) + output["direction"] = request.direction if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.ip_range is not None: output["ip_range"] = request.ip_range @@ -3171,7 +3627,7 @@ def marshal_VolumeServerTemplate( output: Dict[str, Any] = {} if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.id is not None: output["id"] = request.id @@ -3255,7 +3711,7 @@ def marshal_CreateServerRequest( output["public_ips"] = request.public_ips if request.boot_type is not None: - output["boot_type"] = str(request.boot_type) + output["boot_type"] = request.boot_type if request.tags is not None: output["tags"] = request.tags @@ -3308,7 +3764,7 @@ def marshal_CreateSnapshotRequest( output["tags"] = request.tags if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.bucket is not None: output["bucket"] = request.bucket @@ -3365,7 +3821,7 @@ def marshal_CreateVolumeRequest( output["tags"] = request.tags if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -3437,7 +3893,7 @@ def marshal_ServerActionRequestVolumeBackupTemplate( output: Dict[str, Any] = {} if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -3449,7 +3905,7 @@ def marshal_ServerActionRequest( output: Dict[str, Any] = {} if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.name is not None: output["name"] = request.name @@ -3488,7 +3944,7 @@ def marshal_Bootscript( output: Dict[str, Any] = {} if request.architecture is not None: - output["architecture"] = str(request.architecture) + output["architecture"] = request.architecture if request.bootcmdargs is not None: output["bootcmdargs"] = request.bootcmdargs @@ -3509,9 +3965,9 @@ def marshal_Bootscript( output["kernel"] = request.kernel if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.public is not None: output["public"] = request.public @@ -3520,10 +3976,14 @@ def marshal_Bootscript( output["title"] = request.title if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone return output @@ -3544,15 +4004,17 @@ def marshal_Volume( output["size"] = request.size if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.export_uri is not None: output["export_uri"] = request.export_uri @@ -3567,10 +4029,12 @@ def marshal_Volume( output["tags"] = request.tags if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone if request.server is not None: output["server"] = marshal_ServerSummary(request.server, defaults) @@ -3594,7 +4058,7 @@ def marshal_VolumeSummary( output["size"] = request.size if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -3609,7 +4073,7 @@ def marshal_SetImageRequest( output["name"] = request.name if request.arch is not None: - output["arch"] = str(request.arch) + output["arch"] = request.arch if request.creation_date is not None: output["creation_date"] = request.creation_date.isoformat() @@ -3635,18 +4099,20 @@ def marshal_SetImageRequest( } if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.root_volume is not None: output["root_volume"] = marshal_VolumeSummary(request.root_volume, defaults) if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -3664,18 +4130,20 @@ def marshal_SetPlacementGroupRequest( output["name"] = request.name if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.policy_mode is not None: - output["policy_mode"] = str(request.policy_mode) + output["policy_mode"] = request.policy_mode if request.policy_type is not None: - output["policy_type"] = str(request.policy_type) + output["policy_type"] = request.policy_type if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -3702,13 +4170,13 @@ def marshal_SetSecurityGroupRulesRequestRule( output: Dict[str, Any] = {} if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.direction is not None: - output["direction"] = str(request.direction) + output["direction"] = request.direction if request.ip_range is not None: output["ip_range"] = request.ip_range @@ -3771,7 +4239,7 @@ def marshal_UpdateImageRequest( output["name"] = request.name if request.arch is not None: - output["arch"] = str(request.arch) + output["arch"] = request.arch if request.extra_volumes is not None: output["extra_volumes"] = { @@ -3798,7 +4266,7 @@ def marshal_UpdateIpRequest( output["reverse"] = request.reverse if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.tags is not None: output["tags"] = request.tags @@ -3822,10 +4290,10 @@ def marshal_UpdatePlacementGroupRequest( output["tags"] = request.tags if request.policy_mode is not None: - output["policy_mode"] = str(request.policy_mode) + output["policy_mode"] = request.policy_mode if request.policy_type is not None: - output["policy_type"] = str(request.policy_type) + output["policy_type"] = request.policy_type return output @@ -3870,7 +4338,7 @@ def marshal_UpdateSecurityGroupRequest( output["enable_default_security"] = request.enable_default_security if request.inbound_default_policy is not None: - output["inbound_default_policy"] = str(request.inbound_default_policy) + output["inbound_default_policy"] = request.inbound_default_policy if request.tags is not None: output["tags"] = request.tags @@ -3882,7 +4350,7 @@ def marshal_UpdateSecurityGroupRequest( output["project_default"] = request.project_default if request.outbound_default_policy is not None: - output["outbound_default_policy"] = str(request.outbound_default_policy) + output["outbound_default_policy"] = request.outbound_default_policy if request.stateful is not None: output["stateful"] = request.stateful @@ -3897,13 +4365,13 @@ def marshal_UpdateSecurityGroupRuleRequest( output: Dict[str, Any] = {} if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.direction is not None: - output["direction"] = str(request.direction) + output["direction"] = request.direction if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.ip_range is not None: output["ip_range"] = request.ip_range @@ -3945,7 +4413,7 @@ def marshal_UpdateServerRequest( output["name"] = request.name if request.boot_type is not None: - output["boot_type"] = str(request.boot_type) + output["boot_type"] = request.boot_type if request.tags is not None: output["tags"] = request.tags @@ -4057,18 +4525,20 @@ def marshal__SetSecurityGroupRequest( output["stateful"] = request.stateful if request.inbound_default_policy is not None: - output["inbound_default_policy"] = str(request.inbound_default_policy) + output["inbound_default_policy"] = request.inbound_default_policy if request.outbound_default_policy is not None: - output["outbound_default_policy"] = str(request.outbound_default_policy) + output["outbound_default_policy"] = request.outbound_default_policy if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.organization_default is not None: output["organization_default"] = request.organization_default @@ -4100,13 +4570,13 @@ def marshal__SetSecurityGroupRuleRequest( output["editable"] = request.editable if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.direction is not None: - output["direction"] = str(request.direction) + output["direction"] = request.direction if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.dest_port_from is not None: output["dest_port_from"] = request.dest_port_from @@ -4130,7 +4600,7 @@ def marshal_Image( output["name"] = request.name if request.arch is not None: - output["arch"] = str(request.arch) + output["arch"] = request.arch if request.extra_volumes is not None: output["extra_volumes"] = { @@ -4142,9 +4612,9 @@ def marshal_Image( output["from_server"] = request.from_server if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.creation_date is not None: output["creation_date"] = request.creation_date.isoformat() @@ -4161,16 +4631,20 @@ def marshal_Image( output["public"] = request.public if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone if request.root_volume is not None: output["root_volume"] = marshal_VolumeSummary(request.root_volume, defaults) @@ -4191,27 +4665,31 @@ def marshal_PlacementGroup( output["name"] = request.name if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags if request.policy_mode is not None: - output["policy_mode"] = str(request.policy_mode) + output["policy_mode"] = request.policy_mode if request.policy_type is not None: - output["policy_type"] = str(request.policy_type) + output["policy_type"] = request.policy_type if request.policy_respected is not None: output["policy_respected"] = request.policy_respected if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone return output @@ -4235,7 +4713,7 @@ def marshal_PrivateNIC( output["mac_address"] = request.mac_address if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.tags is not None: output["tags"] = request.tags @@ -4277,13 +4755,13 @@ def marshal_ServerIp( output["netmask"] = request.netmask if request.family is not None: - output["family"] = str(request.family) + output["family"] = request.family if request.dynamic is not None: output["dynamic"] = request.dynamic if request.provisioning_mode is not None: - output["provisioning_mode"] = str(request.provisioning_mode) + output["provisioning_mode"] = request.provisioning_mode if request.tags is not None: output["tags"] = request.tags @@ -4292,7 +4770,7 @@ def marshal_ServerIp( output["ipam_id"] = request.ipam_id if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state return output @@ -4367,9 +4845,9 @@ def marshal__SetServerRequest( output["commercial_type"] = request.commercial_type if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.dynamic_ip_required is not None: output["dynamic_ip_required"] = request.dynamic_ip_required @@ -4384,7 +4862,9 @@ def marshal__SetServerRequest( output["state_detail"] = request.state_detail if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.allowed_actions is not None: output["allowed_actions"] = [str(item) for item in request.allowed_actions] @@ -4419,7 +4899,7 @@ def marshal__SetServerRequest( output["modification_date"] = request.modification_date.isoformat() if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.location is not None: output["location"] = marshal_ServerLocation(request.location, defaults) @@ -4428,7 +4908,7 @@ def marshal__SetServerRequest( output["ipv6"] = marshal_ServerIpv6(request.ipv6, defaults) if request.boot_type is not None: - output["boot_type"] = str(request.boot_type) + output["boot_type"] = request.boot_type if request.volumes is not None: output["volumes"] = { @@ -4447,7 +4927,7 @@ def marshal__SetServerRequest( ] if request.arch is not None: - output["arch"] = str(request.arch) + output["arch"] = request.arch if request.placement_group is not None: output["placement_group"] = marshal_PlacementGroup( @@ -4495,18 +4975,18 @@ def marshal__SetSnapshotRequest( output["name"] = request.name if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.size is not None: output["size"] = request.size if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.base_volume is not None: output["base_volume"] = marshal_SnapshotBaseVolume( @@ -4520,7 +5000,9 @@ def marshal__SetSnapshotRequest( output["modification_date"] = request.modification_date.isoformat() if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway-async/scaleway_async/instance/v1/types.py b/scaleway-async/scaleway_async/instance/v1/types.py index 6388d37a5..b025241ff 100644 --- a/scaleway-async/scaleway_async/instance/v1/types.py +++ b/scaleway-async/scaleway_async/instance/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -311,34 +311,22 @@ def __str__(self) -> str: @dataclass class ServerSummary: id: str - name: str @dataclass class Bootscript: architecture: Arch - bootcmdargs: str - default: bool - dtb: str - id: str - initrd: str - kernel: str - organization: str - public: bool - title: str - project: str - zone: ScwZone """ Zone to target. If none is passed will use default zone from the config. @@ -377,37 +365,37 @@ class Volume: Volume Project ID. """ - export_uri: Optional[str] + tags: List[str] """ - Show the volume NBD export URI. + Volume tags. """ - creation_date: Optional[datetime] + state: VolumeState """ - Volume creation date. + Volume state. """ - modification_date: Optional[datetime] + zone: ScwZone """ - Volume modification date. + Zone in which the volume is located. """ - tags: List[str] + export_uri: Optional[str] = None """ - Volume tags. + Show the volume NBD export URI. """ - state: VolumeState + creation_date: Optional[datetime] = None """ - Volume state. + Volume creation date. """ - zone: ScwZone + modification_date: Optional[datetime] = None """ - Zone in which the volume is located. + Volume modification date. """ - server: Optional[ServerSummary] + server: Optional[ServerSummary] = None """ Instance attached to the volume. """ @@ -416,22 +404,19 @@ class Volume: @dataclass class VolumeSummary: id: str - name: str - size: int - volume_type: VolumeVolumeType @dataclass class ServerTypeNetworkInterface: - internal_bandwidth: Optional[int] + internal_bandwidth: Optional[int] = 0 """ Maximum internal bandwidth in bits per seconds. """ - internet_bandwidth: Optional[int] + internet_bandwidth: Optional[int] = 0 """ Maximum internet bandwidth in bits per seconds. """ @@ -453,37 +438,24 @@ class ServerTypeVolumeConstraintSizes: @dataclass class Image: id: str - name: str - arch: Arch - extra_volumes: Dict[str, Volume] - from_server: str - organization: str - - creation_date: Optional[datetime] - - modification_date: Optional[datetime] - - default_bootscript: Optional[Bootscript] - public: bool - state: ImageState - project: str - tags: List[str] - zone: ScwZone """ Zone to target. If none is passed will use default zone from the config. """ - root_volume: Optional[VolumeSummary] + creation_date: Optional[datetime] = None + modification_date: Optional[datetime] = None + default_bootscript: Optional[Bootscript] = None + root_volume: Optional[VolumeSummary] = None @dataclass @@ -571,14 +543,12 @@ class PrivateNIC: @dataclass class SecurityGroupSummary: id: str - name: str @dataclass class ServerFilesystem: filesystem_id: str - state: ServerFilesystemState @@ -656,53 +626,37 @@ class ServerIpv6: @dataclass class ServerLocation: cluster_id: str - hypervisor_id: str - node_id: str - platform_id: str - zone_id: str @dataclass class ServerMaintenance: reason: str - - start_date: Optional[datetime] + start_date: Optional[datetime] = None @dataclass class VolumeServer: id: str - - name: Optional[str] - - export_uri: Optional[str] - - organization: Optional[str] - - server: Optional[ServerSummary] - - size: Optional[int] - volume_type: VolumeServerVolumeType - boot: bool - zone: ScwZone """ Zone to target. If none is passed will use default zone from the config. """ - creation_date: Optional[datetime] - - modification_date: Optional[datetime] - - state: Optional[VolumeServerState] - - project: Optional[str] + name: Optional[str] = None + export_uri: Optional[str] = None + organization: Optional[str] = None + server: Optional[ServerSummary] = None + size: Optional[int] = None + creation_date: Optional[datetime] = None + modification_date: Optional[datetime] = None + state: Optional[VolumeServerState] = None + project: Optional[str] = None @dataclass @@ -730,7 +684,7 @@ class ServerTypeCapabilities: Max number of SFS (Scaleway File Systems) that can be attached to the Instance. """ - block_storage: Optional[bool] + block_storage: Optional[bool] = False """ Defines whether the Instance supports block storage. """ @@ -766,12 +720,12 @@ class ServerTypeNetwork: True if IPv6 is enabled. """ - sum_internal_bandwidth: Optional[int] + sum_internal_bandwidth: Optional[int] = 0 """ Total maximum internal bandwidth in bits per seconds. """ - sum_internet_bandwidth: Optional[int] + sum_internet_bandwidth: Optional[int] = 0 """ Total maximum internet bandwidth in bits per seconds. """ @@ -779,7 +733,7 @@ class ServerTypeNetwork: @dataclass class ServerTypeVolumeConstraintsByType: - l_ssd: Optional[ServerTypeVolumeConstraintSizes] + l_ssd: Optional[ServerTypeVolumeConstraintSizes] = None """ Local SSD volumes. """ @@ -793,7 +747,6 @@ class VolumeTypeCapabilities: @dataclass class VolumeTypeConstraints: min: int - max: int @@ -834,11 +787,6 @@ class Server: Instance commercial type (eg. GP1-M). """ - creation_date: Optional[datetime] - """ - Instance creation date. - """ - dynamic_ip_required: bool """ True if a dynamic IPv4 is required. @@ -914,62 +862,67 @@ class Server: True if the Instance type has reached end of service. """ - routed_ip_enabled: Optional[bool] + creation_date: Optional[datetime] = None + """ + Instance creation date. + """ + + routed_ip_enabled: Optional[bool] = False """ True to configure the instance so it uses the routed IP mode. Use of `routed_ip_enabled` as `False` is deprecated. """ - enable_ipv6: Optional[bool] + enable_ipv6: Optional[bool] = False """ True if IPv6 is enabled (deprecated and always `False` when `routed_ip_enabled` is `True`). """ - image: Optional[Image] + image: Optional[Image] = None """ Information about the Instance image. """ - private_ip: Optional[str] + private_ip: Optional[str] = None """ Private IP address of the Instance (deprecated and always `null` when `routed_ip_enabled` is `True`). """ - public_ip: Optional[ServerIp] + public_ip: Optional[ServerIp] = None """ Information about the public IP (deprecated in favor of `public_ips`). """ - modification_date: Optional[datetime] + modification_date: Optional[datetime] = None """ Instance modification date. """ - location: Optional[ServerLocation] + location: Optional[ServerLocation] = None """ Instance location. """ - ipv6: Optional[ServerIpv6] + ipv6: Optional[ServerIpv6] = None """ Instance IPv6 address (deprecated when `routed_ip_enabled` is `True`). """ - security_group: Optional[SecurityGroupSummary] + security_group: Optional[SecurityGroupSummary] = None """ Instance security group. """ - placement_group: Optional[PlacementGroup] + placement_group: Optional[PlacementGroup] = None """ Instance placement group. """ - admin_password_encryption_ssh_key_id: Optional[str] + admin_password_encryption_ssh_key_id: Optional[str] = None """ The public_key value of this key is used to encrypt the admin password. When set to an empty string, reset this value and admin_password_encrypted_value to an empty string so a new password may be generated. """ - admin_password_encrypted_value: Optional[str] + admin_password_encrypted_value: Optional[str] = None """ This value is reset when admin_password_encryption_ssh_key_id is set to an empty string. """ @@ -997,39 +950,29 @@ class VolumeTemplate: Type of the volume. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class Ip: id: str - address: str - organization: str - tags: List[str] - project: str - type_: IpType - state: IpState - prefix: str - ipam_id: str - zone: ScwZone """ Zone to target. If none is passed will use default zone from the config. """ - reverse: Optional[str] - - server: Optional[ServerSummary] + reverse: Optional[str] = None + server: Optional[ServerSummary] = None @dataclass @@ -1104,17 +1047,17 @@ class SecurityGroup: Zone in which the security group is located. """ - organization_default: Optional[bool] + organization_default: Optional[bool] = False """ True if it is your default security group for this Organization ID. """ - creation_date: Optional[datetime] + creation_date: Optional[datetime] = None """ Security group creation date. """ - modification_date: Optional[datetime] + modification_date: Optional[datetime] = None """ Security group modification date. """ @@ -1123,27 +1066,19 @@ class SecurityGroup: @dataclass class SecurityGroupRule: id: str - protocol: SecurityGroupRuleProtocol - direction: SecurityGroupRuleDirection - action: SecurityGroupRuleAction - ip_range: str - position: int - editable: bool - zone: ScwZone """ Zone to target. If none is passed will use default zone from the config. """ - dest_port_from: Optional[int] - - dest_port_to: Optional[int] + dest_port_from: Optional[int] = None + dest_port_to: Optional[int] = None @dataclass @@ -1153,37 +1088,37 @@ class VolumeServerTemplate: Type of the volume. """ - id: Optional[str] + id: Optional[str] = None """ UUID of the volume. """ - boot: Optional[bool] + boot: Optional[bool] = False """ Force the Instance to boot on this volume. """ - name: Optional[str] + name: Optional[str] = None """ Name of the volume. """ - size: Optional[int] + size: Optional[int] = 0 """ Disk size of the volume, must be a multiple of 512. """ - base_snapshot: Optional[str] + base_snapshot: Optional[str] = None """ ID of the snapshot on which this volume will be based. """ - organization: Optional[str] + organization: Optional[str] = None """ Organization ID of the volume. """ - project: Optional[str] + project: Optional[str] = None """ Project ID of the volume. """ @@ -1236,22 +1171,22 @@ class Snapshot: Snapshot zone. """ - base_volume: Optional[SnapshotBaseVolume] + base_volume: Optional[SnapshotBaseVolume] = None """ Volume on which the snapshot is based on. """ - creation_date: Optional[datetime] + creation_date: Optional[datetime] = None """ Snapshot creation date. """ - modification_date: Optional[datetime] + modification_date: Optional[datetime] = None """ Snapshot modification date. """ - error_reason: Optional[str] + error_reason: Optional[str] = None """ Reason for the failed snapshot import. """ @@ -1280,20 +1215,18 @@ class Task: """ href_from: str - href_result: str - zone: ScwZone """ Zone in which the task is executed. """ - started_at: Optional[datetime] + started_at: Optional[datetime] = None """ Task start date. """ - terminated_at: Optional[datetime] + terminated_at: Optional[datetime] = None """ Task end date. """ @@ -1302,34 +1235,20 @@ class Task: @dataclass class Dashboard: volumes_count: int - running_servers_count: int - servers_by_types: Dict[str, int] - images_count: int - snapshots_count: int - servers_count: int - ips_count: int - security_groups_count: int - ips_unused: int - volumes_l_ssd_count: int - volumes_l_ssd_total_size: int - private_nics_count: int - placement_groups_count: int - - volumes_b_ssd_count: Optional[int] - - volumes_b_ssd_total_size: Optional[int] + volumes_b_ssd_count: Optional[int] = None + volumes_b_ssd_total_size: Optional[int] = None @dataclass @@ -1357,11 +1276,6 @@ class GetServerTypesAvailabilityResponseAvailability: @dataclass class ServerType: - monthly_price: Optional[float] - """ - Estimated monthly price, for a 30 days month, in Euro. - """ - hourly_price: float """ Hourly price in Euro. @@ -1392,42 +1306,47 @@ class ServerType: True if this Instance type has reached end of service. """ - per_volume_constraint: Optional[ServerTypeVolumeConstraintsByType] + monthly_price: Optional[float] = 0.0 + """ + Estimated monthly price, for a 30 days month, in Euro. + """ + + per_volume_constraint: Optional[ServerTypeVolumeConstraintsByType] = None """ Additional volume constraints. """ - volumes_constraint: Optional[ServerTypeVolumeConstraintSizes] + volumes_constraint: Optional[ServerTypeVolumeConstraintSizes] = None """ Initial volume constraints. """ - gpu: Optional[int] + gpu: Optional[int] = 0 """ Number of GPU. """ - gpu_info: Optional[ServerTypeGPUInfo] + gpu_info: Optional[ServerTypeGPUInfo] = None """ GPU information. """ - network: Optional[ServerTypeNetwork] + network: Optional[ServerTypeNetwork] = None """ Network available for the Instance. """ - capabilities: Optional[ServerTypeCapabilities] + capabilities: Optional[ServerTypeCapabilities] = None """ Capabilities. """ - scratch_storage_max_size: Optional[int] + scratch_storage_max_size: Optional[int] = 0 """ Maximum available scratch storage. """ - block_bandwidth: Optional[int] + block_bandwidth: Optional[int] = 0 """ The maximum bandwidth allocated to block storage access (in bytes per second). """ @@ -1436,10 +1355,8 @@ class ServerType: @dataclass class VolumeType: display_name: str - - capabilities: Optional[VolumeTypeCapabilities] - - constraints: Optional[VolumeTypeConstraints] + capabilities: Optional[VolumeTypeCapabilities] = None + constraints: Optional[VolumeTypeConstraints] = None @dataclass @@ -1478,27 +1395,27 @@ class SetSecurityGroupRulesRequestRule: Position of this rule in the security group rules list. If several rules are passed with the same position, the resulting order is undefined. """ - id: Optional[str] + id: Optional[str] = None """ UUID of the security rule to update. If no value is provided, a new rule will be created. """ - dest_port_from: Optional[int] + dest_port_from: Optional[int] = 0 """ Beginning of the range of ports this rule applies to (inclusive). This value will be set to null if protocol is ICMP or ANY. """ - dest_port_to: Optional[int] + dest_port_to: Optional[int] = 0 """ End of the range of ports this rule applies to (inclusive). This value will be set to null if protocol is ICMP or ANY, or if it is equal to dest_port_from. """ - editable: Optional[bool] + editable: Optional[bool] = False """ Indicates if this rule is editable. Rules with the value false will be ignored. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone of the rule. This field is ignored. """ @@ -1515,7 +1432,6 @@ class VolumeImageUpdateTemplate: @dataclass class SecurityGroupTemplate: id: str - name: str @@ -1526,23 +1442,21 @@ class ApplyBlockMigrationRequest: A value to be retrieved from a call to the [Get a volume or snapshot's migration plan](#path-volumes-get-a-volume-or-snapshots-migration-plan) endpoint, to confirm that the volume and/or snapshots specified in said plan should be migrated. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - volume_id: Optional[str] + volume_id: Optional[str] = None - snapshot_id: Optional[str] + snapshot_id: Optional[str] = None @dataclass class AttachServerFileSystemRequest: server_id: str - filesystem_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1550,38 +1464,35 @@ class AttachServerFileSystemRequest: @dataclass class AttachServerFileSystemResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass class AttachServerVolumeRequest: server_id: str - volume_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - volume_type: Optional[AttachServerVolumeRequestVolumeType] - - boot: Optional[bool] + volume_type: Optional[AttachServerVolumeRequestVolumeType] = None + boot: Optional[bool] = None @dataclass class AttachServerVolumeResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass class CheckBlockMigrationOrganizationQuotasRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - organization: Optional[str] + organization: Optional[str] = None @dataclass @@ -1596,108 +1507,110 @@ class CreateImageRequest: Architecture of the image. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the image. """ - extra_volumes: Optional[Dict[str, VolumeTemplate]] + extra_volumes: Optional[Dict[str, VolumeTemplate]] = field(default_factory=dict) """ Additional volumes of the image. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the image. """ - public: Optional[bool] + public: Optional[bool] = False """ True to create a public image. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class CreateImageResponse: - image: Optional[Image] + image: Optional[Image] = None @dataclass class CreateIpRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the IP. """ - server: Optional[str] + server: Optional[str] = None """ UUID of the Instance you want to attach the IP to. """ - type_: Optional[IpType] + type_: Optional[IpType] = IpType.UNKNOWN_IPTYPE """ IP type to reserve (either 'routed_ipv4' or 'routed_ipv6'). """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class CreateIpResponse: - ip: Optional[Ip] + ip: Optional[Ip] = None @dataclass class CreatePlacementGroupRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the placement group. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the placement group. """ - policy_mode: Optional[PlacementGroupPolicyMode] + policy_mode: Optional[PlacementGroupPolicyMode] = PlacementGroupPolicyMode.OPTIONAL """ Operating mode of the placement group. """ - policy_type: Optional[PlacementGroupPolicyType] + policy_type: Optional[PlacementGroupPolicyType] = ( + PlacementGroupPolicyType.MAX_AVAILABILITY + ) """ Policy type of the placement group. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class CreatePlacementGroupResponse: - placement_group: Optional[PlacementGroup] + placement_group: Optional[PlacementGroup] = None @dataclass @@ -1712,22 +1625,22 @@ class CreatePrivateNICRequest: UUID of the private network where the private NIC will be attached. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Private NIC tags. """ - ip_ids: Optional[List[str]] + ip_ids: Optional[List[str]] = field(default_factory=list) """ Ip_ids defined from IPAM. """ - ipam_ip_ids: Optional[List[str]] + ipam_ip_ids: Optional[List[str]] = field(default_factory=list) """ UUID of IPAM ips, to be attached to the instance in the requested private network. """ @@ -1735,7 +1648,7 @@ class CreatePrivateNICRequest: @dataclass class CreatePrivateNICResponse: - private_nic: Optional[PrivateNIC] + private_nic: Optional[PrivateNIC] = None @dataclass @@ -1750,48 +1663,52 @@ class CreateSecurityGroupRequest: Whether the security group is stateful or not. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the security group. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the security group. """ - inbound_default_policy: Optional[SecurityGroupPolicy] + inbound_default_policy: Optional[SecurityGroupPolicy] = ( + SecurityGroupPolicy.UNKNOWN_POLICY + ) """ Default policy for inbound rules. """ - outbound_default_policy: Optional[SecurityGroupPolicy] + outbound_default_policy: Optional[SecurityGroupPolicy] = ( + SecurityGroupPolicy.UNKNOWN_POLICY + ) """ Default policy for outbound rules. """ - enable_default_security: Optional[bool] + enable_default_security: Optional[bool] = False """ True to block SMTP on IPv4 and IPv6. This feature is read only, please open a support ticket if you need to make it configurable. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None - organization_default: Optional[bool] + organization_default: Optional[bool] = False - project_default: Optional[bool] + project_default: Optional[bool] = False @dataclass class CreateSecurityGroupResponse: - security_group: Optional[SecurityGroup] + security_group: Optional[SecurityGroup] = None @dataclass @@ -1802,13 +1719,9 @@ class CreateSecurityGroupRuleRequest: """ protocol: SecurityGroupRuleProtocol - direction: SecurityGroupRuleDirection - action: SecurityGroupRuleAction - ip_range: str - position: int """ Position of this rule in the security group rules list. @@ -1819,17 +1732,17 @@ class CreateSecurityGroupRuleRequest: Indicates if this rule is editable (will be ignored). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - dest_port_from: Optional[int] + dest_port_from: Optional[int] = 0 """ Beginning of the range of ports to apply this rule to (inclusive). """ - dest_port_to: Optional[int] + dest_port_to: Optional[int] = 0 """ End of the range of ports to apply this rule to (inclusive). """ @@ -1837,190 +1750,189 @@ class CreateSecurityGroupRuleRequest: @dataclass class CreateSecurityGroupRuleResponse: - rule: Optional[SecurityGroupRule] + rule: Optional[SecurityGroupRule] = None @dataclass class CreateServerRequest: - zone: Optional[ScwZone] + commercial_type: str """ - Zone to target. If none is passed will use default zone from the config. + Define the Instance commercial type (i.e. GP1-S). """ - commercial_type: str + protected: bool """ - Define the Instance commercial type (i.e. GP1-S). + True to activate server protection option. + """ + + zone: Optional[ScwZone] = None + """ + Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Instance name. """ - dynamic_ip_required: Optional[bool] + dynamic_ip_required: Optional[bool] = False """ By default, `dynamic_ip_required` is true, a dynamic ip is attached to the instance (if no flexible ip is already attached). """ - routed_ip_enabled: Optional[bool] + routed_ip_enabled: Optional[bool] = False """ If true, configure the Instance so it uses the new routed IP mode. """ - image: Optional[str] + image: Optional[str] = None """ Instance image ID or label. """ - volumes: Optional[Dict[str, VolumeServerTemplate]] + volumes: Optional[Dict[str, VolumeServerTemplate]] = field(default_factory=dict) """ Volumes attached to the server. """ - enable_ipv6: Optional[bool] + enable_ipv6: Optional[bool] = False """ True if IPv6 is enabled on the server (deprecated and always `False` when `routed_ip_enabled` is `True`). """ - protected: bool - """ - True to activate server protection option. - """ - - public_ip: Optional[str] + public_ip: Optional[str] = None """ ID of the reserved IP to attach to the Instance. """ - public_ips: Optional[List[str]] + public_ips: Optional[List[str]] = field(default_factory=list) """ A list of reserved IP IDs to attach to the Instance. """ - boot_type: Optional[BootType] + boot_type: Optional[BootType] = BootType.LOCAL """ Boot type to use. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Instance tags. """ - security_group: Optional[str] + security_group: Optional[str] = None """ Security group ID. """ - placement_group: Optional[str] + placement_group: Optional[str] = None """ Placement group ID if Instance must be part of a placement group. """ - admin_password_encryption_ssh_key_id: Optional[str] + admin_password_encryption_ssh_key_id: Optional[str] = None """ The public_key value of this key is used to encrypt the admin password. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class CreateServerResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass class CreateSnapshotRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - volume_id: Optional[str] + volume_id: Optional[str] = None """ UUID of the volume. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the snapshot. """ - volume_type: Optional[SnapshotVolumeType] + volume_type: Optional[SnapshotVolumeType] = SnapshotVolumeType.UNKNOWN_VOLUME_TYPE """ Overrides the volume_type of the snapshot. If omitted, the volume type of the original volume will be used. """ - bucket: Optional[str] + bucket: Optional[str] = None """ Bucket name for snapshot imports. """ - key: Optional[str] + key: Optional[str] = None """ Object key for snapshot imports. """ - size: Optional[int] + size: Optional[int] = 0 """ Imported snapshot size, must be a multiple of 512. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class CreateSnapshotResponse: - snapshot: Optional[Snapshot] - - task: Optional[Task] + snapshot: Optional[Snapshot] = None + task: Optional[Task] = None @dataclass class CreateVolumeRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Volume name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Volume tags. """ - volume_type: Optional[VolumeVolumeType] + volume_type: Optional[VolumeVolumeType] = VolumeVolumeType.L_SSD """ Volume type. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None - size: Optional[int] + size: Optional[int] = 0 - base_snapshot: Optional[str] + base_snapshot: Optional[str] = None @dataclass class CreateVolumeResponse: - volume: Optional[Volume] + volume: Optional[Volume] = None @dataclass @@ -2030,7 +1942,7 @@ class DeleteImageRequest: UUID of the image you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2043,7 +1955,7 @@ class DeleteIpRequest: ID or address of the IP to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2056,7 +1968,7 @@ class DeletePlacementGroupRequest: UUID of the placement group you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2074,7 +1986,7 @@ class DeletePrivateNICRequest: Private NIC unique ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2087,7 +1999,7 @@ class DeleteSecurityGroupRequest: UUID of the security group you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2096,10 +2008,8 @@ class DeleteSecurityGroupRequest: @dataclass class DeleteSecurityGroupRuleRequest: security_group_id: str - security_group_rule_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2108,8 +2018,7 @@ class DeleteSecurityGroupRuleRequest: @dataclass class DeleteServerRequest: server_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2127,7 +2036,7 @@ class DeleteServerUserDataRequest: Key of the user data to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2140,7 +2049,7 @@ class DeleteSnapshotRequest: UUID of the snapshot you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2153,7 +2062,7 @@ class DeleteVolumeRequest: UUID of the volume you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2162,10 +2071,8 @@ class DeleteVolumeRequest: @dataclass class DetachServerFileSystemRequest: server_id: str - filesystem_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2173,16 +2080,14 @@ class DetachServerFileSystemRequest: @dataclass class DetachServerFileSystemResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass class DetachServerVolumeRequest: server_id: str - volume_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2190,7 +2095,7 @@ class DetachServerVolumeRequest: @dataclass class DetachServerVolumeResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass @@ -2210,7 +2115,7 @@ class ExportSnapshotRequest: Snapshot ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2218,24 +2123,23 @@ class ExportSnapshotRequest: @dataclass class ExportSnapshotResponse: - task: Optional[Task] + task: Optional[Task] = None @dataclass class GetDashboardRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - organization: Optional[str] - - project: Optional[str] + organization: Optional[str] = None + project: Optional[str] = None @dataclass class GetDashboardResponse: - dashboard: Optional[Dashboard] + dashboard: Optional[Dashboard] = None @dataclass @@ -2245,7 +2149,7 @@ class GetImageRequest: UUID of the image you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2253,7 +2157,7 @@ class GetImageRequest: @dataclass class GetImageResponse: - image: Optional[Image] + image: Optional[Image] = None @dataclass @@ -2263,7 +2167,7 @@ class GetIpRequest: IP ID or address to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2271,7 +2175,7 @@ class GetIpRequest: @dataclass class GetIpResponse: - ip: Optional[Ip] + ip: Optional[Ip] = None @dataclass @@ -2281,7 +2185,7 @@ class GetPlacementGroupRequest: UUID of the placement group you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2289,7 +2193,7 @@ class GetPlacementGroupRequest: @dataclass class GetPlacementGroupResponse: - placement_group: Optional[PlacementGroup] + placement_group: Optional[PlacementGroup] = None @dataclass @@ -2299,7 +2203,7 @@ class GetPlacementGroupServersRequest: UUID of the placement group you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2325,7 +2229,7 @@ class GetPrivateNICRequest: Private NIC unique ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2333,7 +2237,7 @@ class GetPrivateNICRequest: @dataclass class GetPrivateNICResponse: - private_nic: Optional[PrivateNIC] + private_nic: Optional[PrivateNIC] = None @dataclass @@ -2343,7 +2247,7 @@ class GetSecurityGroupRequest: UUID of the security group you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2351,16 +2255,14 @@ class GetSecurityGroupRequest: @dataclass class GetSecurityGroupResponse: - security_group: Optional[SecurityGroup] + security_group: Optional[SecurityGroup] = None @dataclass class GetSecurityGroupRuleRequest: security_group_id: str - security_group_rule_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2368,7 +2270,7 @@ class GetSecurityGroupRuleRequest: @dataclass class GetSecurityGroupRuleResponse: - rule: Optional[SecurityGroupRule] + rule: Optional[SecurityGroupRule] = None @dataclass @@ -2378,7 +2280,7 @@ class GetServerCompatibleTypesRequest: UUID of the Instance you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2391,7 +2293,7 @@ class GetServerRequest: UUID of the Instance you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2399,22 +2301,22 @@ class GetServerRequest: @dataclass class GetServerResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass class GetServerTypesAvailabilityRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ @@ -2437,7 +2339,7 @@ class GetSnapshotRequest: UUID of the snapshot you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2445,7 +2347,7 @@ class GetSnapshotRequest: @dataclass class GetSnapshotResponse: - snapshot: Optional[Snapshot] + snapshot: Optional[Snapshot] = None @dataclass @@ -2455,7 +2357,7 @@ class GetVolumeRequest: UUID of the volume you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2463,12 +2365,12 @@ class GetVolumeRequest: @dataclass class GetVolumeResponse: - volume: Optional[Volume] + volume: Optional[Volume] = None @dataclass class ListDefaultSecurityGroupRulesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2476,26 +2378,19 @@ class ListDefaultSecurityGroupRulesRequest: @dataclass class ListImagesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - organization: Optional[str] - - per_page: Optional[int] - - page: Optional[int] - - name: Optional[str] - - public: Optional[bool] - - arch: Optional[str] - - project: Optional[str] - - tags: Optional[str] + organization: Optional[str] = None + per_page: Optional[int] = None + page: Optional[int] = None + name: Optional[str] = None + public: Optional[bool] = None + arch: Optional[str] = None + project: Optional[str] = None + tags: Optional[str] = None @dataclass @@ -2513,42 +2408,42 @@ class ListImagesResponse: @dataclass class ListIpsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project: Optional[str] + project: Optional[str] = None """ Project ID in which the IPs are reserved. """ - organization: Optional[str] + organization: Optional[str] = None """ Organization ID in which the IPs are reserved. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ Filter IPs with these exact tags (to filter with several tags, use commas to separate them). """ - name: Optional[str] + name: Optional[str] = None """ Filter on the IP address (Works as a LIKE operation on the IP address). """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ - type_: Optional[str] + type_: Optional[str] = None """ Filter on the IP Mobility IP type (whose value should be either 'routed_ipv4' or 'routed_ipv6'). """ @@ -2569,37 +2464,37 @@ class ListIpsResponse: @dataclass class ListPlacementGroupsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ - organization: Optional[str] + organization: Optional[str] = None """ List only placement groups of this Organization ID. """ - project: Optional[str] + project: Optional[str] = None """ List only placement groups of this Project ID. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ List placement groups with these exact tags (to filter with several tags, use commas to separate them). """ - name: Optional[str] + name: Optional[str] = None """ Filter placement groups by name (for eg. "cluster1" will return "cluster100" and "cluster1" but not "foo"). """ @@ -2625,22 +2520,22 @@ class ListPrivateNICsRequest: Instance to which the private NIC is attached. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ Private NIC tags. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ @@ -2649,7 +2544,6 @@ class ListPrivateNICsRequest: @dataclass class ListPrivateNICsResponse: private_nics: List[PrivateNIC] - total_count: int @@ -2660,17 +2554,17 @@ class ListSecurityGroupRulesRequest: UUID of the security group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ @@ -2691,42 +2585,42 @@ class ListSecurityGroupRulesResponse: @dataclass class ListSecurityGroupsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the security group. """ - organization: Optional[str] + organization: Optional[str] = None """ Security group Organization ID. """ - project: Optional[str] + project: Optional[str] = None """ Security group Project ID. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ List security groups with these exact tags (to filter with several tags, use commas to separate them). """ - project_default: Optional[bool] + project_default: Optional[bool] = False """ Filter security groups with this value for project_default. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ @@ -2748,8 +2642,7 @@ class ListSecurityGroupsResponse: @dataclass class ListServerActionsRequest: server_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2767,7 +2660,7 @@ class ListServerUserDataRequest: UUID of the Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2780,87 +2673,89 @@ class ListServerUserDataResponse: @dataclass class ListServersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ - organization: Optional[str] + organization: Optional[str] = None """ List only Instances of this Organization ID. """ - project: Optional[str] + project: Optional[str] = None """ List only Instances of this Project ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter Instances by name (eg. "server1" will return "server100" and "server1" but not "foo"). """ - private_ip: Optional[str] + private_ip: Optional[str] = None """ List Instances by private_ip. """ - without_ip: Optional[bool] + without_ip: Optional[bool] = False """ List Instances that are not attached to a public IP. """ - with_ip: Optional[str] + with_ip: Optional[str] = None """ List Instances by IP (both private_ip and public_ip are supported). """ - commercial_type: Optional[str] + commercial_type: Optional[str] = None """ List Instances of this commercial type. """ - state: Optional[ServerState] + state: Optional[ServerState] = ServerState.RUNNING """ List Instances in this state. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ List Instances with these exact tags (to filter with several tags, use commas to separate them). """ - private_network: Optional[str] + private_network: Optional[str] = None """ List Instances in this Private Network. """ - order: Optional[ListServersRequestOrder] + order: Optional[ListServersRequestOrder] = ( + ListServersRequestOrder.CREATION_DATE_DESC + ) """ Define the order of the returned servers. """ - private_networks: Optional[List[str]] + private_networks: Optional[List[str]] = None """ List Instances from the given Private Networks (use commas to separate them). """ - private_nic_mac_address: Optional[str] + private_nic_mac_address: Optional[str] = None """ List Instances associated with the given private NIC MAC address. """ - servers: Optional[List[str]] + servers: Optional[List[str]] = None """ List Instances from these server ids (use commas to separate them). """ @@ -2881,14 +2776,13 @@ class ListServersResponse: @dataclass class ListServersTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] - - page: Optional[int] + per_page: Optional[int] = None + page: Optional[int] = None @dataclass @@ -2906,42 +2800,42 @@ class ListServersTypesResponse: @dataclass class ListSnapshotsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - organization: Optional[str] + organization: Optional[str] = None """ List snapshots only for this Organization ID. """ - project: Optional[str] + project: Optional[str] = None """ List snapshots only for this Project ID. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ Number of snapshots returned per page (positive integer lower or equal to 100). """ - page: Optional[int] + page: Optional[int] = 0 """ Page to be returned. """ - name: Optional[str] + name: Optional[str] = None """ List snapshots of the requested name. """ - tags: Optional[str] + tags: Optional[str] = None """ List snapshots that have the requested tag. """ - base_volume_id: Optional[str] + base_volume_id: Optional[str] = None """ List snapshots originating only from this volume. """ @@ -2962,42 +2856,42 @@ class ListSnapshotsResponse: @dataclass class ListVolumesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - volume_type: Optional[VolumeVolumeType] + volume_type: Optional[VolumeVolumeType] = VolumeVolumeType.L_SSD """ Filter by volume type. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ - organization: Optional[str] + organization: Optional[str] = None """ Filter volume by Organization ID. """ - project: Optional[str] + project: Optional[str] = None """ Filter volume by Project ID. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ Filter volumes with these exact tags (to filter with several tags, use commas to separate them). """ - name: Optional[str] + name: Optional[str] = None """ Filter volume by name (for eg. "vol" will return "myvolume" but not "data"). """ @@ -3018,14 +2912,13 @@ class ListVolumesResponse: @dataclass class ListVolumesTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] - - page: Optional[int] + per_page: Optional[int] = None + page: Optional[int] = None @dataclass @@ -3053,7 +2946,7 @@ class MigrationPlan: A value to be passed to the call to the [Migrate a volume and/or snapshots to SBS](#path-volumes-migrate-a-volume-andor-snapshots-to-sbs-scaleway-block-storage) endpoint, to confirm that the execution of the plan is being requested. """ - volume: Optional[Volume] + volume: Optional[Volume] = None """ A volume which will be migrated to SBS together with the snapshots, if present. """ @@ -3061,14 +2954,14 @@ class MigrationPlan: @dataclass class PlanBlockMigrationRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - volume_id: Optional[str] + volume_id: Optional[str] = None - snapshot_id: Optional[str] + snapshot_id: Optional[str] = None @dataclass @@ -3078,29 +2971,31 @@ class ServerActionRequest: UUID of the Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - action: Optional[ServerAction] + action: Optional[ServerAction] = ServerAction.POWERON """ Action to perform on the Instance. """ - name: Optional[str] + name: Optional[str] = None """ Name of the backup you want to create. This field should only be specified when performing a backup action. """ - volumes: Optional[Dict[str, ServerActionRequestVolumeBackupTemplate]] + volumes: Optional[Dict[str, ServerActionRequestVolumeBackupTemplate]] = field( + default_factory=dict + ) """ For each volume UUID, the snapshot parameters of the volume. This field should only be specified when performing a backup action. """ - disable_ipv6: Optional[bool] + disable_ipv6: Optional[bool] = False """ Disable IPv6 on the Instance while performing migration to routed IPs. This field should only be specified when performing a enable_routed_ip action. @@ -3109,7 +3004,7 @@ class ServerActionRequest: @dataclass class ServerActionResponse: - task: Optional[Task] + task: Optional[Task] = None @dataclass @@ -3122,65 +3017,46 @@ class ServerCompatibleTypes: @dataclass class SetImageRequest: - zone: Optional[ScwZone] - """ - Zone to target. If none is passed will use default zone from the config. - """ - id: str - name: str - - arch: Optional[Arch] - - creation_date: Optional[datetime] - - modification_date: Optional[datetime] - from_server: str - public: bool + zone: Optional[ScwZone] = None + """ + Zone to target. If none is passed will use default zone from the config. + """ - default_bootscript: Optional[Bootscript] - - extra_volumes: Optional[Dict[str, Volume]] - - organization: Optional[str] - - root_volume: Optional[VolumeSummary] - - state: Optional[ImageState] - - project: Optional[str] - - tags: Optional[List[str]] + arch: Optional[Arch] = None + creation_date: Optional[datetime] = None + modification_date: Optional[datetime] = None + default_bootscript: Optional[Bootscript] = None + extra_volumes: Optional[Dict[str, Volume]] = None + organization: Optional[str] = None + root_volume: Optional[VolumeSummary] = None + state: Optional[ImageState] = None + project: Optional[str] = None + tags: Optional[List[str]] = None @dataclass class SetPlacementGroupRequest: placement_group_id: str - name: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - organization: Optional[str] - - policy_mode: Optional[PlacementGroupPolicyMode] - - policy_type: Optional[PlacementGroupPolicyType] - - project: Optional[str] - - tags: Optional[List[str]] + organization: Optional[str] = None + policy_mode: Optional[PlacementGroupPolicyMode] = None + policy_type: Optional[PlacementGroupPolicyType] = None + project: Optional[str] = None + tags: Optional[List[str]] = None @dataclass class SetPlacementGroupResponse: - placement_group: Optional[PlacementGroup] + placement_group: Optional[PlacementGroup] = None @dataclass @@ -3195,7 +3071,7 @@ class SetPlacementGroupServersRequest: An array of the Instances' UUIDs you want to configure. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3216,12 +3092,14 @@ class SetSecurityGroupRulesRequest: UUID of the security group to update the rules on. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - rules: Optional[List[SetSecurityGroupRulesRequestRule]] + rules: Optional[List[SetSecurityGroupRulesRequestRule]] = field( + default_factory=list + ) """ List of rules to update in the security group. """ @@ -3239,32 +3117,34 @@ class UpdateImageRequest: UUID of the image. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the image. """ - arch: Optional[Arch] + arch: Optional[Arch] = Arch.UNKNOWN_ARCH """ Architecture of the image. """ - extra_volumes: Optional[Dict[str, VolumeImageUpdateTemplate]] + extra_volumes: Optional[Dict[str, VolumeImageUpdateTemplate]] = field( + default_factory=dict + ) """ Additional snapshots of the image, with extra_volumeKey being the position of the snapshot in the image. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the image. """ - public: Optional[bool] + public: Optional[bool] = False """ True to set the image as public. """ @@ -3272,7 +3152,7 @@ class UpdateImageRequest: @dataclass class UpdateImageResponse: - image: Optional[Image] + image: Optional[Image] = None @dataclass @@ -3282,32 +3162,32 @@ class UpdateIpRequest: IP ID or IP address. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse domain name. """ - type_: Optional[IpType] + type_: Optional[IpType] = IpType.UNKNOWN_IPTYPE """ Should have no effect. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ An array of keywords you want to tag this IP with. """ - server: Optional[str] + server: Optional[str] = None @dataclass class UpdateIpResponse: - ip: Optional[Ip] + ip: Optional[Ip] = None @dataclass @@ -3317,27 +3197,29 @@ class UpdatePlacementGroupRequest: UUID of the placement group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the placement group. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the placement group. """ - policy_mode: Optional[PlacementGroupPolicyMode] + policy_mode: Optional[PlacementGroupPolicyMode] = PlacementGroupPolicyMode.OPTIONAL """ Operating mode of the placement group. """ - policy_type: Optional[PlacementGroupPolicyType] + policy_type: Optional[PlacementGroupPolicyType] = ( + PlacementGroupPolicyType.MAX_AVAILABILITY + ) """ Policy type of the placement group. """ @@ -3345,7 +3227,7 @@ class UpdatePlacementGroupRequest: @dataclass class UpdatePlacementGroupResponse: - placement_group: Optional[PlacementGroup] + placement_group: Optional[PlacementGroup] = None @dataclass @@ -3360,7 +3242,7 @@ class UpdatePlacementGroupServersRequest: An array of the Instances' UUIDs you want to configure. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3386,12 +3268,12 @@ class UpdatePrivateNICRequest: Private NIC unique ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags used to select private NIC/s. """ @@ -3404,52 +3286,56 @@ class UpdateSecurityGroupRequest: UUID of the security group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the security group. """ - description: Optional[str] + description: Optional[str] = None """ Description of the security group. """ - enable_default_security: Optional[bool] + enable_default_security: Optional[bool] = False """ True to block SMTP on IPv4 and IPv6. This feature is read only, please open a support ticket if you need to make it configurable. """ - inbound_default_policy: Optional[SecurityGroupPolicy] + inbound_default_policy: Optional[SecurityGroupPolicy] = ( + SecurityGroupPolicy.UNKNOWN_POLICY + ) """ Default inbound policy. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the security group. """ - organization_default: Optional[bool] + organization_default: Optional[bool] = False """ Please use project_default instead. """ - project_default: Optional[bool] + project_default: Optional[bool] = False """ True use this security group for future Instances created in this project. """ - outbound_default_policy: Optional[SecurityGroupPolicy] + outbound_default_policy: Optional[SecurityGroupPolicy] = ( + SecurityGroupPolicy.UNKNOWN_POLICY + ) """ Default outbound policy. """ - stateful: Optional[bool] + stateful: Optional[bool] = False """ True to set the security group as stateful. """ @@ -3457,7 +3343,7 @@ class UpdateSecurityGroupRequest: @dataclass class UpdateSecurityGroupResponse: - security_group: Optional[SecurityGroup] + security_group: Optional[SecurityGroup] = None @dataclass @@ -3472,42 +3358,46 @@ class UpdateSecurityGroupRuleRequest: UUID of the rule. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - protocol: Optional[SecurityGroupRuleProtocol] + protocol: Optional[SecurityGroupRuleProtocol] = ( + SecurityGroupRuleProtocol.UNKNOWN_PROTOCOL + ) """ Protocol family this rule applies to. """ - direction: Optional[SecurityGroupRuleDirection] + direction: Optional[SecurityGroupRuleDirection] = ( + SecurityGroupRuleDirection.UNKNOWN_DIRECTION + ) """ Direction the rule applies to. """ - action: Optional[SecurityGroupRuleAction] + action: Optional[SecurityGroupRuleAction] = SecurityGroupRuleAction.UNKNOWN_ACTION """ Action to apply when the rule matches a packet. """ - ip_range: Optional[str] + ip_range: Optional[str] = None """ Range of IP addresses these rules apply to. """ - dest_port_from: Optional[int] + dest_port_from: Optional[int] = 0 """ Beginning of the range of ports this rule applies to (inclusive). If 0 is provided, unset the parameter. """ - dest_port_to: Optional[int] + dest_port_to: Optional[int] = 0 """ End of the range of ports this rule applies to (inclusive). If 0 is provided, unset the parameter. """ - position: Optional[int] + position: Optional[int] = 0 """ Position of this rule in the security group rules list. """ @@ -3515,7 +3405,7 @@ class UpdateSecurityGroupRuleRequest: @dataclass class UpdateSecurityGroupRuleResponse: - rule: Optional[SecurityGroupRule] + rule: Optional[SecurityGroupRule] = None @dataclass @@ -3525,57 +3415,52 @@ class UpdateServerRequest: UUID of the Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Instance. """ - boot_type: Optional[BootType] - - tags: Optional[List[str]] + boot_type: Optional[BootType] = BootType.LOCAL + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Instance. """ - volumes: Optional[Dict[str, VolumeServerTemplate]] - - dynamic_ip_required: Optional[bool] - - routed_ip_enabled: Optional[bool] + volumes: Optional[Dict[str, VolumeServerTemplate]] = field(default_factory=dict) + dynamic_ip_required: Optional[bool] = False + routed_ip_enabled: Optional[bool] = False """ True to configure the instance so it uses the new routed IP mode (once this is set to True you cannot set it back to False). """ - public_ips: Optional[List[str]] + public_ips: Optional[List[str]] = field(default_factory=list) """ A list of reserved IP IDs to attach to the Instance. """ - enable_ipv6: Optional[bool] - - protected: Optional[bool] + enable_ipv6: Optional[bool] = False + protected: Optional[bool] = False """ True to activate server protection option. """ - security_group: Optional[SecurityGroupTemplate] - - placement_group: Optional[str] + security_group: Optional[SecurityGroupTemplate] = None + placement_group: Optional[str] = None """ Placement group ID if Instance must be part of a placement group. """ - private_nics: Optional[List[str]] + private_nics: Optional[List[str]] = field(default_factory=list) """ Instance private NICs. """ - commercial_type: Optional[str] + commercial_type: Optional[str] = None """ Warning: This field has some restrictions: - Cannot be changed if the Instance is not in `stopped` state. @@ -3584,7 +3469,7 @@ class UpdateServerRequest: - Local storage requirements of the target commercial_types must be fulfilled (i.e. if an Instance has 80GB of local storage, it can be changed into a GP1-XS, which has a maximum of 150GB, but it cannot be changed into a DEV1-S, which has only 20GB). """ - admin_password_encryption_ssh_key_id: Optional[str] + admin_password_encryption_ssh_key_id: Optional[str] = None """ The public_key value of this key is used to encrypt the admin password. When set to an empty string, reset this value and admin_password_encrypted_value to an empty string so a new password may be generated. """ @@ -3592,7 +3477,7 @@ class UpdateServerRequest: @dataclass class UpdateServerResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass @@ -3602,17 +3487,17 @@ class UpdateSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the snapshot. """ @@ -3620,7 +3505,7 @@ class UpdateSnapshotRequest: @dataclass class UpdateSnapshotResponse: - snapshot: Optional[Snapshot] + snapshot: Optional[Snapshot] = None @dataclass @@ -3630,22 +3515,22 @@ class UpdateVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Volume name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the volume. """ - size: Optional[int] + size: Optional[int] = 0 """ Volume disk size, must be a multiple of 512. """ @@ -3653,4 +3538,4 @@ class UpdateVolumeRequest: @dataclass class UpdateVolumeResponse: - volume: Optional[Volume] + volume: Optional[Volume] = None diff --git a/scaleway-async/scaleway_async/interlink/v1beta1/marshalling.py b/scaleway-async/scaleway_async/interlink/v1beta1/marshalling.py index 477ccc33b..8f54d2528 100644 --- a/scaleway-async/scaleway_async/interlink/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/interlink/v1beta1/marshalling.py @@ -10,6 +10,9 @@ resolve_one_of, ) from .types import ( + BgpStatus, + DedicatedConnectionStatus, + LinkStatus, DedicatedConnection, BgpConfig, PartnerHost, @@ -44,42 +47,62 @@ def unmarshal_DedicatedConnection(data: Any) -> DedicatedConnection: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DedicatedConnectionStatus.UNKNOWN_STATUS field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("pop_id", None) if field is not None: args["pop_id"] = field + else: + args["pop_id"] = None field = data.get("bandwidth_mbps", None) if field is not None: args["bandwidth_mbps"] = field + else: + args["bandwidth_mbps"] = 0 field = data.get("available_link_bandwidths", None) if field is not None: args["available_link_bandwidths"] = field + else: + args["available_link_bandwidths"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -113,14 +136,20 @@ def unmarshal_BgpConfig(data: Any) -> BgpConfig: field = data.get("asn", None) if field is not None: args["asn"] = field + else: + args["asn"] = 0 field = data.get("ipv4", None) if field is not None: args["ipv4"] = field + else: + args["ipv4"] = None field = data.get("ipv6", None) if field is not None: args["ipv6"] = field + else: + args["ipv6"] = None return BgpConfig(**args) @@ -136,10 +165,14 @@ def unmarshal_PartnerHost(data: Any) -> PartnerHost: field = data.get("partner_id", None) if field is not None: args["partner_id"] = field + else: + args["partner_id"] = None field = data.get("pairing_key", None) if field is not None: args["pairing_key"] = field + else: + args["pairing_key"] = None field = data.get("disapproved_reason", None) if field is not None: @@ -161,6 +194,8 @@ def unmarshal_SelfHost(data: Any) -> SelfHost: field = data.get("connection_id", None) if field is not None: args["connection_id"] = field + else: + args["connection_id"] = None return SelfHost(**args) @@ -176,54 +211,80 @@ def unmarshal_Link(data: Any) -> Link: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("pop_id", None) if field is not None: args["pop_id"] = field + else: + args["pop_id"] = None field = data.get("bandwidth_mbps", None) if field is not None: args["bandwidth_mbps"] = field + else: + args["bandwidth_mbps"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = LinkStatus.UNKNOWN_LINK_STATUS field = data.get("bgp_v4_status", None) if field is not None: args["bgp_v4_status"] = field + else: + args["bgp_v4_status"] = BgpStatus.UNKNOWN_BGP_STATUS field = data.get("bgp_v6_status", None) if field is not None: args["bgp_v6_status"] = field + else: + args["bgp_v6_status"] = BgpStatus.UNKNOWN_BGP_STATUS field = data.get("enable_route_propagation", None) if field is not None: args["enable_route_propagation"] = field + else: + args["enable_route_propagation"] = False field = data.get("vlan", None) if field is not None: args["vlan"] = field + else: + args["vlan"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("vpc_id", None) if field is not None: @@ -299,22 +360,32 @@ def unmarshal_Partner(data: Any) -> Partner: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("contact_email", None) if field is not None: args["contact_email"] = field + else: + args["contact_email"] = None field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("portal_url", None) if field is not None: args["portal_url"] = field + else: + args["portal_url"] = None field = data.get("created_at", None) if field is not None: @@ -342,34 +413,50 @@ def unmarshal_Pop(data: Any) -> Pop: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("hosting_provider_name", None) if field is not None: args["hosting_provider_name"] = field + else: + args["hosting_provider_name"] = None field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("city", None) if field is not None: args["city"] = field + else: + args["city"] = None field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("available_link_bandwidths_mbps", None) if field is not None: args["available_link_bandwidths_mbps"] = field + else: + args["available_link_bandwidths_mbps"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None return Pop(**args) @@ -385,38 +472,56 @@ def unmarshal_RoutingPolicy(data: Any) -> RoutingPolicy: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("prefix_filter_in", None) if field is not None: args["prefix_filter_in"] = field + else: + args["prefix_filter_in"] = field(default_factory=list) field = data.get("prefix_filter_out", None) if field is not None: args["prefix_filter_out"] = field + else: + args["prefix_filter_out"] = field(default_factory=list) field = data.get("is_ipv6", None) if field is not None: args["is_ipv6"] = field + else: + args["is_ipv6"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -450,10 +555,14 @@ def unmarshal_ListDedicatedConnectionsResponse( if field is not None else None ) + else: + args["connections"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDedicatedConnectionsResponse(**args) @@ -471,10 +580,14 @@ def unmarshal_ListLinksResponse(data: Any) -> ListLinksResponse: args["links"] = ( [unmarshal_Link(v) for v in field] if field is not None else None ) + else: + args["links"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListLinksResponse(**args) @@ -492,10 +605,14 @@ def unmarshal_ListPartnersResponse(data: Any) -> ListPartnersResponse: args["partners"] = ( [unmarshal_Partner(v) for v in field] if field is not None else None ) + else: + args["partners"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPartnersResponse(**args) @@ -511,10 +628,14 @@ def unmarshal_ListPopsResponse(data: Any) -> ListPopsResponse: field = data.get("pops", None) if field is not None: args["pops"] = [unmarshal_Pop(v) for v in field] if field is not None else None + else: + args["pops"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPopsResponse(**args) @@ -532,10 +653,14 @@ def unmarshal_ListRoutingPoliciesResponse(data: Any) -> ListRoutingPoliciesRespo args["routing_policies"] = ( [unmarshal_RoutingPolicy(v) for v in field] if field is not None else None ) + else: + args["routing_policies"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListRoutingPoliciesResponse(**args) @@ -594,7 +719,9 @@ def marshal_CreateLinkRequest( output["bandwidth_mbps"] = request.bandwidth_mbps if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -621,7 +748,9 @@ def marshal_CreateRoutingPolicyRequest( output["is_ipv6"] = request.is_ipv6 if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway-async/scaleway_async/interlink/v1beta1/types.py b/scaleway-async/scaleway_async/interlink/v1beta1/types.py index 56696a502..103ac7581 100644 --- a/scaleway-async/scaleway_async/interlink/v1beta1/types.py +++ b/scaleway-async/scaleway_async/interlink/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -147,7 +147,7 @@ class PartnerHost: Used to identify a link from a user or partner's point of view. """ - disapproved_reason: Optional[str] + disapproved_reason: Optional[str] = None """ Reason given by partner to explain why they did not approve the request for a hosted link. """ @@ -213,17 +213,17 @@ class DedicatedConnection: Region of the dedicated connection. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the dedicated connection. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the dedicated connection. """ - demarcation_info: Optional[str] + demarcation_info: Optional[str] = None """ Demarcation details required by the data center to set up the supporting Cross Connect. This generally includes the physical space in the facility, the cabinet or rack the connection should land in, the patch panel to go in, the port designation, and the media type. """ @@ -286,59 +286,59 @@ class Link: Defines whether route propagation is enabled or not. To enable or disable route propagation, use the dedicated endpoint. """ - vpc_id: Optional[str] + vlan: int """ - ID of the Scaleway VPC attached to the link. + VLAN of the link. """ - routing_policy_id: Optional[str] + region: ScwRegion """ - Deprecated. Use routing_policy_v4_id or routing_policy_v6_id instead. + Region of the link. """ - created_at: Optional[datetime] + vpc_id: Optional[str] = None """ - Creation date of the link. + ID of the Scaleway VPC attached to the link. """ - updated_at: Optional[datetime] + routing_policy_id: Optional[str] = None """ - Last modification date of the link. + Deprecated. Use routing_policy_v4_id or routing_policy_v6_id instead. """ - vlan: int + created_at: Optional[datetime] = None """ - VLAN of the link. + Creation date of the link. """ - region: ScwRegion + updated_at: Optional[datetime] = None """ - Region of the link. + Last modification date of the link. """ - scw_bgp_config: Optional[BgpConfig] + scw_bgp_config: Optional[BgpConfig] = None """ BGP configuration on Scaleway's side. """ - peer_bgp_config: Optional[BgpConfig] + peer_bgp_config: Optional[BgpConfig] = None """ BGP configuration on peer's side (on-premises or other hosting provider). """ - routing_policy_v4_id: Optional[str] + routing_policy_v4_id: Optional[str] = None """ ID of the routing policy IPv4 attached to the link. """ - routing_policy_v6_id: Optional[str] + routing_policy_v6_id: Optional[str] = None """ ID of the routing policy IPv6 attached to the link. """ - partner: Optional[PartnerHost] + partner: Optional[PartnerHost] = None - self_: Optional[SelfHost] + self_: Optional[SelfHost] = None @dataclass @@ -368,12 +368,12 @@ class Partner: URL of the partner's portal. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the partner. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the partner. """ @@ -469,12 +469,12 @@ class RoutingPolicy: Region of the routing policy. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the routing policy. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the routing policy. """ @@ -492,7 +492,7 @@ class AttachRoutingPolicyRequest: ID of the routing policy to be attached. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -510,7 +510,7 @@ class AttachVpcRequest: ID of the VPC to attach. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -533,34 +533,34 @@ class CreateLinkRequest: Desired bandwidth for the link. Must be compatible with available link bandwidths and remaining bandwidth capacity of the connection. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to create the link in. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the link. """ - peer_asn: Optional[int] + peer_asn: Optional[int] = 0 """ For self-hosted links we need the peer AS Number to establish BGP session. If not given, a default one will be assigned. """ - vlan: Optional[int] + vlan: Optional[int] = 0 """ For self-hosted links only, it is possible to choose the VLAN ID. If the VLAN is not available (ie already taken or out of range), an error is returned. """ - connection_id: Optional[str] + connection_id: Optional[str] = None - partner_id: Optional[str] + partner_id: Optional[str] = None @dataclass @@ -575,27 +575,27 @@ class CreateRoutingPolicyRequest: IP prefixes version of the routing policy. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to create the routing policy in. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the routing policy. """ - prefix_filter_in: Optional[List[str]] + prefix_filter_in: Optional[List[str]] = field(default_factory=list) """ IP prefixes to accept from the peer (ranges of route announcements to accept). """ - prefix_filter_out: Optional[List[str]] + prefix_filter_out: Optional[List[str]] = field(default_factory=list) """ IP prefix filters to advertise to the peer (ranges of routes to advertise). """ @@ -608,7 +608,7 @@ class DeleteLinkRequest: ID of the link to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -621,7 +621,7 @@ class DeleteRoutingPolicyRequest: ID of the routing policy to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -639,7 +639,7 @@ class DetachRoutingPolicyRequest: ID of the routing policy to be detached. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -652,7 +652,7 @@ class DetachVpcRequest: ID of the link to detach the VPC from. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -665,7 +665,7 @@ class DisableRoutePropagationRequest: ID of the link on which to disable route propagation. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -678,7 +678,7 @@ class EnableRoutePropagationRequest: ID of the link on which to enable route propagation. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -691,7 +691,7 @@ class GetDedicatedConnectionRequest: ID of connection to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -704,7 +704,7 @@ class GetLinkRequest: ID of the link to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -717,7 +717,7 @@ class GetPartnerRequest: ID of partner to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -730,7 +730,7 @@ class GetPopRequest: ID of PoP to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -743,7 +743,7 @@ class GetRoutingPolicyRequest: ID of the routing policy to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -751,57 +751,61 @@ class GetRoutingPolicyRequest: @dataclass class ListDedicatedConnectionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListDedicatedConnectionsRequestOrderBy] + order_by: Optional[ListDedicatedConnectionsRequestOrderBy] = ( + ListDedicatedConnectionsRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of connections to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. """ - name: Optional[str] + name: Optional[str] = None """ Link name to filter for. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. """ - status: Optional[DedicatedConnectionStatus] + status: Optional[DedicatedConnectionStatus] = ( + DedicatedConnectionStatus.UNKNOWN_STATUS + ) """ Connection status to filter for. """ - bandwidth_mbps: Optional[int] + bandwidth_mbps: Optional[int] = 0 """ Filter for dedicated connections with this bandwidth size. """ - pop_id: Optional[str] + pop_id: Optional[str] = None """ Filter for dedicated connections present in this PoP. """ @@ -822,97 +826,97 @@ class ListDedicatedConnectionsResponse: @dataclass class ListLinksRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListLinksRequestOrderBy] + order_by: Optional[ListLinksRequestOrderBy] = ListLinksRequestOrderBy.CREATED_AT_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of links to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. """ - name: Optional[str] + name: Optional[str] = None """ Link name to filter for. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. """ - status: Optional[LinkStatus] + status: Optional[LinkStatus] = LinkStatus.UNKNOWN_LINK_STATUS """ Link status to filter for. """ - bgp_v4_status: Optional[BgpStatus] + bgp_v4_status: Optional[BgpStatus] = BgpStatus.UNKNOWN_BGP_STATUS """ BGP IPv4 status to filter for. """ - bgp_v6_status: Optional[BgpStatus] + bgp_v6_status: Optional[BgpStatus] = BgpStatus.UNKNOWN_BGP_STATUS """ BGP IPv6 status to filter for. """ - pop_id: Optional[str] + pop_id: Optional[str] = None """ Filter for links attached to this PoP (via connections). """ - bandwidth_mbps: Optional[int] + bandwidth_mbps: Optional[int] = 0 """ Filter for link bandwidth (in Mbps). """ - partner_id: Optional[str] + partner_id: Optional[str] = None """ Filter for links hosted by this partner. """ - vpc_id: Optional[str] + vpc_id: Optional[str] = None """ Filter for links attached to this VPC. """ - routing_policy_id: Optional[str] + routing_policy_id: Optional[str] = None """ Filter for links using this routing policy. """ - pairing_key: Optional[str] + pairing_key: Optional[str] = None """ Filter for the link with this pairing_key. """ - kind: Optional[LinkKind] + kind: Optional[LinkKind] = LinkKind.HOSTED """ Filter for hosted or self-hosted links. """ - connection_id: Optional[str] + connection_id: Optional[str] = None """ Filter for links self-hosted on this connection. """ @@ -933,27 +937,27 @@ class ListLinksResponse: @dataclass class ListPartnersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPartnersRequestOrderBy] + order_by: Optional[ListPartnersRequestOrderBy] = ListPartnersRequestOrderBy.NAME_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of partners to return per page. """ - pop_ids: Optional[List[str]] + pop_ids: Optional[List[str]] = field(default_factory=list) """ Filter for partners present (offering a connection) in one of these PoPs. """ @@ -974,47 +978,47 @@ class ListPartnersResponse: @dataclass class ListPopsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPopsRequestOrderBy] + order_by: Optional[ListPopsRequestOrderBy] = ListPopsRequestOrderBy.NAME_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of PoPs to return per page. """ - name: Optional[str] + name: Optional[str] = None """ PoP name to filter for. """ - hosting_provider_name: Optional[str] + hosting_provider_name: Optional[str] = None """ Hosting provider name to filter for. """ - partner_id: Optional[str] + partner_id: Optional[str] = None """ Filter for PoPs hosting an available shared connection from this partner. """ - link_bandwidth_mbps: Optional[int] + link_bandwidth_mbps: Optional[int] = 0 """ Filter for PoPs with a shared connection allowing this bandwidth size. Note that we cannot guarantee that PoPs returned will have available capacity. """ - dedicated_available: Optional[bool] + dedicated_available: Optional[bool] = False """ Filter for PoPs with a dedicated connection available for self-hosted links. """ @@ -1035,47 +1039,49 @@ class ListPopsResponse: @dataclass class ListRoutingPoliciesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListRoutingPoliciesRequestOrderBy] + order_by: Optional[ListRoutingPoliciesRequestOrderBy] = ( + ListRoutingPoliciesRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of routing policies to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. """ - name: Optional[str] + name: Optional[str] = None """ Routing policy name to filter for. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. """ - ipv6: Optional[bool] + ipv6: Optional[bool] = False """ Filter for the routing policies based on IP prefixes version. """ @@ -1084,7 +1090,6 @@ class ListRoutingPoliciesRequest: @dataclass class ListRoutingPoliciesResponse: routing_policies: List[RoutingPolicy] - total_count: int @@ -1095,22 +1100,22 @@ class UpdateLinkRequest: ID of the link to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the link. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the link. """ - peer_asn: Optional[int] + peer_asn: Optional[int] = 0 """ For self-hosted links, AS Number to establish BGP session. """ @@ -1123,27 +1128,27 @@ class UpdateRoutingPolicyRequest: ID of the routing policy to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the routing policy. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the routing policy. """ - prefix_filter_in: Optional[List[str]] + prefix_filter_in: Optional[List[str]] = field(default_factory=list) """ IP prefixes to accept from the peer (ranges of route announcements to accept). """ - prefix_filter_out: Optional[List[str]] + prefix_filter_out: Optional[List[str]] = field(default_factory=list) """ IP prefix filters for routes to advertise to the peer (ranges of routes to advertise). """ diff --git a/scaleway-async/scaleway_async/iot/v1/marshalling.py b/scaleway-async/scaleway_async/iot/v1/marshalling.py index fce648a7b..8dddf7afb 100644 --- a/scaleway-async/scaleway_async/iot/v1/marshalling.py +++ b/scaleway-async/scaleway_async/iot/v1/marshalling.py @@ -13,6 +13,15 @@ resolve_one_of, ) from .types import ( + DeviceMessageFiltersRulePolicy, + DeviceStatus, + HubProductPlan, + HubStatus, + NetworkNetworkType, + RouteDatabaseConfigEngine, + RouteRestConfigHttpVerb, + RouteRouteType, + RouteS3ConfigS3Strategy, DeviceMessageFiltersRule, DeviceMessageFilters, Device, @@ -71,12 +80,14 @@ def unmarshal_DeviceMessageFiltersRule(data: Any) -> DeviceMessageFiltersRule: field = data.get("policy", None) if field is not None: args["policy"] = field + else: + args["policy"] = DeviceMessageFiltersRulePolicy.UNKNOWN field = data.get("topics", None) if field is not None: args["topics"] = field else: - args["topics"] = None + args["topics"] = field(default_factory=list) return DeviceMessageFiltersRule(**args) @@ -115,22 +126,32 @@ def unmarshal_Device(data: Any) -> Device: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DeviceStatus.UNKNOWN field = data.get("hub_id", None) if field is not None: args["hub_id"] = field + else: + args["hub_id"] = None field = data.get("last_activity_at", None) if field is not None: @@ -143,18 +164,26 @@ def unmarshal_Device(data: Any) -> Device: field = data.get("is_connected", None) if field is not None: args["is_connected"] = field + else: + args["is_connected"] = False field = data.get("allow_insecure", None) if field is not None: args["allow_insecure"] = field + else: + args["allow_insecure"] = False field = data.get("allow_multiple_connections", None) if field is not None: args["allow_multiple_connections"] = field + else: + args["allow_multiple_connections"] = False field = data.get("has_custom_certificate", None) if field is not None: args["has_custom_certificate"] = field + else: + args["has_custom_certificate"] = False field = data.get("message_filters", None) if field is not None: @@ -188,26 +217,38 @@ def unmarshal_Network(data: Any) -> Network: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = NetworkNetworkType.UNKNOWN field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("hub_id", None) if field is not None: args["hub_id"] = field + else: + args["hub_id"] = None field = data.get("topic_prefix", None) if field is not None: args["topic_prefix"] = field + else: + args["topic_prefix"] = None field = data.get("created_at", None) if field is not None: @@ -229,6 +270,8 @@ def unmarshal_HubTwinsGraphiteConfig(data: Any) -> HubTwinsGraphiteConfig: field = data.get("push_uri", None) if field is not None: args["push_uri"] = field + else: + args["push_uri"] = None return HubTwinsGraphiteConfig(**args) @@ -244,62 +287,92 @@ def unmarshal_Hub(data: Any) -> Hub: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["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"] = HubStatus.UNKNOWN field = data.get("product_plan", None) if field is not None: args["product_plan"] = field + else: + args["product_plan"] = HubProductPlan.PLAN_UNKNOWN field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("device_count", None) if field is not None: args["device_count"] = field + else: + args["device_count"] = 0 field = data.get("connected_device_count", None) if field is not None: args["connected_device_count"] = field + else: + args["connected_device_count"] = 0 field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("disable_events", None) if field is not None: args["disable_events"] = field + else: + args["disable_events"] = False field = data.get("events_topic_prefix", None) if field is not None: args["events_topic_prefix"] = field + else: + args["events_topic_prefix"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("enable_device_auto_provisioning", None) if field is not None: args["enable_device_auto_provisioning"] = field + else: + args["enable_device_auto_provisioning"] = False field = data.get("has_custom_ca", None) if field is not None: args["has_custom_ca"] = field + else: + args["has_custom_ca"] = False field = data.get("created_at", None) if field is not None: @@ -333,10 +406,14 @@ def unmarshal_Certificate(data: Any) -> Certificate: field = data.get("crt", None) if field is not None: args["crt"] = field + else: + args["crt"] = None field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None return Certificate(**args) @@ -375,6 +452,8 @@ def unmarshal_CreateNetworkResponse(data: Any) -> CreateNetworkResponse: field = data.get("secret", None) if field is not None: args["secret"] = field + else: + args["secret"] = None field = data.get("network", None) if field is not None: @@ -396,6 +475,8 @@ def unmarshal_GetDeviceCertificateResponse(data: Any) -> GetDeviceCertificateRes field = data.get("certificate_pem", None) if field is not None: args["certificate_pem"] = field + else: + args["certificate_pem"] = None field = data.get("device", None) if field is not None: @@ -419,6 +500,8 @@ def unmarshal_GetDeviceMetricsResponse(data: Any) -> GetDeviceMetricsResponse: args["metrics"] = ( [unmarshal_TimeSeries(v) for v in field] if field is not None else None ) + else: + args["metrics"] = field(default_factory=list) return GetDeviceMetricsResponse(**args) @@ -434,6 +517,8 @@ def unmarshal_GetHubCAResponse(data: Any) -> GetHubCAResponse: field = data.get("ca_cert_pem", None) if field is not None: args["ca_cert_pem"] = field + else: + args["ca_cert_pem"] = None return GetHubCAResponse(**args) @@ -451,6 +536,8 @@ def unmarshal_GetHubMetricsResponse(data: Any) -> GetHubMetricsResponse: args["metrics"] = ( [unmarshal_TimeSeries(v) for v in field] if field is not None else None ) + else: + args["metrics"] = field(default_factory=list) return GetHubMetricsResponse(**args) @@ -466,12 +553,16 @@ def unmarshal_ListDevicesResponse(data: Any) -> ListDevicesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("devices", None) if field is not None: args["devices"] = ( [unmarshal_Device(v) for v in field] if field is not None else None ) + else: + args["devices"] = field(default_factory=list) return ListDevicesResponse(**args) @@ -487,10 +578,14 @@ def unmarshal_ListHubsResponse(data: Any) -> ListHubsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("hubs", None) if field is not None: args["hubs"] = [unmarshal_Hub(v) for v in field] if field is not None else None + else: + args["hubs"] = field(default_factory=list) return ListHubsResponse(**args) @@ -506,12 +601,16 @@ def unmarshal_ListNetworksResponse(data: Any) -> ListNetworksResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("networks", None) if field is not None: args["networks"] = ( [unmarshal_Network(v) for v in field] if field is not None else None ) + else: + args["networks"] = field(default_factory=list) return ListNetworksResponse(**args) @@ -527,22 +626,32 @@ def unmarshal_RouteSummary(data: Any) -> RouteSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("hub_id", None) if field is not None: args["hub_id"] = field + else: + args["hub_id"] = None field = data.get("topic", None) if field is not None: args["topic"] = field + else: + args["topic"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = RouteRouteType.UNKNOWN field = data.get("created_at", None) if field is not None: @@ -570,12 +679,16 @@ def unmarshal_ListRoutesResponse(data: Any) -> ListRoutesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("routes", None) if field is not None: args["routes"] = ( [unmarshal_RouteSummary(v) for v in field] if field is not None else None ) + else: + args["routes"] = field(default_factory=list) return ListRoutesResponse(**args) @@ -593,6 +706,8 @@ def unmarshal_ListTwinDocumentsResponseDocumentSummary( field = data.get("document_name", None) if field is not None: args["document_name"] = field + else: + args["document_name"] = None return ListTwinDocumentsResponseDocumentSummary(**args) @@ -612,6 +727,8 @@ def unmarshal_ListTwinDocumentsResponse(data: Any) -> ListTwinDocumentsResponse: if field is not None else None ) + else: + args["documents"] = field(default_factory=list) return ListTwinDocumentsResponse(**args) @@ -652,30 +769,44 @@ def unmarshal_RouteDatabaseConfig(data: Any) -> RouteDatabaseConfig: field = data.get("engine", None) if field is not None: args["engine"] = field + else: + args["engine"] = RouteDatabaseConfigEngine.UNKNOWN field = data.get("host", None) if field is not None: args["host"] = field + else: + args["host"] = None field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = None field = data.get("dbname", None) if field is not None: args["dbname"] = field + else: + args["dbname"] = None field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("password", None) if field is not None: args["password"] = field + else: + args["password"] = None field = data.get("query", None) if field is not None: args["query"] = field + else: + args["query"] = None return RouteDatabaseConfig(**args) @@ -691,14 +822,20 @@ def unmarshal_RouteRestConfig(data: Any) -> RouteRestConfig: field = data.get("verb", None) if field is not None: args["verb"] = field + else: + args["verb"] = RouteRestConfigHttpVerb.UNKNOWN field = data.get("uri", None) if field is not None: args["uri"] = field + else: + args["uri"] = None field = data.get("headers", None) if field is not None: args["headers"] = field + else: + args["headers"] = field(default_factory=dict) return RouteRestConfig(**args) @@ -714,18 +851,26 @@ def unmarshal_RouteS3Config(data: Any) -> RouteS3Config: field = data.get("bucket_region", None) if field is not None: args["bucket_region"] = field + else: + args["bucket_region"] = None field = data.get("bucket_name", None) if field is not None: args["bucket_name"] = field + else: + args["bucket_name"] = None field = data.get("object_prefix", None) if field is not None: args["object_prefix"] = field + else: + args["object_prefix"] = None field = data.get("strategy", None) if field is not None: args["strategy"] = field + else: + args["strategy"] = RouteS3ConfigS3Strategy.UNKNOWN return RouteS3Config(**args) @@ -741,22 +886,32 @@ def unmarshal_Route(data: Any) -> Route: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("hub_id", None) if field is not None: args["hub_id"] = field + else: + args["hub_id"] = None field = data.get("topic", None) if field is not None: args["topic"] = field + else: + args["topic"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = RouteRouteType.UNKNOWN field = data.get("created_at", None) if field is not None: @@ -802,6 +957,8 @@ def unmarshal_SetDeviceCertificateResponse(data: Any) -> SetDeviceCertificateRes field = data.get("certificate_pem", None) if field is not None: args["certificate_pem"] = field + else: + args["certificate_pem"] = None field = data.get("device", None) if field is not None: @@ -823,20 +980,26 @@ def unmarshal_TwinDocument(data: Any) -> TwinDocument: field = data.get("twin_id", None) if field is not None: args["twin_id"] = field + else: + args["twin_id"] = None field = data.get("document_name", None) if field is not None: args["document_name"] = field + else: + args["document_name"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = 0 field = data.get("data", None) if field is not None: args["data"] = field else: - args["data"] = None + args["data"] = field(default_factory=dict) return TwinDocument(**args) @@ -848,7 +1011,7 @@ def marshal_DeviceMessageFiltersRule( output: Dict[str, Any] = {} if request.policy is not None: - output["policy"] = str(request.policy) + output["policy"] = request.policy if request.topics is not None: output["topics"] = request.topics @@ -932,13 +1095,15 @@ def marshal_CreateHubRequest( ) if request.product_plan is not None: - output["product_plan"] = str(request.product_plan) + output["product_plan"] = request.product_plan if request.name is not None: output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.disable_events is not None: output["disable_events"] = request.disable_events @@ -956,7 +1121,7 @@ def marshal_CreateNetworkRequest( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.hub_id is not None: output["hub_id"] = request.hub_id @@ -995,7 +1160,7 @@ def marshal_CreateRouteRequestDatabaseConfig( output["query"] = request.query if request.engine is not None: - output["engine"] = str(request.engine) + output["engine"] = request.engine return output @@ -1007,7 +1172,7 @@ def marshal_CreateRouteRequestRestConfig( output: Dict[str, Any] = {} if request.verb is not None: - output["verb"] = str(request.verb) + output["verb"] = request.verb if request.uri is not None: output["uri"] = request.uri @@ -1034,7 +1199,7 @@ def marshal_CreateRouteRequestS3Config( output["object_prefix"] = request.object_prefix if request.strategy is not None: - output["strategy"] = str(request.strategy) + output["strategy"] = request.strategy return output @@ -1182,7 +1347,7 @@ def marshal_UpdateHubRequest( output["name"] = request.name if request.product_plan is not None: - output["product_plan"] = str(request.product_plan) + output["product_plan"] = request.product_plan if request.disable_events is not None: output["disable_events"] = request.disable_events @@ -1205,7 +1370,7 @@ def marshal_UpdateRouteRequestDatabaseConfig( output: Dict[str, Any] = {} if request.engine is not None: - output["engine"] = str(request.engine) + output["engine"] = request.engine if request.host is not None: output["host"] = request.host @@ -1235,7 +1400,7 @@ def marshal_UpdateRouteRequestRestConfig( output: Dict[str, Any] = {} if request.verb is not None: - output["verb"] = str(request.verb) + output["verb"] = request.verb if request.uri is not None: output["uri"] = request.uri @@ -1253,7 +1418,7 @@ def marshal_UpdateRouteRequestS3Config( output: Dict[str, Any] = {} if request.strategy is not None: - output["strategy"] = str(request.strategy) + output["strategy"] = request.strategy if request.bucket_region is not None: output["bucket_region"] = request.bucket_region diff --git a/scaleway-async/scaleway_async/iot/v1/types.py b/scaleway-async/scaleway_async/iot/v1/types.py index b6d2338ab..e8f2881d2 100644 --- a/scaleway-async/scaleway_async/iot/v1/types.py +++ b/scaleway-async/scaleway_async/iot/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Any, Dict, List, Optional @@ -174,7 +174,7 @@ class DeviceMessageFiltersRule: If set to `reject`, all topics in the topics list will be denied, with all other topics being allowed. """ - topics: Optional[List[str]] + topics: Optional[List[str]] = field(default_factory=list) """ List of topics to accept or reject. It must be valid MQTT topics and up to 65535 characters. """ @@ -182,12 +182,12 @@ class DeviceMessageFiltersRule: @dataclass class DeviceMessageFilters: - publish: Optional[DeviceMessageFiltersRule] + publish: Optional[DeviceMessageFiltersRule] = None """ Filtering rule to restrict topics the device can publish to. """ - subscribe: Optional[DeviceMessageFiltersRule] + subscribe: Optional[DeviceMessageFiltersRule] = None """ Filtering rule to restrict topics the device can subscribe to. """ @@ -201,7 +201,6 @@ class HubTwinsGraphiteConfig: @dataclass class Certificate: crt: str - key: str @@ -232,11 +231,6 @@ class Device: Hub ID. """ - last_activity_at: Optional[datetime] - """ - Last connection/activity date of a device. - """ - is_connected: bool """ Defines whether the device is connected to the Hub. @@ -257,17 +251,22 @@ class Device: Assigning a custom certificate allows a device to authenticate using that specific certificate without checking the Hub's CA certificate. """ - message_filters: Optional[DeviceMessageFilters] + last_activity_at: Optional[datetime] = None + """ + Last connection/activity date of a device. + """ + + message_filters: Optional[DeviceMessageFilters] = None """ Filter-sets to restrict the topics the device can publish/subscribe to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date at which the device was added. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date at which the device was last modified. """ @@ -305,7 +304,7 @@ class Network: This prefix will be prepended to all topics for this Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date at which the network was created. """ @@ -314,37 +313,26 @@ class Network: @dataclass class CreateRouteRequestDatabaseConfig: host: str - port: int - dbname: str - username: str - password: str - query: str - engine: RouteDatabaseConfigEngine @dataclass class CreateRouteRequestRestConfig: verb: RouteRestConfigHttpVerb - uri: str - headers: Dict[str, str] @dataclass class CreateRouteRequestS3Config: bucket_region: str - bucket_name: str - object_prefix: str - strategy: RouteS3ConfigS3Strategy @@ -425,17 +413,17 @@ class Hub: Flag is automatically set to `false` after Hub creation, as Hub certificates are managed by Scaleway. Once a custom certificate authority is set, the flag will be set to `true`. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Hub creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Hub last modification date. """ - twins_graphite_config: Optional[HubTwinsGraphiteConfig] + twins_graphite_config: Optional[HubTwinsGraphiteConfig] = None @dataclass @@ -465,12 +453,12 @@ class RouteSummary: Route type. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date at which the route was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date at which the route was last updated. """ @@ -566,38 +554,27 @@ class RouteS3Config: @dataclass class UpdateRouteRequestDatabaseConfig: engine: RouteDatabaseConfigEngine - - host: Optional[str] - - port: Optional[int] - - dbname: Optional[str] - - username: Optional[str] - - password: Optional[str] - - query: Optional[str] + host: Optional[str] = None + port: Optional[int] = None + dbname: Optional[str] = None + username: Optional[str] = None + password: Optional[str] = None + query: Optional[str] = None @dataclass class UpdateRouteRequestRestConfig: verb: RouteRestConfigHttpVerb - - uri: Optional[str] - - headers: Optional[Dict[str, str]] + uri: Optional[str] = None + headers: Optional[Dict[str, str]] = None @dataclass class UpdateRouteRequestS3Config: strategy: RouteS3ConfigS3Strategy - - bucket_region: Optional[str] - - bucket_name: Optional[str] - - object_prefix: Optional[str] + bucket_region: Optional[str] = None + bucket_name: Optional[str] = None + object_prefix: Optional[str] = None @dataclass @@ -617,22 +594,22 @@ class CreateDeviceRequest: Defines whether to allow multiple physical devices to connect with this device's credentials. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Device name. """ - message_filters: Optional[DeviceMessageFilters] + message_filters: Optional[DeviceMessageFilters] = None """ Filter-sets to authorize or deny the device to publish/subscribe to specific topics. """ - description: Optional[str] + description: Optional[str] = None """ Device description. """ @@ -640,12 +617,12 @@ class CreateDeviceRequest: @dataclass class CreateDeviceResponse: - device: Optional[Device] + device: Optional[Device] = None """ Information related to the created device. """ - certificate: Optional[Certificate] + certificate: Optional[Certificate] = None """ Device certificate. """ @@ -658,32 +635,32 @@ class CreateHubRequest: Hub product plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Hub name (up to 255 characters). """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project/Organization ID to filter for, only Hubs from this Project/Organization will be returned. """ - disable_events: Optional[bool] + disable_events: Optional[bool] = False """ Disable Hub events. """ - events_topic_prefix: Optional[str] + events_topic_prefix: Optional[str] = None """ Topic prefix (default '$SCW/events') of Hub events. """ - twins_graphite_config: Optional[HubTwinsGraphiteConfig] + twins_graphite_config: Optional[HubTwinsGraphiteConfig] = None @dataclass @@ -703,12 +680,12 @@ class CreateNetworkRequest: Topic prefix for the Network. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Network name. """ @@ -721,7 +698,7 @@ class CreateNetworkResponse: Endpoint Key to keep secret. This cannot be retrieved later. """ - network: Optional[Network] + network: Optional[Network] = None """ Information related to the created network. """ @@ -739,21 +716,21 @@ class CreateRouteRequest: Topic the route subscribes to. It must be a valid MQTT topic and up to 65535 characters. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Route name. """ - s3_config: Optional[CreateRouteRequestS3Config] + s3_config: Optional[CreateRouteRequestS3Config] = None - db_config: Optional[CreateRouteRequestDatabaseConfig] + db_config: Optional[CreateRouteRequestDatabaseConfig] = None - rest_config: Optional[CreateRouteRequestRestConfig] + rest_config: Optional[CreateRouteRequestRestConfig] = None @dataclass @@ -763,7 +740,7 @@ class DeleteDeviceRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -776,12 +753,12 @@ class DeleteHubRequest: Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - delete_devices: Optional[bool] + delete_devices: Optional[bool] = False """ Defines whether to force the deletion of devices added to this Hub or reject the operation. """ @@ -794,7 +771,7 @@ class DeleteNetworkRequest: Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -807,7 +784,7 @@ class DeleteRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -825,7 +802,7 @@ class DeleteTwinDocumentRequest: Name of the document. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -838,7 +815,7 @@ class DeleteTwinDocumentsRequest: Twin ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -851,7 +828,7 @@ class DisableDeviceRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -864,7 +841,7 @@ class DisableHubRequest: Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -877,7 +854,7 @@ class EnableDeviceRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -890,7 +867,7 @@ class EnableHubRequest: Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -903,7 +880,7 @@ class GetDeviceCertificateRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -916,7 +893,7 @@ class GetDeviceCertificateResponse: Device certificate. """ - device: Optional[Device] + device: Optional[Device] = None """ Information related to the created device. """ @@ -929,12 +906,12 @@ class GetDeviceMetricsRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - start_date: Optional[datetime] + start_date: Optional[datetime] = None """ Start date used to compute the best scale for the returned metrics. """ @@ -955,7 +932,7 @@ class GetDeviceRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -964,8 +941,7 @@ class GetDeviceRequest: @dataclass class GetHubCARequest: hub_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -983,12 +959,12 @@ class GetHubMetricsRequest: Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - start_date: Optional[datetime] + start_date: Optional[datetime] = None """ Start date used to compute the best scale for returned metrics. """ @@ -1009,7 +985,7 @@ class GetHubRequest: Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1022,7 +998,7 @@ class GetNetworkRequest: Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1035,7 +1011,7 @@ class GetRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1053,7 +1029,7 @@ class GetTwinDocumentRequest: Name of the document. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1061,42 +1037,42 @@ class GetTwinDocumentRequest: @dataclass class ListDevicesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of devices to return within a page. Maximum value is 100. """ - order_by: Optional[ListDevicesRequestOrderBy] + order_by: Optional[ListDevicesRequestOrderBy] = ListDevicesRequestOrderBy.NAME_ASC """ Ordering of requested devices. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter for, only devices with this name will be returned. """ - hub_id: Optional[str] + hub_id: Optional[str] = None """ Hub ID to filter for, only devices attached to this Hub will be returned. """ - allow_insecure: Optional[bool] + allow_insecure: Optional[bool] = False """ Defines whether to filter the allow_insecure flag. """ - status: Optional[DeviceStatus] + status: Optional[DeviceStatus] = DeviceStatus.UNKNOWN """ Device status (enabled, disabled, etc.). """ @@ -1117,37 +1093,37 @@ class ListDevicesResponse: @dataclass class ListHubsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Hubs to return within a page. Maximum value is 100. """ - order_by: Optional[ListHubsRequestOrderBy] + order_by: Optional[ListHubsRequestOrderBy] = ListHubsRequestOrderBy.NAME_ASC """ Sort order of Hubs in the response. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Only list Hubs of this Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Only list Hubs of this Organization ID. """ - name: Optional[str] + name: Optional[str] = None """ Hub name. """ @@ -1168,37 +1144,37 @@ class ListHubsResponse: @dataclass class ListNetworksRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of networks to return. The maximum value is 100. """ - order_by: Optional[ListNetworksRequestOrderBy] + order_by: Optional[ListNetworksRequestOrderBy] = ListNetworksRequestOrderBy.NAME_ASC """ Ordering of requested routes. """ - name: Optional[str] + name: Optional[str] = None """ Network name to filter for. """ - hub_id: Optional[str] + hub_id: Optional[str] = None """ Hub ID to filter for. """ - topic_prefix: Optional[str] + topic_prefix: Optional[str] = None """ Topic prefix to filter for. """ @@ -1219,32 +1195,32 @@ class ListNetworksResponse: @dataclass class ListRoutesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of routes to return within a page. Maximum value is 100. """ - order_by: Optional[ListRoutesRequestOrderBy] + order_by: Optional[ListRoutesRequestOrderBy] = ListRoutesRequestOrderBy.NAME_ASC """ Ordering of requested routes. """ - hub_id: Optional[str] + hub_id: Optional[str] = None """ Hub ID to filter for. """ - name: Optional[str] + name: Optional[str] = None """ Route name to filter for. """ @@ -1270,7 +1246,7 @@ class ListTwinDocumentsRequest: Twin ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1296,17 +1272,17 @@ class PatchTwinDocumentRequest: Name of the document. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - version: Optional[int] + version: Optional[int] = 0 """ If set, ensures that the current version of the document matches before persisting the update. """ - data: Optional[Dict[str, Any]] + data: Optional[Dict[str, Any]] = field(default_factory=dict) """ A json data that will be applied on the document's current data. Patching rules: @@ -1329,17 +1305,17 @@ class PutTwinDocumentRequest: Name of the document. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - version: Optional[int] + version: Optional[int] = 0 """ If set, ensures that the current version of the document matches before persisting the update. """ - data: Optional[Dict[str, Any]] + data: Optional[Dict[str, Any]] = field(default_factory=dict) """ New data that will replace the contents of the document. """ @@ -1352,7 +1328,7 @@ class RenewDeviceCertificateRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1360,12 +1336,12 @@ class RenewDeviceCertificateRequest: @dataclass class RenewDeviceCertificateResponse: - device: Optional[Device] + device: Optional[Device] = None """ Information related to the created device. """ - certificate: Optional[Certificate] + certificate: Optional[Certificate] = None """ Device certificate. """ @@ -1398,21 +1374,21 @@ class Route: Route type. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date at which the route was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date at which the route was last updated. """ - s3_config: Optional[RouteS3Config] + s3_config: Optional[RouteS3Config] = None - db_config: Optional[RouteDatabaseConfig] + db_config: Optional[RouteDatabaseConfig] = None - rest_config: Optional[RouteRestConfig] + rest_config: Optional[RouteRestConfig] = None @dataclass @@ -1427,7 +1403,7 @@ class SetDeviceCertificateRequest: PEM-encoded custom certificate. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1436,8 +1412,7 @@ class SetDeviceCertificateRequest: @dataclass class SetDeviceCertificateResponse: certificate_pem: str - - device: Optional[Device] + device: Optional[Device] = None @dataclass @@ -1457,7 +1432,7 @@ class SetHubCARequest: Challenge is a PEM-encoded certificate that acts as proof of possession of the CA. It must be signed by the CA, and have a Common Name equal to the Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1480,7 +1455,7 @@ class TwinDocument: New version of the document. """ - data: Optional[Dict[str, Any]] + data: Optional[Dict[str, Any]] = field(default_factory=dict) """ New data related to the document. """ @@ -1493,32 +1468,32 @@ class UpdateDeviceRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description for the device. """ - allow_insecure: Optional[bool] + allow_insecure: Optional[bool] = False """ Defines whether to allow plain and server-authenticated SSL connections in addition to mutually-authenticated ones. """ - allow_multiple_connections: Optional[bool] + allow_multiple_connections: Optional[bool] = False """ Defines whether to allow multiple physical devices to connect with this device's credentials. """ - message_filters: Optional[DeviceMessageFilters] + message_filters: Optional[DeviceMessageFilters] = None """ Filter-sets to restrict the topics the device can publish/subscribe to. """ - hub_id: Optional[str] + hub_id: Optional[str] = None """ Change Hub for this device, additional fees may apply, see IoT Hub pricing. """ @@ -1531,37 +1506,37 @@ class UpdateHubRequest: ID of the Hub you want to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Hub name (up to 255 characters). """ - product_plan: Optional[HubProductPlan] + product_plan: Optional[HubProductPlan] = HubProductPlan.PLAN_UNKNOWN """ Hub product plan. """ - disable_events: Optional[bool] + disable_events: Optional[bool] = False """ Disable Hub events. """ - events_topic_prefix: Optional[str] + events_topic_prefix: Optional[str] = None """ Topic prefix of Hub events. """ - enable_device_auto_provisioning: Optional[bool] + enable_device_auto_provisioning: Optional[bool] = False """ Enable device auto provisioning. """ - twins_graphite_config: Optional[HubTwinsGraphiteConfig] + twins_graphite_config: Optional[HubTwinsGraphiteConfig] = None @dataclass @@ -1571,23 +1546,23 @@ class UpdateRouteRequest: Route id. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Route name. """ - topic: Optional[str] + topic: Optional[str] = None """ Topic the route subscribes to. It must be a valid MQTT topic and up to 65535 characters. """ - s3_config: Optional[UpdateRouteRequestS3Config] + s3_config: Optional[UpdateRouteRequestS3Config] = None - db_config: Optional[UpdateRouteRequestDatabaseConfig] + db_config: Optional[UpdateRouteRequestDatabaseConfig] = None - rest_config: Optional[UpdateRouteRequestRestConfig] + rest_config: Optional[UpdateRouteRequestRestConfig] = None diff --git a/scaleway-async/scaleway_async/jobs/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/jobs/v1alpha1/marshalling.py index 44470d626..2d727a553 100644 --- a/scaleway-async/scaleway_async/jobs/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/jobs/v1alpha1/marshalling.py @@ -46,6 +46,8 @@ def unmarshal_SecretEnvVar(data: Any) -> SecretEnvVar: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return SecretEnvVar(**args) @@ -61,6 +63,8 @@ def unmarshal_SecretFile(data: Any) -> SecretFile: field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None return SecretFile(**args) @@ -76,14 +80,20 @@ def unmarshal_Secret(data: Any) -> Secret: field = data.get("secret_id", None) if field is not None: args["secret_id"] = field + else: + args["secret_id"] = None field = data.get("secret_manager_id", None) if field is not None: args["secret_manager_id"] = field + else: + args["secret_manager_id"] = None field = data.get("secret_manager_version", None) if field is not None: args["secret_manager_version"] = field + else: + args["secret_manager_version"] = None field = data.get("file", None) if field is not None: @@ -111,10 +121,14 @@ def unmarshal_CronSchedule(data: Any) -> CronSchedule: field = data.get("schedule", None) if field is not None: args["schedule"] = field + else: + args["schedule"] = None field = data.get("timezone", None) if field is not None: args["timezone"] = field + else: + args["timezone"] = None return CronSchedule(**args) @@ -130,30 +144,44 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field + else: + args["cpu_limit"] = None field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field + else: + args["memory_limit"] = None field = data.get("image_uri", None) if field is not None: args["image_uri"] = field + else: + args["image_uri"] = None field = data.get("command", None) if field is not None: args["command"] = field + else: + args["command"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("created_at", None) if field is not None: @@ -170,18 +198,26 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition: field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("local_storage_capacity", None) if field is not None: args["local_storage_capacity"] = field + else: + args["local_storage_capacity"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("job_timeout", None) if field is not None: @@ -209,30 +245,44 @@ def unmarshal_JobRun(data: Any) -> JobRun: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("job_definition_id", None) if field is not None: args["job_definition_id"] = field + else: + args["job_definition_id"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None field = data.get("error_message", None) if field is not None: args["error_message"] = field + else: + args["error_message"] = None field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field + else: + args["cpu_limit"] = None field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field + else: + args["memory_limit"] = None field = data.get("command", None) if field is not None: args["command"] = field + else: + args["command"] = None field = data.get("created_at", None) if field is not None: @@ -269,14 +319,20 @@ def unmarshal_JobRun(data: Any) -> JobRun: field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = None field = data.get("local_storage_capacity", None) if field is not None: args["local_storage_capacity"] = field + else: + args["local_storage_capacity"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("started_at", None) if field is not None: @@ -302,6 +358,8 @@ def unmarshal_CreateJobDefinitionSecretsResponse( args["secrets"] = ( [unmarshal_Secret(v) for v in field] if field is not None else None ) + else: + args["secrets"] = field(default_factory=list) return CreateJobDefinitionSecretsResponse(**args) @@ -317,6 +375,8 @@ def unmarshal_JobsLimits(data: Any) -> JobsLimits: field = data.get("secrets_per_job_definition", None) if field is not None: args["secrets_per_job_definition"] = field + else: + args["secrets_per_job_definition"] = None return JobsLimits(**args) @@ -336,10 +396,14 @@ def unmarshal_ListJobDefinitionSecretsResponse( args["secrets"] = ( [unmarshal_Secret(v) for v in field] if field is not None else None ) + else: + args["secrets"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListJobDefinitionSecretsResponse(**args) @@ -357,10 +421,14 @@ def unmarshal_ListJobDefinitionsResponse(data: Any) -> ListJobDefinitionsRespons args["job_definitions"] = ( [unmarshal_JobDefinition(v) for v in field] if field is not None else None ) + else: + args["job_definitions"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListJobDefinitionsResponse(**args) @@ -378,10 +446,14 @@ def unmarshal_ListJobRunsResponse(data: Any) -> ListJobRunsResponse: args["job_runs"] = ( [unmarshal_JobRun(v) for v in field] if field is not None else None ) + else: + args["job_runs"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListJobRunsResponse(**args) @@ -397,10 +469,14 @@ def unmarshal_Resource(data: Any) -> Resource: field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field + else: + args["cpu_limit"] = None field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field + else: + args["memory_limit"] = None return Resource(**args) @@ -418,6 +494,8 @@ def unmarshal_ListJobsResourcesResponse(data: Any) -> ListJobsResourcesResponse: args["resources"] = ( [unmarshal_Resource(v) for v in field] if field is not None else None ) + else: + args["resources"] = None return ListJobsResourcesResponse(**args) @@ -435,6 +513,8 @@ def unmarshal_StartJobDefinitionResponse(data: Any) -> StartJobDefinitionRespons args["job_runs"] = ( [unmarshal_JobRun(v) for v in field] if field is not None else None ) + else: + args["job_runs"] = None return StartJobDefinitionResponse(**args) @@ -482,7 +562,9 @@ def marshal_CreateJobDefinitionRequest( output["local_storage_capacity"] = request.local_storage_capacity if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.environment_variables is not None: output["environment_variables"] = { diff --git a/scaleway-async/scaleway_async/jobs/v1alpha1/types.py b/scaleway-async/scaleway_async/jobs/v1alpha1/types.py index 742d07950..08cfe7836 100644 --- a/scaleway-async/scaleway_async/jobs/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/jobs/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -71,19 +71,16 @@ class CronSchedule: @dataclass class CreateJobDefinitionRequestCronScheduleConfig: schedule: str - timezone: str @dataclass class CreateJobDefinitionSecretsRequestSecretConfig: secret_manager_id: str - secret_manager_version: str + path: Optional[str] = None - path: Optional[str] - - env_var_name: Optional[str] + env_var_name: Optional[str] = None @dataclass @@ -103,97 +100,68 @@ class Secret: Version of the secret in Secret Manager. """ - file: Optional[SecretFile] + file: Optional[SecretFile] = None - env_var: Optional[SecretEnvVar] + env_var: Optional[SecretEnvVar] = None @dataclass class JobDefinition: id: str - name: str - cpu_limit: int - memory_limit: int - image_uri: str - command: str - project_id: str - - created_at: Optional[datetime] - - updated_at: Optional[datetime] - environment_variables: Dict[str, str] - description: str - local_storage_capacity: int - region: ScwRegion """ Region to target. If none is passed will use default region from the config. """ - job_timeout: Optional[str] - - cron_schedule: Optional[CronSchedule] + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + job_timeout: Optional[str] = None + cron_schedule: Optional[CronSchedule] = None @dataclass class JobRun: id: str - job_definition_id: str - state: JobRunState - error_message: str - cpu_limit: int - memory_limit: int - command: str - - created_at: Optional[datetime] - - updated_at: Optional[datetime] - - terminated_at: Optional[datetime] - - exit_code: Optional[int] - - run_duration: Optional[str] - environment_variables: Dict[str, str] - local_storage_capacity: int - region: ScwRegion """ Region to target. If none is passed will use default region from the config. """ - started_at: Optional[datetime] + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + terminated_at: Optional[datetime] = None + exit_code: Optional[int] = None + run_duration: Optional[str] = None + started_at: Optional[datetime] = None @dataclass class Resource: cpu_limit: int - memory_limit: int @dataclass class UpdateJobDefinitionRequestCronScheduleConfig: - schedule: Optional[str] - - timezone: Optional[str] + schedule: Optional[str] = None + timezone: Optional[str] = None @dataclass @@ -223,37 +191,37 @@ class CreateJobDefinitionRequest: Description of the job. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the job definition. """ - local_storage_capacity: Optional[int] + local_storage_capacity: Optional[int] = 0 """ Local storage capacity of the job (in MiB). """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Scaleway Project containing the job. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the job. """ - job_timeout: Optional[str] + job_timeout: Optional[str] = None """ Timeout of the job in seconds. """ - cron_schedule: Optional[CreateJobDefinitionRequestCronScheduleConfig] + cron_schedule: Optional[CreateJobDefinitionRequestCronScheduleConfig] = None """ Configure a cron for the job. """ @@ -271,7 +239,7 @@ class CreateJobDefinitionSecretsRequest: List of secrets to inject into the job. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -292,7 +260,7 @@ class DeleteJobDefinitionRequest: UUID of the job definition to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -310,7 +278,7 @@ class DeleteJobDefinitionSecretRequest: UUID of the secret reference within the job. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -323,7 +291,7 @@ class GetJobDefinitionRequest: UUID of the job definition to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -341,7 +309,7 @@ class GetJobDefinitionSecretRequest: UUID of the secret reference within the job. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -354,7 +322,7 @@ class GetJobRunRequest: UUID of the job run to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -362,7 +330,7 @@ class GetJobRunRequest: @dataclass class GetJobsLimitsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -380,7 +348,7 @@ class ListJobDefinitionSecretsRequest: UUID of the job definition. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -401,63 +369,50 @@ class ListJobDefinitionSecretsResponse: @dataclass class ListJobDefinitionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListJobDefinitionsRequestOrderBy] - - project_id: Optional[str] - - organization_id: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListJobDefinitionsRequestOrderBy] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None @dataclass class ListJobDefinitionsResponse: job_definitions: List[JobDefinition] - total_count: int @dataclass class ListJobRunsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListJobRunsRequestOrderBy] - - job_definition_id: Optional[str] - - project_id: Optional[str] - - organization_id: Optional[str] - - state: Optional[JobRunState] - - states: Optional[List[JobRunState]] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListJobRunsRequestOrderBy] = None + job_definition_id: Optional[str] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None + state: Optional[JobRunState] = None + states: Optional[List[JobRunState]] = None @dataclass class ListJobRunsResponse: job_runs: List[JobRun] - total_count: int @dataclass class ListJobsResourcesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -475,22 +430,22 @@ class StartJobDefinitionRequest: UUID of the job definition to start. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - command: Optional[str] + command: Optional[str] = None """ Contextual startup command for this specific job run. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Contextual environment variables for this specific job run. """ - replicas: Optional[int] + replicas: Optional[int] = 0 """ Number of jobs to run. """ @@ -508,7 +463,7 @@ class StopJobRunRequest: UUID of the job run to stop. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -521,57 +476,57 @@ class UpdateJobDefinitionRequest: UUID of the job definition to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the job definition. """ - cpu_limit: Optional[int] + cpu_limit: Optional[int] = 0 """ CPU limit of the job. """ - memory_limit: Optional[int] + memory_limit: Optional[int] = 0 """ Memory limit of the job (in MiB). """ - local_storage_capacity: Optional[int] + local_storage_capacity: Optional[int] = 0 """ Local storage capacity of the job (in MiB). """ - image_uri: Optional[str] + image_uri: Optional[str] = None """ Image to use for the job. """ - command: Optional[str] + command: Optional[str] = None """ Startup command. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the job. """ - description: Optional[str] + description: Optional[str] = None """ Description of the job. """ - job_timeout: Optional[str] + job_timeout: Optional[str] = None """ Timeout of the job in seconds. """ - cron_schedule: Optional[UpdateJobDefinitionRequestCronScheduleConfig] + cron_schedule: Optional[UpdateJobDefinitionRequestCronScheduleConfig] = None @dataclass @@ -586,16 +541,16 @@ class UpdateJobDefinitionSecretRequest: UUID of the secret reference within the job. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - secret_manager_version: Optional[str] + secret_manager_version: Optional[str] = None """ Version of the secret in Secret Manager. """ - path: Optional[str] + path: Optional[str] = None - env_var_name: Optional[str] + env_var_name: Optional[str] = None diff --git a/scaleway-async/scaleway_async/k8s/v1/marshalling.py b/scaleway-async/scaleway_async/k8s/v1/marshalling.py index cc86a46c1..f4265c470 100644 --- a/scaleway-async/scaleway_async/k8s/v1/marshalling.py +++ b/scaleway-async/scaleway_async/k8s/v1/marshalling.py @@ -10,7 +10,16 @@ resolve_one_of, ) from .types import ( + AutoscalerEstimator, + AutoscalerExpander, CNI, + ClusterStatus, + ClusterTypeAvailability, + ClusterTypeResiliency, + MaintenanceWindowDayOfTheWeek, + NodeStatus, + PoolStatus, + PoolVolumeType, Runtime, PoolUpgradePolicy, Pool, @@ -73,10 +82,14 @@ def unmarshal_PoolUpgradePolicy(data: Any) -> PoolUpgradePolicy: 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) @@ -92,42 +105,62 @@ def unmarshal_Pool(data: Any) -> Pool: 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: @@ -144,38 +177,56 @@ def unmarshal_Pool(data: Any) -> Pool: 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(default_factory=list) field = data.get("kubelet_args", None) if field is not None: args["kubelet_args"] = field + else: + args["kubelet_args"] = field(default_factory=dict) 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: @@ -193,13 +244,13 @@ def unmarshal_Pool(data: Any) -> Pool: if field is not None: args["root_volume_size"] = field else: - args["root_volume_size"] = None + 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"] = None + args["new_images_enabled"] = False return Pool(**args) @@ -215,36 +266,52 @@ def unmarshal_Version(data: Any) -> Version: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("label", None) if field is not None: args["label"] = field + else: + args["label"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("available_cnis", None) if field is not None: args["available_cnis"] = [CNI(v) for v in field] if field is not None else None + else: + args["available_cnis"] = field(default_factory=list) field = data.get("available_container_runtimes", None) if field is not None: args["available_container_runtimes"] = ( [Runtime(v) for v in field] if field is not None else None ) + else: + args["available_container_runtimes"] = field(default_factory=list) field = data.get("available_feature_gates", None) if field is not None: args["available_feature_gates"] = field + else: + args["available_feature_gates"] = field(default_factory=list) field = data.get("available_admission_plugins", None) if field is not None: args["available_admission_plugins"] = field + else: + args["available_admission_plugins"] = field(default_factory=list) field = data.get("available_kubelet_args", None) if field is not None: args["available_kubelet_args"] = field + else: + args["available_kubelet_args"] = field(default_factory=dict) return Version(**args) @@ -260,10 +327,14 @@ def unmarshal_MaintenanceWindow(data: Any) -> MaintenanceWindow: field = data.get("start_hour", None) if field is not None: args["start_hour"] = field + else: + args["start_hour"] = 0 field = data.get("day", None) if field is not None: args["day"] = field + else: + args["day"] = MaintenanceWindowDayOfTheWeek.ANY return MaintenanceWindow(**args) @@ -279,6 +350,8 @@ def unmarshal_ClusterAutoUpgrade(data: Any) -> ClusterAutoUpgrade: field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("maintenance_window", None) if field is not None: @@ -300,42 +373,62 @@ def unmarshal_ClusterAutoscalerConfig(data: Any) -> ClusterAutoscalerConfig: field = data.get("scale_down_disabled", None) if field is not None: args["scale_down_disabled"] = field + else: + args["scale_down_disabled"] = False field = data.get("scale_down_delay_after_add", None) if field is not None: args["scale_down_delay_after_add"] = field + else: + args["scale_down_delay_after_add"] = None field = data.get("estimator", None) if field is not None: args["estimator"] = field + else: + args["estimator"] = AutoscalerEstimator.UNKNOWN_ESTIMATOR field = data.get("expander", None) if field is not None: args["expander"] = field + else: + args["expander"] = AutoscalerExpander.UNKNOWN_EXPANDER field = data.get("ignore_daemonsets_utilization", None) if field is not None: args["ignore_daemonsets_utilization"] = field + else: + args["ignore_daemonsets_utilization"] = False field = data.get("balance_similar_node_groups", None) if field is not None: args["balance_similar_node_groups"] = field + else: + args["balance_similar_node_groups"] = False field = data.get("expendable_pods_priority_cutoff", None) if field is not None: args["expendable_pods_priority_cutoff"] = field + else: + args["expendable_pods_priority_cutoff"] = 0 field = data.get("scale_down_unneeded_time", None) if field is not None: args["scale_down_unneeded_time"] = field + else: + args["scale_down_unneeded_time"] = None field = data.get("scale_down_utilization_threshold", None) if field is not None: args["scale_down_utilization_threshold"] = field + else: + args["scale_down_utilization_threshold"] = 0.0 field = data.get("max_graceful_termination_sec", None) if field is not None: args["max_graceful_termination_sec"] = field + else: + args["max_graceful_termination_sec"] = 0 return ClusterAutoscalerConfig(**args) @@ -351,30 +444,44 @@ def unmarshal_ClusterOpenIDConnectConfig(data: Any) -> ClusterOpenIDConnectConfi field = data.get("issuer_url", None) if field is not None: args["issuer_url"] = field + else: + args["issuer_url"] = None field = data.get("client_id", None) if field is not None: args["client_id"] = field + else: + args["client_id"] = None field = data.get("username_claim", None) if field is not None: args["username_claim"] = field + else: + args["username_claim"] = None field = data.get("username_prefix", None) if field is not None: args["username_prefix"] = field + else: + args["username_prefix"] = None field = data.get("groups_claim", None) if field is not None: args["groups_claim"] = field + else: + args["groups_claim"] = field(default_factory=list) field = data.get("groups_prefix", None) if field is not None: args["groups_prefix"] = field + else: + args["groups_prefix"] = None field = data.get("required_claim", None) if field is not None: args["required_claim"] = field + else: + args["required_claim"] = field(default_factory=list) return ClusterOpenIDConnectConfig(**args) @@ -390,66 +497,98 @@ def unmarshal_Cluster(data: Any) -> Cluster: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = 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"] = ClusterStatus.UNKNOWN field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("cni", None) if field is not None: args["cni"] = field + else: + args["cni"] = CNI.UNKNOWN_CNI field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("cluster_url", None) if field is not None: args["cluster_url"] = field + else: + args["cluster_url"] = None field = data.get("dns_wildcard", None) if field is not None: args["dns_wildcard"] = field + else: + args["dns_wildcard"] = None field = data.get("upgrade_available", None) if field is not None: args["upgrade_available"] = field + else: + args["upgrade_available"] = False field = data.get("feature_gates", None) if field is not None: args["feature_gates"] = field + else: + args["feature_gates"] = field(default_factory=list) field = data.get("admission_plugins", None) if field is not None: args["admission_plugins"] = field + else: + args["admission_plugins"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -484,22 +623,32 @@ def unmarshal_Cluster(data: Any) -> Cluster: field = data.get("apiserver_cert_sans", None) if field is not None: args["apiserver_cert_sans"] = field + else: + args["apiserver_cert_sans"] = field(default_factory=list) field = data.get("iam_nodes_group_id", None) if field is not None: args["iam_nodes_group_id"] = field + else: + args["iam_nodes_group_id"] = None field = data.get("pod_cidr", None) if field is not None: args["pod_cidr"] = field + else: + args["pod_cidr"] = None field = data.get("service_cidr", None) if field is not None: args["service_cidr"] = field + else: + args["service_cidr"] = None field = data.get("service_dns_ip", None) if field is not None: args["service_dns_ip"] = field + else: + args["service_dns_ip"] = None field = data.get("private_network_id", None) if field is not None: @@ -519,13 +668,13 @@ def unmarshal_Cluster(data: Any) -> Cluster: if field is not None: args["acl_available"] = field else: - args["acl_available"] = None + args["acl_available"] = False field = data.get("new_images_enabled", None) if field is not None: args["new_images_enabled"] = field else: - args["new_images_enabled"] = None + args["new_images_enabled"] = False return Cluster(**args) @@ -541,26 +690,38 @@ def unmarshal_Node(data: Any) -> Node: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pool_id", None) if field is not None: args["pool_id"] = field + else: + args["pool_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("provider_id", None) if field is not None: args["provider_id"] = field + else: + args["provider_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("public_ip_v4", None) if field is not None: @@ -578,11 +739,13 @@ def unmarshal_Node(data: Any) -> Node: if field is not None: args["conditions"] = field else: - args["conditions"] = None + args["conditions"] = field(default_factory=dict) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = NodeStatus.UNKNOWN field = data.get("error_message", None) if field is not None: @@ -616,10 +779,14 @@ def unmarshal_ACLRule(data: Any) -> ACLRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("ip", None) if field is not None: @@ -631,7 +798,7 @@ def unmarshal_ACLRule(data: Any) -> ACLRule: if field is not None: args["scaleway_ranges"] = field else: - args["scaleway_ranges"] = None + args["scaleway_ranges"] = False return ACLRule(**args) @@ -649,6 +816,8 @@ def unmarshal_AddClusterACLRulesResponse(data: Any) -> AddClusterACLRulesRespons args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return AddClusterACLRulesResponse(**args) @@ -664,14 +833,20 @@ def unmarshal_ExternalNodeCoreV1Taint(data: Any) -> ExternalNodeCoreV1Taint: field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None field = data.get("effect", None) if field is not None: args["effect"] = field + else: + args["effect"] = None return ExternalNodeCoreV1Taint(**args) @@ -687,50 +862,74 @@ def unmarshal_ExternalNode(data: Any) -> ExternalNode: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("cluster_url", None) if field is not None: args["cluster_url"] = field + else: + args["cluster_url"] = None field = data.get("pool_version", None) if field is not None: args["pool_version"] = field + else: + args["pool_version"] = None field = data.get("cluster_ca", None) if field is not None: args["cluster_ca"] = field + else: + args["cluster_ca"] = None field = data.get("kube_token", None) if field is not None: args["kube_token"] = field + else: + args["kube_token"] = None field = data.get("kubelet_config", None) if field is not None: args["kubelet_config"] = field + else: + args["kubelet_config"] = None field = data.get("external_ip", None) if field is not None: args["external_ip"] = field + else: + args["external_ip"] = None field = data.get("containerd_version", None) if field is not None: args["containerd_version"] = field + else: + args["containerd_version"] = None field = data.get("runc_version", None) if field is not None: args["runc_version"] = field + else: + args["runc_version"] = None field = data.get("cni_plugins_version", None) if field is not None: args["cni_plugins_version"] = field + else: + args["cni_plugins_version"] = None field = data.get("node_labels", None) if field is not None: args["node_labels"] = field + else: + args["node_labels"] = None field = data.get("node_taints", None) if field is not None: @@ -739,10 +938,14 @@ def unmarshal_ExternalNode(data: Any) -> ExternalNode: if field is not None else None ) + else: + args["node_taints"] = None field = data.get("iam_token", None) if field is not None: args["iam_token"] = field + else: + args["iam_token"] = None return ExternalNode(**args) @@ -758,10 +961,14 @@ def unmarshal_ExternalNodeAuth(data: Any) -> ExternalNodeAuth: field = data.get("node_secret_key", None) if field is not None: args["node_secret_key"] = field + else: + args["node_secret_key"] = None field = data.get("metadata_url", None) if field is not None: args["metadata_url"] = field + else: + args["metadata_url"] = None return ExternalNodeAuth(**args) @@ -777,12 +984,16 @@ def unmarshal_ListClusterACLRulesResponse(data: Any) -> ListClusterACLRulesRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("rules", None) if field is not None: args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return ListClusterACLRulesResponse(**args) @@ -798,38 +1009,56 @@ def unmarshal_ClusterType(data: Any) -> ClusterType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("availability", None) if field is not None: args["availability"] = field + else: + args["availability"] = ClusterTypeAvailability.AVAILABLE field = data.get("max_nodes", None) if field is not None: args["max_nodes"] = field + else: + args["max_nodes"] = 0 field = data.get("sla", None) if field is not None: args["sla"] = field + else: + args["sla"] = 0.0 field = data.get("resiliency", None) if field is not None: args["resiliency"] = field + else: + args["resiliency"] = ClusterTypeResiliency.UNKNOWN_RESILIENCY field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("dedicated", None) if field is not None: args["dedicated"] = field + else: + args["dedicated"] = False field = data.get("audit_logs_supported", None) if field is not None: args["audit_logs_supported"] = field + else: + args["audit_logs_supported"] = False field = data.get("max_etcd_size", None) if field is not None: args["max_etcd_size"] = field + else: + args["max_etcd_size"] = 0 field = data.get("commitment_delay", None) if field is not None: @@ -855,10 +1084,14 @@ def unmarshal_ListClusterAvailableTypesResponse( args["cluster_types"] = ( [unmarshal_ClusterType(v) for v in field] if field is not None else None ) + else: + args["cluster_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListClusterAvailableTypesResponse(**args) @@ -878,6 +1111,8 @@ def unmarshal_ListClusterAvailableVersionsResponse( args["versions"] = ( [unmarshal_Version(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) return ListClusterAvailableVersionsResponse(**args) @@ -893,12 +1128,16 @@ def unmarshal_ListClusterTypesResponse(data: Any) -> ListClusterTypesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("cluster_types", None) if field is not None: args["cluster_types"] = ( [unmarshal_ClusterType(v) for v in field] if field is not None else None ) + else: + args["cluster_types"] = field(default_factory=list) return ListClusterTypesResponse(**args) @@ -914,12 +1153,16 @@ def unmarshal_ListClustersResponse(data: Any) -> ListClustersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("clusters", None) if field is not None: args["clusters"] = ( [unmarshal_Cluster(v) for v in field] if field is not None else None ) + else: + args["clusters"] = field(default_factory=list) return ListClustersResponse(**args) @@ -935,12 +1178,16 @@ def unmarshal_ListNodesResponse(data: Any) -> ListNodesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("nodes", None) if field is not None: args["nodes"] = ( [unmarshal_Node(v) for v in field] if field is not None else None ) + else: + args["nodes"] = field(default_factory=list) return ListNodesResponse(**args) @@ -956,12 +1203,16 @@ def unmarshal_ListPoolsResponse(data: Any) -> ListPoolsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("pools", None) if field is not None: args["pools"] = ( [unmarshal_Pool(v) for v in field] if field is not None else None ) + else: + args["pools"] = field(default_factory=list) return ListPoolsResponse(**args) @@ -979,6 +1230,8 @@ def unmarshal_ListVersionsResponse(data: Any) -> ListVersionsResponse: args["versions"] = ( [unmarshal_Version(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) return ListVersionsResponse(**args) @@ -994,14 +1247,20 @@ def unmarshal_NodeMetadataCoreV1Taint(data: Any) -> NodeMetadataCoreV1Taint: field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None field = data.get("effect", None) if field is not None: args["effect"] = field + else: + args["effect"] = None return NodeMetadataCoreV1Taint(**args) @@ -1017,34 +1276,50 @@ def unmarshal_NodeMetadata(data: Any) -> NodeMetadata: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("cluster_url", None) if field is not None: args["cluster_url"] = field + else: + args["cluster_url"] = None field = data.get("cluster_ca", None) if field is not None: args["cluster_ca"] = field + else: + args["cluster_ca"] = None field = data.get("credential_provider_config", None) if field is not None: args["credential_provider_config"] = field + else: + args["credential_provider_config"] = None field = data.get("pool_version", None) if field is not None: args["pool_version"] = field + else: + args["pool_version"] = None field = data.get("kubelet_config", None) if field is not None: args["kubelet_config"] = field + else: + args["kubelet_config"] = None field = data.get("node_labels", None) if field is not None: args["node_labels"] = field + else: + args["node_labels"] = None field = data.get("node_taints", None) if field is not None: @@ -1053,42 +1328,62 @@ def unmarshal_NodeMetadata(data: Any) -> NodeMetadata: if field is not None else None ) + else: + args["node_taints"] = None field = data.get("provider_id", None) if field is not None: args["provider_id"] = field + else: + args["provider_id"] = None field = data.get("resolvconf_path", None) if field is not None: args["resolvconf_path"] = field + else: + args["resolvconf_path"] = None field = data.get("has_gpu", None) if field is not None: args["has_gpu"] = field + else: + args["has_gpu"] = None field = data.get("external_ip", None) if field is not None: args["external_ip"] = field + else: + args["external_ip"] = None field = data.get("repo_uri", None) if field is not None: args["repo_uri"] = field + else: + args["repo_uri"] = None field = data.get("installer_tags", None) if field is not None: args["installer_tags"] = field + else: + args["installer_tags"] = None field = data.get("updater_bin_url", None) if field is not None: args["updater_bin_url"] = field + else: + args["updater_bin_url"] = None field = data.get("updater_bin_version", None) if field is not None: args["updater_bin_version"] = field + else: + args["updater_bin_version"] = None field = data.get("updater_bin_path", None) if field is not None: args["updater_bin_path"] = field + else: + args["updater_bin_path"] = None return NodeMetadata(**args) @@ -1106,6 +1401,8 @@ def unmarshal_SetClusterACLRulesResponse(data: Any) -> SetClusterACLRulesRespons args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return SetClusterACLRulesResponse(**args) @@ -1158,7 +1455,7 @@ def marshal_MaintenanceWindow( output["start_hour"] = request.start_hour if request.day is not None: - output["day"] = str(request.day) + output["day"] = request.day return output @@ -1202,10 +1499,10 @@ def marshal_CreateClusterRequestAutoscalerConfig( output: Dict[str, Any] = {} if request.estimator is not None: - output["estimator"] = str(request.estimator) + output["estimator"] = request.estimator if request.expander is not None: - output["expander"] = str(request.expander) + output["expander"] = request.expander if request.scale_down_disabled is not None: output["scale_down_disabled"] = request.scale_down_disabled @@ -1287,7 +1584,7 @@ def marshal_CreateClusterRequestPoolConfig( output["size"] = request.size if request.container_runtime is not None: - output["container_runtime"] = str(request.container_runtime) + output["container_runtime"] = request.container_runtime if request.placement_group_id is not None: output["placement_group_id"] = request.placement_group_id @@ -1310,10 +1607,12 @@ def marshal_CreateClusterRequestPoolConfig( } if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone if request.root_volume_type is not None: - output["root_volume_type"] = str(request.root_volume_type) + output["root_volume_type"] = request.root_volume_type if request.public_ip_disabled is not None: output["public_ip_disabled"] = request.public_ip_disabled @@ -1366,7 +1665,7 @@ def marshal_CreateClusterRequest( output["version"] = request.version if request.cni is not None: - output["cni"] = str(request.cni) + output["cni"] = request.cni if request.name is not None: output["name"] = request.name @@ -1470,7 +1769,7 @@ def marshal_CreatePoolRequest( output["max_size"] = request.max_size if request.container_runtime is not None: - output["container_runtime"] = str(request.container_runtime) + output["container_runtime"] = request.container_runtime if request.tags is not None: output["tags"] = request.tags @@ -1486,10 +1785,12 @@ def marshal_CreatePoolRequest( ) if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone if request.root_volume_type is not None: - output["root_volume_type"] = str(request.root_volume_type) + output["root_volume_type"] = request.root_volume_type if request.root_volume_size is not None: output["root_volume_size"] = request.root_volume_size @@ -1562,10 +1863,10 @@ def marshal_UpdateClusterRequestAutoscalerConfig( output: Dict[str, Any] = {} if request.estimator is not None: - output["estimator"] = str(request.estimator) + output["estimator"] = request.estimator if request.expander is not None: - output["expander"] = str(request.expander) + output["expander"] = request.expander if request.scale_down_disabled is not None: output["scale_down_disabled"] = request.scale_down_disabled diff --git a/scaleway-async/scaleway_async/k8s/v1/types.py b/scaleway-async/scaleway_async/k8s/v1/types.py index ec4c047b2..e01af6041 100644 --- a/scaleway-async/scaleway_async/k8s/v1/types.py +++ b/scaleway-async/scaleway_async/k8s/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -212,18 +212,17 @@ class MaintenanceWindow: @dataclass class PoolUpgradePolicy: max_unavailable: int - max_surge: int @dataclass class CreateClusterRequestPoolConfigUpgradePolicy: - max_unavailable: Optional[int] + max_unavailable: Optional[int] = 0 """ The maximum number of nodes that can be not ready at the same time. """ - max_surge: Optional[int] + max_surge: Optional[int] = 0 """ The maximum number of nodes to be created during the upgrade. """ @@ -236,7 +235,7 @@ class ClusterAutoUpgrade: Defines whether auto upgrade is enabled for the cluster. """ - maintenance_window: Optional[MaintenanceWindow] + maintenance_window: Optional[MaintenanceWindow] = None """ Maintenance window of the cluster auto upgrades. """ @@ -385,16 +384,6 @@ class Pool: Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. """ - created_at: Optional[datetime] - """ - Date on which the pool was created. - """ - - updated_at: Optional[datetime] - """ - Date on which the pool was last updated. - """ - container_runtime: Runtime """ Customization of the container runtime is available for each pool. @@ -443,22 +432,32 @@ class Pool: Cluster region of the pool. """ - placement_group_id: Optional[str] + 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] + upgrade_policy: Optional[PoolUpgradePolicy] = None """ Pool upgrade policy. """ - root_volume_size: Optional[int] + root_volume_size: Optional[int] = 0 """ System volume disk size. """ - new_images_enabled: Optional[bool] + new_images_enabled: Optional[bool] = False """ Defines whether the pool is migrated to new images. """ @@ -471,9 +470,9 @@ class ACLRuleRequest: Description of the ACL. """ - ip: Optional[str] + ip: Optional[str] = None - scaleway_ranges: Optional[bool] + scaleway_ranges: Optional[bool] = False @dataclass @@ -488,9 +487,9 @@ class ACLRule: Description of the ACL. """ - ip: Optional[str] + ip: Optional[str] = None - scaleway_ranges: Optional[bool] + scaleway_ranges: Optional[bool] = False @dataclass @@ -500,7 +499,7 @@ class CreateClusterRequestAutoUpgrade: Defines whether auto upgrade is enabled for the cluster. """ - maintenance_window: Optional[MaintenanceWindow] + maintenance_window: Optional[MaintenanceWindow] = None """ Maintenance window of the cluster auto upgrades. """ @@ -518,42 +517,42 @@ class CreateClusterRequestAutoscalerConfig: Type of node group expander to be used in scale up. """ - scale_down_disabled: Optional[bool] + scale_down_disabled: Optional[bool] = False """ Disable the cluster autoscaler. """ - scale_down_delay_after_add: Optional[str] + scale_down_delay_after_add: Optional[str] = None """ How long after scale up the scale down evaluation resumes. """ - ignore_daemonsets_utilization: Optional[bool] + ignore_daemonsets_utilization: Optional[bool] = False """ Ignore DaemonSet pods when calculating resource utilization for scaling down. """ - balance_similar_node_groups: Optional[bool] + balance_similar_node_groups: Optional[bool] = False """ Detect similar node groups and balance the number of nodes between them. """ - expendable_pods_priority_cutoff: Optional[int] + expendable_pods_priority_cutoff: Optional[int] = 0 """ Pods with priority below cutoff will be expendable. They can be killed without any consideration during scale down and they won't cause scale up. Pods with null priority (PodPriority disabled) are non expendable. """ - scale_down_unneeded_time: Optional[str] + scale_down_unneeded_time: Optional[str] = None """ How long a node should be unneeded before it is eligible to be scaled down. """ - scale_down_utilization_threshold: Optional[float] + 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. """ - max_graceful_termination_sec: Optional[int] + 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. """ @@ -571,27 +570,27 @@ class CreateClusterRequestOpenIDConnectConfig: A client ID that all tokens must be issued for. """ - username_claim: Optional[str] + username_claim: Optional[str] = None """ JWT claim to use as the user name. The default is `sub`, which is expected to be the end user's unique identifier. Admins can choose other claims, such as `email` or `name`, depending on their provider. However, claims other than `email` will be prefixed with the issuer URL to prevent name collision. """ - username_prefix: Optional[str] + username_prefix: Optional[str] = None """ Prefix prepended to username claims to prevent name collision (such as `system:` users). For example, the value `oidc:` will create usernames like `oidc:jane.doe`. If this flag is not provided and `username_claim` is a value other than `email`, the prefix defaults to `( Issuer URL )#` where `( Issuer URL )` is the value of `issuer_url`. The value `-` can be used to disable all prefixing. """ - groups_claim: Optional[List[str]] + groups_claim: Optional[List[str]] = field(default_factory=list) """ JWT claim to use as the user's group. """ - groups_prefix: Optional[str] + groups_prefix: Optional[str] = None """ Prefix prepended to group claims to prevent name collision (such as `system:` groups). For example, the value `oidc:` will create group names like `oidc:engineering` and `oidc:infra`. """ - required_claim: Optional[List[str]] + required_claim: Optional[List[str]] = field(default_factory=list) """ Multiple key=value pairs describing a required claim in the ID token. If set, the claims are verified to be present in the ID token with a matching value. """ @@ -624,21 +623,6 @@ class CreateClusterRequestPoolConfig: Customization of the container runtime is available for each pool. """ - placement_group_id: Optional[str] - """ - Placement group ID in which all the nodes of the pool will be created, placement groups are limited to 20 instances. - """ - - min_size: Optional[int] - """ - Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. - """ - - max_size: Optional[int] - """ - Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. - """ - autohealing: bool """ Defines whether the autohealing feature is enabled for the pool. @@ -672,17 +656,32 @@ class CreateClusterRequestPoolConfig: 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. """ - upgrade_policy: Optional[CreateClusterRequestPoolConfigUpgradePolicy] + 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. + """ + + min_size: Optional[int] = 0 + """ + Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + """ + + max_size: Optional[int] = 0 + """ + Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + """ + + upgrade_policy: Optional[CreateClusterRequestPoolConfigUpgradePolicy] = None """ Pool upgrade policy. """ - root_volume_size: Optional[int] + root_volume_size: Optional[int] = 0 """ System volume disk size. """ - security_group_id: Optional[str] + security_group_id: Optional[str] = None """ 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. """ @@ -690,17 +689,14 @@ class CreateClusterRequestPoolConfig: @dataclass class CreatePoolRequestUpgradePolicy: - max_unavailable: Optional[int] - - max_surge: Optional[int] + max_unavailable: Optional[int] = None + max_surge: Optional[int] = None @dataclass class ExternalNodeCoreV1Taint: key: str - value: str - effect: str @@ -751,7 +747,7 @@ class ClusterType: Maximum amount of data that can be stored in etcd for the offer. """ - commitment_delay: Optional[str] + commitment_delay: Optional[str] = None """ Time period during which you can no longer switch to a lower offer. """ @@ -882,72 +878,72 @@ class Cluster: List of enabled admission plugins. """ - created_at: Optional[datetime] + apiserver_cert_sans: List[str] """ - Date on which the cluster was created. + Additional Subject Alternative Names for the Kubernetes API server certificate. """ - updated_at: Optional[datetime] + iam_nodes_group_id: str """ - Date on which the cluster was last updated. + IAM group that nodes are members of (this field might be empty during early stage of cluster creation). """ - autoscaler_config: Optional[ClusterAutoscalerConfig] + pod_cidr: str """ - Autoscaler config for the cluster. + Subnet used for the Pod CIDR. """ - auto_upgrade: Optional[ClusterAutoUpgrade] + service_cidr: str """ - Auto upgrade Kubernetes version of the cluster. + Subnet used for the Service CIDR. """ - open_id_connect_config: Optional[ClusterOpenIDConnectConfig] + service_dns_ip: str """ - This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. + IP used for the DNS Service. """ - apiserver_cert_sans: List[str] + created_at: Optional[datetime] = None """ - Additional Subject Alternative Names for the Kubernetes API server certificate. + Date on which the cluster was created. """ - iam_nodes_group_id: str + updated_at: Optional[datetime] = None """ - IAM group that nodes are members of (this field might be empty during early stage of cluster creation). + Date on which the cluster was last updated. """ - pod_cidr: str + autoscaler_config: Optional[ClusterAutoscalerConfig] = None """ - Subnet used for the Pod CIDR. + Autoscaler config for the cluster. """ - service_cidr: str + auto_upgrade: Optional[ClusterAutoUpgrade] = None """ - Subnet used for the Service CIDR. + Auto upgrade Kubernetes version of the cluster. """ - service_dns_ip: str + open_id_connect_config: Optional[ClusterOpenIDConnectConfig] = None """ - IP used for the DNS Service. + This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Private network ID for internal cluster communication. """ - commitment_ends_at: Optional[datetime] + commitment_ends_at: Optional[datetime] = None """ Date on which it will be possible to switch to a smaller offer. """ - acl_available: Optional[bool] + acl_available: Optional[bool] = False """ Defines whether ACL is available on the cluster. """ - new_images_enabled: Optional[bool] + new_images_enabled: Optional[bool] = False """ Defines whether all pools are migrated to new images. """ @@ -985,37 +981,37 @@ class Node: Name of the node. """ - public_ip_v4: Optional[str] + status: NodeStatus """ - Public IPv4 address of the node. + Status of the node. """ - public_ip_v6: Optional[str] + public_ip_v4: Optional[str] = None """ - Public IPv6 address of the node. + Public IPv4 address of the node. """ - conditions: Optional[Dict[str, str]] + public_ip_v6: Optional[str] = None """ - Conditions of the node. These conditions contain the Node Problem Detector conditions, as well as some in house conditions. + Public IPv6 address of the node. """ - status: NodeStatus + conditions: Optional[Dict[str, str]] = field(default_factory=dict) """ - Status of the node. + Conditions of the node. These conditions contain the Node Problem Detector conditions, as well as some in house conditions. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Details of the error, if any occurred when managing the node. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the node was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the node was last updated. """ @@ -1024,20 +1020,18 @@ class Node: @dataclass class NodeMetadataCoreV1Taint: key: str - value: str - effect: str @dataclass class UpdateClusterRequestAutoUpgrade: - enable: Optional[bool] + enable: Optional[bool] = False """ Defines whether auto upgrade is enabled for the cluster. """ - maintenance_window: Optional[MaintenanceWindow] + maintenance_window: Optional[MaintenanceWindow] = None """ Maintenance window of the cluster auto upgrades. """ @@ -1055,42 +1049,42 @@ class UpdateClusterRequestAutoscalerConfig: Type of node group expander to be used in scale up. """ - scale_down_disabled: Optional[bool] + scale_down_disabled: Optional[bool] = False """ Disable the cluster autoscaler. """ - scale_down_delay_after_add: Optional[str] + scale_down_delay_after_add: Optional[str] = None """ How long after scale up the scale down evaluation resumes. """ - ignore_daemonsets_utilization: Optional[bool] + ignore_daemonsets_utilization: Optional[bool] = False """ Ignore DaemonSet pods when calculating resource utilization for scaling down. """ - balance_similar_node_groups: Optional[bool] + balance_similar_node_groups: Optional[bool] = False """ Detect similar node groups and balance the number of nodes between them. """ - expendable_pods_priority_cutoff: Optional[int] + expendable_pods_priority_cutoff: Optional[int] = 0 """ Pods with priority below cutoff will be expendable. They can be killed without any consideration during scale down and they won't cause scale up. Pods with null priority (PodPriority disabled) are non expendable. """ - scale_down_unneeded_time: Optional[str] + scale_down_unneeded_time: Optional[str] = None """ How long a node should be unneeded before it is eligible to be scaled down. """ - scale_down_utilization_threshold: Optional[float] + 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. """ - max_graceful_termination_sec: Optional[int] + 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. """ @@ -1098,37 +1092,37 @@ class UpdateClusterRequestAutoscalerConfig: @dataclass class UpdateClusterRequestOpenIDConnectConfig: - issuer_url: Optional[str] + issuer_url: Optional[str] = None """ URL of the provider which allows the API server to discover public signing keys. Only URLs using the `https://` scheme are accepted. This is typically the provider's discovery URL without a path, for example "https://accounts.google.com" or "https://login.salesforce.com". """ - client_id: Optional[str] + client_id: Optional[str] = None """ A client ID that all tokens must be issued for. """ - username_claim: Optional[str] + username_claim: Optional[str] = None """ JWT claim to use as the user name. The default is `sub`, which is expected to be the end user's unique identifier. Admins can choose other claims, such as `email` or `name`, depending on their provider. However, claims other than `email` will be prefixed with the issuer URL to prevent name collision. """ - username_prefix: Optional[str] + username_prefix: Optional[str] = None """ Prefix prepended to username claims to prevent name collision (such as `system:` users). For example, the value `oidc:` will create usernames like `oidc:jane.doe`. If this flag is not provided and `username_claim` is a value other than `email`, the prefix defaults to `( Issuer URL )#` where `( Issuer URL )` is the value of `issuer_url`. The value `-` can be used to disable all prefixing. """ - groups_claim: Optional[List[str]] + groups_claim: Optional[List[str]] = field(default_factory=list) """ JWT claim to use as the user's group. """ - groups_prefix: Optional[str] + groups_prefix: Optional[str] = None """ Prefix prepended to group claims to prevent name collision (such as `system:` groups). For example, the value `oidc:` will create group names like `oidc:engineering` and `oidc:infra`. """ - required_claim: Optional[List[str]] + required_claim: Optional[List[str]] = field(default_factory=list) """ Multiple key=value pairs describing a required claim in the ID token. If set, the claims are verified to be present in the ID token with a matching value. """ @@ -1136,9 +1130,8 @@ class UpdateClusterRequestOpenIDConnectConfig: @dataclass class UpdatePoolRequestUpgradePolicy: - max_unavailable: Optional[int] - - max_surge: Optional[int] + max_unavailable: Optional[int] = None + max_surge: Optional[int] = None @dataclass @@ -1148,12 +1141,12 @@ class AddClusterACLRulesRequest: ID of the cluster whose ACLs will be added. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - acls: Optional[List[ACLRuleRequest]] + acls: Optional[List[ACLRuleRequest]] = field(default_factory=list) """ ACLs to add. """ @@ -1174,7 +1167,7 @@ class AuthExternalNodeRequest: Pool the node will be attached to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1202,86 +1195,85 @@ class CreateClusterRequest: Container Network Interface (CNI) plugin running in the cluster. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Cluster name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the cluster. """ - pools: Optional[List[CreateClusterRequestPoolConfig]] + pools: Optional[List[CreateClusterRequestPoolConfig]] = field(default_factory=list) """ Pools created along with the cluster. """ - autoscaler_config: Optional[CreateClusterRequestAutoscalerConfig] + autoscaler_config: Optional[CreateClusterRequestAutoscalerConfig] = None """ Autoscaler configuration for the cluster. It allows you to set (to an extent) your preferred autoscaler configuration, which is an implementation of the cluster-autoscaler (https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler/). """ - auto_upgrade: Optional[CreateClusterRequestAutoUpgrade] + auto_upgrade: Optional[CreateClusterRequestAutoUpgrade] = None """ Auto upgrade configuration of the cluster. This configuration enables to set a specific 2-hour time window in which the cluster can be automatically updated to the latest patch version. """ - feature_gates: Optional[List[str]] + feature_gates: Optional[List[str]] = field(default_factory=list) """ List of feature gates to enable. """ - admission_plugins: Optional[List[str]] + admission_plugins: Optional[List[str]] = field(default_factory=list) """ List of admission plugins to enable. """ - open_id_connect_config: Optional[CreateClusterRequestOpenIDConnectConfig] + open_id_connect_config: Optional[CreateClusterRequestOpenIDConnectConfig] = None """ OpenID Connect configuration of the cluster. This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. """ - apiserver_cert_sans: Optional[List[str]] + apiserver_cert_sans: Optional[List[str]] = field(default_factory=list) """ Additional Subject Alternative Names for the Kubernetes API server certificate. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Private network ID for internal cluster communication (cannot be changed later). """ - pod_cidr: Optional[str] + pod_cidr: Optional[str] = None """ Subnet used for the Pod CIDR (cannot be changed later). """ - service_cidr: Optional[str] + service_cidr: Optional[str] = None """ Subnet used for the Service CIDR (cannot be changed later). """ - service_dns_ip: Optional[str] + service_dns_ip: Optional[str] = None """ IP used for the DNS Service (cannot be changes later). If unset, default to Service CIDR's network + 10. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass class CreateExternalNodeRequest: pool_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1289,11 +1281,6 @@ class CreateExternalNodeRequest: @dataclass class CreatePoolRequest: - region: Optional[ScwRegion] - """ - Region to target. If none is passed will use default region from the config. - """ - cluster_id: str """ Cluster ID to which the pool will be attached. @@ -1314,62 +1301,67 @@ class CreatePoolRequest: Size (number of nodes) of the pool. """ - name: Optional[str] + autohealing: bool """ - Pool name. + Defines whether the autohealing feature is enabled for the pool. """ - placement_group_id: Optional[str] + public_ip_disabled: bool """ - Placement group ID in which all the nodes of the pool will be created, placement groups are limited to 20 instances. + 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. """ - min_size: Optional[int] + region: Optional[ScwRegion] = None """ - Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + Region to target. If none is passed will use default region from the config. """ - autohealing: bool + name: Optional[str] = None """ - Defines whether the autohealing feature is enabled for the pool. + Pool name. """ - public_ip_disabled: bool + placement_group_id: Optional[str] = None """ - 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. + Placement group ID in which all the nodes of the pool will be created, placement groups are limited to 20 instances. """ - max_size: Optional[int] + min_size: Optional[int] = 0 + """ + Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + """ + + max_size: Optional[int] = 0 """ Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. """ - container_runtime: Optional[Runtime] + container_runtime: Optional[Runtime] = Runtime.UNKNOWN_RUNTIME """ Customization of the container runtime is available for each pool. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the pool, see [managing tags](https://www.scaleway.com/en/docs/containers/kubernetes/api-cli/managing-tags). """ - kubelet_args: Optional[Dict[str, str]] + kubelet_args: Optional[Dict[str, str]] = field(default_factory=dict) """ Kubelet arguments to be used by this pool. Note that this feature is experimental. """ - upgrade_policy: Optional[CreatePoolRequestUpgradePolicy] + upgrade_policy: Optional[CreatePoolRequestUpgradePolicy] = None """ Pool upgrade policy. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone in which the pool's nodes will be spawned. """ - root_volume_type: Optional[PoolVolumeType] + root_volume_type: Optional[PoolVolumeType] = PoolVolumeType.DEFAULT_VOLUME_TYPE """ * `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 @@ -1377,12 +1369,12 @@ class CreatePoolRequest: * `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. """ - root_volume_size: Optional[int] + root_volume_size: Optional[int] = 0 """ System volume disk size. """ - security_group_id: Optional[str] + security_group_id: Optional[str] = None """ 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. """ @@ -1395,7 +1387,7 @@ class DeleteACLRuleRequest: ID of the ACL rule to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1413,7 +1405,7 @@ class DeleteClusterRequest: Defines whether all volumes (including retain volume type), empty Private Networks and Load Balancers with a name starting with the cluster ID will also be deleted. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1436,7 +1428,7 @@ class DeleteNodeRequest: Add a new node after the deletion of this node. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1449,7 +1441,7 @@ class DeletePoolRequest: ID of the pool to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1458,38 +1450,24 @@ class DeletePoolRequest: @dataclass class ExternalNode: id: str - name: str - cluster_url: str - pool_version: str - cluster_ca: str - kube_token: str - kubelet_config: str - external_ip: str - containerd_version: str - runc_version: str - cni_plugins_version: str - node_labels: Dict[str, str] - node_taints: List[ExternalNodeCoreV1Taint] - iam_token: str @dataclass class ExternalNodeAuth: node_secret_key: str - metadata_url: str @@ -1500,12 +1478,12 @@ class GetClusterKubeConfigRequest: Cluster ID for which to download the kubeconfig. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - redacted: Optional[bool] + redacted: Optional[bool] = False """ Hide the legacy token from the kubeconfig. """ @@ -1518,7 +1496,7 @@ class GetClusterRequest: ID of the requested cluster. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1526,7 +1504,7 @@ class GetClusterRequest: @dataclass class GetNodeMetadataRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1539,7 +1517,7 @@ class GetNodeRequest: ID of the requested node. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1552,7 +1530,7 @@ class GetPoolRequest: ID of the requested pool. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1565,7 +1543,7 @@ class GetVersionRequest: Requested version name. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1578,17 +1556,17 @@ class ListClusterACLRulesRequest: ID of the cluster whose ACLs will be listed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned ACLs. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of ACLs per page. """ @@ -1614,7 +1592,7 @@ class ListClusterAvailableTypesRequest: Cluster ID for which the available Kubernetes types will be listed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1640,7 +1618,7 @@ class ListClusterAvailableVersionsRequest: Cluster ID for which the available Kubernetes versions will be listed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1656,17 +1634,17 @@ class ListClusterAvailableVersionsResponse: @dataclass class ListClusterTypesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number, from the paginated results, to return for cluster-types. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of clusters per page. """ @@ -1687,52 +1665,54 @@ class ListClusterTypesResponse: @dataclass class ListClustersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID on which to filter the returned clusters. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID on which to filter the returned clusters. """ - order_by: Optional[ListClustersRequestOrderBy] + order_by: Optional[ListClustersRequestOrderBy] = ( + ListClustersRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of returned clusters. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return for clusters, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of clusters per page. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter on, only clusters containing this substring in their name will be returned. """ - status: Optional[ClusterStatus] + status: Optional[ClusterStatus] = ClusterStatus.UNKNOWN """ Status to filter on, only clusters with this status will be returned. """ - type_: Optional[str] + type_: Optional[str] = None """ Type to filter on, only clusters with this type will be returned. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Private Network ID to filter on, only clusters within this Private Network will be returned. """ @@ -1758,37 +1738,37 @@ class ListNodesRequest: Cluster ID from which the nodes will be listed from. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - pool_id: Optional[str] + pool_id: Optional[str] = None """ Pool ID on which to filter the returned nodes. """ - order_by: Optional[ListNodesRequestOrderBy] + order_by: Optional[ListNodesRequestOrderBy] = ListNodesRequestOrderBy.CREATED_AT_ASC """ Sort order of the returned nodes. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned nodes. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of nodes per page. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter on, only nodes containing this substring in their name will be returned. """ - status: Optional[NodeStatus] + status: Optional[NodeStatus] = NodeStatus.UNKNOWN """ Status to filter on, only nodes with this status will be returned. """ @@ -1814,32 +1794,32 @@ class ListPoolsRequest: ID of the cluster whose pools will be listed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPoolsRequestOrderBy] + order_by: Optional[ListPoolsRequestOrderBy] = ListPoolsRequestOrderBy.CREATED_AT_ASC """ Sort order of returned pools. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned pools. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of pools per page. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter on, only pools containing this substring in their name will be returned. """ - status: Optional[PoolStatus] + status: Optional[PoolStatus] = PoolStatus.UNKNOWN """ Status to filter on, only pools with this status will be returned. """ @@ -1860,7 +1840,7 @@ class ListPoolsResponse: @dataclass class ListVersionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1877,51 +1857,33 @@ class ListVersionsResponse: @dataclass class MigratePoolsToNewImagesRequest: cluster_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - pool_ids: Optional[List[str]] + pool_ids: Optional[List[str]] = None @dataclass class NodeMetadata: id: str - name: str - cluster_url: str - cluster_ca: str - credential_provider_config: str - pool_version: str - kubelet_config: str - node_labels: Dict[str, str] - node_taints: List[NodeMetadataCoreV1Taint] - provider_id: str - resolvconf_path: str - has_gpu: bool - external_ip: str - repo_uri: str - installer_tags: List[str] - updater_bin_url: str - updater_bin_version: str - updater_bin_path: str @@ -1932,7 +1894,7 @@ class RebootNodeRequest: ID of the node to reboot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1945,7 +1907,7 @@ class ReplaceNodeRequest: ID of the node to replace. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1958,7 +1920,7 @@ class ResetClusterAdminTokenRequest: Cluster ID on which the admin token will be renewed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1971,12 +1933,12 @@ class SetClusterACLRulesRequest: ID of the cluster whose ACLs will be set. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - acls: Optional[List[ACLRuleRequest]] + acls: Optional[List[ACLRuleRequest]] = field(default_factory=list) """ ACLs to set. """ @@ -2002,7 +1964,7 @@ class SetClusterTypeRequest: Type of the cluster. Note that some migrations are not possible (please refer to product documentation). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2015,52 +1977,52 @@ class UpdateClusterRequest: ID of the cluster to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ New external name for the cluster. """ - description: Optional[str] + description: Optional[str] = None """ New description for the cluster. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags associated with the cluster. """ - autoscaler_config: Optional[UpdateClusterRequestAutoscalerConfig] + autoscaler_config: Optional[UpdateClusterRequestAutoscalerConfig] = None """ New autoscaler config for the cluster. """ - auto_upgrade: Optional[UpdateClusterRequestAutoUpgrade] + auto_upgrade: Optional[UpdateClusterRequestAutoUpgrade] = None """ New auto upgrade configuration for the cluster. Note that all fields needs to be set. """ - feature_gates: Optional[List[str]] + feature_gates: Optional[List[str]] = field(default_factory=list) """ List of feature gates to enable. """ - admission_plugins: Optional[List[str]] + admission_plugins: Optional[List[str]] = field(default_factory=list) """ List of admission plugins to enable. """ - open_id_connect_config: Optional[UpdateClusterRequestOpenIDConnectConfig] + open_id_connect_config: Optional[UpdateClusterRequestOpenIDConnectConfig] = None """ OpenID Connect configuration of the cluster. This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. """ - apiserver_cert_sans: Optional[List[str]] + apiserver_cert_sans: Optional[List[str]] = field(default_factory=list) """ Additional Subject Alternative Names for the Kubernetes API server certificate. """ @@ -2073,47 +2035,47 @@ class UpdatePoolRequest: ID of the pool to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - autoscaling: Optional[bool] + autoscaling: Optional[bool] = False """ New value for the pool autoscaling enablement. """ - size: Optional[int] + size: Optional[int] = 0 """ New desired pool size. """ - min_size: Optional[int] + min_size: Optional[int] = 0 """ New minimum size for the pool. """ - max_size: Optional[int] + max_size: Optional[int] = 0 """ New maximum size for the pool. """ - autohealing: Optional[bool] + autohealing: Optional[bool] = False """ New value for the pool autohealing enablement. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags associated with the pool. """ - kubelet_args: Optional[Dict[str, str]] + kubelet_args: Optional[Dict[str, str]] = field(default_factory=dict) """ New Kubelet arguments to be used by this pool. Note that this feature is experimental. """ - upgrade_policy: Optional[UpdatePoolRequestUpgradePolicy] + upgrade_policy: Optional[UpdatePoolRequestUpgradePolicy] = None """ New upgrade policy for the pool. """ @@ -2136,7 +2098,7 @@ class UpgradeClusterRequest: Defines whether pools will also be upgraded once the control plane is upgraded. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2154,7 +2116,7 @@ class UpgradePoolRequest: New Kubernetes version for the pool. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ diff --git a/scaleway-async/scaleway_async/key_manager/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/key_manager/v1alpha1/marshalling.py index 2893172b1..14875dc86 100644 --- a/scaleway-async/scaleway_async/key_manager/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/key_manager/v1alpha1/marshalling.py @@ -10,6 +10,10 @@ resolve_one_of, ) from .types import ( + DataKeyAlgorithmSymmetricEncryption, + KeyAlgorithmSymmetricEncryption, + KeyOrigin, + KeyState, KeyRotationPolicy, KeyUsage, Key, @@ -68,7 +72,9 @@ def unmarshal_KeyUsage(data: Any) -> KeyUsage: if field is not None: args["symmetric_encryption"] = field else: - args["symmetric_encryption"] = None + args["symmetric_encryption"] = ( + KeyAlgorithmSymmetricEncryption.UNKNOWN_SYMMETRIC_ENCRYPTION + ) field = data.get("asymmetric_encryption", None) if field is not None: @@ -96,22 +102,32 @@ def unmarshal_Key(data: Any) -> Key: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = KeyState.UNKNOWN_STATE field = data.get("rotation_count", None) if field is not None: args["rotation_count"] = field + else: + args["rotation_count"] = 0 field = data.get("usage", None) if field is not None: @@ -134,22 +150,32 @@ def unmarshal_Key(data: Any) -> Key: field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("locked", None) if field is not None: args["locked"] = field + else: + args["locked"] = False field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("origin", None) if field is not None: args["origin"] = field + else: + args["origin"] = KeyOrigin.UNKNOWN_ORIGIN field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("description", None) if field is not None: @@ -191,14 +217,22 @@ def unmarshal_DataKey(data: Any) -> DataKey: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("algorithm", None) if field is not None: args["algorithm"] = field + else: + args["algorithm"] = ( + DataKeyAlgorithmSymmetricEncryption.UNKNOWN_SYMMETRIC_ENCRYPTION + ) field = data.get("ciphertext", None) if field is not None: args["ciphertext"] = field + else: + args["ciphertext"] = None field = data.get("plaintext", None) if field is not None: @@ -226,10 +260,14 @@ def unmarshal_DecryptResponse(data: Any) -> DecryptResponse: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("plaintext", None) if field is not None: args["plaintext"] = field + else: + args["plaintext"] = None field = data.get("ciphertext", None) if field is not None: @@ -251,10 +289,14 @@ def unmarshal_EncryptResponse(data: Any) -> EncryptResponse: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("ciphertext", None) if field is not None: args["ciphertext"] = field + else: + args["ciphertext"] = None return EncryptResponse(**args) @@ -270,10 +312,14 @@ def unmarshal_ListKeysResponse(data: Any) -> ListKeysResponse: field = data.get("keys", None) if field is not None: args["keys"] = [unmarshal_Key(v) for v in field] if field is not None else None + else: + args["keys"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListKeysResponse(**args) @@ -289,6 +335,8 @@ def unmarshal_PublicKey(data: Any) -> PublicKey: field = data.get("pem", None) if field is not None: args["pem"] = field + else: + args["pem"] = None return PublicKey(**args) @@ -304,10 +352,14 @@ def unmarshal_SignResponse(data: Any) -> SignResponse: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("signature", None) if field is not None: args["signature"] = field + else: + args["signature"] = None return SignResponse(**args) @@ -323,10 +375,14 @@ def unmarshal_VerifyResponse(data: Any) -> VerifyResponse: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("valid", None) if field is not None: args["valid"] = field + else: + args["valid"] = False return VerifyResponse(**args) @@ -386,7 +442,9 @@ def marshal_CreateKeyRequest( output["unprotected"] = request.unprotected if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -406,7 +464,7 @@ def marshal_CreateKeyRequest( ) if request.origin is not None: - output["origin"] = str(request.origin) + output["origin"] = request.origin return output @@ -451,7 +509,7 @@ def marshal_GenerateDataKeyRequest( output["without_plaintext"] = request.without_plaintext if request.algorithm is not None: - output["algorithm"] = str(request.algorithm) + output["algorithm"] = request.algorithm return output diff --git a/scaleway-async/scaleway_async/key_manager/v1alpha1/types.py b/scaleway-async/scaleway_async/key_manager/v1alpha1/types.py index 1ce57e4d0..fdadc54dd 100644 --- a/scaleway-async/scaleway_async/key_manager/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/key_manager/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -100,12 +100,12 @@ def __str__(self) -> str: @dataclass class KeyRotationPolicy: - rotation_period: Optional[str] + rotation_period: Optional[str] = None """ Time interval between two key rotations. The minimum duration is 24 hours and the maximum duration is 1 year (876000 hours). """ - next_rotation_at: Optional[datetime] + next_rotation_at: Optional[datetime] = None """ Timestamp indicating the next scheduled rotation. """ @@ -113,11 +113,13 @@ class KeyRotationPolicy: @dataclass class KeyUsage: - symmetric_encryption: Optional[KeyAlgorithmSymmetricEncryption] + symmetric_encryption: Optional[KeyAlgorithmSymmetricEncryption] = ( + KeyAlgorithmSymmetricEncryption.UNKNOWN_SYMMETRIC_ENCRYPTION + ) - asymmetric_encryption: Optional[KeyAlgorithmAsymmetricEncryption] + asymmetric_encryption: Optional[KeyAlgorithmAsymmetricEncryption] = None - asymmetric_signing: Optional[KeyAlgorithmAsymmetricSigning] + asymmetric_signing: Optional[KeyAlgorithmAsymmetricSigning] = None @dataclass @@ -147,21 +149,6 @@ class Key: The rotation count tracks the number of times the key has been rotated. """ - usage: Optional[KeyUsage] - """ - Keys with a usage set to `symmetric_encryption` can encrypt and decrypt data using the `AES-256-GCM` key algorithm. Key Manager currently only supports `AES-256-GCM`. - """ - - created_at: Optional[datetime] - """ - Key creation date. - """ - - updated_at: Optional[datetime] - """ - Key last modification date. - """ - protected: bool """ Returns `true` if key protection is applied to the key. @@ -187,22 +174,37 @@ class Key: Region where the key is stored. """ - description: Optional[str] + usage: Optional[KeyUsage] = None + """ + Keys with a usage set to `symmetric_encryption` can encrypt and decrypt data using the `AES-256-GCM` key algorithm. Key Manager currently only supports `AES-256-GCM`. + """ + + created_at: Optional[datetime] = None + """ + Key creation date. + """ + + updated_at: Optional[datetime] = None + """ + Key last modification date. + """ + + description: Optional[str] = None """ Description of the key. """ - rotated_at: Optional[datetime] + rotated_at: Optional[datetime] = None """ Key last rotation date. """ - rotation_policy: Optional[KeyRotationPolicy] + rotation_policy: Optional[KeyRotationPolicy] = None """ Key rotation policy. """ - deletion_requested_at: Optional[datetime] + deletion_requested_at: Optional[datetime] = None """ Returns the time at which deletion was requested. """ @@ -215,42 +217,42 @@ class CreateKeyRequest: Default value is `false`. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the key. """ - name: Optional[str] + name: Optional[str] = None """ (Optional) Name of the key. """ - usage: Optional[KeyUsage] + usage: Optional[KeyUsage] = None """ See the `Key.Algorithm.SymmetricEncryption` enum for a description of values. """ - description: Optional[str] + description: Optional[str] = None """ (Optional) Description of the key. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ (Optional) List of the key's tags. """ - rotation_policy: Optional[KeyRotationPolicy] + rotation_policy: Optional[KeyRotationPolicy] = None """ If not specified, no rotation policy will be applied to the key. """ - origin: Optional[KeyOrigin] + origin: Optional[KeyOrigin] = KeyOrigin.UNKNOWN_ORIGIN """ Refer to the `Key.Origin` enum for a description of values. """ @@ -273,12 +275,12 @@ class DataKey: Your data encryption key's ciphertext can be stored safely. It can only be decrypted through the keys you create in Key Manager, using the relevant key ID. """ - plaintext: Optional[str] + plaintext: Optional[str] = None """ (Optional) Your data encryption key's plaintext allows you to use the key immediately upon creation. It must neither be stored or shared. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Data encryption key creation date. """ @@ -296,12 +298,12 @@ class DecryptRequest: Data size must be between 1 and 131071 bytes. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - associated_data: Optional[str] + associated_data: Optional[str] = None """ The additional data must match the value passed in the encryption request. Only supported by keys with a usage set to `symmetric_encryption`. """ @@ -319,7 +321,7 @@ class DecryptResponse: Key's decrypted data. """ - ciphertext: Optional[str] + ciphertext: Optional[str] = None """ If the data was already encrypted with the latest key rotation, no output will be returned in the response object. """ @@ -332,7 +334,7 @@ class DeleteKeyMaterialRequest: ID of the key of which to delete the key material. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -345,7 +347,7 @@ class DeleteKeyRequest: ID of the key to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -358,7 +360,7 @@ class DisableKeyRequest: ID of the key to disable. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -371,7 +373,7 @@ class EnableKeyRequest: ID of the key to enable. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -389,12 +391,12 @@ class EncryptRequest: Data size must be between 1 and 65535 bytes. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - associated_data: Optional[str] + associated_data: Optional[str] = None """ Additional data which will not be encrypted, but authenticated and appended to the encrypted payload. Only supported by keys with a usage set to `symmetric_encryption`. """ @@ -426,12 +428,14 @@ class GenerateDataKeyRequest: Set it to `true` if you do not wish the plaintext to be returned in the response object. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - algorithm: Optional[DataKeyAlgorithmSymmetricEncryption] + algorithm: Optional[DataKeyAlgorithmSymmetricEncryption] = ( + DataKeyAlgorithmSymmetricEncryption.UNKNOWN_SYMMETRIC_ENCRYPTION + ) """ See the `DataKey.Algorithm.SymmetricEncryption` enum for a description of values. """ @@ -444,7 +448,7 @@ class GetKeyRequest: ID of the key to target. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -457,7 +461,7 @@ class GetPublicKeyRequest: ID of the key. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -475,12 +479,12 @@ class ImportKeyMaterialRequest: The key material The key material is a random sequence of bytes used to derive a cryptographic key. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - salt: Optional[str] + salt: Optional[str] = None """ A salt is random data added to key material to ensure unique derived keys, even if the input is similar. It helps strengthen security when the key material has low randomness (low entropy). """ @@ -493,38 +497,35 @@ class ListKeysRequest: Filter keys based on their deletion status. By default, only keys not scheduled for deletion are returned in the output. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ (Optional) Filter by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ (Optional) Filter by Project ID. """ - order_by: Optional[ListKeysRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - tags: Optional[List[str]] + order_by: Optional[ListKeysRequestOrderBy] = ListKeysRequestOrderBy.NAME_ASC + page: Optional[int] = 0 + page_size: Optional[int] = 0 + tags: Optional[List[str]] = field(default_factory=list) """ (Optional) List of tags to filter on. """ - name: Optional[str] + name: Optional[str] = None """ (Optional) Filter by key name. """ - usage: Optional[ListKeysRequestUsage] + usage: Optional[ListKeysRequestUsage] = ListKeysRequestUsage.UNKNOWN_USAGE """ Select from symmetric encryption, asymmetric encryption, or asymmetric signing. """ @@ -550,7 +551,7 @@ class ProtectKeyRequest: ID of the key to apply key protection to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -564,8 +565,7 @@ class PublicKey: @dataclass class RestoreKeyRequest: key_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -578,7 +578,7 @@ class RotateKeyRequest: ID of the key to rotate. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -596,7 +596,7 @@ class SignRequest: The digest must be generated using the same algorithm defined in the key’s algorithm settings. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -622,7 +622,7 @@ class UnprotectKeyRequest: ID of the key to remove key protection from. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -635,27 +635,27 @@ class UpdateKeyRequest: ID of the key to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ (Optional) Updated name of the key. """ - description: Optional[str] + description: Optional[str] = None """ (Optional) Updated description of the key. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ (Optional) Updated list of the key's tags. """ - rotation_policy: Optional[KeyRotationPolicy] + rotation_policy: Optional[KeyRotationPolicy] = None """ If not specified, the key's existing rotation policy applies. """ @@ -678,7 +678,7 @@ class VerifyRequest: The message signature to verify. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ diff --git a/scaleway-async/scaleway_async/lb/v1/marshalling.py b/scaleway-async/scaleway_async/lb/v1/marshalling.py index b64fe7a73..d5a6e87da 100644 --- a/scaleway-async/scaleway_async/lb/v1/marshalling.py +++ b/scaleway-async/scaleway_async/lb/v1/marshalling.py @@ -10,6 +10,23 @@ resolve_one_of, ) from .types import ( + AclActionRedirectRedirectType, + AclActionType, + AclHttpFilter, + BackendServerStatsHealthCheckStatus, + BackendServerStatsServerState, + CertificateStatus, + CertificateType, + ForwardPortAlgorithm, + InstanceStatus, + LbStatus, + LbTypeStock, + OnMarkedDownAction, + PrivateNetworkStatus, + Protocol, + ProxyProtocol, + SSLCompatibilityLevel, + StickySessionsType, Ip, SubscriberEmailConfig, SubscriberWebhookConfig, @@ -117,30 +134,44 @@ def unmarshal_Ip(data: Any) -> Ip: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("ip_address", None) if field is not None: args["ip_address"] = field + else: + args["ip_address"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("reverse", None) if field is not None: args["reverse"] = field + else: + args["reverse"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("lb_id", None) if field is not None: @@ -168,6 +199,8 @@ def unmarshal_SubscriberEmailConfig(data: Any) -> SubscriberEmailConfig: field = data.get("email", None) if field is not None: args["email"] = field + else: + args["email"] = None return SubscriberEmailConfig(**args) @@ -183,6 +216,8 @@ def unmarshal_SubscriberWebhookConfig(data: Any) -> SubscriberWebhookConfig: field = data.get("uri", None) if field is not None: args["uri"] = field + else: + args["uri"] = None return SubscriberWebhookConfig(**args) @@ -198,10 +233,14 @@ def unmarshal_Subscriber(data: Any) -> Subscriber: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("email_config", None) if field is not None: @@ -229,20 +268,26 @@ def unmarshal_HealthCheckHttpConfig(data: Any) -> HealthCheckHttpConfig: field = data.get("uri", None) if field is not None: args["uri"] = field + else: + args["uri"] = None field = data.get("method", None) if field is not None: args["method"] = field + else: + args["method"] = None field = data.get("host_header", None) if field is not None: args["host_header"] = field + else: + args["host_header"] = None field = data.get("code", None) if field is not None: args["code"] = field else: - args["code"] = None + args["code"] = 0 return HealthCheckHttpConfig(**args) @@ -258,24 +303,32 @@ def unmarshal_HealthCheckHttpsConfig(data: Any) -> HealthCheckHttpsConfig: field = data.get("uri", None) if field is not None: args["uri"] = field + else: + args["uri"] = None field = data.get("method", None) if field is not None: args["method"] = field + else: + args["method"] = None field = data.get("host_header", None) if field is not None: args["host_header"] = field + else: + args["host_header"] = None field = data.get("sni", None) if field is not None: args["sni"] = field + else: + args["sni"] = None field = data.get("code", None) if field is not None: args["code"] = field else: - args["code"] = None + args["code"] = 0 return HealthCheckHttpsConfig(**args) @@ -302,6 +355,8 @@ def unmarshal_HealthCheckMysqlConfig(data: Any) -> HealthCheckMysqlConfig: field = data.get("user", None) if field is not None: args["user"] = field + else: + args["user"] = None return HealthCheckMysqlConfig(**args) @@ -317,6 +372,8 @@ def unmarshal_HealthCheckPgsqlConfig(data: Any) -> HealthCheckPgsqlConfig: field = data.get("user", None) if field is not None: args["user"] = field + else: + args["user"] = None return HealthCheckPgsqlConfig(**args) @@ -354,10 +411,14 @@ def unmarshal_HealthCheck(data: Any) -> HealthCheck: field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("check_max_retries", None) if field is not None: args["check_max_retries"] = field + else: + args["check_max_retries"] = 0 field = data.get("check_delay", None) if field is not None: @@ -386,6 +447,8 @@ def unmarshal_HealthCheck(data: Any) -> HealthCheck: field = data.get("check_send_proxy", None) if field is not None: args["check_send_proxy"] = field + else: + args["check_send_proxy"] = False field = data.get("pgsql_config", None) if field is not None: @@ -437,18 +500,26 @@ def unmarshal_Instance(data: Any) -> Instance: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceStatus.UNKNOWN field = data.get("ip_address", None) if field is not None: args["ip_address"] = field + else: + args["ip_address"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -482,68 +553,102 @@ def unmarshal_Lb(data: Any) -> Lb: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = LbStatus.UNKNOWN field = data.get("instances", None) if field is not None: args["instances"] = ( [unmarshal_Instance(v) for v in field] if field is not None else None ) + else: + args["instances"] = field(default_factory=list) field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("ip", None) if field is not None: args["ip"] = [unmarshal_Ip(v) for v in field] if field is not None else None + else: + args["ip"] = field(default_factory=list) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("frontend_count", None) if field is not None: args["frontend_count"] = field + else: + args["frontend_count"] = 0 field = data.get("backend_count", None) if field is not None: args["backend_count"] = field + else: + args["backend_count"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("ssl_compatibility_level", None) if field is not None: args["ssl_compatibility_level"] = field + else: + args["ssl_compatibility_level"] = ( + SSLCompatibilityLevel.SSL_COMPATIBILITY_LEVEL_UNKNOWN + ) field = data.get("private_network_count", None) if field is not None: args["private_network_count"] = field + else: + args["private_network_count"] = 0 field = data.get("route_count", None) if field is not None: args["route_count"] = field + else: + args["route_count"] = 0 field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("subscriber", None) if field is not None: @@ -583,42 +688,62 @@ def unmarshal_Backend(data: Any) -> Backend: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("forward_protocol", None) if field is not None: args["forward_protocol"] = field + else: + args["forward_protocol"] = Protocol.TCP field = data.get("forward_port", None) if field is not None: args["forward_port"] = field + else: + args["forward_port"] = 0 field = data.get("forward_port_algorithm", None) if field is not None: args["forward_port_algorithm"] = field + else: + args["forward_port_algorithm"] = ForwardPortAlgorithm.ROUNDROBIN field = data.get("sticky_sessions", None) if field is not None: args["sticky_sessions"] = field + else: + args["sticky_sessions"] = StickySessionsType.NONE field = data.get("sticky_sessions_cookie_name", None) if field is not None: args["sticky_sessions_cookie_name"] = field + else: + args["sticky_sessions_cookie_name"] = None field = data.get("pool", None) if field is not None: args["pool"] = field + else: + args["pool"] = field(default_factory=list) field = data.get("on_marked_down_action", None) if field is not None: args["on_marked_down_action"] = field + else: + args["on_marked_down_action"] = OnMarkedDownAction.ON_MARKED_DOWN_ACTION_NONE field = data.get("proxy_protocol", None) if field is not None: args["proxy_protocol"] = field + else: + args["proxy_protocol"] = ProxyProtocol.PROXY_PROTOCOL_UNKNOWN field = data.get("health_check", None) if field is not None: @@ -636,7 +761,7 @@ def unmarshal_Backend(data: Any) -> Backend: if field is not None: args["send_proxy_v2"] = field else: - args["send_proxy_v2"] = None + args["send_proxy_v2"] = False field = data.get("timeout_server", None) if field is not None: @@ -678,31 +803,31 @@ def unmarshal_Backend(data: Any) -> Backend: if field is not None: args["ssl_bridging"] = field else: - args["ssl_bridging"] = None + args["ssl_bridging"] = False field = data.get("ignore_ssl_server_verify", None) if field is not None: args["ignore_ssl_server_verify"] = field else: - args["ignore_ssl_server_verify"] = None + args["ignore_ssl_server_verify"] = False field = data.get("redispatch_attempt_count", None) if field is not None: args["redispatch_attempt_count"] = field else: - args["redispatch_attempt_count"] = None + args["redispatch_attempt_count"] = 0 field = data.get("max_retries", None) if field is not None: args["max_retries"] = field else: - args["max_retries"] = None + args["max_retries"] = 0 field = data.get("max_connections", None) if field is not None: args["max_connections"] = field else: - args["max_connections"] = None + args["max_connections"] = 0 field = data.get("timeout_queue", None) if field is not None: @@ -724,26 +849,38 @@ def unmarshal_Certificate(data: Any) -> Certificate: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = CertificateType.LETSENCRYT field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("common_name", None) if field is not None: args["common_name"] = field + else: + args["common_name"] = None field = data.get("subject_alternative_name", None) if field is not None: args["subject_alternative_name"] = field + else: + args["subject_alternative_name"] = field(default_factory=list) field = data.get("fingerprint", None) if field is not None: args["fingerprint"] = field + else: + args["fingerprint"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = CertificateStatus.PENDING field = data.get("not_valid_before", None) if field is not None: @@ -770,6 +907,8 @@ def unmarshal_Certificate(data: Any) -> Certificate: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("created_at", None) if field is not None: @@ -803,18 +942,26 @@ def unmarshal_Frontend(data: Any) -> Frontend: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("inbound_port", None) if field is not None: args["inbound_port"] = field + else: + args["inbound_port"] = 0 field = data.get("certificate_ids", None) if field is not None: args["certificate_ids"] = field + else: + args["certificate_ids"] = field(default_factory=list) field = data.get("backend", None) if field is not None: @@ -837,10 +984,14 @@ def unmarshal_Frontend(data: Any) -> Frontend: field = data.get("enable_http3", None) if field is not None: args["enable_http3"] = field + else: + args["enable_http3"] = False field = data.get("enable_access_logs", None) if field is not None: args["enable_access_logs"] = field + else: + args["enable_access_logs"] = False field = data.get("certificate", None) if field is not None: @@ -864,7 +1015,7 @@ def unmarshal_Frontend(data: Any) -> Frontend: if field is not None: args["connection_rate_limit"] = field else: - args["connection_rate_limit"] = None + args["connection_rate_limit"] = 0 return Frontend(**args) @@ -880,16 +1031,20 @@ def unmarshal_AclActionRedirect(data: Any) -> AclActionRedirect: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = AclActionRedirectRedirectType.LOCATION field = data.get("target", None) if field is not None: args["target"] = field + else: + args["target"] = None field = data.get("code", None) if field is not None: args["code"] = field else: - args["code"] = None + args["code"] = 0 return AclActionRedirect(**args) @@ -905,6 +1060,8 @@ def unmarshal_AclAction(data: Any) -> AclAction: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = AclActionType.ALLOW field = data.get("redirect", None) if field is not None: @@ -926,22 +1083,32 @@ def unmarshal_AclMatch(data: Any) -> AclMatch: field = data.get("ip_subnet", None) if field is not None: args["ip_subnet"] = field + else: + args["ip_subnet"] = field(default_factory=list) field = data.get("ips_edge_services", None) if field is not None: args["ips_edge_services"] = field + else: + args["ips_edge_services"] = False field = data.get("http_filter", None) if field is not None: args["http_filter"] = field + else: + args["http_filter"] = AclHttpFilter.ACL_HTTP_FILTER_NONE field = data.get("http_filter_value", None) if field is not None: args["http_filter_value"] = field + else: + args["http_filter_value"] = field(default_factory=list) field = data.get("invert", None) if field is not None: args["invert"] = field + else: + args["invert"] = False field = data.get("http_filter_option", None) if field is not None: @@ -963,18 +1130,26 @@ def unmarshal_Acl(data: Any) -> Acl: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("index", None) if field is not None: args["index"] = field + else: + args["index"] = 0 field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("match", None) if field is not None: @@ -1049,7 +1224,7 @@ def unmarshal_PrivateNetworkStaticConfig(data: Any) -> PrivateNetworkStaticConfi if field is not None: args["ip_address"] = field else: - args["ip_address"] = None + args["ip_address"] = field(default_factory=list) return PrivateNetworkStaticConfig(**args) @@ -1065,14 +1240,20 @@ def unmarshal_PrivateNetwork(data: Any) -> PrivateNetwork: field = data.get("ipam_ids", None) if field is not None: args["ipam_ids"] = field + else: + args["ipam_ids"] = field(default_factory=list) field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = PrivateNetworkStatus.UNKNOWN field = data.get("lb", None) if field is not None: @@ -1124,6 +1305,8 @@ def unmarshal_RouteMatch(data: Any) -> RouteMatch: field = data.get("match_subdomains", None) if field is not None: args["match_subdomains"] = field + else: + args["match_subdomains"] = False field = data.get("sni", None) if field is not None: @@ -1157,14 +1340,20 @@ def unmarshal_Route(data: Any) -> Route: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("frontend_id", None) if field is not None: args["frontend_id"] = field + else: + args["frontend_id"] = None field = data.get("backend_id", None) if field is not None: args["backend_id"] = field + else: + args["backend_id"] = None field = data.get("match", None) if field is not None: @@ -1198,22 +1387,32 @@ def unmarshal_BackendServerStats(data: Any) -> BackendServerStats: field = data.get("instance_id", None) if field is not None: args["instance_id"] = field + else: + args["instance_id"] = None field = data.get("backend_id", None) if field is not None: args["backend_id"] = field + else: + args["backend_id"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("server_state", None) if field is not None: args["server_state"] = field + else: + args["server_state"] = BackendServerStatsServerState.STOPPED field = data.get("last_health_check_status", None) if field is not None: args["last_health_check_status"] = field + else: + args["last_health_check_status"] = BackendServerStatsHealthCheckStatus.UNKNOWN field = data.get("server_state_changed_at", None) if field is not None: @@ -1241,6 +1440,8 @@ def unmarshal_LbStats(data: Any) -> LbStats: if field is not None else None ) + else: + args["backend_servers_stats"] = field(default_factory=list) return LbStats(**args) @@ -1256,10 +1457,14 @@ def unmarshal_ListAclResponse(data: Any) -> ListAclResponse: field = data.get("acls", None) if field is not None: args["acls"] = [unmarshal_Acl(v) for v in field] if field is not None else None + else: + args["acls"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListAclResponse(**args) @@ -1279,10 +1484,14 @@ def unmarshal_ListBackendStatsResponse(data: Any) -> ListBackendStatsResponse: if field is not None else None ) + else: + args["backend_servers_stats"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListBackendStatsResponse(**args) @@ -1300,10 +1509,14 @@ def unmarshal_ListBackendsResponse(data: Any) -> ListBackendsResponse: args["backends"] = ( [unmarshal_Backend(v) for v in field] if field is not None else None ) + else: + args["backends"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListBackendsResponse(**args) @@ -1321,10 +1534,14 @@ def unmarshal_ListCertificatesResponse(data: Any) -> ListCertificatesResponse: args["certificates"] = ( [unmarshal_Certificate(v) for v in field] if field is not None else None ) + else: + args["certificates"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListCertificatesResponse(**args) @@ -1342,10 +1559,14 @@ def unmarshal_ListFrontendsResponse(data: Any) -> ListFrontendsResponse: args["frontends"] = ( [unmarshal_Frontend(v) for v in field] if field is not None else None ) + else: + args["frontends"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListFrontendsResponse(**args) @@ -1361,10 +1582,14 @@ def unmarshal_ListIpsResponse(data: Any) -> ListIpsResponse: field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_Ip(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListIpsResponse(**args) @@ -1382,10 +1607,14 @@ def unmarshal_ListLbPrivateNetworksResponse(data: Any) -> ListLbPrivateNetworksR args["private_network"] = ( [unmarshal_PrivateNetwork(v) for v in field] if field is not None else None ) + else: + args["private_network"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListLbPrivateNetworksResponse(**args) @@ -1401,18 +1630,26 @@ def unmarshal_LbType(data: Any) -> LbType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = LbTypeStock.UNKNOWN field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("region", None) if field is not None: @@ -1436,10 +1673,14 @@ def unmarshal_ListLbTypesResponse(data: Any) -> ListLbTypesResponse: args["lb_types"] = ( [unmarshal_LbType(v) for v in field] if field is not None else None ) + else: + args["lb_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListLbTypesResponse(**args) @@ -1455,10 +1696,14 @@ def unmarshal_ListLbsResponse(data: Any) -> ListLbsResponse: field = data.get("lbs", None) if field is not None: args["lbs"] = [unmarshal_Lb(v) for v in field] if field is not None else None + else: + args["lbs"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListLbsResponse(**args) @@ -1476,10 +1721,14 @@ def unmarshal_ListRoutesResponse(data: Any) -> ListRoutesResponse: args["routes"] = ( [unmarshal_Route(v) for v in field] if field is not None else None ) + else: + args["routes"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListRoutesResponse(**args) @@ -1497,10 +1746,14 @@ def unmarshal_ListSubscriberResponse(data: Any) -> ListSubscriberResponse: args["subscribers"] = ( [unmarshal_Subscriber(v) for v in field] if field is not None else None ) + else: + args["subscribers"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSubscriberResponse(**args) @@ -1516,10 +1769,14 @@ def unmarshal_SetAclsResponse(data: Any) -> SetAclsResponse: field = data.get("acls", None) if field is not None: args["acls"] = [unmarshal_Acl(v) for v in field] if field is not None else None + else: + args["acls"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return SetAclsResponse(**args) @@ -1609,7 +1866,7 @@ def marshal_AclActionRedirect( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.target is not None: output["target"] = request.target @@ -1627,7 +1884,7 @@ def marshal_AclAction( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.redirect is not None: output["redirect"] = marshal_AclActionRedirect(request.redirect, defaults) @@ -1648,7 +1905,7 @@ def marshal_AclMatch( output["ips_edge_services"] = request.ips_edge_services if request.http_filter is not None: - output["http_filter"] = str(request.http_filter) + output["http_filter"] = request.http_filter if request.http_filter_value is not None: output["http_filter_value"] = request.http_filter_value @@ -1857,16 +2114,16 @@ def marshal_CreateBackendRequest( output: Dict[str, Any] = {} if request.forward_protocol is not None: - output["forward_protocol"] = str(request.forward_protocol) + output["forward_protocol"] = request.forward_protocol if request.forward_port is not None: output["forward_port"] = request.forward_port if request.forward_port_algorithm is not None: - output["forward_port_algorithm"] = str(request.forward_port_algorithm) + output["forward_port_algorithm"] = request.forward_port_algorithm if request.sticky_sessions is not None: - output["sticky_sessions"] = str(request.sticky_sessions) + output["sticky_sessions"] = request.sticky_sessions if request.sticky_sessions_cookie_name is not None: output["sticky_sessions_cookie_name"] = request.sticky_sessions_cookie_name @@ -1893,10 +2150,10 @@ def marshal_CreateBackendRequest( output["timeout_tunnel"] = request.timeout_tunnel if request.on_marked_down_action is not None: - output["on_marked_down_action"] = str(request.on_marked_down_action) + output["on_marked_down_action"] = request.on_marked_down_action if request.proxy_protocol is not None: - output["proxy_protocol"] = str(request.proxy_protocol) + output["proxy_protocol"] = request.proxy_protocol if request.failover_host is not None: output["failover_host"] = request.failover_host @@ -2098,7 +2355,7 @@ def marshal_CreateLbRequest( output["tags"] = request.tags if request.ssl_compatibility_level is not None: - output["ssl_compatibility_level"] = str(request.ssl_compatibility_level) + output["ssl_compatibility_level"] = request.ssl_compatibility_level return output @@ -2298,16 +2555,16 @@ def marshal_UpdateBackendRequest( output["name"] = request.name if request.forward_protocol is not None: - output["forward_protocol"] = str(request.forward_protocol) + output["forward_protocol"] = request.forward_protocol if request.forward_port is not None: output["forward_port"] = request.forward_port if request.forward_port_algorithm is not None: - output["forward_port_algorithm"] = str(request.forward_port_algorithm) + output["forward_port_algorithm"] = request.forward_port_algorithm if request.sticky_sessions is not None: - output["sticky_sessions"] = str(request.sticky_sessions) + output["sticky_sessions"] = request.sticky_sessions if request.sticky_sessions_cookie_name is not None: output["sticky_sessions_cookie_name"] = request.sticky_sessions_cookie_name @@ -2325,10 +2582,10 @@ def marshal_UpdateBackendRequest( output["timeout_tunnel"] = request.timeout_tunnel if request.on_marked_down_action is not None: - output["on_marked_down_action"] = str(request.on_marked_down_action) + output["on_marked_down_action"] = request.on_marked_down_action if request.proxy_protocol is not None: - output["proxy_protocol"] = str(request.proxy_protocol) + output["proxy_protocol"] = request.proxy_protocol if request.failover_host is not None: output["failover_host"] = request.failover_host @@ -2504,7 +2761,7 @@ def marshal_UpdateLbRequest( output["tags"] = request.tags if request.ssl_compatibility_level is not None: - output["ssl_compatibility_level"] = str(request.ssl_compatibility_level) + output["ssl_compatibility_level"] = request.ssl_compatibility_level return output @@ -2631,16 +2888,16 @@ def marshal_ZonedApiCreateBackendRequest( output: Dict[str, Any] = {} if request.forward_protocol is not None: - output["forward_protocol"] = str(request.forward_protocol) + output["forward_protocol"] = request.forward_protocol if request.forward_port is not None: output["forward_port"] = request.forward_port if request.forward_port_algorithm is not None: - output["forward_port_algorithm"] = str(request.forward_port_algorithm) + output["forward_port_algorithm"] = request.forward_port_algorithm if request.sticky_sessions is not None: - output["sticky_sessions"] = str(request.sticky_sessions) + output["sticky_sessions"] = request.sticky_sessions if request.sticky_sessions_cookie_name is not None: output["sticky_sessions_cookie_name"] = request.sticky_sessions_cookie_name @@ -2667,10 +2924,10 @@ def marshal_ZonedApiCreateBackendRequest( output["timeout_tunnel"] = request.timeout_tunnel if request.on_marked_down_action is not None: - output["on_marked_down_action"] = str(request.on_marked_down_action) + output["on_marked_down_action"] = request.on_marked_down_action if request.proxy_protocol is not None: - output["proxy_protocol"] = str(request.proxy_protocol) + output["proxy_protocol"] = request.proxy_protocol if request.failover_host is not None: output["failover_host"] = request.failover_host @@ -2845,7 +3102,7 @@ def marshal_ZonedApiCreateLbRequest( output["tags"] = request.tags if request.ssl_compatibility_level is not None: - output["ssl_compatibility_level"] = str(request.ssl_compatibility_level) + output["ssl_compatibility_level"] = request.ssl_compatibility_level return output @@ -3044,16 +3301,16 @@ def marshal_ZonedApiUpdateBackendRequest( output["name"] = request.name if request.forward_protocol is not None: - output["forward_protocol"] = str(request.forward_protocol) + output["forward_protocol"] = request.forward_protocol if request.forward_port is not None: output["forward_port"] = request.forward_port if request.forward_port_algorithm is not None: - output["forward_port_algorithm"] = str(request.forward_port_algorithm) + output["forward_port_algorithm"] = request.forward_port_algorithm if request.sticky_sessions is not None: - output["sticky_sessions"] = str(request.sticky_sessions) + output["sticky_sessions"] = request.sticky_sessions if request.sticky_sessions_cookie_name is not None: output["sticky_sessions_cookie_name"] = request.sticky_sessions_cookie_name @@ -3071,10 +3328,10 @@ def marshal_ZonedApiUpdateBackendRequest( output["timeout_tunnel"] = request.timeout_tunnel if request.on_marked_down_action is not None: - output["on_marked_down_action"] = str(request.on_marked_down_action) + output["on_marked_down_action"] = request.on_marked_down_action if request.proxy_protocol is not None: - output["proxy_protocol"] = str(request.proxy_protocol) + output["proxy_protocol"] = request.proxy_protocol if request.failover_host is not None: output["failover_host"] = request.failover_host @@ -3250,7 +3507,7 @@ def marshal_ZonedApiUpdateLbRequest( output["tags"] = request.tags if request.ssl_compatibility_level is not None: - output["ssl_compatibility_level"] = str(request.ssl_compatibility_level) + output["ssl_compatibility_level"] = request.ssl_compatibility_level return output diff --git a/scaleway-async/scaleway_async/lb/v1/types.py b/scaleway-async/scaleway_async/lb/v1/types.py index 4d8290ed1..0cf85d3e1 100644 --- a/scaleway-async/scaleway_async/lb/v1/types.py +++ b/scaleway-async/scaleway_async/lb/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -310,7 +310,7 @@ class HealthCheckHttpConfig: The HTTP host header used when performing a health check on backend servers. """ - code: Optional[int] + code: Optional[int] = 0 """ The HTTP response code that should be returned for a health check to be considered successful. """ @@ -338,7 +338,7 @@ class HealthCheckHttpsConfig: The SNI value used when performing a health check on backend servers over SSL. """ - code: Optional[int] + code: Optional[int] = 0 """ The HTTP response code that should be returned for a health check to be considered successful. """ @@ -397,17 +397,17 @@ class Instance: The zone the Instance is in. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Instance was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the Instance was last updated. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ The region the Instance is in. """ @@ -450,12 +450,12 @@ class Ip: The zone the IP address is in. """ - lb_id: Optional[str] + lb_id: Optional[str] = None """ Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ The region the IP address is in. """ @@ -477,9 +477,9 @@ class Subscriber: Subscriber name. """ - email_config: Optional[SubscriberEmailConfig] + email_config: Optional[SubscriberEmailConfig] = None - webhook_config: Optional[SubscriberWebhookConfig] + webhook_config: Optional[SubscriberWebhookConfig] = None @dataclass @@ -499,34 +499,34 @@ class HealthCheck: Defines whether proxy protocol should be activated for the health check. """ - check_delay: Optional[str] + check_delay: Optional[str] = None """ Time to wait between two consecutive health checks. """ - check_timeout: Optional[str] + check_timeout: Optional[str] = None """ Maximum time a backend server has to reply to the health check. """ - transient_check_delay: Optional[str] + transient_check_delay: Optional[str] = None """ Time to wait between two consecutive health checks when a backend server is in a transient state (going UP or DOWN). """ - tcp_config: Optional[HealthCheckTcpConfig] + tcp_config: Optional[HealthCheckTcpConfig] = None - mysql_config: Optional[HealthCheckMysqlConfig] + mysql_config: Optional[HealthCheckMysqlConfig] = None - pgsql_config: Optional[HealthCheckPgsqlConfig] + pgsql_config: Optional[HealthCheckPgsqlConfig] = None - ldap_config: Optional[HealthCheckLdapConfig] + ldap_config: Optional[HealthCheckLdapConfig] = None - redis_config: Optional[HealthCheckRedisConfig] + redis_config: Optional[HealthCheckRedisConfig] = None - http_config: Optional[HealthCheckHttpConfig] + http_config: Optional[HealthCheckHttpConfig] = None - https_config: Optional[HealthCheckHttpsConfig] + https_config: Optional[HealthCheckHttpsConfig] = None @dataclass @@ -611,22 +611,22 @@ class Lb: The zone the Load Balancer is in. """ - subscriber: Optional[Subscriber] + subscriber: Optional[Subscriber] = None """ Subscriber information. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Load Balancer was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the Load Balancer was last updated. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ The region the Load Balancer is in. """ @@ -644,7 +644,7 @@ class AclActionRedirect: Redirect target. For a location redirect, you can use a URL e.g. `https://scaleway.com`. Using a scheme name (e.g. `https`, `http`, `ftp`, `git`) will replace the request's original scheme. This can be useful to implement HTTP to HTTPS redirects. Valid placeholders that can be used in a `location` redirect to preserve parts of the original request in the redirection URL are \{\{host\}\}, \{\{query\}\}, \{\{path\}\} and \{\{scheme\}\}. """ - code: Optional[int] + code: Optional[int] = 0 """ HTTP redirect code to use. Valid values are 301, 302, 303, 307 and 308. Default value is 302. """ @@ -702,77 +702,77 @@ class Backend: Protocol to use between the Load Balancer and backend servers. Allows the backend servers to be informed of the client's real IP address. The PROXY protocol must be supported by the backend servers' software. """ - health_check: Optional[HealthCheck] + health_check: Optional[HealthCheck] = None """ Object defining the health check to be carried out by the backend when checking the status and health of backend servers. """ - lb: Optional[Lb] + lb: Optional[Lb] = None """ Load Balancer the backend is attached to. """ - send_proxy_v2: Optional[bool] + send_proxy_v2: Optional[bool] = False """ Deprecated in favor of proxy_protocol field. """ - timeout_server: Optional[str] + timeout_server: Optional[str] = None """ Maximum allowed time for a backend server to process a request. """ - timeout_connect: Optional[str] + timeout_connect: Optional[str] = None """ Maximum allowed time for establishing a connection to a backend server. """ - timeout_tunnel: Optional[str] + timeout_tunnel: Optional[str] = None """ Maximum allowed tunnel inactivity time after Websocket is established (takes precedence over client and server timeout). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date at which the backend was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date at which the backend was updated. """ - failover_host: Optional[str] + failover_host: Optional[str] = None """ Scaleway Object Storage bucket website to be served as failover if all backend servers are down, e.g. failover-website.s3-website.fr-par.scw.cloud. """ - ssl_bridging: Optional[bool] + ssl_bridging: Optional[bool] = False """ Defines whether to enable SSL bridging between the Load Balancer and backend servers. """ - ignore_ssl_server_verify: Optional[bool] + ignore_ssl_server_verify: Optional[bool] = False """ Defines whether the server certificate verification should be ignored. """ - redispatch_attempt_count: Optional[int] + redispatch_attempt_count: Optional[int] = 0 """ Whether to use another backend server on each attempt. """ - max_retries: Optional[int] + max_retries: Optional[int] = 0 """ Number of retries when a backend server connection failed. """ - max_connections: Optional[int] + max_connections: Optional[int] = 0 """ Maximum number of connections allowed per backend server. """ - timeout_queue: Optional[str] + timeout_queue: Optional[str] = None """ Maximum time for a request to be left pending in queue when `max_connections` is reached. """ @@ -810,37 +810,37 @@ class Certificate: Certificate status. """ - not_valid_before: Optional[datetime] + name: str """ - Lower validity bound. + Certificate name. """ - not_valid_after: Optional[datetime] + not_valid_before: Optional[datetime] = None """ - Upper validity bound. + Lower validity bound. """ - lb: Optional[Lb] + not_valid_after: Optional[datetime] = None """ - Load Balancer object the certificate is attached to. + Upper validity bound. """ - name: str + lb: Optional[Lb] = None """ - Certificate name. + Load Balancer object the certificate is attached to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the certificate was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the certificate was last updated. """ - status_details: Optional[str] + status_details: Optional[str] = None """ Additional information about the certificate status (useful in case of certificate generation failure, for example). """ @@ -853,7 +853,7 @@ class AclAction: Action to take when incoming traffic matches an ACL filter. """ - redirect: Optional[AclActionRedirect] + redirect: Optional[AclActionRedirect] = None """ Redirection parameters when using an ACL with a `redirect` action. """ @@ -886,7 +886,7 @@ class AclMatch: Defines whether to invert the match condition. If set to `true`, the ACL carries out its action when the condition DOES NOT match. """ - http_filter_option: Optional[str] + http_filter_option: Optional[str] = None """ Name of the HTTP header to filter on if `http_header_match` was selected in `http_filter`. """ @@ -914,47 +914,47 @@ class Frontend: List of SSL/TLS certificate IDs to bind to the frontend. """ - backend: Optional[Backend] + enable_http3: bool """ - Backend object the frontend is attached to. + Defines whether to enable HTTP/3 protocol on the frontend. """ - lb: Optional[Lb] + enable_access_logs: bool """ - Load Balancer object the frontend is attached to. + Defines whether to enable access logs on the frontend. """ - timeout_client: Optional[str] + backend: Optional[Backend] = None """ - Maximum allowed inactivity time on the client side. + Backend object the frontend is attached to. """ - enable_http3: bool + lb: Optional[Lb] = None """ - Defines whether to enable HTTP/3 protocol on the frontend. + Load Balancer object the frontend is attached to. """ - enable_access_logs: bool + timeout_client: Optional[str] = None """ - Defines whether to enable access logs on the frontend. + Maximum allowed inactivity time on the client side. """ - certificate: Optional[Certificate] + certificate: Optional[Certificate] = None """ Certificate, deprecated in favor of certificate_ids array. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the frontend was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the frontend was last updated. """ - connection_rate_limit: Optional[int] + connection_rate_limit: Optional[int] = 0 """ Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second. """ @@ -962,7 +962,7 @@ class Frontend: @dataclass class PrivateNetworkDHCPConfig: - ip_id: Optional[str] + ip_id: Optional[str] = None @dataclass @@ -972,7 +972,7 @@ class PrivateNetworkIpamConfig: @dataclass class PrivateNetworkStaticConfig: - ip_address: Optional[List[str]] + ip_address: Optional[List[str]] = field(default_factory=list) """ Array of a local IP address for the Load Balancer on this Private Network. """ @@ -985,11 +985,11 @@ class RouteMatch: If true, all subdomains will match. """ - sni: Optional[str] + sni: Optional[str] = None - host_header: Optional[str] + host_header: Optional[str] = None - path_begin: Optional[str] + path_begin: Optional[str] = None @dataclass @@ -1040,7 +1040,7 @@ class BackendServerStats: Last health check status (unknown/neutral/failed/passed/condpass). """ - server_state_changed_at: Optional[datetime] + server_state_changed_at: Optional[datetime] = None """ Time since last operational change. """ @@ -1068,27 +1068,27 @@ class Acl: ACL description. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` & `http_filter_value` are required. """ - action: Optional[AclAction] + action: Optional[AclAction] = None """ Action to take when incoming traffic matches an ACL filter. """ - frontend: Optional[Frontend] + frontend: Optional[Frontend] = None """ ACL is attached to this frontend object. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the ACL was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the ACL was last updated. """ @@ -1111,26 +1111,26 @@ class PrivateNetwork: Status of Private Network connection. """ - lb: Optional[Lb] + lb: Optional[Lb] = None """ Load Balancer object which is attached to the Private Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Private Network was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the PN was last updated. """ - static_config: Optional[PrivateNetworkStaticConfig] + static_config: Optional[PrivateNetworkStaticConfig] = None - dhcp_config: Optional[PrivateNetworkDHCPConfig] + dhcp_config: Optional[PrivateNetworkDHCPConfig] = None - ipam_config: Optional[PrivateNetworkIpamConfig] + ipam_config: Optional[PrivateNetworkIpamConfig] = None @dataclass @@ -1155,7 +1155,7 @@ class LbType: The zone the Load Balancer stock is in. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ The region the Load Balancer stock is in. """ @@ -1178,17 +1178,17 @@ class Route: ID of the target backend. """ - match: Optional[RouteMatch] + match: Optional[RouteMatch] = None """ Object defining the match condition for a route to be applied. If an incoming client session matches the specified condition (i.e. it has a matching SNI value or HTTP Host header value), it will be passed to the target backend. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the route was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the route was last updated. """ @@ -1216,7 +1216,7 @@ class AclSpec: ACL description. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` and `http_filter_value` are required. """ @@ -1234,7 +1234,7 @@ class AddBackendServersRequest: List of IP addresses to add to backend servers. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1252,21 +1252,21 @@ class AttachPrivateNetworkRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - ipam_ids: Optional[List[str]] + ipam_ids: Optional[List[str]] = field(default_factory=list) """ IPAM ID of a pre-reserved IP address to assign to the Load Balancer on this Private Network. In the future, it will be possible to specify multiple IPs in this field (IPv4 and IPv6), for now only one ID of an IPv4 address is expected. When null, a new private IP address is created for the Load Balancer on this Private Network. """ - static_config: Optional[PrivateNetworkStaticConfig] + static_config: Optional[PrivateNetworkStaticConfig] = None - dhcp_config: Optional[PrivateNetworkDHCPConfig] + dhcp_config: Optional[PrivateNetworkDHCPConfig] = None - ipam_config: Optional[PrivateNetworkIpamConfig] + ipam_config: Optional[PrivateNetworkIpamConfig] = None @dataclass @@ -1295,17 +1295,17 @@ class CreateAclRequest: ACL description. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ ACL name. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` & `http_filter_value` are required. """ @@ -1353,77 +1353,79 @@ class CreateBackendRequest: List of backend server IP addresses (IPv4 or IPv6) the backend should forward traffic to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the backend. """ - send_proxy_v2: Optional[bool] + send_proxy_v2: Optional[bool] = False """ Deprecated in favor of proxy_protocol field. """ - timeout_server: Optional[str] + timeout_server: Optional[str] = None """ Maximum allowed time for a backend server to process a request. """ - timeout_connect: Optional[str] + timeout_connect: Optional[str] = None """ Maximum allowed time for establishing a connection to a backend server. """ - timeout_tunnel: Optional[str] + timeout_tunnel: Optional[str] = None """ Maximum allowed tunnel inactivity time after Websocket is established (takes precedence over client and server timeout). """ - on_marked_down_action: Optional[OnMarkedDownAction] + on_marked_down_action: Optional[OnMarkedDownAction] = ( + OnMarkedDownAction.ON_MARKED_DOWN_ACTION_NONE + ) """ Action to take when a backend server is marked as down. """ - proxy_protocol: Optional[ProxyProtocol] + proxy_protocol: Optional[ProxyProtocol] = ProxyProtocol.PROXY_PROTOCOL_UNKNOWN """ Protocol to use between the Load Balancer and backend servers. Allows the backend servers to be informed of the client's real IP address. The PROXY protocol must be supported by the backend servers' software. """ - failover_host: Optional[str] + failover_host: Optional[str] = None """ Scaleway Object Storage bucket website to be served as failover if all backend servers are down, e.g. failover-website.s3-website.fr-par.scw.cloud. """ - ssl_bridging: Optional[bool] + ssl_bridging: Optional[bool] = False """ Defines whether to enable SSL bridging between the Load Balancer and backend servers. """ - ignore_ssl_server_verify: Optional[bool] + ignore_ssl_server_verify: Optional[bool] = False """ Defines whether the server certificate verification should be ignored. """ - redispatch_attempt_count: Optional[int] + redispatch_attempt_count: Optional[int] = 0 """ Whether to use another backend server on each attempt. """ - max_retries: Optional[int] + max_retries: Optional[int] = 0 """ Number of retries when a backend server connection failed. """ - max_connections: Optional[int] + max_connections: Optional[int] = 0 """ Maximum number of connections allowed per backend server. """ - timeout_queue: Optional[str] + timeout_queue: Optional[str] = None """ Maximum time for a request to be left pending in queue when `max_connections` is reached. """ @@ -1436,19 +1438,19 @@ class CreateCertificateRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the certificate. """ - letsencrypt: Optional[CreateCertificateRequestLetsencryptConfig] + letsencrypt: Optional[CreateCertificateRequestLetsencryptConfig] = None - custom_certificate: Optional[CreateCertificateRequestCustomCertificate] + custom_certificate: Optional[CreateCertificateRequestCustomCertificate] = None @dataclass @@ -1478,32 +1480,32 @@ class CreateFrontendRequest: Defines whether to enable access logs on the frontend. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the frontend. """ - timeout_client: Optional[str] + timeout_client: Optional[str] = None """ Maximum allowed inactivity time on the client side. """ - certificate_id: Optional[str] + certificate_id: Optional[str] = None """ Certificate ID, deprecated in favor of certificate_ids array. """ - certificate_ids: Optional[List[str]] + certificate_ids: Optional[List[str]] = field(default_factory=list) """ List of SSL/TLS certificate IDs to bind to the frontend. """ - connection_rate_limit: Optional[int] + connection_rate_limit: Optional[int] = 0 """ Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second. """ @@ -1516,24 +1518,24 @@ class CreateIpRequest: If true, creates a Flexible IP with an ipv6 address. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse DNS (domain name) for the IP address. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the IP. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -1548,49 +1550,51 @@ class CreateLbRequest: Load Balancer commercial offer type. Use the Load Balancer types endpoint to retrieve a list of available offer types. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the Load Balancer. """ - ip_id: Optional[str] + ip_id: Optional[str] = None """ ID of an existing flexible IP address to attach to the Load Balancer. """ - assign_flexible_ip: Optional[bool] + assign_flexible_ip: Optional[bool] = False """ Defines whether to automatically assign a flexible public IP to the Load Balancer. Default value is `true` (assign). """ - assign_flexible_ipv6: Optional[bool] + assign_flexible_ipv6: Optional[bool] = False """ Defines whether to automatically assign a flexible public IPv6 to the Load Balancer. Default value is `false` (do not assign). """ - ip_ids: Optional[List[str]] + ip_ids: Optional[List[str]] = field(default_factory=list) """ List of IP IDs to attach to the Load Balancer. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Load Balancer. """ - ssl_compatibility_level: Optional[SSLCompatibilityLevel] + ssl_compatibility_level: Optional[SSLCompatibilityLevel] = ( + SSLCompatibilityLevel.SSL_COMPATIBILITY_LEVEL_UNKNOWN + ) """ Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and do not need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -1605,12 +1609,12 @@ class CreateRouteRequest: ID of the target backend for the route. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - match: Optional[RouteMatch] + match: Optional[RouteMatch] = None """ Object defining the match condition for a route to be applied. If an incoming client session matches the specified condition (i.e. it has a matching SNI value or HTTP Host header value), it will be passed to the target backend. """ @@ -1627,18 +1631,18 @@ class CreateSubscriberRequest: Subscriber name. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None - email_config: Optional[SubscriberEmailConfig] + email_config: Optional[SubscriberEmailConfig] = None - webhook_config: Optional[SubscriberWebhookConfig] + webhook_config: Optional[SubscriberWebhookConfig] = None @dataclass @@ -1648,7 +1652,7 @@ class DeleteAclRequest: ACL ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1661,7 +1665,7 @@ class DeleteBackendRequest: ID of the backend to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1674,7 +1678,7 @@ class DeleteCertificateRequest: Certificate ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1687,7 +1691,7 @@ class DeleteFrontendRequest: ID of the frontend to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1705,7 +1709,7 @@ class DeleteLbRequest: Defines whether the Load Balancer's flexible IP should be deleted. Set to true to release the flexible IP, or false to keep it available in your account for future Load Balancers. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1718,7 +1722,7 @@ class DeleteRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1731,7 +1735,7 @@ class DeleteSubscriberRequest: Subscriber ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1749,7 +1753,7 @@ class DetachPrivateNetworkRequest: Set your instance private network id. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1762,7 +1766,7 @@ class GetAclRequest: ACL ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1775,7 +1779,7 @@ class GetBackendRequest: Backend ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1788,7 +1792,7 @@ class GetCertificateRequest: Certificate ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1801,7 +1805,7 @@ class GetFrontendRequest: Frontend ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1814,7 +1818,7 @@ class GetIpRequest: IP address ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1827,7 +1831,7 @@ class GetLbRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1844,12 +1848,12 @@ class GetLbStatsRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - backend_id: Optional[str] + backend_id: Optional[str] = None """ ID of the backend. """ @@ -1862,7 +1866,7 @@ class GetRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1875,7 +1879,7 @@ class GetSubscriberRequest: Subscriber ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1909,27 +1913,27 @@ class ListAclsRequest: Frontend ID (ACLs attached to this frontend will be returned in the response). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListAclRequestOrderBy] + order_by: Optional[ListAclRequestOrderBy] = ListAclRequestOrderBy.CREATED_AT_ASC """ Sort order of ACLs in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of ACLs to return. """ - name: Optional[str] + name: Optional[str] = None """ ACL name to filter for. """ @@ -1942,22 +1946,22 @@ class ListBackendStatsRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of items to return. """ - backend_id: Optional[str] + backend_id: Optional[str] = None """ ID of the backend. """ @@ -1983,27 +1987,29 @@ class ListBackendsRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the backend to filter for. """ - order_by: Optional[ListBackendsRequestOrderBy] + order_by: Optional[ListBackendsRequestOrderBy] = ( + ListBackendsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of backends in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of backends to return. """ @@ -2029,27 +2035,29 @@ class ListCertificatesRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListCertificatesRequestOrderBy] + order_by: Optional[ListCertificatesRequestOrderBy] = ( + ListCertificatesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of certificates in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of certificates to return. """ - name: Optional[str] + name: Optional[str] = None """ Certificate name to filter for, only certificates of this name will be returned. """ @@ -2075,27 +2083,29 @@ class ListFrontendsRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the frontend to filter for. """ - order_by: Optional[ListFrontendsRequestOrderBy] + order_by: Optional[ListFrontendsRequestOrderBy] = ( + ListFrontendsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of frontends in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of frontends to return. """ @@ -2116,42 +2126,42 @@ class ListFrontendsResponse: @dataclass class ListIPsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of IP addresses to return. """ - ip_address: Optional[str] + ip_address: Optional[str] = None """ IP address to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for, only Load Balancer IP addresses from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Load Balancer IP addresses from this Project will be returned. """ - ip_type: Optional[ListIpsRequestIpType] + ip_type: Optional[ListIpsRequestIpType] = ListIpsRequestIpType.ALL """ IP type to filter for. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tag to filter for, only IPs with one or more matching tags will be returned. """ @@ -2177,22 +2187,24 @@ class ListLbPrivateNetworksRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPrivateNetworksRequestOrderBy] + order_by: Optional[ListPrivateNetworksRequestOrderBy] = ( + ListPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of Private Network objects in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of objects to return. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ @@ -2213,17 +2225,17 @@ class ListLbPrivateNetworksResponse: @dataclass class ListLbTypesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of items to return. """ @@ -2244,42 +2256,42 @@ class ListLbTypesResponse: @dataclass class ListLbsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Load Balancer name to filter for. """ - order_by: Optional[ListLbsRequestOrderBy] + order_by: Optional[ListLbsRequestOrderBy] = ListLbsRequestOrderBy.CREATED_AT_ASC """ Sort order of Load Balancers in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Load Balancers to return. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for, only Load Balancers from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Load Balancers from this Project will be returned. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tag, only Load Balancers with one or more matching tags will be returned. """ @@ -2300,27 +2312,29 @@ class ListLbsResponse: @dataclass class ListRoutesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListRoutesRequestOrderBy] + order_by: Optional[ListRoutesRequestOrderBy] = ( + ListRoutesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of routes in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of route objects to return. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - frontend_id: Optional[str] + frontend_id: Optional[str] = None """ Frontend ID to filter for, only Routes from this Frontend will be returned. """ @@ -2341,37 +2355,39 @@ class ListRoutesResponse: @dataclass class ListSubscriberRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListSubscriberRequestOrderBy] + order_by: Optional[ListSubscriberRequestOrderBy] = ( + ListSubscriberRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of subscribers in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of items to return. """ - name: Optional[str] + name: Optional[str] = None """ Subscriber name to search for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter subscribers by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter subscribers by Project ID. """ @@ -2402,7 +2418,7 @@ class MigrateLbRequest: Load Balancer type to migrate to (use the List all Load Balancer offer types endpoint to get a list of available offer types). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2415,7 +2431,7 @@ class ReleaseIpRequest: IP address ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2433,7 +2449,7 @@ class RemoveBackendServersRequest: List of IP addresses to remove from backend servers. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2464,7 +2480,7 @@ class SetBackendServersRequest: List of IP addresses for backend servers. Any other existing backend servers will be removed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2482,7 +2498,7 @@ class SubscribeToLbRequest: Subscriber ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2495,7 +2511,7 @@ class UnsubscribeFromLbRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2523,17 +2539,17 @@ class UpdateAclRequest: Priority of this ACL (ACLs are applied in ascending order, 0 is the first ACL executed). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` & `http_filter_value` are required. """ - description: Optional[str] + description: Optional[str] = None """ ACL description. """ @@ -2576,72 +2592,74 @@ class UpdateBackendRequest: Cookie name for cookie-based sticky sessions. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - send_proxy_v2: Optional[bool] + send_proxy_v2: Optional[bool] = False """ Deprecated in favor of proxy_protocol field. """ - timeout_server: Optional[str] + timeout_server: Optional[str] = None """ Maximum allowed time for a backend server to process a request. """ - timeout_connect: Optional[str] + timeout_connect: Optional[str] = None """ Maximum allowed time for establishing a connection to a backend server. """ - timeout_tunnel: Optional[str] + timeout_tunnel: Optional[str] = None """ Maximum allowed tunnel inactivity time after Websocket is established (takes precedence over client and server timeout). """ - on_marked_down_action: Optional[OnMarkedDownAction] + on_marked_down_action: Optional[OnMarkedDownAction] = ( + OnMarkedDownAction.ON_MARKED_DOWN_ACTION_NONE + ) """ Action to take when a backend server is marked as down. """ - proxy_protocol: Optional[ProxyProtocol] + proxy_protocol: Optional[ProxyProtocol] = ProxyProtocol.PROXY_PROTOCOL_UNKNOWN """ Protocol to use between the Load Balancer and backend servers. Allows the backend servers to be informed of the client's real IP address. The PROXY protocol must be supported by the backend servers' software. """ - failover_host: Optional[str] + failover_host: Optional[str] = None """ Scaleway Object Storage bucket website to be served as failover if all backend servers are down, e.g. failover-website.s3-website.fr-par.scw.cloud. """ - ssl_bridging: Optional[bool] + ssl_bridging: Optional[bool] = False """ Defines whether to enable SSL bridging between the Load Balancer and backend servers. """ - ignore_ssl_server_verify: Optional[bool] + ignore_ssl_server_verify: Optional[bool] = False """ Defines whether the server certificate verification should be ignored. """ - redispatch_attempt_count: Optional[int] + redispatch_attempt_count: Optional[int] = 0 """ Whether to use another backend server on each attempt. """ - max_retries: Optional[int] + max_retries: Optional[int] = 0 """ Number of retries when a backend server connection failed. """ - max_connections: Optional[int] + max_connections: Optional[int] = 0 """ Maximum number of connections allowed per backend server. """ - timeout_queue: Optional[str] + timeout_queue: Optional[str] = None """ Maximum time for a request to be left pending in queue when `max_connections` is reached. """ @@ -2659,7 +2677,7 @@ class UpdateCertificateRequest: Certificate name. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2692,32 +2710,32 @@ class UpdateFrontendRequest: Defines whether to enable HTTP/3 protocol on the frontend. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - timeout_client: Optional[str] + timeout_client: Optional[str] = None """ Maximum allowed inactivity time on the client side. """ - certificate_id: Optional[str] + certificate_id: Optional[str] = None """ Certificate ID, deprecated in favor of certificate_ids array. """ - certificate_ids: Optional[List[str]] + certificate_ids: Optional[List[str]] = field(default_factory=list) """ List of SSL/TLS certificate IDs to bind to the frontend. """ - connection_rate_limit: Optional[int] + connection_rate_limit: Optional[int] = 0 """ Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second. """ - enable_access_logs: Optional[bool] + enable_access_logs: Optional[bool] = False """ Defines whether to enable access logs on the frontend. """ @@ -2745,39 +2763,39 @@ class UpdateHealthCheckRequest: Defines whether proxy protocol should be activated for the health check. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - check_delay: Optional[str] + check_delay: Optional[str] = None """ Time to wait between two consecutive health checks. """ - check_timeout: Optional[str] + check_timeout: Optional[str] = None """ Maximum time a backend server has to reply to the health check. """ - transient_check_delay: Optional[str] + transient_check_delay: Optional[str] = None """ Time to wait between two consecutive health checks when a backend server is in a transient state (going UP or DOWN). """ - tcp_config: Optional[HealthCheckTcpConfig] + tcp_config: Optional[HealthCheckTcpConfig] = None - mysql_config: Optional[HealthCheckMysqlConfig] + mysql_config: Optional[HealthCheckMysqlConfig] = None - pgsql_config: Optional[HealthCheckPgsqlConfig] + pgsql_config: Optional[HealthCheckPgsqlConfig] = None - ldap_config: Optional[HealthCheckLdapConfig] + ldap_config: Optional[HealthCheckLdapConfig] = None - redis_config: Optional[HealthCheckRedisConfig] + redis_config: Optional[HealthCheckRedisConfig] = None - http_config: Optional[HealthCheckHttpConfig] + http_config: Optional[HealthCheckHttpConfig] = None - https_config: Optional[HealthCheckHttpsConfig] + https_config: Optional[HealthCheckHttpsConfig] = None @dataclass @@ -2787,22 +2805,22 @@ class UpdateIpRequest: IP address ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse DNS (domain name) for the IP address. """ - lb_id: Optional[str] + lb_id: Optional[str] = None """ ID of the server on which to attach the flexible IP. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the IP. """ @@ -2825,17 +2843,19 @@ class UpdateLbRequest: Load Balancer description. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Load Balancer. """ - ssl_compatibility_level: Optional[SSLCompatibilityLevel] + ssl_compatibility_level: Optional[SSLCompatibilityLevel] = ( + SSLCompatibilityLevel.SSL_COMPATIBILITY_LEVEL_UNKNOWN + ) """ Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and don't need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort. """ @@ -2853,12 +2873,12 @@ class UpdateRouteRequest: ID of the target backend for the route. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - match: Optional[RouteMatch] + match: Optional[RouteMatch] = None """ Object defining the match condition for a route to be applied. If an incoming client session matches the specified condition (i.e. it has a matching SNI value or HTTP Host header value), it will be passed to the target backend. """ @@ -2876,14 +2896,14 @@ class UpdateSubscriberRequest: Subscriber name. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - email_config: Optional[SubscriberEmailConfig] + email_config: Optional[SubscriberEmailConfig] = None - webhook_config: Optional[SubscriberWebhookConfig] + webhook_config: Optional[SubscriberWebhookConfig] = None @dataclass @@ -2898,7 +2918,7 @@ class ZonedApiAddBackendServersRequest: List of IP addresses to add to backend servers. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2916,21 +2936,21 @@ class ZonedApiAttachPrivateNetworkRequest: Private Network ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ipam_ids: Optional[List[str]] + ipam_ids: Optional[List[str]] = field(default_factory=list) """ IPAM ID of a pre-reserved IP address to assign to the Load Balancer on this Private Network. In the future, it will be possible to specify multiple IPs in this field (IPv4 and IPv6), for now only one ID of an IPv4 address is expected. When null, a new private IP address is created for the Load Balancer on this Private Network. """ - static_config: Optional[PrivateNetworkStaticConfig] + static_config: Optional[PrivateNetworkStaticConfig] = None - dhcp_config: Optional[PrivateNetworkDHCPConfig] + dhcp_config: Optional[PrivateNetworkDHCPConfig] = None - ipam_config: Optional[PrivateNetworkIpamConfig] + ipam_config: Optional[PrivateNetworkIpamConfig] = None @dataclass @@ -2959,17 +2979,17 @@ class ZonedApiCreateAclRequest: ACL description. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ ACL name. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` & `http_filter_value` are required. """ @@ -3017,77 +3037,79 @@ class ZonedApiCreateBackendRequest: List of backend server IP addresses (IPv4 or IPv6) the backend should forward traffic to. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the backend. """ - send_proxy_v2: Optional[bool] + send_proxy_v2: Optional[bool] = False """ Deprecated in favor of proxy_protocol field. """ - timeout_server: Optional[str] + timeout_server: Optional[str] = None """ Maximum allowed time for a backend server to process a request. """ - timeout_connect: Optional[str] + timeout_connect: Optional[str] = None """ Maximum allowed time for establishing a connection to a backend server. """ - timeout_tunnel: Optional[str] + timeout_tunnel: Optional[str] = None """ Maximum allowed tunnel inactivity time after Websocket is established (takes precedence over client and server timeout). """ - on_marked_down_action: Optional[OnMarkedDownAction] + on_marked_down_action: Optional[OnMarkedDownAction] = ( + OnMarkedDownAction.ON_MARKED_DOWN_ACTION_NONE + ) """ Action to take when a backend server is marked as down. """ - proxy_protocol: Optional[ProxyProtocol] + proxy_protocol: Optional[ProxyProtocol] = ProxyProtocol.PROXY_PROTOCOL_UNKNOWN """ Protocol to use between the Load Balancer and backend servers. Allows the backend servers to be informed of the client's real IP address. The PROXY protocol must be supported by the backend servers' software. """ - failover_host: Optional[str] + failover_host: Optional[str] = None """ Scaleway Object Storage bucket website to be served as failover if all backend servers are down, e.g. failover-website.s3-website.fr-par.scw.cloud. """ - ssl_bridging: Optional[bool] + ssl_bridging: Optional[bool] = False """ Defines whether to enable SSL bridging between the Load Balancer and backend servers. """ - ignore_ssl_server_verify: Optional[bool] + ignore_ssl_server_verify: Optional[bool] = False """ Defines whether the server certificate verification should be ignored. """ - redispatch_attempt_count: Optional[int] + redispatch_attempt_count: Optional[int] = 0 """ Whether to use another backend server on each attempt. """ - max_retries: Optional[int] + max_retries: Optional[int] = 0 """ Number of retries when a backend server connection failed. """ - max_connections: Optional[int] + max_connections: Optional[int] = 0 """ Maximum number of connections allowed per backend server. """ - timeout_queue: Optional[str] + timeout_queue: Optional[str] = None """ Maximum time for a request to be left pending in queue when `max_connections` is reached. """ @@ -3100,19 +3122,19 @@ class ZonedApiCreateCertificateRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the certificate. """ - letsencrypt: Optional[CreateCertificateRequestLetsencryptConfig] + letsencrypt: Optional[CreateCertificateRequestLetsencryptConfig] = None - custom_certificate: Optional[CreateCertificateRequestCustomCertificate] + custom_certificate: Optional[CreateCertificateRequestCustomCertificate] = None @dataclass @@ -3142,32 +3164,32 @@ class ZonedApiCreateFrontendRequest: Defines whether to enable access logs on the frontend. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the frontend. """ - timeout_client: Optional[str] + timeout_client: Optional[str] = None """ Maximum allowed inactivity time on the client side. """ - certificate_id: Optional[str] + certificate_id: Optional[str] = None """ Certificate ID, deprecated in favor of certificate_ids array. """ - certificate_ids: Optional[List[str]] + certificate_ids: Optional[List[str]] = field(default_factory=list) """ List of SSL/TLS certificate IDs to bind to the frontend. """ - connection_rate_limit: Optional[int] + connection_rate_limit: Optional[int] = 0 """ Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second. """ @@ -3180,24 +3202,24 @@ class ZonedApiCreateIpRequest: If true, creates a Flexible IP with an ipv6 address. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse DNS (domain name) for the IP address. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the IP. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -3212,49 +3234,51 @@ class ZonedApiCreateLbRequest: Load Balancer commercial offer type. Use the Load Balancer types endpoint to retrieve a list of available offer types. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the Load Balancer. """ - ip_id: Optional[str] + ip_id: Optional[str] = None """ ID of an existing flexible IP address to attach to the Load Balancer. """ - assign_flexible_ip: Optional[bool] + assign_flexible_ip: Optional[bool] = False """ Defines whether to automatically assign a flexible public IP to the Load Balancer. Default value is `true` (assign). """ - assign_flexible_ipv6: Optional[bool] + assign_flexible_ipv6: Optional[bool] = False """ Defines whether to automatically assign a flexible public IPv6 to the Load Balancer. Default value is `false` (do not assign). """ - ip_ids: Optional[List[str]] + ip_ids: Optional[List[str]] = field(default_factory=list) """ List of IP IDs to attach to the Load Balancer. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Load Balancer. """ - ssl_compatibility_level: Optional[SSLCompatibilityLevel] + ssl_compatibility_level: Optional[SSLCompatibilityLevel] = ( + SSLCompatibilityLevel.SSL_COMPATIBILITY_LEVEL_UNKNOWN + ) """ Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and do not need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -3269,12 +3293,12 @@ class ZonedApiCreateRouteRequest: ID of the target backend for the route. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - match: Optional[RouteMatch] + match: Optional[RouteMatch] = None """ Object defining the match condition for a route to be applied. If an incoming client session matches the specified condition (i.e. it has a matching SNI value or HTTP Host header value), it will be passed to the target backend. """ @@ -3291,18 +3315,18 @@ class ZonedApiCreateSubscriberRequest: Subscriber name. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None - email_config: Optional[SubscriberEmailConfig] + email_config: Optional[SubscriberEmailConfig] = None - webhook_config: Optional[SubscriberWebhookConfig] + webhook_config: Optional[SubscriberWebhookConfig] = None @dataclass @@ -3312,7 +3336,7 @@ class ZonedApiDeleteAclRequest: ACL ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3325,7 +3349,7 @@ class ZonedApiDeleteBackendRequest: ID of the backend to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3338,7 +3362,7 @@ class ZonedApiDeleteCertificateRequest: Certificate ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3351,7 +3375,7 @@ class ZonedApiDeleteFrontendRequest: ID of the frontend to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3369,7 +3393,7 @@ class ZonedApiDeleteLbRequest: Defines whether the Load Balancer's flexible IP should be deleted. Set to true to release the flexible IP, or false to keep it available in your account for future Load Balancers. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3382,7 +3406,7 @@ class ZonedApiDeleteRouteRequest: Route ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3395,7 +3419,7 @@ class ZonedApiDeleteSubscriberRequest: Subscriber ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3413,7 +3437,7 @@ class ZonedApiDetachPrivateNetworkRequest: Set your instance private network id. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3426,7 +3450,7 @@ class ZonedApiGetAclRequest: ACL ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3439,7 +3463,7 @@ class ZonedApiGetBackendRequest: Backend ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3452,7 +3476,7 @@ class ZonedApiGetCertificateRequest: Certificate ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3465,7 +3489,7 @@ class ZonedApiGetFrontendRequest: Frontend ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3478,7 +3502,7 @@ class ZonedApiGetIpRequest: IP address ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3491,7 +3515,7 @@ class ZonedApiGetLbRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3508,12 +3532,12 @@ class ZonedApiGetLbStatsRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - backend_id: Optional[str] + backend_id: Optional[str] = None """ ID of the backend. """ @@ -3526,7 +3550,7 @@ class ZonedApiGetRouteRequest: Route ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3539,7 +3563,7 @@ class ZonedApiGetSubscriberRequest: Subscriber ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3552,27 +3576,27 @@ class ZonedApiListAclsRequest: Frontend ID (ACLs attached to this frontend will be returned in the response). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListAclRequestOrderBy] + order_by: Optional[ListAclRequestOrderBy] = ListAclRequestOrderBy.CREATED_AT_ASC """ Sort order of ACLs in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of ACLs to return. """ - name: Optional[str] + name: Optional[str] = None """ ACL name to filter for. """ @@ -3585,22 +3609,22 @@ class ZonedApiListBackendStatsRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of items to return. """ - backend_id: Optional[str] + backend_id: Optional[str] = None """ ID of the backend. """ @@ -3613,27 +3637,29 @@ class ZonedApiListBackendsRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the backend to filter for. """ - order_by: Optional[ListBackendsRequestOrderBy] + order_by: Optional[ListBackendsRequestOrderBy] = ( + ListBackendsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of backends in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of backends to return. """ @@ -3646,27 +3672,29 @@ class ZonedApiListCertificatesRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListCertificatesRequestOrderBy] + order_by: Optional[ListCertificatesRequestOrderBy] = ( + ListCertificatesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of certificates in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of certificates to return. """ - name: Optional[str] + name: Optional[str] = None """ Certificate name to filter for, only certificates of this name will be returned. """ @@ -3679,27 +3707,29 @@ class ZonedApiListFrontendsRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the frontend to filter for. """ - order_by: Optional[ListFrontendsRequestOrderBy] + order_by: Optional[ListFrontendsRequestOrderBy] = ( + ListFrontendsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of frontends in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of frontends to return. """ @@ -3707,42 +3737,42 @@ class ZonedApiListFrontendsRequest: @dataclass class ZonedApiListIPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of IP addresses to return. """ - ip_address: Optional[str] + ip_address: Optional[str] = None """ IP address to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for, only Load Balancer IP addresses from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Load Balancer IP addresses from this Project will be returned. """ - ip_type: Optional[ListIpsRequestIpType] + ip_type: Optional[ListIpsRequestIpType] = ListIpsRequestIpType.ALL """ IP type to filter for. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tag to filter for, only IPs with one or more matching tags will be returned. """ @@ -3755,22 +3785,24 @@ class ZonedApiListLbPrivateNetworksRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListPrivateNetworksRequestOrderBy] + order_by: Optional[ListPrivateNetworksRequestOrderBy] = ( + ListPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of Private Network objects in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of objects to return. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ @@ -3778,17 +3810,17 @@ class ZonedApiListLbPrivateNetworksRequest: @dataclass class ZonedApiListLbTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of items to return. """ @@ -3796,42 +3828,42 @@ class ZonedApiListLbTypesRequest: @dataclass class ZonedApiListLbsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Load Balancer name to filter for. """ - order_by: Optional[ListLbsRequestOrderBy] + order_by: Optional[ListLbsRequestOrderBy] = ListLbsRequestOrderBy.CREATED_AT_ASC """ Sort order of Load Balancers in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Load Balancers to return. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for, only Load Balancers from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Load Balancers from this Project will be returned. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tag, only Load Balancers with one or more matching tags will be returned. """ @@ -3839,27 +3871,29 @@ class ZonedApiListLbsRequest: @dataclass class ZonedApiListRoutesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListRoutesRequestOrderBy] + order_by: Optional[ListRoutesRequestOrderBy] = ( + ListRoutesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of routes in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of route objects to return. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - frontend_id: Optional[str] + frontend_id: Optional[str] = None """ Frontend ID to filter for, only Routes from this Frontend will be returned. """ @@ -3867,37 +3901,39 @@ class ZonedApiListRoutesRequest: @dataclass class ZonedApiListSubscriberRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListSubscriberRequestOrderBy] + order_by: Optional[ListSubscriberRequestOrderBy] = ( + ListSubscriberRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of subscribers in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of items to return. """ - name: Optional[str] + name: Optional[str] = None """ Subscriber name to search for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter subscribers by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter subscribers by Project ID. """ @@ -3915,7 +3951,7 @@ class ZonedApiMigrateLbRequest: Load Balancer type to migrate to (use the List all Load Balancer offer types endpoint to get a list of available offer types). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3928,7 +3964,7 @@ class ZonedApiReleaseIpRequest: IP address ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3946,7 +3982,7 @@ class ZonedApiRemoveBackendServersRequest: List of IP addresses to remove from backend servers. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3964,7 +4000,7 @@ class ZonedApiSetAclsRequest: Frontend ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3982,7 +4018,7 @@ class ZonedApiSetBackendServersRequest: List of IP addresses for backend servers. Any other existing backend servers will be removed. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4000,7 +4036,7 @@ class ZonedApiSubscribeToLbRequest: Subscriber ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4013,7 +4049,7 @@ class ZonedApiUnsubscribeFromLbRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4041,17 +4077,17 @@ class ZonedApiUpdateAclRequest: Priority of this ACL (ACLs are applied in ascending order, 0 is the first ACL executed). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` & `http_filter_value` are required. """ - description: Optional[str] + description: Optional[str] = None """ ACL description. """ @@ -4094,72 +4130,74 @@ class ZonedApiUpdateBackendRequest: Cookie name for cookie-based sticky sessions. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - send_proxy_v2: Optional[bool] + send_proxy_v2: Optional[bool] = False """ Deprecated in favor of proxy_protocol field. """ - timeout_server: Optional[str] + timeout_server: Optional[str] = None """ Maximum allowed time for a backend server to process a request. """ - timeout_connect: Optional[str] + timeout_connect: Optional[str] = None """ Maximum allowed time for establishing a connection to a backend server. """ - timeout_tunnel: Optional[str] + timeout_tunnel: Optional[str] = None """ Maximum allowed tunnel inactivity time after Websocket is established (takes precedence over client and server timeout). """ - on_marked_down_action: Optional[OnMarkedDownAction] + on_marked_down_action: Optional[OnMarkedDownAction] = ( + OnMarkedDownAction.ON_MARKED_DOWN_ACTION_NONE + ) """ Action to take when a backend server is marked as down. """ - proxy_protocol: Optional[ProxyProtocol] + proxy_protocol: Optional[ProxyProtocol] = ProxyProtocol.PROXY_PROTOCOL_UNKNOWN """ Protocol to use between the Load Balancer and backend servers. Allows the backend servers to be informed of the client's real IP address. The PROXY protocol must be supported by the backend servers' software. """ - failover_host: Optional[str] + failover_host: Optional[str] = None """ Scaleway Object Storage bucket website to be served as failover if all backend servers are down, e.g. failover-website.s3-website.fr-par.scw.cloud. """ - ssl_bridging: Optional[bool] + ssl_bridging: Optional[bool] = False """ Defines whether to enable SSL bridging between the Load Balancer and backend servers. """ - ignore_ssl_server_verify: Optional[bool] + ignore_ssl_server_verify: Optional[bool] = False """ Defines whether the server certificate verification should be ignored. """ - redispatch_attempt_count: Optional[int] + redispatch_attempt_count: Optional[int] = 0 """ Whether to use another backend server on each attempt. """ - max_retries: Optional[int] + max_retries: Optional[int] = 0 """ Number of retries when a backend server connection failed. """ - max_connections: Optional[int] + max_connections: Optional[int] = 0 """ Maximum number of connections allowed per backend server. """ - timeout_queue: Optional[str] + timeout_queue: Optional[str] = None """ Maximum time for a request to be left pending in queue when `max_connections` is reached. """ @@ -4177,7 +4215,7 @@ class ZonedApiUpdateCertificateRequest: Certificate name. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4210,32 +4248,32 @@ class ZonedApiUpdateFrontendRequest: Defines whether to enable HTTP/3 protocol on the frontend. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - timeout_client: Optional[str] + timeout_client: Optional[str] = None """ Maximum allowed inactivity time on the client side. """ - certificate_id: Optional[str] + certificate_id: Optional[str] = None """ Certificate ID, deprecated in favor of certificate_ids array. """ - certificate_ids: Optional[List[str]] + certificate_ids: Optional[List[str]] = field(default_factory=list) """ List of SSL/TLS certificate IDs to bind to the frontend. """ - connection_rate_limit: Optional[int] + connection_rate_limit: Optional[int] = 0 """ Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second. """ - enable_access_logs: Optional[bool] + enable_access_logs: Optional[bool] = False """ Defines whether to enable access logs on the frontend. """ @@ -4263,39 +4301,39 @@ class ZonedApiUpdateHealthCheckRequest: Defines whether proxy protocol should be activated for the health check. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - check_delay: Optional[str] + check_delay: Optional[str] = None """ Time to wait between two consecutive health checks. """ - check_timeout: Optional[str] + check_timeout: Optional[str] = None """ Maximum time a backend server has to reply to the health check. """ - transient_check_delay: Optional[str] + transient_check_delay: Optional[str] = None """ Time to wait between two consecutive health checks when a backend server is in a transient state (going UP or DOWN). """ - tcp_config: Optional[HealthCheckTcpConfig] + tcp_config: Optional[HealthCheckTcpConfig] = None - mysql_config: Optional[HealthCheckMysqlConfig] + mysql_config: Optional[HealthCheckMysqlConfig] = None - pgsql_config: Optional[HealthCheckPgsqlConfig] + pgsql_config: Optional[HealthCheckPgsqlConfig] = None - ldap_config: Optional[HealthCheckLdapConfig] + ldap_config: Optional[HealthCheckLdapConfig] = None - redis_config: Optional[HealthCheckRedisConfig] + redis_config: Optional[HealthCheckRedisConfig] = None - http_config: Optional[HealthCheckHttpConfig] + http_config: Optional[HealthCheckHttpConfig] = None - https_config: Optional[HealthCheckHttpsConfig] + https_config: Optional[HealthCheckHttpsConfig] = None @dataclass @@ -4305,22 +4343,22 @@ class ZonedApiUpdateIpRequest: IP address ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse DNS (domain name) for the IP address. """ - lb_id: Optional[str] + lb_id: Optional[str] = None """ ID of the server on which to attach the flexible IP. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the IP. """ @@ -4343,17 +4381,19 @@ class ZonedApiUpdateLbRequest: Load Balancer description. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Load Balancer. """ - ssl_compatibility_level: Optional[SSLCompatibilityLevel] + ssl_compatibility_level: Optional[SSLCompatibilityLevel] = ( + SSLCompatibilityLevel.SSL_COMPATIBILITY_LEVEL_UNKNOWN + ) """ Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and don't need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort. """ @@ -4371,12 +4411,12 @@ class ZonedApiUpdateRouteRequest: ID of the target backend for the route. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - match: Optional[RouteMatch] + match: Optional[RouteMatch] = None """ Object defining the match condition for a route to be applied. If an incoming client session matches the specified condition (i.e. it has a matching SNI value or HTTP Host header value), it will be passed to the target backend. """ @@ -4394,11 +4434,11 @@ class ZonedApiUpdateSubscriberRequest: Subscriber name. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - email_config: Optional[SubscriberEmailConfig] + email_config: Optional[SubscriberEmailConfig] = None - webhook_config: Optional[SubscriberWebhookConfig] + webhook_config: Optional[SubscriberWebhookConfig] = None diff --git a/scaleway-async/scaleway_async/marketplace/v2/marshalling.py b/scaleway-async/scaleway_async/marketplace/v2/marshalling.py index c3c22a3e1..7d49dce30 100644 --- a/scaleway-async/scaleway_async/marketplace/v2/marshalling.py +++ b/scaleway-async/scaleway_async/marketplace/v2/marshalling.py @@ -5,6 +5,7 @@ from dateutil import parser from .types import ( + LocalImageType, Category, Image, LocalImage, @@ -27,14 +28,20 @@ def unmarshal_Category(data: Any) -> Category: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None return Category(**args) @@ -50,26 +57,38 @@ def unmarshal_Image(data: Any) -> Image: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("logo", None) if field is not None: args["logo"] = field + else: + args["logo"] = None field = data.get("categories", None) if field is not None: args["categories"] = field + else: + args["categories"] = field(default_factory=list) field = data.get("label", None) if field is not None: args["label"] = field + else: + args["label"] = None field = data.get("created_at", None) if field is not None: @@ -105,26 +124,38 @@ def unmarshal_LocalImage(data: Any) -> LocalImage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("compatible_commercial_types", None) if field is not None: args["compatible_commercial_types"] = field + else: + args["compatible_commercial_types"] = field(default_factory=list) field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("label", None) if field is not None: args["label"] = field + else: + args["label"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = LocalImageType.UNKNOWN_TYPE return LocalImage(**args) @@ -140,10 +171,14 @@ def unmarshal_Version(data: Any) -> Version: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("created_at", None) if field is not None: @@ -181,10 +216,14 @@ def unmarshal_ListCategoriesResponse(data: Any) -> ListCategoriesResponse: args["categories"] = ( [unmarshal_Category(v) for v in field] if field is not None else None ) + else: + args["categories"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListCategoriesResponse(**args) @@ -202,10 +241,14 @@ def unmarshal_ListImagesResponse(data: Any) -> ListImagesResponse: args["images"] = ( [unmarshal_Image(v) for v in field] if field is not None else None ) + else: + args["images"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListImagesResponse(**args) @@ -223,10 +266,14 @@ def unmarshal_ListLocalImagesResponse(data: Any) -> ListLocalImagesResponse: args["local_images"] = ( [unmarshal_LocalImage(v) for v in field] if field is not None else None ) + else: + args["local_images"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListLocalImagesResponse(**args) @@ -244,9 +291,13 @@ def unmarshal_ListVersionsResponse(data: Any) -> ListVersionsResponse: args["versions"] = ( [unmarshal_Version(v) for v in field] if field is not None else None ) + else: + args["versions"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListVersionsResponse(**args) diff --git a/scaleway-async/scaleway_async/marketplace/v2/types.py b/scaleway-async/scaleway_async/marketplace/v2/types.py index fd972c3a8..fda64d01b 100644 --- a/scaleway-async/scaleway_async/marketplace/v2/types.py +++ b/scaleway-async/scaleway_async/marketplace/v2/types.py @@ -57,9 +57,7 @@ def __str__(self) -> str: @dataclass class Category: id: str - name: str - description: str @@ -96,17 +94,17 @@ class Image: This label can be used in the image field of the server creation request. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of this image. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date of the last modification of this image. """ - valid_until: Optional[datetime] + valid_until: Optional[datetime] = None """ Expiration date of this image. """ @@ -157,17 +155,17 @@ class Version: Name of this version. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of this image version. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date of the last modification of this version. """ - published_at: Optional[datetime] + published_at: Optional[datetime] = None """ Date this version was officially published. """ @@ -198,15 +196,13 @@ class GetVersionRequest: @dataclass class ListCategoriesRequest: - page_size: Optional[int] - - page: Optional[int] + page_size: Optional[int] = None + page: Optional[int] = None @dataclass class ListCategoriesResponse: categories: List[Category] - total_count: int @@ -217,27 +213,27 @@ class ListImagesRequest: Choose to include end-of-life images. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to display. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to display. """ - order_by: Optional[ListImagesRequestOrderBy] + order_by: Optional[ListImagesRequestOrderBy] = ListImagesRequestOrderBy.NAME_ASC """ Ordering to use. """ - arch: Optional[str] + arch: Optional[str] = None """ Choose for which machine architecture to return images. """ - category: Optional[str] + category: Optional[str] = None """ Choose the category of images to get. """ @@ -246,64 +242,60 @@ class ListImagesRequest: @dataclass class ListImagesResponse: images: List[Image] - total_count: int @dataclass class ListLocalImagesRequest: - page_size: Optional[int] + page_size: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to display. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to display. """ - order_by: Optional[ListLocalImagesRequestOrderBy] + order_by: Optional[ListLocalImagesRequestOrderBy] = ( + ListLocalImagesRequestOrderBy.TYPE_ASC + ) """ Ordering to use. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Filter local images available on this Availability Zone. """ - type_: Optional[LocalImageType] + type_: Optional[LocalImageType] = LocalImageType.UNKNOWN_TYPE """ Filter by type. """ - image_id: Optional[str] + image_id: Optional[str] = None - version_id: Optional[str] + version_id: Optional[str] = None - image_label: Optional[str] + image_label: Optional[str] = None @dataclass class ListLocalImagesResponse: local_images: List[LocalImage] - total_count: int @dataclass class ListVersionsRequest: image_id: str - - page_size: Optional[int] - - page: Optional[int] - - order_by: Optional[ListVersionsRequestOrderBy] + page_size: Optional[int] = None + page: Optional[int] = None + order_by: Optional[ListVersionsRequestOrderBy] = None @dataclass class ListVersionsResponse: versions: List[Version] - total_count: int diff --git a/scaleway-async/scaleway_async/mnq/v1beta1/marshalling.py b/scaleway-async/scaleway_async/mnq/v1beta1/marshalling.py index a61ebfcb1..1fb55617a 100644 --- a/scaleway-async/scaleway_async/mnq/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/mnq/v1beta1/marshalling.py @@ -6,6 +6,8 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + SnsInfoStatus, + SqsInfoStatus, NatsAccount, File, NatsCredentials, @@ -44,22 +46,32 @@ def unmarshal_NatsAccount(data: Any) -> NatsAccount: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -87,10 +99,14 @@ def unmarshal_File(data: Any) -> File: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("content", None) if field is not None: args["content"] = field + else: + args["content"] = None return File(**args) @@ -106,18 +122,26 @@ def unmarshal_NatsCredentials(data: Any) -> NatsCredentials: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("nats_account_id", None) if field is not None: args["nats_account_id"] = field + else: + args["nats_account_id"] = None field = data.get("checksum", None) if field is not None: args["checksum"] = field + else: + args["checksum"] = None field = data.get("created_at", None) if field is not None: @@ -152,19 +176,19 @@ def unmarshal_SnsPermissions(data: Any) -> SnsPermissions: if field is not None: args["can_publish"] = field else: - args["can_publish"] = None + args["can_publish"] = False field = data.get("can_receive", None) if field is not None: args["can_receive"] = field else: - args["can_receive"] = None + args["can_receive"] = False field = data.get("can_manage", None) if field is not None: args["can_manage"] = field else: - args["can_manage"] = None + args["can_manage"] = False return SnsPermissions(**args) @@ -180,30 +204,44 @@ def unmarshal_SnsCredentials(data: Any) -> SnsCredentials: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None field = data.get("secret_key", None) if field is not None: args["secret_key"] = field + else: + args["secret_key"] = None field = data.get("secret_checksum", None) if field is not None: args["secret_checksum"] = field + else: + args["secret_checksum"] = None field = data.get("created_at", None) if field is not None: @@ -238,19 +276,19 @@ def unmarshal_SqsPermissions(data: Any) -> SqsPermissions: if field is not None: args["can_publish"] = field else: - args["can_publish"] = None + args["can_publish"] = False field = data.get("can_receive", None) if field is not None: args["can_receive"] = field else: - args["can_receive"] = None + args["can_receive"] = False field = data.get("can_manage", None) if field is not None: args["can_manage"] = field else: - args["can_manage"] = None + args["can_manage"] = False return SqsPermissions(**args) @@ -266,30 +304,44 @@ def unmarshal_SqsCredentials(data: Any) -> SqsCredentials: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None field = data.get("secret_key", None) if field is not None: args["secret_key"] = field + else: + args["secret_key"] = None field = data.get("secret_checksum", None) if field is not None: args["secret_checksum"] = field + else: + args["secret_checksum"] = None field = data.get("created_at", None) if field is not None: @@ -323,12 +375,16 @@ def unmarshal_ListNatsAccountsResponse(data: Any) -> ListNatsAccountsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("nats_accounts", None) if field is not None: args["nats_accounts"] = ( [unmarshal_NatsAccount(v) for v in field] if field is not None else None ) + else: + args["nats_accounts"] = field(default_factory=list) return ListNatsAccountsResponse(**args) @@ -344,12 +400,16 @@ def unmarshal_ListNatsCredentialsResponse(data: Any) -> ListNatsCredentialsRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("nats_credentials", None) if field is not None: args["nats_credentials"] = ( [unmarshal_NatsCredentials(v) for v in field] if field is not None else None ) + else: + args["nats_credentials"] = field(default_factory=list) return ListNatsCredentialsResponse(**args) @@ -365,12 +425,16 @@ def unmarshal_ListSnsCredentialsResponse(data: Any) -> ListSnsCredentialsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("sns_credentials", None) if field is not None: args["sns_credentials"] = ( [unmarshal_SnsCredentials(v) for v in field] if field is not None else None ) + else: + args["sns_credentials"] = field(default_factory=list) return ListSnsCredentialsResponse(**args) @@ -386,12 +450,16 @@ def unmarshal_ListSqsCredentialsResponse(data: Any) -> ListSqsCredentialsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("sqs_credentials", None) if field is not None: args["sqs_credentials"] = ( [unmarshal_SqsCredentials(v) for v in field] if field is not None else None ) + else: + args["sqs_credentials"] = field(default_factory=list) return ListSqsCredentialsResponse(**args) @@ -407,18 +475,26 @@ def unmarshal_SnsInfo(data: Any) -> SnsInfo: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SnsInfoStatus.UNKNOWN_STATUS field = data.get("sns_endpoint_url", None) if field is not None: args["sns_endpoint_url"] = field + else: + args["sns_endpoint_url"] = None field = data.get("created_at", None) if field is not None: @@ -446,18 +522,26 @@ def unmarshal_SqsInfo(data: Any) -> SqsInfo: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SqsInfoStatus.UNKNOWN_STATUS field = data.get("sqs_endpoint_url", None) if field is not None: args["sqs_endpoint_url"] = field + else: + args["sqs_endpoint_url"] = None field = data.get("created_at", None) if field is not None: @@ -484,7 +568,9 @@ def marshal_NatsApiCreateNatsAccountRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -523,7 +609,9 @@ def marshal_SnsApiActivateSnsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -553,7 +641,9 @@ def marshal_SnsApiCreateSnsCredentialsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -571,7 +661,9 @@ def marshal_SnsApiDeactivateSnsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -598,7 +690,9 @@ def marshal_SqsApiActivateSqsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -628,7 +722,9 @@ def marshal_SqsApiCreateSqsCredentialsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -646,7 +742,9 @@ def marshal_SqsApiDeactivateSqsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output diff --git a/scaleway-async/scaleway_async/mnq/v1beta1/types.py b/scaleway-async/scaleway_async/mnq/v1beta1/types.py index 29a4a641d..631b7c479 100644 --- a/scaleway-async/scaleway_async/mnq/v1beta1/types.py +++ b/scaleway-async/scaleway_async/mnq/v1beta1/types.py @@ -96,17 +96,17 @@ class File: @dataclass class SnsPermissions: - can_publish: Optional[bool] + can_publish: Optional[bool] = False """ Defines whether the credentials bearer can publish messages to the service (publish to Topics and Events topics). """ - can_receive: Optional[bool] + can_receive: Optional[bool] = False """ Defines whether the credentials bearer can receive messages from the service (configure subscriptions). """ - can_manage: Optional[bool] + can_manage: Optional[bool] = False """ Defines whether the credentials bearer can manage the associated Topics and Events topics or subscriptions. """ @@ -114,17 +114,17 @@ class SnsPermissions: @dataclass class SqsPermissions: - can_publish: Optional[bool] + can_publish: Optional[bool] = False """ Defines whether the credentials bearer can publish messages to the service (send messages to Queues queues). """ - can_receive: Optional[bool] + can_receive: Optional[bool] = False """ Defines whether the credentials bearer can receive messages from Queues queues. """ - can_manage: Optional[bool] + can_manage: Optional[bool] = False """ Defines whether the credentials bearer can manage the associated Queues queues. """ @@ -157,12 +157,12 @@ class NatsAccount: Region where the NATS account is deployed. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ NATS account creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ NATS account last modification date. """ @@ -190,17 +190,17 @@ class NatsCredentials: Checksum of the credentials file. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ NATS credentials creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ NATS credentials last modification date. """ - credentials: Optional[File] + credentials: Optional[File] = None """ Object containing the credentials file (Only returned by **Create Nats Credentials** call). """ @@ -243,17 +243,17 @@ class SnsCredentials: Checksum of the Secret key. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Credentials creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Credentials last modification date. """ - permissions: Optional[SnsPermissions] + permissions: Optional[SnsPermissions] = None """ Permissions associated with these credentials. """ @@ -296,17 +296,17 @@ class SqsCredentials: Checksum of the Secret key. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Credentials creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Credentials last modification date. """ - permissions: Optional[SqsPermissions] + permissions: Optional[SqsPermissions] = None """ Permissions associated with these credentials. """ @@ -366,17 +366,17 @@ class ListSqsCredentialsResponse: @dataclass class NatsApiCreateNatsAccountRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ NATS account name. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project containing the NATS account. """ @@ -389,12 +389,12 @@ class NatsApiCreateNatsCredentialsRequest: NATS account containing the credentials. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the credentials. """ @@ -407,7 +407,7 @@ class NatsApiDeleteNatsAccountRequest: ID of the NATS account to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -420,7 +420,7 @@ class NatsApiDeleteNatsCredentialsRequest: ID of the credentials to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -433,7 +433,7 @@ class NatsApiGetNatsAccountRequest: ID of the NATS account to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -446,7 +446,7 @@ class NatsApiGetNatsCredentialsRequest: ID of the credentials to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -454,27 +454,29 @@ class NatsApiGetNatsCredentialsRequest: @dataclass class NatsApiListNatsAccountsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only NATS accounts in this Project. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of NATS accounts to return per page. """ - order_by: Optional[ListNatsAccountsRequestOrderBy] + order_by: Optional[ListNatsAccountsRequestOrderBy] = ( + ListNatsAccountsRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ @@ -482,32 +484,34 @@ class NatsApiListNatsAccountsRequest: @dataclass class NatsApiListNatsCredentialsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only NATS accounts in this Project. """ - nats_account_id: Optional[str] + nats_account_id: Optional[str] = None """ Include only credentials for this NATS account. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of credentials to return per page. """ - order_by: Optional[ListNatsCredentialsRequestOrderBy] + order_by: Optional[ListNatsCredentialsRequestOrderBy] = ( + ListNatsCredentialsRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ @@ -520,12 +524,12 @@ class NatsApiUpdateNatsAccountRequest: ID of the NATS account to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ NATS account name. """ @@ -533,12 +537,12 @@ class NatsApiUpdateNatsAccountRequest: @dataclass class SnsApiActivateSnsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project on which to activate the Topics and Events service. """ @@ -546,22 +550,22 @@ class SnsApiActivateSnsRequest: @dataclass class SnsApiCreateSnsCredentialsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project containing the Topics and Events credentials. """ - name: Optional[str] + name: Optional[str] = None """ Name of the credentials. """ - permissions: Optional[SnsPermissions] + permissions: Optional[SnsPermissions] = None """ Permissions associated with these credentials. """ @@ -569,12 +573,12 @@ class SnsApiCreateSnsCredentialsRequest: @dataclass class SnsApiDeactivateSnsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project on which to deactivate the Topics and Events service. """ @@ -587,7 +591,7 @@ class SnsApiDeleteSnsCredentialsRequest: ID of the credentials to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -600,7 +604,7 @@ class SnsApiGetSnsCredentialsRequest: ID of the Topics and Events credentials to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -608,12 +612,12 @@ class SnsApiGetSnsCredentialsRequest: @dataclass class SnsApiGetSnsInfoRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project to retrieve Topics and Events info from. """ @@ -621,27 +625,29 @@ class SnsApiGetSnsInfoRequest: @dataclass class SnsApiListSnsCredentialsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only Topics and Events credentials in this Project. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of credentials to return per page. """ - order_by: Optional[ListSnsCredentialsRequestOrderBy] + order_by: Optional[ListSnsCredentialsRequestOrderBy] = ( + ListSnsCredentialsRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ @@ -654,17 +660,17 @@ class SnsApiUpdateSnsCredentialsRequest: ID of the Topics and Events credentials to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the credentials. """ - permissions: Optional[SnsPermissions] + permissions: Optional[SnsPermissions] = None """ Permissions associated with these credentials. """ @@ -692,12 +698,12 @@ class SnsInfo: Endpoint of the Topics and Events service for this region and project. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Topics and Events creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Topics and Events last modification date. """ @@ -705,12 +711,12 @@ class SnsInfo: @dataclass class SqsApiActivateSqsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project on which to activate the Queues service. """ @@ -718,22 +724,22 @@ class SqsApiActivateSqsRequest: @dataclass class SqsApiCreateSqsCredentialsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project containing the Queues credentials. """ - name: Optional[str] + name: Optional[str] = None """ Name of the credentials. """ - permissions: Optional[SqsPermissions] + permissions: Optional[SqsPermissions] = None """ Permissions associated with these credentials. """ @@ -741,12 +747,12 @@ class SqsApiCreateSqsCredentialsRequest: @dataclass class SqsApiDeactivateSqsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project on which to deactivate the Queues service. """ @@ -759,7 +765,7 @@ class SqsApiDeleteSqsCredentialsRequest: ID of the credentials to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -772,7 +778,7 @@ class SqsApiGetSqsCredentialsRequest: ID of the Queues credentials to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -780,12 +786,12 @@ class SqsApiGetSqsCredentialsRequest: @dataclass class SqsApiGetSqsInfoRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project to retrieve Queues info from. """ @@ -793,27 +799,29 @@ class SqsApiGetSqsInfoRequest: @dataclass class SqsApiListSqsCredentialsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only Queues credentials in this Project. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of credentials to return per page. """ - order_by: Optional[ListSqsCredentialsRequestOrderBy] + order_by: Optional[ListSqsCredentialsRequestOrderBy] = ( + ListSqsCredentialsRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ @@ -826,17 +834,17 @@ class SqsApiUpdateSqsCredentialsRequest: ID of the Queues credentials to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the credentials. """ - permissions: Optional[SqsPermissions] + permissions: Optional[SqsPermissions] = None """ Permissions associated with these credentials. """ @@ -864,12 +872,12 @@ class SqsInfo: Endpoint of the Queues service for this region and project. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Queues creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Queues last modification date. """ diff --git a/scaleway-async/scaleway_async/mongodb/v1/marshalling.py b/scaleway-async/scaleway_async/mongodb/v1/marshalling.py index 9d4184b4f..fdb272d2c 100644 --- a/scaleway-async/scaleway_async/mongodb/v1/marshalling.py +++ b/scaleway-async/scaleway_async/mongodb/v1/marshalling.py @@ -10,6 +10,11 @@ resolve_one_of, ) from .types import ( + InstanceStatus, + NodeTypeStock, + SnapshotStatus, + UserRoleRole, + VolumeType, EndpointPrivateNetworkDetails, EndpointPublicNetworkDetails, Endpoint, @@ -56,6 +61,8 @@ def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetwork field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None return EndpointPrivateNetworkDetails(**args) @@ -82,14 +89,20 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("dns_record", None) if field is not None: args["dns_record"] = field + else: + args["dns_record"] = None field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("private_network", None) if field is not None: @@ -117,14 +130,20 @@ def unmarshal_InstanceSnapshotSchedule(data: Any) -> InstanceSnapshotSchedule: field = data.get("frequency_hours", None) if field is not None: args["frequency_hours"] = field + else: + args["frequency_hours"] = None field = data.get("retention_days", None) if field is not None: args["retention_days"] = field + else: + args["retention_days"] = None field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = None field = data.get("next_update", None) if field is not None: @@ -154,10 +173,14 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = VolumeType.UNKNOWN_TYPE field = data.get("size_bytes", None) if field is not None: args["size_bytes"] = field + else: + args["size_bytes"] = 0 return Volume(**args) @@ -173,48 +196,70 @@ def unmarshal_Instance(data: Any) -> Instance: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceStatus.UNKNOWN_STATUS field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("node_amount", None) if field is not None: args["node_amount"] = field + else: + args["node_amount"] = 0 field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("volume", None) if field is not None: @@ -248,34 +293,50 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["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"] = SnapshotStatus.UNKNOWN_STATUS field = data.get("size_bytes", None) if field is not None: args["size_bytes"] = field + else: + args["size_bytes"] = 0 field = data.get("instance_name", None) if field is not None: args["instance_name"] = field + else: + args["instance_name"] = None field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = VolumeType.UNKNOWN_TYPE field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("instance_id", None) if field is not None: @@ -315,6 +376,8 @@ def unmarshal_UserRole(data: Any) -> UserRole: field = data.get("role", None) if field is not None: args["role"] = field + else: + args["role"] = UserRoleRole.UNKNOWN_ROLE field = data.get("database_name", None) if field is not None: @@ -326,7 +389,7 @@ def unmarshal_UserRole(data: Any) -> UserRole: if field is not None: args["any_database"] = field else: - args["any_database"] = None + args["any_database"] = False return UserRole(**args) @@ -342,12 +405,16 @@ def unmarshal_User(data: Any) -> User: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("roles", None) if field is not None: args["roles"] = ( [unmarshal_UserRole(v) for v in field] if field is not None else None ) + else: + args["roles"] = field(default_factory=list) return User(**args) @@ -363,6 +430,8 @@ def unmarshal_Database(data: Any) -> Database: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return Database(**args) @@ -380,10 +449,14 @@ def unmarshal_ListDatabasesResponse(data: Any) -> ListDatabasesResponse: args["databases"] = ( [unmarshal_Database(v) for v in field] if field is not None else None ) + else: + args["databases"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabasesResponse(**args) @@ -401,10 +474,14 @@ def unmarshal_ListInstancesResponse(data: Any) -> ListInstancesResponse: args["instances"] = ( [unmarshal_Instance(v) for v in field] if field is not None else None ) + else: + args["instances"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstancesResponse(**args) @@ -420,22 +497,32 @@ def unmarshal_NodeTypeVolumeType(data: Any) -> NodeTypeVolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = VolumeType.UNKNOWN_TYPE field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("min_size_bytes", None) if field is not None: args["min_size_bytes"] = field + else: + args["min_size_bytes"] = 0 field = data.get("max_size_bytes", None) if field is not None: args["max_size_bytes"] = field + else: + args["max_size_bytes"] = 0 field = data.get("chunk_size_bytes", None) if field is not None: args["chunk_size_bytes"] = field + else: + args["chunk_size_bytes"] = 0 return NodeTypeVolumeType(**args) @@ -451,22 +538,32 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN_STOCK field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory_bytes", None) if field is not None: args["memory_bytes"] = field + else: + args["memory_bytes"] = 0 field = data.get("available_volume_types", None) if field is not None: @@ -475,18 +572,26 @@ def unmarshal_NodeType(data: Any) -> NodeType: if field is not None else None ) + else: + args["available_volume_types"] = field(default_factory=list) field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("instance_range", None) if field is not None: args["instance_range"] = field + else: + args["instance_range"] = None return NodeType(**args) @@ -504,10 +609,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -525,10 +634,14 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSnapshotsResponse(**args) @@ -546,10 +659,14 @@ def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse: args["users"] = ( [unmarshal_User(v) for v in field] if field is not None else None ) + else: + args["users"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListUsersResponse(**args) @@ -565,6 +682,8 @@ def unmarshal_Version(data: Any) -> Version: field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("end_of_life_at", None) if field is not None: @@ -590,10 +709,14 @@ def unmarshal_ListVersionsResponse(data: Any) -> ListVersionsResponse: args["versions"] = ( [unmarshal_Version(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVersionsResponse(**args) @@ -666,7 +789,7 @@ def marshal_Volume( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.size_bytes is not None: output["size_bytes"] = request.size_bytes @@ -696,7 +819,9 @@ def marshal_CreateInstanceRequest( output["password"] = request.password if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -764,7 +889,7 @@ def marshal_RestoreSnapshotRequest( output["node_amount"] = request.node_amount if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -790,7 +915,7 @@ def marshal_UserRole( ) if request.role is not None: - output["role"] = str(request.role) + output["role"] = request.role return output diff --git a/scaleway-async/scaleway_async/mongodb/v1/types.py b/scaleway-async/scaleway_async/mongodb/v1/types.py index fa3193f51..76c2401d1 100644 --- a/scaleway-async/scaleway_async/mongodb/v1/types.py +++ b/scaleway-async/scaleway_async/mongodb/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -164,22 +164,18 @@ class Endpoint: TCP port of the endpoint. """ - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None - public_network: Optional[EndpointPublicNetworkDetails] + public_network: Optional[EndpointPublicNetworkDetails] = None @dataclass class InstanceSnapshotSchedule: frequency_hours: int - retention_days: int - enabled: bool - - next_update: Optional[datetime] - - last_run: Optional[datetime] + next_update: Optional[datetime] = None + last_run: Optional[datetime] = None @dataclass @@ -230,16 +226,16 @@ class UserRole: Name of the preset role. """ - database_name: Optional[str] + database_name: Optional[str] = None - any_database: Optional[bool] + any_database: Optional[bool] = False @dataclass class EndpointSpec: - public_network: Optional[EndpointSpecPublicNetworkDetails] + public_network: Optional[EndpointSpecPublicNetworkDetails] = None - private_network: Optional[EndpointSpecPrivateNetworkDetails] + private_network: Optional[EndpointSpecPrivateNetworkDetails] = None @dataclass @@ -304,17 +300,17 @@ class Instance: Region the Database Instance is in. """ - volume: Optional[Volume] + volume: Optional[Volume] = None """ Volumes of the Database Instance. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ - snapshot_schedule: Optional[InstanceSnapshotSchedule] + snapshot_schedule: Optional[InstanceSnapshotSchedule] = None """ Snapshot schedule configuration of the Database Instance. """ @@ -410,22 +406,22 @@ class Snapshot: Region of the snapshot. """ - instance_id: Optional[str] + instance_id: Optional[str] = None """ UUID of the Database Instance. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Updated date (must follow the ISO 8601 format). """ @@ -451,7 +447,7 @@ class Version: MongoDB® major engine version. """ - end_of_life_at: Optional[datetime] + end_of_life_at: Optional[datetime] = None """ Date of End of Life. """ @@ -469,7 +465,7 @@ class CreateEndpointRequest: EndpointSpec used to expose your Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -502,32 +498,32 @@ class CreateInstanceRequest: Password of the initial user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ The Project ID on which the Database Instance will be created. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to apply to the Database Instance. """ - volume: Optional[Volume] + volume: Optional[Volume] = None """ Instance volume information. """ - endpoints: Optional[List[EndpointSpec]] + endpoints: Optional[List[EndpointSpec]] = field(default_factory=list) """ One or multiple EndpointSpec used to expose your Database Instance. """ @@ -545,12 +541,12 @@ class CreateSnapshotRequest: Name of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the snapshot (must follow the ISO 8601 format). """ @@ -573,7 +569,7 @@ class CreateUserRequest: Password of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -586,7 +582,7 @@ class DeleteEndpointRequest: UUID of the Endpoint to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -599,7 +595,7 @@ class DeleteInstanceRequest: UUID of the Database Instance to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -612,7 +608,7 @@ class DeleteSnapshotRequest: UUID of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -630,7 +626,7 @@ class DeleteUserRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -643,7 +639,7 @@ class GetInstanceCertificateRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -656,7 +652,7 @@ class GetInstanceRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -669,7 +665,7 @@ class GetSnapshotRequest: UUID of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -682,19 +678,20 @@ class ListDatabasesRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListDatabasesRequestOrderBy] + order_by: Optional[ListDatabasesRequestOrderBy] = ( + ListDatabasesRequestOrderBy.NAME_ASC + ) """ Criteria to use when requesting user listing. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -712,39 +709,40 @@ class ListDatabasesResponse: @dataclass class ListInstancesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List Database Instances that have a given tag. """ - name: Optional[str] + name: Optional[str] = None """ Lists Database Instances that match a name pattern. """ - order_by: Optional[ListInstancesRequestOrderBy] + order_by: Optional[ListInstancesRequestOrderBy] = ( + ListInstancesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering Database Instance listings. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID of the Database Instance. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to list the instances of. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -762,19 +760,18 @@ class ListInstancesResponse: @dataclass class ListNodeTypesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - include_disabled: Optional[bool] + include_disabled: Optional[bool] = False """ Defines whether or not to include disabled types. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -792,39 +789,40 @@ class ListNodeTypesResponse: @dataclass class ListSnapshotsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - instance_id: Optional[str] + instance_id: Optional[str] = None """ Instance ID the snapshots belongs to. """ - name: Optional[str] + name: Optional[str] = None """ Lists database snapshots that match a name pattern. """ - order_by: Optional[ListSnapshotsRequestOrderBy] + order_by: Optional[ListSnapshotsRequestOrderBy] = ( + ListSnapshotsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering snapshot listings. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID the snapshots belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to list the snapshots of. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -847,24 +845,23 @@ class ListUsersRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the user. """ - order_by: Optional[ListUsersRequestOrderBy] + order_by: Optional[ListUsersRequestOrderBy] = ListUsersRequestOrderBy.NAME_ASC """ Criteria to use when requesting user listing. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -882,16 +879,14 @@ class ListUsersResponse: @dataclass class ListVersionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - version: Optional[str] - - page: Optional[int] - - page_size: Optional[int] + version: Optional[str] = None + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -934,7 +929,7 @@ class RestoreSnapshotRequest: Instance volume type. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -952,12 +947,12 @@ class SetUserRoleRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - roles: Optional[List[UserRole]] + roles: Optional[List[UserRole]] = field(default_factory=list) """ List of roles assigned to the user, along with the corresponding database where each role is granted. """ @@ -970,32 +965,32 @@ class UpdateInstanceRequest: UUID of the Database Instance to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of a Database Instance. """ - snapshot_schedule_frequency_hours: Optional[int] + snapshot_schedule_frequency_hours: Optional[int] = 0 """ In hours. """ - snapshot_schedule_retention_days: Optional[int] + snapshot_schedule_retention_days: Optional[int] = 0 """ In days. """ - is_snapshot_schedule_enabled: Optional[bool] + is_snapshot_schedule_enabled: Optional[bool] = False """ Defines whether or not the snapshot schedule is enabled. """ @@ -1008,17 +1003,17 @@ class UpdateSnapshotRequest: UUID of the Snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the snapshot (must follow the ISO 8601 format). """ @@ -1036,12 +1031,12 @@ class UpdateUserRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - password: Optional[str] + password: Optional[str] = None """ Password of the database user. """ @@ -1054,9 +1049,9 @@ class UpgradeInstanceRequest: UUID of the Database Instance you want to upgrade. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - volume_size_bytes: Optional[int] + volume_size_bytes: Optional[int] = 0 diff --git a/scaleway-async/scaleway_async/mongodb/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/mongodb/v1alpha1/marshalling.py index e058309e7..96f7bde92 100644 --- a/scaleway-async/scaleway_async/mongodb/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/mongodb/v1alpha1/marshalling.py @@ -10,6 +10,12 @@ resolve_one_of, ) from .types import ( + InstanceStatus, + NodeTypeStock, + SettingPropertyType, + SnapshotStatus, + UserRoleRole, + VolumeType, EndpointPrivateNetworkDetails, EndpointPublicDetails, Endpoint, @@ -59,6 +65,8 @@ def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetwork field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None return EndpointPrivateNetworkDetails(**args) @@ -85,18 +93,26 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("ips", None) if field is not None: args["ips"] = field + else: + args["ips"] = field(default_factory=list) field = data.get("dns_records", None) if field is not None: args["dns_records"] = field + else: + args["dns_records"] = field(default_factory=list) field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("private_network", None) if field is not None: @@ -124,10 +140,14 @@ def unmarshal_InstanceSetting(data: Any) -> InstanceSetting: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None return InstanceSetting(**args) @@ -143,14 +163,20 @@ def unmarshal_InstanceSnapshotSchedule(data: Any) -> InstanceSnapshotSchedule: field = data.get("frequency_hours", None) if field is not None: args["frequency_hours"] = field + else: + args["frequency_hours"] = None field = data.get("retention_days", None) if field is not None: args["retention_days"] = field + else: + args["retention_days"] = None field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = None field = data.get("next_update", None) if field is not None: @@ -180,10 +206,14 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = VolumeType.UNKNOWN_TYPE field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 return Volume(**args) @@ -199,50 +229,72 @@ def unmarshal_Instance(data: Any) -> Instance: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceStatus.UNKNOWN_STATUS field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("settings", None) if field is not None: args["settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) field = data.get("node_number", None) if field is not None: args["node_number"] = field + else: + args["node_number"] = 0 field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("volume", None) if field is not None: @@ -276,6 +328,8 @@ def unmarshal_SnapshotVolumeType(data: Any) -> SnapshotVolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return SnapshotVolumeType(**args) @@ -291,34 +345,50 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("instance_id", None) if field is not None: args["instance_id"] = field + else: + args["instance_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"] = SnapshotStatus.UNKNOWN_STATUS field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("instance_name", None) if field is not None: args["instance_name"] = field + else: + args["instance_name"] = None field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("expires_at", None) if field is not None: @@ -358,6 +428,8 @@ def unmarshal_UserRole(data: Any) -> UserRole: field = data.get("role", None) if field is not None: args["role"] = field + else: + args["role"] = UserRoleRole.UNKNOWN_ROLE field = data.get("database", None) if field is not None: @@ -369,7 +441,7 @@ def unmarshal_UserRole(data: Any) -> UserRole: if field is not None: args["any_database"] = field else: - args["any_database"] = None + args["any_database"] = False return UserRole(**args) @@ -385,12 +457,16 @@ def unmarshal_User(data: Any) -> User: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("roles", None) if field is not None: args["roles"] = ( [unmarshal_UserRole(v) for v in field] if field is not None else None ) + else: + args["roles"] = field(default_factory=list) return User(**args) @@ -408,10 +484,14 @@ def unmarshal_ListInstancesResponse(data: Any) -> ListInstancesResponse: args["instances"] = ( [unmarshal_Instance(v) for v in field] if field is not None else None ) + else: + args["instances"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstancesResponse(**args) @@ -427,22 +507,32 @@ def unmarshal_NodeTypeVolumeType(data: Any) -> NodeTypeVolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = VolumeType.UNKNOWN_TYPE field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = 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("chunk_size", None) if field is not None: args["chunk_size"] = field + else: + args["chunk_size"] = 0 return NodeTypeVolumeType(**args) @@ -458,22 +548,32 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN_STOCK field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("available_volume_types", None) if field is not None: @@ -482,18 +582,26 @@ def unmarshal_NodeType(data: Any) -> NodeType: if field is not None else None ) + else: + args["available_volume_types"] = field(default_factory=list) field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("instance_range", None) if field is not None: args["instance_range"] = field + else: + args["instance_range"] = None return NodeType(**args) @@ -511,10 +619,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -532,10 +644,14 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSnapshotsResponse(**args) @@ -553,10 +669,14 @@ def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse: args["users"] = ( [unmarshal_User(v) for v in field] if field is not None else None ) + else: + args["users"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListUsersResponse(**args) @@ -572,22 +692,32 @@ def unmarshal_Setting(data: Any) -> Setting: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("default_value", None) if field is not None: args["default_value"] = field + else: + args["default_value"] = None field = data.get("hot_configurable", None) if field is not None: args["hot_configurable"] = field + else: + args["hot_configurable"] = False field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("property_type", None) if field is not None: args["property_type"] = field + else: + args["property_type"] = SettingPropertyType.BOOLEAN field = data.get("unit", None) if field is not None: @@ -605,25 +735,25 @@ def unmarshal_Setting(data: Any) -> Setting: if field is not None: args["int_min"] = field else: - args["int_min"] = None + args["int_min"] = 0 field = data.get("int_max", None) if field is not None: args["int_max"] = field else: - args["int_max"] = None + args["int_max"] = 0 field = data.get("float_min", None) if field is not None: args["float_min"] = field else: - args["float_min"] = None + args["float_min"] = 0.0 field = data.get("float_max", None) if field is not None: args["float_max"] = field else: - args["float_max"] = None + args["float_max"] = 0.0 return Setting(**args) @@ -639,12 +769,16 @@ def unmarshal_Version(data: Any) -> Version: field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("available_settings", None) if field is not None: args["available_settings"] = ( [unmarshal_Setting(v) for v in field] if field is not None else None ) + else: + args["available_settings"] = field(default_factory=list) field = data.get("end_of_life_at", None) if field is not None: @@ -670,10 +804,14 @@ def unmarshal_ListVersionsResponse(data: Any) -> ListVersionsResponse: args["versions"] = ( [unmarshal_Version(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVersionsResponse(**args) @@ -749,7 +887,7 @@ def marshal_CreateInstanceRequestVolumeDetails( output["volume_size"] = request.volume_size if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -776,7 +914,9 @@ def marshal_CreateInstanceRequest( output["password"] = request.password if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -834,7 +974,7 @@ def marshal_RestoreSnapshotRequestVolumeDetails( output: Dict[str, Any] = {} if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -881,7 +1021,7 @@ def marshal_UserRole( ) if request.role is not None: - output["role"] = str(request.role) + output["role"] = request.role return output diff --git a/scaleway-async/scaleway_async/mongodb/v1alpha1/types.py b/scaleway-async/scaleway_async/mongodb/v1alpha1/types.py index 537e0c080..f29db9a0e 100644 --- a/scaleway-async/scaleway_async/mongodb/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/mongodb/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -167,9 +167,9 @@ class Endpoint: TCP port of the endpoint. """ - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None - public: Optional[EndpointPublicDetails] + public: Optional[EndpointPublicDetails] = None @dataclass @@ -188,14 +188,10 @@ class InstanceSetting: @dataclass class InstanceSnapshotSchedule: frequency_hours: int - retention_days: int - enabled: bool - - next_update: Optional[datetime] - - last_run: Optional[datetime] + next_update: Optional[datetime] = None + last_run: Optional[datetime] = None @dataclass @@ -251,9 +247,9 @@ class UserRole: Name of the preset role. """ - database: Optional[str] + database: Optional[str] = None - any_database: Optional[bool] + any_database: Optional[bool] = False @dataclass @@ -283,32 +279,32 @@ class Setting: Setting type. """ - unit: Optional[str] + unit: Optional[str] = None """ Setting base unit. """ - string_constraint: Optional[str] + string_constraint: Optional[str] = None """ Validation regex for string type settings. """ - int_min: Optional[int] + int_min: Optional[int] = 0 """ Minimum value for int types. """ - int_max: Optional[int] + int_max: Optional[int] = 0 """ Maximum value for int types. """ - float_min: Optional[float] + float_min: Optional[float] = 0.0 """ Minimum value for float types. """ - float_max: Optional[float] + float_max: Optional[float] = 0.0 """ Maximum value for float types. """ @@ -316,9 +312,9 @@ class Setting: @dataclass class EndpointSpec: - public: Optional[EndpointSpecPublicDetails] + public: Optional[EndpointSpecPublicDetails] = None - private_network: Optional[EndpointSpecPrivateNetworkDetails] + private_network: Optional[EndpointSpecPrivateNetworkDetails] = None @dataclass @@ -391,17 +387,17 @@ class Instance: Region the Database Instance is in. """ - volume: Optional[Volume] + volume: Optional[Volume] = None """ Volumes of the Database Instance. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ - snapshot_schedule: Optional[InstanceSnapshotSchedule] + snapshot_schedule: Optional[InstanceSnapshotSchedule] = None """ Snapshot schedule configuration of the Database Instance. """ @@ -497,22 +493,22 @@ class Snapshot: Region of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Updated date (must follow the ISO 8601 format). """ - volume_type: Optional[SnapshotVolumeType] + volume_type: Optional[SnapshotVolumeType] = None """ Type of volume where data is stored - sbs_5k or sbs_15k. """ @@ -543,7 +539,7 @@ class Version: Instance settings available to be updated. """ - end_of_life_at: Optional[datetime] + end_of_life_at: Optional[datetime] = None """ Date of End of Life. """ @@ -569,7 +565,7 @@ class CreateEndpointRequest: EndpointSpec used to expose your Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -602,32 +598,32 @@ class CreateInstanceRequest: Password of the initial user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ The Project ID on which the Database Instance will be created. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to apply to the Database Instance. """ - volume: Optional[CreateInstanceRequestVolumeDetails] + volume: Optional[CreateInstanceRequestVolumeDetails] = None """ Instance volume information. """ - endpoints: Optional[List[EndpointSpec]] + endpoints: Optional[List[EndpointSpec]] = field(default_factory=list) """ One or multiple EndpointSpec used to expose your Database Instance. """ @@ -645,12 +641,12 @@ class CreateSnapshotRequest: Name of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the snapshot (must follow the ISO 8601 format). """ @@ -673,7 +669,7 @@ class CreateUserRequest: Password of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -686,7 +682,7 @@ class DeleteEndpointRequest: UUID of the Endpoint to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -699,7 +695,7 @@ class DeleteInstanceRequest: UUID of the Database Instance to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -712,7 +708,7 @@ class DeleteSnapshotRequest: UUID of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -730,7 +726,7 @@ class DeleteUserRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -743,7 +739,7 @@ class GetInstanceCertificateRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -756,7 +752,7 @@ class GetInstanceRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -769,7 +765,7 @@ class GetSnapshotRequest: UUID of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -777,39 +773,40 @@ class GetSnapshotRequest: @dataclass class ListInstancesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List Database Instances that have a given tag. """ - name: Optional[str] + name: Optional[str] = None """ Lists Database Instances that match a name pattern. """ - order_by: Optional[ListInstancesRequestOrderBy] + order_by: Optional[ListInstancesRequestOrderBy] = ( + ListInstancesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering Database Instance listings. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID of the Database Instance. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -827,19 +824,18 @@ class ListInstancesResponse: @dataclass class ListNodeTypesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - include_disabled_types: Optional[bool] + include_disabled_types: Optional[bool] = False """ Defines whether or not to include disabled types. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -857,39 +853,40 @@ class ListNodeTypesResponse: @dataclass class ListSnapshotsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - instance_id: Optional[str] + instance_id: Optional[str] = None """ Instance ID the snapshots belongs to. """ - name: Optional[str] + name: Optional[str] = None """ Lists database snapshots that match a name pattern. """ - order_by: Optional[ListSnapshotsRequestOrderBy] + order_by: Optional[ListSnapshotsRequestOrderBy] = ( + ListSnapshotsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering snapshot listings. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID the snapshots belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to list the snapshots of. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -912,24 +909,23 @@ class ListUsersRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the user. """ - order_by: Optional[ListUsersRequestOrderBy] + order_by: Optional[ListUsersRequestOrderBy] = ListUsersRequestOrderBy.NAME_ASC """ Criteria to use when requesting user listing. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -947,16 +943,14 @@ class ListUsersResponse: @dataclass class ListVersionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - version: Optional[str] - - page: Optional[int] - - page_size: Optional[int] + version: Optional[str] = None + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -999,7 +993,7 @@ class RestoreSnapshotRequest: Instance volume information. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1017,12 +1011,12 @@ class SetUserRoleRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - roles: Optional[List[UserRole]] + roles: Optional[List[UserRole]] = field(default_factory=list) """ List of roles assigned to the user, along with the corresponding database where each role is granted. """ @@ -1035,17 +1029,17 @@ class UpdateInstanceRequest: UUID of the Database Instance to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of a Database Instance. """ @@ -1058,17 +1052,17 @@ class UpdateSnapshotRequest: UUID of the Snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the snapshot (must follow the ISO 8601 format). """ @@ -1086,12 +1080,12 @@ class UpdateUserRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - password: Optional[str] + password: Optional[str] = None """ Password of the database user. """ @@ -1104,9 +1098,9 @@ class UpgradeInstanceRequest: UUID of the Database Instance you want to upgrade. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - volume_size: Optional[int] + volume_size: Optional[int] = 0 diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py index 07b14b443..a1f63b49a 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py @@ -8,6 +8,8 @@ unmarshal_Money, ) from .types import ( + PublicCatalogProductPropertiesHardwareCPUArch, + PublicCatalogProductStatus, PublicCatalogProductPropertiesHardwareCPUPhysical, PublicCatalogProductPropertiesHardwareCPUVirtual, PublicCatalogProductPropertiesHardwareCPU, @@ -44,22 +46,32 @@ def unmarshal_PublicCatalogProductPropertiesHardwareCPUPhysical( field = data.get("sockets", None) if field is not None: args["sockets"] = field + else: + args["sockets"] = 0 field = data.get("cores_per_socket", None) if field is not None: args["cores_per_socket"] = field + else: + args["cores_per_socket"] = 0 field = data.get("threads_per_core", None) if field is not None: args["threads_per_core"] = field + else: + args["threads_per_core"] = 0 field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("benchmark", None) if field is not None: args["benchmark"] = field + else: + args["benchmark"] = 0 return PublicCatalogProductPropertiesHardwareCPUPhysical(**args) @@ -77,6 +89,8 @@ def unmarshal_PublicCatalogProductPropertiesHardwareCPUVirtual( field = data.get("count", None) if field is not None: args["count"] = field + else: + args["count"] = 0 return PublicCatalogProductPropertiesHardwareCPUVirtual(**args) @@ -94,18 +108,26 @@ def unmarshal_PublicCatalogProductPropertiesHardwareCPU( field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = PublicCatalogProductPropertiesHardwareCPUArch.UNKNOWN_ARCH field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("threads", None) if field is not None: args["threads"] = field + else: + args["threads"] = 0 field = data.get("virtual", None) if field is not None: @@ -139,14 +161,20 @@ def unmarshal_PublicCatalogProductPropertiesHardwareGPU( field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("count", None) if field is not None: args["count"] = field + else: + args["count"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return PublicCatalogProductPropertiesHardwareGPU(**args) @@ -164,18 +192,26 @@ def unmarshal_PublicCatalogProductPropertiesHardwareNetwork( field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("internal_bandwidth", None) if field is not None: args["internal_bandwidth"] = field + else: + args["internal_bandwidth"] = 0 field = data.get("public_bandwidth", None) if field is not None: args["public_bandwidth"] = field + else: + args["public_bandwidth"] = 0 field = data.get("max_public_bandwidth", None) if field is not None: args["max_public_bandwidth"] = field + else: + args["max_public_bandwidth"] = 0 return PublicCatalogProductPropertiesHardwareNetwork(**args) @@ -193,14 +229,20 @@ def unmarshal_PublicCatalogProductPropertiesHardwareRAM( field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return PublicCatalogProductPropertiesHardwareRAM(**args) @@ -218,10 +260,14 @@ def unmarshal_PublicCatalogProductPropertiesHardwareStorage( field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("total", None) if field is not None: args["total"] = field + else: + args["total"] = 0 return PublicCatalogProductPropertiesHardwareStorage(**args) @@ -239,6 +285,8 @@ def unmarshal_PublicCatalogProductPropertiesAppleSilicon( field = data.get("range", None) if field is not None: args["range"] = field + else: + args["range"] = None return PublicCatalogProductPropertiesAppleSilicon(**args) @@ -256,10 +304,14 @@ def unmarshal_PublicCatalogProductPropertiesBlockStorage( field = data.get("min_volume_size", None) if field is not None: args["min_volume_size"] = field + else: + args["min_volume_size"] = 0 field = data.get("max_volume_size", None) if field is not None: args["max_volume_size"] = field + else: + args["max_volume_size"] = 0 return PublicCatalogProductPropertiesBlockStorage(**args) @@ -277,6 +329,8 @@ def unmarshal_PublicCatalogProductPropertiesDedibox( field = data.get("range", None) if field is not None: args["range"] = field + else: + args["range"] = None return PublicCatalogProductPropertiesDedibox(**args) @@ -294,6 +348,8 @@ def unmarshal_PublicCatalogProductPropertiesElasticMetal( field = data.get("range", None) if field is not None: args["range"] = field + else: + args["range"] = None return PublicCatalogProductPropertiesElasticMetal(**args) @@ -354,14 +410,20 @@ def unmarshal_PublicCatalogProductPropertiesInstance( field = data.get("range", None) if field is not None: args["range"] = field + else: + args["range"] = None field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = None field = data.get("recommended_replacement_offer_ids", None) if field is not None: args["recommended_replacement_offer_ids"] = field + else: + args["recommended_replacement_offer_ids"] = field(default_factory=list) return PublicCatalogProductPropertiesInstance(**args) @@ -403,7 +465,7 @@ def unmarshal_PublicCatalogProductLocality(data: Any) -> PublicCatalogProductLoc if field is not None: args["global_"] = field else: - args["global_"] = None + args["global_"] = False field = data.get("region", None) if field is not None: @@ -511,10 +573,14 @@ def unmarshal_PublicCatalogProductUnitOfMeasure( field = data.get("unit", None) if field is not None: args["unit"] = field + else: + args["unit"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None return PublicCatalogProductUnitOfMeasure(**args) @@ -530,26 +596,38 @@ def unmarshal_PublicCatalogProduct(data: Any) -> PublicCatalogProduct: field = data.get("sku", None) if field is not None: args["sku"] = field + else: + args["sku"] = None field = data.get("service_category", None) if field is not None: args["service_category"] = field + else: + args["service_category"] = None field = data.get("product", None) if field is not None: args["product"] = field + else: + args["product"] = None field = data.get("variant", None) if field is not None: args["variant"] = field + else: + args["variant"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = PublicCatalogProductStatus.UNKNOWN_STATUS field = data.get("locality", None) if field is not None: @@ -611,9 +689,13 @@ def unmarshal_ListPublicCatalogProductsResponse( if field is not None else None ) + else: + args["products"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPublicCatalogProductsResponse(**args) diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py index b44dfd6a0..e2af2ff90 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -143,9 +143,9 @@ class PublicCatalogProductPropertiesHardwareCPU: The total number of threads. """ - virtual: Optional[PublicCatalogProductPropertiesHardwareCPUVirtual] + virtual: Optional[PublicCatalogProductPropertiesHardwareCPUVirtual] = None - physical: Optional[PublicCatalogProductPropertiesHardwareCPUPhysical] + physical: Optional[PublicCatalogProductPropertiesHardwareCPUPhysical] = None @dataclass @@ -259,27 +259,27 @@ class PublicCatalogProductPropertiesElasticMetal: @dataclass class PublicCatalogProductPropertiesHardware: - cpu: Optional[PublicCatalogProductPropertiesHardwareCPU] + cpu: Optional[PublicCatalogProductPropertiesHardwareCPU] = None """ The CPU hardware properties. """ - ram: Optional[PublicCatalogProductPropertiesHardwareRAM] + ram: Optional[PublicCatalogProductPropertiesHardwareRAM] = None """ The RAM hardware properties. """ - storage: Optional[PublicCatalogProductPropertiesHardwareStorage] + storage: Optional[PublicCatalogProductPropertiesHardwareStorage] = None """ The storage hardware properties. """ - network: Optional[PublicCatalogProductPropertiesHardwareNetwork] + network: Optional[PublicCatalogProductPropertiesHardwareNetwork] = None """ The network hardware properties. """ - gpu: Optional[PublicCatalogProductPropertiesHardwareGPU] + gpu: Optional[PublicCatalogProductPropertiesHardwareGPU] = None """ The GPU hardware properties. """ @@ -305,25 +305,24 @@ class PublicCatalogProductPropertiesInstance: @dataclass class PublicCatalogProductEnvironmentalImpactEstimation: - kg_co2_equivalent: Optional[float] - - m3_water_usage: Optional[float] + kg_co2_equivalent: Optional[float] = None + m3_water_usage: Optional[float] = None @dataclass class PublicCatalogProductLocality: - global_: Optional[bool] + global_: Optional[bool] = False - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None - datacenter: Optional[str] + datacenter: Optional[str] = None @dataclass class PublicCatalogProductPrice: - retail_price: Optional[Money] + retail_price: Optional[Money] = None """ The retail price of the product. """ @@ -331,26 +330,25 @@ class PublicCatalogProductPrice: @dataclass class PublicCatalogProductProperties: - hardware: Optional[PublicCatalogProductPropertiesHardware] + hardware: Optional[PublicCatalogProductPropertiesHardware] = None """ The hardware properties of the product (if supported). """ - dedibox: Optional[PublicCatalogProductPropertiesDedibox] + dedibox: Optional[PublicCatalogProductPropertiesDedibox] = None - elastic_metal: Optional[PublicCatalogProductPropertiesElasticMetal] + elastic_metal: Optional[PublicCatalogProductPropertiesElasticMetal] = None - apple_silicon: Optional[PublicCatalogProductPropertiesAppleSilicon] + apple_silicon: Optional[PublicCatalogProductPropertiesAppleSilicon] = None - instance: Optional[PublicCatalogProductPropertiesInstance] + instance: Optional[PublicCatalogProductPropertiesInstance] = None - block_storage: Optional[PublicCatalogProductPropertiesBlockStorage] + block_storage: Optional[PublicCatalogProductPropertiesBlockStorage] = None @dataclass class PublicCatalogProductUnitOfMeasure: unit: PublicCatalogProductUnitOfMeasureCountableUnit - size: int @@ -386,34 +384,34 @@ class PublicCatalogProduct: The status of the product. """ - locality: Optional[PublicCatalogProductLocality] + locality: Optional[PublicCatalogProductLocality] = None """ The locality of the product. """ - price: Optional[PublicCatalogProductPrice] + price: Optional[PublicCatalogProductPrice] = None """ The price of the product. """ - properties: Optional[PublicCatalogProductProperties] + properties: Optional[PublicCatalogProductProperties] = None """ The properties of the product. """ environmental_impact_estimation: Optional[ PublicCatalogProductEnvironmentalImpactEstimation - ] + ] = None """ The environmental impact estimation of the product. """ - unit_of_measure: Optional[PublicCatalogProductUnitOfMeasure] + unit_of_measure: Optional[PublicCatalogProductUnitOfMeasure] = None """ The unit of measure of the product. """ - end_of_life_at: Optional[datetime] + end_of_life_at: Optional[datetime] = None """ The end of life date of the product. """ @@ -434,25 +432,27 @@ class ListPublicCatalogProductsResponse: @dataclass class PublicCatalogApiListPublicCatalogProductsRequest: - page: Optional[int] + page: Optional[int] = 0 """ Number of the page. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of products per page. Value must be greater or equal to 1. """ - product_types: Optional[List[ListPublicCatalogProductsRequestProductType]] + product_types: Optional[List[ListPublicCatalogProductsRequestProductType]] = field( + default_factory=list + ) """ The list of filtered product categories. """ - global_: Optional[bool] + global_: Optional[bool] = False - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None - datacenter: Optional[str] + datacenter: Optional[str] = None diff --git a/scaleway-async/scaleway_async/qaas/v1alpha1/__init__.py b/scaleway-async/scaleway_async/qaas/v1alpha1/__init__.py index 6e7c77ed7..53c554e19 100644 --- a/scaleway-async/scaleway_async/qaas/v1alpha1/__init__.py +++ b/scaleway-async/scaleway_async/qaas/v1alpha1/__init__.py @@ -9,6 +9,7 @@ from .types import ListBookingsRequestOrderBy from .types import ListJobResultsRequestOrderBy from .types import ListJobsRequestOrderBy +from .types import ListModelsRequestOrderBy from .types import ListPlatformsRequestOrderBy from .types import ListProcessResultsRequestOrderBy from .types import ListProcessesRequestOrderBy @@ -31,6 +32,7 @@ from .types import Booking from .types import JobResult from .types import Job +from .types import Model from .types import Platform from .types import ProcessResult from .types import Process @@ -38,6 +40,7 @@ from .types import CancelJobRequest from .types import CancelProcessRequest from .types import CreateJobRequest +from .types import CreateModelRequest from .types import CreateProcessRequest from .types import CreateSessionRequest from .types import DeleteJobRequest @@ -47,6 +50,7 @@ from .types import GetBookingRequest from .types import GetJobCircuitRequest from .types import GetJobRequest +from .types import GetModelRequest from .types import GetPlatformRequest from .types import GetProcessRequest from .types import GetSessionRequest @@ -58,6 +62,8 @@ from .types import ListJobResultsResponse from .types import ListJobsRequest from .types import ListJobsResponse +from .types import ListModelsRequest +from .types import ListModelsResponse from .types import ListPlatformsRequest from .types import ListPlatformsResponse from .types import ListProcessResultsRequest @@ -85,6 +91,7 @@ "ListBookingsRequestOrderBy", "ListJobResultsRequestOrderBy", "ListJobsRequestOrderBy", + "ListModelsRequestOrderBy", "ListPlatformsRequestOrderBy", "ListProcessResultsRequestOrderBy", "ListProcessesRequestOrderBy", @@ -107,6 +114,7 @@ "Booking", "JobResult", "Job", + "Model", "Platform", "ProcessResult", "Process", @@ -114,6 +122,7 @@ "CancelJobRequest", "CancelProcessRequest", "CreateJobRequest", + "CreateModelRequest", "CreateProcessRequest", "CreateSessionRequest", "DeleteJobRequest", @@ -123,6 +132,7 @@ "GetBookingRequest", "GetJobCircuitRequest", "GetJobRequest", + "GetModelRequest", "GetPlatformRequest", "GetProcessRequest", "GetSessionRequest", @@ -134,6 +144,8 @@ "ListJobResultsResponse", "ListJobsRequest", "ListJobsResponse", + "ListModelsRequest", + "ListModelsResponse", "ListPlatformsRequest", "ListPlatformsResponse", "ListProcessResultsRequest", diff --git a/scaleway-async/scaleway_async/qaas/v1alpha1/api.py b/scaleway-async/scaleway_async/qaas/v1alpha1/api.py index 6d8b70138..8a7d2e409 100644 --- a/scaleway-async/scaleway_async/qaas/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/qaas/v1alpha1/api.py @@ -18,6 +18,7 @@ ListBookingsRequestOrderBy, ListJobResultsRequestOrderBy, ListJobsRequestOrderBy, + ListModelsRequestOrderBy, ListPlatformsRequestOrderBy, ListProcessResultsRequestOrderBy, ListProcessesRequestOrderBy, @@ -29,6 +30,7 @@ Application, Booking, CreateJobRequest, + CreateModelRequest, CreateProcessRequest, CreateSessionRequest, CreateSessionRequestBookingDemand, @@ -39,11 +41,13 @@ ListBookingsResponse, ListJobResultsResponse, ListJobsResponse, + ListModelsResponse, ListPlatformsResponse, ListProcessResultsResponse, ListProcessesResponse, ListSessionACLsResponse, ListSessionsResponse, + Model, Platform, Process, ProcessResult, @@ -64,6 +68,7 @@ unmarshal_Application, unmarshal_Booking, unmarshal_Job, + unmarshal_Model, unmarshal_Platform, unmarshal_Process, unmarshal_Session, @@ -71,12 +76,14 @@ unmarshal_ListBookingsResponse, unmarshal_ListJobResultsResponse, unmarshal_ListJobsResponse, + unmarshal_ListModelsResponse, unmarshal_ListPlatformsResponse, unmarshal_ListProcessResultsResponse, unmarshal_ListProcessesResponse, unmarshal_ListSessionACLsResponse, unmarshal_ListSessionsResponse, marshal_CreateJobRequest, + marshal_CreateModelRequest, marshal_CreateProcessRequest, marshal_CreateSessionRequest, marshal_UpdateBookingRequest, @@ -331,6 +338,8 @@ async def create_job( circuit: JobCircuit, tags: Optional[List[str]] = None, max_duration: Optional[str] = None, + model_id: Optional[str] = None, + parameters: Optional[str] = None, ) -> Job: """ Create a job. @@ -340,6 +349,8 @@ async def create_job( :param circuit: Quantum circuit that should be executed. :param tags: Tags of the job. :param max_duration: Maximum duration of the job. + :param model_id: Computation model ID to be executed by the job. + :param parameters: Execution parameters for this job. :return: :class:`Job ` Usage: @@ -362,6 +373,8 @@ async def create_job( circuit=circuit, tags=tags, max_duration=max_duration, + model_id=model_id, + parameters=parameters, ), self.client, ), @@ -780,6 +793,7 @@ async def create_session( tags: Optional[List[str]] = None, deduplication_id: Optional[str] = None, booking_demand: Optional[CreateSessionRequestBookingDemand] = None, + model_id: Optional[str] = None, ) -> Session: """ Create a session. @@ -792,6 +806,7 @@ async def create_session( :param tags: Tags of the session. :param deduplication_id: Deduplication ID of the session. :param booking_demand: A booking demand to schedule the session, only applicable if the platform is bookable. + :param model_id: Default computation model ID to be executed by job assigned to this session. :return: :class:`Session ` Usage: @@ -815,6 +830,7 @@ async def create_session( tags=tags, deduplication_id=deduplication_id, booking_demand=booking_demand, + model_id=model_id, ), self.client, ), @@ -1655,3 +1671,138 @@ async def update_booking( self._throw_on_error(res) return unmarshal_Booking(res.json()) + + async def create_model( + self, + *, + project_id: Optional[str] = None, + payload: Optional[str] = None, + ) -> Model: + """ + Create a new model. + Create and register a new model that can be executed through next jobs. A model can also be assigned to a Session. + :param project_id: Project ID to attach this model. + :param payload: The serialized model data. + :return: :class:`Model ` + + Usage: + :: + + result = await api.create_model() + """ + + res = self._request( + "POST", + "/qaas/v1alpha1/models", + body=marshal_CreateModelRequest( + CreateModelRequest( + project_id=project_id, + payload=payload, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_Model(res.json()) + + async def get_model( + self, + *, + model_id: str, + ) -> Model: + """ + Get model information. + Retrieve information about of the provided **model ID**. + :param model_id: Unique ID of the model. + :return: :class:`Model ` + + Usage: + :: + + result = await api.get_model( + model_id="example", + ) + """ + + param_model_id = validate_path_param("model_id", model_id) + + res = self._request( + "GET", + f"/qaas/v1alpha1/models/{param_model_id}", + ) + + self._throw_on_error(res) + return unmarshal_Model(res.json()) + + async def list_models( + self, + *, + project_id: Optional[str] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListModelsRequestOrderBy] = None, + ) -> ListModelsResponse: + """ + List all models attached to the **project ID**. + Retrieve information about all models of the provided **project ID**. + :param project_id: List models belonging to this project ID. + :param page: Page number. + :param page_size: Maximum number of results to return per page. + :param order_by: Sort order of the returned results. + :return: :class:`ListModelsResponse ` + + Usage: + :: + + result = await api.list_models() + """ + + res = self._request( + "GET", + "/qaas/v1alpha1/models", + params={ + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListModelsResponse(res.json()) + + async def list_models_all( + self, + *, + project_id: Optional[str] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListModelsRequestOrderBy] = None, + ) -> List[Model]: + """ + List all models attached to the **project ID**. + Retrieve information about all models of the provided **project ID**. + :param project_id: List models belonging to this project ID. + :param page: Page number. + :param page_size: Maximum number of results to return per page. + :param order_by: Sort order of the returned results. + :return: :class:`List[Model] ` + + Usage: + :: + + result = await api.list_models_all() + """ + + return await fetch_all_pages_async( + type=ListModelsResponse, + key="models", + fetcher=self.list_models, + args={ + "project_id": project_id, + "page": page, + "page_size": page_size, + "order_by": order_by, + }, + ) diff --git a/scaleway-async/scaleway_async/qaas/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/qaas/v1alpha1/marshalling.py index 35fd793a4..60d3f84ff 100644 --- a/scaleway-async/scaleway_async/qaas/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/qaas/v1alpha1/marshalling.py @@ -13,11 +13,21 @@ resolve_one_of, ) from .types import ( + ApplicationType, + BookingStatus, + JobStatus, + PlatformAvailability, + PlatformTechnology, + PlatformType, + ProcessStatus, SessionAccess, + SessionOriginType, + SessionStatus, JobCircuit, Application, Booking, Job, + Model, PlatformBookingRequirement, PlatformHardware, Platform, @@ -28,6 +38,7 @@ JobResult, ListJobResultsResponse, ListJobsResponse, + ListModelsResponse, ListPlatformsResponse, ProcessResult, ListProcessResultsResponse, @@ -35,6 +46,7 @@ ListSessionACLsResponse, ListSessionsResponse, CreateJobRequest, + CreateModelRequest, CreateProcessRequest, CreateSessionRequestBookingDemand, CreateSessionRequest, @@ -79,22 +91,32 @@ def unmarshal_Application(data: Any) -> Application: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ApplicationType.UNKNOWN_TYPE field = data.get("compatible_platform_ids", None) if field is not None: args["compatible_platform_ids"] = field + else: + args["compatible_platform_ids"] = field(default_factory=list) field = data.get("input_template", None) if field is not None: args["input_template"] = field + else: + args["input_template"] = None return Application(**args) @@ -110,18 +132,26 @@ def unmarshal_Booking(data: Any) -> Booking: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = BookingStatus.UNKNOWN_STATUS field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("progress_message", None) if field is not None: args["progress_message"] = field + else: + args["progress_message"] = None field = data.get("created_at", None) if field is not None: @@ -163,24 +193,26 @@ def unmarshal_Job(data: Any) -> Job: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("session_id", None) if field is not None: args["session_id"] = field - - field = data.get("status", None) - if field is not None: - args["status"] = field + else: + args["session_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field else: - args["tags"] = None + args["tags"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -194,6 +226,12 @@ def unmarshal_Job(data: Any) -> Job: else: args["started_at"] = None + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = JobStatus.UNKNOWN_STATUS + field = data.get("updated_at", None) if field is not None: args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -218,9 +256,56 @@ def unmarshal_Job(data: Any) -> Job: else: args["result_distribution"] = None + field = data.get("model_id", None) + if field is not None: + args["model_id"] = field + else: + args["model_id"] = None + + field = data.get("parameters", None) + if field is not None: + args["parameters"] = field + else: + args["parameters"] = None + return Job(**args) +def unmarshal_Model(data: Any) -> Model: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Model' 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("project_id", None) + if field is not None: + args["project_id"] = field + else: + args["project_id"] = None + + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("url", None) + if field is not None: + args["url"] = field + else: + args["url"] = None + + return Model(**args) + + def unmarshal_PlatformBookingRequirement(data: Any) -> PlatformBookingRequirement: if not isinstance(data, dict): raise TypeError( @@ -267,26 +352,38 @@ def unmarshal_PlatformHardware(data: Any) -> PlatformHardware: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("gpus", None) if field is not None: args["gpus"] = field + else: + args["gpus"] = 0 field = data.get("gpus_network", None) if field is not None: args["gpus_network"] = field + else: + args["gpus_network"] = None field = data.get("ram", None) if field is not None: args["ram"] = field + else: + args["ram"] = 0 field = data.get("vram", None) if field is not None: args["vram"] = field + else: + args["vram"] = 0 return PlatformHardware(**args) @@ -302,62 +399,92 @@ def unmarshal_Platform(data: Any) -> Platform: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("provider_name", None) if field is not None: args["provider_name"] = field + else: + args["provider_name"] = None field = data.get("backend_name", None) if field is not None: args["backend_name"] = field + else: + args["backend_name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = PlatformType.UNKNOWN_TYPE field = data.get("technology", None) if field is not None: args["technology"] = field + else: + args["technology"] = PlatformTechnology.UNKNOWN_TECHNOLOGY field = data.get("max_qubit_count", None) if field is not None: args["max_qubit_count"] = field + else: + args["max_qubit_count"] = 0 field = data.get("max_shot_count", None) if field is not None: args["max_shot_count"] = field + else: + args["max_shot_count"] = 0 field = data.get("max_circuit_count", None) if field is not None: args["max_circuit_count"] = field + else: + args["max_circuit_count"] = 0 field = data.get("availability", None) if field is not None: args["availability"] = field + else: + args["availability"] = PlatformAvailability.UNKNOWN_AVAILABILITY field = data.get("metadata", None) if field is not None: args["metadata"] = field + else: + args["metadata"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("documentation_url", None) if field is not None: args["documentation_url"] = field + else: + args["documentation_url"] = None field = data.get("is_bookable", None) if field is not None: args["is_bookable"] = field + else: + args["is_bookable"] = False field = data.get("price_per_hour", None) if field is not None: @@ -403,14 +530,20 @@ def unmarshal_Process(data: Any) -> Process: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("attached_session_ids", None) if field is not None: args["attached_session_ids"] = field + else: + args["attached_session_ids"] = field(default_factory=list) field = data.get("application_id", None) if field is not None: @@ -421,14 +554,20 @@ def unmarshal_Process(data: Any) -> Process: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ProcessStatus.UNKNOWN_STATUS field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("platform_id", None) if field is not None: @@ -466,7 +605,7 @@ def unmarshal_Process(data: Any) -> Process: if field is not None: args["progress"] = field else: - args["progress"] = None + args["progress"] = 0 field = data.get("progress_message", None) if field is not None: @@ -494,44 +633,56 @@ def unmarshal_Session(data: Any) -> Session: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("platform_id", None) if field is not None: args["platform_id"] = field + else: + args["platform_id"] = None field = data.get("waiting_job_count", None) if field is not None: args["waiting_job_count"] = field - - 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 + args["waiting_job_count"] = 0 field = data.get("finished_job_count", None) if field is not None: args["finished_job_count"] = field + else: + args["finished_job_count"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SessionStatus.UNKNOWN_STATUS field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("deduplication_id", None) if field is not None: args["deduplication_id"] = field + else: + args["deduplication_id"] = None - field = data.get("origin_type", None) + field = data.get("created_at", None) if field is not None: - args["origin_type"] = field + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None field = data.get("started_at", None) if field is not None: @@ -569,7 +720,13 @@ def unmarshal_Session(data: Any) -> Session: if field is not None: args["tags"] = field else: - args["tags"] = None + args["tags"] = field(default_factory=list) + + field = data.get("origin_type", None) + if field is not None: + args["origin_type"] = field + else: + args["origin_type"] = SessionOriginType.UNKNOWN_ORIGIN_TYPE field = data.get("origin_id", None) if field is not None: @@ -589,6 +746,12 @@ def unmarshal_Session(data: Any) -> Session: else: args["booking_id"] = None + field = data.get("model_id", None) + if field is not None: + args["model_id"] = field + else: + args["model_id"] = None + return Session(**args) @@ -603,12 +766,16 @@ def unmarshal_ListApplicationsResponse(data: Any) -> ListApplicationsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("applications", None) if field is not None: args["applications"] = ( [unmarshal_Application(v) for v in field] if field is not None else None ) + else: + args["applications"] = field(default_factory=list) return ListApplicationsResponse(**args) @@ -624,12 +791,16 @@ def unmarshal_ListBookingsResponse(data: Any) -> ListBookingsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("bookings", None) if field is not None: args["bookings"] = ( [unmarshal_Booking(v) for v in field] if field is not None else None ) + else: + args["bookings"] = field(default_factory=list) return ListBookingsResponse(**args) @@ -645,6 +816,8 @@ def unmarshal_JobResult(data: Any) -> JobResult: field = data.get("job_id", None) if field is not None: args["job_id"] = field + else: + args["job_id"] = None field = data.get("result", None) if field is not None: @@ -678,12 +851,16 @@ def unmarshal_ListJobResultsResponse(data: Any) -> ListJobResultsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("job_results", None) if field is not None: args["job_results"] = ( [unmarshal_JobResult(v) for v in field] if field is not None else None ) + else: + args["job_results"] = field(default_factory=list) return ListJobResultsResponse(**args) @@ -699,14 +876,43 @@ def unmarshal_ListJobsResponse(data: Any) -> ListJobsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("jobs", None) if field is not None: args["jobs"] = [unmarshal_Job(v) for v in field] if field is not None else None + else: + args["jobs"] = field(default_factory=list) return ListJobsResponse(**args) +def unmarshal_ListModelsResponse(data: Any) -> ListModelsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = 0 + + field = data.get("models", None) + if field is not None: + args["models"] = ( + [unmarshal_Model(v) for v in field] if field is not None else None + ) + else: + args["models"] = field(default_factory=list) + + return ListModelsResponse(**args) + + def unmarshal_ListPlatformsResponse(data: Any) -> ListPlatformsResponse: if not isinstance(data, dict): raise TypeError( @@ -718,12 +924,16 @@ def unmarshal_ListPlatformsResponse(data: Any) -> ListPlatformsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("platforms", None) if field is not None: args["platforms"] = ( [unmarshal_Platform(v) for v in field] if field is not None else None ) + else: + args["platforms"] = field(default_factory=list) return ListPlatformsResponse(**args) @@ -739,10 +949,14 @@ def unmarshal_ProcessResult(data: Any) -> ProcessResult: field = data.get("process_id", None) if field is not None: args["process_id"] = field + else: + args["process_id"] = None field = data.get("result", None) if field is not None: args["result"] = field + else: + args["result"] = None field = data.get("created_at", None) if field is not None: @@ -764,12 +978,16 @@ def unmarshal_ListProcessResultsResponse(data: Any) -> ListProcessResultsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("process_results", None) if field is not None: args["process_results"] = ( [unmarshal_ProcessResult(v) for v in field] if field is not None else None ) + else: + args["process_results"] = field(default_factory=list) return ListProcessResultsResponse(**args) @@ -785,12 +1003,16 @@ def unmarshal_ListProcessesResponse(data: Any) -> ListProcessesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("processes", None) if field is not None: args["processes"] = ( [unmarshal_Process(v) for v in field] if field is not None else None ) + else: + args["processes"] = field(default_factory=list) return ListProcessesResponse(**args) @@ -806,10 +1028,14 @@ def unmarshal_ListSessionACLsResponse(data: Any) -> ListSessionACLsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("acls", None) if field is not None: args["acls"] = [SessionAccess(v) for v in field] if field is not None else None + else: + args["acls"] = None return ListSessionACLsResponse(**args) @@ -825,12 +1051,16 @@ def unmarshal_ListSessionsResponse(data: Any) -> ListSessionsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("sessions", None) if field is not None: args["sessions"] = ( [unmarshal_Session(v) for v in field] if field is not None else None ) + else: + args["sessions"] = field(default_factory=list) return ListSessionsResponse(**args) @@ -881,6 +1111,29 @@ def marshal_CreateJobRequest( if request.max_duration is not None: output["max_duration"] = request.max_duration + if request.model_id is not None: + output["model_id"] = request.model_id + + if request.parameters is not None: + output["parameters"] = request.parameters + + return output + + +def marshal_CreateModelRequest( + request: CreateModelRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.project_id is not None: + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id + + if request.payload is not None: + output["payload"] = request.payload + return output @@ -894,7 +1147,9 @@ def marshal_CreateProcessRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.platform_id is not None: output["platform_id"] = request.platform_id @@ -939,7 +1194,9 @@ def marshal_CreateSessionRequest( output["platform_id"] = request.platform_id if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -961,6 +1218,9 @@ def marshal_CreateSessionRequest( request.booking_demand, defaults ) + if request.model_id is not None: + output["model_id"] = request.model_id + return output diff --git a/scaleway-async/scaleway_async/qaas/v1alpha1/types.py b/scaleway-async/scaleway_async/qaas/v1alpha1/types.py index f0157bba2..188310169 100644 --- a/scaleway-async/scaleway_async/qaas/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/qaas/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -93,6 +93,14 @@ def __str__(self) -> str: return str(self.value) +class ListModelsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_DESC = "created_at_desc" + CREATED_AT_ASC = "created_at_asc" + + def __str__(self) -> str: + return str(self.value) + + class ListPlatformsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): NAME_ASC = "name_asc" NAME_DESC = "name_desc" @@ -234,22 +242,22 @@ def __str__(self) -> str: @dataclass class PlatformBookingRequirement: - min_duration: Optional[str] + min_duration: Optional[str] = None """ Minimal duration of any booking based on this platform. """ - max_duration: Optional[str] + max_duration: Optional[str] = None """ Maximal duration of any bookings based on this platform. """ - max_cancellation_duration: Optional[str] + max_cancellation_duration: Optional[str] = None """ Allowed time to cancel a booking attached to this platform before the beginning of the session. """ - max_planification_duration: Optional[str] + max_planification_duration: Optional[str] = None """ Allowed planification time from now where the platform can be booked in the future. """ @@ -290,18 +298,16 @@ class PlatformHardware: @dataclass class JobCircuit: - perceval_circuit: Optional[str] + perceval_circuit: Optional[str] = None - qiskit_circuit: Optional[str] + qiskit_circuit: Optional[str] = None @dataclass class CreateSessionRequestBookingDemand: - started_at: Optional[datetime] - - finished_at: Optional[datetime] - - description: Optional[str] + started_at: Optional[datetime] = None + finished_at: Optional[datetime] = None + description: Optional[str] = None @dataclass @@ -354,22 +360,22 @@ class Booking: Any progress message of the booking. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Time at which the booking was created. """ - started_at: Optional[datetime] + started_at: Optional[datetime] = None """ Time at which the booking starts. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Time at which the booking was updated. """ - finished_at: Optional[datetime] + finished_at: Optional[datetime] = None """ Time at which the booking finishes. """ @@ -382,17 +388,17 @@ class JobResult: ID of the parent job. """ - result: Optional[str] + result: Optional[str] = None """ Result in JSON format. """ - url: Optional[str] + url: Optional[str] = None """ URL to download a large result (optional). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation time of the result. """ @@ -420,41 +426,74 @@ class Job: Job status. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the job. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Time at which the job was created. """ - started_at: Optional[datetime] + started_at: Optional[datetime] = None """ Time at which the job was started. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Time at which the job was updated. """ - progress_message: Optional[str] + progress_message: Optional[str] = None """ Last progress message, if the job has started. """ - job_duration: Optional[str] + job_duration: Optional[str] = None """ Duration of the job, if the job is finished. """ - result_distribution: Optional[str] + result_distribution: Optional[str] = None """ Result of the job, if the job is finished. """ + model_id: Optional[str] = None + """ + Computation model ID executed by the job. + """ + + parameters: Optional[str] = None + """ + Execution parameters for this job. + """ + + +@dataclass +class Model: + id: str + """ + Unique ID of the model. + """ + + project_id: str + """ + Project ID in which the model has been created. + """ + + created_at: Optional[datetime] = None + """ + Time at which the model was created. + """ + + url: Optional[str] = None + """ + Storage URL of the model. + """ + @dataclass class Platform: @@ -533,27 +572,27 @@ class Platform: Specify if the platform is bookable. """ - price_per_hour: Optional[Money] + price_per_hour: Optional[Money] = None """ Price to be paid per hour (excluding free tiers). """ - price_per_shot: Optional[Money] + price_per_shot: Optional[Money] = None """ Price to be paid per shot (excluding free tiers). """ - price_per_circuit: Optional[Money] + price_per_circuit: Optional[Money] = None """ Price to be paid per circuit setup before its execution (excluding free tiers). """ - hardware: Optional[PlatformHardware] + hardware: Optional[PlatformHardware] = None """ Specifications of the underlying hardware. """ - booking_requirement: Optional[PlatformBookingRequirement] + booking_requirement: Optional[PlatformBookingRequirement] = None """ Booking constraints to fit if the platform is bookable. """ @@ -571,7 +610,7 @@ class ProcessResult: Result in JSON format. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation time of the result. """ @@ -594,11 +633,6 @@ class Process: List of sessions generated by the process. """ - application_id: Optional[str] - """ - Application ID for which the process has been created. - """ - status: ProcessStatus """ Status of the process. @@ -614,42 +648,47 @@ class Process: Tags of the process. """ - platform_id: Optional[str] + application_id: Optional[str] = None + """ + Application ID for which the process has been created. + """ + + platform_id: Optional[str] = None """ Platform ID for which the process has been created. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Time at which the process was created. """ - started_at: Optional[datetime] + started_at: Optional[datetime] = None """ Time at which the process started. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Time at which the process was updated. """ - finished_at: Optional[datetime] + finished_at: Optional[datetime] = None """ Time at which the process was finished. """ - progress: Optional[int] + progress: Optional[int] = 0 """ Progress of the process, from 0 to 1. """ - progress_message: Optional[str] + progress_message: Optional[str] = None """ Any progress of the process. """ - input: Optional[str] + input: Optional[str] = None """ Input payload of the process as JSON string. """ @@ -677,11 +716,6 @@ class Session: Number of waiting jobs linked to the session. """ - created_at: Optional[datetime] - """ - The time at which the session was created. - """ - finished_job_count: int """ Number of finished jobs linked to the session. @@ -707,51 +741,61 @@ class Session: Resource type that creates the session. """ - started_at: Optional[datetime] + created_at: Optional[datetime] = None + """ + The time at which the session was created. + """ + + started_at: Optional[datetime] = None """ The time at which the session started. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ The time at which the session was updated. """ - terminated_at: Optional[datetime] + terminated_at: Optional[datetime] = None """ The time at which the session was terminated. """ - max_idle_duration: Optional[str] + max_idle_duration: Optional[str] = None """ Maximum idle time before the session ends. """ - max_duration: Optional[str] + max_duration: Optional[str] = None """ Maximum duration before the session ends. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the session. """ - origin_id: Optional[str] + origin_id: Optional[str] = None """ Unique ID of the session's origin resource (if exists). """ - progress_message: Optional[str] + progress_message: Optional[str] = None """ Any progress of the session. """ - booking_id: Optional[str] + booking_id: Optional[str] = None """ An optional booking unique ID of an attached booking. """ + model_id: Optional[str] = None + """ + Default computation model ID to be executed by job assigned to this session. + """ + @dataclass class CancelJobRequest: @@ -786,16 +830,39 @@ class CreateJobRequest: Quantum circuit that should be executed. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the job. """ - max_duration: Optional[str] + max_duration: Optional[str] = None """ Maximum duration of the job. """ + model_id: Optional[str] = None + """ + Computation model ID to be executed by the job. + """ + + parameters: Optional[str] = None + """ + Execution parameters for this job. + """ + + +@dataclass +class CreateModelRequest: + project_id: Optional[str] = None + """ + Project ID to attach this model. + """ + + payload: Optional[str] = None + """ + The serialized model data. + """ + @dataclass class CreateProcessRequest: @@ -804,27 +871,27 @@ class CreateProcessRequest: Name of the process. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project in which the process was created. """ - platform_id: Optional[str] + platform_id: Optional[str] = None """ ID of the platform for which the process was created. """ - application_id: Optional[str] + application_id: Optional[str] = None """ ID of the application for which the process was created. """ - input: Optional[str] + input: Optional[str] = None """ Process parameters in JSON format. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the process. """ @@ -837,41 +904,46 @@ class CreateSessionRequest: ID of the Platform for which the session was created. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project in which the session was created. """ - name: Optional[str] + name: Optional[str] = None """ Name of the session. """ - max_idle_duration: Optional[str] + max_idle_duration: Optional[str] = None """ Maximum idle duration before the session ends. """ - max_duration: Optional[str] + max_duration: Optional[str] = None """ Maximum duration before the session ends. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the session. """ - deduplication_id: Optional[str] + deduplication_id: Optional[str] = None """ Deduplication ID of the session. """ - booking_demand: Optional[CreateSessionRequestBookingDemand] + booking_demand: Optional[CreateSessionRequestBookingDemand] = None """ A booking demand to schedule the session, only applicable if the platform is bookable. """ + model_id: Optional[str] = None + """ + Default computation model ID to be executed by job assigned to this session. + """ + @dataclass class DeleteJobRequest: @@ -929,6 +1001,14 @@ class GetJobRequest: """ +@dataclass +class GetModelRequest: + model_id: str + """ + Unique ID of the model. + """ + + @dataclass class GetPlatformRequest: platform_id: str @@ -955,27 +1035,29 @@ class GetSessionRequest: @dataclass class ListApplicationsRequest: - name: Optional[str] + name: Optional[str] = None """ List applications with this name. """ - application_type: Optional[ApplicationType] + application_type: Optional[ApplicationType] = ApplicationType.UNKNOWN_TYPE """ List applications with this type. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of applications a to return per page. """ - order_by: Optional[ListApplicationsRequestOrderBy] + order_by: Optional[ListApplicationsRequestOrderBy] = ( + ListApplicationsRequestOrderBy.NAME_ASC + ) """ Sort order of the returned applications. """ @@ -996,27 +1078,29 @@ class ListApplicationsResponse: @dataclass class ListBookingsRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ List bookings belonging to this project ID. """ - platform_id: Optional[str] + platform_id: Optional[str] = None """ List bookings attached to this platform ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of results to return per page. """ - order_by: Optional[ListBookingsRequestOrderBy] + order_by: Optional[ListBookingsRequestOrderBy] = ( + ListBookingsRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of the returned results. """ @@ -1042,17 +1126,19 @@ class ListJobResultsRequest: ID of the job. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of results to return per page. """ - order_by: Optional[ListJobResultsRequestOrderBy] + order_by: Optional[ListJobResultsRequestOrderBy] = ( + ListJobResultsRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of the returned results. """ @@ -1073,29 +1159,29 @@ class ListJobResultsResponse: @dataclass class ListJobsRequest: - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List jobs with these tags. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of jobs to return per page. """ - order_by: Optional[ListJobsRequestOrderBy] + order_by: Optional[ListJobsRequestOrderBy] = ListJobsRequestOrderBy.CREATED_AT_DESC """ Sort order of the returned jobs. """ - session_id: Optional[str] + session_id: Optional[str] = None - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -1111,44 +1197,86 @@ class ListJobsResponse: """ +@dataclass +class ListModelsRequest: + project_id: Optional[str] = None + """ + List models belonging to this project ID. + """ + + page: Optional[int] = 0 + """ + Page number. + """ + + page_size: Optional[int] = 0 + """ + Maximum number of results to return per page. + """ + + order_by: Optional[ListModelsRequestOrderBy] = ( + ListModelsRequestOrderBy.CREATED_AT_DESC + ) + """ + Sort order of the returned results. + """ + + +@dataclass +class ListModelsResponse: + total_count: int + """ + Total number of models. + """ + + models: List[Model] + """ + List of models. + """ + + @dataclass class ListPlatformsRequest: - provider_name: Optional[str] + provider_name: Optional[str] = None """ List platforms with this provider name. """ - backend_name: Optional[str] + backend_name: Optional[str] = None """ List platforms with this backend name. """ - name: Optional[str] + name: Optional[str] = None """ List platforms with this name. """ - platform_type: Optional[PlatformType] + platform_type: Optional[PlatformType] = PlatformType.UNKNOWN_TYPE """ List platforms with this type. """ - platform_technology: Optional[PlatformTechnology] + platform_technology: Optional[PlatformTechnology] = ( + PlatformTechnology.UNKNOWN_TECHNOLOGY + ) """ List platforms with this technology. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of platforms to return per page. """ - order_by: Optional[ListPlatformsRequestOrderBy] + order_by: Optional[ListPlatformsRequestOrderBy] = ( + ListPlatformsRequestOrderBy.NAME_ASC + ) """ Sort order of the returned platforms. """ @@ -1174,17 +1302,19 @@ class ListProcessResultsRequest: ID of the process. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of results to return per page. """ - order_by: Optional[ListProcessResultsRequestOrderBy] + order_by: Optional[ListProcessResultsRequestOrderBy] = ( + ListProcessResultsRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of the returned results. """ @@ -1205,32 +1335,34 @@ class ListProcessResultsResponse: @dataclass class ListProcessesRequest: - application_id: Optional[str] + application_id: Optional[str] = None """ List processes that have been created for this application. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List processes with these tags. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of processes to return per page. """ - order_by: Optional[ListProcessesRequestOrderBy] + order_by: Optional[ListProcessesRequestOrderBy] = ( + ListProcessesRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of the returned processes. """ - project_id: Optional[str] + project_id: Optional[str] = None """ List processes belonging to this project ID. """ @@ -1252,49 +1384,45 @@ class ListProcessesResponse: @dataclass class ListSessionACLsRequest: session_id: str - - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListSessionACLsRequestOrderBy] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListSessionACLsRequestOrderBy] = None @dataclass class ListSessionACLsResponse: total_count: int - acls: List[SessionAccess] @dataclass class ListSessionsRequest: - platform_id: Optional[str] + platform_id: Optional[str] = None """ List sessions that have been created for this platform. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List sessions with these tags. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of sessions to return per page. """ - order_by: Optional[ListSessionsRequestOrderBy] + order_by: Optional[ListSessionsRequestOrderBy] = ListSessionsRequestOrderBy.NAME_ASC """ Sort order of the returned sessions. """ - project_id: Optional[str] + project_id: Optional[str] = None """ List sessions belonging to this project ID. """ @@ -1328,7 +1456,7 @@ class UpdateBookingRequest: Unique ID of the booking. """ - description: Optional[str] + description: Optional[str] = None """ Description of the booking slot. """ @@ -1341,12 +1469,12 @@ class UpdateJobRequest: Unique ID of the job. """ - name: Optional[str] + name: Optional[str] = None """ Name of the job. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the job. """ @@ -1359,12 +1487,12 @@ class UpdateProcessRequest: Unique ID of the process. """ - name: Optional[str] + name: Optional[str] = None """ Name of the process. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the process. """ @@ -1377,22 +1505,22 @@ class UpdateSessionRequest: Unique ID of the session. """ - name: Optional[str] + name: Optional[str] = None """ Name of the session. """ - max_idle_duration: Optional[str] + max_idle_duration: Optional[str] = None """ Maximum idle duration before the session ends. """ - max_duration: Optional[str] + max_duration: Optional[str] = None """ Maximum time before the session ends. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the session. """ diff --git a/scaleway-async/scaleway_async/rdb/v1/marshalling.py b/scaleway-async/scaleway_async/rdb/v1/marshalling.py index 7c47f87d0..06094a856 100644 --- a/scaleway-async/scaleway_async/rdb/v1/marshalling.py +++ b/scaleway-async/scaleway_async/rdb/v1/marshalling.py @@ -13,6 +13,19 @@ resolve_one_of, ) from .types import ( + DatabaseBackupStatus, + EndpointPrivateNetworkDetailsProvisioningMode, + EngineSettingPropertyType, + InstanceLogStatus, + InstanceStatus, + MaintenanceStatus, + NodeTypeGeneration, + NodeTypeStock, + Permission, + ReadReplicaStatus, + SnapshotStatus, + StorageClass, + VolumeType, EndpointDirectAccessDetails, EndpointLoadBalancerDetails, EndpointPrivateNetworkDetails, @@ -132,18 +145,26 @@ def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetwork field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("service_ip", None) if field is not None: args["service_ip"] = field + else: + args["service_ip"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("provisioning_mode", None) if field is not None: args["provisioning_mode"] = field + else: + args["provisioning_mode"] = EndpointPrivateNetworkDetailsProvisioningMode.STATIC return EndpointPrivateNetworkDetails(**args) @@ -159,10 +180,14 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("ip", None) if field is not None: @@ -214,14 +239,20 @@ def unmarshal_Maintenance(data: Any) -> Maintenance: field = data.get("reason", None) if field is not None: args["reason"] = field + else: + args["reason"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = MaintenanceStatus.UNKNOWN field = data.get("is_applicable", None) if field is not None: args["is_applicable"] = field + else: + args["is_applicable"] = False field = data.get("starts_at", None) if field is not None: @@ -261,28 +292,40 @@ def unmarshal_ReadReplica(data: Any) -> ReadReplica: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ReadReplicaStatus.UNKNOWN field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("same_zone", None) if field is not None: args["same_zone"] = field + else: + args["same_zone"] = False field = data.get("instance_id", None) if field is not None: args["instance_id"] = field + else: + args["instance_id"] = None return ReadReplica(**args) @@ -298,28 +341,38 @@ def unmarshal_DatabaseBackup(data: Any) -> DatabaseBackup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("instance_id", None) if field is not None: args["instance_id"] = field + else: + args["instance_id"] = None field = data.get("database_name", None) if field is not None: args["database_name"] = field + else: + args["database_name"] = 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"] = DatabaseBackupStatus.UNKNOWN field = data.get("size", None) if field is not None: args["size"] = field else: - args["size"] = None + args["size"] = 0 field = data.get("expires_at", None) if field is not None: @@ -342,14 +395,20 @@ def unmarshal_DatabaseBackup(data: Any) -> DatabaseBackup: field = data.get("instance_name", None) if field is not None: args["instance_name"] = field + else: + args["instance_name"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("same_region", None) if field is not None: args["same_region"] = field + else: + args["same_region"] = False field = data.get("download_url", None) if field is not None: @@ -379,18 +438,26 @@ def unmarshal_Database(data: Any) -> Database: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("owner", None) if field is not None: args["owner"] = field + else: + args["owner"] = None field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 return Database(**args) @@ -406,18 +473,26 @@ def unmarshal_InstanceLog(data: Any) -> InstanceLog: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceLogStatus.UNKNOWN field = data.get("node_name", None) if field is not None: args["node_name"] = field + else: + args["node_name"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("download_url", None) if field is not None: @@ -451,14 +526,20 @@ def unmarshal_BackupSchedule(data: Any) -> BackupSchedule: field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("retention", None) if field is not None: args["retention"] = field + else: + args["retention"] = 0 field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("next_run_at", None) if field is not None: @@ -482,6 +563,8 @@ def unmarshal_EncryptionAtRest(data: Any) -> EncryptionAtRest: field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = None return EncryptionAtRest(**args) @@ -497,10 +580,14 @@ def unmarshal_InstanceSetting(data: Any) -> InstanceSetting: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None return InstanceSetting(**args) @@ -517,13 +604,13 @@ def unmarshal_LogsPolicy(data: Any) -> LogsPolicy: if field is not None: args["max_age_retention"] = field else: - args["max_age_retention"] = None + args["max_age_retention"] = 0 field = data.get("total_disk_retention", None) if field is not None: args["total_disk_retention"] = field else: - args["total_disk_retention"] = None + args["total_disk_retention"] = 0 return LogsPolicy(**args) @@ -539,18 +626,26 @@ def unmarshal_UpgradableVersion(data: Any) -> UpgradableVersion: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("minor_version", None) if field is not None: args["minor_version"] = field + else: + args["minor_version"] = None return UpgradableVersion(**args) @@ -566,14 +661,20 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = None return Volume(**args) @@ -589,18 +690,26 @@ def unmarshal_Instance(data: Any) -> Instance: field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("created_at", None) if field is not None: @@ -617,14 +726,20 @@ def unmarshal_Instance(data: Any) -> Instance: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceStatus.UNKNOWN field = data.get("engine", None) if field is not None: args["engine"] = field + else: + args["engine"] = None field = data.get("upgradable_version", None) if field is not None: @@ -633,20 +748,28 @@ def unmarshal_Instance(data: Any) -> Instance: if field is not None else None ) + else: + args["upgradable_version"] = field(default_factory=list) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("settings", None) if field is not None: args["settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) field = data.get("is_ha_cluster", None) if field is not None: args["is_ha_cluster"] = field + else: + args["is_ha_cluster"] = False field = data.get("endpoint", None) if field is not None: @@ -665,32 +788,44 @@ def unmarshal_Instance(data: Any) -> Instance: args["read_replicas"] = ( [unmarshal_ReadReplica(v) for v in field] if field is not None else None ) + else: + args["read_replicas"] = field(default_factory=list) field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("init_settings", None) if field is not None: args["init_settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["init_settings"] = field(default_factory=list) field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("backup_same_region", None) if field is not None: args["backup_same_region"] = field + else: + args["backup_same_region"] = False field = data.get("maintenances", None) if field is not None: args["maintenances"] = ( [unmarshal_Maintenance(v) for v in field] if field is not None else None ) + else: + args["maintenances"] = field(default_factory=list) field = data.get("logs_policy", None) if field is not None: @@ -718,14 +853,20 @@ def unmarshal_Privilege(data: Any) -> Privilege: field = data.get("permission", None) if field is not None: args["permission"] = field + else: + args["permission"] = Permission.READONLY field = data.get("database_name", None) if field is not None: args["database_name"] = field + else: + args["database_name"] = None field = data.get("user_name", None) if field is not None: args["user_name"] = field + else: + args["user_name"] = None return Privilege(**args) @@ -741,10 +882,14 @@ def unmarshal_SnapshotVolumeType(data: Any) -> SnapshotVolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = None return SnapshotVolumeType(**args) @@ -760,36 +905,50 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("instance_id", None) if field is not None: args["instance_id"] = field + else: + args["instance_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"] = SnapshotStatus.UNKNOWN field = data.get("instance_name", None) if field is not None: args["instance_name"] = field + else: + args["instance_name"] = None field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("size", None) if field is not None: args["size"] = field else: - args["size"] = None + args["size"] = 0 field = data.get("expires_at", None) if field is not None: @@ -829,10 +988,14 @@ def unmarshal_User(data: Any) -> User: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("is_admin", None) if field is not None: args["is_admin"] = field + else: + args["is_admin"] = False return User(**args) @@ -848,22 +1011,32 @@ def unmarshal_ACLRule(data: Any) -> ACLRule: field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = None field = data.get("direction", None) if field is not None: args["direction"] = field + else: + args["direction"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("port", None) if field is not None: @@ -887,6 +1060,8 @@ def unmarshal_AddInstanceACLRulesResponse(data: Any) -> AddInstanceACLRulesRespo args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return AddInstanceACLRulesResponse(**args) @@ -904,6 +1079,8 @@ def unmarshal_AddInstanceSettingsResponse(data: Any) -> AddInstanceSettingsRespo args["settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) return AddInstanceSettingsResponse(**args) @@ -923,6 +1100,8 @@ def unmarshal_DeleteInstanceACLRulesResponse( args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return DeleteInstanceACLRulesResponse(**args) @@ -942,6 +1121,8 @@ def unmarshal_DeleteInstanceSettingsResponse( args["settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) return DeleteInstanceSettingsResponse(**args) @@ -959,6 +1140,8 @@ def unmarshal_InstanceMetrics(data: Any) -> InstanceMetrics: args["timeseries"] = ( [unmarshal_TimeSeries(v) for v in field] if field is not None else None ) + else: + args["timeseries"] = field(default_factory=list) return InstanceMetrics(**args) @@ -976,10 +1159,14 @@ def unmarshal_ListDatabaseBackupsResponse(data: Any) -> ListDatabaseBackupsRespo args["database_backups"] = ( [unmarshal_DatabaseBackup(v) for v in field] if field is not None else None ) + else: + args["database_backups"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabaseBackupsResponse(**args) @@ -995,22 +1182,32 @@ def unmarshal_EngineSetting(data: Any) -> EngineSetting: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("default_value", None) if field is not None: args["default_value"] = field + else: + args["default_value"] = None field = data.get("hot_configurable", None) if field is not None: args["hot_configurable"] = field + else: + args["hot_configurable"] = False field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("property_type", None) if field is not None: args["property_type"] = field + else: + args["property_type"] = EngineSettingPropertyType.BOOLEAN field = data.get("unit", None) if field is not None: @@ -1028,25 +1225,25 @@ def unmarshal_EngineSetting(data: Any) -> EngineSetting: if field is not None: args["int_min"] = field else: - args["int_min"] = None + args["int_min"] = 0 field = data.get("int_max", None) if field is not None: args["int_max"] = field else: - args["int_max"] = None + args["int_max"] = 0 field = data.get("float_min", None) if field is not None: args["float_min"] = field else: - args["float_min"] = None + args["float_min"] = 0.0 field = data.get("float_max", None) if field is not None: args["float_max"] = field else: - args["float_max"] = None + args["float_max"] = 0.0 return EngineSetting(**args) @@ -1062,30 +1259,42 @@ def unmarshal_EngineVersion(data: Any) -> EngineVersion: field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("available_settings", None) if field is not None: args["available_settings"] = ( [unmarshal_EngineSetting(v) for v in field] if field is not None else None ) + else: + args["available_settings"] = field(default_factory=list) field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("available_init_settings", None) if field is not None: args["available_init_settings"] = ( [unmarshal_EngineSetting(v) for v in field] if field is not None else None ) + else: + args["available_init_settings"] = field(default_factory=list) field = data.get("end_of_life", None) if field is not None: @@ -1109,20 +1318,28 @@ def unmarshal_DatabaseEngine(data: Any) -> DatabaseEngine: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("versions", None) if field is not None: args["versions"] = ( [unmarshal_EngineVersion(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None return DatabaseEngine(**args) @@ -1140,10 +1357,14 @@ def unmarshal_ListDatabaseEnginesResponse(data: Any) -> ListDatabaseEnginesRespo args["engines"] = ( [unmarshal_DatabaseEngine(v) for v in field] if field is not None else None ) + else: + args["engines"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabaseEnginesResponse(**args) @@ -1161,10 +1382,14 @@ def unmarshal_ListDatabasesResponse(data: Any) -> ListDatabasesResponse: args["databases"] = ( [unmarshal_Database(v) for v in field] if field is not None else None ) + else: + args["databases"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabasesResponse(**args) @@ -1182,10 +1407,14 @@ def unmarshal_ListInstanceACLRulesResponse(data: Any) -> ListInstanceACLRulesRes args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstanceACLRulesResponse(**args) @@ -1203,10 +1432,14 @@ def unmarshal_ListInstanceLogsDetailsResponseInstanceLogDetail( field = data.get("log_name", None) if field is not None: args["log_name"] = field + else: + args["log_name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None return ListInstanceLogsDetailsResponseInstanceLogDetail(**args) @@ -1231,6 +1464,8 @@ def unmarshal_ListInstanceLogsDetailsResponse( if field is not None else None ) + else: + args["details"] = field(default_factory=list) return ListInstanceLogsDetailsResponse(**args) @@ -1248,6 +1483,8 @@ def unmarshal_ListInstanceLogsResponse(data: Any) -> ListInstanceLogsResponse: args["instance_logs"] = ( [unmarshal_InstanceLog(v) for v in field] if field is not None else None ) + else: + args["instance_logs"] = field(default_factory=list) return ListInstanceLogsResponse(**args) @@ -1265,10 +1502,14 @@ def unmarshal_ListInstancesResponse(data: Any) -> ListInstancesResponse: args["instances"] = ( [unmarshal_Instance(v) for v in field] if field is not None else None ) + else: + args["instances"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstancesResponse(**args) @@ -1284,10 +1525,14 @@ def unmarshal_NodeTypeVolumeConstraintSizes(data: Any) -> NodeTypeVolumeConstrai 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 return NodeTypeVolumeConstraintSizes(**args) @@ -1303,26 +1548,38 @@ def unmarshal_NodeTypeVolumeType(data: Any) -> NodeTypeVolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = VolumeType.LSSD field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = 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("chunk_size", None) if field is not None: args["chunk_size"] = field + else: + args["chunk_size"] = 0 field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = StorageClass.UNKNOWN_STORAGE_CLASS return NodeTypeVolumeType(**args) @@ -1338,30 +1595,44 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("volume_constraint", None) if field is not None: @@ -1373,7 +1644,7 @@ def unmarshal_NodeType(data: Any) -> NodeType: if field is not None: args["is_bssd_compatible"] = field else: - args["is_bssd_compatible"] = None + args["is_bssd_compatible"] = False field = data.get("available_volume_types", None) if field is not None: @@ -1382,22 +1653,32 @@ def unmarshal_NodeType(data: Any) -> NodeType: if field is not None else None ) + else: + args["available_volume_types"] = field(default_factory=list) field = data.get("is_ha_required", None) if field is not None: args["is_ha_required"] = field + else: + args["is_ha_required"] = False field = data.get("generation", None) if field is not None: args["generation"] = field + else: + args["generation"] = NodeTypeGeneration.UNKNOWN_GENERATION field = data.get("instance_range", None) if field is not None: args["instance_range"] = field + else: + args["instance_range"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None return NodeType(**args) @@ -1415,10 +1696,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -1436,10 +1721,14 @@ def unmarshal_ListPrivilegesResponse(data: Any) -> ListPrivilegesResponse: args["privileges"] = ( [unmarshal_Privilege(v) for v in field] if field is not None else None ) + else: + args["privileges"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPrivilegesResponse(**args) @@ -1457,10 +1746,14 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSnapshotsResponse(**args) @@ -1478,10 +1771,14 @@ def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse: args["users"] = ( [unmarshal_User(v) for v in field] if field is not None else None ) + else: + args["users"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListUsersResponse(**args) @@ -1499,6 +1796,8 @@ def unmarshal_PrepareInstanceLogsResponse(data: Any) -> PrepareInstanceLogsRespo args["instance_logs"] = ( [unmarshal_InstanceLog(v) for v in field] if field is not None else None ) + else: + args["instance_logs"] = field(default_factory=list) return PrepareInstanceLogsResponse(**args) @@ -1516,6 +1815,8 @@ def unmarshal_SetInstanceACLRulesResponse(data: Any) -> SetInstanceACLRulesRespo args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return SetInstanceACLRulesResponse(**args) @@ -1533,6 +1834,8 @@ def unmarshal_SetInstanceSettingsResponse(data: Any) -> SetInstanceSettingsRespo args["settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) return SetInstanceSettingsResponse(**args) @@ -1814,7 +2117,7 @@ def marshal_CreateInstanceRequest( ] if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.init_endpoints is not None: output["init_endpoints"] = [ @@ -2084,7 +2387,7 @@ def marshal_SetPrivilegeRequest( output["user_name"] = request.user_name if request.permission is not None: - output["permission"] = str(request.permission) + output["permission"] = request.permission return output diff --git a/scaleway-async/scaleway_async/rdb/v1/types.py b/scaleway-async/scaleway_async/rdb/v1/types.py index 7ffe6d373..d7bb81ef8 100644 --- a/scaleway-async/scaleway_async/rdb/v1/types.py +++ b/scaleway-async/scaleway_async/rdb/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -337,32 +337,32 @@ class EngineSetting: Setting type. """ - unit: Optional[str] + unit: Optional[str] = None """ Setting base unit. """ - string_constraint: Optional[str] + string_constraint: Optional[str] = None """ Validation regex for string type settings. """ - int_min: Optional[int] + int_min: Optional[int] = 0 """ Minimum value for int types. """ - int_max: Optional[int] + int_max: Optional[int] = 0 """ Maximum value for int types. """ - float_min: Optional[float] + float_min: Optional[float] = 0.0 """ Minimum value for float types. """ - float_max: Optional[float] + float_max: Optional[float] = 0.0 """ Maximum value for float types. """ @@ -380,20 +380,20 @@ class Endpoint: TCP port of the endpoint. """ - name: Optional[str] + name: Optional[str] = None """ Name of the endpoint. """ - ip: Optional[str] + ip: Optional[str] = None - hostname: Optional[str] + hostname: Optional[str] = None - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None - load_balancer: Optional[EndpointLoadBalancerDetails] + load_balancer: Optional[EndpointLoadBalancerDetails] = None - direct_access: Optional[EndpointDirectAccessDetails] + direct_access: Optional[EndpointDirectAccessDetails] = None @dataclass @@ -408,9 +408,9 @@ class EndpointSpecPrivateNetwork: UUID of the Private Network to be connected to the Database Instance. """ - service_ip: Optional[str] + service_ip: Optional[str] = None - ipam_config: Optional[EndpointSpecPrivateNetworkIpamConfig] + ipam_config: Optional[EndpointSpecPrivateNetworkIpamConfig] = None @dataclass @@ -425,9 +425,9 @@ class ReadReplicaEndpointSpecPrivateNetwork: UUID of the Private Network to be connected to the Read Replica. """ - service_ip: Optional[str] + service_ip: Optional[str] = None - ipam_config: Optional[ReadReplicaEndpointSpecPrivateNetworkIpamConfig] + ipam_config: Optional[ReadReplicaEndpointSpecPrivateNetworkIpamConfig] = None @dataclass @@ -462,7 +462,7 @@ class EngineVersion: Engine settings available to be set at database initialization. """ - end_of_life: Optional[datetime] + end_of_life: Optional[datetime] = None """ End of life date. """ @@ -485,7 +485,7 @@ class BackupSchedule: Defines whether the backup schedule feature is disabled. """ - next_run_at: Optional[datetime] + next_run_at: Optional[datetime] = None """ Next run of the backup schedule (accurate to 10 minutes). """ @@ -499,18 +499,17 @@ class EncryptionAtRest: @dataclass class InstanceSetting: name: str - value: str @dataclass class LogsPolicy: - max_age_retention: Optional[int] + max_age_retention: Optional[int] = 0 """ Max age (in days) of remote logs to keep on the Database Instance. """ - total_disk_retention: Optional[int] + total_disk_retention: Optional[int] = 0 """ Max disk size of remote logs to keep on the Database Instance. """ @@ -533,22 +532,22 @@ class Maintenance: Indicate if the maintenance can be applied by the user. """ - starts_at: Optional[datetime] + starts_at: Optional[datetime] = None """ Start date of the maintenance window. """ - stops_at: Optional[datetime] + stops_at: Optional[datetime] = None """ End date of the maintenance window. """ - closed_at: Optional[datetime] + closed_at: Optional[datetime] = None """ Closed maintenance date. """ - forced_at: Optional[datetime] + forced_at: Optional[datetime] = None """ Time when Scaleway-side maintenance will be applied. """ @@ -590,20 +589,15 @@ class ReadReplica: @dataclass class UpgradableVersion: id: str - name: str - version: str - minor_version: str @dataclass class Volume: type_: VolumeType - size: int - class_: StorageClass @@ -656,44 +650,37 @@ class NodeTypeVolumeType: @dataclass class SnapshotVolumeType: type_: VolumeType - class_: StorageClass @dataclass class ACLRuleRequest: ip: str - description: str @dataclass class ACLRule: ip: str - protocol: ACLRuleProtocol - direction: ACLRuleDirection - action: ACLRuleAction - description: str - - port: Optional[int] + port: Optional[int] = None @dataclass class EndpointSpec: - load_balancer: Optional[EndpointSpecLoadBalancer] + load_balancer: Optional[EndpointSpecLoadBalancer] = None - private_network: Optional[EndpointSpecPrivateNetwork] + private_network: Optional[EndpointSpecPrivateNetwork] = None @dataclass class ReadReplicaEndpointSpec: - direct_access: Optional[ReadReplicaEndpointSpecDirectAccess] + direct_access: Optional[ReadReplicaEndpointSpecDirectAccess] = None - private_network: Optional[ReadReplicaEndpointSpecPrivateNetwork] + private_network: Optional[ReadReplicaEndpointSpecPrivateNetwork] = None @dataclass @@ -723,47 +710,47 @@ class DatabaseBackup: Status of the backup. """ - size: Optional[int] + instance_name: str """ - Size of the database backup. + Name of the Database Instance of the backup. """ - expires_at: Optional[datetime] + region: ScwRegion """ - Expiration date (must follow the ISO 8601 format). + Region of the database backup. """ - created_at: Optional[datetime] + same_region: bool """ - Creation date (must follow the ISO 8601 format). + Store logical backups in the same region as the source Database Instance. """ - updated_at: Optional[datetime] + size: Optional[int] = 0 """ - Updated date (must follow the ISO 8601 format). + Size of the database backup. """ - instance_name: str + expires_at: Optional[datetime] = None """ - Name of the Database Instance of the backup. + Expiration date (must follow the ISO 8601 format). """ - region: ScwRegion + created_at: Optional[datetime] = None """ - Region of the database backup. + Creation date (must follow the ISO 8601 format). """ - same_region: bool + updated_at: Optional[datetime] = None """ - Store logical backups in the same region as the source Database Instance. + Updated date (must follow the ISO 8601 format). """ - download_url: Optional[str] + download_url: Optional[str] = None """ URL you can download the backup from. """ - download_url_expires_at: Optional[datetime] + download_url_expires_at: Optional[datetime] = None """ Expiration date of the download link. """ @@ -818,7 +805,6 @@ class Database: @dataclass class ListInstanceLogsDetailsResponseInstanceLogDetail: log_name: str - size: int @@ -844,17 +830,17 @@ class InstanceLog: Region the Database Instance is in. """ - download_url: Optional[str] + download_url: Optional[str] = None """ Presigned Object Storage URL to download your log file. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ @@ -882,16 +868,6 @@ class Instance: Organization ID the Database Instance belongs to. """ - created_at: Optional[datetime] - """ - Creation date (must follow the ISO 8601 format). - """ - - volume: Optional[Volume] - """ - Volumes of the Database Instance. - """ - project_id: str """ Project ID the Database Instance belongs to. @@ -927,16 +903,6 @@ class Instance: Defines whether or not High-Availability is enabled. """ - endpoint: Optional[Endpoint] - """ - Endpoint of the Database Instance. - """ - - backup_schedule: Optional[BackupSchedule] - """ - Backup schedule of the Database Instance. - """ - read_replicas: List[ReadReplica] """ Read Replicas of the Database Instance. @@ -967,12 +933,32 @@ class Instance: List of Database Instance maintenance events. """ - logs_policy: Optional[LogsPolicy] + created_at: Optional[datetime] = None + """ + Creation date (must follow the ISO 8601 format). + """ + + volume: Optional[Volume] = None + """ + Volumes of the Database Instance. + """ + + endpoint: Optional[Endpoint] = None + """ + Endpoint of the Database Instance. + """ + + backup_schedule: Optional[BackupSchedule] = None + """ + Backup schedule of the Database Instance. + """ + + logs_policy: Optional[LogsPolicy] = None """ Logs policy of the Database Instance. """ - encryption: Optional[EncryptionAtRest] + encryption: Optional[EncryptionAtRest] = None """ Encryption at rest settings for your Database Instance. """ @@ -1015,16 +1001,6 @@ class NodeType: The Node Type is currently in beta. """ - volume_constraint: Optional[NodeTypeVolumeConstraintSizes] - """ - [deprecated] Node Type volume constraints. - """ - - is_bssd_compatible: Optional[bool] - """ - The Node Type is compliant with Block Storage. - """ - available_volume_types: List[NodeTypeVolumeType] """ Available storage options for the Node Type. @@ -1050,6 +1026,16 @@ class NodeType: Region the Node Type is in. """ + volume_constraint: Optional[NodeTypeVolumeConstraintSizes] = None + """ + [deprecated] Node Type volume constraints. + """ + + is_bssd_compatible: Optional[bool] = False + """ + The Node Type is compliant with Block Storage. + """ + @dataclass class Privilege: @@ -1106,27 +1092,27 @@ class Snapshot: Region of this snapshot. """ - size: Optional[int] + size: Optional[int] = 0 """ Size of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Updated date (must follow the ISO 8601 format). """ - volume_type: Optional[SnapshotVolumeType] + volume_type: Optional[SnapshotVolumeType] = None """ Type of volume where data is stored (lssd, bssd or sbs). """ @@ -1170,7 +1156,7 @@ class AddInstanceACLRulesRequest: ACL rules to add to the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1196,7 +1182,7 @@ class AddInstanceSettingsRequest: Settings to add to the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1217,7 +1203,7 @@ class ApplyInstanceMaintenanceRequest: UUID of the Database Instance you want to apply maintenance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1235,12 +1221,12 @@ class CloneInstanceRequest: Name of the Database Instance clone. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - node_type: Optional[str] + node_type: Optional[str] = None """ Node type of the clone. """ @@ -1258,17 +1244,17 @@ class CreateDatabaseBackupRequest: Name of the database you want to back up. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the backup. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ @@ -1286,7 +1272,7 @@ class CreateDatabaseRequest: Name of the database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1299,12 +1285,12 @@ class CreateEndpointRequest: UUID of the Database Instance you to which you want to add an endpoint. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - endpoint_spec: Optional[EndpointSpec] + endpoint_spec: Optional[EndpointSpec] = None """ Specification of the endpoint you want to create. """ @@ -1322,17 +1308,17 @@ class CreateInstanceFromSnapshotRequest: Name of the Database Instance created with the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - is_ha_cluster: Optional[bool] + is_ha_cluster: Optional[bool] = False """ Defines whether or not High-Availability is enabled on the new Database Instance. """ - node_type: Optional[str] + node_type: Optional[str] = None """ The node type used to restore the snapshot. """ @@ -1360,16 +1346,6 @@ class CreateInstanceRequest: Type of node to use for the Database Instance. """ - region: Optional[ScwRegion] - """ - Region to target. If none is passed will use default region from the config. - """ - - name: Optional[str] - """ - Name of the Database Instance. - """ - is_ha_cluster: bool """ Defines whether or not High-Availability is enabled. @@ -1390,34 +1366,44 @@ class CreateInstanceRequest: Defines whether to or not to store logical backups in the same region as the Database Instance. """ - tags: Optional[List[str]] + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + name: Optional[str] = None + """ + Name of the Database Instance. + """ + + tags: Optional[List[str]] = field(default_factory=list) """ Tags to apply to the Database Instance. """ - init_settings: Optional[List[InstanceSetting]] + init_settings: Optional[List[InstanceSetting]] = field(default_factory=list) """ List of engine settings to be set upon Database Instance initialization. """ - volume_type: Optional[VolumeType] + volume_type: Optional[VolumeType] = VolumeType.LSSD """ Type of volume where data is stored (lssd, bssd, ...). """ - init_endpoints: Optional[List[EndpointSpec]] + init_endpoints: Optional[List[EndpointSpec]] = field(default_factory=list) """ One or multiple EndpointSpec used to expose your Database Instance. A load_balancer public endpoint is systematically created. """ - encryption: Optional[EncryptionAtRest] + encryption: Optional[EncryptionAtRest] = None """ Encryption at rest settings for your Database Instance. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -1432,7 +1418,7 @@ class CreateReadReplicaEndpointRequest: Specification of the endpoint you want to create. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1445,17 +1431,17 @@ class CreateReadReplicaRequest: UUID of the Database Instance you want to create a Read Replica from. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - endpoint_spec: Optional[List[ReadReplicaEndpointSpec]] + endpoint_spec: Optional[List[ReadReplicaEndpointSpec]] = field(default_factory=list) """ Specification of the endpoint you want to create. """ - same_zone: Optional[bool] + same_zone: Optional[bool] = False """ Defines whether to create the replica in the same availability zone as the main instance nodes or not. """ @@ -1468,17 +1454,17 @@ class CreateSnapshotRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ @@ -1506,7 +1492,7 @@ class CreateUserRequest: Defines whether the user will have administrative privileges. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1519,7 +1505,7 @@ class DeleteDatabaseBackupRequest: UUID of the database backup to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1537,7 +1523,7 @@ class DeleteDatabaseRequest: Name of the database to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1550,7 +1536,7 @@ class DeleteEndpointRequest: This endpoint can also be used to delete a Read Replica endpoint. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1568,7 +1554,7 @@ class DeleteInstanceACLRulesRequest: IP addresses defined in the ACL rules of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1589,7 +1575,7 @@ class DeleteInstanceRequest: UUID of the Database Instance to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1607,7 +1593,7 @@ class DeleteInstanceSettingsRequest: Settings names to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1628,7 +1614,7 @@ class DeleteReadReplicaRequest: UUID of the Read Replica. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1641,7 +1627,7 @@ class DeleteSnapshotRequest: UUID of the snapshot to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1659,7 +1645,7 @@ class DeleteUserRequest: Name of the user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1672,7 +1658,7 @@ class ExportDatabaseBackupRequest: UUID of the database backup you want to export. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1685,7 +1671,7 @@ class GetDatabaseBackupRequest: UUID of the database backup. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1698,7 +1684,7 @@ class GetEndpointRequest: UUID of the endpoint you want to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1711,7 +1697,7 @@ class GetInstanceCertificateRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1724,7 +1710,7 @@ class GetInstanceLogRequest: UUID of the instance_log you want. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1737,22 +1723,22 @@ class GetInstanceMetricsRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - start_date: Optional[datetime] + start_date: Optional[datetime] = None """ Start date to gather metrics from. """ - end_date: Optional[datetime] + end_date: Optional[datetime] = None """ End date to gather metrics from. """ - metric_name: Optional[str] + metric_name: Optional[str] = None """ Name of the metric to gather. """ @@ -1765,7 +1751,7 @@ class GetInstanceRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1778,7 +1764,7 @@ class GetReadReplicaRequest: UUID of the Read Replica. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1791,7 +1777,7 @@ class GetSnapshotRequest: UUID of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1807,39 +1793,40 @@ class InstanceMetrics: @dataclass class ListDatabaseBackupsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the database backups. """ - order_by: Optional[ListDatabaseBackupsRequestOrderBy] + order_by: Optional[ListDatabaseBackupsRequestOrderBy] = ( + ListDatabaseBackupsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering database backups listing. """ - instance_id: Optional[str] + instance_id: Optional[str] = None """ UUID of the Database Instance. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID of the Organization the database backups belong to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the Project the database backups belong to. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -1857,24 +1844,23 @@ class ListDatabaseBackupsResponse: @dataclass class ListDatabaseEnginesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the database engine. """ - version: Optional[str] + version: Optional[str] = None """ Version of the database engine. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -1897,34 +1883,35 @@ class ListDatabasesRequest: UUID of the Database Instance to list the databases of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the database. """ - managed: Optional[bool] + managed: Optional[bool] = False """ Defines whether or not the database is managed. """ - owner: Optional[str] + owner: Optional[str] = None """ User that owns this database. """ - order_by: Optional[ListDatabasesRequestOrderBy] + order_by: Optional[ListDatabasesRequestOrderBy] = ( + ListDatabasesRequestOrderBy.NAME_ASC + ) """ Criteria to use when ordering database listing. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -1947,14 +1934,13 @@ class ListInstanceACLRulesRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -1977,7 +1963,7 @@ class ListInstanceLogsDetailsRequest: UUID of the Database Instance you want logs of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1998,12 +1984,14 @@ class ListInstanceLogsRequest: UUID of the Database Instance you want logs of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListInstanceLogsRequestOrderBy] + order_by: Optional[ListInstanceLogsRequestOrderBy] = ( + ListInstanceLogsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering Database Instance logs listing. """ @@ -2019,44 +2007,45 @@ class ListInstanceLogsResponse: @dataclass class ListInstancesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List Database Instances that have a given tag. """ - name: Optional[str] + name: Optional[str] = None """ Lists Database Instances that match a name pattern. """ - order_by: Optional[ListInstancesRequestOrderBy] + order_by: Optional[ListInstancesRequestOrderBy] = ( + ListInstancesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering Database Instance listings. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Please use project_id instead. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to list the Database Instance of. """ - has_maintenances: Optional[bool] + has_maintenances: Optional[bool] = False """ Filter to only list instances with a scheduled maintenance. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -2079,14 +2068,13 @@ class ListNodeTypesRequest: Defines whether or not to include disabled types. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -2109,26 +2097,26 @@ class ListPrivilegesRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPrivilegesRequestOrderBy] + order_by: Optional[ListPrivilegesRequestOrderBy] = ( + ListPrivilegesRequestOrderBy.USER_NAME_ASC + ) """ Criteria to use when ordering privileges listing. """ - page: Optional[int] - - page_size: Optional[int] - - database_name: Optional[str] + page: Optional[int] = 0 + page_size: Optional[int] = 0 + database_name: Optional[str] = None """ Name of the database. """ - user_name: Optional[str] + user_name: Optional[str] = None """ Name of the user. """ @@ -2149,39 +2137,40 @@ class ListPrivilegesResponse: @dataclass class ListSnapshotsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - order_by: Optional[ListSnapshotsRequestOrderBy] + order_by: Optional[ListSnapshotsRequestOrderBy] = ( + ListSnapshotsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering snapshot listing. """ - instance_id: Optional[str] + instance_id: Optional[str] = None """ UUID of the Database Instance. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID the snapshots belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID the snapshots belongs to. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -2204,24 +2193,23 @@ class ListUsersRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the user. """ - order_by: Optional[ListUsersRequestOrderBy] + order_by: Optional[ListUsersRequestOrderBy] = ListUsersRequestOrderBy.NAME_ASC """ Criteria to use when requesting user listing. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -2249,7 +2237,7 @@ class MigrateEndpointRequest: UUID of the instance you want to attach the endpoint to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2262,17 +2250,17 @@ class PrepareInstanceLogsRequest: UUID of the Database Instance you want logs of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - start_date: Optional[datetime] + start_date: Optional[datetime] = None """ Start datetime of your log. (RFC 3339 format). """ - end_date: Optional[datetime] + end_date: Optional[datetime] = None """ End datetime of your log. (RFC 3339 format). """ @@ -2293,7 +2281,7 @@ class PromoteReadReplicaRequest: UUID of the Read Replica. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2306,12 +2294,12 @@ class PurgeInstanceLogsRequest: UUID of the Database Instance you want logs of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - log_name: Optional[str] + log_name: Optional[str] = None """ Given log name to purge. """ @@ -2324,7 +2312,7 @@ class RenewInstanceCertificateRequest: UUID of the Database Instance you want logs of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2337,7 +2325,7 @@ class ResetReadReplicaRequest: UUID of the Read Replica. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2350,7 +2338,7 @@ class RestartInstanceRequest: UUID of the Database Instance you want to restart. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2368,12 +2356,12 @@ class RestoreDatabaseBackupRequest: Defines the Database Instance where the backup has to be restored. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - database_name: Optional[str] + database_name: Optional[str] = None """ Defines the destination database to restore into a specified database (the default destination is set to the origin database of the backup). """ @@ -2391,7 +2379,7 @@ class SetInstanceACLRulesRequest: ACL rules to define for the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2417,7 +2405,7 @@ class SetInstanceSettingsRequest: Settings to define for the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2448,12 +2436,12 @@ class SetPrivilegeRequest: Name of the user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - permission: Optional[Permission] + permission: Optional[Permission] = Permission.READONLY """ Permission to set (Read, Read/Write, All, Custom). """ @@ -2466,17 +2454,17 @@ class UpdateDatabaseBackupRequest: UUID of the database backup to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Backup. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ @@ -2489,47 +2477,47 @@ class UpdateInstanceRequest: UUID of the Database Instance to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - backup_schedule_frequency: Optional[int] + backup_schedule_frequency: Optional[int] = 0 """ In hours. """ - backup_schedule_retention: Optional[int] + backup_schedule_retention: Optional[int] = 0 """ In days. """ - is_backup_schedule_disabled: Optional[bool] + is_backup_schedule_disabled: Optional[bool] = False """ Defines whether or not the backup schedule is disabled. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of a Database Instance. """ - logs_policy: Optional[LogsPolicy] + logs_policy: Optional[LogsPolicy] = None """ Logs policy of the Database Instance. """ - backup_same_region: Optional[bool] + backup_same_region: Optional[bool] = False """ Store logical backups in the same region as the Database Instance. """ - backup_schedule_start_hour: Optional[int] + backup_schedule_start_hour: Optional[int] = 0 """ Defines the start time of the autobackup. """ @@ -2542,17 +2530,17 @@ class UpdateSnapshotRequest: UUID of the snapshot to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ @@ -2570,17 +2558,17 @@ class UpdateUserRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - password: Optional[str] + password: Optional[str] = None """ Password of the database user. Password must be between 8 and 128 characters, contain at least one digit, one uppercase, one lowercase and one special character. """ - is_admin: Optional[bool] + is_admin: Optional[bool] = False """ Defines whether or not this user got administrative privileges. """ @@ -2593,21 +2581,21 @@ class UpgradeInstanceRequest: UUID of the Database Instance you want to upgrade. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - node_type: Optional[str] + node_type: Optional[str] = None - enable_ha: Optional[bool] + enable_ha: Optional[bool] = False - volume_size: Optional[int] + volume_size: Optional[int] = 0 - volume_type: Optional[VolumeType] + volume_type: Optional[VolumeType] = VolumeType.LSSD - upgradable_version_id: Optional[str] + upgradable_version_id: Optional[str] = None - major_upgrade_workflow: Optional[UpgradeInstanceRequestMajorUpgradeWorkflow] + major_upgrade_workflow: Optional[UpgradeInstanceRequestMajorUpgradeWorkflow] = None - enable_encryption: Optional[bool] + enable_encryption: Optional[bool] = False diff --git a/scaleway-async/scaleway_async/redis/v1/marshalling.py b/scaleway-async/scaleway_async/redis/v1/marshalling.py index 7f9727b06..ace2f1d01 100644 --- a/scaleway-async/scaleway_async/redis/v1/marshalling.py +++ b/scaleway-async/scaleway_async/redis/v1/marshalling.py @@ -13,6 +13,10 @@ resolve_one_of, ) from .types import ( + AvailableClusterSettingPropertyType, + ClusterStatus, + NodeTypeStock, + PrivateNetworkProvisioningMode, ACLRule, PrivateNetwork, PublicNetwork, @@ -60,6 +64,8 @@ def unmarshal_ACLRule(data: Any) -> ACLRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("ip_cidr", None) if field is not None: @@ -87,18 +93,26 @@ def unmarshal_PrivateNetwork(data: Any) -> PrivateNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("service_ips", None) if field is not None: args["service_ips"] = field + else: + args["service_ips"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("provisioning_mode", None) if field is not None: args["provisioning_mode"] = field + else: + args["provisioning_mode"] = PrivateNetworkProvisioningMode.STATIC return PrivateNetwork(**args) @@ -125,14 +139,20 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("ips", None) if field is not None: args["ips"] = field + else: + args["ips"] = field(default_factory=list) field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("private_network", None) if field is not None: @@ -160,10 +180,14 @@ def unmarshal_ClusterSetting(data: Any) -> ClusterSetting: field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return ClusterSetting(**args) @@ -179,46 +203,66 @@ def unmarshal_Cluster(data: Any) -> Cluster: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ClusterStatus.UNKNOWN field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("tls_enabled", None) if field is not None: args["tls_enabled"] = field + else: + args["tls_enabled"] = False field = data.get("cluster_settings", None) if field is not None: args["cluster_settings"] = ( [unmarshal_ClusterSetting(v) for v in field] if field is not None else None ) + else: + args["cluster_settings"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -237,22 +281,32 @@ def unmarshal_Cluster(data: Any) -> Cluster: args["acl_rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["acl_rules"] = field(default_factory=list) field = data.get("cluster_size", None) if field is not None: args["cluster_size"] = field + else: + args["cluster_size"] = 0 field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("user_name", None) if field is not None: args["user_name"] = field + else: + args["user_name"] = None field = data.get("upgradable_versions", None) if field is not None: args["upgradable_versions"] = field + else: + args["upgradable_versions"] = field(default_factory=list) return Cluster(**args) @@ -270,10 +324,14 @@ def unmarshal_AddAclRulesResponse(data: Any) -> AddAclRulesResponse: args["acl_rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["acl_rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return AddAclRulesResponse(**args) @@ -291,10 +349,14 @@ def unmarshal_AddEndpointsResponse(data: Any) -> AddEndpointsResponse: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return AddEndpointsResponse(**args) @@ -312,6 +374,8 @@ def unmarshal_ClusterMetricsResponse(data: Any) -> ClusterMetricsResponse: args["timeseries"] = ( [unmarshal_TimeSeries(v) for v in field] if field is not None else None ) + else: + args["timeseries"] = field(default_factory=list) return ClusterMetricsResponse(**args) @@ -329,6 +393,8 @@ def unmarshal_ClusterSettingsResponse(data: Any) -> ClusterSettingsResponse: args["settings"] = ( [unmarshal_ClusterSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) return ClusterSettingsResponse(**args) @@ -344,18 +410,26 @@ def unmarshal_AvailableClusterSetting(data: Any) -> AvailableClusterSetting: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = AvailableClusterSettingPropertyType.UNKNOWN field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("deprecated", None) if field is not None: args["deprecated"] = field + else: + args["deprecated"] = False field = data.get("default_value", None) if field is not None: @@ -367,13 +441,13 @@ def unmarshal_AvailableClusterSetting(data: Any) -> AvailableClusterSetting: if field is not None: args["max_value"] = field else: - args["max_value"] = None + args["max_value"] = 0 field = data.get("min_value", None) if field is not None: args["min_value"] = field else: - args["min_value"] = None + args["min_value"] = 0 field = data.get("regex", None) if field is not None: @@ -395,6 +469,8 @@ def unmarshal_ClusterVersion(data: Any) -> ClusterVersion: field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("available_settings", None) if field is not None: @@ -403,14 +479,20 @@ def unmarshal_ClusterVersion(data: Any) -> ClusterVersion: if field is not None else None ) + else: + args["available_settings"] = field(default_factory=list) field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("end_of_life_at", None) if field is not None: @@ -436,10 +518,14 @@ def unmarshal_ListClusterVersionsResponse(data: Any) -> ListClusterVersionsRespo args["versions"] = ( [unmarshal_ClusterVersion(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListClusterVersionsResponse(**args) @@ -457,10 +543,14 @@ def unmarshal_ListClustersResponse(data: Any) -> ListClustersResponse: args["clusters"] = ( [unmarshal_Cluster(v) for v in field] if field is not None else None ) + else: + args["clusters"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListClustersResponse(**args) @@ -476,34 +566,50 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return NodeType(**args) @@ -521,10 +627,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -542,6 +652,8 @@ def unmarshal_SetAclRulesResponse(data: Any) -> SetAclRulesResponse: args["acl_rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["acl_rules"] = field(default_factory=list) return SetAclRulesResponse(**args) @@ -559,6 +671,8 @@ def unmarshal_SetEndpointsResponse(data: Any) -> SetEndpointsResponse: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) return SetEndpointsResponse(**args) @@ -711,7 +825,9 @@ def marshal_CreateClusterRequest( output["node_type"] = request.node_type if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name diff --git a/scaleway-async/scaleway_async/redis/v1/types.py b/scaleway-async/scaleway_async/redis/v1/types.py index a4a9c8ea2..8568790ca 100644 --- a/scaleway-async/scaleway_async/redis/v1/types.py +++ b/scaleway-async/scaleway_async/redis/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -115,7 +115,7 @@ class EndpointSpecPrivateNetworkSpec: Endpoint IPv4 address with a CIDR notation. You must provide at least one IPv4 per node. """ - ipam_config: Optional[EndpointSpecPrivateNetworkSpecIpamConfig] + ipam_config: Optional[EndpointSpecPrivateNetworkSpecIpamConfig] = None """ Automated configuration of your Private Network endpoint with Scaleway IPAM service. """ @@ -148,22 +148,22 @@ class AvailableClusterSetting: Defines whether or not the setting is deprecated. """ - default_value: Optional[str] + default_value: Optional[str] = None """ Default value of the setting. """ - max_value: Optional[int] + max_value: Optional[int] = 0 """ Optional maximum value of the setting. """ - min_value: Optional[int] + min_value: Optional[int] = 0 """ Optional minimum value of the setting. """ - regex: Optional[str] + regex: Optional[str] = None """ Optional validation rule of the setting. """ @@ -176,12 +176,12 @@ class ACLRule: ID of the rule. """ - ip_cidr: Optional[str] + ip_cidr: Optional[str] = None """ IPv4 network address of the rule. """ - description: Optional[str] + description: Optional[str] = None """ Description of the rule. """ @@ -217,9 +217,9 @@ class Endpoint: UUID of the endpoint. """ - private_network: Optional[PrivateNetwork] + private_network: Optional[PrivateNetwork] = None - public_network: Optional[PublicNetwork] + public_network: Optional[PublicNetwork] = None @dataclass @@ -237,9 +237,9 @@ class ACLRuleSpec: @dataclass class EndpointSpec: - private_network: Optional[EndpointSpecPrivateNetworkSpec] + private_network: Optional[EndpointSpecPrivateNetworkSpec] = None - public_network: Optional[EndpointSpecPublicNetworkSpec] + public_network: Optional[EndpointSpecPublicNetworkSpec] = None @dataclass @@ -264,7 +264,7 @@ class ClusterVersion: Zone of the Redis™ Database Instance. """ - end_of_life_at: Optional[datetime] + end_of_life_at: Optional[datetime] = None """ Date of End of Life. """ @@ -322,16 +322,6 @@ class Cluster: List of Database Instance settings. """ - created_at: Optional[datetime] - """ - Creation date (Format ISO 8601). - """ - - updated_at: Optional[datetime] - """ - Update date (Format ISO 8601). - """ - acl_rules: List[ACLRule] """ List of ACL rules. @@ -357,6 +347,16 @@ class Cluster: List of engine versions the Database Instance can upgrade to. """ + created_at: Optional[datetime] = None + """ + Creation date (Format ISO 8601). + """ + + updated_at: Optional[datetime] = None + """ + Update date (Format ISO 8601). + """ + @dataclass class NodeType: @@ -413,7 +413,7 @@ class AddAclRulesRequest: ACLs rules to add to the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -444,7 +444,7 @@ class AddClusterSettingsRequest: Settings to add to the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -462,7 +462,7 @@ class AddEndpointsRequest: Endpoints to add to the Database Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -509,57 +509,57 @@ class CreateClusterRequest: Type of node to use for the Database Instance. """ - zone: Optional[ScwZone] + user_name: str """ - Zone to target. If none is passed will use default zone from the config. + Name of the user created upon Database Instance creation. """ - project_id: Optional[str] + password: str """ - Project ID in which to create the Database Instance. + Password of the user. """ - name: Optional[str] + tls_enabled: bool """ - Name of the Database Instance. + Defines whether or not TLS is enabled. """ - tags: Optional[List[str]] + zone: Optional[ScwZone] = None """ - Tags to apply to the Database Instance. + Zone to target. If none is passed will use default zone from the config. """ - user_name: str + project_id: Optional[str] = None """ - Name of the user created upon Database Instance creation. + Project ID in which to create the Database Instance. """ - password: str + name: Optional[str] = None """ - Password of the user. + Name of the Database Instance. """ - tls_enabled: bool + tags: Optional[List[str]] = field(default_factory=list) """ - Defines whether or not TLS is enabled. + Tags to apply to the Database Instance. """ - cluster_size: Optional[int] + cluster_size: Optional[int] = 0 """ Number of nodes in the Redis™ cluster. """ - acl_rules: Optional[List[ACLRuleSpec]] + acl_rules: Optional[List[ACLRuleSpec]] = field(default_factory=list) """ List of ACLRuleSpec used to secure your publicly exposed cluster. """ - endpoints: Optional[List[EndpointSpec]] + endpoints: Optional[List[EndpointSpec]] = field(default_factory=list) """ Zero or multiple EndpointSpec used to expose your cluster publicly and inside private networks. If no EndpoindSpec is given the cluster will be publicly exposed by default. """ - cluster_settings: Optional[List[ClusterSetting]] + cluster_settings: Optional[List[ClusterSetting]] = field(default_factory=list) """ List of advanced settings to be set upon Database Instance initialization. """ @@ -572,7 +572,7 @@ class DeleteAclRuleRequest: UUID of the ACL rule you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -585,7 +585,7 @@ class DeleteClusterRequest: UUID of the Database Instance to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -603,7 +603,7 @@ class DeleteClusterSettingRequest: Setting name to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -616,7 +616,7 @@ class DeleteEndpointRequest: UUID of the endpoint you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -629,7 +629,7 @@ class GetAclRuleRequest: UUID of the ACL rule you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -642,7 +642,7 @@ class GetClusterCertificateRequest: UUID of the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -655,22 +655,22 @@ class GetClusterMetricsRequest: UUID of the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - start_at: Optional[datetime] + start_at: Optional[datetime] = None """ Start date. """ - end_at: Optional[datetime] + end_at: Optional[datetime] = None """ End date. """ - metric_name: Optional[str] + metric_name: Optional[str] = None """ Name of the metric to gather. """ @@ -683,7 +683,7 @@ class GetClusterRequest: UUID of the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -696,7 +696,7 @@ class GetEndpointRequest: UUID of the endpoint you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -719,19 +719,18 @@ class ListClusterVersionsRequest: Defines whether or not to include deprecated Redis™ engine versions. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - version: Optional[str] + version: Optional[str] = None """ List Redis™ engine versions that match a given name pattern. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -749,44 +748,45 @@ class ListClusterVersionsResponse: @dataclass class ListClustersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by Database Instance tags. """ - name: Optional[str] + name: Optional[str] = None """ Filter by Database Instance names. """ - order_by: Optional[ListClustersRequestOrderBy] + order_by: Optional[ListClustersRequestOrderBy] = ( + ListClustersRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - version: Optional[str] + version: Optional[str] = None """ Filter by Redis™ engine version. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -809,14 +809,13 @@ class ListNodeTypesRequest: Defines whether or not to include disabled types. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -839,16 +838,16 @@ class MigrateClusterRequest: UUID of the Database Instance to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - version: Optional[str] + version: Optional[str] = None - node_type: Optional[str] + node_type: Optional[str] = None - cluster_size: Optional[int] + cluster_size: Optional[int] = 0 @dataclass @@ -858,7 +857,7 @@ class RenewClusterCertificateRequest: UUID of the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -876,7 +875,7 @@ class SetAclRulesRequest: ACLs rules to define for the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -902,7 +901,7 @@ class SetClusterSettingsRequest: Settings to define for the Database Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -920,7 +919,7 @@ class SetEndpointsRequest: Endpoints to define for the Database Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -941,27 +940,27 @@ class UpdateClusterRequest: UUID of the Database Instance to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Database Instance tags. """ - user_name: Optional[str] + user_name: Optional[str] = None """ Name of the Database Instance user. """ - password: Optional[str] + password: Optional[str] = None """ Password of the Database Instance user. """ @@ -974,11 +973,11 @@ class UpdateEndpointRequest: UUID of the endpoint you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - private_network: Optional[EndpointSpecPrivateNetworkSpec] + private_network: Optional[EndpointSpecPrivateNetworkSpec] = None - public_network: Optional[EndpointSpecPublicNetworkSpec] + public_network: Optional[EndpointSpecPublicNetworkSpec] = None diff --git a/scaleway-async/scaleway_async/registry/v1/marshalling.py b/scaleway-async/scaleway_async/registry/v1/marshalling.py index 1ac359a95..47ca3b797 100644 --- a/scaleway-async/scaleway_async/registry/v1/marshalling.py +++ b/scaleway-async/scaleway_async/registry/v1/marshalling.py @@ -10,6 +10,10 @@ resolve_one_of, ) from .types import ( + ImageStatus, + ImageVisibility, + NamespaceStatus, + TagStatus, Image, Namespace, Tag, @@ -33,30 +37,44 @@ def unmarshal_Image(data: Any) -> Image: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("namespace_id", None) if field is not None: args["namespace_id"] = field + else: + args["namespace_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ImageStatus.UNKNOWN field = data.get("visibility", None) if field is not None: args["visibility"] = field + else: + args["visibility"] = ImageVisibility.VISIBILITY_UNKNOWN field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("status_message", None) if field is not None: @@ -90,50 +108,74 @@ def unmarshal_Namespace(data: Any) -> Namespace: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = NamespaceStatus.UNKNOWN field = data.get("status_message", None) if field is not None: args["status_message"] = field + else: + args["status_message"] = None field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("is_public", None) if field is not None: args["is_public"] = field + else: + args["is_public"] = False field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("image_count", None) if field is not None: args["image_count"] = field + else: + args["image_count"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -161,22 +203,32 @@ def unmarshal_Tag(data: Any) -> Tag: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("image_id", None) if field is not None: args["image_id"] = field + else: + args["image_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TagStatus.UNKNOWN field = data.get("digest", None) if field is not None: args["digest"] = field + else: + args["digest"] = None field = data.get("created_at", None) if field is not None: @@ -206,10 +258,14 @@ def unmarshal_ListImagesResponse(data: Any) -> ListImagesResponse: args["images"] = ( [unmarshal_Image(v) for v in field] if field is not None else None ) + else: + args["images"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListImagesResponse(**args) @@ -227,10 +283,14 @@ def unmarshal_ListNamespacesResponse(data: Any) -> ListNamespacesResponse: args["namespaces"] = ( [unmarshal_Namespace(v) for v in field] if field is not None else None ) + else: + args["namespaces"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNamespacesResponse(**args) @@ -246,10 +306,14 @@ def unmarshal_ListTagsResponse(data: Any) -> ListTagsResponse: field = data.get("tags", None) if field is not None: args["tags"] = [unmarshal_Tag(v) for v in field] if field is not None else None + else: + args["tags"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListTagsResponse(**args) @@ -297,7 +361,7 @@ def marshal_UpdateImageRequest( output: Dict[str, Any] = {} if request.visibility is not None: - output["visibility"] = str(request.visibility) + output["visibility"] = request.visibility return output diff --git a/scaleway-async/scaleway_async/registry/v1/types.py b/scaleway-async/scaleway_async/registry/v1/types.py index e5e425dad..487672162 100644 --- a/scaleway-async/scaleway_async/registry/v1/types.py +++ b/scaleway-async/scaleway_async/registry/v1/types.py @@ -127,17 +127,17 @@ class Image: List of docker tags of the image. """ - status_message: Optional[str] + status_message: Optional[str] = None """ Details of the image status. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of image creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last update. """ @@ -205,12 +205,12 @@ class Namespace: Region the namespace belongs to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last update. """ @@ -243,12 +243,12 @@ class Tag: Hash of the tag content. Several tags of a same image may have the same digest. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last update. """ @@ -266,19 +266,19 @@ class CreateNamespaceRequest: Defines whether or not namespace is public. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the namespace. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -288,7 +288,7 @@ class DeleteImageRequest: UUID of the image. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -301,7 +301,7 @@ class DeleteNamespaceRequest: UUID of the namespace. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -314,12 +314,12 @@ class DeleteTagRequest: UUID of the tag. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - force: Optional[bool] + force: Optional[bool] = False """ If two tags share the same digest the deletion will fail unless this parameter is set to true (deprecated). """ @@ -332,7 +332,7 @@ class GetImageRequest: UUID of the image. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -345,7 +345,7 @@ class GetNamespaceRequest: UUID of the namespace. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -358,7 +358,7 @@ class GetTagRequest: UUID of the tag. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -366,42 +366,44 @@ class GetTagRequest: @dataclass class ListImagesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to display. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to display. """ - order_by: Optional[ListImagesRequestOrderBy] + order_by: Optional[ListImagesRequestOrderBy] = ( + ListImagesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering image listings. Possible values are `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`, `region`, `status_asc` and `status_desc`. The default value is `created_at_asc`. """ - namespace_id: Optional[str] + namespace_id: Optional[str] = None """ Filter by the namespace ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by the image name (exact match). """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ @@ -422,37 +424,39 @@ class ListImagesResponse: @dataclass class ListNamespacesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to display. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to display. """ - order_by: Optional[ListNamespacesRequestOrderBy] + order_by: Optional[ListNamespacesRequestOrderBy] = ( + ListNamespacesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering namespace listings. Possible values are `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`, `region`, `status_asc` and `status_desc`. The default value is `created_at_asc`. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by the namespace name (exact match). """ @@ -478,27 +482,27 @@ class ListTagsRequest: UUID of the image. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to display. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to display. """ - order_by: Optional[ListTagsRequestOrderBy] + order_by: Optional[ListTagsRequestOrderBy] = ListTagsRequestOrderBy.CREATED_AT_ASC """ Criteria to use when ordering tag listings. Possible values are `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`, `region`, `status_asc` and `status_desc`. The default value is `created_at_asc`. """ - name: Optional[str] + name: Optional[str] = None """ Filter by the tag name (exact match). """ @@ -524,12 +528,12 @@ class UpdateImageRequest: ID of the image to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - visibility: Optional[ImageVisibility] + visibility: Optional[ImageVisibility] = ImageVisibility.VISIBILITY_UNKNOWN """ Set to `public` to allow the image to be pulled without authentication. Else, set to `private`. Set to `inherit` to keep the same visibility configuration as the namespace. """ @@ -542,17 +546,17 @@ class UpdateNamespaceRequest: ID of the namespace to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Namespace description. """ - is_public: Optional[bool] + is_public: Optional[bool] = False """ Defines whether or not the namespace is public. """ diff --git a/scaleway-async/scaleway_async/secret/v1beta1/marshalling.py b/scaleway-async/scaleway_async/secret/v1beta1/marshalling.py index 3bf186c9f..161afc1b3 100644 --- a/scaleway-async/scaleway_async/secret/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/secret/v1beta1/marshalling.py @@ -6,8 +6,11 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + EphemeralPolicyAction, Product, + SecretStatus, SecretType, + SecretVersionStatus, EphemeralProperties, SecretVersion, EphemeralPolicy, @@ -40,6 +43,8 @@ def unmarshal_EphemeralProperties(data: Any) -> EphemeralProperties: field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = EphemeralPolicyAction.UNKNOWN_ACTION field = data.get("expires_at", None) if field is not None: @@ -51,7 +56,7 @@ def unmarshal_EphemeralProperties(data: Any) -> EphemeralProperties: if field is not None: args["expires_once_accessed"] = field else: - args["expires_once_accessed"] = None + args["expires_once_accessed"] = False return EphemeralProperties(**args) @@ -67,18 +72,26 @@ def unmarshal_SecretVersion(data: Any) -> SecretVersion: field = data.get("revision", None) if field is not None: args["revision"] = field + else: + args["revision"] = 0 field = data.get("secret_id", None) if field is not None: args["secret_id"] = field + else: + args["secret_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SecretVersionStatus.UNKNOWN_STATUS field = data.get("latest", None) if field is not None: args["latest"] = field + else: + args["latest"] = False field = data.get("created_at", None) if field is not None: @@ -132,6 +145,8 @@ def unmarshal_EphemeralPolicy(data: Any) -> EphemeralPolicy: field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = EphemeralPolicyAction.UNKNOWN_ACTION field = data.get("time_to_live", None) if field is not None: @@ -143,7 +158,7 @@ def unmarshal_EphemeralPolicy(data: Any) -> EphemeralPolicy: if field is not None: args["expires_once_accessed"] = field else: - args["expires_once_accessed"] = None + args["expires_once_accessed"] = False return EphemeralPolicy(**args) @@ -159,50 +174,74 @@ def unmarshal_Secret(data: Any) -> Secret: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_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"] = SecretStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("version_count", None) if field is not None: args["version_count"] = field + else: + args["version_count"] = 0 field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = SecretType.UNKNOWN_TYPE field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None field = data.get("used_by", None) if field is not None: args["used_by"] = [Product(v) for v in field] if field is not None else None + else: + args["used_by"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -256,24 +295,32 @@ def unmarshal_AccessSecretVersionResponse(data: Any) -> AccessSecretVersionRespo field = data.get("secret_id", None) if field is not None: args["secret_id"] = field + else: + args["secret_id"] = None field = data.get("revision", None) if field is not None: args["revision"] = field + else: + args["revision"] = 0 field = data.get("data", None) if field is not None: args["data"] = field + else: + args["data"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = SecretType.UNKNOWN_TYPE field = data.get("data_crc32", None) if field is not None: args["data_crc32"] = field else: - args["data_crc32"] = None + args["data_crc32"] = 0 return AccessSecretVersionResponse(**args) @@ -304,22 +351,32 @@ def unmarshal_BrowseSecretsResponseItemSecretDetails( field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = None field = data.get("version_count", None) if field is not None: args["version_count"] = field + else: + args["version_count"] = None field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("ephemeral_policy", None) if field is not None: @@ -341,6 +398,8 @@ def unmarshal_BrowseSecretsResponseItem(data: Any) -> BrowseSecretsResponseItem: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("created_at", None) if field is not None: @@ -384,14 +443,20 @@ def unmarshal_BrowseSecretsResponse(data: Any) -> BrowseSecretsResponse: if field is not None else None ) + else: + args["items"] = field(default_factory=list) field = data.get("current_path", None) if field is not None: args["current_path"] = field + else: + args["current_path"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return BrowseSecretsResponse(**args) @@ -407,10 +472,14 @@ def unmarshal_ListSecretTypesResponse(data: Any) -> ListSecretTypesResponse: field = data.get("types", None) if field is not None: args["types"] = [SecretType(v) for v in field] if field is not None else None + else: + args["types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSecretTypesResponse(**args) @@ -428,10 +497,14 @@ def unmarshal_ListSecretVersionsResponse(data: Any) -> ListSecretVersionsRespons args["versions"] = ( [unmarshal_SecretVersion(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSecretVersionsResponse(**args) @@ -449,10 +522,14 @@ def unmarshal_ListSecretsResponse(data: Any) -> ListSecretsResponse: args["secrets"] = ( [unmarshal_Secret(v) for v in field] if field is not None else None ) + else: + args["secrets"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSecretsResponse(**args) @@ -468,10 +545,14 @@ def unmarshal_ListTagsResponse(data: Any) -> ListTagsResponse: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListTagsResponse(**args) @@ -483,7 +564,7 @@ def marshal_AddSecretOwnerRequest( output: Dict[str, Any] = {} if request.product is not None: - output["product"] = str(request.product) + output["product"] = request.product return output @@ -495,7 +576,7 @@ def marshal_EphemeralPolicy( output: Dict[str, Any] = {} if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.time_to_live is not None: output["time_to_live"] = request.time_to_live @@ -519,7 +600,9 @@ def marshal_CreateSecretRequest( output["protected"] = request.protected if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -528,7 +611,7 @@ def marshal_CreateSecretRequest( output["description"] = request.description if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.path is not None: output["path"] = request.path @@ -598,7 +681,7 @@ def marshal_EphemeralProperties( output: Dict[str, Any] = {} if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.expires_at is not None: output["expires_at"] = request.expires_at.isoformat() diff --git a/scaleway-async/scaleway_async/secret/v1beta1/types.py b/scaleway-async/scaleway_async/secret/v1beta1/types.py index aa5423e89..aefb41692 100644 --- a/scaleway-async/scaleway_async/secret/v1beta1/types.py +++ b/scaleway-async/scaleway_async/secret/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -96,12 +96,12 @@ class EphemeralPolicy: See the `EphemeralPolicy.Action` enum for a description of values. """ - time_to_live: Optional[str] + time_to_live: Optional[str] = None """ Time frame, from one second and up to one year, during which the secret's versions are valid. """ - expires_once_accessed: Optional[bool] + expires_once_accessed: Optional[bool] = False """ Returns `true` if the version expires after a single user access. """ @@ -115,16 +115,11 @@ class BrowseSecretsResponseItemFolderDetails: @dataclass class BrowseSecretsResponseItemSecretDetails: id: str - tags: List[str] - version_count: int - protected: bool - type_: SecretType - - ephemeral_policy: Optional[EphemeralPolicy] + ephemeral_policy: Optional[EphemeralPolicy] = None @dataclass @@ -134,12 +129,12 @@ class EphemeralProperties: See `EphemeralPolicy.Action` enum for a description of values. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ (Optional.) If not specified, the version does not have an expiration date. """ - expires_once_accessed: Optional[bool] + expires_once_accessed: Optional[bool] = False """ (Optional.) If not specified, the version can be accessed an unlimited amount of times. """ @@ -148,14 +143,11 @@ class EphemeralProperties: @dataclass class BrowseSecretsResponseItem: name: str + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + secret: Optional[BrowseSecretsResponseItemSecretDetails] = None - created_at: Optional[datetime] - - updated_at: Optional[datetime] - - secret: Optional[BrowseSecretsResponseItemSecretDetails] - - folder: Optional[BrowseSecretsResponseItemFolderDetails] + folder: Optional[BrowseSecretsResponseItemFolderDetails] = None @dataclass @@ -184,32 +176,32 @@ class SecretVersion: Returns `true` if the version is the latest. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the version's creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update of the version. """ - deleted_at: Optional[datetime] + deleted_at: Optional[datetime] = None """ Date and time of the version's deletion. """ - description: Optional[str] + description: Optional[str] = None """ Description of the version. """ - ephemeral_properties: Optional[EphemeralProperties] + ephemeral_properties: Optional[EphemeralProperties] = None """ Returns the version's expiration date, whether it expires after being accessed once, and the action to perform (disable or delete) once the version expires. """ - deletion_requested_at: Optional[datetime] + deletion_requested_at: Optional[datetime] = None """ Returns the time at which deletion was requested. """ @@ -278,32 +270,32 @@ class Secret: Region of the secret. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the secret's creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update of the secret. """ - description: Optional[str] + description: Optional[str] = None """ Updated description of the secret. """ - ephemeral_policy: Optional[EphemeralPolicy] + ephemeral_policy: Optional[EphemeralPolicy] = None """ (Optional.) Policy that defines whether/when a secret's versions expire. By default, the policy is applied to all the secret's versions. """ - deletion_requested_at: Optional[datetime] + deletion_requested_at: Optional[datetime] = None """ Returns the time at which deletion was requested. """ - key_id: Optional[str] + key_id: Optional[str] = None """ (Optional.) The Scaleway Key Manager key ID used to encrypt and decrypt secret versions. """ @@ -329,12 +321,12 @@ class AccessSecretVersionByPathRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ @@ -355,7 +347,7 @@ class AccessSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -383,7 +375,7 @@ class AccessSecretVersionResponse: See the `Secret.Type` enum for a description of values. """ - data_crc32: Optional[int] + data_crc32: Optional[int] = 0 """ This field is only available if a CRC32 was supplied during the creation of the version. """ @@ -396,12 +388,12 @@ class AddSecretOwnerRequest: ID of the secret. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - product: Optional[Product] + product: Optional[Product] = Product.UNKNOWN_PRODUCT """ See `Product` enum for description of values. """ @@ -427,28 +419,27 @@ class BrowseSecretsRequest: Filter secrets and folders for a given prefix (default /). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID (optional). """ - order_by: Optional[BrowseSecretsRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - tags: Optional[List[str]] + order_by: Optional[BrowseSecretsRequestOrderBy] = ( + BrowseSecretsRequestOrderBy.NAME_ASC + ) + page: Optional[int] = 0 + page_size: Optional[int] = 0 + tags: Optional[List[str]] = field(default_factory=list) """ Filter secrets by tags. """ - type_: Optional[SecretType] + type_: Optional[SecretType] = SecretType.UNKNOWN_TYPE """ Filter by secret type (optional). """ @@ -484,42 +475,42 @@ class CreateSecretRequest: A protected secret cannot be deleted. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the secret. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of the secret's tags. """ - description: Optional[str] + description: Optional[str] = None """ Description of the secret. """ - type_: Optional[SecretType] + type_: Optional[SecretType] = SecretType.UNKNOWN_TYPE """ (Optional.) See the `Secret.Type` enum for a description of values. If not specified, the type is `Opaque`. """ - path: Optional[str] + path: Optional[str] = None """ (Optional.) Location of the secret in the directory structure. If not specified, the path is `/`. """ - ephemeral_policy: Optional[EphemeralPolicy] + ephemeral_policy: Optional[EphemeralPolicy] = None """ (Optional.) Policy that defines whether/when a secret's versions expire. By default, the policy is applied to all the secret's versions. """ - key_id: Optional[str] + key_id: Optional[str] = None """ (Optional.) The Scaleway Key Manager key ID will be used to encrypt and decrypt secret versions. If not specified, Secret Manager will use a Key Manager internal key. """ @@ -537,22 +528,22 @@ class CreateSecretVersionRequest: The base64-encoded secret payload of the version. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the version. """ - disable_previous: Optional[bool] + disable_previous: Optional[bool] = False """ (Optional.) If there is no previous version or if the previous version was already disabled, does nothing. """ - data_crc32: Optional[int] + data_crc32: Optional[int] = 0 """ If specified, Secret Manager will verify the integrity of the data received against the given CRC32 checksum. An error is returned if the CRC32 does not match. If, however, the CRC32 matches, it will be stored and returned along with the SecretVersion on future access requests. """ @@ -598,7 +589,7 @@ class DeleteSecretRequest: ID of the secret. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -619,7 +610,7 @@ class DeleteSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -640,7 +631,7 @@ class DisableSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -661,7 +652,7 @@ class EnableSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -674,7 +665,7 @@ class GetSecretRequest: ID of the secret. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -695,7 +686,7 @@ class GetSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -703,19 +694,18 @@ class GetSecretVersionRequest: @dataclass class ListSecretTypesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -738,16 +728,14 @@ class ListSecretVersionsRequest: ID of the secret. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] - - status: Optional[List[SecretVersionStatus]] + page: Optional[int] = 0 + page_size: Optional[int] = 0 + status: Optional[List[SecretVersionStatus]] = field(default_factory=list) """ Filter results by status. """ @@ -773,48 +761,45 @@ class ListSecretsRequest: Filter by whether the secret was scheduled for deletion / not scheduled for deletion. By default, it will display only not scheduled for deletion secrets. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID (optional). """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID (optional). """ - order_by: Optional[ListSecretsRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - tags: Optional[List[str]] + order_by: Optional[ListSecretsRequestOrderBy] = ListSecretsRequestOrderBy.NAME_ASC + page: Optional[int] = 0 + page_size: Optional[int] = 0 + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to filter on (optional). """ - name: Optional[str] + name: Optional[str] = None """ Filter by secret name (optional). """ - path: Optional[str] + path: Optional[str] = None """ Filter by exact path (optional). """ - ephemeral: Optional[bool] + ephemeral: Optional[bool] = False """ Filter by ephemeral / not ephemeral (optional). """ - type_: Optional[SecretType] + type_: Optional[SecretType] = SecretType.UNKNOWN_TYPE """ Filter by secret type (optional). """ @@ -835,19 +820,18 @@ class ListSecretsResponse: @dataclass class ListTagsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -870,7 +854,7 @@ class ProtectSecretRequest: ID of the secret to enable secret protection for. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -879,8 +863,7 @@ class ProtectSecretRequest: @dataclass class RestoreSecretRequest: secret_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -889,10 +872,8 @@ class RestoreSecretRequest: @dataclass class RestoreSecretVersionRequest: secret_id: str - revision: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -913,7 +894,7 @@ class UnprotectSecretRequest: ID of the secret to disable secret protection for. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -926,32 +907,32 @@ class UpdateSecretRequest: ID of the secret. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Secret's updated name (optional). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Secret's updated list of tags (optional). """ - description: Optional[str] + description: Optional[str] = None """ Description of the secret. """ - path: Optional[str] + path: Optional[str] = None """ (Optional.) Location of the folder in the directory structure. If not specified, the path is `/`. """ - ephemeral_policy: Optional[EphemeralPolicy] + ephemeral_policy: Optional[EphemeralPolicy] = None """ (Optional.) Policy that defines whether/when a secret's versions expire. """ @@ -972,17 +953,17 @@ class UpdateSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the version. """ - ephemeral_properties: Optional[EphemeralProperties] + ephemeral_properties: Optional[EphemeralProperties] = None """ (Optional.) Properties that defines the version's expiration date, whether it expires after being accessed once, and the action to perform (disable or delete) once the version expires. """ diff --git a/scaleway-async/scaleway_async/serverless_sqldb/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/serverless_sqldb/v1alpha1/marshalling.py index 13a841b17..29f5be0eb 100644 --- a/scaleway-async/scaleway_async/serverless_sqldb/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/serverless_sqldb/v1alpha1/marshalling.py @@ -6,6 +6,8 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + DatabaseBackupStatus, + DatabaseStatus, DatabaseBackup, Database, ListDatabaseBackupsResponse, @@ -27,26 +29,38 @@ def unmarshal_DatabaseBackup(data: Any) -> DatabaseBackup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DatabaseBackupStatus.UNKNOWN_STATUS field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("database_id", None) if field is not None: args["database_id"] = field + else: + args["database_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -64,13 +78,13 @@ def unmarshal_DatabaseBackup(data: Any) -> DatabaseBackup: if field is not None: args["size"] = field else: - args["size"] = None + args["size"] = 0 field = data.get("db_size", None) if field is not None: args["db_size"] = field else: - args["db_size"] = None + args["db_size"] = 0 field = data.get("download_url", None) if field is not None: @@ -100,50 +114,74 @@ def unmarshal_Database(data: Any) -> Database: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["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"] = DatabaseStatus.UNKNOWN_STATUS field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("cpu_min", None) if field is not None: args["cpu_min"] = field + else: + args["cpu_min"] = 0 field = data.get("cpu_max", None) if field is not None: args["cpu_max"] = field + else: + args["cpu_max"] = 0 field = data.get("cpu_current", None) if field is not None: args["cpu_current"] = field + else: + args["cpu_current"] = 0 field = data.get("started", None) if field is not None: args["started"] = field + else: + args["started"] = False field = data.get("engine_major_version", None) if field is not None: args["engine_major_version"] = field + else: + args["engine_major_version"] = 0 field = data.get("created_at", None) if field is not None: @@ -167,10 +205,14 @@ def unmarshal_ListDatabaseBackupsResponse(data: Any) -> ListDatabaseBackupsRespo args["backups"] = ( [unmarshal_DatabaseBackup(v) for v in field] if field is not None else None ) + else: + args["backups"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabaseBackupsResponse(**args) @@ -188,10 +230,14 @@ def unmarshal_ListDatabasesResponse(data: Any) -> ListDatabasesResponse: args["databases"] = ( [unmarshal_Database(v) for v in field] if field is not None else None ) + else: + args["databases"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabasesResponse(**args) @@ -212,7 +258,9 @@ def marshal_CreateDatabaseRequest( output["cpu_max"] = request.cpu_max if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.from_backup_id is not None: output["from_backup_id"] = request.from_backup_id diff --git a/scaleway-async/scaleway_async/serverless_sqldb/v1alpha1/types.py b/scaleway-async/scaleway_async/serverless_sqldb/v1alpha1/types.py index 6ec7e7258..10616c04b 100644 --- a/scaleway-async/scaleway_async/serverless_sqldb/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/serverless_sqldb/v1alpha1/types.py @@ -88,32 +88,32 @@ class DatabaseBackup: Region of the database backup. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date. """ - size: Optional[int] + size: Optional[int] = 0 """ Size (in bytes) of the database backup file. """ - db_size: Optional[int] + db_size: Optional[int] = 0 """ Size (in bytes) of the database when backup has been done. """ - download_url: Optional[str] + download_url: Optional[str] = None """ Download URL of the exported database backup. """ - download_url_expires_at: Optional[datetime] + download_url_expires_at: Optional[datetime] = None """ Expiration date of the download URL. """ @@ -181,7 +181,7 @@ class Database: The major version of the underlying database engine. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date. """ @@ -204,17 +204,17 @@ class CreateDatabaseRequest: The maximum number of CPU units for your Serverless SQL Database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ The ID of your Scaleway project. """ - from_backup_id: Optional[str] + from_backup_id: Optional[str] = None """ The ID of the backup to create the database from. """ @@ -227,7 +227,7 @@ class DeleteDatabaseRequest: UUID of the Serverless SQL Database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -240,7 +240,7 @@ class ExportDatabaseBackupRequest: UUID of the Serverless SQL Database backup. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -253,7 +253,7 @@ class GetDatabaseBackupRequest: UUID of the Serverless SQL Database backup. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -266,7 +266,7 @@ class GetDatabaseRequest: UUID of the Serverless SQL DB database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -279,32 +279,34 @@ class ListDatabaseBackupsRequest: Filter by the UUID of the Serverless SQL Database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by the UUID of the Scaleway organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by the UUID of the Scaleway project. """ - page: Optional[int] + page: Optional[int] = None """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = None """ Page size. """ - order_by: Optional[ListDatabaseBackupsRequestOrderBy] + order_by: Optional[ListDatabaseBackupsRequestOrderBy] = ( + ListDatabaseBackupsRequestOrderBy.CREATED_AT_DESC + ) """ Sorting criteria. One of `created_at_asc`, `created_at_desc`. """ @@ -325,37 +327,39 @@ class ListDatabaseBackupsResponse: @dataclass class ListDatabasesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by the UUID of the Scaleway organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Scaleway project. """ - page: Optional[int] + page: Optional[int] = None """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = None """ Page size. """ - name: Optional[str] + name: Optional[str] = None """ Filter by the name of the database. """ - order_by: Optional[ListDatabasesRequestOrderBy] + order_by: Optional[ListDatabasesRequestOrderBy] = ( + ListDatabasesRequestOrderBy.CREATED_AT_ASC + ) """ Sorting criteria. One of `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`. """ @@ -386,7 +390,7 @@ class RestoreDatabaseFromBackupRequest: UUID of the Serverless SQL Database backup to restore. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -399,17 +403,17 @@ class UpdateDatabaseRequest: UUID of the Serverless SQL Database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - cpu_min: Optional[int] + cpu_min: Optional[int] = 0 """ The minimum number of CPU units for your Serverless SQL Database. """ - cpu_max: Optional[int] + cpu_max: Optional[int] = 0 """ The maximum number of CPU units for your Serverless SQL Database. """ diff --git a/scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py index 522b5dec8..9f9565f0d 100644 --- a/scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py @@ -6,7 +6,18 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + BlocklistType, + DomainLastStatusAutoconfigStateReason, + DomainLastStatusRecordStatus, + DomainReputationStatus, + DomainStatus, EmailFlag, + EmailRcptType, + EmailStatus, + OfferName, + PoolStatus, + ProjectSettingsPeriodicReportFrequency, + WebhookEventStatus, WebhookEventType, EmailTry, Email, @@ -66,14 +77,20 @@ def unmarshal_EmailTry(data: Any) -> EmailTry: field = data.get("rank", None) if field is not None: args["rank"] = field + else: + args["rank"] = 0 field = data.get("code", None) if field is not None: args["code"] = field + else: + args["code"] = 0 field = data.get("message", None) if field is not None: args["message"] = field + else: + args["message"] = None field = data.get("tried_at", None) if field is not None: @@ -95,22 +112,32 @@ def unmarshal_Email(data: Any) -> Email: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("message_id", None) if field is not None: args["message_id"] = field + else: + args["message_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("mail_from", None) if field is not None: args["mail_from"] = field + else: + args["mail_from"] = None field = data.get("mail_rcpt", None) if field is not None: args["mail_rcpt"] = field + else: + args["mail_rcpt"] = None field = data.get("rcpt_to", None) if field is not None: @@ -121,28 +148,40 @@ def unmarshal_Email(data: Any) -> Email: field = data.get("rcpt_type", None) if field is not None: args["rcpt_type"] = field + else: + args["rcpt_type"] = EmailRcptType.UNKNOWN_RCPT_TYPE field = data.get("subject", None) if field is not None: args["subject"] = field + else: + args["subject"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = EmailStatus.UNKNOWN field = data.get("try_count", None) if field is not None: args["try_count"] = field + else: + args["try_count"] = 0 field = data.get("last_tries", None) if field is not None: args["last_tries"] = ( [unmarshal_EmailTry(v) for v in field] if field is not None else None ) + else: + args["last_tries"] = field(default_factory=list) field = data.get("flags", None) if field is not None: args["flags"] = [EmailFlag(v) for v in field] if field is not None else None + else: + args["flags"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -176,10 +215,14 @@ def unmarshal_DomainRecordsDMARC(data: Any) -> DomainRecordsDMARC: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None return DomainRecordsDMARC(**args) @@ -212,10 +255,14 @@ def unmarshal_DomainReputation(data: Any) -> DomainReputation: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainReputationStatus.UNKNOWN_STATUS field = data.get("score", None) if field is not None: args["score"] = field + else: + args["score"] = 0 field = data.get("scored_at", None) if field is not None: @@ -227,7 +274,7 @@ def unmarshal_DomainReputation(data: Any) -> DomainReputation: if field is not None: args["previous_score"] = field else: - args["previous_score"] = None + args["previous_score"] = 0 field = data.get("previous_scored_at", None) if field is not None: @@ -251,18 +298,26 @@ def unmarshal_DomainStatistics(data: Any) -> DomainStatistics: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("sent_count", None) if field is not None: args["sent_count"] = field + else: + args["sent_count"] = None field = data.get("failed_count", None) if field is not None: args["failed_count"] = field + else: + args["failed_count"] = None field = data.get("canceled_count", None) if field is not None: args["canceled_count"] = field + else: + args["canceled_count"] = None return DomainStatistics(**args) @@ -278,30 +333,44 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_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"] = DomainStatus.UNKNOWN field = data.get("spf_config", None) if field is not None: args["spf_config"] = field + else: + args["spf_config"] = None field = data.get("dkim_config", None) if field is not None: args["dkim_config"] = field + else: + args["dkim_config"] = None field = data.get("created_at", None) if field is not None: @@ -328,10 +397,14 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("autoconfig", None) if field is not None: args["autoconfig"] = field + else: + args["autoconfig"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("revoked_at", None) if field is not None: @@ -377,38 +450,56 @@ def unmarshal_OfferSubscription(data: Any) -> OfferSubscription: field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = OfferName.UNKNOWN_NAME field = data.get("sla", None) if field is not None: args["sla"] = field + else: + args["sla"] = 0.0 field = data.get("max_domains", None) if field is not None: args["max_domains"] = field + else: + args["max_domains"] = 0 field = data.get("max_dedicated_ips", None) if field is not None: args["max_dedicated_ips"] = field + else: + args["max_dedicated_ips"] = 0 field = data.get("max_webhooks_per_domain", None) if field is not None: args["max_webhooks_per_domain"] = field + else: + args["max_webhooks_per_domain"] = 0 field = data.get("max_custom_blocklists_per_domain", None) if field is not None: args["max_custom_blocklists_per_domain"] = field + else: + args["max_custom_blocklists_per_domain"] = 0 field = data.get("included_monthly_emails", None) if field is not None: args["included_monthly_emails"] = field + else: + args["included_monthly_emails"] = 0 field = data.get("subscribed_at", None) if field is not None: @@ -440,32 +531,46 @@ def unmarshal_Webhook(data: Any) -> Webhook: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("domain_id", None) if field is not None: args["domain_id"] = field + else: + args["domain_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("event_types", None) if field is not None: args["event_types"] = ( [WebhookEventType(v) for v in field] if field is not None else None ) + else: + args["event_types"] = field(default_factory=list) field = data.get("sns_arn", None) if field is not None: args["sns_arn"] = field + else: + args["sns_arn"] = None field = data.get("created_at", None) if field is not None: @@ -493,26 +598,38 @@ def unmarshal_Blocklist(data: Any) -> Blocklist: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("domain_id", None) if field is not None: args["domain_id"] = field + else: + args["domain_id"] = None field = data.get("email", None) if field is not None: args["email"] = field + else: + args["email"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = BlocklistType.UNKNOWN_TYPE field = data.get("reason", None) if field is not None: args["reason"] = field + else: + args["reason"] = None field = data.get("custom", None) if field is not None: args["custom"] = field + else: + args["custom"] = False field = data.get("created_at", None) if field is not None: @@ -548,6 +665,8 @@ def unmarshal_BulkCreateBlocklistsResponse(data: Any) -> BulkCreateBlocklistsRes args["blocklists"] = ( [unmarshal_Blocklist(v) for v in field] if field is not None else None ) + else: + args["blocklists"] = field(default_factory=list) return BulkCreateBlocklistsResponse(**args) @@ -565,6 +684,8 @@ def unmarshal_CreateEmailResponse(data: Any) -> CreateEmailResponse: args["emails"] = ( [unmarshal_Email(v) for v in field] if field is not None else None ) + else: + args["emails"] = field(default_factory=list) return CreateEmailResponse(**args) @@ -582,16 +703,20 @@ def unmarshal_DomainLastStatusAutoconfigState( field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("autoconfigurable", None) if field is not None: args["autoconfigurable"] = field + else: + args["autoconfigurable"] = False field = data.get("reason", None) if field is not None: args["reason"] = field else: - args["reason"] = None + args["reason"] = DomainLastStatusAutoconfigStateReason.UNKNOWN_REASON return DomainLastStatusAutoconfigState(**args) @@ -607,6 +732,8 @@ def unmarshal_DomainLastStatusDkimRecord(data: Any) -> DomainLastStatusDkimRecor field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainLastStatusRecordStatus.UNKNOWN_RECORD_STATUS field = data.get("last_valid_at", None) if field is not None: @@ -636,6 +763,8 @@ def unmarshal_DomainLastStatusDmarcRecord(data: Any) -> DomainLastStatusDmarcRec field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainLastStatusRecordStatus.UNKNOWN_RECORD_STATUS field = data.get("last_valid_at", None) if field is not None: @@ -665,6 +794,8 @@ def unmarshal_DomainLastStatusSpfRecord(data: Any) -> DomainLastStatusSpfRecord: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainLastStatusRecordStatus.UNKNOWN_RECORD_STATUS field = data.get("last_valid_at", None) if field is not None: @@ -694,10 +825,14 @@ def unmarshal_DomainLastStatus(data: Any) -> DomainLastStatus: field = data.get("domain_id", None) if field is not None: args["domain_id"] = field + else: + args["domain_id"] = None field = data.get("domain_name", None) if field is not None: args["domain_name"] = field + else: + args["domain_name"] = None field = data.get("spf_record", None) if field is not None: @@ -737,12 +872,16 @@ def unmarshal_ListBlocklistsResponse(data: Any) -> ListBlocklistsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("blocklists", None) if field is not None: args["blocklists"] = ( [unmarshal_Blocklist(v) for v in field] if field is not None else None ) + else: + args["blocklists"] = field(default_factory=list) return ListBlocklistsResponse(**args) @@ -758,12 +897,16 @@ def unmarshal_ListDomainsResponse(data: Any) -> ListDomainsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("domains", None) if field is not None: args["domains"] = ( [unmarshal_Domain(v) for v in field] if field is not None else None ) + else: + args["domains"] = field(default_factory=list) return ListDomainsResponse(**args) @@ -779,12 +922,16 @@ def unmarshal_ListEmailsResponse(data: Any) -> ListEmailsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("emails", None) if field is not None: args["emails"] = ( [unmarshal_Email(v) for v in field] if field is not None else None ) + else: + args["emails"] = field(default_factory=list) return ListEmailsResponse(**args) @@ -802,6 +949,8 @@ def unmarshal_ListOfferSubscriptionsResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("offer_subscriptions", None) if field is not None: @@ -810,6 +959,8 @@ def unmarshal_ListOfferSubscriptionsResponse( if field is not None else None ) + else: + args["offer_subscriptions"] = field(default_factory=list) return ListOfferSubscriptionsResponse(**args) @@ -825,30 +976,44 @@ def unmarshal_Offer(data: Any) -> Offer: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = OfferName.UNKNOWN_NAME field = data.get("sla", None) if field is not None: args["sla"] = field + else: + args["sla"] = 0.0 field = data.get("max_domains", None) if field is not None: args["max_domains"] = field + else: + args["max_domains"] = 0 field = data.get("max_dedicated_ips", None) if field is not None: args["max_dedicated_ips"] = field + else: + args["max_dedicated_ips"] = 0 field = data.get("included_monthly_emails", None) if field is not None: args["included_monthly_emails"] = field + else: + args["included_monthly_emails"] = 0 field = data.get("max_webhooks_per_domain", None) if field is not None: args["max_webhooks_per_domain"] = field + else: + args["max_webhooks_per_domain"] = 0 field = data.get("max_custom_blocklists_per_domain", None) if field is not None: args["max_custom_blocklists_per_domain"] = field + else: + args["max_custom_blocklists_per_domain"] = 0 field = data.get("created_at", None) if field is not None: @@ -876,12 +1041,16 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("offers", None) if field is not None: args["offers"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["offers"] = field(default_factory=list) return ListOffersResponse(**args) @@ -897,14 +1066,20 @@ def unmarshal_Pool(data: Any) -> Pool: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = PoolStatus.UNKNOWN_STATUS field = data.get("ips", None) if field is not None: args["ips"] = field + else: + args["ips"] = field(default_factory=list) field = data.get("details", None) if field is not None: @@ -938,12 +1113,16 @@ def unmarshal_ListPoolsResponse(data: Any) -> ListPoolsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("pools", None) if field is not None: args["pools"] = ( [unmarshal_Pool(v) for v in field] if field is not None else None ) + else: + args["pools"] = field(default_factory=list) return ListPoolsResponse(**args) @@ -959,34 +1138,50 @@ def unmarshal_WebhookEvent(data: Any) -> WebhookEvent: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("webhook_id", None) if field is not None: args["webhook_id"] = field + else: + args["webhook_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("domain_id", None) if field is not None: args["domain_id"] = field + else: + args["domain_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = WebhookEventType.UNKNOWN_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = WebhookEventStatus.UNKNOWN_STATUS field = data.get("data", None) if field is not None: args["data"] = field + else: + args["data"] = None field = data.get("created_at", None) if field is not None: @@ -1020,12 +1215,16 @@ def unmarshal_ListWebhookEventsResponse(data: Any) -> ListWebhookEventsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("webhook_events", None) if field is not None: args["webhook_events"] = ( [unmarshal_WebhookEvent(v) for v in field] if field is not None else None ) + else: + args["webhook_events"] = field(default_factory=list) return ListWebhookEventsResponse(**args) @@ -1041,12 +1240,16 @@ def unmarshal_ListWebhooksResponse(data: Any) -> ListWebhooksResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("webhooks", None) if field is not None: args["webhooks"] = ( [unmarshal_Webhook(v) for v in field] if field is not None else None ) + else: + args["webhooks"] = field(default_factory=list) return ListWebhooksResponse(**args) @@ -1062,26 +1265,38 @@ def unmarshal_ProjectConsumption(data: Any) -> ProjectConsumption: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("domains_count", None) if field is not None: args["domains_count"] = field + else: + args["domains_count"] = 0 field = data.get("dedicated_ips_count", None) if field is not None: args["dedicated_ips_count"] = field + else: + args["dedicated_ips_count"] = 0 field = data.get("monthly_emails_count", None) if field is not None: args["monthly_emails_count"] = field + else: + args["monthly_emails_count"] = 0 field = data.get("webhooks_count", None) if field is not None: args["webhooks_count"] = field + else: + args["webhooks_count"] = 0 field = data.get("custom_blocklists_count", None) if field is not None: args["custom_blocklists_count"] = field + else: + args["custom_blocklists_count"] = 0 return ProjectConsumption(**args) @@ -1097,18 +1312,26 @@ def unmarshal_ProjectSettingsPeriodicReport(data: Any) -> ProjectSettingsPeriodi field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = ProjectSettingsPeriodicReportFrequency.UNKNOWN_FREQUENCY field = data.get("sending_hour", None) if field is not None: args["sending_hour"] = field + else: + args["sending_hour"] = 0 field = data.get("sending_day", None) if field is not None: args["sending_day"] = field + else: + args["sending_day"] = 0 return ProjectSettingsPeriodicReport(**args) @@ -1141,26 +1364,38 @@ def unmarshal_Statistics(data: Any) -> Statistics: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("new_count", None) if field is not None: args["new_count"] = field + else: + args["new_count"] = 0 field = data.get("sending_count", None) if field is not None: args["sending_count"] = field + else: + args["sending_count"] = 0 field = data.get("sent_count", None) if field is not None: args["sent_count"] = field + else: + args["sent_count"] = 0 field = data.get("failed_count", None) if field is not None: args["failed_count"] = field + else: + args["failed_count"] = 0 field = data.get("canceled_count", None) if field is not None: args["canceled_count"] = field + else: + args["canceled_count"] = 0 return Statistics(**args) @@ -1178,7 +1413,7 @@ def marshal_BulkCreateBlocklistsRequest( output["emails"] = request.emails if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.reason is not None: output["reason"] = request.reason @@ -1199,7 +1434,9 @@ def marshal_CreateDomainRequest( output["autoconfig"] = request.autoconfig if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.accept_tos is not None: output["accept_tos"] = request.accept_tos @@ -1289,7 +1526,9 @@ def marshal_CreateEmailRequest( ] if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.attachments is not None: output["attachments"] = [ @@ -1325,7 +1564,9 @@ def marshal_CreateWebhookRequest( output["sns_arn"] = request.sns_arn if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.event_types is not None: output["event_types"] = [str(item) for item in request.event_types] @@ -1352,10 +1593,12 @@ def marshal_UpdateOfferSubscriptionRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: - output["name"] = str(request.name) + output["name"] = request.name return output @@ -1370,7 +1613,7 @@ def marshal_UpdateProjectSettingsRequestUpdatePeriodicReport( output["enabled"] = request.enabled if request.frequency is not None: - output["frequency"] = str(request.frequency) + output["frequency"] = request.frequency if request.sending_hour is not None: output["sending_hour"] = request.sending_hour diff --git a/scaleway-async/scaleway_async/tem/v1alpha1/types.py b/scaleway-async/scaleway_async/tem/v1alpha1/types.py index 0f40682c4..4a669a9b4 100644 --- a/scaleway-async/scaleway_async/tem/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/tem/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -235,7 +235,7 @@ class EmailTry: The SMTP message received. If the attempt did not reach an SMTP server, the message returned explains what happened. """ - tried_at: Optional[datetime] + tried_at: Optional[datetime] = None """ Date of the attempt to send the email. """ @@ -243,7 +243,7 @@ class EmailTry: @dataclass class DomainRecords: - dmarc: Optional[DomainRecordsDMARC] + dmarc: Optional[DomainRecordsDMARC] = None """ DMARC TXT record specification. """ @@ -261,17 +261,17 @@ class DomainReputation: A range from 0 to 100 that determines your domain's reputation score. A score of `0` means a bad domain reputation and a score of `100` means an excellent domain reputation. """ - scored_at: Optional[datetime] + scored_at: Optional[datetime] = None """ Time and date the score was calculated. """ - previous_score: Optional[int] + previous_score: Optional[int] = 0 """ The previously-calculated domain's reputation score. """ - previous_scored_at: Optional[datetime] + previous_scored_at: Optional[datetime] = None """ Time and date the previous reputation score was calculated. """ @@ -280,11 +280,8 @@ class DomainReputation: @dataclass class DomainStatistics: total_count: int - sent_count: int - failed_count: int - canceled_count: int @@ -320,17 +317,17 @@ class Blocklist: True if this blocklist was created manually. False for an automatic Transactional Email blocklist. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the blocklist creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of the blocklist's last update. """ - ends_at: Optional[datetime] + ends_at: Optional[datetime] = None """ Date and time when the blocklist ends. Empty if the blocklist has no end. """ @@ -343,7 +340,7 @@ class CreateEmailRequestAddress: Email address. """ - name: Optional[str] + name: Optional[str] = None """ (Optional) Name displayed. """ @@ -407,11 +404,6 @@ class Email: Email address of the recipient. """ - rcpt_to: Optional[str] - """ - Deprecated. Email address of the recipient. - """ - rcpt_type: EmailRcptType """ Type of recipient. @@ -442,17 +434,22 @@ class Email: Flags categorize emails. They allow you to obtain more information about recurring errors, for example. """ - created_at: Optional[datetime] + rcpt_to: Optional[str] = None + """ + Deprecated. Email address of the recipient. + """ + + created_at: Optional[datetime] = None """ Creation date of the email object. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update of the email object. """ - status_details: Optional[str] + status_details: Optional[str] = None """ Additional status information. """ @@ -470,7 +467,9 @@ class DomainLastStatusAutoconfigState: Whether the domain can be auto-configured or not. """ - reason: Optional[DomainLastStatusAutoconfigStateReason] + reason: Optional[DomainLastStatusAutoconfigStateReason] = ( + DomainLastStatusAutoconfigStateReason.UNKNOWN_REASON + ) """ The reason that the domain cannot be auto-configurable. """ @@ -483,12 +482,12 @@ class DomainLastStatusDkimRecord: Status of the DKIM record's configuration. """ - last_valid_at: Optional[datetime] + last_valid_at: Optional[datetime] = None """ Time and date the DKIM record was last valid. """ - error: Optional[str] + error: Optional[str] = None """ An error text displays in case the record is not valid. """ @@ -501,12 +500,12 @@ class DomainLastStatusDmarcRecord: Status of the DMARC record's configuration. """ - last_valid_at: Optional[datetime] + last_valid_at: Optional[datetime] = None """ Time and date the DMARC record was last valid. """ - error: Optional[str] + error: Optional[str] = None """ An error text displays in case the record is not valid. """ @@ -519,12 +518,12 @@ class DomainLastStatusSpfRecord: Status of the SPF record's configuration. """ - last_valid_at: Optional[datetime] + last_valid_at: Optional[datetime] = None """ Time and date the SPF record was last valid. """ - error: Optional[str] + error: Optional[str] = None """ An error text displays in case the record is not valid. """ @@ -567,52 +566,52 @@ class Domain: DKIM public key to record in the DNS zone. """ - created_at: Optional[datetime] + autoconfig: bool """ - Date and time of domain creation. + Status of auto-configuration for the domain's DNS zone. """ - next_check_at: Optional[datetime] + region: ScwRegion """ - Date and time of the next scheduled check. + Region to target. If none is passed will use default region from the config. """ - last_valid_at: Optional[datetime] + created_at: Optional[datetime] = None """ - Date and time the domain was last valid. + Date and time of domain creation. """ - autoconfig: bool + next_check_at: Optional[datetime] = None """ - Status of auto-configuration for the domain's DNS zone. + Date and time of the next scheduled check. """ - region: ScwRegion + last_valid_at: Optional[datetime] = None """ - Region to target. If none is passed will use default region from the config. + Date and time the domain was last valid. """ - revoked_at: Optional[datetime] + revoked_at: Optional[datetime] = None """ Date and time of the domain's deletion. """ - last_error: Optional[str] + last_error: Optional[str] = None """ Deprecated. Error message returned if the last check failed. """ - statistics: Optional[DomainStatistics] + statistics: Optional[DomainStatistics] = None """ Domain's statistics. """ - reputation: Optional[DomainReputation] + reputation: Optional[DomainReputation] = None """ The domain's reputation is available when your domain is checked and has sent enough emails. """ - records: Optional[DomainRecords] + records: Optional[DomainRecords] = None """ List of records to configure to validate a domain. """ @@ -665,12 +664,12 @@ class OfferSubscription: Number of emails included in the offer-subscription per month. """ - subscribed_at: Optional[datetime] + subscribed_at: Optional[datetime] = None """ Date and time of the subscription. """ - cancellation_available_at: Optional[datetime] + cancellation_available_at: Optional[datetime] = None """ Date and time of the end of the offer-subscription commitment. """ @@ -713,12 +712,12 @@ class Offer: Max number of active custom blocklists that can be associated with the offer. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the offer creation. """ - commitment_period: Optional[str] + commitment_period: Optional[str] = None """ Period of commitment. """ @@ -741,17 +740,17 @@ class Pool: IPs of the pool. """ - details: Optional[str] + details: Optional[str] = None """ Details of the pool. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone of the pool. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse hostname of all IPs of the pool. """ @@ -799,17 +798,17 @@ class WebhookEvent: Data sent to the Webhook destination. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the Webhook Event creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last Webhook Event updates. """ - email_id: Optional[str] + email_id: Optional[str] = None """ Optional Email ID if the event is triggered by an Email resource. """ @@ -852,12 +851,12 @@ class Webhook: Scaleway SNS ARN topic to push the events to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the Webhook creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last Webhook updates. """ @@ -888,22 +887,24 @@ class ProjectSettingsPeriodicReport: @dataclass class UpdateProjectSettingsRequestUpdatePeriodicReport: - enabled: Optional[bool] + enabled: Optional[bool] = False """ (Optional) Enable or disable periodic report notifications. """ - frequency: Optional[ProjectSettingsPeriodicReportFrequency] + frequency: Optional[ProjectSettingsPeriodicReportFrequency] = ( + ProjectSettingsPeriodicReportFrequency.UNKNOWN_FREQUENCY + ) """ (Optional) Frequency at which you receive periodic report notifications. """ - sending_hour: Optional[int] + sending_hour: Optional[int] = 0 """ (Optional) Hour at which you receive periodic report notifications. """ - sending_day: Optional[int] + sending_day: Optional[int] = 0 """ (Optional) On which day you receive periodic report notifications (1-7 weekly, 1-28 monthly). """ @@ -916,22 +917,22 @@ class BulkCreateBlocklistsRequest: Domain ID linked to the blocklist. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - emails: Optional[List[str]] + emails: Optional[List[str]] = field(default_factory=list) """ Email blocked by the blocklist. """ - type_: Optional[BlocklistType] + type_: Optional[BlocklistType] = BlocklistType.UNKNOWN_TYPE """ Type of blocklist. """ - reason: Optional[str] + reason: Optional[str] = None """ Reason to block the email. """ @@ -952,7 +953,7 @@ class CancelEmailRequest: ID of the email to cancel. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -965,7 +966,7 @@ class CheckDomainRequest: ID of the domain to check. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -983,17 +984,17 @@ class CreateDomainRequest: Activate auto-configuration of the domain's DNS zone. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project to which the domain belongs. """ - accept_tos: Optional[bool] + accept_tos: Optional[bool] = False """ Deprecated. Accept Scaleway's Terms of Service. """ @@ -1021,42 +1022,46 @@ class CreateEmailRequest: HTML content. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - to: Optional[List[CreateEmailRequestAddress]] + to: Optional[List[CreateEmailRequestAddress]] = field(default_factory=list) """ An array of the primary recipient's information. """ - cc: Optional[List[CreateEmailRequestAddress]] + cc: Optional[List[CreateEmailRequestAddress]] = field(default_factory=list) """ An array of the carbon copy recipient's information. """ - bcc: Optional[List[CreateEmailRequestAddress]] + bcc: Optional[List[CreateEmailRequestAddress]] = field(default_factory=list) """ An array of the blind carbon copy recipient's information. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project in which to create the email. """ - attachments: Optional[List[CreateEmailRequestAttachment]] + attachments: Optional[List[CreateEmailRequestAttachment]] = field( + default_factory=list + ) """ Array of attachments. """ - send_before: Optional[datetime] + send_before: Optional[datetime] = None """ Maximum date to deliver the email. """ - additional_headers: Optional[List[CreateEmailRequestHeader]] + additional_headers: Optional[List[CreateEmailRequestHeader]] = field( + default_factory=list + ) """ Array of additional headers as key-value. """ @@ -1087,17 +1092,17 @@ class CreateWebhookRequest: Scaleway SNS ARN topic to push the events to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project to which the Webhook belongs. """ - event_types: Optional[List[WebhookEventType]] + event_types: Optional[List[WebhookEventType]] = field(default_factory=list) """ List of event types that will trigger an event. """ @@ -1110,7 +1115,7 @@ class DeleteBlocklistRequest: ID of the blocklist to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1123,7 +1128,7 @@ class DeleteWebhookRequest: ID of the Webhook to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1141,22 +1146,22 @@ class DomainLastStatus: The domain name (example.com). """ - spf_record: Optional[DomainLastStatusSpfRecord] + spf_record: Optional[DomainLastStatusSpfRecord] = None """ The SPF record verification data. """ - dkim_record: Optional[DomainLastStatusDkimRecord] + dkim_record: Optional[DomainLastStatusDkimRecord] = None """ The DKIM record verification data. """ - dmarc_record: Optional[DomainLastStatusDmarcRecord] + dmarc_record: Optional[DomainLastStatusDmarcRecord] = None """ The DMARC record verification data. """ - autoconfig_state: Optional[DomainLastStatusAutoconfigState] + autoconfig_state: Optional[DomainLastStatusAutoconfigState] = None """ The verification state of domain auto-configuration. """ @@ -1169,7 +1174,7 @@ class GetDomainLastStatusRequest: ID of the domain to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1182,7 +1187,7 @@ class GetDomainRequest: ID of the domain. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1195,7 +1200,7 @@ class GetEmailRequest: ID of the email to retrieve. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1203,12 +1208,12 @@ class GetEmailRequest: @dataclass class GetProjectConsumptionRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ @@ -1216,12 +1221,12 @@ class GetProjectConsumptionRequest: @dataclass class GetProjectSettingsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ @@ -1229,32 +1234,32 @@ class GetProjectSettingsRequest: @dataclass class GetStatisticsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ (Optional) Number of emails for this Project. """ - domain_id: Optional[str] + domain_id: Optional[str] = None """ (Optional) Number of emails sent from this domain (must be coherent with the `project_id` and the `organization_id`). """ - since: Optional[datetime] + since: Optional[datetime] = None """ (Optional) Number of emails created after this date. """ - until: Optional[datetime] + until: Optional[datetime] = None """ (Optional) Number of emails created before this date. """ - mail_from: Optional[str] + mail_from: Optional[str] = None """ (Optional) Number of emails sent with this sender's email address. """ @@ -1267,7 +1272,7 @@ class GetWebhookRequest: ID of the Webhook to check. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1280,37 +1285,39 @@ class ListBlocklistsRequest: (Optional) Filter by a domain ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListBlocklistsRequestOrderBy] + order_by: Optional[ListBlocklistsRequestOrderBy] = ( + ListBlocklistsRequestOrderBy.CREATED_AT_DESC + ) """ (Optional) List blocklist corresponding to specific criteria. """ - page: Optional[int] + page: Optional[int] = 0 """ (Optional) Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ (Optional) Requested page size. Value must be between 1 and 100. """ - email: Optional[str] + email: Optional[str] = None """ (Optional) Filter by an email address. """ - type_: Optional[BlocklistType] + type_: Optional[BlocklistType] = BlocklistType.UNKNOWN_TYPE """ (Optional) Filter by a blocklist type. """ - custom: Optional[bool] + custom: Optional[bool] = False """ (Optional) Filter by custom blocklist (true) or automatic Transactional Email blocklist (false). """ @@ -1331,37 +1338,37 @@ class ListBlocklistsResponse: @dataclass class ListDomainsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Requested page size. Value must be between 1 and 1000. """ - project_id: Optional[str] + project_id: Optional[str] = None """ (Optional) ID of the Project in which to list the domains. """ - status: Optional[List[DomainStatus]] + status: Optional[List[DomainStatus]] = field(default_factory=list) """ (Optional) List domains under specific statuses. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ (Optional) ID of the Organization in which to list the domains. """ - name: Optional[str] + name: Optional[str] = None """ (Optional) Names of the domains to list. """ @@ -1382,76 +1389,76 @@ class ListDomainsResponse: @dataclass class ListEmailsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] - - project_id: Optional[str] + page: Optional[int] = 0 + page_size: Optional[int] = 0 + project_id: Optional[str] = None """ (Optional) ID of the Project in which to list the emails. """ - domain_id: Optional[str] + domain_id: Optional[str] = None """ (Optional) ID of the domain for which to list the emails. """ - message_id: Optional[str] + message_id: Optional[str] = None """ (Optional) ID of the message for which to list the emails. """ - since: Optional[datetime] + since: Optional[datetime] = None """ (Optional) List emails created after this date. """ - until: Optional[datetime] + until: Optional[datetime] = None """ (Optional) List emails created before this date. """ - mail_from: Optional[str] + mail_from: Optional[str] = None """ (Optional) List emails sent with this sender's email address. """ - mail_to: Optional[str] + mail_to: Optional[str] = None """ Deprecated. List emails sent to this recipient's email address. """ - mail_rcpt: Optional[str] + mail_rcpt: Optional[str] = None """ (Optional) List emails sent to this recipient's email address. """ - statuses: Optional[List[EmailStatus]] + statuses: Optional[List[EmailStatus]] = field(default_factory=list) """ (Optional) List emails with any of these statuses. """ - subject: Optional[str] + subject: Optional[str] = None """ (Optional) List emails with this subject. """ - search: Optional[str] + search: Optional[str] = None """ (Optional) List emails by searching to all fields. """ - order_by: Optional[ListEmailsRequestOrderBy] + order_by: Optional[ListEmailsRequestOrderBy] = ( + ListEmailsRequestOrderBy.CREATED_AT_DESC + ) """ (Optional) List emails corresponding to specific criteria. """ - flags: Optional[List[EmailFlag]] + flags: Optional[List[EmailFlag]] = field(default_factory=list) """ (Optional) List emails containing only specific flags. """ @@ -1472,12 +1479,12 @@ class ListEmailsResponse: @dataclass class ListOfferSubscriptionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1498,7 +1505,7 @@ class ListOfferSubscriptionsResponse: @dataclass class ListOffersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1519,22 +1526,22 @@ class ListOffersResponse: @dataclass class ListPoolsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Requested page size. Value must be between 1 and 1000. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1560,52 +1567,54 @@ class ListWebhookEventsRequest: ID of the Webhook linked to the events. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListWebhookEventsRequestOrderBy] + order_by: Optional[ListWebhookEventsRequestOrderBy] = ( + ListWebhookEventsRequestOrderBy.CREATED_AT_DESC + ) """ (Optional) List Webhook events corresponding to specific criteria. """ - page: Optional[int] + page: Optional[int] = 0 """ Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Requested page size. Value must be between 1 and 100. """ - email_id: Optional[str] + email_id: Optional[str] = None """ ID of the email linked to the events. """ - event_types: Optional[List[WebhookEventType]] + event_types: Optional[List[WebhookEventType]] = field(default_factory=list) """ List of event types linked to the events. """ - statuses: Optional[List[WebhookEventStatus]] + statuses: Optional[List[WebhookEventStatus]] = field(default_factory=list) """ List of event statuses. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the webhook Project. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the webhook Organization. """ - domain_id: Optional[str] + domain_id: Optional[str] = None """ ID of the domain to watch for triggering events. """ @@ -1626,37 +1635,39 @@ class ListWebhookEventsResponse: @dataclass class ListWebhooksRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListWebhooksRequestOrderBy] + order_by: Optional[ListWebhooksRequestOrderBy] = ( + ListWebhooksRequestOrderBy.CREATED_AT_DESC + ) """ (Optional) List Webhooks corresponding to specific criteria. """ - page: Optional[int] + page: Optional[int] = 0 """ (Optional) Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ (Optional) Requested page size. Value must be between 1 and 100. """ - project_id: Optional[str] + project_id: Optional[str] = None """ (Optional) ID of the Project for which to list the Webhooks. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ (Optional) ID of the Organization for which to list the Webhooks. """ - domain_id: Optional[str] + domain_id: Optional[str] = None """ (Optional) ID of the Domain for which to list the Webhooks. """ @@ -1710,7 +1721,7 @@ class ProjectConsumption: @dataclass class ProjectSettings: - periodic_report: Optional[ProjectSettingsPeriodicReport] + periodic_report: Optional[ProjectSettingsPeriodicReport] = None """ Information about your periodic report. """ @@ -1723,7 +1734,7 @@ class RevokeDomainRequest: ID of the domain to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1769,12 +1780,12 @@ class UpdateDomainRequest: ID of the domain to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - autoconfig: Optional[bool] + autoconfig: Optional[bool] = False """ (Optional) If set to true, activate auto-configuration of the domain's DNS zone. """ @@ -1782,17 +1793,17 @@ class UpdateDomainRequest: @dataclass class UpdateOfferSubscriptionRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ - name: Optional[OfferName] + name: Optional[OfferName] = OfferName.UNKNOWN_NAME """ Name of the offer-subscription. """ @@ -1800,17 +1811,17 @@ class UpdateOfferSubscriptionRequest: @dataclass class UpdateProjectSettingsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ - periodic_report: Optional[UpdateProjectSettingsRequestUpdatePeriodicReport] + periodic_report: Optional[UpdateProjectSettingsRequestUpdatePeriodicReport] = None """ Periodic report update details - all fields are optional. """ @@ -1823,22 +1834,22 @@ class UpdateWebhookRequest: ID of the Webhook to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Webhook to update. """ - event_types: Optional[List[WebhookEventType]] + event_types: Optional[List[WebhookEventType]] = field(default_factory=list) """ List of event types to update. """ - sns_arn: Optional[str] + sns_arn: Optional[str] = None """ Scaleway SNS ARN topic to update. """ diff --git a/scaleway-async/scaleway_async/test/v1/marshalling.py b/scaleway-async/scaleway_async/test/v1/marshalling.py index c8a19fb63..1157c2e0c 100644 --- a/scaleway-async/scaleway_async/test/v1/marshalling.py +++ b/scaleway-async/scaleway_async/test/v1/marshalling.py @@ -30,30 +30,44 @@ def unmarshal_Human(data: Any) -> Human: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("height", None) if field is not None: args["height"] = field + else: + args["height"] = None field = data.get("shoe_size", None) if field is not None: args["shoe_size"] = field + else: + args["shoe_size"] = None field = data.get("altitude_in_meter", None) if field is not None: args["altitude_in_meter"] = field + else: + args["altitude_in_meter"] = None field = data.get("altitude_in_millimeter", None) if field is not None: args["altitude_in_millimeter"] = field + else: + args["altitude_in_millimeter"] = None field = data.get("fingers_count", None) if field is not None: args["fingers_count"] = field + else: + args["fingers_count"] = None field = data.get("created_at", None) if field is not None: @@ -70,26 +84,38 @@ def unmarshal_Human(data: Any) -> Human: field = data.get("hair_count", None) if field is not None: args["hair_count"] = field + else: + args["hair_count"] = None field = data.get("is_happy", None) if field is not None: args["is_happy"] = field + else: + args["is_happy"] = None field = data.get("eyes_color", None) if field is not None: args["eyes_color"] = field + else: + args["eyes_color"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None return Human(**args) @@ -105,12 +131,16 @@ def unmarshal_ListHumansResponse(data: Any) -> ListHumansResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("humans", None) if field is not None: args["humans"] = ( [unmarshal_Human(v) for v in field] if field is not None else None ) + else: + args["humans"] = None return ListHumansResponse(**args) @@ -126,10 +156,14 @@ def unmarshal_RegisterResponse(data: Any) -> RegisterResponse: field = data.get("secret_key", None) if field is not None: args["secret_key"] = field + else: + args["secret_key"] = None field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None return RegisterResponse(**args) @@ -183,7 +217,7 @@ def marshal_CreateHumanRequest( output["name"] = request.name if request.eyes_color is not None: - output["eyes_color"] = str(request.eyes_color) + output["eyes_color"] = request.eyes_color return output @@ -228,7 +262,7 @@ def marshal_UpdateHumanRequest( output["is_happy"] = request.is_happy if request.eyes_color is not None: - output["eyes_color"] = str(request.eyes_color) + output["eyes_color"] = request.eyes_color if request.name is not None: output["name"] = request.name diff --git a/scaleway-async/scaleway_async/test/v1/types.py b/scaleway-async/scaleway_async/test/v1/types.py index bc83e5e82..0b54440f1 100644 --- a/scaleway-async/scaleway_async/test/v1/types.py +++ b/scaleway-async/scaleway_async/test/v1/types.py @@ -51,59 +51,36 @@ def __str__(self) -> str: @dataclass class Human: id: str - organization_id: str - height: float - shoe_size: float - altitude_in_meter: int - altitude_in_millimeter: int - fingers_count: int - - created_at: Optional[datetime] - - updated_at: Optional[datetime] - hair_count: int - is_happy: bool - eyes_color: EyeColors - status: HumanStatus - name: str - project_id: str + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None @dataclass class CreateHumanRequest: height: float - shoe_size: float - altitude_in_meter: int - altitude_in_millimeter: int - fingers_count: int - hair_count: int - is_happy: bool - name: str + eyes_color: Optional[EyeColors] = None + project_id: Optional[str] = None - eyes_color: Optional[EyeColors] - - project_id: Optional[str] - - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -124,21 +101,16 @@ class GetHumanRequest: @dataclass class ListHumansRequest: - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListHumansRequestOrderBy] - - organization_id: Optional[str] - - project_id: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListHumansRequestOrderBy] = None + organization_id: Optional[str] = None + project_id: Optional[str] = None @dataclass class ListHumansResponse: total_count: int - humans: List[Human] @@ -150,7 +122,6 @@ class RegisterRequest: @dataclass class RegisterResponse: secret_key: str - access_key: str @@ -177,23 +148,16 @@ class UpdateHumanRequest: UUID of the human you want to update. """ - height: Optional[float] + height: Optional[float] = 0.0 """ Height of the human in meters. """ - shoe_size: Optional[float] - - altitude_in_meter: Optional[int] - - altitude_in_millimeter: Optional[int] - - fingers_count: Optional[int] - - hair_count: Optional[int] - - is_happy: Optional[bool] - - eyes_color: Optional[EyeColors] - - name: Optional[str] + shoe_size: Optional[float] = 0.0 + altitude_in_meter: Optional[int] = 0 + altitude_in_millimeter: Optional[int] = 0 + fingers_count: Optional[int] = 0 + hair_count: Optional[int] = 0 + is_happy: Optional[bool] = False + eyes_color: Optional[EyeColors] = EyeColors.UNKNOWN + name: Optional[str] = None diff --git a/scaleway-async/scaleway_async/vpc/v2/marshalling.py b/scaleway-async/scaleway_async/vpc/v2/marshalling.py index edbc3275a..8be8eee8d 100644 --- a/scaleway-async/scaleway_async/vpc/v2/marshalling.py +++ b/scaleway-async/scaleway_async/vpc/v2/marshalling.py @@ -41,22 +41,32 @@ def unmarshal_Subnet(data: Any) -> Subnet: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("subnet", None) if field is not None: args["subnet"] = field + else: + args["subnet"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("vpc_id", None) if field is not None: args["vpc_id"] = field + else: + args["vpc_id"] = None field = data.get("created_at", None) if field is not None: @@ -84,44 +94,64 @@ def unmarshal_PrivateNetwork(data: Any) -> PrivateNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("subnets", None) if field is not None: args["subnets"] = ( [unmarshal_Subnet(v) for v in field] if field is not None else None ) + else: + args["subnets"] = field(default_factory=list) field = data.get("vpc_id", None) if field is not None: args["vpc_id"] = field + else: + args["vpc_id"] = None field = data.get("dhcp_enabled", None) if field is not None: args["dhcp_enabled"] = field + else: + args["dhcp_enabled"] = False field = data.get("default_route_propagation_enabled", None) if field is not None: args["default_route_propagation_enabled"] = field + else: + args["default_route_propagation_enabled"] = False field = data.get("created_at", None) if field is not None: @@ -149,30 +179,44 @@ def unmarshal_Route(data: Any) -> Route: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("vpc_id", None) if field is not None: args["vpc_id"] = field + else: + args["vpc_id"] = None field = data.get("destination", None) if field is not None: args["destination"] = field + else: + args["destination"] = None field = data.get("is_read_only", None) if field is not None: args["is_read_only"] = field + else: + args["is_read_only"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("nexthop_resource_id", None) if field is not None: @@ -212,42 +256,62 @@ def unmarshal_VPC(data: Any) -> VPC: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("is_default", None) if field is not None: args["is_default"] = field + else: + args["is_default"] = False field = data.get("private_network_count", None) if field is not None: args["private_network_count"] = field + else: + args["private_network_count"] = 0 field = data.get("routing_enabled", None) if field is not None: args["routing_enabled"] = field + else: + args["routing_enabled"] = False field = data.get("custom_routes_propagation_enabled", None) if field is not None: args["custom_routes_propagation_enabled"] = field + else: + args["custom_routes_propagation_enabled"] = False field = data.get("created_at", None) if field is not None: @@ -275,6 +339,8 @@ def unmarshal_AddSubnetsResponse(data: Any) -> AddSubnetsResponse: field = data.get("subnets", None) if field is not None: args["subnets"] = field + else: + args["subnets"] = None return AddSubnetsResponse(**args) @@ -290,6 +356,8 @@ def unmarshal_DeleteSubnetsResponse(data: Any) -> DeleteSubnetsResponse: field = data.get("subnets", None) if field is not None: args["subnets"] = field + else: + args["subnets"] = None return DeleteSubnetsResponse(**args) @@ -305,34 +373,50 @@ def unmarshal_AclRule(data: Any) -> AclRule: field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = None field = data.get("source", None) if field is not None: args["source"] = field + else: + args["source"] = None field = data.get("src_port_low", None) if field is not None: args["src_port_low"] = field + else: + args["src_port_low"] = None field = data.get("src_port_high", None) if field is not None: args["src_port_high"] = field + else: + args["src_port_high"] = None field = data.get("destination", None) if field is not None: args["destination"] = field + else: + args["destination"] = None field = data.get("dst_port_low", None) if field is not None: args["dst_port_low"] = field + else: + args["dst_port_low"] = None field = data.get("dst_port_high", None) if field is not None: args["dst_port_high"] = field + else: + args["dst_port_high"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = None field = data.get("description", None) if field is not None: @@ -356,10 +440,14 @@ def unmarshal_GetAclResponse(data: Any) -> GetAclResponse: args["rules"] = ( [unmarshal_AclRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = None field = data.get("default_policy", None) if field is not None: args["default_policy"] = field + else: + args["default_policy"] = None return GetAclResponse(**args) @@ -377,10 +465,14 @@ def unmarshal_ListPrivateNetworksResponse(data: Any) -> ListPrivateNetworksRespo args["private_networks"] = ( [unmarshal_PrivateNetwork(v) for v in field] if field is not None else None ) + else: + args["private_networks"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListPrivateNetworksResponse(**args) @@ -398,10 +490,14 @@ def unmarshal_ListSubnetsResponse(data: Any) -> ListSubnetsResponse: args["subnets"] = ( [unmarshal_Subnet(v) for v in field] if field is not None else None ) + else: + args["subnets"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListSubnetsResponse(**args) @@ -417,10 +513,14 @@ def unmarshal_ListVPCsResponse(data: Any) -> ListVPCsResponse: field = data.get("vpcs", None) if field is not None: args["vpcs"] = [unmarshal_VPC(v) for v in field] if field is not None else None + else: + args["vpcs"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListVPCsResponse(**args) @@ -438,10 +538,14 @@ def unmarshal_SetAclResponse(data: Any) -> SetAclResponse: args["rules"] = ( [unmarshal_AclRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = None field = data.get("default_policy", None) if field is not None: args["default_policy"] = field + else: + args["default_policy"] = None return SetAclResponse(**args) @@ -473,7 +577,9 @@ def marshal_CreatePrivateNetworkRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -527,7 +633,9 @@ def marshal_CreateVPCRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -554,7 +662,7 @@ def marshal_AclRule( output: Dict[str, Any] = {} if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.source is not None: output["source"] = request.source @@ -575,7 +683,7 @@ def marshal_AclRule( output["dst_port_high"] = request.dst_port_high if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.description is not None: output["description"] = request.description @@ -596,7 +704,7 @@ def marshal_SetAclRequest( output["is_ipv6"] = request.is_ipv6 if request.default_policy is not None: - output["default_policy"] = str(request.default_policy) + output["default_policy"] = request.default_policy return output diff --git a/scaleway-async/scaleway_async/vpc/v2/types.py b/scaleway-async/scaleway_async/vpc/v2/types.py index 0185930b1..6df407aeb 100644 --- a/scaleway-async/scaleway_async/vpc/v2/types.py +++ b/scaleway-async/scaleway_async/vpc/v2/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -89,12 +89,12 @@ class Subnet: VPC the subnet belongs to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Subnet creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Subnet last modification date. """ @@ -152,12 +152,12 @@ class PrivateNetwork: Defines whether default v4 and v6 routes are propagated for this Private Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the Private Network was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the Private Network was last modified. """ @@ -200,22 +200,22 @@ class Route: Region of the Route. """ - nexthop_resource_id: Optional[str] + nexthop_resource_id: Optional[str] = None """ ID of the nexthop resource. """ - nexthop_private_network_id: Optional[str] + nexthop_private_network_id: Optional[str] = None """ ID of the nexthop private network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the Route was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the Route was last modified. """ @@ -263,7 +263,7 @@ class AclRule: Policy to apply to the packet. """ - description: Optional[str] + description: Optional[str] = None """ Rule description. """ @@ -321,12 +321,12 @@ class VPC: Defines whether the VPC advertises custom routes between its Private Networks. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the VPC was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the VPC was last modified. """ @@ -339,12 +339,12 @@ class AddSubnetsRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - subnets: Optional[List[str]] + subnets: Optional[List[str]] = field(default_factory=list) """ Private Network subnets CIDR. """ @@ -362,32 +362,32 @@ class CreatePrivateNetworkRequest: Defines whether default v4 and v6 routes are propagated for this Private Network. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the Private Network. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Scaleway Project in which to create the Private Network. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the Private Network. """ - subnets: Optional[List[str]] + subnets: Optional[List[str]] = field(default_factory=list) """ Private Network subnets CIDR. """ - vpc_id: Optional[str] + vpc_id: Optional[str] = None """ VPC in which to create the Private Network. """ @@ -410,22 +410,22 @@ class CreateRouteRequest: Destination of the Route. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Route. """ - nexthop_resource_id: Optional[str] + nexthop_resource_id: Optional[str] = None """ ID of the nexthop resource. """ - nexthop_private_network_id: Optional[str] + nexthop_private_network_id: Optional[str] = None """ ID of the nexthop private network. """ @@ -438,22 +438,22 @@ class CreateVPCRequest: Enable routing between Private Networks in the VPC. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the VPC. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Scaleway Project in which to create the VPC. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the VPC. """ @@ -466,7 +466,7 @@ class DeletePrivateNetworkRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -479,7 +479,7 @@ class DeleteRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -492,12 +492,12 @@ class DeleteSubnetsRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - subnets: Optional[List[str]] + subnets: Optional[List[str]] = field(default_factory=list) """ Private Network subnets CIDR. """ @@ -515,7 +515,7 @@ class DeleteVPCRequest: VPC ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -528,7 +528,7 @@ class EnableCustomRoutesPropagationRequest: VPC ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -541,7 +541,7 @@ class EnableDHCPRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -554,7 +554,7 @@ class EnableRoutingRequest: VPC ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -572,7 +572,7 @@ class GetAclRequest: Defines whether this set of ACL rules is for IPv6 (false = IPv4). Each Network ACL can have rules for only one IP type. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -581,7 +581,6 @@ class GetAclRequest: @dataclass class GetAclResponse: rules: List[AclRule] - default_policy: Action @@ -592,7 +591,7 @@ class GetPrivateNetworkRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -605,7 +604,7 @@ class GetRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -618,7 +617,7 @@ class GetVPCRequest: VPC ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -626,57 +625,59 @@ class GetVPCRequest: @dataclass class ListPrivateNetworksRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPrivateNetworksRequestOrderBy] + order_by: Optional[ListPrivateNetworksRequestOrderBy] = ( + ListPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the returned Private Networks. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Private Networks to return per page. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter for. Only Private Networks with names containing this string will be returned. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. Only Private Networks with one or more matching tags will be returned. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. Only Private Networks belonging to this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. Only Private Networks belonging to this Project will be returned. """ - private_network_ids: Optional[List[str]] + private_network_ids: Optional[List[str]] = field(default_factory=list) """ Private Network IDs to filter for. Only Private Networks with one of these IDs will be returned. """ - vpc_id: Optional[str] + vpc_id: Optional[str] = None """ VPC ID to filter for. Only Private Networks belonging to this VPC will be returned. """ - dhcp_enabled: Optional[bool] + dhcp_enabled: Optional[bool] = False """ DHCP status to filter for. When true, only Private Networks with managed DHCP enabled will be returned. """ @@ -685,48 +686,49 @@ class ListPrivateNetworksRequest: @dataclass class ListPrivateNetworksResponse: private_networks: List[PrivateNetwork] - total_count: int @dataclass class ListSubnetsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListSubnetsRequestOrderBy] + order_by: Optional[ListSubnetsRequestOrderBy] = ( + ListSubnetsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the returned subnets. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Private Networks to return per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. Only subnets belonging to this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. Only subnets belonging to this Project will be returned. """ - subnet_ids: Optional[List[str]] + subnet_ids: Optional[List[str]] = field(default_factory=list) """ Subnet IDs to filter for. Only subnets matching the specified IDs will be returned. """ - vpc_id: Optional[str] + vpc_id: Optional[str] = None """ VPC ID to filter for. Only subnets belonging to this VPC will be returned. """ @@ -735,58 +737,57 @@ class ListSubnetsRequest: @dataclass class ListSubnetsResponse: subnets: List[Subnet] - total_count: int @dataclass class ListVPCsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListVPCsRequestOrderBy] + order_by: Optional[ListVPCsRequestOrderBy] = ListVPCsRequestOrderBy.CREATED_AT_ASC """ Sort order of the returned VPCs. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of VPCs to return per page. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter for. Only VPCs with names containing this string will be returned. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. Only VPCs with one or more matching tags will be returned. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. Only VPCs belonging to this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. Only VPCs belonging to this Project will be returned. """ - is_default: Optional[bool] + is_default: Optional[bool] = False """ Defines whether to filter only for VPCs which are the default one for their Project. """ - routing_enabled: Optional[bool] + routing_enabled: Optional[bool] = False """ Defines whether to filter only for VPCs which route traffic between their Private Networks. """ @@ -795,7 +796,6 @@ class ListVPCsRequest: @dataclass class ListVPCsResponse: vpcs: List[VPC] - total_count: int @@ -821,7 +821,7 @@ class SetAclRequest: Action to take for packets which do not match any rules. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -830,7 +830,6 @@ class SetAclRequest: @dataclass class SetAclResponse: rules: List[AclRule] - default_policy: Action @@ -841,22 +840,22 @@ class UpdatePrivateNetworkRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the Private Network. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the Private Network. """ - default_route_propagation_enabled: Optional[bool] + default_route_propagation_enabled: Optional[bool] = False """ Defines whether default v4 and v6 routes are propagated for this Private Network. """ @@ -869,32 +868,32 @@ class UpdateRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Route description. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Route. """ - destination: Optional[str] + destination: Optional[str] = None """ Destination of the Route. """ - nexthop_resource_id: Optional[str] + nexthop_resource_id: Optional[str] = None """ ID of the nexthop resource. """ - nexthop_private_network_id: Optional[str] + nexthop_private_network_id: Optional[str] = None """ ID of the nexthop private network. """ @@ -907,17 +906,17 @@ class UpdateVPCRequest: VPC ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the VPC. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the VPC. """ diff --git a/scaleway-async/scaleway_async/vpcgw/v1/marshalling.py b/scaleway-async/scaleway_async/vpcgw/v1/marshalling.py index 56aeb3ac7..0ef4bf0d1 100644 --- a/scaleway-async/scaleway_async/vpcgw/v1/marshalling.py +++ b/scaleway-async/scaleway_async/vpcgw/v1/marshalling.py @@ -10,6 +10,10 @@ resolve_one_of, ) from .types import ( + DHCPEntryType, + GatewayNetworkStatus, + GatewayStatus, + PATRuleProtocol, DHCP, IpamConfig, GatewayNetwork, @@ -60,26 +64,38 @@ def unmarshal_DHCP(data: Any) -> DHCP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("subnet", None) if field is not None: args["subnet"] = field + else: + args["subnet"] = None field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("pool_low", None) if field is not None: args["pool_low"] = field + else: + args["pool_low"] = None field = data.get("created_at", None) if field is not None: @@ -96,34 +112,50 @@ def unmarshal_DHCP(data: Any) -> DHCP: field = data.get("pool_high", None) if field is not None: args["pool_high"] = field + else: + args["pool_high"] = None field = data.get("enable_dynamic", None) if field is not None: args["enable_dynamic"] = field + else: + args["enable_dynamic"] = False field = data.get("push_default_route", None) if field is not None: args["push_default_route"] = field + else: + args["push_default_route"] = False field = data.get("push_dns_server", None) if field is not None: args["push_dns_server"] = field + else: + args["push_dns_server"] = False field = data.get("dns_servers_override", None) if field is not None: args["dns_servers_override"] = field + else: + args["dns_servers_override"] = field(default_factory=list) field = data.get("dns_search", None) if field is not None: args["dns_search"] = field + else: + args["dns_search"] = field(default_factory=list) field = data.get("dns_local_name", None) if field is not None: args["dns_local_name"] = field + else: + args["dns_local_name"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("valid_lifetime", None) if field is not None: @@ -157,10 +189,14 @@ def unmarshal_IpamConfig(data: Any) -> IpamConfig: field = data.get("push_default_route", None) if field is not None: args["push_default_route"] = field + else: + args["push_default_route"] = False field = data.get("ipam_ip_id", None) if field is not None: args["ipam_ip_id"] = field + else: + args["ipam_ip_id"] = None return IpamConfig(**args) @@ -176,14 +212,20 @@ def unmarshal_GatewayNetwork(data: Any) -> GatewayNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("gateway_id", None) if field is not None: args["gateway_id"] = field + else: + args["gateway_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("created_at", None) if field is not None: @@ -206,18 +248,26 @@ def unmarshal_GatewayNetwork(data: Any) -> GatewayNetwork: field = data.get("enable_masquerade", None) if field is not None: args["enable_masquerade"] = field + else: + args["enable_masquerade"] = False field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = GatewayNetworkStatus.UNKNOWN field = data.get("enable_dhcp", None) if field is not None: args["enable_dhcp"] = field + else: + args["enable_dhcp"] = False field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("dhcp", None) if field is not None: @@ -251,26 +301,38 @@ def unmarshal_IP(data: Any) -> IP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -310,30 +372,44 @@ def unmarshal_DHCPEntry(data: Any) -> DHCPEntry: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("gateway_network_id", None) if field is not None: args["gateway_network_id"] = field + else: + args["gateway_network_id"] = None field = data.get("mac_address", None) if field is not None: args["mac_address"] = field + else: + args["mac_address"] = None field = data.get("ip_address", None) if field is not None: args["ip_address"] = field + else: + args["ip_address"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = DHCPEntryType.UNKNOWN field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -361,14 +437,20 @@ def unmarshal_GatewayType(data: Any) -> GatewayType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("bandwidth", None) if field is not None: args["bandwidth"] = field + else: + args["bandwidth"] = 0 field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return GatewayType(**args) @@ -384,14 +466,20 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("created_at", None) if field is not None: @@ -414,28 +502,40 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = GatewayStatus.UNKNOWN field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("gateway_networks", None) if field is not None: args["gateway_networks"] = ( [unmarshal_GatewayNetwork(v) for v in field] if field is not None else None ) + else: + args["gateway_networks"] = field(default_factory=list) field = data.get("upstream_dns_servers", None) if field is not None: args["upstream_dns_servers"] = field + else: + args["upstream_dns_servers"] = field(default_factory=list) field = data.get("bastion_enabled", None) if field is not None: args["bastion_enabled"] = field + else: + args["bastion_enabled"] = False field = data.get("ip", None) if field is not None: @@ -458,22 +558,32 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("bastion_port", None) if field is not None: args["bastion_port"] = field + else: + args["bastion_port"] = 0 field = data.get("smtp_enabled", None) if field is not None: args["smtp_enabled"] = field + else: + args["smtp_enabled"] = False field = data.get("is_legacy", None) if field is not None: args["is_legacy"] = field + else: + args["is_legacy"] = False field = data.get("ip_mobility_enabled", None) if field is not None: args["ip_mobility_enabled"] = field + else: + args["ip_mobility_enabled"] = False field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return Gateway(**args) @@ -489,30 +599,44 @@ def unmarshal_PATRule(data: Any) -> PATRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("gateway_id", None) if field is not None: args["gateway_id"] = field + else: + args["gateway_id"] = None field = data.get("public_port", None) if field is not None: args["public_port"] = field + else: + args["public_port"] = 0 field = data.get("private_ip", None) if field is not None: args["private_ip"] = field + else: + args["private_ip"] = None field = data.get("private_port", None) if field is not None: args["private_port"] = field + else: + args["private_port"] = 0 field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = PATRuleProtocol.UNKNOWN field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -542,10 +666,14 @@ def unmarshal_ListDHCPEntriesResponse(data: Any) -> ListDHCPEntriesResponse: args["dhcp_entries"] = ( [unmarshal_DHCPEntry(v) for v in field] if field is not None else None ) + else: + args["dhcp_entries"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDHCPEntriesResponse(**args) @@ -563,10 +691,14 @@ def unmarshal_ListDHCPsResponse(data: Any) -> ListDHCPsResponse: args["dhcps"] = ( [unmarshal_DHCP(v) for v in field] if field is not None else None ) + else: + args["dhcps"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDHCPsResponse(**args) @@ -584,10 +716,14 @@ def unmarshal_ListGatewayNetworksResponse(data: Any) -> ListGatewayNetworksRespo args["gateway_networks"] = ( [unmarshal_GatewayNetwork(v) for v in field] if field is not None else None ) + else: + args["gateway_networks"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListGatewayNetworksResponse(**args) @@ -605,6 +741,8 @@ def unmarshal_ListGatewayTypesResponse(data: Any) -> ListGatewayTypesResponse: args["types"] = ( [unmarshal_GatewayType(v) for v in field] if field is not None else None ) + else: + args["types"] = field(default_factory=list) return ListGatewayTypesResponse(**args) @@ -622,10 +760,14 @@ def unmarshal_ListGatewaysResponse(data: Any) -> ListGatewaysResponse: args["gateways"] = ( [unmarshal_Gateway(v) for v in field] if field is not None else None ) + else: + args["gateways"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListGatewaysResponse(**args) @@ -641,10 +783,14 @@ def unmarshal_ListIPsResponse(data: Any) -> ListIPsResponse: field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_IP(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListIPsResponse(**args) @@ -662,10 +808,14 @@ def unmarshal_ListPATRulesResponse(data: Any) -> ListPATRulesResponse: args["pat_rules"] = ( [unmarshal_PATRule(v) for v in field] if field is not None else None ) + else: + args["pat_rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPATRulesResponse(**args) @@ -683,6 +833,8 @@ def unmarshal_SetDHCPEntriesResponse(data: Any) -> SetDHCPEntriesResponse: args["dhcp_entries"] = ( [unmarshal_DHCPEntry(v) for v in field] if field is not None else None ) + else: + args["dhcp_entries"] = field(default_factory=list) return SetDHCPEntriesResponse(**args) @@ -700,6 +852,8 @@ def unmarshal_SetPATRulesResponse(data: Any) -> SetPATRulesResponse: args["pat_rules"] = ( [unmarshal_PATRule(v) for v in field] if field is not None else None ) + else: + args["pat_rules"] = field(default_factory=list) return SetPATRulesResponse(**args) @@ -714,7 +868,9 @@ def marshal_CreateDHCPRequest( output["subnet"] = request.subnet if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.address is not None: output["address"] = request.address @@ -847,7 +1003,9 @@ def marshal_CreateGatewayRequest( output["enable_bastion"] = request.enable_bastion if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -874,7 +1032,9 @@ def marshal_CreateIPRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -901,7 +1061,7 @@ def marshal_CreatePATRuleRequest( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output @@ -955,7 +1115,7 @@ def marshal_SetPATRulesRequestRule( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output @@ -1145,7 +1305,7 @@ def marshal_UpdatePATRuleRequest( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output diff --git a/scaleway-async/scaleway_async/vpcgw/v1/types.py b/scaleway-async/scaleway_async/vpcgw/v1/types.py index bb1c21bdc..f04583d95 100644 --- a/scaleway-async/scaleway_async/vpcgw/v1/types.py +++ b/scaleway-async/scaleway_async/vpcgw/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -163,16 +163,6 @@ class DHCP: Low IP (inclusive) of the dynamic address pool. Must be in the config's subnet. """ - created_at: Optional[datetime] - """ - Date the DHCP configuration was created. - """ - - updated_at: Optional[datetime] - """ - Configuration last modification date. - """ - pool_high: str """ High IP (inclusive) of the dynamic address pool. Must be in the config's subnet. @@ -213,17 +203,27 @@ class DHCP: Zone of this DHCP configuration. """ - valid_lifetime: Optional[str] + created_at: Optional[datetime] = None + """ + Date the DHCP configuration was created. + """ + + updated_at: Optional[datetime] = None + """ + Configuration last modification date. + """ + + valid_lifetime: Optional[str] = None """ How long DHCP entries will be valid for. """ - renew_timer: Optional[str] + renew_timer: Optional[str] = None """ After how long a renew will be attempted. Must be 30s lower than `rebind_timer`. """ - rebind_timer: Optional[str] + rebind_timer: Optional[str] = None """ After how long a DHCP client will query for a new lease if previous renews fail. Must be 30s lower than `valid_lifetime`. """ @@ -259,52 +259,52 @@ class GatewayNetwork: ID of the connected Private Network. """ - created_at: Optional[datetime] + enable_masquerade: bool """ - Connection creation date. + Defines whether the gateway masquerades traffic for this Private Network (Dynamic NAT). """ - updated_at: Optional[datetime] + status: GatewayNetworkStatus """ - Connection last modification date. + Current status of the Public Gateway's connection to the Private Network. """ - mac_address: Optional[str] + enable_dhcp: bool """ - MAC address of the gateway in the Private Network (if the gateway is up and running). + Defines whether DHCP is enabled on the connected Private Network. """ - enable_masquerade: bool + zone: ScwZone """ - Defines whether the gateway masquerades traffic for this Private Network (Dynamic NAT). + Zone of the GatewayNetwork connection. """ - status: GatewayNetworkStatus + created_at: Optional[datetime] = None """ - Current status of the Public Gateway's connection to the Private Network. + Connection creation date. """ - enable_dhcp: bool + updated_at: Optional[datetime] = None """ - Defines whether DHCP is enabled on the connected Private Network. + Connection last modification date. """ - zone: ScwZone + mac_address: Optional[str] = None """ - Zone of the GatewayNetwork connection. + MAC address of the gateway in the Private Network (if the gateway is up and running). """ - dhcp: Optional[DHCP] + dhcp: Optional[DHCP] = None """ DHCP configuration for the connected Private Network. """ - address: Optional[str] + address: Optional[str] = None """ Address of the Gateway (in CIDR form) to use when DHCP is not used. """ - ipam_config: Optional[IpamConfig] + ipam_config: Optional[IpamConfig] = None """ IPAM IP configuration used. """ @@ -360,22 +360,22 @@ class IP: Zone of the IP address. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ IP address creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ IP address last modification date. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse domain name for the IP address. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Public Gateway associated with the IP address. """ @@ -388,72 +388,72 @@ class CreateDHCPRequest: Subnet for the DHCP server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project to create the DHCP configuration in. """ - address: Optional[str] + address: Optional[str] = None """ IP address of the DHCP server. This will be the gateway's address in the Private Network. Defaults to the first address of the subnet. """ - pool_low: Optional[str] + pool_low: Optional[str] = None """ Low IP (inclusive) of the dynamic address pool. Must be in the config's subnet. Defaults to the second address of the subnet. """ - pool_high: Optional[str] + pool_high: Optional[str] = None """ High IP (inclusive) of the dynamic address pool. Must be in the config's subnet. Defaults to the last address of the subnet. """ - enable_dynamic: Optional[bool] + enable_dynamic: Optional[bool] = False """ Defines whether to enable dynamic pooling of IPs. When false, only pre-existing DHCP reservations will be handed out. Defaults to true. """ - valid_lifetime: Optional[str] + valid_lifetime: Optional[str] = None """ How long DHCP entries will be valid for. Defaults to 1h (3600s). """ - renew_timer: Optional[str] + renew_timer: Optional[str] = None """ After how long a renew will be attempted. Must be 30s lower than `rebind_timer`. Defaults to 50m (3000s). """ - rebind_timer: Optional[str] + rebind_timer: Optional[str] = None """ After how long a DHCP client will query for a new lease if previous renews fail. Must be 30s lower than `valid_lifetime`. Defaults to 51m (3060s). """ - push_default_route: Optional[bool] + push_default_route: Optional[bool] = False """ Defines whether the gateway should push a default route to DHCP clients or only hand out IPs. Defaults to true. """ - push_dns_server: Optional[bool] + push_dns_server: Optional[bool] = False """ Defines whether the gateway should push custom DNS servers to clients. This allows for Instance hostname -> IP resolution. Defaults to true. """ - dns_servers_override: Optional[List[str]] + dns_servers_override: Optional[List[str]] = field(default_factory=list) """ Array of DNS server IP addresses used to override the DNS server list pushed to DHCP clients, instead of the gateway itself. """ - dns_search: Optional[List[str]] + dns_search: Optional[List[str]] = field(default_factory=list) """ Array of search paths in addition to the pushed DNS configuration. """ - dns_local_name: Optional[str] + dns_local_name: Optional[str] = None """ TLD given to hostnames in the Private Network. Allowed characters are `a-z0-9-.`. Defaults to the slugified Private Network name if created along a GatewayNetwork, or else to `priv`. """ @@ -466,7 +466,7 @@ class CreateGatewayNetworkRequestIpamConfig: Enabling the default route also enables masquerading. """ - ipam_ip_id: Optional[str] + ipam_ip_id: Optional[str] = None """ Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. """ @@ -509,12 +509,12 @@ class DHCPEntry: Zone of this DHCP entry. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ DHCP entry creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ DHCP entry last modification date. """ @@ -537,21 +537,6 @@ class Gateway: Owning Project. """ - created_at: Optional[datetime] - """ - Gateway creation date. - """ - - updated_at: Optional[datetime] - """ - Gateway last modification date. - """ - - type_: Optional[GatewayType] - """ - Gateway type (commercial offer). - """ - status: GatewayStatus """ Current status of the gateway. @@ -582,21 +567,6 @@ class Gateway: Defines whether SSH bastion is enabled on the gateway. """ - ip: Optional[IP] - """ - Public IP address of the gateway. - """ - - version: Optional[str] - """ - Version of the running gateway software. - """ - - can_upgrade_to: Optional[str] - """ - Newly available gateway software version that can be updated to. - """ - bastion_port: int """ Port of the SSH bastion. @@ -622,6 +592,36 @@ class Gateway: Zone of the gateway. """ + created_at: Optional[datetime] = None + """ + Gateway creation date. + """ + + updated_at: Optional[datetime] = None + """ + Gateway last modification date. + """ + + type_: Optional[GatewayType] = None + """ + Gateway type (commercial offer). + """ + + ip: Optional[IP] = None + """ + Public IP address of the gateway. + """ + + version: Optional[str] = None + """ + Version of the running gateway software. + """ + + can_upgrade_to: Optional[str] = None + """ + Newly available gateway software version that can be updated to. + """ + @dataclass class PATRule: @@ -660,12 +660,12 @@ class PATRule: Zone of the PAT rule. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ PAT rule creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ PAT rule last modification date. """ @@ -709,12 +709,12 @@ class SetPATRulesRequestRule: @dataclass class UpdateGatewayNetworkRequestIpamConfig: - push_default_route: Optional[bool] + push_default_route: Optional[bool] = False """ Enabling the default route also enables masquerading. """ - ipam_ip_id: Optional[str] + ipam_ip_id: Optional[str] = None """ Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. """ @@ -737,7 +737,7 @@ class CreateDHCPEntryRequest: IP address to give to the device. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -760,24 +760,24 @@ class CreateGatewayNetworkRequest: Note: this setting is ignored when passing `ipam_config`. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - enable_dhcp: Optional[bool] + enable_dhcp: Optional[bool] = False """ Defaults to `true` if either `dhcp_id` or `dhcp` are present. If set to `true`, either `dhcp_id` or `dhcp` must be present. Note: this setting is ignored when passing `ipam_config`. """ - dhcp_id: Optional[str] + dhcp_id: Optional[str] = None - dhcp: Optional[CreateDHCPRequest] + dhcp: Optional[CreateDHCPRequest] = None - address: Optional[str] + address: Optional[str] = None - ipam_config: Optional[CreateGatewayNetworkRequestIpamConfig] + ipam_config: Optional[CreateGatewayNetworkRequestIpamConfig] = None @dataclass @@ -797,37 +797,37 @@ class CreateGatewayRequest: Defines whether SSH bastion should be enabled the gateway. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Scaleway Project to create the gateway in. """ - name: Optional[str] + name: Optional[str] = None """ Name for the gateway. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the gateway. """ - upstream_dns_servers: Optional[List[str]] + upstream_dns_servers: Optional[List[str]] = field(default_factory=list) """ Array of DNS server IP addresses to override the gateway's default recursive DNS servers. """ - ip_id: Optional[str] + ip_id: Optional[str] = None """ Existing IP address to attach to the gateway. """ - bastion_port: Optional[int] + bastion_port: Optional[int] = 0 """ Port of the SSH bastion. """ @@ -835,17 +835,17 @@ class CreateGatewayRequest: @dataclass class CreateIPRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project to create the IP address in. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to give to the IP address. """ @@ -873,12 +873,12 @@ class CreatePATRuleRequest: Private port to translate to. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - protocol: Optional[PATRuleProtocol] + protocol: Optional[PATRuleProtocol] = PATRuleProtocol.UNKNOWN """ Protocol the rule should apply to. """ @@ -891,7 +891,7 @@ class DeleteDHCPEntryRequest: ID of the DHCP entry to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -904,7 +904,7 @@ class DeleteDHCPRequest: DHCP configuration ID to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -922,7 +922,7 @@ class DeleteGatewayNetworkRequest: Defines whether to clean up attached DHCP configurations (if any, and if not attached to another Gateway Network). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -940,7 +940,7 @@ class DeleteGatewayRequest: Defines whether to clean up attached DHCP configurations (if any, and if not attached to another Gateway Network). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -953,7 +953,7 @@ class DeleteIPRequest: ID of the IP address to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -966,7 +966,7 @@ class DeletePATRuleRequest: ID of the PAT rule to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -979,7 +979,7 @@ class EnableIPMobilityRequest: ID of the gateway to upgrade to IP mobility. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -992,7 +992,7 @@ class GetDHCPEntryRequest: ID of the DHCP entry to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1005,7 +1005,7 @@ class GetDHCPRequest: ID of the DHCP configuration to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1018,7 +1018,7 @@ class GetGatewayNetworkRequest: ID of the GatewayNetwork to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1031,7 +1031,7 @@ class GetGatewayRequest: ID of the gateway to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1044,7 +1044,7 @@ class GetIPRequest: ID of the IP address to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1057,7 +1057,7 @@ class GetPATRuleRequest: ID of the PAT rule to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1065,47 +1065,49 @@ class GetPATRuleRequest: @dataclass class ListDHCPEntriesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListDHCPEntriesRequestOrderBy] + order_by: Optional[ListDHCPEntriesRequestOrderBy] = ( + ListDHCPEntriesRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ DHCP entries per page. """ - gateway_network_id: Optional[str] + gateway_network_id: Optional[str] = None """ Filter for entries on this GatewayNetwork. """ - mac_address: Optional[str] + mac_address: Optional[str] = None """ Filter for entries with this MAC address. """ - ip_address: Optional[str] + ip_address: Optional[str] = None """ Filter for entries with this IP address. """ - hostname: Optional[str] + hostname: Optional[str] = None """ Filter for entries with this hostname substring. """ - type_: Optional[DHCPEntryType] + type_: Optional[DHCPEntryType] = DHCPEntryType.UNKNOWN """ Filter for entries of this type. """ @@ -1126,42 +1128,42 @@ class ListDHCPEntriesResponse: @dataclass class ListDHCPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListDHCPsRequestOrderBy] + order_by: Optional[ListDHCPsRequestOrderBy] = ListDHCPsRequestOrderBy.CREATED_AT_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ DHCP configurations per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Include only DHCP configuration objects in this Organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only DHCP configuration objects in this Project. """ - address: Optional[str] + address: Optional[str] = None """ Filter for DHCP configuration objects with this DHCP server IP address (the gateway's address in the Private Network). """ - has_address: Optional[str] + has_address: Optional[str] = None """ Filter for DHCP configuration objects with subnets containing this IP address. """ @@ -1182,47 +1184,49 @@ class ListDHCPsResponse: @dataclass class ListGatewayNetworksRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListGatewayNetworksRequestOrderBy] + order_by: Optional[ListGatewayNetworksRequestOrderBy] = ( + ListGatewayNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ GatewayNetworks per page. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Filter for GatewayNetworks connected to this gateway. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Filter for GatewayNetworks connected to this Private Network. """ - enable_masquerade: Optional[bool] + enable_masquerade: Optional[bool] = False """ Filter for GatewayNetworks with this `enable_masquerade` setting. """ - dhcp_id: Optional[str] + dhcp_id: Optional[str] = None """ Filter for GatewayNetworks using this DHCP configuration. """ - status: Optional[GatewayNetworkStatus] + status: Optional[GatewayNetworkStatus] = GatewayNetworkStatus.UNKNOWN """ Filter for GatewayNetworks with this current status this status. Use `unknown` to include all statuses. """ @@ -1243,7 +1247,7 @@ class ListGatewayNetworksResponse: @dataclass class ListGatewayTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1259,57 +1263,59 @@ class ListGatewayTypesResponse: @dataclass class ListGatewaysRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListGatewaysRequestOrderBy] + order_by: Optional[ListGatewaysRequestOrderBy] = ( + ListGatewaysRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Gateways per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Include only gateways in this Organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only gateways in this Project. """ - name: Optional[str] + name: Optional[str] = None """ Filter for gateways which have this search term in their name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter for gateways with these tags. """ - type_: Optional[str] + type_: Optional[str] = None """ Filter for gateways of this type. """ - status: Optional[GatewayStatus] + status: Optional[GatewayStatus] = GatewayStatus.UNKNOWN """ Filter for gateways with this current status. Use `unknown` to include all statuses. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Filter for gateways attached to this Private nNetwork. """ @@ -1330,47 +1336,47 @@ class ListGatewaysResponse: @dataclass class ListIPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListIPsRequestOrderBy] + order_by: Optional[ListIPsRequestOrderBy] = ListIPsRequestOrderBy.CREATED_AT_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ IP addresses per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter for IP addresses in this Organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter for IP addresses in this Project. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter for IP addresses with these tags. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Filter for IP addresses that have a reverse containing this string. """ - is_free: Optional[bool] + is_free: Optional[bool] = False """ Filter based on whether the IP is attached to a gateway or not. """ @@ -1391,37 +1397,39 @@ class ListIPsResponse: @dataclass class ListPATRulesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListPATRulesRequestOrderBy] + order_by: Optional[ListPATRulesRequestOrderBy] = ( + ListPATRulesRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ PAT rules per page. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Filter for PAT rules on this Gateway. """ - private_ip: Optional[str] + private_ip: Optional[str] = None """ Filter for PAT rules targeting this private ip. """ - protocol: Optional[PATRuleProtocol] + protocol: Optional[PATRuleProtocol] = PATRuleProtocol.UNKNOWN """ Filter for PAT rules with this protocol. """ @@ -1447,7 +1455,7 @@ class MigrateToV2Request: ID of the gateway to put into IPAM mode. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1460,7 +1468,7 @@ class RefreshSSHKeysRequest: ID of the gateway to refresh SSH keys on. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1473,12 +1481,14 @@ class SetDHCPEntriesRequest: ID of the Gateway Network on which to set DHCP reservation list. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - dhcp_entries: Optional[List[SetDHCPEntriesRequestEntry]] + dhcp_entries: Optional[List[SetDHCPEntriesRequestEntry]] = field( + default_factory=list + ) """ New list of DHCP reservations. """ @@ -1504,7 +1514,7 @@ class SetPATRulesRequest: New list of PAT rules. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1525,12 +1535,12 @@ class UpdateDHCPEntryRequest: ID of the DHCP entry to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ip_address: Optional[str] + ip_address: Optional[str] = None """ New IP address to give to the device. """ @@ -1543,72 +1553,72 @@ class UpdateDHCPRequest: DHCP configuration to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - subnet: Optional[str] + subnet: Optional[str] = None """ Subnet for the DHCP server. """ - address: Optional[str] + address: Optional[str] = None """ IP address of the DHCP server. This will be the Public Gateway's address in the Private Network. It must be part of config's subnet. """ - pool_low: Optional[str] + pool_low: Optional[str] = None """ Low IP (inclusive) of the dynamic address pool. Must be in the config's subnet. """ - pool_high: Optional[str] + pool_high: Optional[str] = None """ High IP (inclusive) of the dynamic address pool. Must be in the config's subnet. """ - enable_dynamic: Optional[bool] + enable_dynamic: Optional[bool] = False """ Defines whether to enable dynamic pooling of IPs. When false, only pre-existing DHCP reservations will be handed out. Defaults to true. """ - valid_lifetime: Optional[str] + valid_lifetime: Optional[str] = None """ How long DHCP entries will be valid for. """ - renew_timer: Optional[str] + renew_timer: Optional[str] = None """ After how long a renew will be attempted. Must be 30s lower than `rebind_timer`. """ - rebind_timer: Optional[str] + rebind_timer: Optional[str] = None """ After how long a DHCP client will query for a new lease if previous renews fail. Must be 30s lower than `valid_lifetime`. """ - push_default_route: Optional[bool] + push_default_route: Optional[bool] = False """ Defines whether the gateway should push a default route to DHCP clients, or only hand out IPs. """ - push_dns_server: Optional[bool] + push_dns_server: Optional[bool] = False """ Defines whether the gateway should push custom DNS servers to clients. This allows for instance hostname -> IP resolution. """ - dns_servers_override: Optional[List[str]] + dns_servers_override: Optional[List[str]] = field(default_factory=list) """ Array of DNS server IP addresses used to override the DNS server list pushed to DHCP clients, instead of the gateway itself. """ - dns_search: Optional[List[str]] + dns_search: Optional[List[str]] = field(default_factory=list) """ Array of search paths in addition to the pushed DNS configuration. """ - dns_local_name: Optional[str] + dns_local_name: Optional[str] = None """ TLD given to hostnames in the Private Networks. If an instance with hostname `foo` gets a lease, and this is set to `bar`, `foo.bar` will resolve. Allowed characters are `a-z0-9-.`. """ @@ -1621,27 +1631,27 @@ class UpdateGatewayNetworkRequest: ID of the GatewayNetwork to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - enable_masquerade: Optional[bool] + enable_masquerade: Optional[bool] = False """ Note: this setting is ignored when passing `ipam_config`. """ - enable_dhcp: Optional[bool] + enable_dhcp: Optional[bool] = False """ Defaults to `true` if `dhcp_id` is present. If set to `true`, `dhcp_id` must be present. Note: this setting is ignored when passing `ipam_config`. """ - dhcp_id: Optional[str] + dhcp_id: Optional[str] = None - address: Optional[str] + address: Optional[str] = None - ipam_config: Optional[UpdateGatewayNetworkRequestIpamConfig] + ipam_config: Optional[UpdateGatewayNetworkRequestIpamConfig] = None @dataclass @@ -1651,37 +1661,37 @@ class UpdateGatewayRequest: ID of the gateway to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the gateway. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the gateway. """ - upstream_dns_servers: Optional[List[str]] + upstream_dns_servers: Optional[List[str]] = field(default_factory=list) """ Array of DNS server IP addresses to override the gateway's default recursive DNS servers. """ - enable_bastion: Optional[bool] + enable_bastion: Optional[bool] = False """ Defines whether SSH bastion should be enabled the gateway. """ - bastion_port: Optional[int] + bastion_port: Optional[int] = 0 """ Port of the SSH bastion. """ - enable_smtp: Optional[bool] + enable_smtp: Optional[bool] = False """ Defines whether SMTP traffic should be allowed to pass through the gateway. """ @@ -1694,22 +1704,22 @@ class UpdateIPRequest: ID of the IP address to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to give to the IP address. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse to set on the address. Empty string to unset. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Gateway to attach the IP address to. Empty string to detach. """ @@ -1722,27 +1732,27 @@ class UpdatePATRuleRequest: ID of the PAT rule to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - public_port: Optional[int] + public_port: Optional[int] = 0 """ Public port to listen on. """ - private_ip: Optional[str] + private_ip: Optional[str] = None """ Private IP to forward data to. """ - private_port: Optional[int] + private_port: Optional[int] = 0 """ Private port to translate to. """ - protocol: Optional[PATRuleProtocol] + protocol: Optional[PATRuleProtocol] = PATRuleProtocol.UNKNOWN """ Protocol the rule should apply to. """ @@ -1755,12 +1765,12 @@ class UpgradeGatewayRequest: ID of the gateway to upgrade. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - type_: Optional[str] + type_: Optional[str] = None """ Gateway type (commercial offer). """ diff --git a/scaleway-async/scaleway_async/vpcgw/v2/marshalling.py b/scaleway-async/scaleway_async/vpcgw/v2/marshalling.py index 2c01ee753..93a7820f4 100644 --- a/scaleway-async/scaleway_async/vpcgw/v2/marshalling.py +++ b/scaleway-async/scaleway_async/vpcgw/v2/marshalling.py @@ -6,6 +6,9 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + GatewayNetworkStatus, + GatewayStatus, + PatRuleProtocol, GatewayNetwork, IP, Gateway, @@ -46,34 +49,50 @@ def unmarshal_GatewayNetwork(data: Any) -> GatewayNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("gateway_id", None) if field is not None: args["gateway_id"] = field + else: + args["gateway_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("masquerade_enabled", None) if field is not None: args["masquerade_enabled"] = field + else: + args["masquerade_enabled"] = False field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = GatewayNetworkStatus.UNKNOWN_STATUS field = data.get("push_default_route", None) if field is not None: args["push_default_route"] = field + else: + args["push_default_route"] = False field = data.get("ipam_ip_id", None) if field is not None: args["ipam_ip_id"] = field + else: + args["ipam_ip_id"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -107,26 +126,38 @@ def unmarshal_IP(data: Any) -> IP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -166,30 +197,44 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("bandwidth", None) if field is not None: args["bandwidth"] = field + else: + args["bandwidth"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = GatewayStatus.UNKNOWN_STATUS field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("created_at", None) if field is not None: @@ -206,16 +251,22 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("gateway_networks", None) if field is not None: args["gateway_networks"] = ( [unmarshal_GatewayNetwork(v) for v in field] if field is not None else None ) + else: + args["gateway_networks"] = field(default_factory=list) field = data.get("bastion_enabled", None) if field is not None: args["bastion_enabled"] = field + else: + args["bastion_enabled"] = False field = data.get("ipv4", None) if field is not None: @@ -238,22 +289,32 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("bastion_port", None) if field is not None: args["bastion_port"] = field + else: + args["bastion_port"] = 0 field = data.get("smtp_enabled", None) if field is not None: args["smtp_enabled"] = field + else: + args["smtp_enabled"] = False field = data.get("is_legacy", None) if field is not None: args["is_legacy"] = field + else: + args["is_legacy"] = False field = data.get("bastion_allowed_ips", None) if field is not None: args["bastion_allowed_ips"] = field + else: + args["bastion_allowed_ips"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return Gateway(**args) @@ -269,30 +330,44 @@ def unmarshal_PatRule(data: Any) -> PatRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("gateway_id", None) if field is not None: args["gateway_id"] = field + else: + args["gateway_id"] = None field = data.get("public_port", None) if field is not None: args["public_port"] = field + else: + args["public_port"] = 0 field = data.get("private_ip", None) if field is not None: args["private_ip"] = field + else: + args["private_ip"] = None field = data.get("private_port", None) if field is not None: args["private_port"] = field + else: + args["private_port"] = 0 field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = PatRuleProtocol.UNKNOWN_PROTOCOL field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -320,6 +395,8 @@ def unmarshal_AddBastionAllowedIPsResponse(data: Any) -> AddBastionAllowedIPsRes field = data.get("ip_ranges", None) if field is not None: args["ip_ranges"] = field + else: + args["ip_ranges"] = field(default_factory=list) return AddBastionAllowedIPsResponse(**args) @@ -337,10 +414,14 @@ def unmarshal_ListGatewayNetworksResponse(data: Any) -> ListGatewayNetworksRespo args["gateway_networks"] = ( [unmarshal_GatewayNetwork(v) for v in field] if field is not None else None ) + else: + args["gateway_networks"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListGatewayNetworksResponse(**args) @@ -356,14 +437,20 @@ def unmarshal_GatewayType(data: Any) -> GatewayType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("bandwidth", None) if field is not None: args["bandwidth"] = field + else: + args["bandwidth"] = 0 field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return GatewayType(**args) @@ -381,6 +468,8 @@ def unmarshal_ListGatewayTypesResponse(data: Any) -> ListGatewayTypesResponse: args["types"] = ( [unmarshal_GatewayType(v) for v in field] if field is not None else None ) + else: + args["types"] = field(default_factory=list) return ListGatewayTypesResponse(**args) @@ -398,10 +487,14 @@ def unmarshal_ListGatewaysResponse(data: Any) -> ListGatewaysResponse: args["gateways"] = ( [unmarshal_Gateway(v) for v in field] if field is not None else None ) + else: + args["gateways"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListGatewaysResponse(**args) @@ -417,10 +510,14 @@ def unmarshal_ListIPsResponse(data: Any) -> ListIPsResponse: field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_IP(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListIPsResponse(**args) @@ -438,10 +535,14 @@ def unmarshal_ListPatRulesResponse(data: Any) -> ListPatRulesResponse: args["pat_rules"] = ( [unmarshal_PatRule(v) for v in field] if field is not None else None ) + else: + args["pat_rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPatRulesResponse(**args) @@ -457,6 +558,8 @@ def unmarshal_SetBastionAllowedIPsResponse(data: Any) -> SetBastionAllowedIPsRes field = data.get("ip_ranges", None) if field is not None: args["ip_ranges"] = field + else: + args["ip_ranges"] = field(default_factory=list) return SetBastionAllowedIPsResponse(**args) @@ -474,6 +577,8 @@ def unmarshal_SetPatRulesResponse(data: Any) -> SetPatRulesResponse: args["pat_rules"] = ( [unmarshal_PatRule(v) for v in field] if field is not None else None ) + else: + args["pat_rules"] = field(default_factory=list) return SetPatRulesResponse(**args) @@ -530,7 +635,9 @@ def marshal_CreateGatewayRequest( output["enable_bastion"] = request.enable_bastion if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -554,7 +661,9 @@ def marshal_CreateIPRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -581,7 +690,7 @@ def marshal_CreatePatRuleRequest( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output @@ -614,7 +723,7 @@ def marshal_SetPatRulesRequestRule( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output @@ -712,7 +821,7 @@ def marshal_UpdatePatRuleRequest( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output diff --git a/scaleway-async/scaleway_async/vpcgw/v2/types.py b/scaleway-async/scaleway_async/vpcgw/v2/types.py index dfd76cccd..e00685d65 100644 --- a/scaleway-async/scaleway_async/vpcgw/v2/types.py +++ b/scaleway-async/scaleway_async/vpcgw/v2/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -140,17 +140,17 @@ class GatewayNetwork: Zone of the GatewayNetwork connection. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Connection creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Connection last modification date. """ - mac_address: Optional[str] + mac_address: Optional[str] = None """ MAC address of the gateway in the Private Network (if the gateway is up and running). """ @@ -188,22 +188,22 @@ class IP: Zone of the IP address. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ IP address creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ IP address last modification date. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse domain name for the IP address. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Public Gateway associated with the IP address. """ @@ -264,16 +264,6 @@ class Gateway: Name of the gateway. """ - created_at: Optional[datetime] - """ - Gateway creation date. - """ - - updated_at: Optional[datetime] - """ - Gateway last modification date. - """ - tags: List[str] """ Tags associated with the gateway. @@ -289,21 +279,6 @@ class Gateway: Defines whether SSH bastion is enabled on the gateway. """ - ipv4: Optional[IP] - """ - Public IPv4 address of the gateway. - """ - - version: Optional[str] - """ - Version of the running gateway software. - """ - - can_upgrade_to: Optional[str] - """ - Newly available gateway software version that can be updated to. - """ - bastion_port: int """ Port of the SSH bastion. @@ -329,6 +304,31 @@ class Gateway: Zone of the gateway. """ + created_at: Optional[datetime] = None + """ + Gateway creation date. + """ + + updated_at: Optional[datetime] = None + """ + Gateway last modification date. + """ + + ipv4: Optional[IP] = None + """ + Public IPv4 address of the gateway. + """ + + version: Optional[str] = None + """ + Version of the running gateway software. + """ + + can_upgrade_to: Optional[str] = None + """ + Newly available gateway software version that can be updated to. + """ + @dataclass class PatRule: @@ -367,12 +367,12 @@ class PatRule: Zone of the PAT rule. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ PAT rule creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ PAT rule last modification date. """ @@ -413,7 +413,7 @@ class AddBastionAllowedIPsRequest: IP range allowed to connect to the SSH bastion. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -449,12 +449,12 @@ class CreateGatewayNetworkRequest: Enabling the default route also enables masquerading. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ipam_ip_id: Optional[str] + ipam_ip_id: Optional[str] = None """ Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. """ @@ -477,32 +477,32 @@ class CreateGatewayRequest: Defines whether SSH bastion should be enabled the gateway. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Scaleway Project to create the gateway in. """ - name: Optional[str] + name: Optional[str] = None """ Name for the gateway. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the gateway. """ - ip_id: Optional[str] + ip_id: Optional[str] = None """ Existing IP address to attach to the gateway. """ - bastion_port: Optional[int] + bastion_port: Optional[int] = 0 """ Port of the SSH bastion. """ @@ -510,17 +510,17 @@ class CreateGatewayRequest: @dataclass class CreateIPRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project to create the IP address in. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to give to the IP address. """ @@ -548,12 +548,12 @@ class CreatePatRuleRequest: Private port to translate to. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - protocol: Optional[PatRuleProtocol] + protocol: Optional[PatRuleProtocol] = PatRuleProtocol.UNKNOWN_PROTOCOL """ Protocol the rule should apply to. """ @@ -571,7 +571,7 @@ class DeleteBastionAllowedIPsRequest: IP range to delete from SSH bastion's list of allowed IPs. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -584,7 +584,7 @@ class DeleteGatewayNetworkRequest: ID of the GatewayNetwork to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -602,7 +602,7 @@ class DeleteGatewayRequest: Defines whether the PGW's IP should be deleted. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -615,7 +615,7 @@ class DeleteIPRequest: ID of the IP address to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -628,7 +628,7 @@ class DeletePatRuleRequest: ID of the PAT rule to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -641,7 +641,7 @@ class GetGatewayNetworkRequest: ID of the GatewayNetwork to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -654,7 +654,7 @@ class GetGatewayRequest: ID of the gateway to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -667,7 +667,7 @@ class GetIPRequest: ID of the IP address to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -680,7 +680,7 @@ class GetPatRuleRequest: ID of the PAT rule to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -688,42 +688,44 @@ class GetPatRuleRequest: @dataclass class ListGatewayNetworksRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListGatewayNetworksRequestOrderBy] + order_by: Optional[ListGatewayNetworksRequestOrderBy] = ( + ListGatewayNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ GatewayNetworks per page. """ - status: Optional[List[GatewayNetworkStatus]] + status: Optional[List[GatewayNetworkStatus]] = field(default_factory=list) """ Filter for GatewayNetworks with these status. Use `unknown` to include all statuses. """ - gateway_ids: Optional[List[str]] + gateway_ids: Optional[List[str]] = field(default_factory=list) """ Filter for GatewayNetworks connected to these gateways. """ - private_network_ids: Optional[List[str]] + private_network_ids: Optional[List[str]] = field(default_factory=list) """ Filter for GatewayNetworks connected to these Private Networks. """ - masquerade_enabled: Optional[bool] + masquerade_enabled: Optional[bool] = False """ Filter for GatewayNetworks with this `enable_masquerade` setting. """ @@ -744,7 +746,7 @@ class ListGatewayNetworksResponse: @dataclass class ListGatewayTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -760,62 +762,64 @@ class ListGatewayTypesResponse: @dataclass class ListGatewaysRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListGatewaysRequestOrderBy] + order_by: Optional[ListGatewaysRequestOrderBy] = ( + ListGatewaysRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Gateways per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Include only gateways in this Organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only gateways in this Project. """ - name: Optional[str] + name: Optional[str] = None """ Filter for gateways which have this search term in their name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter for gateways with these tags. """ - types: Optional[List[str]] + types: Optional[List[str]] = field(default_factory=list) """ Filter for gateways of these types. """ - status: Optional[List[GatewayStatus]] + status: Optional[List[GatewayStatus]] = field(default_factory=list) """ Filter for gateways with these status. Use `unknown` to include all statuses. """ - private_network_ids: Optional[List[str]] + private_network_ids: Optional[List[str]] = field(default_factory=list) """ Filter for gateways attached to these Private Networks. """ - include_legacy: Optional[bool] + include_legacy: Optional[bool] = False """ Include also legacy gateways. """ @@ -836,47 +840,47 @@ class ListGatewaysResponse: @dataclass class ListIPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListIPsRequestOrderBy] + order_by: Optional[ListIPsRequestOrderBy] = ListIPsRequestOrderBy.CREATED_AT_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ IP addresses per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Include only gateways in this Organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter for IP addresses in this Project. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter for IP addresses with these tags. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Filter for IP addresses that have a reverse containing this string. """ - is_free: Optional[bool] + is_free: Optional[bool] = False """ Filter based on whether the IP is attached to a gateway or not. """ @@ -897,37 +901,39 @@ class ListIPsResponse: @dataclass class ListPatRulesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListPatRulesRequestOrderBy] + order_by: Optional[ListPatRulesRequestOrderBy] = ( + ListPatRulesRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ PAT rules per page. """ - gateway_ids: Optional[List[str]] + gateway_ids: Optional[List[str]] = field(default_factory=list) """ Filter for PAT rules on these gateways. """ - private_ips: Optional[List[str]] + private_ips: Optional[List[str]] = field(default_factory=list) """ Filter for PAT rules targeting these private ips. """ - protocol: Optional[PatRuleProtocol] + protocol: Optional[PatRuleProtocol] = PatRuleProtocol.UNKNOWN_PROTOCOL """ Filter for PAT rules with this protocol. """ @@ -953,7 +959,7 @@ class RefreshSSHKeysRequest: ID of the gateway to refresh SSH keys on. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -966,12 +972,12 @@ class SetBastionAllowedIPsRequest: ID of the gateway on which to set the allowed IP range. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ip_ranges: Optional[List[str]] + ip_ranges: Optional[List[str]] = field(default_factory=list) """ New list of IP ranges (each range in CIDR notation) allowed to connect to the SSH bastion. """ @@ -997,7 +1003,7 @@ class SetPatRulesRequest: New list of PAT rules. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1018,22 +1024,22 @@ class UpdateGatewayNetworkRequest: ID of the GatewayNetwork to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - enable_masquerade: Optional[bool] + enable_masquerade: Optional[bool] = False """ Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork. """ - push_default_route: Optional[bool] + push_default_route: Optional[bool] = False """ Enabling the default route also enables masquerading. """ - ipam_ip_id: Optional[str] + ipam_ip_id: Optional[str] = None """ Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. """ @@ -1046,32 +1052,32 @@ class UpdateGatewayRequest: ID of the gateway to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the gateway. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the gateway. """ - enable_bastion: Optional[bool] + enable_bastion: Optional[bool] = False """ Defines whether SSH bastion should be enabled the gateway. """ - bastion_port: Optional[int] + bastion_port: Optional[int] = 0 """ Port of the SSH bastion. """ - enable_smtp: Optional[bool] + enable_smtp: Optional[bool] = False """ Defines whether SMTP traffic should be allowed to pass through the gateway. """ @@ -1084,22 +1090,22 @@ class UpdateIPRequest: ID of the IP address to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to give to the IP address. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse to set on the address. Empty string to unset. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Gateway to attach the IP address to. Empty string to detach. """ @@ -1112,27 +1118,27 @@ class UpdatePatRuleRequest: ID of the PAT rule to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - public_port: Optional[int] + public_port: Optional[int] = 0 """ Public port to listen on. """ - private_ip: Optional[str] + private_ip: Optional[str] = None """ Private IP to forward data to. """ - private_port: Optional[int] + private_port: Optional[int] = 0 """ Private port to translate to. """ - protocol: Optional[PatRuleProtocol] + protocol: Optional[PatRuleProtocol] = PatRuleProtocol.UNKNOWN_PROTOCOL """ Protocol the rule should apply to. """ @@ -1145,12 +1151,12 @@ class UpgradeGatewayRequest: ID of the gateway to upgrade. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - type_: Optional[str] + type_: Optional[str] = None """ Gateway type (commercial offer). """ diff --git a/scaleway-async/scaleway_async/webhosting/v1/__init__.py b/scaleway-async/scaleway_async/webhosting/v1/__init__.py index 325d01061..93b525663 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/__init__.py +++ b/scaleway-async/scaleway_async/webhosting/v1/__init__.py @@ -1,5 +1,8 @@ # This file was automatically generated. DO NOT EDIT. # If you have any remark or suggestion do not hesitate to open an issue. +from .types import BackupItemType +from .types import BackupStatus +from .content import BACKUP_TRANSIENT_STATUSES from .types import DnsRecordStatus from .types import DnsRecordType from .types import DnsRecordsStatus @@ -13,6 +16,7 @@ from .types import DomainZoneOwner from .types import HostingStatus from .content import HOSTING_TRANSIENT_STATUSES +from .types import ListBackupsRequestOrderBy from .types import ListDatabaseUsersRequestOrderBy from .types import ListDatabasesRequestOrderBy from .types import ListFtpAccountsRequestOrderBy @@ -29,6 +33,7 @@ from .types import HostingDomainCustomDomain from .types import OfferOption from .types import PlatformControlPanel +from .types import BackupItem from .types import HostingDomain from .types import CreateDatabaseRequestUser from .types import CreateHostingRequestDomainConfiguration @@ -39,6 +44,8 @@ from .types import HostingUser from .types import Offer from .types import Platform +from .types import BackupItemGroup +from .types import Backup from .types import ControlPanel from .types import DatabaseUser from .types import Database @@ -47,6 +54,11 @@ from .types import MailAccount from .types import Website from .types import DomainAvailability +from .types import BackupApiGetBackupRequest +from .types import BackupApiListBackupItemsRequest +from .types import BackupApiListBackupsRequest +from .types import BackupApiRestoreBackupItemsRequest +from .types import BackupApiRestoreBackupRequest from .types import CheckUserOwnsDomainResponse from .types import ControlPanelApiListControlPanelsRequest from .types import DatabaseApiAssignDatabaseUserRequest @@ -80,6 +92,8 @@ from .types import HostingApiListHostingsRequest from .types import HostingApiResetHostingPasswordRequest from .types import HostingApiUpdateHostingRequest +from .types import ListBackupItemsResponse +from .types import ListBackupsResponse from .types import ListControlPanelsResponse from .types import ListDatabaseUsersResponse from .types import ListDatabasesResponse @@ -95,9 +109,12 @@ from .types import OfferApiListOffersRequest from .types import ResetHostingPasswordResponse from .types import ResourceSummary +from .types import RestoreBackupItemsResponse +from .types import RestoreBackupResponse from .types import SearchDomainsResponse from .types import Session from .types import WebsiteApiListWebsitesRequest +from .api import WebhostingV1BackupAPI from .api import WebhostingV1ControlPanelAPI from .api import WebhostingV1DatabaseAPI from .api import WebhostingV1DnsAPI @@ -108,6 +125,9 @@ from .api import WebhostingV1WebsiteAPI __all__ = [ + "BackupItemType", + "BackupStatus", + "BACKUP_TRANSIENT_STATUSES", "DnsRecordStatus", "DnsRecordType", "DnsRecordsStatus", @@ -121,6 +141,7 @@ "DomainZoneOwner", "HostingStatus", "HOSTING_TRANSIENT_STATUSES", + "ListBackupsRequestOrderBy", "ListDatabaseUsersRequestOrderBy", "ListDatabasesRequestOrderBy", "ListFtpAccountsRequestOrderBy", @@ -137,6 +158,7 @@ "HostingDomainCustomDomain", "OfferOption", "PlatformControlPanel", + "BackupItem", "HostingDomain", "CreateDatabaseRequestUser", "CreateHostingRequestDomainConfiguration", @@ -147,6 +169,8 @@ "HostingUser", "Offer", "Platform", + "BackupItemGroup", + "Backup", "ControlPanel", "DatabaseUser", "Database", @@ -155,6 +179,11 @@ "MailAccount", "Website", "DomainAvailability", + "BackupApiGetBackupRequest", + "BackupApiListBackupItemsRequest", + "BackupApiListBackupsRequest", + "BackupApiRestoreBackupItemsRequest", + "BackupApiRestoreBackupRequest", "CheckUserOwnsDomainResponse", "ControlPanelApiListControlPanelsRequest", "DatabaseApiAssignDatabaseUserRequest", @@ -188,6 +217,8 @@ "HostingApiListHostingsRequest", "HostingApiResetHostingPasswordRequest", "HostingApiUpdateHostingRequest", + "ListBackupItemsResponse", + "ListBackupsResponse", "ListControlPanelsResponse", "ListDatabaseUsersResponse", "ListDatabasesResponse", @@ -203,9 +234,12 @@ "OfferApiListOffersRequest", "ResetHostingPasswordResponse", "ResourceSummary", + "RestoreBackupItemsResponse", + "RestoreBackupResponse", "SearchDomainsResponse", "Session", "WebsiteApiListWebsitesRequest", + "WebhostingV1BackupAPI", "WebhostingV1ControlPanelAPI", "WebhostingV1DatabaseAPI", "WebhostingV1DnsAPI", diff --git a/scaleway-async/scaleway_async/webhosting/v1/api.py b/scaleway-async/scaleway_async/webhosting/v1/api.py index 212b454c9..3abdd7514 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/api.py +++ b/scaleway-async/scaleway_async/webhosting/v1/api.py @@ -15,6 +15,7 @@ ) from .types import ( HostingStatus, + ListBackupsRequestOrderBy, ListDatabaseUsersRequestOrderBy, ListDatabasesRequestOrderBy, ListFtpAccountsRequestOrderBy, @@ -23,6 +24,8 @@ ListOffersRequestOrderBy, ListWebsitesRequestOrderBy, AutoConfigDomainDns, + Backup, + BackupApiRestoreBackupItemsRequest, CheckUserOwnsDomainResponse, ControlPanel, CreateDatabaseRequestUser, @@ -45,6 +48,8 @@ HostingApiCreateHostingRequest, HostingApiUpdateHostingRequest, HostingSummary, + ListBackupItemsResponse, + ListBackupsResponse, ListControlPanelsResponse, ListDatabaseUsersResponse, ListDatabasesResponse, @@ -61,16 +66,20 @@ OfferOptionRequest, ResetHostingPasswordResponse, ResourceSummary, + RestoreBackupItemsResponse, + RestoreBackupResponse, SearchDomainsResponse, Session, SyncDomainDnsRecordsRequestRecord, Website, ) from .content import ( + BACKUP_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES, HOSTING_TRANSIENT_STATUSES, ) from .marshalling import ( + unmarshal_Backup, unmarshal_DatabaseUser, unmarshal_Database, unmarshal_FtpAccount, @@ -79,6 +88,8 @@ unmarshal_DnsRecords, unmarshal_Domain, unmarshal_Hosting, + unmarshal_ListBackupItemsResponse, + unmarshal_ListBackupsResponse, unmarshal_ListControlPanelsResponse, unmarshal_ListDatabaseUsersResponse, unmarshal_ListDatabasesResponse, @@ -89,8 +100,11 @@ unmarshal_ListWebsitesResponse, unmarshal_ResetHostingPasswordResponse, unmarshal_ResourceSummary, + unmarshal_RestoreBackupItemsResponse, + unmarshal_RestoreBackupResponse, unmarshal_SearchDomainsResponse, unmarshal_Session, + marshal_BackupApiRestoreBackupItemsRequest, marshal_DatabaseApiAssignDatabaseUserRequest, marshal_DatabaseApiChangeDatabaseUserPasswordRequest, marshal_DatabaseApiCreateDatabaseRequest, @@ -111,6 +125,292 @@ ) +class WebhostingV1BackupAPI(API): + """ + This API allows you to list and restore backups for your cPanel and WordPress Web Hosting service. + """ + + async def list_backups( + self, + *, + hosting_id: str, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListBackupsRequestOrderBy] = None, + ) -> ListBackupsResponse: + """ + List all available backups for a hosting account. + :param hosting_id: UUID of the hosting account. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Page number to retrieve. + :param page_size: Number of backups to return per page. + :param order_by: Order in which to return the list of backups. + :return: :class:`ListBackupsResponse ` + + Usage: + :: + + result = await api.list_backups( + hosting_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( + "GET", + f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/backups", + params={ + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListBackupsResponse(res.json()) + + async def list_backups_all( + self, + *, + hosting_id: str, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListBackupsRequestOrderBy] = None, + ) -> List[Backup]: + """ + List all available backups for a hosting account. + :param hosting_id: UUID of the hosting account. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Page number to retrieve. + :param page_size: Number of backups to return per page. + :param order_by: Order in which to return the list of backups. + :return: :class:`List[Backup] ` + + Usage: + :: + + result = await api.list_backups_all( + hosting_id="example", + ) + """ + + return await fetch_all_pages_async( + type=ListBackupsResponse, + key="backups", + fetcher=self.list_backups, + args={ + "hosting_id": hosting_id, + "region": region, + "page": page, + "page_size": page_size, + "order_by": order_by, + }, + ) + + async def get_backup( + self, + *, + hosting_id: str, + backup_id: str, + region: Optional[ScwRegion] = None, + ) -> Backup: + """ + Get info about a backup specified by the backup ID. + :param hosting_id: UUID of the hosting account. + :param backup_id: ID of the backup to retrieve. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`Backup ` + + Usage: + :: + + result = await api.get_backup( + hosting_id="example", + backup_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_hosting_id = validate_path_param("hosting_id", hosting_id) + param_backup_id = validate_path_param("backup_id", backup_id) + + res = self._request( + "GET", + f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/backups/{param_backup_id}", + ) + + self._throw_on_error(res) + return unmarshal_Backup(res.json()) + + async def wait_for_backup( + self, + *, + hosting_id: str, + backup_id: str, + region: Optional[ScwRegion] = None, + options: Optional[WaitForOptions[Backup, Union[bool, Awaitable[bool]]]] = None, + ) -> Backup: + """ + Get info about a backup specified by the backup ID. + :param hosting_id: UUID of the hosting account. + :param backup_id: ID of the backup to retrieve. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`Backup ` + + Usage: + :: + + result = await api.get_backup( + hosting_id="example", + backup_id="example", + ) + """ + + if not options: + options = WaitForOptions() + + if not options.stop: + options.stop = lambda res: res.status not in BACKUP_TRANSIENT_STATUSES + + return await wait_for_resource_async( + fetcher=self.get_backup, + options=options, + args={ + "hosting_id": hosting_id, + "backup_id": backup_id, + "region": region, + }, + ) + + async def restore_backup( + self, + *, + hosting_id: str, + backup_id: str, + region: Optional[ScwRegion] = None, + ) -> RestoreBackupResponse: + """ + Restore an entire backup to your hosting environment. + :param hosting_id: UUID of the hosting account. + :param backup_id: ID of the backup to fully restore. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`RestoreBackupResponse ` + + Usage: + :: + + result = await api.restore_backup( + hosting_id="example", + backup_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_hosting_id = validate_path_param("hosting_id", hosting_id) + param_backup_id = validate_path_param("backup_id", backup_id) + + res = self._request( + "POST", + f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/backups/{param_backup_id}/restore", + body={}, + ) + + self._throw_on_error(res) + return unmarshal_RestoreBackupResponse(res.json()) + + async def list_backup_items( + self, + *, + hosting_id: str, + backup_id: str, + region: Optional[ScwRegion] = None, + ) -> ListBackupItemsResponse: + """ + List items within a specific backup, grouped by type. + :param hosting_id: UUID of the hosting account. + :param backup_id: ID of the backup to list items from. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`ListBackupItemsResponse ` + + Usage: + :: + + result = await api.list_backup_items( + hosting_id="example", + backup_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( + "GET", + f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/backup-items", + params={ + "backup_id": backup_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListBackupItemsResponse(res.json()) + + async def restore_backup_items( + self, + *, + hosting_id: str, + region: Optional[ScwRegion] = None, + item_ids: Optional[List[str]] = None, + ) -> RestoreBackupItemsResponse: + """ + Restore specific items from a backup (e.g., a database or mailbox). + :param hosting_id: UUID of the hosting account. + :param region: Region to target. If none is passed will use default region from the config. + :param item_ids: List of backup item IDs to restore individually. + :return: :class:`RestoreBackupItemsResponse ` + + Usage: + :: + + result = await api.restore_backup_items( + hosting_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}/restore-backup-items", + body=marshal_BackupApiRestoreBackupItemsRequest( + BackupApiRestoreBackupItemsRequest( + hosting_id=hosting_id, + region=region, + item_ids=item_ids, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_RestoreBackupItemsResponse(res.json()) + + class WebhostingV1ControlPanelAPI(API): """ This API allows you to manage your Web Hosting services. diff --git a/scaleway-async/scaleway_async/webhosting/v1/content.py b/scaleway-async/scaleway_async/webhosting/v1/content.py index 895da5659..e77f5228b 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/content.py +++ b/scaleway-async/scaleway_async/webhosting/v1/content.py @@ -3,11 +3,18 @@ from typing import List from .types import ( + BackupStatus, DomainAvailabilityStatus, DomainStatus, HostingStatus, ) +BACKUP_TRANSIENT_STATUSES: List[BackupStatus] = [ + BackupStatus.RESTORING, +] +""" +Lists transient statutes of the enum :class:`BackupStatus `. +""" DOMAIN_AVAILABILITY_TRANSIENT_STATUSES: List[DomainAvailabilityStatus] = [ DomainAvailabilityStatus.VALIDATING, ] diff --git a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py index 3825815ee..de30cfcc7 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/marshalling.py +++ b/scaleway-async/scaleway_async/webhosting/v1/marshalling.py @@ -13,9 +13,23 @@ resolve_one_of, ) from .types import ( + BackupItemType, + BackupStatus, + DnsRecordStatus, + DnsRecordType, + DnsRecordsStatus, DomainAction, DomainAvailabilityAction, + DomainAvailabilityStatus, DomainDnsAction, + DomainStatus, + DomainZoneOwner, + HostingStatus, + NameserverStatus, + OfferOptionName, + OfferOptionWarning, + PlatformPlatformGroup, + Backup, DatabaseUser, Database, FtpAccount, @@ -35,6 +49,10 @@ Offer, Platform, Hosting, + BackupItem, + BackupItemGroup, + ListBackupItemsResponse, + ListBackupsResponse, ControlPanel, ListControlPanelsResponse, ListDatabaseUsersResponse, @@ -48,9 +66,12 @@ ListWebsitesResponse, ResetHostingPasswordResponse, ResourceSummary, + RestoreBackupItemsResponse, + RestoreBackupResponse, DomainAvailability, SearchDomainsResponse, Session, + BackupApiRestoreBackupItemsRequest, DatabaseApiAssignDatabaseUserRequest, DatabaseApiChangeDatabaseUserPasswordRequest, CreateDatabaseRequestUser, @@ -75,6 +96,47 @@ ) +def unmarshal_Backup(data: Any) -> Backup: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Backup' 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("size", None) + if field is not None: + args["size"] = field + else: + args["size"] = 0 + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = BackupStatus.UNKNOWN_BACKUP_STATUS + + field = data.get("total_items", None) + if field is not None: + args["total_items"] = field + else: + args["total_items"] = 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 + + return Backup(**args) + + def unmarshal_DatabaseUser(data: Any) -> DatabaseUser: if not isinstance(data, dict): raise TypeError( @@ -86,10 +148,14 @@ def unmarshal_DatabaseUser(data: Any) -> DatabaseUser: field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("databases", None) if field is not None: args["databases"] = field + else: + args["databases"] = field(default_factory=list) return DatabaseUser(**args) @@ -105,10 +171,14 @@ def unmarshal_Database(data: Any) -> Database: field = data.get("database_name", None) if field is not None: args["database_name"] = field + else: + args["database_name"] = None field = data.get("users", None) if field is not None: args["users"] = field + else: + args["users"] = field(default_factory=list) return Database(**args) @@ -124,10 +194,14 @@ def unmarshal_FtpAccount(data: Any) -> FtpAccount: field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None return FtpAccount(**args) @@ -143,10 +217,14 @@ def unmarshal_MailAccount(data: Any) -> MailAccount: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None return MailAccount(**args) @@ -162,6 +240,8 @@ def unmarshal_CheckUserOwnsDomainResponse(data: Any) -> CheckUserOwnsDomainRespo field = data.get("owns_domain", None) if field is not None: args["owns_domain"] = field + else: + args["owns_domain"] = False return CheckUserOwnsDomainResponse(**args) @@ -177,22 +257,32 @@ def unmarshal_AutoConfigDomainDns(data: Any) -> AutoConfigDomainDns: field = data.get("nameservers", None) if field is not None: args["nameservers"] = field + else: + args["nameservers"] = False field = data.get("web_records", None) if field is not None: args["web_records"] = field + else: + args["web_records"] = False field = data.get("mail_records", None) if field is not None: args["mail_records"] = field + else: + args["mail_records"] = False field = data.get("all_records", None) if field is not None: args["all_records"] = field + else: + args["all_records"] = False field = data.get("none", None) if field is not None: args["none"] = field + else: + args["none"] = False return AutoConfigDomainDns(**args) @@ -208,32 +298,44 @@ def unmarshal_DnsRecord(data: Any) -> DnsRecord: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = DnsRecordType.UNKNOWN_TYPE field = data.get("ttl", None) if field is not None: args["ttl"] = field + else: + args["ttl"] = 0 field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DnsRecordStatus.UNKNOWN_STATUS field = data.get("raw_data", None) if field is not None: args["raw_data"] = field + else: + args["raw_data"] = None field = data.get("priority", None) if field is not None: args["priority"] = field else: - args["priority"] = None + args["priority"] = 0 return DnsRecord(**args) @@ -249,14 +351,20 @@ def unmarshal_Nameserver(data: Any) -> Nameserver: field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = NameserverStatus.UNKNOWN_STATUS field = data.get("is_default", None) if field is not None: args["is_default"] = field + else: + args["is_default"] = False return Nameserver(**args) @@ -274,16 +382,22 @@ def unmarshal_DnsRecords(data: Any) -> DnsRecords: args["records"] = ( [unmarshal_DnsRecord(v) for v in field] if field is not None else None ) + else: + args["records"] = field(default_factory=list) field = data.get("name_servers", None) if field is not None: args["name_servers"] = ( [unmarshal_Nameserver(v) for v in field] if field is not None else None ) + else: + args["name_servers"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DnsRecordsStatus.UNKNOWN_STATUS field = data.get("dns_config", None) if field is not None: @@ -291,7 +405,7 @@ def unmarshal_DnsRecords(data: Any) -> DnsRecords: [DomainDnsAction(v) for v in field] if field is not None else None ) else: - args["dns_config"] = None + args["dns_config"] = field(default_factory=list) field = data.get("auto_config_domain_dns", None) if field is not None: @@ -313,24 +427,34 @@ def unmarshal_Domain(data: Any) -> Domain: 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"] = DomainStatus.UNKNOWN_STATUS field = data.get("owner", None) if field is not None: args["owner"] = field + else: + args["owner"] = DomainZoneOwner.UNKNOWN_ZONE_OWNER field = data.get("zone_domain_name", None) if field is not None: args["zone_domain_name"] = field + else: + args["zone_domain_name"] = None field = data.get("available_actions", None) if field is not None: args["available_actions"] = ( [DomainAction(v) for v in field] if field is not None else None ) + else: + args["available_actions"] = field(default_factory=list) field = data.get("available_dns_actions", None) if field is not None: @@ -338,7 +462,7 @@ def unmarshal_Domain(data: Any) -> Domain: [DomainDnsAction(v) for v in field] if field is not None else None ) else: - args["available_dns_actions"] = None + args["available_dns_actions"] = field(default_factory=list) field = data.get("auto_config_domain_dns", None) if field is not None: @@ -360,10 +484,14 @@ def unmarshal_PlatformControlPanelUrls(data: Any) -> PlatformControlPanelUrls: field = data.get("dashboard", None) if field is not None: args["dashboard"] = field + else: + args["dashboard"] = None field = data.get("webmail", None) if field is not None: args["webmail"] = field + else: + args["webmail"] = None return PlatformControlPanelUrls(**args) @@ -379,14 +507,20 @@ def unmarshal_HostingDomainCustomDomain(data: Any) -> HostingDomainCustomDomain: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("domain_status", None) if field is not None: args["domain_status"] = field + else: + args["domain_status"] = DomainStatus.UNKNOWN_STATUS field = data.get("dns_status", None) if field is not None: args["dns_status"] = field + else: + args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS field = data.get("auto_config_domain_dns", None) if field is not None: @@ -408,30 +542,44 @@ def unmarshal_OfferOption(data: Any) -> OfferOption: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = OfferOptionName.UNKNOWN_NAME field = data.get("billing_operation_path", None) if field is not None: args["billing_operation_path"] = field + else: + args["billing_operation_path"] = None field = data.get("min_value", None) if field is not None: args["min_value"] = field + else: + args["min_value"] = 0 field = data.get("current_value", None) if field is not None: args["current_value"] = field + else: + args["current_value"] = 0 field = data.get("max_value", None) if field is not None: args["max_value"] = field + else: + args["max_value"] = 0 field = data.get("quota_warning", None) if field is not None: args["quota_warning"] = field + else: + args["quota_warning"] = OfferOptionWarning.UNKNOWN_WARNING field = data.get("price", None) if field is not None: @@ -453,6 +601,8 @@ def unmarshal_PlatformControlPanel(data: Any) -> PlatformControlPanel: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("urls", None) if field is not None: @@ -474,6 +624,8 @@ def unmarshal_HostingDomain(data: Any) -> HostingDomain: field = data.get("subdomain", None) if field is not None: args["subdomain"] = field + else: + args["subdomain"] = None field = data.get("custom_domain", None) if field is not None: @@ -495,10 +647,14 @@ def unmarshal_HostingUser(data: Any) -> HostingUser: field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("contact_email", None) if field is not None: args["contact_email"] = field + else: + args["contact_email"] = None field = data.get("one_time_password", None) if field is not None: @@ -526,36 +682,52 @@ def unmarshal_Offer(data: Any) -> Offer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("billing_operation_path", None) if field is not None: args["billing_operation_path"] = field + else: + args["billing_operation_path"] = None field = data.get("options", None) if field is not None: args["options"] = ( [unmarshal_OfferOption(v) for v in field] if field is not None else None ) + else: + args["options"] = field(default_factory=list) field = data.get("available", None) if field is not None: args["available"] = field + else: + args["available"] = False field = data.get("control_panel_name", None) if field is not None: args["control_panel_name"] = field + else: + args["control_panel_name"] = None field = data.get("end_of_life", None) if field is not None: args["end_of_life"] = field + else: + args["end_of_life"] = False field = data.get("quota_warning", None) if field is not None: args["quota_warning"] = field + else: + args["quota_warning"] = OfferOptionWarning.UNKNOWN_WARNING field = data.get("price", None) if field is not None: @@ -577,22 +749,32 @@ def unmarshal_Platform(data: Any) -> Platform: field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("number", None) if field is not None: args["number"] = field + else: + args["number"] = 0 field = data.get("group_name", None) if field is not None: args["group_name"] = field + else: + args["group_name"] = PlatformPlatformGroup.UNKNOWN_GROUP field = data.get("ipv4", None) if field is not None: args["ipv4"] = field + else: + args["ipv4"] = None field = data.get("ipv6", None) if field is not None: args["ipv6"] = field + else: + args["ipv6"] = None field = data.get("control_panel", None) if field is not None: @@ -614,14 +796,20 @@ def unmarshal_Hosting(data: Any) -> Hosting: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = HostingStatus.UNKNOWN_STATUS field = data.get("updated_at", None) if field is not None: @@ -656,24 +844,32 @@ def unmarshal_Hosting(data: Any) -> Hosting: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("ipv4", None) if field is not None: args["ipv4"] = field + else: + args["ipv4"] = None field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("dns_status", None) if field is not None: args["dns_status"] = field else: - args["dns_status"] = None + args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS field = data.get("user", None) if field is not None: @@ -685,7 +881,7 @@ def unmarshal_Hosting(data: Any) -> Hosting: if field is not None: args["domain_status"] = field else: - args["domain_status"] = None + args["domain_status"] = DomainStatus.UNKNOWN_STATUS field = data.get("domain_info", None) if field is not None: @@ -696,6 +892,128 @@ def unmarshal_Hosting(data: Any) -> Hosting: return Hosting(**args) +def unmarshal_BackupItem(data: Any) -> BackupItem: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'BackupItem' 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("name", None) + if field is not None: + args["name"] = field + else: + args["name"] = None + + field = data.get("type", None) + if field is not None: + args["type_"] = field + else: + args["type_"] = BackupItemType.UNKNOWN_BACKUP_ITEM_TYPE + + field = data.get("size", None) + if field is not None: + args["size"] = field + else: + args["size"] = 0 + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = BackupStatus.UNKNOWN_BACKUP_STATUS + + 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 + + return BackupItem(**args) + + +def unmarshal_BackupItemGroup(data: Any) -> BackupItemGroup: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'BackupItemGroup' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("type", None) + if field is not None: + args["type_"] = field + else: + args["type_"] = BackupItemType.UNKNOWN_BACKUP_ITEM_TYPE + + field = data.get("items", None) + if field is not None: + args["items"] = ( + [unmarshal_BackupItem(v) for v in field] if field is not None else None + ) + else: + args["items"] = field(default_factory=list) + + return BackupItemGroup(**args) + + +def unmarshal_ListBackupItemsResponse(data: Any) -> ListBackupItemsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListBackupItemsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = 0 + + field = data.get("groups", None) + if field is not None: + args["groups"] = ( + [unmarshal_BackupItemGroup(v) for v in field] if field is not None else None + ) + else: + args["groups"] = field(default_factory=list) + + return ListBackupItemsResponse(**args) + + +def unmarshal_ListBackupsResponse(data: Any) -> ListBackupsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListBackupsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = 0 + + field = data.get("backups", None) + if field is not None: + args["backups"] = ( + [unmarshal_Backup(v) for v in field] if field is not None else None + ) + else: + args["backups"] = field(default_factory=list) + + return ListBackupsResponse(**args) + + def unmarshal_ControlPanel(data: Any) -> ControlPanel: if not isinstance(data, dict): raise TypeError( @@ -707,20 +1025,28 @@ def unmarshal_ControlPanel(data: Any) -> ControlPanel: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("available", None) if field is not None: args["available"] = field + else: + args["available"] = False field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("available_languages", None) if field is not None: args["available_languages"] = ( [StdLanguageCode(v) for v in field] if field is not None else None ) + else: + args["available_languages"] = field(default_factory=list) return ControlPanel(**args) @@ -736,12 +1062,16 @@ def unmarshal_ListControlPanelsResponse(data: Any) -> ListControlPanelsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("control_panels", None) if field is not None: args["control_panels"] = ( [unmarshal_ControlPanel(v) for v in field] if field is not None else None ) + else: + args["control_panels"] = field(default_factory=list) return ListControlPanelsResponse(**args) @@ -757,12 +1087,16 @@ def unmarshal_ListDatabaseUsersResponse(data: Any) -> ListDatabaseUsersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("users", None) if field is not None: args["users"] = ( [unmarshal_DatabaseUser(v) for v in field] if field is not None else None ) + else: + args["users"] = field(default_factory=list) return ListDatabaseUsersResponse(**args) @@ -778,12 +1112,16 @@ def unmarshal_ListDatabasesResponse(data: Any) -> ListDatabasesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("databases", None) if field is not None: args["databases"] = ( [unmarshal_Database(v) for v in field] if field is not None else None ) + else: + args["databases"] = field(default_factory=list) return ListDatabasesResponse(**args) @@ -799,12 +1137,16 @@ def unmarshal_ListFtpAccountsResponse(data: Any) -> ListFtpAccountsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("ftp_accounts", None) if field is not None: args["ftp_accounts"] = ( [unmarshal_FtpAccount(v) for v in field] if field is not None else None ) + else: + args["ftp_accounts"] = field(default_factory=list) return ListFtpAccountsResponse(**args) @@ -820,26 +1162,38 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = HostingStatus.UNKNOWN_STATUS field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -863,13 +1217,13 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: if field is not None: args["dns_status"] = field else: - args["dns_status"] = None + args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS field = data.get("domain_status", None) if field is not None: args["domain_status"] = field else: - args["domain_status"] = None + args["domain_status"] = DomainStatus.UNKNOWN_STATUS field = data.get("domain_info", None) if field is not None: @@ -891,12 +1245,16 @@ def unmarshal_ListHostingsResponse(data: Any) -> ListHostingsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("hostings", None) if field is not None: args["hostings"] = ( [unmarshal_HostingSummary(v) for v in field] if field is not None else None ) + else: + args["hostings"] = field(default_factory=list) return ListHostingsResponse(**args) @@ -912,12 +1270,16 @@ def unmarshal_ListMailAccountsResponse(data: Any) -> ListMailAccountsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("mail_accounts", None) if field is not None: args["mail_accounts"] = ( [unmarshal_MailAccount(v) for v in field] if field is not None else None ) + else: + args["mail_accounts"] = field(default_factory=list) return ListMailAccountsResponse(**args) @@ -933,12 +1295,16 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("offers", None) if field is not None: args["offers"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["offers"] = field(default_factory=list) return ListOffersResponse(**args) @@ -954,14 +1320,20 @@ def unmarshal_Website(data: Any) -> Website: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None field = data.get("ssl_status", None) if field is not None: args["ssl_status"] = field + else: + args["ssl_status"] = False return Website(**args) @@ -977,12 +1349,16 @@ def unmarshal_ListWebsitesResponse(data: Any) -> ListWebsitesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("websites", None) if field is not None: args["websites"] = ( [unmarshal_Website(v) for v in field] if field is not None else None ) + else: + args["websites"] = field(default_factory=list) return ListWebsitesResponse(**args) @@ -998,6 +1374,8 @@ def unmarshal_ResetHostingPasswordResponse(data: Any) -> ResetHostingPasswordRes field = data.get("one_time_password_b64", None) if field is not None: args["one_time_password_b64"] = field + else: + args["one_time_password_b64"] = None field = data.get("one_time_password", None) if field is not None: @@ -1019,22 +1397,52 @@ def unmarshal_ResourceSummary(data: Any) -> ResourceSummary: field = data.get("databases_count", None) if field is not None: args["databases_count"] = field + else: + args["databases_count"] = 0 field = data.get("mail_accounts_count", None) if field is not None: args["mail_accounts_count"] = field + else: + args["mail_accounts_count"] = 0 field = data.get("ftp_accounts_count", None) if field is not None: args["ftp_accounts_count"] = field + else: + args["ftp_accounts_count"] = 0 field = data.get("websites_count", None) if field is not None: args["websites_count"] = field + else: + args["websites_count"] = 0 return ResourceSummary(**args) +def unmarshal_RestoreBackupItemsResponse(data: Any) -> RestoreBackupItemsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'RestoreBackupItemsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + return RestoreBackupItemsResponse(**args) + + +def unmarshal_RestoreBackupResponse(data: Any) -> RestoreBackupResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'RestoreBackupResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + return RestoreBackupResponse(**args) + + def unmarshal_DomainAvailability(data: Any) -> DomainAvailability: if not isinstance(data, dict): raise TypeError( @@ -1046,24 +1454,34 @@ def unmarshal_DomainAvailability(data: Any) -> DomainAvailability: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("zone_name", None) if field is not None: args["zone_name"] = field + else: + args["zone_name"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainAvailabilityStatus.UNKNOWN_STATUS field = data.get("available_actions", None) if field is not None: args["available_actions"] = ( [DomainAvailabilityAction(v) for v in field] if field is not None else None ) + else: + args["available_actions"] = field(default_factory=list) field = data.get("can_create_hosting", None) if field is not None: args["can_create_hosting"] = field + else: + args["can_create_hosting"] = False field = data.get("price", None) if field is not None: @@ -1089,6 +1507,8 @@ def unmarshal_SearchDomainsResponse(data: Any) -> SearchDomainsResponse: if field is not None else None ) + else: + args["domains_available"] = field(default_factory=list) return SearchDomainsResponse(**args) @@ -1104,10 +1524,24 @@ def unmarshal_Session(data: Any) -> Session: field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None return Session(**args) +def marshal_BackupApiRestoreBackupItemsRequest( + request: BackupApiRestoreBackupItemsRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.item_ids is not None: + output["item_ids"] = request.item_ids + + return output + + def marshal_DatabaseApiAssignDatabaseUserRequest( request: DatabaseApiAssignDatabaseUserRequest, defaults: ProfileDefaults, @@ -1209,7 +1643,9 @@ def marshal_DnsApiCheckUserOwnsDomainRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1248,7 +1684,7 @@ def marshal_SyncDomainDnsRecordsRequestRecord( output["name"] = request.name if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ return output @@ -1367,7 +1803,9 @@ def marshal_HostingApiCreateHostingRequest( output["domain"] = request.domain if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -1381,7 +1819,7 @@ def marshal_HostingApiCreateHostingRequest( ] if request.language is not None: - output["language"] = str(request.language) + output["language"] = request.language if request.domain_configuration is not None: output["domain_configuration"] = ( diff --git a/scaleway-async/scaleway_async/webhosting/v1/types.py b/scaleway-async/scaleway_async/webhosting/v1/types.py index 13e8ef91e..ce0bda760 100644 --- a/scaleway-async/scaleway_async/webhosting/v1/types.py +++ b/scaleway-async/scaleway_async/webhosting/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -20,6 +20,34 @@ ) +class BackupItemType(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_BACKUP_ITEM_TYPE = "unknown_backup_item_type" + FULL = "full" + WEB = "web" + MAIL = "mail" + DB = "db" + DB_USER = "db_user" + FTP_USER = "ftp_user" + DNS_ZONE = "dns_zone" + CRON_JOB = "cron_job" + SSL_CERTIFICATE = "ssl_certificate" + + def __str__(self) -> str: + return str(self.value) + + +class BackupStatus(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_BACKUP_STATUS = "unknown_backup_status" + ACTIVE = "active" + LOCKED = "locked" + DISABLED = "disabled" + DAMAGED = "damaged" + RESTORING = "restoring" + + def __str__(self) -> str: + return str(self.value) + + class DnsRecordStatus(str, Enum, metaclass=StrEnumMeta): UNKNOWN_STATUS = "unknown_status" VALID = "valid" @@ -131,6 +159,14 @@ def __str__(self) -> str: return str(self.value) +class ListBackupsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_DESC = "created_at_desc" + CREATED_AT_ASC = "created_at_asc" + + def __str__(self) -> str: + return str(self.value) + + class ListDatabaseUsersRequestOrderBy(str, Enum, metaclass=StrEnumMeta): USERNAME_ASC = "username_asc" USERNAME_DESC = "username_desc" @@ -290,7 +326,7 @@ class HostingDomainCustomDomain: Status of the DNS configuration for the custom domain. """ - auto_config_domain_dns: Optional[AutoConfigDomainDns] + auto_config_domain_dns: Optional[AutoConfigDomainDns] = None """ Indicates whether to auto-configure DNS for this domain. """ @@ -333,7 +369,7 @@ class OfferOption: Defines a warning if the maximum value for the option has been reached. """ - price: Optional[Money] + price: Optional[Money] = None """ Price of the option for 1 value. """ @@ -346,12 +382,45 @@ class PlatformControlPanel: Name of the control panel. """ - urls: Optional[PlatformControlPanelUrls] + urls: Optional[PlatformControlPanelUrls] = None """ URL to connect to control panel dashboard and to Webmail interface. """ +@dataclass +class BackupItem: + id: str + """ + ID of the item. + """ + + name: str + """ + Name of the item (e.g., `database name`, `email address`). + """ + + type_: BackupItemType + """ + Type of the item (e.g., email, database, FTP). + """ + + size: int + """ + Size of the item in bytes. + """ + + status: BackupStatus + """ + Status of the item. Available values are `active`, `damaged`, and `restoring`. + """ + + created_at: Optional[datetime] = None + """ + Date and time at which this item was backed up. + """ + + @dataclass class HostingDomain: subdomain: str @@ -359,7 +428,7 @@ class HostingDomain: Optional free subdomain linked to the Web Hosting plan. """ - custom_domain: Optional[HostingDomainCustomDomain] + custom_domain: Optional[HostingDomainCustomDomain] = None """ Optional custom domain linked to the Web Hosting plan. """ @@ -368,18 +437,14 @@ class HostingDomain: @dataclass class CreateDatabaseRequestUser: username: str - password: str @dataclass class CreateHostingRequestDomainConfiguration: update_nameservers: bool - update_web_record: bool - update_mail_record: bool - update_all_records: bool @@ -399,7 +464,6 @@ class OfferOptionRequest: @dataclass class SyncDomainDnsRecordsRequestRecord: name: str - type_: DnsRecordType @@ -435,7 +499,7 @@ class DnsRecord: Record representation as it appears in the zone file or DNS management system. """ - priority: Optional[int] + priority: Optional[int] = 0 """ Record priority level. """ @@ -471,12 +535,12 @@ class HostingUser: Contact email used for the hosting. """ - one_time_password: Optional[str] + one_time_password: Optional[str] = None """ One-time-password used for the first login to the control panel, cleared after first use (deprecated, use password_b64 instead). """ - one_time_password_b64: Optional[str] + one_time_password_b64: Optional[str] = None """ One-time-password used for the first login to the control panel, cleared after first use, encoded in base64. """ @@ -524,7 +588,7 @@ class Offer: Defines a warning if the maximum value for an option in the offer is exceeded. """ - price: Optional[Money] + price: Optional[Money] = None """ Price of the offer. """ @@ -557,12 +621,53 @@ class Platform: IPv6 address of the hosting's host platform. """ - control_panel: Optional[PlatformControlPanel] + control_panel: Optional[PlatformControlPanel] = None """ Details of the platform control panel. """ +@dataclass +class BackupItemGroup: + type_: BackupItemType + """ + Type of items (e.g., email, database, FTP). + """ + + items: List[BackupItem] + """ + List of individual backup items of this type. + """ + + +@dataclass +class Backup: + id: str + """ + ID of the backup. + """ + + size: int + """ + Total size of the backup in bytes. + """ + + status: BackupStatus + """ + Status of the backup. Available values are `active`, `locked`, and `restoring`. + """ + + total_items: int + """ + Total number of restorable items in the backup. + """ + + created_at: Optional[datetime] = None + """ + Creation date of the backup. + """ + + @dataclass class ControlPanel: name: str @@ -657,32 +762,32 @@ class HostingSummary: Region where the Web Hosting plan is hosted. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Web Hosting plan was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the Web Hosting plan was last updated. """ - domain: Optional[str] + domain: Optional[str] = None """ Main domain associated with the Web Hosting plan (deprecated, use domain_info). """ - dns_status: Optional[DnsRecordsStatus] + dns_status: Optional[DnsRecordsStatus] = DnsRecordsStatus.UNKNOWN_STATUS """ DNS status of the Web Hosting plan. """ - domain_status: Optional[DomainStatus] + domain_status: Optional[DomainStatus] = DomainStatus.UNKNOWN_STATUS """ Main domain status of the Web Hosting plan. """ - domain_info: Optional[HostingDomain] + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). """ @@ -746,12 +851,114 @@ class DomainAvailability: Whether a hosting can be created for this domain. """ - price: Optional[Money] + price: Optional[Money] = None """ Price for registering the domain. """ +@dataclass +class BackupApiGetBackupRequest: + hosting_id: str + """ + UUID of the hosting account. + """ + + backup_id: str + """ + ID of the backup to retrieve. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + +@dataclass +class BackupApiListBackupItemsRequest: + hosting_id: str + """ + UUID of the hosting account. + """ + + backup_id: str + """ + ID of the backup to list items from. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + +@dataclass +class BackupApiListBackupsRequest: + hosting_id: str + """ + UUID of the hosting account. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + page: Optional[int] = 0 + """ + Page number to retrieve. + """ + + page_size: Optional[int] = 0 + """ + Number of backups to return per page. + """ + + order_by: Optional[ListBackupsRequestOrderBy] = ( + ListBackupsRequestOrderBy.CREATED_AT_DESC + ) + """ + Order in which to return the list of backups. + """ + + +@dataclass +class BackupApiRestoreBackupItemsRequest: + hosting_id: str + """ + UUID of the hosting account. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + item_ids: Optional[List[str]] = field(default_factory=list) + """ + List of backup item IDs to restore individually. + """ + + +@dataclass +class BackupApiRestoreBackupRequest: + hosting_id: str + """ + UUID of the hosting account. + """ + + backup_id: str + """ + ID of the backup to fully restore. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class CheckUserOwnsDomainResponse: owns_domain: bool @@ -762,17 +969,17 @@ class CheckUserOwnsDomainResponse: @dataclass class ControlPanelApiListControlPanelsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of control panels to return (must be a positive integer lower or equal to 100). """ @@ -795,7 +1002,7 @@ class DatabaseApiAssignDatabaseUserRequest: Name of the database to be assigned. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -818,7 +1025,7 @@ class DatabaseApiChangeDatabaseUserPasswordRequest: New password. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -836,14 +1043,14 @@ class DatabaseApiCreateDatabaseRequest: Name of the database to be created. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - new_user: Optional[CreateDatabaseRequestUser] + new_user: Optional[CreateDatabaseRequestUser] = None - existing_username: Optional[str] + existing_username: Optional[str] = None @dataclass @@ -863,7 +1070,7 @@ class DatabaseApiCreateDatabaseUserRequest: Password of the user to create. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -881,7 +1088,7 @@ class DatabaseApiDeleteDatabaseRequest: Name of the database to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -899,7 +1106,7 @@ class DatabaseApiDeleteDatabaseUserRequest: Name of the database user to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -917,7 +1124,7 @@ class DatabaseApiGetDatabaseRequest: Name of the database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -935,7 +1142,7 @@ class DatabaseApiGetDatabaseUserRequest: Name of the database user to retrieve details. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -948,22 +1155,24 @@ class DatabaseApiListDatabaseUsersRequest: UUID of the hosting plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of database users to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListDatabaseUsersRequestOrderBy] + order_by: Optional[ListDatabaseUsersRequestOrderBy] = ( + ListDatabaseUsersRequestOrderBy.USERNAME_ASC + ) """ Sort order of database users in the response. """ @@ -976,22 +1185,24 @@ class DatabaseApiListDatabasesRequest: UUID of the hosting plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of databases to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListDatabasesRequestOrderBy] + order_by: Optional[ListDatabasesRequestOrderBy] = ( + ListDatabasesRequestOrderBy.DATABASE_NAME_ASC + ) """ Sort order of databases in the response. """ @@ -1014,7 +1225,7 @@ class DatabaseApiUnassignDatabaseUserRequest: Name of the database to be unassigned. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1027,12 +1238,12 @@ class DnsApiCheckUserOwnsDomainRequest: Domain for which ownership is to be verified. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project currently in use. """ @@ -1045,7 +1256,7 @@ class DnsApiGetDomainDnsRecordsRequest: Domain associated with the DNS records. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1058,12 +1269,12 @@ class DnsApiGetDomainRequest: Domain name to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Scaleway Project in which to get the domain to create the Web Hosting plan. """ @@ -1076,12 +1287,12 @@ class DnsApiSearchDomainsRequest: Domain name to search. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Scaleway Project in which to search the domain to create the Web Hosting plan. """ @@ -1094,37 +1305,39 @@ class DnsApiSyncDomainDnsRecordsRequest: Domain for which the DNS records will be synchronized. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - update_web_records: Optional[bool] + update_web_records: Optional[bool] = False """ Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns). """ - update_mail_records: Optional[bool] + update_mail_records: Optional[bool] = False """ Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns). """ - update_all_records: Optional[bool] + update_all_records: Optional[bool] = False """ Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns). """ - update_nameservers: Optional[bool] + update_nameservers: Optional[bool] = False """ Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns). """ - custom_records: Optional[List[SyncDomainDnsRecordsRequestRecord]] + custom_records: Optional[List[SyncDomainDnsRecordsRequestRecord]] = field( + default_factory=list + ) """ Custom records to synchronize. """ - auto_config_domain_dns: Optional[AutoConfigDomainDns] + auto_config_domain_dns: Optional[AutoConfigDomainDns] = None """ Whether or not to synchronize each types of records. """ @@ -1147,12 +1360,12 @@ class DnsRecords: Status of the records. """ - dns_config: Optional[List[DomainDnsAction]] + dns_config: Optional[List[DomainDnsAction]] = field(default_factory=list) """ Records dns auto configuration settings (deprecated, use auto_config_domain_dns). """ - auto_config_domain_dns: Optional[AutoConfigDomainDns] + auto_config_domain_dns: Optional[AutoConfigDomainDns] = None """ Whether or not to synchronize each types of records. """ @@ -1185,12 +1398,12 @@ class Domain: A list of actions that can be performed on the domain. """ - available_dns_actions: Optional[List[DomainDnsAction]] + available_dns_actions: Optional[List[DomainDnsAction]] = field(default_factory=list) """ A list of DNS-related actions that can be auto configured for the domain (deprecated, use auto_config_domain_dns instead). """ - auto_config_domain_dns: Optional[AutoConfigDomainDns] + auto_config_domain_dns: Optional[AutoConfigDomainDns] = None """ Whether or not to synchronize each type of record. """ @@ -1213,7 +1426,7 @@ class FtpAccountApiChangeFtpAccountPasswordRequest: New password for the FTP account. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1241,7 +1454,7 @@ class FtpAccountApiCreateFtpAccountRequest: Password for the new FTP account. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1254,27 +1467,29 @@ class FtpAccountApiListFtpAccountsRequest: UUID of the hosting plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of FTP accounts to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListFtpAccountsRequestOrderBy] + order_by: Optional[ListFtpAccountsRequestOrderBy] = ( + ListFtpAccountsRequestOrderBy.USERNAME_ASC + ) """ Sort order of FTP accounts in the response. """ - domain: Optional[str] + domain: Optional[str] = None """ Domain to filter the FTP accounts. """ @@ -1292,7 +1507,7 @@ class FtpAccountApiRemoveFtpAccountRequest: Username of the FTP account to be deleted. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1315,67 +1530,67 @@ class Hosting: Status of the Web Hosting plan. """ - updated_at: Optional[datetime] + tags: List[str] """ - Date on which the Web Hosting plan was last updated. + List of tags associated with the Web Hosting plan. """ - created_at: Optional[datetime] + ipv4: str """ - Date on which the Web Hosting plan was created. + Current IPv4 address of the hosting. """ - domain: Optional[str] + protected: bool """ - Main domain associated with the Web Hosting plan (deprecated, use domain_info). + Whether the hosting is protected or not. """ - offer: Optional[Offer] + region: ScwRegion """ - Details of the Web Hosting plan offer and options. + Region where the Web Hosting plan is hosted. """ - platform: Optional[Platform] + updated_at: Optional[datetime] = None """ - Details of the hosting platform. + Date on which the Web Hosting plan was last updated. """ - tags: List[str] + created_at: Optional[datetime] = None """ - List of tags associated with the Web Hosting plan. + Date on which the Web Hosting plan was created. """ - ipv4: str + domain: Optional[str] = None """ - Current IPv4 address of the hosting. + Main domain associated with the Web Hosting plan (deprecated, use domain_info). """ - protected: bool + offer: Optional[Offer] = None """ - Whether the hosting is protected or not. + Details of the Web Hosting plan offer and options. """ - region: ScwRegion + platform: Optional[Platform] = None """ - Region where the Web Hosting plan is hosted. + Details of the hosting platform. """ - dns_status: Optional[DnsRecordsStatus] + dns_status: Optional[DnsRecordsStatus] = DnsRecordsStatus.UNKNOWN_STATUS """ DNS status of the Web Hosting plan (deprecated, use domain_info). """ - user: Optional[HostingUser] + user: Optional[HostingUser] = None """ Details of the hosting user. """ - domain_status: Optional[DomainStatus] + domain_status: Optional[DomainStatus] = DomainStatus.UNKNOWN_STATUS """ Main domain status of the Web Hosting plan (deprecated, use domain_info). """ - domain_info: Optional[HostingDomain] + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). """ @@ -1398,47 +1613,47 @@ class HostingApiCreateHostingRequest: Domain name to link to the Web Hosting plan. You must already own this domain name, and have completed the DNS validation process beforehand. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Scaleway Project in which to create the Web Hosting plan. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Web Hosting plan. """ - subdomain: Optional[str] + subdomain: Optional[str] = None """ The name prefix to use as a free subdomain (for example, `mysite`) assigned to the Web Hosting plan. The full domain will be automatically created by adding it to the fixed base domain (e.g. `mysite.scw.site`). You do not need to include the base domain yourself. """ - offer_options: Optional[List[OfferOptionRequest]] + offer_options: Optional[List[OfferOptionRequest]] = field(default_factory=list) """ List of the Web Hosting plan options IDs with their quantities. """ - language: Optional[StdLanguageCode] + language: Optional[StdLanguageCode] = StdLanguageCode.UNKNOWN_LANGUAGE_CODE """ Default language for the control panel interface. """ - domain_configuration: Optional[CreateHostingRequestDomainConfiguration] + domain_configuration: Optional[CreateHostingRequestDomainConfiguration] = None """ Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_config_domain_dns instead). """ - skip_welcome_email: Optional[bool] + skip_welcome_email: Optional[bool] = False """ Indicates whether to skip a welcome email to the contact email containing hosting info. """ - auto_config_domain_dns: Optional[AutoConfigDomainDns] + auto_config_domain_dns: Optional[AutoConfigDomainDns] = None """ Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_update_* fields instead). """ @@ -1451,7 +1666,7 @@ class HostingApiCreateSessionRequest: Hosting ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1464,7 +1679,7 @@ class HostingApiDeleteHostingRequest: Hosting ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1477,7 +1692,7 @@ class HostingApiGetHostingRequest: Hosting ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1490,7 +1705,7 @@ class HostingApiGetResourceSummaryRequest: Hosting ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1498,57 +1713,59 @@ class HostingApiGetResourceSummaryRequest: @dataclass class HostingApiListHostingsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Web Hosting plans to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListHostingsRequestOrderBy] + order_by: Optional[ListHostingsRequestOrderBy] = ( + ListHostingsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for Web Hosting plans in the response. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for, only Web Hosting plans with matching tags will be returned. """ - statuses: Optional[List[HostingStatus]] + statuses: Optional[List[HostingStatus]] = field(default_factory=list) """ Statuses to filter for, only Web Hosting plans with matching statuses will be returned. """ - domain: Optional[str] + domain: Optional[str] = None """ Domain to filter for, only Web Hosting plans associated with this domain will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Web Hosting plans from this Project will be returned. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for, only Web Hosting plans from this Organization will be returned. """ - control_panels: Optional[List[str]] + control_panels: Optional[List[str]] = field(default_factory=list) """ Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned. """ - subdomain: Optional[str] + subdomain: Optional[str] = None """ Optional free subdomain linked to the Web Hosting plan. """ @@ -1561,7 +1778,7 @@ class HostingApiResetHostingPasswordRequest: UUID of the hosting. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1574,37 +1791,63 @@ class HostingApiUpdateHostingRequest: Hosting ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - email: Optional[str] + email: Optional[str] = None """ New contact email for the Web Hosting plan. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags for the Web Hosting plan. """ - offer_options: Optional[List[OfferOptionRequest]] + offer_options: Optional[List[OfferOptionRequest]] = field(default_factory=list) """ List of the Web Hosting plan options IDs with their quantities. """ - offer_id: Optional[str] + offer_id: Optional[str] = None """ ID of the new offer for the Web Hosting plan. """ - protected: Optional[bool] + protected: Optional[bool] = False """ Whether the hosting is protected or not. """ +@dataclass +class ListBackupItemsResponse: + total_count: int + """ + Total number of backup item groups. + """ + + groups: List[BackupItemGroup] + """ + List of backup item groups categorized by type. + """ + + +@dataclass +class ListBackupsResponse: + total_count: int + """ + Total number of available backups. + """ + + backups: List[Backup] + """ + List of available backups. + """ + + @dataclass class ListControlPanelsResponse: total_count: int @@ -1731,7 +1974,7 @@ class MailAccountApiChangeMailAccountPasswordRequest: New password for the mail account. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1759,7 +2002,7 @@ class MailAccountApiCreateMailAccountRequest: Password for the new mail account. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1772,27 +2015,29 @@ class MailAccountApiListMailAccountsRequest: UUID of the hosting plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of mail accounts to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListMailAccountsRequestOrderBy] + order_by: Optional[ListMailAccountsRequestOrderBy] = ( + ListMailAccountsRequestOrderBy.USERNAME_ASC + ) """ Sort order of mail accounts in the response. """ - domain: Optional[str] + domain: Optional[str] = None """ Domain to filter the mail accounts. """ @@ -1815,7 +2060,7 @@ class MailAccountApiRemoveMailAccountRequest: Username part of the mail account address. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1823,32 +2068,32 @@ class MailAccountApiRemoveMailAccountRequest: @dataclass class OfferApiListOffersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of websites to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListOffersRequestOrderBy] + order_by: Optional[ListOffersRequestOrderBy] = ListOffersRequestOrderBy.PRICE_ASC """ Sort order for Web Hosting offers in the response. """ - hosting_id: Optional[str] + hosting_id: Optional[str] = None """ UUID of the hosting plan. """ - control_panels: Optional[List[str]] + control_panels: Optional[List[str]] = field(default_factory=list) """ Name of the control panel(s) to filter for. """ @@ -1861,7 +2106,7 @@ class ResetHostingPasswordResponse: New temporary password, encoded in base64. """ - one_time_password: Optional[str] + one_time_password: Optional[str] = None """ New temporary password (deprecated, use password_b64 instead). """ @@ -1890,6 +2135,16 @@ class ResourceSummary: """ +@dataclass +class RestoreBackupItemsResponse: + pass + + +@dataclass +class RestoreBackupResponse: + pass + + @dataclass class SearchDomainsResponse: domains_available: List[DomainAvailability] @@ -1913,22 +2168,24 @@ class WebsiteApiListWebsitesRequest: UUID of the hosting plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of websites to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListWebsitesRequestOrderBy] + order_by: Optional[ListWebsitesRequestOrderBy] = ( + ListWebsitesRequestOrderBy.DOMAIN_ASC + ) """ Sort order for Web Hosting websites in the response. """ diff --git a/scaleway/scaleway/account/v3/marshalling.py b/scaleway/scaleway/account/v3/marshalling.py index f9262972b..56904ed4b 100644 --- a/scaleway/scaleway/account/v3/marshalling.py +++ b/scaleway/scaleway/account/v3/marshalling.py @@ -10,6 +10,8 @@ resolve_one_of, ) from .types import ( + ContractType, + QualificationArchitectureType, Contract, ContractSignature, QualificationAiMachine, @@ -46,18 +48,26 @@ def unmarshal_Contract(data: Any) -> Contract: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ContractType.UNKNOWN_TYPE field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = 0 field = data.get("created_at", None) if field is not None: @@ -85,10 +95,14 @@ def unmarshal_ContractSignature(data: Any) -> ContractSignature: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("created_at", None) if field is not None: @@ -128,6 +142,8 @@ def unmarshal_QualificationAiMachine(data: Any) -> QualificationAiMachine: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationAiMachine(**args) @@ -143,6 +159,8 @@ def unmarshal_QualificationArchiveData(data: Any) -> QualificationArchiveData: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationArchiveData(**args) @@ -158,6 +176,8 @@ def unmarshal_QualificationContainer(data: Any) -> QualificationContainer: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationContainer(**args) @@ -173,6 +193,8 @@ def unmarshal_QualificationDeploySoftware(data: Any) -> QualificationDeploySoftw field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationDeploySoftware(**args) @@ -188,6 +210,8 @@ def unmarshal_QualificationHostApplication(data: Any) -> QualificationHostApplic field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationHostApplication(**args) @@ -203,6 +227,8 @@ def unmarshal_QualificationHostWebsite(data: Any) -> QualificationHostWebsite: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationHostWebsite(**args) @@ -218,6 +244,8 @@ def unmarshal_QualificationOtherUseCase(data: Any) -> QualificationOtherUseCase: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationOtherUseCase(**args) @@ -235,6 +263,8 @@ def unmarshal_QualificationSetScalewayEnvironment( field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationSetScalewayEnvironment(**args) @@ -250,6 +280,8 @@ def unmarshal_QualificationShareData(data: Any) -> QualificationShareData: field = data.get("sub_use_case", None) if field is not None: args["sub_use_case"] = field + else: + args["sub_use_case"] = None return QualificationShareData(**args) @@ -265,6 +297,10 @@ def unmarshal_Qualification(data: Any) -> Qualification: field = data.get("architecture_type", None) if field is not None: args["architecture_type"] = field + else: + args["architecture_type"] = ( + QualificationArchitectureType.UNKNOWN_ARCHITECTURE_TYPE + ) field = data.get("host_website", None) if field is not None: @@ -336,18 +372,26 @@ def unmarshal_Project(data: Any) -> Project: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("created_at", None) if field is not None: @@ -383,10 +427,14 @@ def unmarshal_CheckContractSignatureResponse( field = data.get("created", None) if field is not None: args["created"] = field + else: + args["created"] = False field = data.get("validated", None) if field is not None: args["validated"] = field + else: + args["validated"] = False return CheckContractSignatureResponse(**args) @@ -404,6 +452,8 @@ def unmarshal_ListContractSignaturesResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("contract_signatures", None) if field is not None: @@ -412,6 +462,8 @@ def unmarshal_ListContractSignaturesResponse( if field is not None else None ) + else: + args["contract_signatures"] = field(default_factory=list) return ListContractSignaturesResponse(**args) @@ -427,12 +479,16 @@ def unmarshal_ListProjectsResponse(data: Any) -> ListProjectsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("projects", None) if field is not None: args["projects"] = ( [unmarshal_Project(v) for v in field] if field is not None else None ) + else: + args["projects"] = field(default_factory=list) return ListProjectsResponse(**args) @@ -448,6 +504,8 @@ def unmarshal_ProjectQualification(data: Any) -> ProjectQualification: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("qualification", None) if field is not None: @@ -468,12 +526,12 @@ def marshal_ContractApiCheckContractSignatureRequest( output["contract_name"] = request.contract_name if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id if request.contract_type is not None: - output["contract_type"] = str(request.contract_type) + output["contract_type"] = request.contract_type return output @@ -491,12 +549,12 @@ def marshal_ContractApiCreateContractSignatureRequest( output["validated"] = request.validated if request.contract_type is not None: - output["contract_type"] = str(request.contract_type) + output["contract_type"] = request.contract_type if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id return output @@ -514,9 +572,9 @@ def marshal_ProjectApiCreateProjectRequest( output["name"] = request.name if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id return output @@ -528,7 +586,7 @@ def marshal_QualificationAiMachine( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -540,7 +598,7 @@ def marshal_QualificationArchiveData( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -552,7 +610,7 @@ def marshal_QualificationContainer( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -564,7 +622,7 @@ def marshal_QualificationDeploySoftware( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -576,7 +634,7 @@ def marshal_QualificationHostApplication( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -588,7 +646,7 @@ def marshal_QualificationHostWebsite( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -600,7 +658,7 @@ def marshal_QualificationOtherUseCase( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -612,7 +670,7 @@ def marshal_QualificationSetScalewayEnvironment( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -624,7 +682,7 @@ def marshal_QualificationShareData( output: Dict[str, Any] = {} if request.sub_use_case is not None: - output["sub_use_case"] = str(request.sub_use_case) + output["sub_use_case"] = request.sub_use_case return output @@ -687,7 +745,7 @@ def marshal_Qualification( ) if request.architecture_type is not None: - output["architecture_type"] = str(request.architecture_type) + output["architecture_type"] = request.architecture_type return output diff --git a/scaleway/scaleway/account/v3/types.py b/scaleway/scaleway/account/v3/types.py index d8c33dddd..91b87308c 100644 --- a/scaleway/scaleway/account/v3/types.py +++ b/scaleway/scaleway/account/v3/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -201,12 +201,12 @@ class Contract: The version of the contract. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ The creation date of the contract. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ The last modification date of the contract. """ @@ -219,23 +219,23 @@ class Qualification: Architecture type of the qualification. """ - host_website: Optional[QualificationHostWebsite] + host_website: Optional[QualificationHostWebsite] = None - host_application: Optional[QualificationHostApplication] + host_application: Optional[QualificationHostApplication] = None - deploy_software: Optional[QualificationDeploySoftware] + deploy_software: Optional[QualificationDeploySoftware] = None - set_scaleway_environment: Optional[QualificationSetScalewayEnvironment] + set_scaleway_environment: Optional[QualificationSetScalewayEnvironment] = None - ai_machine: Optional[QualificationAiMachine] + ai_machine: Optional[QualificationAiMachine] = None - container: Optional[QualificationContainer] + container: Optional[QualificationContainer] = None - archive_data: Optional[QualificationArchiveData] + archive_data: Optional[QualificationArchiveData] = None - share_data: Optional[QualificationShareData] + share_data: Optional[QualificationShareData] = None - other_use_case: Optional[QualificationOtherUseCase] + other_use_case: Optional[QualificationOtherUseCase] = None @dataclass @@ -250,22 +250,22 @@ class ContractSignature: The Organization ID which signed the contract. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ The creation date of the contract signature. """ - signed_at: Optional[datetime] + signed_at: Optional[datetime] = None """ The signing date of the contract signature. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ The expiration date of the contract signature. """ - contract: Optional[Contract] + contract: Optional[Contract] = None """ The contract signed. """ @@ -293,17 +293,17 @@ class Project: Description of the Project. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the Project. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Update date of the Project. """ - qualification: Optional[Qualification] + qualification: Optional[Qualification] = None """ Qualification of the Project. """ @@ -329,12 +329,12 @@ class ContractApiCheckContractSignatureRequest: Filter on contract name. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization to check the contract signature for. """ - contract_type: Optional[ContractType] + contract_type: Optional[ContractType] = ContractType.UNKNOWN_TYPE """ Filter on contract type. """ @@ -352,12 +352,12 @@ class ContractApiCreateContractSignatureRequest: Whether the contract is validated at creation. """ - contract_type: Optional[ContractType] + contract_type: Optional[ContractType] = ContractType.UNKNOWN_TYPE """ The type of the contract. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -370,7 +370,7 @@ class ContractApiDownloadContractSignatureRequest: The contract signature ID. """ - locale: Optional[StdLanguageCode] + locale: Optional[StdLanguageCode] = StdLanguageCode.UNKNOWN_LANGUAGE_CODE """ The locale requested for the content of the contract. """ @@ -378,22 +378,24 @@ class ContractApiDownloadContractSignatureRequest: @dataclass class ContractApiListContractSignaturesRequest: - page: Optional[int] + page: Optional[int] = 0 """ The page number for the returned contracts. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The maximum number of contracts per page. """ - order_by: Optional[ListContractSignaturesRequestOrderBy] + order_by: Optional[ListContractSignaturesRequestOrderBy] = ( + ListContractSignaturesRequestOrderBy.SIGNED_AT_ASC + ) """ How the contracts are ordered in the response. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter on Organization ID. """ @@ -440,12 +442,12 @@ class ProjectApiCreateProjectRequest: Description of the Project. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Project. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID of the Project. """ @@ -453,7 +455,7 @@ class ProjectApiCreateProjectRequest: @dataclass class ProjectApiDeleteProjectRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the Project. """ @@ -461,7 +463,7 @@ class ProjectApiDeleteProjectRequest: @dataclass class ProjectApiGetProjectRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the Project. """ @@ -469,32 +471,34 @@ class ProjectApiGetProjectRequest: @dataclass class ProjectApiListProjectsRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID of the Project. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Project. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned Projects. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Project per page. """ - order_by: Optional[ListProjectsRequestOrderBy] + order_by: Optional[ListProjectsRequestOrderBy] = ( + ListProjectsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the returned Projects. """ - project_ids: Optional[List[str]] + project_ids: Optional[List[str]] = field(default_factory=list) """ Project IDs to filter for. The results will be limited to any Projects with an ID in this array. """ @@ -502,12 +506,12 @@ class ProjectApiListProjectsRequest: @dataclass class ProjectApiSetProjectQualificationRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ - qualification: Optional[Qualification] + qualification: Optional[Qualification] = None """ Use case chosen for the Project. """ @@ -515,17 +519,17 @@ class ProjectApiSetProjectQualificationRequest: @dataclass class ProjectApiUpdateProjectRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the Project. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Project. """ - description: Optional[str] + description: Optional[str] = None """ Description of the Project. """ @@ -538,7 +542,7 @@ class ProjectQualification: Project ID. """ - qualification: Optional[Qualification] + qualification: Optional[Qualification] = None """ Qualification of the Project. """ diff --git a/scaleway/scaleway/applesilicon/v1alpha1/marshalling.py b/scaleway/scaleway/applesilicon/v1alpha1/marshalling.py index eb23a6f6d..2be2d6250 100644 --- a/scaleway/scaleway/applesilicon/v1alpha1/marshalling.py +++ b/scaleway/scaleway/applesilicon/v1alpha1/marshalling.py @@ -7,6 +7,10 @@ from scaleway_core.profile import ProfileDefaults from .types import ( ConnectivityDiagnosticActionType, + ServerPrivateNetworkServerStatus, + ServerPrivateNetworkStatus, + ServerStatus, + ServerTypeStock, OS, Commitment, Server, @@ -49,38 +53,56 @@ def unmarshal_OS(data: Any) -> OS: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("label", None) if field is not None: args["label"] = field + else: + args["label"] = None field = data.get("image_url", None) if field is not None: args["image_url"] = field + else: + args["image_url"] = None field = data.get("family", None) if field is not None: args["family"] = field + else: + args["family"] = None field = data.get("is_beta", None) if field is not None: args["is_beta"] = field + else: + args["is_beta"] = False field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("xcode_version", None) if field is not None: args["xcode_version"] = field + else: + args["xcode_version"] = None field = data.get("compatible_server_types", None) if field is not None: args["compatible_server_types"] = field + else: + args["compatible_server_types"] = field(default_factory=list) return OS(**args) @@ -96,10 +118,14 @@ def unmarshal_Commitment(data: Any) -> Commitment: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("cancelled", None) if field is not None: args["cancelled"] = field + else: + args["cancelled"] = None return Commitment(**args) @@ -115,46 +141,68 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("vnc_url", None) if field is not None: args["vnc_url"] = field + else: + args["vnc_url"] = None field = data.get("ssh_username", None) if field is not None: args["ssh_username"] = field + else: + args["ssh_username"] = None field = data.get("sudo_password", None) if field is not None: args["sudo_password"] = field + else: + args["sudo_password"] = None field = data.get("vnc_port", None) if field is not None: args["vnc_port"] = field + else: + args["vnc_port"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerStatus.UNKNOWN_STATUS field = data.get("os", None) if field is not None: @@ -185,22 +233,32 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("deletion_scheduled", None) if field is not None: args["deletion_scheduled"] = field + else: + args["deletion_scheduled"] = False field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("delivered", None) if field is not None: args["delivered"] = field + else: + args["delivered"] = False field = data.get("vpc_status", None) if field is not None: args["vpc_status"] = field + else: + args["vpc_status"] = ServerPrivateNetworkStatus.VPC_UNKNOWN_STATUS field = data.get("public_bandwidth_bps", None) if field is not None: args["public_bandwidth_bps"] = field + else: + args["public_bandwidth_bps"] = 0 field = data.get("commitment", None) if field is not None: @@ -222,32 +280,44 @@ def unmarshal_ServerPrivateNetwork(data: Any) -> ServerPrivateNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("server_id", None) if field is not None: args["server_id"] = field + else: + args["server_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerPrivateNetworkServerStatus.UNKNOWN_STATUS field = data.get("ipam_ip_ids", None) if field is not None: args["ipam_ip_ids"] = field + else: + args["ipam_ip_ids"] = field(default_factory=list) field = data.get("vlan", None) if field is not None: args["vlan"] = field else: - args["vlan"] = None + args["vlan"] = 0 field = data.get("created_at", None) if field is not None: @@ -275,14 +345,20 @@ def unmarshal_ServerTypeCPU(data: Any) -> ServerTypeCPU: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("core_count", None) if field is not None: args["core_count"] = field + else: + args["core_count"] = None field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = None return ServerTypeCPU(**args) @@ -298,10 +374,14 @@ def unmarshal_ServerTypeDisk(data: Any) -> ServerTypeDisk: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return ServerTypeDisk(**args) @@ -317,6 +397,8 @@ def unmarshal_ServerTypeGPU(data: Any) -> ServerTypeGPU: field = data.get("count", None) if field is not None: args["count"] = field + else: + args["count"] = None return ServerTypeGPU(**args) @@ -332,10 +414,14 @@ def unmarshal_ServerTypeMemory(data: Any) -> ServerTypeMemory: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return ServerTypeMemory(**args) @@ -351,10 +437,14 @@ def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork: field = data.get("public_bandwidth_bps", None) if field is not None: args["public_bandwidth_bps"] = field + else: + args["public_bandwidth_bps"] = None field = data.get("supported_bandwidth", None) if field is not None: args["supported_bandwidth"] = field + else: + args["supported_bandwidth"] = None return ServerTypeNetwork(**args) @@ -370,10 +460,14 @@ def unmarshal_ServerType(data: Any) -> ServerType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock", None) if field is not None: args["stock"] = field + else: + args["stock"] = ServerTypeStock.UNKNOWN_STOCK field = data.get("cpu", None) if field is not None: @@ -433,6 +527,8 @@ def unmarshal_BatchCreateServersResponse(data: Any) -> BatchCreateServersRespons args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return BatchCreateServersResponse(**args) @@ -450,22 +546,32 @@ def unmarshal_ConnectivityDiagnosticServerHealth( field = data.get("is_server_alive", None) if field is not None: args["is_server_alive"] = field + else: + args["is_server_alive"] = None field = data.get("is_agent_alive", None) if field is not None: args["is_agent_alive"] = field + else: + args["is_agent_alive"] = None field = data.get("is_mdm_alive", None) if field is not None: args["is_mdm_alive"] = field + else: + args["is_mdm_alive"] = None field = data.get("is_ssh_port_up", None) if field is not None: args["is_ssh_port_up"] = field + else: + args["is_ssh_port_up"] = None field = data.get("is_vnc_port_up", None) if field is not None: args["is_vnc_port_up"] = field + else: + args["is_vnc_port_up"] = None field = data.get("last_checkin_date", None) if field is not None: @@ -489,14 +595,20 @@ def unmarshal_ConnectivityDiagnostic(data: Any) -> ConnectivityDiagnostic: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("is_healthy", None) if field is not None: args["is_healthy"] = field + else: + args["is_healthy"] = None field = data.get("supported_actions", None) if field is not None: @@ -505,10 +617,14 @@ def unmarshal_ConnectivityDiagnostic(data: Any) -> ConnectivityDiagnostic: if field is not None else None ) + else: + args["supported_actions"] = None field = data.get("error_message", None) if field is not None: args["error_message"] = field + else: + args["error_message"] = None field = data.get("health_details", None) if field is not None: @@ -530,10 +646,14 @@ def unmarshal_ListOSResponse(data: Any) -> ListOSResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("os", None) if field is not None: args["os"] = [unmarshal_OS(v) for v in field] if field is not None else None + else: + args["os"] = field(default_factory=list) return ListOSResponse(**args) @@ -555,10 +675,14 @@ def unmarshal_ListServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListServerPrivateNetworksResponse(**args) @@ -576,6 +700,8 @@ def unmarshal_ListServerTypesResponse(data: Any) -> ListServerTypesResponse: args["server_types"] = ( [unmarshal_ServerType(v) for v in field] if field is not None else None ) + else: + args["server_types"] = field(default_factory=list) return ListServerTypesResponse(**args) @@ -591,12 +717,16 @@ def unmarshal_ListServersResponse(data: Any) -> ListServersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListServersResponse(**args) @@ -618,6 +748,8 @@ def unmarshal_SetServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None return SetServerPrivateNetworksResponse(**args) @@ -635,6 +767,8 @@ def unmarshal_StartConnectivityDiagnosticResponse( field = data.get("diagnostic_id", None) if field is not None: args["diagnostic_id"] = field + else: + args["diagnostic_id"] = None return StartConnectivityDiagnosticResponse(**args) @@ -667,13 +801,15 @@ def marshal_BatchCreateServersRequest( output["public_bandwidth_bps"] = request.public_bandwidth_bps if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.os_id is not None: output["os_id"] = request.os_id if request.commitment_type is not None: - output["commitment_type"] = str(request.commitment_type) + output["commitment_type"] = request.commitment_type if request.requests is not None: output["requests"] = [ @@ -705,13 +841,15 @@ def marshal_CreateServerRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.os_id is not None: output["os_id"] = request.os_id if request.commitment_type is not None: - output["commitment_type"] = str(request.commitment_type) + output["commitment_type"] = request.commitment_type return output @@ -776,7 +914,7 @@ def marshal_CommitmentTypeValue( output: Dict[str, Any] = {} if request.commitment_type is not None: - output["commitment_type"] = str(request.commitment_type) + output["commitment_type"] = request.commitment_type return output diff --git a/scaleway/scaleway/applesilicon/v1alpha1/types.py b/scaleway/scaleway/applesilicon/v1alpha1/types.py index 8831b428f..bd95d4970 100644 --- a/scaleway/scaleway/applesilicon/v1alpha1/types.py +++ b/scaleway/scaleway/applesilicon/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -112,7 +112,6 @@ def __str__(self) -> str: @dataclass class Commitment: type_: CommitmentType - cancelled: bool @@ -167,16 +166,13 @@ class OS: @dataclass class ServerTypeCPU: name: str - core_count: int - frequency: int @dataclass class ServerTypeDisk: capacity: int - type_: str @@ -188,14 +184,12 @@ class ServerTypeGPU: @dataclass class ServerTypeMemory: capacity: int - type_: str @dataclass class ServerTypeNetwork: public_bandwidth_bps: int - supported_bandwidth: List[int] @@ -261,52 +255,52 @@ class Server: Current status of the server. """ - os: Optional[OS] + deletion_scheduled: bool """ - Initially installed OS, this does not necessarily reflect the current OS version. + Set to true to mark the server for automatic deletion depending on `deletable_at` date. Set to false to cancel an existing deletion schedule. Leave unset otherwise. """ - created_at: Optional[datetime] + zone: ScwZone """ - Date on which the server was created. + Zone of the server. """ - updated_at: Optional[datetime] + delivered: bool """ - Date on which the server was last updated. + Set to true once the server has completed its provisioning steps and is ready to use. Some OS configurations might require a reinstallation of the server before delivery depending on the available stock. A reinstallation after the initial delivery will not change this flag and can be tracked using the server status. """ - deletable_at: Optional[datetime] + vpc_status: ServerPrivateNetworkStatus """ - Date from which the server can be deleted. + Activation status of optional Private Network feature support for this server. """ - deletion_scheduled: bool + public_bandwidth_bps: int """ - Set to true to mark the server for automatic deletion depending on `deletable_at` date. Set to false to cancel an existing deletion schedule. Leave unset otherwise. + Public bandwidth configured for this server. Expressed in bits per second. """ - zone: ScwZone + os: Optional[OS] = None """ - Zone of the server. + Initially installed OS, this does not necessarily reflect the current OS version. """ - delivered: bool + created_at: Optional[datetime] = None """ - Set to true once the server has completed its provisioning steps and is ready to use. Some OS configurations might require a reinstallation of the server before delivery depending on the available stock. A reinstallation after the initial delivery will not change this flag and can be tracked using the server status. + Date on which the server was created. """ - vpc_status: ServerPrivateNetworkStatus + updated_at: Optional[datetime] = None """ - Activation status of optional Private Network feature support for this server. + Date on which the server was last updated. """ - public_bandwidth_bps: int + deletable_at: Optional[datetime] = None """ - Public bandwidth configured for this server. Expressed in bits per second. + Date from which the server can be deleted. """ - commitment: Optional[Commitment] + commitment: Optional[Commitment] = None """ Commitment scheme applied to this server. """ @@ -315,16 +309,11 @@ class Server: @dataclass class ConnectivityDiagnosticServerHealth: is_server_alive: bool - is_agent_alive: bool - is_mdm_alive: bool - is_ssh_port_up: bool - is_vnc_port_up: bool - - last_checkin_date: Optional[datetime] + last_checkin_date: Optional[datetime] = None @dataclass @@ -359,17 +348,17 @@ class ServerPrivateNetwork: IPAM IP IDs of the server, if it has any. """ - vlan: Optional[int] + vlan: Optional[int] = 0 """ ID of the VLAN associated with the Private Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Private Network creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the Private Network was last modified. """ @@ -387,37 +376,37 @@ class ServerType: Current stock. """ - cpu: Optional[ServerTypeCPU] + cpu: Optional[ServerTypeCPU] = None """ CPU description. """ - disk: Optional[ServerTypeDisk] + disk: Optional[ServerTypeDisk] = None """ Size of the local disk of the server. """ - memory: Optional[ServerTypeMemory] + memory: Optional[ServerTypeMemory] = None """ Size of memory available. """ - minimum_lease_duration: Optional[str] + minimum_lease_duration: Optional[str] = None """ Minimum duration of the lease in seconds (example. 3.4s). """ - gpu: Optional[ServerTypeGPU] + gpu: Optional[ServerTypeGPU] = None """ GPU description. """ - network: Optional[ServerTypeNetwork] + network: Optional[ServerTypeNetwork] = None """ Network description. """ - default_os: Optional[OS] + default_os: Optional[OS] = None """ The default OS for this server type. """ @@ -445,27 +434,29 @@ class BatchCreateServersRequest: Public bandwidth to configure for these servers. This defaults to the minimum bandwidth for the corresponding server type. For compatible server types, the bandwidth can be increased which incurs additional costs. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Create servers in the given project ID. """ - os_id: Optional[str] + os_id: Optional[str] = None """ Create servers & install the given os_id, when no os_id provided the default OS for this server type is chosen. Requesting a non-default OS will induce an extended delivery time. """ - commitment_type: Optional[CommitmentType] + commitment_type: Optional[CommitmentType] = CommitmentType.DURATION_24H """ Activate commitment for these servers. If not specified, there is a 24h commitment due to Apple licensing (commitment_type `duration_24h`). It can be updated with the Update Server request. Available commitment depends on server type. """ - requests: Optional[List[BatchCreateServersRequestBatchInnerCreateServerRequest]] + requests: Optional[List[BatchCreateServersRequestBatchInnerCreateServerRequest]] = ( + field(default_factory=list) + ) """ List of servers to create. """ @@ -482,16 +473,11 @@ class BatchCreateServersResponse: @dataclass class ConnectivityDiagnostic: id: str - status: ConnectivityDiagnosticDiagnosticStatus - is_healthy: bool - supported_actions: List[ConnectivityDiagnosticActionType] - error_message: str - - health_details: Optional[ConnectivityDiagnosticServerHealth] + health_details: Optional[ConnectivityDiagnosticServerHealth] = None @dataclass @@ -511,27 +497,27 @@ class CreateServerRequest: Public bandwidth to configure for this server. This defaults to the minimum bandwidth for this server type. For compatible server types, the bandwidth can be increased which incurs additional costs. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Create a server with this given name. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Create a server in the given project ID. """ - os_id: Optional[str] + os_id: Optional[str] = None """ Create a server & install the given os_id, when no os_id provided the default OS for this server type is chosen. Requesting a non-default OS will induce an extended delivery time. """ - commitment_type: Optional[CommitmentType] + commitment_type: Optional[CommitmentType] = CommitmentType.DURATION_24H """ Activate commitment for this server. If not specified, there is a 24h commitment due to Apple licensing (commitment_type `duration_24h`). It can be updated with the Update Server request. Available commitment depends on server type. """ @@ -544,7 +530,7 @@ class DeleteServerRequest: UUID of the server you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -553,8 +539,7 @@ class DeleteServerRequest: @dataclass class GetConnectivityDiagnosticRequest: diagnostic_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -567,7 +552,7 @@ class GetOSRequest: UUID of the OS you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -580,7 +565,7 @@ class GetServerRequest: UUID of the server you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -593,7 +578,7 @@ class GetServerTypeRequest: Server type identifier. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -601,27 +586,27 @@ class GetServerTypeRequest: @dataclass class ListOSRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Positive integer to choose the page to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - server_type: Optional[str] + server_type: Optional[str] = None """ List of compatible server types. """ - name: Optional[str] + name: Optional[str] = None """ Filter OS by name (note that "11.1" will return "11.1.2" and "11.1" but not "12")). """ @@ -643,13 +628,12 @@ class ListOSResponse: @dataclass class ListServerPrivateNetworksResponse: server_private_networks: List[ServerPrivateNetwork] - total_count: int @dataclass class ListServerTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -665,32 +649,34 @@ class ListServerTypesResponse: @dataclass class ListServersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListServersRequestOrderBy] + order_by: Optional[ListServersRequestOrderBy] = ( + ListServersRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the returned servers. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Only list servers of this project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Only list servers of this Organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Positive integer to choose the page to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ @@ -721,12 +707,12 @@ class PrivateNetworkApiAddServerPrivateNetworkRequest: ID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ipam_ip_ids: Optional[List[str]] + ipam_ip_ids: Optional[List[str]] = field(default_factory=list) """ IPAM IDs of IPs to attach to the server. """ @@ -744,7 +730,7 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: ID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -753,10 +739,8 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: @dataclass class PrivateNetworkApiGetServerPrivateNetworkRequest: server_id: str - private_network_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -764,47 +748,49 @@ class PrivateNetworkApiGetServerPrivateNetworkRequest: @dataclass class PrivateNetworkApiListServerPrivateNetworksRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListServerPrivateNetworksRequestOrderBy] + order_by: Optional[ListServerPrivateNetworksRequestOrderBy] = ( + ListServerPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for the returned Private Networks. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned Private Networks. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Private Networks per page. """ - server_id: Optional[str] + server_id: Optional[str] = None """ Filter Private Networks by server ID. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Filter Private Networks by Private Network ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter Private Networks by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter Private Networks by Project ID. """ - ipam_ip_ids: Optional[List[str]] + ipam_ip_ids: Optional[List[str]] = field(default_factory=list) """ Filter Private Networks by IPAM IP IDs. """ @@ -822,7 +808,7 @@ class PrivateNetworkApiSetServerPrivateNetworksRequest: Object where the keys are the IDs of Private Networks and the values are arrays of IPAM IDs representing the IPs to assign to this Apple silicon server on the Private Network. If the array supplied for a Private Network is empty, the next available IP from the Private Network's CIDR block will automatically be used for attachment. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -835,7 +821,7 @@ class RebootServerRequest: UUID of the server you want to reboot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -848,12 +834,12 @@ class ReinstallServerRequest: UUID of the server you want to reinstall. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - os_id: Optional[str] + os_id: Optional[str] = None """ Reinstall the server with the target OS, when no os_id provided the default OS for the server type is used. """ @@ -867,8 +853,7 @@ class SetServerPrivateNetworksResponse: @dataclass class StartConnectivityDiagnosticRequest: server_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -886,32 +871,32 @@ class UpdateServerRequest: UUID of the server you want to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Updated name for your server. """ - schedule_deletion: Optional[bool] + schedule_deletion: Optional[bool] = False """ Specify whether the server should be flagged for automatic deletion. """ - enable_vpc: Optional[bool] + enable_vpc: Optional[bool] = False """ Activate or deactivate Private Network support for this server. """ - commitment_type: Optional[CommitmentTypeValue] + commitment_type: Optional[CommitmentTypeValue] = None """ Change commitment. Use 'none' to automatically cancel a renewing commitment. """ - public_bandwidth_bps: Optional[int] + public_bandwidth_bps: Optional[int] = 0 """ Public bandwidth to configure for this server. Setting an higher bandwidth incurs additional costs. Supported bandwidth levels depends on server type and can be queried using the `/server-types` endpoint. """ diff --git a/scaleway/scaleway/audit_trail/v1alpha1/__init__.py b/scaleway/scaleway/audit_trail/v1alpha1/__init__.py index 6325b9583..baf6c38b5 100644 --- a/scaleway/scaleway/audit_trail/v1alpha1/__init__.py +++ b/scaleway/scaleway/audit_trail/v1alpha1/__init__.py @@ -17,6 +17,7 @@ from .types import SecretManagerSecretInfo from .types import SecretManagerSecretVersionInfo from .types import EventPrincipal +from .types import EventSystem from .types import Resource from .types import ProductService from .types import Event @@ -45,6 +46,7 @@ "SecretManagerSecretInfo", "SecretManagerSecretVersionInfo", "EventPrincipal", + "EventSystem", "Resource", "ProductService", "Event", diff --git a/scaleway/scaleway/audit_trail/v1alpha1/marshalling.py b/scaleway/scaleway/audit_trail/v1alpha1/marshalling.py index 32ea3154c..90a64449b 100644 --- a/scaleway/scaleway/audit_trail/v1alpha1/marshalling.py +++ b/scaleway/scaleway/audit_trail/v1alpha1/marshalling.py @@ -20,6 +20,7 @@ SecretManagerSecretInfo, SecretManagerSecretVersionInfo, EventPrincipal, + EventSystem, Resource, Event, ListEventsResponse, @@ -51,6 +52,8 @@ def unmarshal_AccountProjectInfo(data: Any) -> AccountProjectInfo: field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None return AccountProjectInfo(**args) @@ -66,6 +69,8 @@ def unmarshal_AccountUserInfo(data: Any) -> AccountUserInfo: field = data.get("email", None) if field is not None: args["email"] = field + else: + args["email"] = None field = data.get("phone_number", None) if field is not None: @@ -87,10 +92,14 @@ def unmarshal_AppleSiliconServerInfo(data: Any) -> AppleSiliconServerInfo: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return AppleSiliconServerInfo(**args) @@ -106,10 +115,14 @@ def unmarshal_BaremetalServerInfo(data: Any) -> BaremetalServerInfo: field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = None return BaremetalServerInfo(**args) @@ -125,6 +138,8 @@ def unmarshal_BaremetalSettingInfo(data: Any) -> BaremetalSettingInfo: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return BaremetalSettingInfo(**args) @@ -140,6 +155,8 @@ def unmarshal_InstanceServerInfo(data: Any) -> InstanceServerInfo: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return InstanceServerInfo(**args) @@ -188,10 +205,14 @@ def unmarshal_KubernetesNodeInfo(data: Any) -> KubernetesNodeInfo: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return KubernetesNodeInfo(**args) @@ -207,10 +228,14 @@ def unmarshal_KubernetesPoolInfo(data: Any) -> KubernetesPoolInfo: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return KubernetesPoolInfo(**args) @@ -226,6 +251,8 @@ def unmarshal_SecretManagerSecretInfo(data: Any) -> SecretManagerSecretInfo: field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None field = data.get("key_id", None) if field is not None: @@ -249,6 +276,8 @@ def unmarshal_SecretManagerSecretVersionInfo( field = data.get("revision", None) if field is not None: args["revision"] = field + else: + args["revision"] = None return SecretManagerSecretVersionInfo(**args) @@ -264,10 +293,29 @@ def unmarshal_EventPrincipal(data: Any) -> EventPrincipal: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None return EventPrincipal(**args) +def unmarshal_EventSystem(data: Any) -> EventSystem: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'EventSystem' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("name", None) + if field is not None: + args["name"] = field + else: + args["name"] = None + + return EventSystem(**args) + + def unmarshal_Resource(data: Any) -> Resource: if not isinstance(data, dict): raise TypeError( @@ -279,10 +327,14 @@ def unmarshal_Resource(data: Any) -> Resource: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("created_at", None) if field is not None: @@ -428,22 +480,44 @@ def unmarshal_Event(data: Any) -> Event: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("locality", None) if field is not None: args["locality"] = field + else: + args["locality"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("source_ip", None) if field is not None: args["source_ip"] = field + else: + args["source_ip"] = None field = data.get("product_name", None) if field is not None: args["product_name"] = field + else: + args["product_name"] = None + + field = data.get("service_name", None) + if field is not None: + args["service_name"] = field + else: + args["service_name"] = None + + field = data.get("method_name", None) + if field is not None: + args["method_name"] = field + else: + args["method_name"] = None field = data.get("recorded_at", None) if field is not None: @@ -459,45 +533,49 @@ def unmarshal_Event(data: Any) -> Event: else: args["principal"] = None - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - else: - args["project_id"] = None - - field = data.get("user_agent", None) - if field is not None: - args["user_agent"] = field - else: - args["user_agent"] = None - - field = data.get("service_name", None) - if field is not None: - args["service_name"] = field - - field = data.get("method_name", None) - if field is not None: - args["method_name"] = field - field = data.get("resources", None) if field is not None: args["resources"] = ( [unmarshal_Resource(v) for v in field] if field is not None else None ) + else: + args["resources"] = field(default_factory=list) field = data.get("request_id", None) if field is not None: args["request_id"] = field + else: + args["request_id"] = None field = data.get("status_code", None) if field is not None: args["status_code"] = field + else: + args["status_code"] = 0 + + field = data.get("system", None) + if field is not None: + args["system"] = unmarshal_EventSystem(field) + else: + args["system"] = None + + field = data.get("project_id", None) + if field is not None: + args["project_id"] = field + else: + args["project_id"] = None + + field = data.get("user_agent", None) + if field is not None: + args["user_agent"] = field + else: + args["user_agent"] = None field = data.get("request_body", None) if field is not None: args["request_body"] = field else: - args["request_body"] = None + args["request_body"] = field(default_factory=dict) return Event(**args) @@ -515,6 +593,8 @@ def unmarshal_ListEventsResponse(data: Any) -> ListEventsResponse: args["events"] = ( [unmarshal_Event(v) for v in field] if field is not None else None ) + else: + args["events"] = field(default_factory=list) field = data.get("next_page_token", None) if field is not None: @@ -536,10 +616,14 @@ def unmarshal_ProductService(data: Any) -> ProductService: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("methods", None) if field is not None: args["methods"] = field + else: + args["methods"] = None return ProductService(**args) @@ -555,16 +639,22 @@ def unmarshal_Product(data: Any) -> Product: field = data.get("title", None) if field is not None: args["title"] = field + else: + args["title"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("services", None) if field is not None: args["services"] = ( [unmarshal_ProductService(v) for v in field] if field is not None else None ) + else: + args["services"] = field(default_factory=list) return Product(**args) @@ -582,9 +672,13 @@ def unmarshal_ListProductsResponse(data: Any) -> ListProductsResponse: args["products"] = ( [unmarshal_Product(v) for v in field] if field is not None else None ) + else: + args["products"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListProductsResponse(**args) diff --git a/scaleway/scaleway/audit_trail/v1alpha1/types.py b/scaleway/scaleway/audit_trail/v1alpha1/types.py index 16fd831c7..a9dc82b68 100644 --- a/scaleway/scaleway/audit_trail/v1alpha1/types.py +++ b/scaleway/scaleway/audit_trail/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Any, Dict, List, Optional @@ -67,21 +67,18 @@ class AccountProjectInfo: @dataclass class AccountUserInfo: email: str - - phone_number: Optional[str] + phone_number: Optional[str] = None @dataclass class AppleSiliconServerInfo: id: str - name: str @dataclass class BaremetalServerInfo: description: str - tags: List[str] @@ -113,22 +110,19 @@ class KubernetesClusterInfo: @dataclass class KubernetesNodeInfo: id: str - name: str @dataclass class KubernetesPoolInfo: id: str - name: str @dataclass class SecretManagerSecretInfo: path: str - - key_id: Optional[str] + key_id: Optional[str] = None @dataclass @@ -141,59 +135,57 @@ class EventPrincipal: id: str +@dataclass +class EventSystem: + name: str + + @dataclass class Resource: id: str - type_: ResourceType + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + deleted_at: Optional[datetime] = None + name: Optional[str] = None + secm_secret_info: Optional[SecretManagerSecretInfo] = None - created_at: Optional[datetime] - - updated_at: Optional[datetime] - - deleted_at: Optional[datetime] + secm_secret_version_info: Optional[SecretManagerSecretVersionInfo] = None - name: Optional[str] + kube_cluster_info: Optional[KubernetesClusterInfo] = None - secm_secret_info: Optional[SecretManagerSecretInfo] + kube_pool_info: Optional[KubernetesPoolInfo] = None - secm_secret_version_info: Optional[SecretManagerSecretVersionInfo] + kube_node_info: Optional[KubernetesNodeInfo] = None - kube_cluster_info: Optional[KubernetesClusterInfo] + kube_acl_info: Optional[KubernetesACLInfo] = None - kube_pool_info: Optional[KubernetesPoolInfo] + keym_key_info: Optional[KeyManagerKeyInfo] = None - kube_node_info: Optional[KubernetesNodeInfo] + secret_manager_secret_info: Optional[SecretManagerSecretInfo] = None - kube_acl_info: Optional[KubernetesACLInfo] + secret_manager_version_info: Optional[SecretManagerSecretVersionInfo] = None - keym_key_info: Optional[KeyManagerKeyInfo] + key_manager_key_info: Optional[KeyManagerKeyInfo] = None - secret_manager_secret_info: Optional[SecretManagerSecretInfo] + account_user_info: Optional[AccountUserInfo] = None - secret_manager_version_info: Optional[SecretManagerSecretVersionInfo] + account_organization_info: Optional[AccountOrganizationInfo] = None - key_manager_key_info: Optional[KeyManagerKeyInfo] + instance_server_info: Optional[InstanceServerInfo] = None - account_user_info: Optional[AccountUserInfo] + apple_silicon_server_info: Optional[AppleSiliconServerInfo] = None - account_organization_info: Optional[AccountOrganizationInfo] + account_project_info: Optional[AccountProjectInfo] = None - instance_server_info: Optional[InstanceServerInfo] + baremetal_server_info: Optional[BaremetalServerInfo] = None - apple_silicon_server_info: Optional[AppleSiliconServerInfo] - - account_project_info: Optional[AccountProjectInfo] - - baremetal_server_info: Optional[BaremetalServerInfo] - - baremetal_setting_info: Optional[BaremetalSettingInfo] + baremetal_setting_info: Optional[BaremetalSettingInfo] = None @dataclass class ProductService: name: str - methods: List[str] @@ -224,26 +216,6 @@ class Event: Product name of the resource attached to the event. """ - recorded_at: Optional[datetime] - """ - Timestamp of the event. - """ - - principal: Optional[EventPrincipal] - """ - User or IAM application at the origin of the event. - """ - - project_id: Optional[str] - """ - (Optional) Project of the resource attached to the event. - """ - - user_agent: Optional[str] - """ - User Agent at the origin of the event. - """ - service_name: str """ API name called to trigger the event. @@ -269,11 +241,30 @@ class Event: HTTP status code resulting of the API call. """ - request_body: Optional[Dict[str, Any]] + recorded_at: Optional[datetime] = None + """ + Timestamp of the event. + """ + + project_id: Optional[str] = None + """ + (Optional) Project of the resource attached to the event. + """ + + user_agent: Optional[str] = None + """ + User Agent at the origin of the event. + """ + + request_body: Optional[Dict[str, Any]] = field(default_factory=dict) """ Request at the origin of the event. """ + principal: Optional[EventPrincipal] = None + + system: Optional[EventSystem] = None + @dataclass class Product: @@ -295,58 +286,57 @@ class Product: @dataclass class ListEventsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ (Optional) ID of the Project containing the Audit Trail events. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization containing the Audit Trail events. """ - resource_type: Optional[ResourceType] + resource_type: Optional[ResourceType] = ResourceType.UNKNOWN_TYPE """ (Optional) Returns a paginated list of Scaleway resources' features. """ - method_name: Optional[str] + method_name: Optional[str] = None """ (Optional) Name of the method of the API call performed. """ - status: Optional[int] + status: Optional[int] = 0 """ (Optional) HTTP status code of the request. Returns either `200` if the request was successful or `403` if the permission was denied. """ - recorded_after: Optional[datetime] + recorded_after: Optional[datetime] = None """ (Optional) The `recorded_after` parameter defines the earliest timestamp from which Audit Trail events are retrieved. Returns `one hour ago` by default. """ - recorded_before: Optional[datetime] + recorded_before: Optional[datetime] = None """ (Optional) The `recorded_before` parameter defines the latest timestamp up to which Audit Trail events are retrieved. Returns `now` by default. """ - order_by: Optional[ListEventsRequestOrderBy] - - page_size: Optional[int] - - page_token: Optional[str] - - product_name: Optional[str] + order_by: Optional[ListEventsRequestOrderBy] = ( + ListEventsRequestOrderBy.RECORDED_AT_DESC + ) + page_size: Optional[int] = 0 + page_token: Optional[str] = None + product_name: Optional[str] = None """ (Optional) Name of the Scaleway resource in a hyphenated format. """ - service_name: Optional[str] + service_name: Optional[str] = None """ (Optional) Name of the service of the API call performed. """ @@ -359,7 +349,7 @@ class ListEventsResponse: Single page of events matching the requested criteria. """ - next_page_token: Optional[str] + next_page_token: Optional[str] = None """ Page token to use in following calls to keep listing. """ @@ -367,12 +357,12 @@ class ListEventsResponse: @dataclass class ListProductsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization containing the Audit Trail events. """ diff --git a/scaleway/scaleway/autoscaling/v1alpha1/marshalling.py b/scaleway/scaleway/autoscaling/v1alpha1/marshalling.py index 7db33fe14..e669da533 100644 --- a/scaleway/scaleway/autoscaling/v1alpha1/marshalling.py +++ b/scaleway/scaleway/autoscaling/v1alpha1/marshalling.py @@ -10,6 +10,15 @@ resolve_one_of, ) from .types import ( + InstanceGroupEventLevel, + InstanceGroupEventSource, + InstancePolicyAction, + InstancePolicyType, + InstanceTemplateStatus, + MetricAggregate, + MetricManagedMetric, + MetricOperator, + VolumeInstanceTemplateVolumeType, Capacity, Loadbalancer, InstanceGroup, @@ -47,10 +56,14 @@ def unmarshal_Capacity(data: Any) -> Capacity: field = data.get("max_replicas", None) if field is not None: args["max_replicas"] = field + else: + args["max_replicas"] = 0 field = data.get("min_replicas", None) if field is not None: args["min_replicas"] = field + else: + args["min_replicas"] = 0 field = data.get("cooldown_delay", None) if field is not None: @@ -72,14 +85,20 @@ def unmarshal_Loadbalancer(data: Any) -> Loadbalancer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("backend_ids", None) if field is not None: args["backend_ids"] = field + else: + args["backend_ids"] = field(default_factory=list) field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None return Loadbalancer(**args) @@ -95,34 +114,50 @@ def unmarshal_InstanceGroup(data: Any) -> InstanceGroup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("instance_template_id", None) if field is not None: args["instance_template_id"] = field + else: + args["instance_template_id"] = None field = data.get("capacity", None) if field is not None: args["capacity"] = unmarshal_Capacity(field) + else: + args["capacity"] = None field = data.get("loadbalancer", None) if field is not None: args["loadbalancer"] = unmarshal_Loadbalancer(field) + else: + args["loadbalancer"] = None field = data.get("error_messages", None) if field is not None: args["error_messages"] = field + else: + args["error_messages"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -150,28 +185,38 @@ def unmarshal_Metric(data: Any) -> Metric: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("operator", None) if field is not None: args["operator"] = field + else: + args["operator"] = MetricOperator.OPERATOR_UNKNOWN field = data.get("aggregate", None) if field is not None: args["aggregate"] = field + else: + args["aggregate"] = MetricAggregate.AGGREGATE_UNKNOWN field = data.get("sampling_range_min", None) if field is not None: args["sampling_range_min"] = field + else: + args["sampling_range_min"] = 0 field = data.get("threshold", None) if field is not None: args["threshold"] = field + else: + args["threshold"] = 0.0 field = data.get("managed_metric", None) if field is not None: args["managed_metric"] = field else: - args["managed_metric"] = None + args["managed_metric"] = MetricManagedMetric.MANAGED_METRIC_UNKNOWN field = data.get("cockpit_metric_name", None) if field is not None: @@ -193,30 +238,44 @@ def unmarshal_InstancePolicy(data: Any) -> InstancePolicy: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = InstancePolicyAction.UNKNOWN_ACTION field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = InstancePolicyType.UNKNOWN_TYPE field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = 0 field = data.get("priority", None) if field is not None: args["priority"] = field + else: + args["priority"] = 0 field = data.get("instance_group_id", None) if field is not None: args["instance_group_id"] = field + else: + args["instance_group_id"] = None field = data.get("metric", None) if field is not None: @@ -240,6 +299,8 @@ def unmarshal_VolumeInstanceTemplateFromEmpty( field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None return VolumeInstanceTemplateFromEmpty(**args) @@ -257,6 +318,8 @@ def unmarshal_VolumeInstanceTemplateFromSnapshot( field = data.get("snapshot_id", None) if field is not None: args["snapshot_id"] = field + else: + args["snapshot_id"] = None field = data.get("size", None) if field is not None: @@ -278,18 +341,26 @@ def unmarshal_VolumeInstanceTemplate(data: Any) -> VolumeInstanceTemplate: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("boot", None) if field is not None: args["boot"] = field + else: + args["boot"] = False field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = VolumeInstanceTemplateVolumeType.UNKNOWN_VOLUME_TYPE field = data.get("perf_iops", None) if field is not None: @@ -323,10 +394,14 @@ def unmarshal_InstanceTemplate(data: Any) -> InstanceTemplate: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("commercial_type", None) if field is not None: args["commercial_type"] = field + else: + args["commercial_type"] = None field = data.get("volumes", None) if field is not None: @@ -338,22 +413,32 @@ def unmarshal_InstanceTemplate(data: Any) -> InstanceTemplate: if field is not None else None ) + else: + args["volumes"] = field(default_factory=dict) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("private_network_ids", None) if field is not None: args["private_network_ids"] = field + else: + args["private_network_ids"] = field(default_factory=list) field = data.get("image_id", None) if field is not None: @@ -377,17 +462,19 @@ def unmarshal_InstanceTemplate(data: Any) -> InstanceTemplate: if field is not None: args["public_ips_v4_count"] = field else: - args["public_ips_v4_count"] = None + args["public_ips_v4_count"] = 0 field = data.get("public_ips_v6_count", None) if field is not None: args["public_ips_v6_count"] = field else: - args["public_ips_v6_count"] = None + args["public_ips_v6_count"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceTemplateStatus.UNKNOWN_STATUS field = data.get("cloud_init", None) if field is not None: @@ -421,18 +508,26 @@ def unmarshal_InstanceGroupEvent(data: Any) -> InstanceGroupEvent: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("source", None) if field is not None: args["source"] = field + else: + args["source"] = InstanceGroupEventSource.UNKNOWN_SOURCE field = data.get("level", None) if field is not None: args["level"] = field + else: + args["level"] = InstanceGroupEventLevel.INFO field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("created_at", None) if field is not None: @@ -466,10 +561,14 @@ def unmarshal_ListInstanceGroupEventsResponse( if field is not None else None ) + else: + args["instance_events"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstanceGroupEventsResponse(**args) @@ -487,10 +586,14 @@ def unmarshal_ListInstanceGroupsResponse(data: Any) -> ListInstanceGroupsRespons args["instance_groups"] = ( [unmarshal_InstanceGroup(v) for v in field] if field is not None else None ) + else: + args["instance_groups"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstanceGroupsResponse(**args) @@ -508,10 +611,14 @@ def unmarshal_ListInstancePoliciesResponse(data: Any) -> ListInstancePoliciesRes args["policies"] = ( [unmarshal_InstancePolicy(v) for v in field] if field is not None else None ) + else: + args["policies"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstancePoliciesResponse(**args) @@ -527,6 +634,8 @@ def unmarshal_ListInstanceTemplatesResponse(data: Any) -> ListInstanceTemplatesR field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("instance_templates", None) if field is not None: @@ -535,6 +644,8 @@ def unmarshal_ListInstanceTemplatesResponse(data: Any) -> ListInstanceTemplatesR if field is not None else None ) + else: + args["instance_templates"] = field(default_factory=list) return ListInstanceTemplatesResponse(**args) @@ -594,7 +705,9 @@ def marshal_CreateInstanceGroupRequest( output["loadbalancer"] = marshal_Loadbalancer(request.loadbalancer, defaults) if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -628,10 +741,10 @@ def marshal_Metric( output["name"] = request.name if request.operator is not None: - output["operator"] = str(request.operator) + output["operator"] = request.operator if request.aggregate is not None: - output["aggregate"] = str(request.aggregate) + output["aggregate"] = request.aggregate if request.sampling_range_min is not None: output["sampling_range_min"] = request.sampling_range_min @@ -661,10 +774,10 @@ def marshal_CreateInstancePolicyRequest( output["name"] = request.name if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.value is not None: output["value"] = request.value @@ -746,7 +859,7 @@ def marshal_VolumeInstanceTemplate( output["boot"] = request.boot if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -788,7 +901,9 @@ def marshal_CreateInstanceTemplateRequest( output["public_ips_v6_count"] = request.public_ips_v6_count if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.private_network_ids is not None: output["private_network_ids"] = request.private_network_ids @@ -877,10 +992,10 @@ def marshal_UpdateInstancePolicyRequestMetric( ) if request.operator is not None: - output["operator"] = str(request.operator) + output["operator"] = request.operator if request.aggregate is not None: - output["aggregate"] = str(request.aggregate) + output["aggregate"] = request.aggregate if request.name is not None: output["name"] = request.name @@ -915,10 +1030,10 @@ def marshal_UpdateInstancePolicyRequest( output["name"] = request.name if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.value is not None: output["value"] = request.value diff --git a/scaleway/scaleway/autoscaling/v1alpha1/types.py b/scaleway/scaleway/autoscaling/v1alpha1/types.py index f1ecfd81d..00fb0513a 100644 --- a/scaleway/scaleway/autoscaling/v1alpha1/types.py +++ b/scaleway/scaleway/autoscaling/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -180,8 +180,7 @@ class VolumeInstanceTemplateFromEmpty: @dataclass class VolumeInstanceTemplateFromSnapshot: snapshot_id: str - - size: Optional[int] + size: Optional[int] = None @dataclass @@ -196,7 +195,7 @@ class Capacity: Minimum count of Instances for the Instance group. """ - cooldown_delay: Optional[str] + cooldown_delay: Optional[str] = None """ Time (in seconds) after a scaling action during which requests to carry out a new scaling action will be denied. """ @@ -247,9 +246,11 @@ class Metric: Threshold value to measure the aggregated sampled `metric` value against. Combined with the `operator` field, determines whether a scaling action should be triggered. """ - managed_metric: Optional[MetricManagedMetric] + managed_metric: Optional[MetricManagedMetric] = ( + MetricManagedMetric.MANAGED_METRIC_UNKNOWN + ) - cockpit_metric_name: Optional[str] + cockpit_metric_name: Optional[str] = None @dataclass @@ -274,11 +275,11 @@ class VolumeInstanceTemplate: Type of the volume. """ - from_empty: Optional[VolumeInstanceTemplateFromEmpty] + from_empty: Optional[VolumeInstanceTemplateFromEmpty] = None - from_snapshot: Optional[VolumeInstanceTemplateFromSnapshot] + from_snapshot: Optional[VolumeInstanceTemplateFromSnapshot] = None - perf_iops: Optional[int] + perf_iops: Optional[int] = None @dataclass @@ -303,12 +304,12 @@ class InstanceGroupEvent: Log title. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the log. """ - details: Optional[str] + details: Optional[str] = None """ Full text of the log. """ @@ -356,12 +357,12 @@ class InstanceGroup: Any configuration errors for dependencies (Load Balancer, Private Network, Instance template etc.). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Instance group was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the Instance group was last updated. """ @@ -404,7 +405,7 @@ class InstancePolicy: Instance group ID related to this policy. """ - metric: Optional[Metric] + metric: Optional[Metric] = None @dataclass @@ -444,47 +445,47 @@ class InstanceTemplate: Private Network IDs to attach to the new Instance. """ - image_id: Optional[str] + status: InstanceTemplateStatus + """ + Status of Instance template. + """ + + image_id: Optional[str] = None """ Instance image ID. Can be an ID of a marketplace or personal image. This image must be compatible with `volume` and `commercial_type` template. """ - security_group_id: Optional[str] + security_group_id: Optional[str] = None """ Instance security group ID (optional). """ - placement_group_id: Optional[str] + placement_group_id: Optional[str] = None """ Instance placement group ID. This is optional, but it is highly recommended to set a preference for Instance location within Availability Zone. """ - public_ips_v4_count: Optional[int] + public_ips_v4_count: Optional[int] = 0 """ Number of flexible IPv4 addresses to attach to the new Instance. """ - public_ips_v6_count: Optional[int] + public_ips_v6_count: Optional[int] = 0 """ Number of flexible IPv6 addresses to attach to the new Instance. """ - status: InstanceTemplateStatus - """ - Status of Instance template. - """ - - cloud_init: Optional[str] + cloud_init: Optional[str] = None """ Cloud-config file must be passed in Base64 format. Cloud-config files are special scripts designed to be run by the cloud-init process. These are generally used for initial configuration on the very first boot of a server. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Instance template was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the Instance template was last updated. """ @@ -492,17 +493,17 @@ class InstanceTemplate: @dataclass class UpdateInstanceGroupRequestCapacity: - max_replicas: Optional[int] + max_replicas: Optional[int] = 0 """ Maximum count of Instances for the Instance group. """ - min_replicas: Optional[int] + min_replicas: Optional[int] = 0 """ Minimum count of Instances for the Instance group. """ - cooldown_delay: Optional[str] + cooldown_delay: Optional[str] = None """ Time (in seconds) after a scaling action during which requests to carry out a new scaling action will be denied. """ @@ -510,7 +511,7 @@ class UpdateInstanceGroupRequestCapacity: @dataclass class UpdateInstanceGroupRequestLoadbalancer: - backend_ids: Optional[List[str]] + backend_ids: Optional[List[str]] = field(default_factory=list) """ Load Balancer backend IDs. """ @@ -528,24 +529,26 @@ class UpdateInstancePolicyRequestMetric: How the values sampled for the `metric` should be aggregated. """ - name: Optional[str] + name: Optional[str] = None """ Name or description of your metric policy. """ - sampling_range_min: Optional[int] + sampling_range_min: Optional[int] = 0 """ Interval of time, in minutes, during which metric is sampled. """ - threshold: Optional[float] + threshold: Optional[float] = 0.0 """ Threshold value to measure the aggregated sampled `metric` value against. Combined with the `operator` field, determines whether a scaling action should be triggered. """ - managed_metric: Optional[UpdateInstancePolicyRequestMetricManagedMetric] + managed_metric: Optional[UpdateInstancePolicyRequestMetricManagedMetric] = ( + UpdateInstancePolicyRequestMetricManagedMetric.MANAGED_METRIC_UNKNOWN + ) - cockpit_metric_name: Optional[str] + cockpit_metric_name: Optional[str] = None @dataclass @@ -570,17 +573,17 @@ class CreateInstanceGroupRequest: Specification of the Load Balancer to link to the Instance group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Instance groups from this Project will be returned. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Instance group. """ @@ -618,21 +621,16 @@ class CreateInstancePolicyRequest: Instance group ID related to this policy. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - metric: Optional[Metric] + metric: Optional[Metric] = None @dataclass class CreateInstanceTemplateRequest: - zone: Optional[ScwZone] - """ - Zone to target. If none is passed will use default zone from the config. - """ - commercial_type: str """ Name of Instance commercial type. @@ -643,52 +641,57 @@ class CreateInstanceTemplateRequest: Template of Instance volume. """ - image_id: Optional[str] + name: str """ - Instance image ID. Can be an ID of a marketplace or personal image. This image must be compatible with `volume` and `commercial_type` template. + Name of Instance template. """ - tags: Optional[List[str]] + zone: Optional[ScwZone] = None """ - List of tags for the Instance template. + Zone to target. If none is passed will use default zone from the config. """ - security_group_id: Optional[str] + image_id: Optional[str] = None """ - Instance security group ID (optional). + Instance image ID. Can be an ID of a marketplace or personal image. This image must be compatible with `volume` and `commercial_type` template. """ - name: str + tags: Optional[List[str]] = field(default_factory=list) """ - Name of Instance template. + List of tags for the Instance template. """ - placement_group_id: Optional[str] + security_group_id: Optional[str] = None + """ + Instance security group ID (optional). + """ + + placement_group_id: Optional[str] = None """ Instance placement group ID. This is optional, but it is highly recommended to set a preference for Instance location within Availability Zone. """ - public_ips_v4_count: Optional[int] + public_ips_v4_count: Optional[int] = 0 """ Number of flexible IPv4 addresses to attach to the new Instance. """ - public_ips_v6_count: Optional[int] + public_ips_v6_count: Optional[int] = 0 """ Number of flexible IPv6 addresses to attach to the new Instance. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the Instance template resource. """ - private_network_ids: Optional[List[str]] + private_network_ids: Optional[List[str]] = field(default_factory=list) """ Private Network IDs to attach to the new Instance. """ - cloud_init: Optional[str] + cloud_init: Optional[str] = None """ Cloud-config file must be passed in Base64 format. Cloud-config files are special scripts designed to be run by the cloud-init process. These are generally used for initial configuration on the very first boot of a server. """ @@ -701,7 +704,7 @@ class DeleteInstanceGroupRequest: ID of the Instance group to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -714,7 +717,7 @@ class DeleteInstancePolicyRequest: ID of the policy to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -727,7 +730,7 @@ class DeleteInstanceTemplateRequest: ID of the template to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -740,7 +743,7 @@ class GetInstanceGroupRequest: ID of the requested Instance group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -753,7 +756,7 @@ class GetInstancePolicyRequest: Policy ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -766,7 +769,7 @@ class GetInstanceTemplateRequest: Template ID of the resource. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -779,22 +782,24 @@ class ListInstanceGroupEventsRequest: List all event logs for the Instance group ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListInstanceGroupEventsRequestOrderBy] + order_by: Optional[ListInstanceGroupEventsRequestOrderBy] = ( + ListInstanceGroupEventsRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of Instance groups in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Instance groups to return per page. """ @@ -815,22 +820,24 @@ class ListInstanceGroupEventsResponse: @dataclass class ListInstanceGroupsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListInstanceGroupsRequestOrderBy] + order_by: Optional[ListInstanceGroupsRequestOrderBy] = ( + ListInstanceGroupsRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of Instance groups in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Instance groups to return per page. """ @@ -856,22 +863,24 @@ class ListInstancePoliciesRequest: Instance group ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListInstancePoliciesRequestOrderBy] + order_by: Optional[ListInstancePoliciesRequestOrderBy] = ( + ListInstancePoliciesRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of Instance groups in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of scaling policies to return per page. """ @@ -892,22 +901,24 @@ class ListInstancePoliciesResponse: @dataclass class ListInstanceTemplatesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListInstanceTemplatesRequestOrderBy] + order_by: Optional[ListInstanceTemplatesRequestOrderBy] = ( + ListInstanceTemplatesRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of Instance groups in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Instance groups to return per page. """ @@ -933,27 +944,27 @@ class UpdateInstanceGroupRequest: Instance group ID to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of Instance group. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Load Balancer. """ - capacity: Optional[UpdateInstanceGroupRequestCapacity] + capacity: Optional[UpdateInstanceGroupRequestCapacity] = None """ Specification of the minimum and maximum replicas for the Instance group, and the cooldown interval between two scaling events. """ - loadbalancer: Optional[UpdateInstanceGroupRequestLoadbalancer] + loadbalancer: Optional[UpdateInstanceGroupRequestLoadbalancer] = None """ Specification of the Load Balancer to link to the Instance group. """ @@ -966,37 +977,37 @@ class UpdateInstancePolicyRequest: Policy ID to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Policy name to update. """ - action: Optional[InstancePolicyAction] + action: Optional[InstancePolicyAction] = InstancePolicyAction.UNKNOWN_ACTION """ Action to update (action to execute when the metric-based condition is met). """ - type_: Optional[InstancePolicyType] + type_: Optional[InstancePolicyType] = InstancePolicyType.UNKNOWN_TYPE """ Type to update (how to use the number defined in `value` when determining by how many Instances to scale up/down). """ - value: Optional[int] + value: Optional[int] = 0 """ Value to update (number representing the magnitude of the scaling action to take for the Instance group). """ - priority: Optional[int] + priority: Optional[int] = 0 """ Priority to update (priority of this policy compared to all other scaling policies. The lower the number, the higher the priority). """ - metric: Optional[UpdateInstancePolicyRequestMetric] + metric: Optional[UpdateInstancePolicyRequestMetric] = None @dataclass @@ -1006,62 +1017,62 @@ class UpdateInstanceTemplateRequest: Template ID of the resource. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - commercial_type: Optional[str] + commercial_type: Optional[str] = None """ Name of Instance commercial type. """ - image_id: Optional[str] + image_id: Optional[str] = None """ Instance image ID. Can be an ID of a marketplace or personal image. This image must be compatible with `volume` and `commercial_type` template. """ - volumes: Optional[Dict[str, VolumeInstanceTemplate]] + volumes: Optional[Dict[str, VolumeInstanceTemplate]] = field(default_factory=dict) """ Template of Instance volume. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Instance template. """ - security_group_id: Optional[str] + security_group_id: Optional[str] = None """ Instance security group ID (optional). """ - placement_group_id: Optional[str] + placement_group_id: Optional[str] = None """ Instance placement group ID. This is optional, but it is highly recommended to set a preference for Instance location within Availability Zone. """ - public_ips_v4_count: Optional[int] + public_ips_v4_count: Optional[int] = 0 """ Number of flexible IPv4 addresses to attach to the new Instance. """ - public_ips_v6_count: Optional[int] + public_ips_v6_count: Optional[int] = 0 """ Number of flexible IPv6 addresses to attach to the new Instance. """ - name: Optional[str] + name: Optional[str] = None """ Name of Instance template. """ - private_network_ids: Optional[List[str]] + private_network_ids: Optional[List[str]] = field(default_factory=list) """ Private Network IDs to attach to the new Instance. """ - cloud_init: Optional[str] + cloud_init: Optional[str] = None """ Cloud-config file must be passed in Base64 format. Cloud-config files are special scripts designed to be run by the cloud-init process. These are generally used for initial configuration on the very first boot of a server. """ diff --git a/scaleway/scaleway/baremetal/v1/marshalling.py b/scaleway/scaleway/baremetal/v1/marshalling.py index 6420591fc..6cb642053 100644 --- a/scaleway/scaleway/baremetal/v1/marshalling.py +++ b/scaleway/scaleway/baremetal/v1/marshalling.py @@ -14,6 +14,17 @@ resolve_one_of, ) from .types import ( + IPReverseStatus, + IPVersion, + OfferStock, + OfferSubscriptionPeriod, + ServerBootType, + ServerInstallStatus, + ServerOptionOptionStatus, + ServerPingStatus, + ServerPrivateNetworkStatus, + ServerStatus, + SettingType, SchemaPartition, SchemaPool, SchemaDisk, @@ -82,18 +93,26 @@ def unmarshal_SchemaPartition(data: Any) -> SchemaPartition: field = data.get("label", None) if field is not None: args["label"] = field + else: + args["label"] = None field = data.get("number", None) if field is not None: args["number"] = field + else: + args["number"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None field = data.get("use_all_available_space", None) if field is not None: args["use_all_available_space"] = field + else: + args["use_all_available_space"] = None return SchemaPartition(**args) @@ -109,22 +128,32 @@ def unmarshal_SchemaPool(data: Any) -> SchemaPool: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("devices", None) if field is not None: args["devices"] = field + else: + args["devices"] = None field = data.get("options", None) if field is not None: args["options"] = field + else: + args["options"] = None field = data.get("filesystem_options", None) if field is not None: args["filesystem_options"] = field + else: + args["filesystem_options"] = None return SchemaPool(**args) @@ -140,12 +169,16 @@ def unmarshal_SchemaDisk(data: Any) -> SchemaDisk: field = data.get("device", None) if field is not None: args["device"] = field + else: + args["device"] = None field = data.get("partitions", None) if field is not None: args["partitions"] = ( [unmarshal_SchemaPartition(v) for v in field] if field is not None else None ) + else: + args["partitions"] = None return SchemaDisk(**args) @@ -161,14 +194,20 @@ def unmarshal_SchemaFilesystem(data: Any) -> SchemaFilesystem: field = data.get("device", None) if field is not None: args["device"] = field + else: + args["device"] = None field = data.get("format", None) if field is not None: args["format"] = field + else: + args["format"] = None field = data.get("mountpoint", None) if field is not None: args["mountpoint"] = field + else: + args["mountpoint"] = None return SchemaFilesystem(**args) @@ -184,14 +223,20 @@ def unmarshal_SchemaRAID(data: Any) -> SchemaRAID: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("level", None) if field is not None: args["level"] = field + else: + args["level"] = None field = data.get("devices", None) if field is not None: args["devices"] = field + else: + args["devices"] = None return SchemaRAID(**args) @@ -209,6 +254,8 @@ def unmarshal_SchemaZFS(data: Any) -> SchemaZFS: args["pools"] = ( [unmarshal_SchemaPool(v) for v in field] if field is not None else None ) + else: + args["pools"] = None return SchemaZFS(**args) @@ -226,12 +273,16 @@ def unmarshal_Schema(data: Any) -> Schema: args["disks"] = ( [unmarshal_SchemaDisk(v) for v in field] if field is not None else None ) + else: + args["disks"] = None field = data.get("raids", None) if field is not None: args["raids"] = ( [unmarshal_SchemaRAID(v) for v in field] if field is not None else None ) + else: + args["raids"] = None field = data.get("filesystems", None) if field is not None: @@ -240,6 +291,8 @@ def unmarshal_Schema(data: Any) -> Schema: if field is not None else None ) + else: + args["filesystems"] = None field = data.get("zfs", None) if field is not None: @@ -261,26 +314,38 @@ def unmarshal_IP(data: Any) -> IP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("reverse", None) if field is not None: args["reverse"] = field + else: + args["reverse"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = IPVersion.IPV4 field = data.get("reverse_status", None) if field is not None: args["reverse_status"] = field + else: + args["reverse_status"] = IPReverseStatus.UNKNOWN field = data.get("reverse_status_message", None) if field is not None: args["reverse_status_message"] = field + else: + args["reverse_status_message"] = None return IP(**args) @@ -307,6 +372,8 @@ def unmarshal_LicenseOption(data: Any) -> LicenseOption: field = data.get("os_id", None) if field is not None: args["os_id"] = field + else: + args["os_id"] = None return LicenseOption(**args) @@ -322,6 +389,8 @@ def unmarshal_PrivateNetworkOption(data: Any) -> PrivateNetworkOption: field = data.get("bandwidth_in_bps", None) if field is not None: args["bandwidth_in_bps"] = field + else: + args["bandwidth_in_bps"] = None return PrivateNetworkOption(**args) @@ -337,6 +406,8 @@ def unmarshal_PublicBandwidthOption(data: Any) -> PublicBandwidthOption: field = data.get("bandwidth_in_bps", None) if field is not None: args["bandwidth_in_bps"] = field + else: + args["bandwidth_in_bps"] = None return PublicBandwidthOption(**args) @@ -363,30 +434,44 @@ def unmarshal_ServerInstall(data: Any) -> ServerInstall: field = data.get("os_id", None) if field is not None: args["os_id"] = field + else: + args["os_id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("ssh_key_ids", None) if field is not None: args["ssh_key_ids"] = field + else: + args["ssh_key_ids"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerInstallStatus.UNKNOWN field = data.get("user", None) if field is not None: args["user"] = field + else: + args["user"] = None field = data.get("service_user", None) if field is not None: args["service_user"] = field + else: + args["service_user"] = None field = data.get("service_url", None) if field is not None: args["service_url"] = field + else: + args["service_url"] = None field = data.get("partitioning_schema", None) if field is not None: @@ -408,18 +493,26 @@ def unmarshal_ServerOption(data: Any) -> ServerOption: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["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"] = ServerOptionOptionStatus.OPTION_STATUS_UNKNOWN field = data.get("manageable", None) if field is not None: args["manageable"] = field + else: + args["manageable"] = False field = data.get("expires_at", None) if field is not None: @@ -471,10 +564,14 @@ def unmarshal_ServerRescueServer(data: Any) -> ServerRescueServer: field = data.get("user", None) if field is not None: args["user"] = field + else: + args["user"] = None field = data.get("password", None) if field is not None: args["password"] = field + else: + args["password"] = None return ServerRescueServer(**args) @@ -490,34 +587,50 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerStatus.UNKNOWN field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = None field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = None field = data.get("updated_at", None) if field is not None: @@ -534,36 +647,52 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_IP(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("boot_type", None) if field is not None: args["boot_type"] = field + else: + args["boot_type"] = ServerBootType.UNKNOWN_BOOT_TYPE field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("ping_status", None) if field is not None: args["ping_status"] = field + else: + args["ping_status"] = ServerPingStatus.PING_STATUS_UNKNOWN field = data.get("options", None) if field is not None: args["options"] = ( [unmarshal_ServerOption(v) for v in field] if field is not None else None ) + else: + args["options"] = field(default_factory=list) field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("install", None) if field is not None: @@ -591,10 +720,14 @@ def unmarshal_OSOSField(data: Any) -> OSOSField: field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = None field = data.get("required", None) if field is not None: args["required"] = field + else: + args["required"] = None field = data.get("default_value", None) if field is not None: @@ -616,18 +749,26 @@ def unmarshal_OS(data: Any) -> OS: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("ssh", None) if field is not None: @@ -662,18 +803,26 @@ def unmarshal_OS(data: Any) -> OS: field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("license_required", None) if field is not None: args["license_required"] = field + else: + args["license_required"] = False field = data.get("allowed", None) if field is not None: args["allowed"] = field + else: + args["allowed"] = False field = data.get("custom_partitioning_supported", None) if field is not None: args["custom_partitioning_supported"] = field + else: + args["custom_partitioning_supported"] = False return OS(**args) @@ -689,22 +838,32 @@ def unmarshal_CPU(data: Any) -> CPU: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("core_count", None) if field is not None: args["core_count"] = field + else: + args["core_count"] = 0 field = data.get("thread_count", None) if field is not None: args["thread_count"] = field + else: + args["thread_count"] = 0 field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("benchmark", None) if field is not None: args["benchmark"] = field + else: + args["benchmark"] = None return CPU(**args) @@ -720,10 +879,14 @@ def unmarshal_Disk(data: Any) -> Disk: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return Disk(**args) @@ -739,10 +902,14 @@ def unmarshal_GPU(data: Any) -> GPU: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("vram", None) if field is not None: args["vram"] = field + else: + args["vram"] = 0 return GPU(**args) @@ -758,18 +925,26 @@ def unmarshal_Memory(data: Any) -> Memory: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("is_ecc", None) if field is not None: args["is_ecc"] = field + else: + args["is_ecc"] = False return Memory(**args) @@ -785,22 +960,34 @@ def unmarshal_OfferOptionOffer(data: Any) -> OfferOptionOffer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("subscription_period", None) if field is not None: args["subscription_period"] = field + else: + args["subscription_period"] = ( + OfferSubscriptionPeriod.UNKNOWN_SUBSCRIPTION_PERIOD + ) field = data.get("manageable", None) if field is not None: args["manageable"] = field + else: + args["manageable"] = False field = data.get("price", None) if field is not None: @@ -858,14 +1045,20 @@ def unmarshal_PersistentMemory(data: Any) -> PersistentMemory: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 return PersistentMemory(**args) @@ -881,10 +1074,14 @@ def unmarshal_RaidController(data: Any) -> RaidController: field = data.get("model", None) if field is not None: args["model"] = field + else: + args["model"] = None field = data.get("raid_level", None) if field is not None: args["raid_level"] = field + else: + args["raid_level"] = None return RaidController(**args) @@ -900,46 +1097,66 @@ def unmarshal_Offer(data: Any) -> Offer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock", None) if field is not None: args["stock"] = field + else: + args["stock"] = OfferStock.EMPTY field = data.get("bandwidth", None) if field is not None: args["bandwidth"] = field + else: + args["bandwidth"] = 0 field = data.get("max_bandwidth", None) if field is not None: args["max_bandwidth"] = field + else: + args["max_bandwidth"] = 0 field = data.get("commercial_range", None) if field is not None: args["commercial_range"] = field + else: + args["commercial_range"] = None field = data.get("disks", None) if field is not None: args["disks"] = ( [unmarshal_Disk(v) for v in field] if field is not None else None ) + else: + args["disks"] = field(default_factory=list) field = data.get("enable", None) if field is not None: args["enable"] = field + else: + args["enable"] = False field = data.get("cpus", None) if field is not None: args["cpus"] = [unmarshal_CPU(v) for v in field] if field is not None else None + else: + args["cpus"] = field(default_factory=list) field = data.get("memories", None) if field is not None: args["memories"] = ( [unmarshal_Memory(v) for v in field] if field is not None else None ) + else: + args["memories"] = field(default_factory=list) field = data.get("price_per_hour", None) if field is not None: @@ -956,6 +1173,8 @@ def unmarshal_Offer(data: Any) -> Offer: field = data.get("quota_name", None) if field is not None: args["quota_name"] = field + else: + args["quota_name"] = None field = data.get("persistent_memories", None) if field is not None: @@ -964,24 +1183,36 @@ def unmarshal_Offer(data: Any) -> Offer: if field is not None else None ) + else: + args["persistent_memories"] = field(default_factory=list) field = data.get("raid_controllers", None) if field is not None: args["raid_controllers"] = ( [unmarshal_RaidController(v) for v in field] if field is not None else None ) + else: + args["raid_controllers"] = field(default_factory=list) field = data.get("incompatible_os_ids", None) if field is not None: args["incompatible_os_ids"] = field + else: + args["incompatible_os_ids"] = field(default_factory=list) field = data.get("subscription_period", None) if field is not None: args["subscription_period"] = field + else: + args["subscription_period"] = ( + OfferSubscriptionPeriod.UNKNOWN_SUBSCRIPTION_PERIOD + ) field = data.get("operation_path", None) if field is not None: args["operation_path"] = field + else: + args["operation_path"] = None field = data.get("options", None) if field is not None: @@ -990,22 +1221,32 @@ def unmarshal_Offer(data: Any) -> Offer: if field is not None else None ) + else: + args["options"] = field(default_factory=list) field = data.get("private_bandwidth", None) if field is not None: args["private_bandwidth"] = field + else: + args["private_bandwidth"] = 0 field = data.get("shared_bandwidth", None) if field is not None: args["shared_bandwidth"] = field + else: + args["shared_bandwidth"] = False field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("gpus", None) if field is not None: args["gpus"] = [unmarshal_GPU(v) for v in field] if field is not None else None + else: + args["gpus"] = field(default_factory=list) field = data.get("fee", None) if field is not None: @@ -1033,14 +1274,20 @@ def unmarshal_Option(data: Any) -> Option: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("manageable", None) if field is not None: args["manageable"] = field + else: + args["manageable"] = False field = data.get("license", None) if field is not None: @@ -1086,28 +1333,38 @@ def unmarshal_ServerPrivateNetwork(data: Any) -> ServerPrivateNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("server_id", None) if field is not None: args["server_id"] = field + else: + args["server_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerPrivateNetworkStatus.UNKNOWN field = data.get("vlan", None) if field is not None: args["vlan"] = field else: - args["vlan"] = None + args["vlan"] = 0 field = data.get("created_at", None) if field is not None: @@ -1135,18 +1392,26 @@ def unmarshal_Setting(data: Any) -> Setting: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = SettingType.UNKNOWN field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False return Setting(**args) @@ -1162,14 +1427,20 @@ def unmarshal_BMCAccess(data: Any) -> BMCAccess: field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("login", None) if field is not None: args["login"] = field + else: + args["login"] = None field = data.get("password", None) if field is not None: args["password"] = field + else: + args["password"] = None field = data.get("expires_at", None) if field is not None: @@ -1208,10 +1479,14 @@ def unmarshal_ListOSResponse(data: Any) -> ListOSResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("os", None) if field is not None: args["os"] = [unmarshal_OS(v) for v in field] if field is not None else None + else: + args["os"] = field(default_factory=list) return ListOSResponse(**args) @@ -1227,12 +1502,16 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("offers", None) if field is not None: args["offers"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["offers"] = field(default_factory=list) return ListOffersResponse(**args) @@ -1248,12 +1527,16 @@ def unmarshal_ListOptionsResponse(data: Any) -> ListOptionsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("options", None) if field is not None: args["options"] = ( [unmarshal_Option(v) for v in field] if field is not None else None ) + else: + args["options"] = field(default_factory=list) return ListOptionsResponse(**args) @@ -1269,10 +1552,14 @@ def unmarshal_ServerEvent(data: Any) -> ServerEvent: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = None field = data.get("updated_at", None) if field is not None: @@ -1300,12 +1587,16 @@ def unmarshal_ListServerEventsResponse(data: Any) -> ListServerEventsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("events", None) if field is not None: args["events"] = ( [unmarshal_ServerEvent(v) for v in field] if field is not None else None ) + else: + args["events"] = field(default_factory=list) return ListServerEventsResponse(**args) @@ -1327,10 +1618,14 @@ def unmarshal_ListServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListServerPrivateNetworksResponse(**args) @@ -1346,12 +1641,16 @@ def unmarshal_ListServersResponse(data: Any) -> ListServersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListServersResponse(**args) @@ -1367,12 +1666,16 @@ def unmarshal_ListSettingsResponse(data: Any) -> ListSettingsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("settings", None) if field is not None: args["settings"] = ( [unmarshal_Setting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) return ListSettingsResponse(**args) @@ -1394,6 +1697,8 @@ def unmarshal_SetServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None return SetServerPrivateNetworksResponse(**args) @@ -1405,7 +1710,7 @@ def marshal_SchemaPartition( output: Dict[str, Any] = {} if request.label is not None: - output["label"] = str(request.label) + output["label"] = request.label if request.number is not None: output["number"] = request.number @@ -1429,7 +1734,7 @@ def marshal_SchemaPool( output["name"] = request.name if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.devices is not None: output["devices"] = request.devices @@ -1470,7 +1775,7 @@ def marshal_SchemaFilesystem( output["device"] = request.device if request.format is not None: - output["format"] = str(request.format) + output["format"] = request.format if request.mountpoint is not None: output["mountpoint"] = request.mountpoint @@ -1488,7 +1793,7 @@ def marshal_SchemaRAID( output["name"] = request.name if request.level is not None: - output["level"] = str(request.level) + output["level"] = request.level if request.devices is not None: output["devices"] = request.devices @@ -1694,7 +1999,7 @@ def marshal_RebootServerRequest( output: Dict[str, Any] = {} if request.boot_type is not None: - output["boot_type"] = str(request.boot_type) + output["boot_type"] = request.boot_type return output @@ -1718,7 +2023,7 @@ def marshal_StartServerRequest( output: Dict[str, Any] = {} if request.boot_type is not None: - output["boot_type"] = str(request.boot_type) + output["boot_type"] = request.boot_type return output diff --git a/scaleway/scaleway/baremetal/v1/types.py b/scaleway/scaleway/baremetal/v1/types.py index fd3933cf2..7a88b59b0 100644 --- a/scaleway/scaleway/baremetal/v1/types.py +++ b/scaleway/scaleway/baremetal/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -220,49 +220,37 @@ def __str__(self) -> str: @dataclass class SchemaPartition: label: SchemaPartitionLabel - number: int - size: int - use_all_available_space: bool @dataclass class SchemaPool: name: str - type_: SchemaPoolType - devices: List[str] - options: List[str] - filesystem_options: List[str] @dataclass class SchemaDisk: device: str - partitions: List[SchemaPartition] @dataclass class SchemaFilesystem: device: str - format: SchemaFilesystemFormat - mountpoint: str @dataclass class SchemaRAID: name: str - level: SchemaRAIDLevel - devices: List[str] @@ -274,12 +262,9 @@ class SchemaZFS: @dataclass class Schema: disks: List[SchemaDisk] - raids: List[SchemaRAID] - filesystems: List[SchemaFilesystem] - - zfs: Optional[SchemaZFS] + zfs: Optional[SchemaZFS] = None @dataclass @@ -324,27 +309,27 @@ class CreateServerRequestInstall: SSH key IDs authorized on the server. """ - user: Optional[str] + user: Optional[str] = None """ User for the installation. """ - password: Optional[str] + password: Optional[str] = None """ Password for the installation. """ - service_user: Optional[str] + service_user: Optional[str] = None """ Regular user that runs the service to be installed on the server. """ - service_password: Optional[str] + service_password: Optional[str] = None """ Password used for the service to install. """ - partitioning_schema: Optional[Schema] + partitioning_schema: Optional[Schema] = None """ Partitioning schema. """ @@ -420,7 +405,7 @@ class ServerInstall: Address of the installed service. """ - partitioning_schema: Optional[Schema] + partitioning_schema: Optional[Schema] = None """ Partitioning schema. """ @@ -448,20 +433,20 @@ class ServerOption: Defines whether the option can be managed (added or removed). """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Auto expiration date for compatible options. """ - license: Optional[LicenseOption] + license: Optional[LicenseOption] = None - public_bandwidth: Optional[PublicBandwidthOption] + public_bandwidth: Optional[PublicBandwidthOption] = None - private_network: Optional[PrivateNetworkOption] + private_network: Optional[PrivateNetworkOption] = None - remote_access: Optional[RemoteAccessOption] + remote_access: Optional[RemoteAccessOption] = None - certification: Optional[CertificationOption] + certification: Optional[CertificationOption] = None @dataclass @@ -480,10 +465,8 @@ class ServerRescueServer: @dataclass class OSOSField: editable: bool - required: bool - - default_value: Optional[str] + default_value: Optional[str] = None @dataclass @@ -591,25 +574,25 @@ class OfferOptionOffer: Boolean to know if option could be managed. """ - price: Optional[Money] + price: Optional[Money] = None """ Price of the option. """ - os_id: Optional[str] + os_id: Optional[str] = None """ Deprecated, use LicenseOptionVars.os_id instead. """ - license: Optional[LicenseOption] + license: Optional[LicenseOption] = None - public_bandwidth: Optional[PublicBandwidthOption] + public_bandwidth: Optional[PublicBandwidthOption] = None - private_network: Optional[PrivateNetworkOption] + private_network: Optional[PrivateNetworkOption] = None - remote_access: Optional[RemoteAccessOption] + remote_access: Optional[RemoteAccessOption] = None - certification: Optional[CertificationOption] + certification: Optional[CertificationOption] = None @dataclass @@ -633,7 +616,6 @@ class PersistentMemory: @dataclass class RaidController: model: str - raid_level: List[str] @@ -659,29 +641,29 @@ class CreateServerRequest: If enabled, the server can not be deleted. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to associate to the server. """ - install: Optional[CreateServerRequestInstall] + install: Optional[CreateServerRequestInstall] = None """ Object describing the configuration details of the OS installation on the server. """ - option_ids: Optional[List[str]] + option_ids: Optional[List[str]] = field(default_factory=list) """ IDs of options to enable on server. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -726,16 +708,6 @@ class Server: Offer name of the server. """ - updated_at: Optional[datetime] - """ - Last modification date of the server. - """ - - created_at: Optional[datetime] - """ - Creation date of the server. - """ - tags: List[str] """ Array of custom tags attached to the server. @@ -776,12 +748,22 @@ class Server: If enabled, the server can not be deleted. """ - install: Optional[ServerInstall] + updated_at: Optional[datetime] = None + """ + Last modification date of the server. + """ + + created_at: Optional[datetime] = None + """ + Creation date of the server. + """ + + install: Optional[ServerInstall] = None """ Configuration of the installation. """ - rescue_server: Optional[ServerRescueServer] + rescue_server: Optional[ServerRescueServer] = None """ Configuration of rescue boot. """ @@ -809,49 +791,49 @@ class OS: URL of this OS's logo. """ - ssh: Optional[OSOSField] + enabled: bool """ - Object defining the SSH requirements to install the OS. + Defines if the operating system is enabled or not. """ - user: Optional[OSOSField] + license_required: bool """ - Object defining the username requirements to install the OS. + License required (check server options for pricing details). """ - password: Optional[OSOSField] + allowed: bool """ - Object defining the password requirements to install the OS. + Defines if a specific Organization is allowed to install this OS type. """ - service_user: Optional[OSOSField] + custom_partitioning_supported: bool """ - Object defining the username requirements to install the service. + Defines if custom partitioning is supported by this OS. """ - service_password: Optional[OSOSField] + ssh: Optional[OSOSField] = None """ - Object defining the password requirements to install the service. + Object defining the SSH requirements to install the OS. """ - enabled: bool + user: Optional[OSOSField] = None """ - Defines if the operating system is enabled or not. + Object defining the username requirements to install the OS. """ - license_required: bool + password: Optional[OSOSField] = None """ - License required (check server options for pricing details). + Object defining the password requirements to install the OS. """ - allowed: bool + service_user: Optional[OSOSField] = None """ - Defines if a specific Organization is allowed to install this OS type. + Object defining the username requirements to install the service. """ - custom_partitioning_supported: bool + service_password: Optional[OSOSField] = None """ - Defines if custom partitioning is supported by this OS. + Object defining the password requirements to install the service. """ @@ -907,16 +889,6 @@ class Offer: Memory specifications of the offer. """ - price_per_hour: Optional[Money] - """ - Price of the offer for the next 60 minutes (a server order at 11h32 will be paid until 12h32). - """ - - price_per_month: Optional[Money] - """ - Monthly price of the offer, if subscribing on a monthly basis. - """ - quota_name: str """ Name of the quota associated to the offer. @@ -972,12 +944,22 @@ class Offer: GPU specifications of the offer. """ - fee: Optional[Money] + price_per_hour: Optional[Money] = None + """ + Price of the offer for the next 60 minutes (a server order at 11h32 will be paid until 12h32). + """ + + price_per_month: Optional[Money] = None + """ + Monthly price of the offer, if subscribing on a monthly basis. + """ + + fee: Optional[Money] = None """ One time fee invoiced by Scaleway for the setup and activation of the server. """ - monthly_offer_id: Optional[str] + monthly_offer_id: Optional[str] = None """ Exist only for hourly offers, to migrate to the monthly offer. """ @@ -1000,15 +982,15 @@ class Option: Defines whether the option is manageable (could be added or removed). """ - license: Optional[LicenseOption] + license: Optional[LicenseOption] = None - public_bandwidth: Optional[PublicBandwidthOption] + public_bandwidth: Optional[PublicBandwidthOption] = None - private_network: Optional[PrivateNetworkOption] + private_network: Optional[PrivateNetworkOption] = None - remote_access: Optional[RemoteAccessOption] + remote_access: Optional[RemoteAccessOption] = None - certification: Optional[CertificationOption] + certification: Optional[CertificationOption] = None @dataclass @@ -1023,12 +1005,12 @@ class ServerEvent: The action that will be applied to the server. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date of last modification of the action. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date of creation of the action. """ @@ -1061,17 +1043,17 @@ class ServerPrivateNetwork: The configuration status of the Private Network. """ - vlan: Optional[int] + vlan: Optional[int] = 0 """ The VLAN ID associated to the Private Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ The Private Network creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ The date the Private Network was last modified. """ @@ -1112,12 +1094,12 @@ class AddOptionServerRequest: ID of the option to add. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Auto expire the option after this date. """ @@ -1140,7 +1122,7 @@ class BMCAccess: The password to use for the BMC (Baseboard Management Controller) access authentification. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ The date after which the BMC (Baseboard Management Controller) access will be closed. """ @@ -1158,7 +1140,7 @@ class DeleteOptionServerRequest: ID of the option to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1171,7 +1153,7 @@ class DeleteServerRequest: ID of the server to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1184,7 +1166,7 @@ class GetBMCAccessRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1202,7 +1184,7 @@ class GetDefaultPartitioningSchemaRequest: ID of the OS. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1215,7 +1197,7 @@ class GetOSRequest: ID of the OS. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1228,7 +1210,7 @@ class GetOfferRequest: ID of the researched Offer. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1241,7 +1223,7 @@ class GetOptionRequest: ID of the option. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1254,7 +1236,7 @@ class GetServerMetricsRequest: Server ID to get the metrics. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1262,7 +1244,7 @@ class GetServerMetricsRequest: @dataclass class GetServerMetricsResponse: - pings: Optional[TimeSeries] + pings: Optional[TimeSeries] = None """ Timeseries object representing pings on the server. """ @@ -1275,7 +1257,7 @@ class GetServerRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1303,32 +1285,32 @@ class InstallServerRequest: SSH key IDs authorized on the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - user: Optional[str] + user: Optional[str] = None """ User used for the installation. """ - password: Optional[str] + password: Optional[str] = None """ Password used for the installation. """ - service_user: Optional[str] + service_user: Optional[str] = None """ User used for the service to install. """ - service_password: Optional[str] + service_password: Optional[str] = None """ Password used for the service to install. """ - partitioning_schema: Optional[Schema] + partitioning_schema: Optional[Schema] = None """ Partitioning schema. """ @@ -1336,22 +1318,22 @@ class InstallServerRequest: @dataclass class ListOSRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of OS per page. """ - offer_id: Optional[str] + offer_id: Optional[str] = None """ Offer IDs to filter OSes for. """ @@ -1372,27 +1354,29 @@ class ListOSResponse: @dataclass class ListOffersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of offers per page. """ - subscription_period: Optional[OfferSubscriptionPeriod] + subscription_period: Optional[OfferSubscriptionPeriod] = ( + OfferSubscriptionPeriod.UNKNOWN_SUBSCRIPTION_PERIOD + ) """ Subscription period type to filter offers by. """ - name: Optional[str] + name: Optional[str] = None """ Offer name to filter offers by. """ @@ -1413,27 +1397,27 @@ class ListOffersResponse: @dataclass class ListOptionsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of options per page. """ - offer_id: Optional[str] + offer_id: Optional[str] = None """ Offer ID to filter options for. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter options for. """ @@ -1459,22 +1443,24 @@ class ListServerEventsRequest: ID of the server events searched. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of server events per page. """ - order_by: Optional[ListServerEventsRequestOrderBy] + order_by: Optional[ListServerEventsRequestOrderBy] = ( + ListServerEventsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the server events. """ @@ -1496,58 +1482,59 @@ class ListServerEventsResponse: @dataclass class ListServerPrivateNetworksResponse: server_private_networks: List[ServerPrivateNetwork] - total_count: int @dataclass class ListServersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of servers per page. """ - order_by: Optional[ListServersRequestOrderBy] + order_by: Optional[ListServersRequestOrderBy] = ( + ListServersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the servers. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. """ - status: Optional[List[str]] + status: Optional[List[str]] = field(default_factory=list) """ Status to filter for. """ - name: Optional[str] + name: Optional[str] = None """ Names to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. """ - option_id: Optional[str] + option_id: Optional[str] = None """ Option ID to filter for. """ @@ -1568,27 +1555,29 @@ class ListServersResponse: @dataclass class ListSettingsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Set the maximum list size. """ - order_by: Optional[ListSettingsRequestOrderBy] + order_by: Optional[ListSettingsRequestOrderBy] = ( + ListSettingsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for items in the response. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1614,7 +1603,7 @@ class MigrateServerToMonthlyOfferRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1632,7 +1621,7 @@ class PrivateNetworkApiAddServerPrivateNetworkRequest: The ID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1650,7 +1639,7 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: The ID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1658,42 +1647,44 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: @dataclass class PrivateNetworkApiListServerPrivateNetworksRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListServerPrivateNetworksRequestOrderBy] + order_by: Optional[ListServerPrivateNetworksRequestOrderBy] = ( + ListServerPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ The sort order for the returned Private Networks. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number for the returned Private Networks. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The maximum number of Private Networks per page. """ - server_id: Optional[str] + server_id: Optional[str] = None """ Filter Private Networks by server ID. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Filter Private Networks by Private Network ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter Private Networks by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter Private Networks by Project ID. """ @@ -1711,7 +1702,7 @@ class PrivateNetworkApiSetServerPrivateNetworksRequest: The IDs of the Private Networks. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1724,12 +1715,12 @@ class RebootServerRequest: ID of the server to reboot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - boot_type: Optional[ServerBootType] + boot_type: Optional[ServerBootType] = ServerBootType.UNKNOWN_BOOT_TYPE """ The type of boot. """ @@ -1752,7 +1743,7 @@ class StartBMCAccessRequest: The IP authorized to connect to the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1765,12 +1756,12 @@ class StartServerRequest: ID of the server to start. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - boot_type: Optional[ServerBootType] + boot_type: Optional[ServerBootType] = ServerBootType.UNKNOWN_BOOT_TYPE """ The type of boot. """ @@ -1783,7 +1774,7 @@ class StopBMCAccessRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1796,7 +1787,7 @@ class StopServerRequest: ID of the server to stop. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1814,12 +1805,12 @@ class UpdateIPRequest: ID of the IP to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ New reverse IP to update, not updated if null. """ @@ -1832,27 +1823,27 @@ class UpdateServerRequest: ID of the server to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the server (≠hostname), not updated if null. """ - description: Optional[str] + description: Optional[str] = None """ Description associated with the server, max 255 characters, not updated if null. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the server, not updated if null. """ - protected: Optional[bool] + protected: Optional[bool] = False """ If enabled, the server can not be deleted. """ @@ -1865,12 +1856,12 @@ class UpdateSettingRequest: ID of the setting. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - enabled: Optional[bool] + enabled: Optional[bool] = False """ Defines whether the setting is enabled. """ @@ -1888,12 +1879,12 @@ class ValidatePartitioningSchemaRequest: OS ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - partitioning_schema: Optional[Schema] + partitioning_schema: Optional[Schema] = None """ Partitioning schema. """ diff --git a/scaleway/scaleway/baremetal/v3/marshalling.py b/scaleway/scaleway/baremetal/v3/marshalling.py index d1c8dee32..cb4ab0df0 100644 --- a/scaleway/scaleway/baremetal/v3/marshalling.py +++ b/scaleway/scaleway/baremetal/v3/marshalling.py @@ -6,6 +6,7 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + ServerPrivateNetworkStatus, ServerPrivateNetwork, ListServerPrivateNetworksResponse, SetServerPrivateNetworksResponse, @@ -25,32 +26,44 @@ def unmarshal_ServerPrivateNetwork(data: Any) -> ServerPrivateNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("server_id", None) if field is not None: args["server_id"] = field + else: + args["server_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerPrivateNetworkStatus.UNKNOWN_STATUS field = data.get("ipam_ip_ids", None) if field is not None: args["ipam_ip_ids"] = field + else: + args["ipam_ip_ids"] = field(default_factory=list) field = data.get("vlan", None) if field is not None: args["vlan"] = field else: - args["vlan"] = None + args["vlan"] = 0 field = data.get("created_at", None) if field is not None: @@ -84,10 +97,14 @@ def unmarshal_ListServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListServerPrivateNetworksResponse(**args) @@ -109,6 +126,8 @@ def unmarshal_SetServerPrivateNetworksResponse( if field is not None else None ) + else: + args["server_private_networks"] = None return SetServerPrivateNetworksResponse(**args) diff --git a/scaleway/scaleway/baremetal/v3/types.py b/scaleway/scaleway/baremetal/v3/types.py index e48318896..e90848794 100644 --- a/scaleway/scaleway/baremetal/v3/types.py +++ b/scaleway/scaleway/baremetal/v3/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -69,17 +69,17 @@ class ServerPrivateNetwork: IPAM IP IDs of the server, if it has any. """ - vlan: Optional[int] + vlan: Optional[int] = 0 """ VLAN UUID associated with the Private Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Private Network creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the Private Network was last modified. """ @@ -88,7 +88,6 @@ class ServerPrivateNetwork: @dataclass class ListServerPrivateNetworksResponse: server_private_networks: List[ServerPrivateNetwork] - total_count: int @@ -104,12 +103,12 @@ class PrivateNetworkApiAddServerPrivateNetworkRequest: UUID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ipam_ip_ids: Optional[List[str]] + ipam_ip_ids: Optional[List[str]] = field(default_factory=list) """ IPAM IDs of an IPs to attach to the server. """ @@ -127,7 +126,7 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: UUID of the Private Network. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -135,47 +134,49 @@ class PrivateNetworkApiDeleteServerPrivateNetworkRequest: @dataclass class PrivateNetworkApiListServerPrivateNetworksRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListServerPrivateNetworksRequestOrderBy] + order_by: Optional[ListServerPrivateNetworksRequestOrderBy] = ( + ListServerPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for the returned Private Networks. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned Private Networks. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Private Networks per page. """ - server_id: Optional[str] + server_id: Optional[str] = None """ Filter Private Networks by server UUID. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Filter Private Networks by Private Network UUID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter Private Networks by organization UUID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter Private Networks by project UUID. """ - ipam_ip_ids: Optional[List[str]] + ipam_ip_ids: Optional[List[str]] = field(default_factory=list) """ Filter Private Networks by IPAM IP UUIDs. """ @@ -193,7 +194,7 @@ class PrivateNetworkApiSetServerPrivateNetworksRequest: Object where the keys are the UUIDs of Private Networks and the values are arrays of IPAM IDs representing the IPs to assign to this Elastic Metal server on the Private Network. If the array supplied for a Private Network is empty, the next available IP from the Private Network's CIDR block will automatically be used for attachment. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ diff --git a/scaleway/scaleway/billing/v2beta1/marshalling.py b/scaleway/scaleway/billing/v2beta1/marshalling.py index 57b1d89a7..fb3c240ce 100644 --- a/scaleway/scaleway/billing/v2beta1/marshalling.py +++ b/scaleway/scaleway/billing/v2beta1/marshalling.py @@ -8,6 +8,9 @@ unmarshal_Money, ) from .types import ( + DiscountDiscountMode, + DiscountFilterType, + InvoiceType, DiscountCoupon, DiscountFilter, Discount, @@ -49,14 +52,20 @@ def unmarshal_DiscountFilter(data: Any) -> DiscountFilter: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = DiscountFilterType.UNKNOWN_TYPE field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None field = data.get("exclude", None) if field is not None: args["exclude"] = field + else: + args["exclude"] = False return DiscountFilter(**args) @@ -72,36 +81,52 @@ def unmarshal_Discount(data: Any) -> Discount: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = 0.0 field = data.get("value_used", None) if field is not None: args["value_used"] = field + else: + args["value_used"] = 0.0 field = data.get("value_remaining", None) if field is not None: args["value_remaining"] = field + else: + args["value_remaining"] = 0.0 field = data.get("mode", None) if field is not None: args["mode"] = field + else: + args["mode"] = DiscountDiscountMode.UNKNOWN_DISCOUNT_MODE field = data.get("filters", None) if field is not None: args["filters"] = ( [unmarshal_DiscountFilter(v) for v in field] if field is not None else None ) + else: + args["filters"] = field(default_factory=list) field = data.get("creation_date", None) if field is not None: @@ -143,14 +168,20 @@ def unmarshal_Invoice(data: Any) -> Invoice: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("organization_name", None) if field is not None: args["organization_name"] = field + else: + args["organization_name"] = None field = data.get("start_date", None) if field is not None: @@ -189,18 +220,26 @@ def unmarshal_Invoice(data: Any) -> Invoice: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = InvoiceType.UNKNOWN_TYPE field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None field = data.get("number", None) if field is not None: args["number"] = field + else: + args["number"] = 0 field = data.get("seller_name", None) if field is not None: args["seller_name"] = field + else: + args["seller_name"] = None field = data.get("total_untaxed", None) if field is not None: @@ -248,30 +287,44 @@ def unmarshal_ListConsumptionsResponseConsumption( field = data.get("product_name", None) if field is not None: args["product_name"] = field + else: + args["product_name"] = None field = data.get("resource_name", None) if field is not None: args["resource_name"] = field + else: + args["resource_name"] = None field = data.get("sku", None) if field is not None: args["sku"] = field + else: + args["sku"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("category_name", None) if field is not None: args["category_name"] = field + else: + args["category_name"] = None field = data.get("unit", None) if field is not None: args["unit"] = field + else: + args["unit"] = None field = data.get("billed_quantity", None) if field is not None: args["billed_quantity"] = field + else: + args["billed_quantity"] = None field = data.get("value", None) if field is not None: @@ -297,14 +350,20 @@ def unmarshal_ListConsumptionsResponse(data: Any) -> ListConsumptionsResponse: if field is not None else None ) + else: + args["consumptions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("total_discount_untaxed_value", None) if field is not None: args["total_discount_untaxed_value"] = field + else: + args["total_discount_untaxed_value"] = 0.0 field = data.get("updated_at", None) if field is not None: @@ -326,12 +385,16 @@ def unmarshal_ListDiscountsResponse(data: Any) -> ListDiscountsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("discounts", None) if field is not None: args["discounts"] = ( [unmarshal_Discount(v) for v in field] if field is not None else None ) + else: + args["discounts"] = field(default_factory=list) return ListDiscountsResponse(**args) @@ -347,12 +410,16 @@ def unmarshal_ListInvoicesResponse(data: Any) -> ListInvoicesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("invoices", None) if field is not None: args["invoices"] = ( [unmarshal_Invoice(v) for v in field] if field is not None else None ) + else: + args["invoices"] = field(default_factory=list) return ListInvoicesResponse(**args) @@ -368,22 +435,26 @@ def unmarshal_ListTaxesResponseTax(data: Any) -> ListTaxesResponseTax: field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("currency", None) if field is not None: args["currency"] = field + else: + args["currency"] = None field = data.get("rate", None) if field is not None: args["rate"] = field else: - args["rate"] = None + args["rate"] = 0.0 field = data.get("total_tax_value", None) if field is not None: args["total_tax_value"] = field else: - args["total_tax_value"] = None + args["total_tax_value"] = 0.0 return ListTaxesResponseTax(**args) @@ -403,10 +474,14 @@ def unmarshal_ListTaxesResponse(data: Any) -> ListTaxesResponse: if field is not None else None ) + else: + args["taxes"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("updated_at", None) if field is not None: diff --git a/scaleway/scaleway/billing/v2beta1/types.py b/scaleway/scaleway/billing/v2beta1/types.py index acb11d3e7..0ec8f5fbd 100644 --- a/scaleway/scaleway/billing/v2beta1/types.py +++ b/scaleway/scaleway/billing/v2beta1/types.py @@ -135,7 +135,7 @@ def __str__(self) -> str: @dataclass class DiscountCoupon: - description: Optional[str] + description: Optional[str] = None """ The description of the coupon. """ @@ -196,7 +196,7 @@ class ListConsumptionsResponseConsumption: Consumed quantity. """ - value: Optional[Money] + value: Optional[Money] = None """ Monetary value of the consumption. """ @@ -244,22 +244,22 @@ class Discount: List of the discount scopes. """ - creation_date: Optional[datetime] + creation_date: Optional[datetime] = None """ The creation date of the discount. """ - start_date: Optional[datetime] + start_date: Optional[datetime] = None """ The start date of the discount. """ - stop_date: Optional[datetime] + stop_date: Optional[datetime] = None """ The stop date of the discount. """ - coupon: Optional[DiscountCoupon] + coupon: Optional[DiscountCoupon] = None """ The description of the coupon. """ @@ -273,72 +273,69 @@ class Invoice: """ organization_id: str - organization_name: str - - start_date: Optional[datetime] + type_: InvoiceType """ - Start date of the billing period. + Type of invoice, either periodic or purchase. """ - stop_date: Optional[datetime] - - billing_period: Optional[datetime] + state: str """ - The billing period of the invoice in the YYYY-MM format. + The state of the Invoice. """ - issued_date: Optional[datetime] + number: int """ - Date when the invoice was sent to the customer. + Invoice number. """ - due_date: Optional[datetime] + seller_name: str """ - Payment time limit, set according to the Organization's payment conditions. + The name of the seller (Scaleway). """ - type_: InvoiceType + start_date: Optional[datetime] = None """ - Type of invoice, either periodic or purchase. + Start date of the billing period. """ - state: str + stop_date: Optional[datetime] = None + billing_period: Optional[datetime] = None """ - The state of the Invoice. + The billing period of the invoice in the YYYY-MM format. """ - number: int + issued_date: Optional[datetime] = None """ - Invoice number. + Date when the invoice was sent to the customer. """ - seller_name: str + due_date: Optional[datetime] = None """ - The name of the seller (Scaleway). + Payment time limit, set according to the Organization's payment conditions. """ - total_untaxed: Optional[Money] + total_untaxed: Optional[Money] = None """ Total amount, untaxed. """ - total_taxed: Optional[Money] + total_taxed: Optional[Money] = None """ Total amount, taxed. """ - total_tax: Optional[Money] + total_tax: Optional[Money] = None """ The total tax amount of the invoice. """ - total_discount: Optional[Money] + total_discount: Optional[Money] = None """ The total discount amount of the invoice. """ - total_undiscount: Optional[Money] + total_undiscount: Optional[Money] = None """ The total amount of the invoice before applying the discount. """ @@ -356,12 +353,12 @@ class ListTaxesResponseTax: The three-letter currency code. """ - rate: Optional[float] + rate: Optional[float] = 0.0 """ Applied tax rate (0.2 means a VAT of 20%). """ - total_tax_value: Optional[float] + total_tax_value: Optional[float] = 0.0 """ The total tax value of the consumption. """ @@ -374,7 +371,9 @@ class DownloadInvoiceRequest: Invoice ID. """ - file_type: Optional[DownloadInvoiceRequestFileType] + file_type: Optional[DownloadInvoiceRequestFileType] = ( + DownloadInvoiceRequestFileType.PDF + ) """ File type. PDF by default. """ @@ -382,42 +381,46 @@ class DownloadInvoiceRequest: @dataclass class ExportInvoicesRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID. If specified, only invoices from this Organization will be returned. """ - billing_period_start_after: Optional[datetime] + billing_period_start_after: Optional[datetime] = None """ Return only invoice with start date greater than billing_period_start. """ - billing_period_start_before: Optional[datetime] + billing_period_start_before: Optional[datetime] = None """ Return only invoice with start date less than billing_period_start. """ - invoice_type: Optional[InvoiceType] + invoice_type: Optional[InvoiceType] = InvoiceType.UNKNOWN_TYPE """ Invoice type. It can either be `periodic` or `purchase`. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - order_by: Optional[ExportInvoicesRequestOrderBy] + order_by: Optional[ExportInvoicesRequestOrderBy] = ( + ExportInvoicesRequestOrderBy.INVOICE_NUMBER_DESC + ) """ How invoices are ordered in the response. """ - file_type: Optional[ExportInvoicesRequestFileType] + file_type: Optional[ExportInvoicesRequestFileType] = ( + ExportInvoicesRequestFileType.CSV + ) """ File format for exporting the invoice list. """ @@ -433,34 +436,36 @@ class GetInvoiceRequest: @dataclass class ListConsumptionsRequest: - order_by: Optional[ListConsumptionsRequestOrderBy] + order_by: Optional[ListConsumptionsRequestOrderBy] = ( + ListConsumptionsRequestOrderBy.UPDATED_AT_DESC + ) """ Order consumptions list in the response by their update date. """ - page: Optional[int] + page: Optional[int] = 0 """ Positive integer to choose the page to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - category_name: Optional[str] + category_name: Optional[str] = None """ Filter by name of a Category as they are shown in the invoice (Compute, Network, Observability). """ - billing_period: Optional[str] + billing_period: Optional[str] = None """ Filter by the billing period in the YYYY-MM format. If it is empty the current billing period will be used as default. """ - organization_id: Optional[str] + organization_id: Optional[str] = None - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -480,7 +485,7 @@ class ListConsumptionsResponse: Sum of all discounts, displayed only when no category or project ID filter is applied. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last consumption update date. """ @@ -488,22 +493,24 @@ class ListConsumptionsResponse: @dataclass class ListDiscountsRequest: - order_by: Optional[ListDiscountsRequestOrderBy] + order_by: Optional[ListDiscountsRequestOrderBy] = ( + ListDiscountsRequestOrderBy.CREATION_DATE_DESC + ) """ Order discounts in the response by their description. """ - page: Optional[int] + page: Optional[int] = 0 """ Positive integer to choose the page to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the organization. """ @@ -524,37 +531,39 @@ class ListDiscountsResponse: @dataclass class ListInvoicesRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID. If specified, only invoices from this Organization will be returned. """ - billing_period_start_after: Optional[datetime] + billing_period_start_after: Optional[datetime] = None """ Return only invoice with start date greater than billing_period_start. """ - billing_period_start_before: Optional[datetime] + billing_period_start_before: Optional[datetime] = None """ Return only invoice with start date less than billing_period_start. """ - invoice_type: Optional[InvoiceType] + invoice_type: Optional[InvoiceType] = InvoiceType.UNKNOWN_TYPE """ Invoice type. It can either be `periodic` or `purchase`. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - order_by: Optional[ListInvoicesRequestOrderBy] + order_by: Optional[ListInvoicesRequestOrderBy] = ( + ListInvoicesRequestOrderBy.INVOICE_NUMBER_DESC + ) """ How invoices are ordered in the response. """ @@ -575,27 +584,29 @@ class ListInvoicesResponse: @dataclass class ListTaxesRequest: - order_by: Optional[ListTaxesRequestOrderBy] + order_by: Optional[ListTaxesRequestOrderBy] = ( + ListTaxesRequestOrderBy.UPDATED_AT_DESC + ) """ Order consumed taxes list in the response by their update date. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Positive integer lower or equal to 100 to select the number of items to return. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - billing_period: Optional[str] + billing_period: Optional[str] = None """ Filter by the billing period in the YYYY-MM format. If it is empty the current billing period will be used as default. """ @@ -613,7 +624,7 @@ class ListTaxesResponse: Total number of returned items. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last consumption update date. """ @@ -626,7 +637,7 @@ class RedeemCouponRequest: The code of the coupon to redeem. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ The Organization ID of the discount. """ diff --git a/scaleway/scaleway/block/v1/marshalling.py b/scaleway/scaleway/block/v1/marshalling.py index 31e50d261..47a10f260 100644 --- a/scaleway/scaleway/block/v1/marshalling.py +++ b/scaleway/scaleway/block/v1/marshalling.py @@ -13,6 +13,11 @@ resolve_one_of, ) from .types import ( + ReferenceStatus, + ReferenceType, + SnapshotStatus, + StorageClass, + VolumeStatus, Reference, SnapshotParentVolume, Snapshot, @@ -44,22 +49,32 @@ def unmarshal_Reference(data: Any) -> Reference: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("product_resource_type", None) if field is not None: args["product_resource_type"] = field + else: + args["product_resource_type"] = None field = data.get("product_resource_id", None) if field is not None: args["product_resource_id"] = field + else: + args["product_resource_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ReferenceType.UNKNOWN_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ReferenceStatus.UNKNOWN_STATUS field = data.get("created_at", None) if field is not None: @@ -81,18 +96,26 @@ def unmarshal_SnapshotParentVolume(data: Any) -> SnapshotParentVolume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = VolumeStatus.UNKNOWN_STATUS return SnapshotParentVolume(**args) @@ -108,40 +131,58 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("references", None) if field is not None: args["references"] = ( [unmarshal_Reference(v) for v in field] if field is not None else None ) + else: + args["references"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SnapshotStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = StorageClass.UNKNOWN_STORAGE_CLASS field = data.get("parent_volume", None) if field is not None: @@ -175,12 +216,14 @@ def unmarshal_VolumeSpecifications(data: Any) -> VolumeSpecifications: field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = StorageClass.UNKNOWN_STORAGE_CLASS field = data.get("perf_iops", None) if field is not None: args["perf_iops"] = field else: - args["perf_iops"] = None + args["perf_iops"] = 0 return VolumeSpecifications(**args) @@ -196,28 +239,40 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("references", None) if field is not None: args["references"] = ( [unmarshal_Reference(v) for v in field] if field is not None else None ) + else: + args["references"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -240,14 +295,20 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = VolumeStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("specs", None) if field is not None: @@ -279,10 +340,14 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSnapshotsResponse(**args) @@ -298,6 +363,8 @@ def unmarshal_VolumeType(data: Any) -> VolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("pricing", None) if field is not None: @@ -333,10 +400,14 @@ def unmarshal_ListVolumeTypesResponse(data: Any) -> ListVolumeTypesResponse: args["volume_types"] = ( [unmarshal_VolumeType(v) for v in field] if field is not None else None ) + else: + args["volume_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVolumeTypesResponse(**args) @@ -354,10 +425,14 @@ def unmarshal_ListVolumesResponse(data: Any) -> ListVolumesResponse: args["volumes"] = ( [unmarshal_Volume(v) for v in field] if field is not None else None ) + else: + args["volumes"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVolumesResponse(**args) @@ -375,7 +450,9 @@ def marshal_CreateSnapshotRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -445,7 +522,9 @@ def marshal_CreateVolumeRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -484,7 +563,9 @@ def marshal_ImportSnapshotFromObjectStorageRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway/scaleway/block/v1/types.py b/scaleway/scaleway/block/v1/types.py index d666ce94c..935a2bbe8 100644 --- a/scaleway/scaleway/block/v1/types.py +++ b/scaleway/scaleway/block/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -128,7 +128,7 @@ class Reference: Status of the reference. Statuses include `attaching`, `attached`, and `detaching`. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the reference. """ @@ -164,7 +164,7 @@ class VolumeSpecifications: The storage class of the volume. """ - perf_iops: Optional[int] + perf_iops: Optional[int] = 0 """ The maximum IO/s expected, according to the different options available in stock (`5000 | 15000`). """ @@ -185,7 +185,7 @@ class CreateVolumeRequestFromSnapshot: Source snapshot from which volume will be created. """ - size: Optional[int] + size: Optional[int] = 0 """ Must be compliant with the minimum (1 GB) and maximum (10 TB) allowed size. Size is optional and is used only if a resize of the volume is requested, otherwise original snapshot size will be used. @@ -239,17 +239,17 @@ class Snapshot: Storage class of the snapshot. """ - parent_volume: Optional[SnapshotParentVolume] + parent_volume: Optional[SnapshotParentVolume] = None """ If the parent volume was deleted, value is null. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the snapshot. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the properties of a snapshot. """ @@ -262,17 +262,17 @@ class VolumeType: Volume type. """ - pricing: Optional[Money] + pricing: Optional[Money] = None """ Price of the volume billed in GB/hour. """ - snapshot_pricing: Optional[Money] + snapshot_pricing: Optional[Money] = None """ Price of the snapshot billed in GB/hour. """ - specs: Optional[VolumeSpecifications] + specs: Optional[VolumeSpecifications] = None """ Volume specifications of the volume type. """ @@ -310,42 +310,42 @@ class Volume: List of the references to the volume. """ - created_at: Optional[datetime] + status: VolumeStatus """ - Creation date of the volume. + Current status of the volume (available, in_use, ...). """ - updated_at: Optional[datetime] + tags: List[str] """ - Last update of the properties of a volume. + List of tags assigned to the volume. """ - parent_snapshot_id: Optional[str] + zone: ScwZone """ - When a volume is created from a snapshot, is the UUID of the snapshot from which the volume has been created. + Volume zone. """ - status: VolumeStatus + created_at: Optional[datetime] = None """ - Current status of the volume (available, in_use, ...). + Creation date of the volume. """ - tags: List[str] + updated_at: Optional[datetime] = None """ - List of tags assigned to the volume. + Last update of the properties of a volume. """ - zone: ScwZone + parent_snapshot_id: Optional[str] = None """ - Volume zone. + When a volume is created from a snapshot, is the UUID of the snapshot from which the volume has been created. """ - specs: Optional[VolumeSpecifications] + specs: Optional[VolumeSpecifications] = None """ Specifications of the volume. """ - last_detached_at: Optional[datetime] + last_detached_at: Optional[datetime] = None """ Last time the volume was detached. """ @@ -358,22 +358,22 @@ class CreateSnapshotRequest: UUID of the volume to snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project to which the volume and the snapshot belong. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ @@ -381,31 +381,31 @@ class CreateSnapshotRequest: @dataclass class CreateVolumeRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the volume. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project the volume belongs to. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the volume. """ - from_empty: Optional[CreateVolumeRequestFromEmpty] + from_empty: Optional[CreateVolumeRequestFromEmpty] = None - from_snapshot: Optional[CreateVolumeRequestFromSnapshot] + from_snapshot: Optional[CreateVolumeRequestFromSnapshot] = None - perf_iops: Optional[int] + perf_iops: Optional[int] = None @dataclass @@ -415,7 +415,7 @@ class DeleteSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -428,7 +428,7 @@ class DeleteVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -451,7 +451,7 @@ class ExportSnapshotToObjectStorageRequest: The object key inside the given bucket. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -464,7 +464,7 @@ class GetSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -477,7 +477,7 @@ class GetVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -500,22 +500,22 @@ class ImportSnapshotFromObjectStorageRequest: Name of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project to which the volume and the snapshot belong. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ - size: Optional[int] + size: Optional[int] = 0 """ Size of the snapshot. """ @@ -523,47 +523,49 @@ class ImportSnapshotFromObjectStorageRequest: @dataclass class ListSnapshotsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListSnapshotsRequestOrderBy] + order_by: Optional[ListSnapshotsRequestOrderBy] = ( + ListSnapshotsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ - volume_id: Optional[str] + volume_id: Optional[str] = None """ Filter snapshots by the ID of the original volume. """ - name: Optional[str] + name: Optional[str] = None """ Filter snapshots by their names. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. Only snapshots with one or more matching tags will be returned. """ @@ -584,17 +586,17 @@ class ListSnapshotsResponse: @dataclass class ListVolumeTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ @@ -615,47 +617,49 @@ class ListVolumeTypesResponse: @dataclass class ListVolumesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListVolumesRequestOrderBy] + order_by: Optional[ListVolumesRequestOrderBy] = ( + ListVolumesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ - name: Optional[str] + name: Optional[str] = None """ Filter the return volumes by their names. """ - product_resource_id: Optional[str] + product_resource_id: Optional[str] = None """ Filter by a product resource ID linked to this volume (such as an Instance ID). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. Only volumes with one or more matching tags will be returned. """ @@ -681,17 +685,17 @@ class UpdateSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ When defined, is the name of the snapshot. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ @@ -704,28 +708,28 @@ class UpdateVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ When defined, is the new name of the volume. """ - size: Optional[int] + size: Optional[int] = 0 """ Size in bytes of the volume, with a granularity of 1 GB (10^9 bytes). Must be compliant with the minimum (1GB) and maximum (10TB) allowed size. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the volume. """ - perf_iops: Optional[int] + perf_iops: Optional[int] = 0 """ The selected value must be available for the volume's current storage class. """ diff --git a/scaleway/scaleway/block/v1alpha1/marshalling.py b/scaleway/scaleway/block/v1alpha1/marshalling.py index a2ae2b31e..3d00c18d2 100644 --- a/scaleway/scaleway/block/v1alpha1/marshalling.py +++ b/scaleway/scaleway/block/v1alpha1/marshalling.py @@ -13,6 +13,11 @@ resolve_one_of, ) from .types import ( + ReferenceStatus, + ReferenceType, + SnapshotStatus, + StorageClass, + VolumeStatus, Reference, SnapshotParentVolume, Snapshot, @@ -45,22 +50,32 @@ def unmarshal_Reference(data: Any) -> Reference: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("product_resource_type", None) if field is not None: args["product_resource_type"] = field + else: + args["product_resource_type"] = None field = data.get("product_resource_id", None) if field is not None: args["product_resource_id"] = field + else: + args["product_resource_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ReferenceType.UNKNOWN_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ReferenceStatus.UNKNOWN_STATUS field = data.get("created_at", None) if field is not None: @@ -82,18 +97,26 @@ def unmarshal_SnapshotParentVolume(data: Any) -> SnapshotParentVolume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = VolumeStatus.UNKNOWN_STATUS return SnapshotParentVolume(**args) @@ -109,40 +132,58 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("references", None) if field is not None: args["references"] = ( [unmarshal_Reference(v) for v in field] if field is not None else None ) + else: + args["references"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SnapshotStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = StorageClass.UNKNOWN_STORAGE_CLASS field = data.get("parent_volume", None) if field is not None: @@ -176,12 +217,14 @@ def unmarshal_VolumeSpecifications(data: Any) -> VolumeSpecifications: field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = StorageClass.UNKNOWN_STORAGE_CLASS field = data.get("perf_iops", None) if field is not None: args["perf_iops"] = field else: - args["perf_iops"] = None + args["perf_iops"] = 0 return VolumeSpecifications(**args) @@ -197,28 +240,40 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("references", None) if field is not None: args["references"] = ( [unmarshal_Reference(v) for v in field] if field is not None else None ) + else: + args["references"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -241,14 +296,20 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = VolumeStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("specs", None) if field is not None: @@ -280,10 +341,14 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSnapshotsResponse(**args) @@ -299,6 +364,8 @@ def unmarshal_VolumeType(data: Any) -> VolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("pricing", None) if field is not None: @@ -334,10 +401,14 @@ def unmarshal_ListVolumeTypesResponse(data: Any) -> ListVolumeTypesResponse: args["volume_types"] = ( [unmarshal_VolumeType(v) for v in field] if field is not None else None ) + else: + args["volume_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVolumeTypesResponse(**args) @@ -355,10 +426,14 @@ def unmarshal_ListVolumesResponse(data: Any) -> ListVolumesResponse: args["volumes"] = ( [unmarshal_Volume(v) for v in field] if field is not None else None ) + else: + args["volumes"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVolumesResponse(**args) @@ -376,7 +451,9 @@ def marshal_CreateSnapshotRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -446,7 +523,9 @@ def marshal_CreateVolumeRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -485,7 +564,9 @@ def marshal_ImportSnapshotFromObjectStorageRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -512,7 +593,9 @@ def marshal_ImportSnapshotFromS3Request( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway/scaleway/block/v1alpha1/types.py b/scaleway/scaleway/block/v1alpha1/types.py index 2f15d1ec0..282599100 100644 --- a/scaleway/scaleway/block/v1alpha1/types.py +++ b/scaleway/scaleway/block/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -128,7 +128,7 @@ class Reference: Status of the reference. Statuses include `attaching`, `attached`, and `detaching`. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the reference. """ @@ -164,7 +164,7 @@ class VolumeSpecifications: The storage class of the volume. """ - perf_iops: Optional[int] + perf_iops: Optional[int] = 0 """ The maximum IO/s expected, according to the different options available in stock (`5000 | 15000`). """ @@ -185,7 +185,7 @@ class CreateVolumeRequestFromSnapshot: Source snapshot from which volume will be created. """ - size: Optional[int] + size: Optional[int] = 0 """ Must be compliant with the minimum (1 GB) and maximum (10 TB) allowed size. Size is optional and is used only if a resize of the volume is requested, otherwise original snapshot size will be used. @@ -239,17 +239,17 @@ class Snapshot: Storage class of the snapshot. """ - parent_volume: Optional[SnapshotParentVolume] + parent_volume: Optional[SnapshotParentVolume] = None """ If the parent volume was deleted, value is null. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the snapshot. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the properties of a snapshot. """ @@ -262,17 +262,17 @@ class VolumeType: Volume type. """ - pricing: Optional[Money] + pricing: Optional[Money] = None """ Price of the volume billed in GB/hour. """ - snapshot_pricing: Optional[Money] + snapshot_pricing: Optional[Money] = None """ Price of the snapshot billed in GB/hour. """ - specs: Optional[VolumeSpecifications] + specs: Optional[VolumeSpecifications] = None """ Volume specifications of the volume type. """ @@ -310,42 +310,42 @@ class Volume: List of the references to the volume. """ - created_at: Optional[datetime] + status: VolumeStatus """ - Creation date of the volume. + Current status of the volume (available, in_use, ...). """ - updated_at: Optional[datetime] + tags: List[str] """ - Last update of the properties of a volume. + List of tags assigned to the volume. """ - parent_snapshot_id: Optional[str] + zone: ScwZone """ - When a volume is created from a snapshot, is the UUID of the snapshot from which the volume has been created. + Volume zone. """ - status: VolumeStatus + created_at: Optional[datetime] = None """ - Current status of the volume (available, in_use, ...). + Creation date of the volume. """ - tags: List[str] + updated_at: Optional[datetime] = None """ - List of tags assigned to the volume. + Last update of the properties of a volume. """ - zone: ScwZone + parent_snapshot_id: Optional[str] = None """ - Volume zone. + When a volume is created from a snapshot, is the UUID of the snapshot from which the volume has been created. """ - specs: Optional[VolumeSpecifications] + specs: Optional[VolumeSpecifications] = None """ Specifications of the volume. """ - last_detached_at: Optional[datetime] + last_detached_at: Optional[datetime] = None """ Last time the volume was detached. """ @@ -358,22 +358,22 @@ class CreateSnapshotRequest: UUID of the volume to snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project to which the volume and the snapshot belong. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ @@ -381,31 +381,31 @@ class CreateSnapshotRequest: @dataclass class CreateVolumeRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the volume. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project the volume belongs to. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the volume. """ - from_empty: Optional[CreateVolumeRequestFromEmpty] + from_empty: Optional[CreateVolumeRequestFromEmpty] = None - from_snapshot: Optional[CreateVolumeRequestFromSnapshot] + from_snapshot: Optional[CreateVolumeRequestFromSnapshot] = None - perf_iops: Optional[int] + perf_iops: Optional[int] = None @dataclass @@ -415,7 +415,7 @@ class DeleteSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -428,7 +428,7 @@ class DeleteVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -451,7 +451,7 @@ class ExportSnapshotToObjectStorageRequest: The object key inside the given bucket. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -464,7 +464,7 @@ class GetSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -477,7 +477,7 @@ class GetVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -500,22 +500,22 @@ class ImportSnapshotFromObjectStorageRequest: Name of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project to which the volume and the snapshot belong. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ - size: Optional[int] + size: Optional[int] = 0 """ Size of the snapshot. """ @@ -538,22 +538,22 @@ class ImportSnapshotFromS3Request: Name of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project to which the volume and the snapshot belong. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ - size: Optional[int] + size: Optional[int] = 0 """ Size of the snapshot. """ @@ -561,47 +561,49 @@ class ImportSnapshotFromS3Request: @dataclass class ListSnapshotsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListSnapshotsRequestOrderBy] + order_by: Optional[ListSnapshotsRequestOrderBy] = ( + ListSnapshotsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ - volume_id: Optional[str] + volume_id: Optional[str] = None """ Filter snapshots by the ID of the original volume. """ - name: Optional[str] + name: Optional[str] = None """ Filter snapshots by their names. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. Only snapshots with one or more matching tags will be returned. """ @@ -622,17 +624,17 @@ class ListSnapshotsResponse: @dataclass class ListVolumeTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ @@ -653,47 +655,49 @@ class ListVolumeTypesResponse: @dataclass class ListVolumesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListVolumesRequestOrderBy] + order_by: Optional[ListVolumesRequestOrderBy] = ( + ListVolumesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size, defines how many entries are returned in one page, must be lower or equal to 100. """ - name: Optional[str] + name: Optional[str] = None """ Filter the return volumes by their names. """ - product_resource_id: Optional[str] + product_resource_id: Optional[str] = None """ Filter by a product resource ID linked to this volume (such as an Instance ID). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. Only volumes with one or more matching tags will be returned. """ @@ -719,17 +723,17 @@ class UpdateSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ When defined, is the name of the snapshot. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the snapshot. """ @@ -742,28 +746,28 @@ class UpdateVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ When defined, is the new name of the volume. """ - size: Optional[int] + size: Optional[int] = 0 """ Size in bytes of the volume, with a granularity of 1 GB (10^9 bytes). Must be compliant with the minimum (1GB) and maximum (10TB) allowed size. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the volume. """ - perf_iops: Optional[int] + perf_iops: Optional[int] = 0 """ The selected value must be available for the volume's current storage class. """ diff --git a/scaleway/scaleway/cockpit/v1/marshalling.py b/scaleway/scaleway/cockpit/v1/marshalling.py index c40e5ff04..f2e0843f8 100644 --- a/scaleway/scaleway/cockpit/v1/marshalling.py +++ b/scaleway/scaleway/cockpit/v1/marshalling.py @@ -10,7 +10,14 @@ resolve_one_of, ) from .types import ( + AlertState, + AlertStatus, + DataSourceOrigin, + DataSourceType, + GrafanaUserRole, + PlanName, TokenScope, + UsageUnit, ContactPointEmail, ContactPoint, DataSource, @@ -68,6 +75,8 @@ def unmarshal_ContactPointEmail(data: Any) -> ContactPointEmail: field = data.get("to", None) if field is not None: args["to"] = field + else: + args["to"] = None return ContactPointEmail(**args) @@ -83,10 +92,14 @@ def unmarshal_ContactPoint(data: Any) -> ContactPoint: field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("send_resolved_notifications", None) if field is not None: args["send_resolved_notifications"] = field + else: + args["send_resolved_notifications"] = False field = data.get("email", None) if field is not None: @@ -108,38 +121,56 @@ def unmarshal_DataSource(data: Any) -> DataSource: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = DataSourceType.UNKNOWN_TYPE field = data.get("origin", None) if field is not None: args["origin"] = field + else: + args["origin"] = DataSourceOrigin.UNKNOWN_ORIGIN field = data.get("synchronized_with_grafana", None) if field is not None: args["synchronized_with_grafana"] = field + else: + args["synchronized_with_grafana"] = False field = data.get("retention_days", None) if field is not None: args["retention_days"] = field + else: + args["retention_days"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -167,22 +198,32 @@ def unmarshal_GrafanaProductDashboard(data: Any) -> GrafanaProductDashboard: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("title", None) if field is not None: args["title"] = field + else: + args["title"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("variables", None) if field is not None: args["variables"] = field + else: + args["variables"] = field(default_factory=list) return GrafanaProductDashboard(**args) @@ -198,14 +239,20 @@ def unmarshal_GrafanaUser(data: Any) -> GrafanaUser: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("login", None) if field is not None: args["login"] = field + else: + args["login"] = None field = data.get("role", None) if field is not None: args["role"] = field + else: + args["role"] = GrafanaUserRole.UNKNOWN_ROLE field = data.get("password", None) if field is not None: @@ -227,22 +274,32 @@ def unmarshal_Plan(data: Any) -> Plan: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = PlanName.UNKNOWN_NAME field = data.get("sample_ingestion_price", None) if field is not None: args["sample_ingestion_price"] = field + else: + args["sample_ingestion_price"] = 0 field = data.get("logs_ingestion_price", None) if field is not None: args["logs_ingestion_price"] = field + else: + args["logs_ingestion_price"] = 0 field = data.get("traces_ingestion_price", None) if field is not None: args["traces_ingestion_price"] = field + else: + args["traces_ingestion_price"] = 0 field = data.get("monthly_price", None) if field is not None: args["monthly_price"] = field + else: + args["monthly_price"] = 0 field = data.get("retention_metrics_interval", None) if field is not None: @@ -276,22 +333,32 @@ def unmarshal_Token(data: Any) -> Token: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("scopes", None) if field is not None: args["scopes"] = [TokenScope(v) for v in field] if field is not None else None + else: + args["scopes"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -325,14 +392,20 @@ def unmarshal_AlertManager(data: Any) -> AlertManager: field = data.get("alert_manager_enabled", None) if field is not None: args["alert_manager_enabled"] = field + else: + args["alert_manager_enabled"] = False field = data.get("managed_alerts_enabled", None) if field is not None: args["managed_alerts_enabled"] = field + else: + args["managed_alerts_enabled"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("alert_manager_url", None) if field is not None: @@ -354,6 +427,8 @@ def unmarshal_DisableAlertRulesResponse(data: Any) -> DisableAlertRulesResponse: field = data.get("disabled_rule_ids", None) if field is not None: args["disabled_rule_ids"] = field + else: + args["disabled_rule_ids"] = field(default_factory=list) return DisableAlertRulesResponse(**args) @@ -369,6 +444,8 @@ def unmarshal_EnableAlertRulesResponse(data: Any) -> EnableAlertRulesResponse: field = data.get("enabled_rule_ids", None) if field is not None: args["enabled_rule_ids"] = field + else: + args["enabled_rule_ids"] = field(default_factory=list) return EnableAlertRulesResponse(**args) @@ -384,14 +461,20 @@ def unmarshal_GetConfigResponseRetention(data: Any) -> GetConfigResponseRetentio field = data.get("min_days", None) if field is not None: args["min_days"] = field + else: + args["min_days"] = None field = data.get("max_days", None) if field is not None: args["max_days"] = field + else: + args["max_days"] = None field = data.get("default_days", None) if field is not None: args["default_days"] = field + else: + args["default_days"] = None return GetConfigResponseRetention(**args) @@ -448,14 +531,20 @@ def unmarshal_RulesCount(data: Any) -> RulesCount: field = data.get("data_source_id", None) if field is not None: args["data_source_id"] = field + else: + args["data_source_id"] = None field = data.get("data_source_name", None) if field is not None: args["data_source_name"] = field + else: + args["data_source_name"] = None field = data.get("rules_count", None) if field is not None: args["rules_count"] = field + else: + args["rules_count"] = 0 return RulesCount(**args) @@ -473,14 +562,20 @@ def unmarshal_GetRulesCountResponse(data: Any) -> GetRulesCountResponse: args["rules_count_by_datasource"] = ( [unmarshal_RulesCount(v) for v in field] if field is not None else None ) + else: + args["rules_count_by_datasource"] = field(default_factory=list) field = data.get("preconfigured_rules_count", None) if field is not None: args["preconfigured_rules_count"] = field + else: + args["preconfigured_rules_count"] = 0 field = data.get("custom_rules_count", None) if field is not None: args["custom_rules_count"] = field + else: + args["custom_rules_count"] = 0 return GetRulesCountResponse(**args) @@ -496,6 +591,8 @@ def unmarshal_Grafana(data: Any) -> Grafana: field = data.get("grafana_url", None) if field is not None: args["grafana_url"] = field + else: + args["grafana_url"] = None return Grafana(**args) @@ -511,22 +608,32 @@ def unmarshal_PreconfiguredAlertData(data: Any) -> PreconfiguredAlertData: field = data.get("preconfigured_rule_id", None) if field is not None: args["preconfigured_rule_id"] = field + else: + args["preconfigured_rule_id"] = None field = data.get("display_name", None) if field is not None: args["display_name"] = field + else: + args["display_name"] = None field = data.get("display_description", None) if field is not None: args["display_description"] = field + else: + args["display_description"] = None field = data.get("product_name", None) if field is not None: args["product_name"] = field + else: + args["product_name"] = None field = data.get("product_family", None) if field is not None: args["product_family"] = field + else: + args["product_family"] = None return PreconfiguredAlertData(**args) @@ -542,40 +649,56 @@ def unmarshal_Alert(data: Any) -> Alert: field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("preconfigured", None) if field is not None: args["preconfigured"] = field + else: + args["preconfigured"] = False field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("rule", None) if field is not None: args["rule"] = field + else: + args["rule"] = None field = data.get("duration", None) if field is not None: args["duration"] = field + else: + args["duration"] = None field = data.get("rule_status", None) if field is not None: args["rule_status"] = field + else: + args["rule_status"] = AlertStatus.UNKNOWN_STATUS field = data.get("annotations", None) if field is not None: args["annotations"] = field + else: + args["annotations"] = field(default_factory=dict) field = data.get("data_source_id", None) if field is not None: args["data_source_id"] = field + else: + args["data_source_id"] = None field = data.get("state", None) if field is not None: args["state"] = field else: - args["state"] = None + args["state"] = AlertState.UNKNOWN_STATE field = data.get("preconfigured_data", None) if field is not None: @@ -597,12 +720,16 @@ def unmarshal_ListAlertsResponse(data: Any) -> ListAlertsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("alerts", None) if field is not None: args["alerts"] = ( [unmarshal_Alert(v) for v in field] if field is not None else None ) + else: + args["alerts"] = field(default_factory=list) return ListAlertsResponse(**args) @@ -618,20 +745,28 @@ def unmarshal_ListContactPointsResponse(data: Any) -> ListContactPointsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("contact_points", None) if field is not None: args["contact_points"] = ( [unmarshal_ContactPoint(v) for v in field] if field is not None else None ) + else: + args["contact_points"] = field(default_factory=list) field = data.get("has_additional_receivers", None) if field is not None: args["has_additional_receivers"] = field + else: + args["has_additional_receivers"] = False field = data.get("has_additional_contact_points", None) if field is not None: args["has_additional_contact_points"] = field + else: + args["has_additional_contact_points"] = False return ListContactPointsResponse(**args) @@ -647,12 +782,16 @@ def unmarshal_ListDataSourcesResponse(data: Any) -> ListDataSourcesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("data_sources", None) if field is not None: args["data_sources"] = ( [unmarshal_DataSource(v) for v in field] if field is not None else None ) + else: + args["data_sources"] = field(default_factory=list) return ListDataSourcesResponse(**args) @@ -670,6 +809,8 @@ def unmarshal_ListGrafanaProductDashboardsResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("dashboards", None) if field is not None: @@ -678,6 +819,8 @@ def unmarshal_ListGrafanaProductDashboardsResponse( if field is not None else None ) + else: + args["dashboards"] = field(default_factory=list) return ListGrafanaProductDashboardsResponse(**args) @@ -693,12 +836,16 @@ def unmarshal_ListGrafanaUsersResponse(data: Any) -> ListGrafanaUsersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("grafana_users", None) if field is not None: args["grafana_users"] = ( [unmarshal_GrafanaUser(v) for v in field] if field is not None else None ) + else: + args["grafana_users"] = field(default_factory=list) return ListGrafanaUsersResponse(**args) @@ -714,12 +861,16 @@ def unmarshal_ListPlansResponse(data: Any) -> ListPlansResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("plans", None) if field is not None: args["plans"] = ( [unmarshal_Plan(v) for v in field] if field is not None else None ) + else: + args["plans"] = field(default_factory=list) return ListPlansResponse(**args) @@ -735,12 +886,16 @@ def unmarshal_ListTokensResponse(data: Any) -> ListTokensResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("tokens", None) if field is not None: args["tokens"] = ( [unmarshal_Token(v) for v in field] if field is not None else None ) + else: + args["tokens"] = field(default_factory=list) return ListTokensResponse(**args) @@ -756,26 +911,38 @@ def unmarshal_Usage(data: Any) -> Usage: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("data_source_origin", None) if field is not None: args["data_source_origin"] = field + else: + args["data_source_origin"] = DataSourceOrigin.UNKNOWN_ORIGIN field = data.get("data_source_type", None) if field is not None: args["data_source_type"] = field + else: + args["data_source_type"] = DataSourceType.UNKNOWN_TYPE field = data.get("unit", None) if field is not None: args["unit"] = field + else: + args["unit"] = UsageUnit.UNKNOWN_UNIT field = data.get("quantity_over_interval", None) if field is not None: args["quantity_over_interval"] = field + else: + args["quantity_over_interval"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("data_source_id", None) if field is not None: @@ -843,10 +1010,12 @@ def marshal_GlobalApiCreateGrafanaUserRequest( output["login"] = request.login if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.role is not None: - output["role"] = str(request.role) + output["role"] = request.role return output @@ -858,7 +1027,9 @@ def marshal_GlobalApiResetGrafanaUserPasswordRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -870,10 +1041,12 @@ def marshal_GlobalApiSelectPlanRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.plan_name is not None: - output["plan_name"] = str(request.plan_name) + output["plan_name"] = request.plan_name return output @@ -885,7 +1058,9 @@ def marshal_GlobalApiSyncGrafanaDataSourcesRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -920,7 +1095,9 @@ def marshal_RegionalApiCreateContactPointRequest( ) if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.send_resolved_notifications is not None: output["send_resolved_notifications"] = request.send_resolved_notifications @@ -938,10 +1115,12 @@ def marshal_RegionalApiCreateDataSourceRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.retention_days is not None: output["retention_days"] = request.retention_days @@ -959,7 +1138,9 @@ def marshal_RegionalApiCreateTokenRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.token_scopes is not None: output["token_scopes"] = [str(item) for item in request.token_scopes] @@ -985,7 +1166,9 @@ def marshal_RegionalApiDeleteContactPointRequest( ) if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -997,7 +1180,9 @@ def marshal_RegionalApiDisableAlertManagerRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1009,7 +1194,9 @@ def marshal_RegionalApiDisableAlertRulesRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.rule_ids is not None: output["rule_ids"] = request.rule_ids @@ -1024,7 +1211,9 @@ def marshal_RegionalApiDisableManagedAlertsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1036,7 +1225,9 @@ def marshal_RegionalApiEnableAlertManagerRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1048,7 +1239,9 @@ def marshal_RegionalApiEnableAlertRulesRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.rule_ids is not None: output["rule_ids"] = request.rule_ids @@ -1063,7 +1256,9 @@ def marshal_RegionalApiEnableManagedAlertsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1075,7 +1270,9 @@ def marshal_RegionalApiTriggerTestAlertRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1098,7 +1295,9 @@ def marshal_RegionalApiUpdateContactPointRequest( ) if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.send_resolved_notifications is not None: output["send_resolved_notifications"] = request.send_resolved_notifications diff --git a/scaleway/scaleway/cockpit/v1/types.py b/scaleway/scaleway/cockpit/v1/types.py index b953f921c..2ed41cfcc 100644 --- a/scaleway/scaleway/cockpit/v1/types.py +++ b/scaleway/scaleway/cockpit/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -178,9 +178,7 @@ class ContactPointEmail: @dataclass class GetConfigResponseRetention: min_days: int - max_days: int - default_days: int @@ -248,12 +246,12 @@ class Alert: ID of the data source containing the alert rule. """ - state: Optional[AlertState] + state: Optional[AlertState] = AlertState.UNKNOWN_STATE """ Current state of the alert. Possible states are `inactive`, `pending`, and `firing`. """ - preconfigured_data: Optional[PreconfiguredAlertData] + preconfigured_data: Optional[PreconfiguredAlertData] = None """ Contains additional data for preconfigured alerts, such as the rule ID, display name, and description. Only present if the alert is preconfigured. """ @@ -275,7 +273,7 @@ class ContactPoint: Send an email notification when an alert is marked as resolved. """ - email: Optional[ContactPointEmail] + email: Optional[ContactPointEmail] = None @dataclass @@ -329,12 +327,12 @@ class DataSource: Region of the data source. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the data source was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the data source was last updated. """ @@ -393,7 +391,7 @@ class GrafanaUser: Role assigned to the Grafana user. """ - password: Optional[str] + password: Optional[str] = None """ Grafana user's password. """ @@ -430,17 +428,17 @@ class Plan: Retention price in euros per month. """ - retention_metrics_interval: Optional[str] + retention_metrics_interval: Optional[str] = None """ Interval of time during which Scaleway's Cockpit keeps your metrics. """ - retention_logs_interval: Optional[str] + retention_logs_interval: Optional[str] = None """ Interval of time during which Scaleway's Cockpit keeps your logs. """ - retention_traces_interval: Optional[str] + retention_traces_interval: Optional[str] = None """ Interval of time during which Scaleway's Cockpit keeps your traces. """ @@ -477,17 +475,17 @@ class Token: Regions where the token is located. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Token creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Token last modification date. """ - secret_key: Optional[str] + secret_key: Optional[str] = None """ Token secret key. """ @@ -529,12 +527,12 @@ class Usage: Region of the data source usage. """ - data_source_id: Optional[str] + data_source_id: Optional[str] = None """ ID of the data source. """ - interval: Optional[str] + interval: Optional[str] = None """ Interval for the data source usage. """ @@ -561,7 +559,7 @@ class AlertManager: Regions where the Alert manager is enabled. """ - alert_manager_url: Optional[str] + alert_manager_url: Optional[str] = None """ Alert manager URL. """ @@ -597,27 +595,27 @@ class GetConfigResponse: Cockpit configuration. """ - custom_metrics_retention: Optional[GetConfigResponseRetention] + custom_metrics_retention: Optional[GetConfigResponseRetention] = None """ Custom metrics retention configuration. """ - custom_logs_retention: Optional[GetConfigResponseRetention] + custom_logs_retention: Optional[GetConfigResponseRetention] = None """ Custom logs retention configuration. """ - custom_traces_retention: Optional[GetConfigResponseRetention] + custom_traces_retention: Optional[GetConfigResponseRetention] = None """ Custom traces retention configuration. """ - product_metrics_retention: Optional[GetConfigResponseRetention] + product_metrics_retention: Optional[GetConfigResponseRetention] = None """ Scaleway metrics retention configuration. """ - product_logs_retention: Optional[GetConfigResponseRetention] + product_logs_retention: Optional[GetConfigResponseRetention] = None """ Scaleway logs retention configuration. """ @@ -652,12 +650,12 @@ class GlobalApiCreateGrafanaUserRequest: Username of the Grafana user. Note that the `admin` username is not available for creation. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project in which to create the Grafana user. """ - role: Optional[GrafanaUserRole] + role: Optional[GrafanaUserRole] = GrafanaUserRole.UNKNOWN_ROLE """ Role assigned to the Grafana user. """ @@ -669,14 +667,14 @@ class GlobalApiDeleteGrafanaUserRequest: Delete a Grafana user. """ - project_id: Optional[str] + grafana_user_id: int """ - ID of the Project to target. + ID of the Grafana user. """ - grafana_user_id: int + project_id: Optional[str] = None """ - ID of the Grafana user. + ID of the Project to target. """ @@ -686,7 +684,7 @@ class GlobalApiGetCurrentPlanRequest: Retrieve a pricing plan for the given Project. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -698,14 +696,14 @@ class GlobalApiGetGrafanaProductDashboardRequest: Retrieve a specific dashboard. """ - project_id: Optional[str] + dashboard_name: str """ - ID of the Project the dashboard belongs to. + Name of the dashboard. """ - dashboard_name: str + project_id: Optional[str] = None """ - Name of the dashboard. + ID of the Project the dashboard belongs to. """ @@ -715,7 +713,7 @@ class GlobalApiGetGrafanaRequest: Request a Grafana. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -727,22 +725,22 @@ class GlobalApiListGrafanaProductDashboardsRequest: Retrieve a list of available product dashboards. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. """ @@ -754,22 +752,24 @@ class GlobalApiListGrafanaUsersRequest: List all Grafana users. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size. """ - order_by: Optional[ListGrafanaUsersRequestOrderBy] + order_by: Optional[ListGrafanaUsersRequestOrderBy] = ( + ListGrafanaUsersRequestOrderBy.LOGIN_ASC + ) """ Order of the Grafana users. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ @@ -781,17 +781,17 @@ class GlobalApiListPlansRequest: Retrieve a list of available pricing plans. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Page size. """ - order_by: Optional[ListPlansRequestOrderBy] + order_by: Optional[ListPlansRequestOrderBy] = ListPlansRequestOrderBy.NAME_ASC @dataclass @@ -800,14 +800,14 @@ class GlobalApiResetGrafanaUserPasswordRequest: Reset a Grafana user's password. """ - project_id: Optional[str] + grafana_user_id: int """ - ID of the Project to target. + ID of the Grafana user. """ - grafana_user_id: int + project_id: Optional[str] = None """ - ID of the Grafana user. + ID of the Project to target. """ @@ -817,12 +817,12 @@ class GlobalApiSelectPlanRequest: Select a specific pricing plan. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ - plan_name: Optional[PlanName] + plan_name: Optional[PlanName] = PlanName.UNKNOWN_NAME """ Name of the pricing plan. """ @@ -834,7 +834,7 @@ class GlobalApiSyncGrafanaDataSourcesRequest: Trigger the synchronization of all data sources created in the relevant regions. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ @@ -987,22 +987,22 @@ class RegionalApiCreateContactPointRequest: Create a contact point. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to create the contact point in. """ - send_resolved_notifications: Optional[bool] + send_resolved_notifications: Optional[bool] = False """ Send an email notification when an alert is marked as resolved. """ - email: Optional[ContactPointEmail] + email: Optional[ContactPointEmail] = None @dataclass @@ -1016,22 +1016,22 @@ class RegionalApiCreateDataSourceRequest: Data source name. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project the data source belongs to. """ - type_: Optional[DataSourceType] + type_: Optional[DataSourceType] = DataSourceType.UNKNOWN_TYPE """ Data source type. """ - retention_days: Optional[int] + retention_days: Optional[int] = 0 """ Default values are 31 days for metrics, 7 days for logs and traces. """ @@ -1048,17 +1048,17 @@ class RegionalApiCreateTokenRequest: Name of the token. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project the token belongs to. """ - token_scopes: Optional[List[TokenScope]] + token_scopes: Optional[List[TokenScope]] = field(default_factory=list) """ Token permission scopes. """ @@ -1070,17 +1070,17 @@ class RegionalApiDeleteContactPointRequest: Delete a contact point. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the contact point to delete. """ - email: Optional[ContactPointEmail] + email: Optional[ContactPointEmail] = None @dataclass @@ -1094,7 +1094,7 @@ class RegionalApiDeleteDataSourceRequest: ID of the data source to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1111,7 +1111,7 @@ class RegionalApiDeleteTokenRequest: ID of the token to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1123,12 +1123,12 @@ class RegionalApiDisableAlertManagerRequest: Disable the Alert manager. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to disable the Alert manager in. """ @@ -1136,17 +1136,17 @@ class RegionalApiDisableAlertManagerRequest: @dataclass class RegionalApiDisableAlertRulesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ - rule_ids: Optional[List[str]] + rule_ids: Optional[List[str]] = field(default_factory=list) """ List of IDs of the rules to enable. If empty, disables all preconfigured rules. """ @@ -1158,12 +1158,12 @@ class RegionalApiDisableManagedAlertsRequest: Disable the sending of managed alerts. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1175,12 +1175,12 @@ class RegionalApiEnableAlertManagerRequest: Enable the Alert manager. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to enable the Alert manager in. """ @@ -1188,17 +1188,17 @@ class RegionalApiEnableAlertManagerRequest: @dataclass class RegionalApiEnableAlertRulesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ - rule_ids: Optional[List[str]] + rule_ids: Optional[List[str]] = field(default_factory=list) """ List of IDs of the rules to enable. If empty, enables all preconfigured rules. """ @@ -1210,12 +1210,12 @@ class RegionalApiEnableManagedAlertsRequest: Enable the sending of managed alerts. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1227,12 +1227,12 @@ class RegionalApiGetAlertManagerRequest: Get the Alert manager. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the requested Alert manager. """ @@ -1244,7 +1244,7 @@ class RegionalApiGetConfigRequest: Get Cockpit configuration. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1261,7 +1261,7 @@ class RegionalApiGetDataSourceRequest: ID of the relevant data source. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1269,12 +1269,12 @@ class RegionalApiGetDataSourceRequest: @dataclass class RegionalApiGetRulesCountRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to retrieve the rule count for. """ @@ -1291,7 +1291,7 @@ class RegionalApiGetTokenRequest: Token ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1299,14 +1299,13 @@ class RegionalApiGetTokenRequest: @dataclass class RegionalApiGetUsageOverviewRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] - - interval: Optional[str] + project_id: Optional[str] = None + interval: Optional[str] = None @dataclass @@ -1315,32 +1314,32 @@ class RegionalApiListAlertsRequest: Retrieve a list of alerts. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only alerts from this Project will be returned. """ - rule_status: Optional[AlertStatus] + rule_status: Optional[AlertStatus] = AlertStatus.UNKNOWN_STATUS """ Returns only alerts with the given activation status. If omitted, no alert filtering is applied. Other filters may still apply. """ - is_preconfigured: Optional[bool] + is_preconfigured: Optional[bool] = False """ True returns only preconfigured alerts. False returns only custom alerts. If omitted, no filtering is applied on alert types. Other filters may still apply. """ - state: Optional[AlertState] + state: Optional[AlertState] = AlertState.UNKNOWN_STATE """ Valid values to filter on are `inactive`, `pending` and `firing`. If omitted, no filtering is applied on alert states. Other filters may still apply. """ - data_source_id: Optional[str] + data_source_id: Optional[str] = None """ If omitted, only alerts from the default Scaleway metrics data source will be listed. """ @@ -1352,22 +1351,22 @@ class RegionalApiListContactPointsRequest: List contact points. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Total count of contact points to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the contact points to list. """ @@ -1379,37 +1378,39 @@ class RegionalApiListDataSourcesRequest: List data sources. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of data sources to return per page. """ - order_by: Optional[ListDataSourcesRequestOrderBy] + order_by: Optional[ListDataSourcesRequestOrderBy] = ( + ListDataSourcesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for data sources in the response. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only data sources from this Project will be returned. """ - origin: Optional[DataSourceOrigin] + origin: Optional[DataSourceOrigin] = DataSourceOrigin.UNKNOWN_ORIGIN """ Origin to filter for, only data sources with matching origin will be returned. If omitted, all types will be returned. """ - types: Optional[List[DataSourceType]] + types: Optional[List[DataSourceType]] = field(default_factory=list) """ Types to filter for (metrics, logs, traces), only data sources with matching types will be returned. If omitted, all types will be returned. """ @@ -1421,32 +1422,34 @@ class RegionalApiListTokensRequest: List tokens. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of tokens to return per page. """ - order_by: Optional[ListTokensRequestOrderBy] + order_by: Optional[ListTokensRequestOrderBy] = ( + ListTokensRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project the tokens belong to. """ - token_scopes: Optional[List[TokenScope]] + token_scopes: Optional[List[TokenScope]] = field(default_factory=list) """ Token scopes to filter for. """ @@ -1458,12 +1461,12 @@ class RegionalApiTriggerTestAlertRequest: Request to trigger a test alert. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1475,22 +1478,22 @@ class RegionalApiUpdateContactPointRequest: Update a contact point. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the contact point to update. """ - send_resolved_notifications: Optional[bool] + send_resolved_notifications: Optional[bool] = False """ Enable or disable notifications when alert is resolved. """ - email: Optional[ContactPointEmail] + email: Optional[ContactPointEmail] = None @dataclass @@ -1504,17 +1507,17 @@ class RegionalApiUpdateDataSourceRequest: ID of the data source to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Updated name of the data source. """ - retention_days: Optional[int] + retention_days: Optional[int] = 0 """ Duration for which the data will be retained in the data source. """ @@ -1522,12 +1525,8 @@ class RegionalApiUpdateDataSourceRequest: @dataclass class UsageOverview: - scaleway_metrics_usage: Optional[Usage] - - scaleway_logs_usage: Optional[Usage] - - external_metrics_usage: Optional[Usage] - - external_logs_usage: Optional[Usage] - - external_traces_usage: Optional[Usage] + scaleway_metrics_usage: Optional[Usage] = None + scaleway_logs_usage: Optional[Usage] = None + external_metrics_usage: Optional[Usage] = None + external_logs_usage: Optional[Usage] = None + external_traces_usage: Optional[Usage] = None diff --git a/scaleway/scaleway/container/v1beta1/marshalling.py b/scaleway/scaleway/container/v1beta1/marshalling.py index 3e059aede..5326db212 100644 --- a/scaleway/scaleway/container/v1beta1/marshalling.py +++ b/scaleway/scaleway/container/v1beta1/marshalling.py @@ -10,6 +10,17 @@ resolve_one_of, ) from .types import ( + ContainerHttpOption, + ContainerPrivacy, + ContainerProtocol, + ContainerSandbox, + ContainerStatus, + CronStatus, + DomainStatus, + NamespaceStatus, + TokenStatus, + TriggerInputType, + TriggerStatus, ContainerHealthCheckSpecHTTPProbe, ContainerHealthCheckSpecTCPProbe, ContainerHealthCheckSpec, @@ -61,6 +72,8 @@ def unmarshal_ContainerHealthCheckSpecHTTPProbe( field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None return ContainerHealthCheckSpecHTTPProbe(**args) @@ -89,6 +102,8 @@ def unmarshal_ContainerHealthCheckSpec(data: Any) -> ContainerHealthCheckSpec: field = data.get("failure_threshold", None) if field is not None: args["failure_threshold"] = field + else: + args["failure_threshold"] = 0 field = data.get("http", None) if field is not None: @@ -151,10 +166,14 @@ def unmarshal_SecretHashedValue(data: Any) -> SecretHashedValue: field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None field = data.get("hashed_value", None) if field is not None: args["hashed_value"] = field + else: + args["hashed_value"] = None return SecretHashedValue(**args) @@ -170,54 +189,80 @@ def unmarshal_Container(data: Any) -> Container: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("namespace_id", None) if field is not None: args["namespace_id"] = field + else: + args["namespace_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ContainerStatus.UNKNOWN field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = field(default_factory=dict) field = data.get("min_scale", None) if field is not None: args["min_scale"] = field + else: + args["min_scale"] = 0 field = data.get("max_scale", None) if field is not None: args["max_scale"] = field + else: + args["max_scale"] = 0 field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field + else: + args["memory_limit"] = 0 field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field + else: + args["cpu_limit"] = 0 field = data.get("privacy", None) if field is not None: args["privacy"] = field + else: + args["privacy"] = ContainerPrivacy.UNKNOWN_PRIVACY field = data.get("registry_image", None) if field is not None: args["registry_image"] = field + else: + args["registry_image"] = None field = data.get("max_concurrency", None) if field is not None: args["max_concurrency"] = field + else: + args["max_concurrency"] = 0 field = data.get("domain_name", None) if field is not None: args["domain_name"] = field + else: + args["domain_name"] = None field = data.get("timeout", None) if field is not None: @@ -240,10 +285,14 @@ def unmarshal_Container(data: Any) -> Container: field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = ContainerProtocol.UNKNOWN_PROTOCOL field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("secret_environment_variables", None) if field is not None: @@ -252,18 +301,26 @@ def unmarshal_Container(data: Any) -> Container: if field is not None else None ) + else: + args["secret_environment_variables"] = field(default_factory=list) field = data.get("http_option", None) if field is not None: args["http_option"] = field + else: + args["http_option"] = ContainerHttpOption.UNKNOWN_HTTP_OPTION field = data.get("sandbox", None) if field is not None: args["sandbox"] = field + else: + args["sandbox"] = ContainerSandbox.UNKNOWN_SANDBOX field = data.get("local_storage_limit", None) if field is not None: args["local_storage_limit"] = field + else: + args["local_storage_limit"] = 0 field = data.get("scaling_option", None) if field is not None: @@ -274,18 +331,26 @@ def unmarshal_Container(data: Any) -> Container: field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("command", None) if field is not None: args["command"] = field + else: + args["command"] = field(default_factory=list) field = data.get("args", None) if field is not None: args["args"] = field + else: + args["args"] = field(default_factory=list) field = data.get("health_check", None) if field is not None: @@ -331,28 +396,38 @@ def unmarshal_Cron(data: Any) -> Cron: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("container_id", None) if field is not None: args["container_id"] = field + else: + args["container_id"] = None field = data.get("schedule", None) if field is not None: args["schedule"] = field + else: + args["schedule"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = CronStatus.UNKNOWN field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("args", None) if field is not None: args["args"] = field else: - args["args"] = None + args["args"] = field(default_factory=dict) return Cron(**args) @@ -368,22 +443,32 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("container_id", None) if field is not None: args["container_id"] = field + else: + args["container_id"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainStatus.UNKNOWN field = data.get("error_message", None) if field is not None: @@ -405,30 +490,44 @@ def unmarshal_Namespace(data: Any) -> Namespace: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = field(default_factory=dict) field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = NamespaceStatus.UNKNOWN field = data.get("registry_namespace_id", None) if field is not None: args["registry_namespace_id"] = field + else: + args["registry_namespace_id"] = None field = data.get("error_message", None) if field is not None: @@ -439,6 +538,8 @@ def unmarshal_Namespace(data: Any) -> Namespace: field = data.get("registry_endpoint", None) if field is not None: args["registry_endpoint"] = field + else: + args["registry_endpoint"] = None field = data.get("secret_environment_variables", None) if field is not None: @@ -447,14 +548,20 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None else None ) + else: + args["secret_environment_variables"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("description", None) if field is not None: @@ -478,7 +585,7 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None: args["vpc_integration_activated"] = field else: - args["vpc_integration_activated"] = None + args["vpc_integration_activated"] = False return Namespace(**args) @@ -494,14 +601,20 @@ def unmarshal_Token(data: Any) -> Token: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("token", None) if field is not None: args["token"] = field + else: + args["token"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TokenStatus.UNKNOWN field = data.get("container_id", None) if field is not None: @@ -547,18 +660,26 @@ def unmarshal_TriggerMnqNatsClientConfig(data: Any) -> TriggerMnqNatsClientConfi field = data.get("subject", None) if field is not None: args["subject"] = field + else: + args["subject"] = None field = data.get("mnq_nats_account_id", None) if field is not None: args["mnq_nats_account_id"] = field + else: + args["mnq_nats_account_id"] = None field = data.get("mnq_project_id", None) if field is not None: args["mnq_project_id"] = field + else: + args["mnq_project_id"] = None field = data.get("mnq_region", None) if field is not None: args["mnq_region"] = field + else: + args["mnq_region"] = None field = data.get("mnq_credential_id", None) if field is not None: @@ -580,14 +701,20 @@ def unmarshal_TriggerMnqSqsClientConfig(data: Any) -> TriggerMnqSqsClientConfig: field = data.get("queue", None) if field is not None: args["queue"] = field + else: + args["queue"] = None field = data.get("mnq_project_id", None) if field is not None: args["mnq_project_id"] = field + else: + args["mnq_project_id"] = None field = data.get("mnq_region", None) if field is not None: args["mnq_region"] = field + else: + args["mnq_region"] = None field = data.get("mnq_credential_id", None) if field is not None: @@ -609,18 +736,26 @@ def unmarshal_TriggerSqsClientConfig(data: Any) -> TriggerSqsClientConfig: field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("queue_url", None) if field is not None: args["queue_url"] = field + else: + args["queue_url"] = None field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None field = data.get("secret_key", None) if field is not None: args["secret_key"] = field + else: + args["secret_key"] = None return TriggerSqsClientConfig(**args) @@ -636,26 +771,38 @@ def unmarshal_Trigger(data: Any) -> Trigger: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("container_id", None) if field is not None: args["container_id"] = field + else: + args["container_id"] = None field = data.get("input_type", None) if field is not None: args["input_type"] = field + else: + args["input_type"] = TriggerInputType.UNKNOWN_INPUT_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TriggerStatus.UNKNOWN_STATUS field = data.get("error_message", None) if field is not None: @@ -697,10 +844,14 @@ def unmarshal_ListContainersResponse(data: Any) -> ListContainersResponse: args["containers"] = ( [unmarshal_Container(v) for v in field] if field is not None else None ) + else: + args["containers"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListContainersResponse(**args) @@ -718,10 +869,14 @@ def unmarshal_ListCronsResponse(data: Any) -> ListCronsResponse: args["crons"] = ( [unmarshal_Cron(v) for v in field] if field is not None else None ) + else: + args["crons"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListCronsResponse(**args) @@ -739,10 +894,14 @@ def unmarshal_ListDomainsResponse(data: Any) -> ListDomainsResponse: args["domains"] = ( [unmarshal_Domain(v) for v in field] if field is not None else None ) + else: + args["domains"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDomainsResponse(**args) @@ -760,10 +919,14 @@ def unmarshal_ListNamespacesResponse(data: Any) -> ListNamespacesResponse: args["namespaces"] = ( [unmarshal_Namespace(v) for v in field] if field is not None else None ) + else: + args["namespaces"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNamespacesResponse(**args) @@ -781,10 +944,14 @@ def unmarshal_ListTokensResponse(data: Any) -> ListTokensResponse: args["tokens"] = ( [unmarshal_Token(v) for v in field] if field is not None else None ) + else: + args["tokens"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListTokensResponse(**args) @@ -800,12 +967,16 @@ def unmarshal_ListTriggersResponse(data: Any) -> ListTriggersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("triggers", None) if field is not None: args["triggers"] = ( [unmarshal_Trigger(v) for v in field] if field is not None else None ) + else: + args["triggers"] = field(default_factory=list) return ListTriggersResponse(**args) @@ -938,7 +1109,7 @@ def marshal_CreateContainerRequest( output["timeout"] = request.timeout if request.privacy is not None: - output["privacy"] = str(request.privacy) + output["privacy"] = request.privacy if request.description is not None: output["description"] = request.description @@ -950,7 +1121,7 @@ def marshal_CreateContainerRequest( output["max_concurrency"] = request.max_concurrency if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.port is not None: output["port"] = request.port @@ -962,10 +1133,10 @@ def marshal_CreateContainerRequest( ] if request.http_option is not None: - output["http_option"] = str(request.http_option) + output["http_option"] = request.http_option if request.sandbox is not None: - output["sandbox"] = str(request.sandbox) + output["sandbox"] = request.sandbox if request.local_storage_limit is not None: output["local_storage_limit"] = request.local_storage_limit @@ -1047,7 +1218,9 @@ def marshal_CreateNamespaceRequest( output["environment_variables"] = request.environment_variables if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.description is not None: output["description"] = request.description @@ -1218,7 +1391,7 @@ def marshal_UpdateContainerRequest( output["redeploy"] = request.redeploy if request.privacy is not None: - output["privacy"] = str(request.privacy) + output["privacy"] = request.privacy if request.description is not None: output["description"] = request.description @@ -1230,7 +1403,7 @@ def marshal_UpdateContainerRequest( output["max_concurrency"] = request.max_concurrency if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.port is not None: output["port"] = request.port @@ -1242,10 +1415,10 @@ def marshal_UpdateContainerRequest( ] if request.http_option is not None: - output["http_option"] = str(request.http_option) + output["http_option"] = request.http_option if request.sandbox is not None: - output["sandbox"] = str(request.sandbox) + output["sandbox"] = request.sandbox if request.local_storage_limit is not None: output["local_storage_limit"] = request.local_storage_limit diff --git a/scaleway/scaleway/container/v1beta1/types.py b/scaleway/scaleway/container/v1beta1/types.py index f782b8c8f..7545093fa 100644 --- a/scaleway/scaleway/container/v1beta1/types.py +++ b/scaleway/scaleway/container/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Any, Dict, List, Optional @@ -212,29 +212,28 @@ class ContainerHealthCheckSpec: As a result, lowering this value can help to reduce the time it takes to detect a failed deployment. """ - interval: Optional[str] + interval: Optional[str] = None """ Period between health checks. """ - http: Optional[ContainerHealthCheckSpecHTTPProbe] + http: Optional[ContainerHealthCheckSpecHTTPProbe] = None - tcp: Optional[ContainerHealthCheckSpecTCPProbe] + tcp: Optional[ContainerHealthCheckSpecTCPProbe] = None @dataclass class ContainerScalingOption: - concurrent_requests_threshold: Optional[int] + concurrent_requests_threshold: Optional[int] = None - cpu_usage_threshold: Optional[int] + cpu_usage_threshold: Optional[int] = None - memory_usage_threshold: Optional[int] + memory_usage_threshold: Optional[int] = None @dataclass class SecretHashedValue: key: str - hashed_value: str @@ -260,7 +259,7 @@ class TriggerMnqNatsClientConfig: Currently, only the `fr-par` and `nl-ams` regions are available. """ - mnq_credential_id: Optional[str] + mnq_credential_id: Optional[str] = None """ ID of the Messaging and Queuing credentials used to subscribe to the NATS subject. """ @@ -283,7 +282,7 @@ class TriggerMnqSqsClientConfig: Currently, only the `fr-par` and `nl-ams` regions are available. """ - mnq_credential_id: Optional[str] + mnq_credential_id: Optional[str] = None """ ID of the Messaging and Queuing credentials used to read from the SQS queue. """ @@ -292,19 +291,15 @@ class TriggerMnqSqsClientConfig: @dataclass class TriggerSqsClientConfig: endpoint: str - queue_url: str - access_key: str - secret_key: str @dataclass class Secret: key: str - - value: Optional[str] + value: Optional[str] = None @dataclass @@ -351,11 +346,8 @@ class CreateTriggerRequestMnqSqsClientConfig: @dataclass class CreateTriggerRequestSqsClientConfig: endpoint: str - queue_url: str - access_key: str - secret_key: str @@ -426,21 +418,6 @@ class Container: Domain name attributed to the contaioner. """ - timeout: Optional[str] - """ - Processing time limit for the container. - """ - - error_message: Optional[str] - """ - Last error message of the container. - """ - - description: Optional[str] - """ - Description of the container. - """ - protocol: ContainerProtocol """ Protocol the container uses. @@ -473,14 +450,6 @@ class Container: Local storage limit of the container (in MB). """ - scaling_option: Optional[ContainerScalingOption] - """ - Possible values: -- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. -- cpu_usage_threshold: Scale depending on the CPU usage of a container instance. -- memory_usage_threshold: Scale depending on the memory usage of a container instance. - """ - region: ScwRegion """ Region in which the container will be deployed. @@ -501,27 +470,50 @@ class Container: Arguments passed to the command specified in the "command" field. These override the default arguments from the container image, and behave like command-line parameters. """ - health_check: Optional[ContainerHealthCheckSpec] + timeout: Optional[str] = None + """ + Processing time limit for the container. + """ + + error_message: Optional[str] = None + """ + Last error message of the container. + """ + + description: Optional[str] = None + """ + Description of the container. + """ + + scaling_option: Optional[ContainerScalingOption] = None + """ + Possible values: +- concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. +- cpu_usage_threshold: Scale depending on the CPU usage of a container instance. +- memory_usage_threshold: Scale depending on the memory usage of a container instance. + """ + + health_check: Optional[ContainerHealthCheckSpec] = None """ Health check configuration of the container. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the container. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the container. """ - ready_at: Optional[datetime] + ready_at: Optional[datetime] = None """ Last date when the container was successfully deployed and set to ready. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the container can access other Scaleway resources in this Private Network. """ @@ -554,7 +546,7 @@ class Cron: Name of the cron. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to pass with the cron. """ @@ -587,7 +579,7 @@ class Domain: Status of the domain. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Last error message of the domain. """ @@ -630,11 +622,6 @@ class Namespace: UUID of the registry namespace. """ - error_message: Optional[str] - """ - Last error message of the namesace. - """ - registry_endpoint: str """ Registry endpoint of the namespace. @@ -655,22 +642,27 @@ class Namespace: List of tags applied to the Serverless Container Namespace. """ - description: Optional[str] + error_message: Optional[str] = None + """ + Last error message of the namesace. + """ + + description: Optional[str] = None """ Description of the endpoint. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the namespace. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the namespace. """ - vpc_integration_activated: Optional[bool] + vpc_integration_activated: Optional[bool] = False """ When activated, containers in the namespace can be connected to a Private Network. Note that activating the VPC integration can only be done when creating a new namespace. @@ -694,24 +686,24 @@ class Token: Status of the token. """ - public_key: Optional[str] + public_key: Optional[str] = None """ Public key of the token. """ - description: Optional[str] + description: Optional[str] = None """ Description of the token. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiry date of the token. """ - container_id: Optional[str] + container_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None @dataclass @@ -746,23 +738,22 @@ class Trigger: Status of the trigger. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Error message of the trigger. """ - scw_sqs_config: Optional[TriggerMnqSqsClientConfig] + scw_sqs_config: Optional[TriggerMnqSqsClientConfig] = None - scw_nats_config: Optional[TriggerMnqNatsClientConfig] + scw_nats_config: Optional[TriggerMnqNatsClientConfig] = None - sqs_config: Optional[TriggerSqsClientConfig] + sqs_config: Optional[TriggerSqsClientConfig] = None @dataclass class UpdateTriggerRequestSqsClientConfig: - access_key: Optional[str] - - secret_key: Optional[str] + access_key: Optional[str] = None + secret_key: Optional[str] = None @dataclass @@ -777,94 +768,94 @@ class CreateContainerRequest: Name of the container. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the container. """ - min_scale: Optional[int] + min_scale: Optional[int] = 0 """ Minimum number of instances to scale the container to. """ - max_scale: Optional[int] + max_scale: Optional[int] = 0 """ Maximum number of instances to scale the container to. """ - memory_limit: Optional[int] + memory_limit: Optional[int] = 0 """ Memory limit of the container in MB. """ - cpu_limit: Optional[int] + cpu_limit: Optional[int] = 0 """ CPU limit of the container in mvCPU. """ - timeout: Optional[str] + timeout: Optional[str] = None """ Processing time limit for the container. """ - privacy: Optional[ContainerPrivacy] + privacy: Optional[ContainerPrivacy] = ContainerPrivacy.UNKNOWN_PRIVACY """ Privacy setting of the container. """ - description: Optional[str] + description: Optional[str] = None """ Description of the container. """ - registry_image: Optional[str] + registry_image: Optional[str] = None """ Name of the registry image (e.g. "rg.fr-par.scw.cloud/something/image:tag"). """ - max_concurrency: Optional[int] + max_concurrency: Optional[int] = 0 """ Number of maximum concurrent executions of the container. """ - protocol: Optional[ContainerProtocol] + protocol: Optional[ContainerProtocol] = ContainerProtocol.UNKNOWN_PROTOCOL """ Protocol the container uses. """ - port: Optional[int] + port: Optional[int] = 0 """ Port the container listens on. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the container. """ - http_option: Optional[ContainerHttpOption] + http_option: Optional[ContainerHttpOption] = ContainerHttpOption.UNKNOWN_HTTP_OPTION """ Possible values: - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. - enabled: Serve both HTTP and HTTPS traffic. """ - sandbox: Optional[ContainerSandbox] + sandbox: Optional[ContainerSandbox] = ContainerSandbox.UNKNOWN_SANDBOX """ Execution environment of the container. """ - local_storage_limit: Optional[int] + local_storage_limit: Optional[int] = 0 """ Local storage limit of the container (in MB). """ - scaling_option: Optional[ContainerScalingOption] + scaling_option: Optional[ContainerScalingOption] = None """ Possible values: - concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. @@ -872,29 +863,29 @@ class CreateContainerRequest: - memory_usage_threshold: Scale depending on the memory usage of a container instance. """ - health_check: Optional[ContainerHealthCheckSpec] + health_check: Optional[ContainerHealthCheckSpec] = None """ Health check configuration of the container. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Container. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the container can access other Scaleway resources in this Private Network. Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. """ - command: Optional[List[str]] + command: Optional[List[str]] = field(default_factory=list) """ Command executed when the container starts. This overrides the default command defined in the container image. This is usually the main executable, or entry point script to run. """ - args: Optional[List[str]] + args: Optional[List[str]] = field(default_factory=list) """ Arguments passed to the command specified in the "command" field. These override the default arguments from the container image, and behave like command-line parameters. """ @@ -912,17 +903,17 @@ class CreateCronRequest: UNIX cron shedule. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to pass with the cron. """ - name: Optional[str] + name: Optional[str] = None """ Name of the cron to create. """ @@ -940,7 +931,7 @@ class CreateDomainRequest: UUID of the container to assign the domain to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -953,37 +944,37 @@ class CreateNamespaceRequest: When activated, containers in the namespace can be connected to a Private Network. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the namespace to create. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the namespace to create. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project in which the namespace will be created. """ - description: Optional[str] + description: Optional[str] = None """ Description of the namespace to create. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the namespace to create. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Container Namespace. """ @@ -991,24 +982,24 @@ class CreateNamespaceRequest: @dataclass class CreateTokenRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the token. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiry date of the token. """ - container_id: Optional[str] + container_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None @dataclass @@ -1023,21 +1014,21 @@ class CreateTriggerRequest: ID of the container to trigger. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the trigger. """ - scw_sqs_config: Optional[CreateTriggerRequestMnqSqsClientConfig] + scw_sqs_config: Optional[CreateTriggerRequestMnqSqsClientConfig] = None - scw_nats_config: Optional[CreateTriggerRequestMnqNatsClientConfig] + scw_nats_config: Optional[CreateTriggerRequestMnqNatsClientConfig] = None - sqs_config: Optional[CreateTriggerRequestSqsClientConfig] + sqs_config: Optional[CreateTriggerRequestSqsClientConfig] = None @dataclass @@ -1047,7 +1038,7 @@ class DeleteContainerRequest: UUID of the container to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1060,7 +1051,7 @@ class DeleteCronRequest: UUID of the cron to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1073,7 +1064,7 @@ class DeleteDomainRequest: UUID of the domain to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1086,7 +1077,7 @@ class DeleteNamespaceRequest: UUID of the namespace to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1099,7 +1090,7 @@ class DeleteTokenRequest: UUID of the token to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1112,7 +1103,7 @@ class DeleteTriggerRequest: ID of the trigger to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1125,7 +1116,7 @@ class DeployContainerRequest: UUID of the container to deploy. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1138,7 +1129,7 @@ class GetContainerRequest: UUID of the container to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1151,7 +1142,7 @@ class GetCronRequest: UUID of the cron to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1164,7 +1155,7 @@ class GetDomainRequest: UUID of the domain to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1177,7 +1168,7 @@ class GetNamespaceRequest: UUID of the namespace to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1190,7 +1181,7 @@ class GetTokenRequest: UUID of the token to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1203,7 +1194,7 @@ class GetTriggerRequest: ID of the trigger to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1216,37 +1207,39 @@ class ListContainersRequest: UUID of the namespace the container belongs to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of containers per page. """ - order_by: Optional[ListContainersRequestOrderBy] + order_by: Optional[ListContainersRequestOrderBy] = ( + ListContainersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the containers. """ - name: Optional[str] + name: Optional[str] = None """ Name of the container. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ UUID of the Organization the container belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project the container belongs to. """ @@ -1272,22 +1265,22 @@ class ListCronsRequest: UUID of the container invoked by the cron. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of crons per page. """ - order_by: Optional[ListCronsRequestOrderBy] + order_by: Optional[ListCronsRequestOrderBy] = ListCronsRequestOrderBy.CREATED_AT_ASC """ Order of the crons. """ @@ -1313,22 +1306,24 @@ class ListDomainsRequest: UUID of the container the domain belongs to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of domains per page. """ - order_by: Optional[ListDomainsRequestOrderBy] + order_by: Optional[ListDomainsRequestOrderBy] = ( + ListDomainsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the domains. """ @@ -1349,37 +1344,39 @@ class ListDomainsResponse: @dataclass class ListNamespacesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of namespaces per page. """ - order_by: Optional[ListNamespacesRequestOrderBy] + order_by: Optional[ListNamespacesRequestOrderBy] = ( + ListNamespacesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the namespaces. """ - name: Optional[str] + name: Optional[str] = None """ Name of the namespaces. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ UUID of the Organization the namespace belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project the namespace belongs to. """ @@ -1400,32 +1397,34 @@ class ListNamespacesResponse: @dataclass class ListTokensRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of tokens per page. """ - order_by: Optional[ListTokensRequestOrderBy] + order_by: Optional[ListTokensRequestOrderBy] = ( + ListTokensRequestOrderBy.CREATED_AT_ASC + ) """ Order of the tokens. """ - container_id: Optional[str] + container_id: Optional[str] = None """ UUID of the container the token belongs to. """ - namespace_id: Optional[str] + namespace_id: Optional[str] = None """ UUID of the namespace the token belongs to. """ @@ -1434,37 +1433,38 @@ class ListTokensRequest: @dataclass class ListTokensResponse: tokens: List[Token] - total_count: int @dataclass class ListTriggersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of triggers to return per page. """ - order_by: Optional[ListTriggersRequestOrderBy] + order_by: Optional[ListTriggersRequestOrderBy] = ( + ListTriggersRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - container_id: Optional[str] + container_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -1487,99 +1487,99 @@ class UpdateContainerRequest: UUID of the container to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the container. """ - min_scale: Optional[int] + min_scale: Optional[int] = 0 """ Minimum number of instances to scale the container to. """ - max_scale: Optional[int] + max_scale: Optional[int] = 0 """ Maximum number of instances to scale the container to. """ - memory_limit: Optional[int] + memory_limit: Optional[int] = 0 """ Memory limit of the container in MB. """ - cpu_limit: Optional[int] + cpu_limit: Optional[int] = 0 """ CPU limit of the container in mvCPU. """ - timeout: Optional[str] + timeout: Optional[str] = None """ Processing time limit for the container. """ - redeploy: Optional[bool] + redeploy: Optional[bool] = False """ Defines whether to redeploy failed containers. """ - privacy: Optional[ContainerPrivacy] + privacy: Optional[ContainerPrivacy] = ContainerPrivacy.UNKNOWN_PRIVACY """ Privacy settings of the container. """ - description: Optional[str] + description: Optional[str] = None """ Description of the container. """ - registry_image: Optional[str] + registry_image: Optional[str] = None """ Name of the registry image (e.g. "rg.fr-par.scw.cloud/something/image:tag"). """ - max_concurrency: Optional[int] + max_concurrency: Optional[int] = 0 """ Number of maximum concurrent executions of the container. """ - protocol: Optional[ContainerProtocol] + protocol: Optional[ContainerProtocol] = ContainerProtocol.UNKNOWN_PROTOCOL """ Protocol the container uses. """ - port: Optional[int] + port: Optional[int] = 0 """ Port the container listens on. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the container. """ - http_option: Optional[ContainerHttpOption] + http_option: Optional[ContainerHttpOption] = ContainerHttpOption.UNKNOWN_HTTP_OPTION """ Possible values: - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. - enabled: Serve both HTTP and HTTPS traffic. """ - sandbox: Optional[ContainerSandbox] + sandbox: Optional[ContainerSandbox] = ContainerSandbox.UNKNOWN_SANDBOX """ Execution environment of the container. """ - local_storage_limit: Optional[int] + local_storage_limit: Optional[int] = 0 """ Local storage limit of the container (in MB). """ - scaling_option: Optional[ContainerScalingOption] + scaling_option: Optional[ContainerScalingOption] = None """ Possible values: - concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance. @@ -1587,29 +1587,29 @@ class UpdateContainerRequest: - memory_usage_threshold: Scale depending on the memory usage of a container instance. """ - health_check: Optional[ContainerHealthCheckSpec] + health_check: Optional[ContainerHealthCheckSpec] = None """ Health check configuration of the container. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Container. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the container can access other Scaleway resources in this Private Network. Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. """ - command: Optional[List[str]] + command: Optional[List[str]] = field(default_factory=list) """ Command executed when the container starts. This overrides the default command defined in the container image. This is usually the main executable, or entry point script to run. """ - args: Optional[List[str]] + args: Optional[List[str]] = field(default_factory=list) """ Arguments passed to the command specified in the "command" field. These override the default arguments from the container image, and behave like command-line parameters. """ @@ -1622,27 +1622,27 @@ class UpdateCronRequest: UUID of the cron to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - container_id: Optional[str] + container_id: Optional[str] = None """ UUID of the container invoked by the cron. """ - schedule: Optional[str] + schedule: Optional[str] = None """ UNIX cron schedule. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to pass with the cron. """ - name: Optional[str] + name: Optional[str] = None """ Name of the cron. """ @@ -1655,27 +1655,27 @@ class UpdateNamespaceRequest: UUID of the namespace to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the namespace to update. """ - description: Optional[str] + description: Optional[str] = None """ Description of the namespace to update. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the namespace to update. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Container Namespace. """ @@ -1688,19 +1688,19 @@ class UpdateTriggerRequest: ID of the trigger to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the trigger. """ - description: Optional[str] + description: Optional[str] = None """ Description of the trigger. """ - sqs_config: Optional[UpdateTriggerRequestSqsClientConfig] + sqs_config: Optional[UpdateTriggerRequestSqsClientConfig] = None diff --git a/scaleway/scaleway/dedibox/v1/marshalling.py b/scaleway/scaleway/dedibox/v1/marshalling.py index ddee241c4..09063735f 100644 --- a/scaleway/scaleway/dedibox/v1/marshalling.py +++ b/scaleway/scaleway/dedibox/v1/marshalling.py @@ -9,8 +9,43 @@ unmarshal_Money, ) from .types import ( + BMCAccessStatus, + BackupStatus, + FailoverBlockVersion, + FailoverIPInterfaceType, + FailoverIPStatus, + FailoverIPVersion, + GetRpnStatusResponseStatus, + IPSemantic, + IPStatus, + IPVersion, + IPv6BlockDelegationStatus, + LogAction, + LogStatus, + MemoryType, + NetworkInterfaceInterfaceType, + OSArch, + OSType, + OfferCatalog, + OfferPaymentFrequency, + OfferSANInfoType, OfferServerInfoStock, PartitionFileSystem, + PartitionType, + RaidArrayRaidLevel, + RescueProtocol, + RpnGroupMemberStatus, + RpnGroupType, + RpnSanIpType, + RpnSanStatus, + RpnV2GroupStatus, + RpnV2GroupType, + RpnV2MemberStatus, + ServerDiskType, + ServerStatus, + ServiceLevelLevel, + ServiceProvisioningStatus, + ServiceType, IP, CPU, Disk, @@ -147,38 +182,56 @@ def unmarshal_IP(data: Any) -> IP: field = data.get("ip_id", None) if field is not None: args["ip_id"] = field + else: + args["ip_id"] = 0 field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("reverse", None) if field is not None: args["reverse"] = field + else: + args["reverse"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = IPVersion.IPV4 field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = 0 field = data.get("netmask", None) if field is not None: args["netmask"] = field + else: + args["netmask"] = None field = data.get("semantic", None) if field is not None: args["semantic"] = field + else: + args["semantic"] = IPSemantic.UNKNOWN field = data.get("gateway", None) if field is not None: args["gateway"] = field + else: + args["gateway"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = IPStatus.UNKNOWN_STATUS return IP(**args) @@ -194,18 +247,26 @@ def unmarshal_CPU(data: Any) -> CPU: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("core_count", None) if field is not None: args["core_count"] = field + else: + args["core_count"] = 0 field = data.get("thread_count", None) if field is not None: args["thread_count"] = field + else: + args["thread_count"] = 0 field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 return CPU(**args) @@ -221,10 +282,14 @@ def unmarshal_Disk(data: Any) -> Disk: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ServerDiskType.SATA return Disk(**args) @@ -240,18 +305,26 @@ def unmarshal_Memory(data: Any) -> Memory: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = MemoryType.DDR2 field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("is_ecc", None) if field is not None: args["is_ecc"] = field + else: + args["is_ecc"] = False return Memory(**args) @@ -267,14 +340,20 @@ def unmarshal_PersistentMemory(data: Any) -> PersistentMemory: field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("model", None) if field is not None: args["model"] = field + else: + args["model"] = None return PersistentMemory(**args) @@ -290,10 +369,14 @@ def unmarshal_RaidController(data: Any) -> RaidController: field = data.get("model", None) if field is not None: args["model"] = field + else: + args["model"] = None field = data.get("raid_level", None) if field is not None: args["raid_level"] = field + else: + args["raid_level"] = field(default_factory=list) return RaidController(**args) @@ -309,6 +392,8 @@ def unmarshal_OfferAntiDosInfo(data: Any) -> OfferAntiDosInfo: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return OfferAntiDosInfo(**args) @@ -324,6 +409,8 @@ def unmarshal_OfferBackupInfo(data: Any) -> OfferBackupInfo: field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None return OfferBackupInfo(**args) @@ -339,6 +426,8 @@ def unmarshal_OfferBandwidthInfo(data: Any) -> OfferBandwidthInfo: field = data.get("speed", None) if field is not None: args["speed"] = field + else: + args["speed"] = None return OfferBandwidthInfo(**args) @@ -388,6 +477,8 @@ def unmarshal_OfferLicenseInfo(data: Any) -> OfferLicenseInfo: field = data.get("bound_to_ip", None) if field is not None: args["bound_to_ip"] = field + else: + args["bound_to_ip"] = None return OfferLicenseInfo(**args) @@ -403,6 +494,8 @@ def unmarshal_OfferRPNInfo(data: Any) -> OfferRPNInfo: field = data.get("speed", None) if field is not None: args["speed"] = field + else: + args["speed"] = None return OfferRPNInfo(**args) @@ -418,14 +511,20 @@ def unmarshal_OfferSANInfo(data: Any) -> OfferSANInfo: field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("ha", None) if field is not None: args["ha"] = field + else: + args["ha"] = False field = data.get("device_type", None) if field is not None: args["device_type"] = field + else: + args["device_type"] = OfferSANInfoType.HDD return OfferSANInfo(**args) @@ -441,30 +540,42 @@ def unmarshal_OfferServerInfo(data: Any) -> OfferServerInfo: field = data.get("bandwidth", None) if field is not None: args["bandwidth"] = field + else: + args["bandwidth"] = None field = data.get("stock", None) if field is not None: args["stock"] = field + else: + args["stock"] = None field = data.get("commercial_range", None) if field is not None: args["commercial_range"] = field + else: + args["commercial_range"] = None field = data.get("disks", None) if field is not None: args["disks"] = ( [unmarshal_Disk(v) for v in field] if field is not None else None ) + else: + args["disks"] = None field = data.get("cpus", None) if field is not None: args["cpus"] = [unmarshal_CPU(v) for v in field] if field is not None else None + else: + args["cpus"] = None field = data.get("memories", None) if field is not None: args["memories"] = ( [unmarshal_Memory(v) for v in field] if field is not None else None ) + else: + args["memories"] = None field = data.get("persistent_memories", None) if field is not None: @@ -473,22 +584,30 @@ def unmarshal_OfferServerInfo(data: Any) -> OfferServerInfo: if field is not None else None ) + else: + args["persistent_memories"] = None field = data.get("raid_controllers", None) if field is not None: args["raid_controllers"] = ( [unmarshal_RaidController(v) for v in field] if field is not None else None ) + else: + args["raid_controllers"] = None field = data.get("available_options", None) if field is not None: args["available_options"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["available_options"] = None field = data.get("connectivity", None) if field is not None: args["connectivity"] = field + else: + args["connectivity"] = None field = data.get("stock_by_datacenter", None) if field is not None: @@ -497,6 +616,8 @@ def unmarshal_OfferServerInfo(data: Any) -> OfferServerInfo: if field is not None else None ) + else: + args["stock_by_datacenter"] = None field = data.get("rpn_version", None) if field is not None: @@ -524,48 +645,70 @@ def unmarshal_OfferServiceLevelInfo(data: Any) -> OfferServiceLevelInfo: field = data.get("support_ticket", None) if field is not None: args["support_ticket"] = field + else: + args["support_ticket"] = None field = data.get("support_phone", None) if field is not None: args["support_phone"] = field + else: + args["support_phone"] = None field = data.get("sales_support", None) if field is not None: args["sales_support"] = field + else: + args["sales_support"] = None field = data.get("git", None) if field is not None: args["git"] = field + else: + args["git"] = None field = data.get("sla", None) if field is not None: args["sla"] = field + else: + args["sla"] = None field = data.get("priority_support", None) if field is not None: args["priority_support"] = field + else: + args["priority_support"] = None field = data.get("high_rpn_bandwidth", None) if field is not None: args["high_rpn_bandwidth"] = field + else: + args["high_rpn_bandwidth"] = None field = data.get("customization", None) if field is not None: args["customization"] = field + else: + args["customization"] = None field = data.get("antidos", None) if field is not None: args["antidos"] = field + else: + args["antidos"] = None field = data.get("extra_failover_quota", None) if field is not None: args["extra_failover_quota"] = field + else: + args["extra_failover_quota"] = None field = data.get("available_options", None) if field is not None: args["available_options"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["available_options"] = None return OfferServiceLevelInfo(**args) @@ -581,10 +724,14 @@ def unmarshal_OfferStorageInfo(data: Any) -> OfferStorageInfo: field = data.get("max_quota", None) if field is not None: args["max_quota"] = field + else: + args["max_quota"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None return OfferStorageInfo(**args) @@ -600,18 +747,26 @@ def unmarshal_Offer(data: Any) -> Offer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("catalog", None) if field is not None: args["catalog"] = field + else: + args["catalog"] = OfferCatalog.ALL field = data.get("payment_frequency", None) if field is not None: args["payment_frequency"] = field + else: + args["payment_frequency"] = OfferPaymentFrequency.MONTHLY field = data.get("pricing", None) if field is not None: @@ -705,76 +860,108 @@ def unmarshal_OS(data: Any) -> OS: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = OSType.UNKNOWN_TYPE field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = OSArch.UNKNOWN_ARCH field = data.get("allow_custom_partitioning", None) if field is not None: args["allow_custom_partitioning"] = field + else: + args["allow_custom_partitioning"] = False field = data.get("allow_ssh_keys", None) if field is not None: args["allow_ssh_keys"] = field + else: + args["allow_ssh_keys"] = False field = data.get("requires_user", None) if field is not None: args["requires_user"] = field + else: + args["requires_user"] = False field = data.get("requires_admin_password", None) if field is not None: args["requires_admin_password"] = field + else: + args["requires_admin_password"] = False field = data.get("requires_panel_password", None) if field is not None: args["requires_panel_password"] = field + else: + args["requires_panel_password"] = False field = data.get("allowed_filesystems", None) if field is not None: args["allowed_filesystems"] = ( [PartitionFileSystem(v) for v in field] if field is not None else None ) + else: + args["allowed_filesystems"] = field(default_factory=list) field = data.get("requires_license", None) if field is not None: args["requires_license"] = field + else: + args["requires_license"] = False field = data.get("license_offers", None) if field is not None: args["license_offers"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["license_offers"] = field(default_factory=list) field = data.get("display_name", None) if field is not None: args["display_name"] = field + else: + args["display_name"] = None field = data.get("password_regex", None) if field is not None: args["password_regex"] = field + else: + args["password_regex"] = None field = data.get("hostname_max_length", None) if field is not None: args["hostname_max_length"] = field + else: + args["hostname_max_length"] = 0 field = data.get("max_partitions", None) if field is not None: args["max_partitions"] = field else: - args["max_partitions"] = None + args["max_partitions"] = 0 field = data.get("panel_password_regex", None) if field is not None: @@ -786,7 +973,7 @@ def unmarshal_OS(data: Any) -> OS: if field is not None: args["requires_valid_hostname"] = field else: - args["requires_valid_hostname"] = None + args["requires_valid_hostname"] = False field = data.get("hostname_regex", None) if field is not None: @@ -816,30 +1003,44 @@ def unmarshal_RpnSan(data: Any) -> RpnSan: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("server_hostname", None) if field is not None: args["server_hostname"] = field + else: + args["server_hostname"] = None field = data.get("iqn_suffix", None) if field is not None: args["iqn_suffix"] = field + else: + args["iqn_suffix"] = None field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = 0 field = data.get("created_at", None) if field is not None: @@ -850,26 +1051,38 @@ def unmarshal_RpnSan(data: Any) -> RpnSan: field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = RpnSanStatus.UNKNOWN_STATUS field = data.get("storage_size", None) if field is not None: args["storage_size"] = field + else: + args["storage_size"] = 0 field = data.get("iqn", None) if field is not None: args["iqn"] = field + else: + args["iqn"] = None field = data.get("rpnv1_compatible", None) if field is not None: args["rpnv1_compatible"] = field + else: + args["rpnv1_compatible"] = False field = data.get("rpnv1_implicit", None) if field is not None: args["rpnv1_implicit"] = field + else: + args["rpnv1_implicit"] = False field = data.get("offer", None) if field is not None: @@ -913,34 +1126,50 @@ def unmarshal_RpnGroup(data: Any) -> RpnGroup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = RpnGroupType.UNKNOWN field = data.get("active", None) if field is not None: args["active"] = field + else: + args["active"] = False field = data.get("owner", None) if field is not None: args["owner"] = field + else: + args["owner"] = None field = data.get("members_count", None) if field is not None: args["members_count"] = field + else: + args["members_count"] = 0 field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("created_at", None) if field is not None: @@ -962,22 +1191,32 @@ def unmarshal_NetworkInterface(data: Any) -> NetworkInterface: field = data.get("card_id", None) if field is not None: args["card_id"] = field + else: + args["card_id"] = 0 field = data.get("device_id", None) if field is not None: args["device_id"] = field + else: + args["device_id"] = 0 field = data.get("mac", None) if field is not None: args["mac"] = field + else: + args["mac"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = NetworkInterfaceInterfaceType.UNKNOWN field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_IP(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) return NetworkInterface(**args) @@ -993,14 +1232,20 @@ def unmarshal_ServerLocation(data: Any) -> ServerLocation: field = data.get("rack", None) if field is not None: args["rack"] = field + else: + args["rack"] = None field = data.get("room", None) if field is not None: args["room"] = field + else: + args["room"] = None field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None return ServerLocation(**args) @@ -1018,6 +1263,8 @@ def unmarshal_ServerOption(data: Any) -> ServerOption: args["options"] = ( [unmarshal_ServerOption(v) for v in field] if field is not None else None ) + else: + args["options"] = None field = data.get("offer", None) if field is not None: @@ -1057,10 +1304,14 @@ def unmarshal_ServiceLevel(data: Any) -> ServiceLevel: field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = 0 field = data.get("level", None) if field is not None: args["level"] = field + else: + args["level"] = ServiceLevelLevel.UNKNOWN return ServiceLevel(**args) @@ -1076,22 +1327,32 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerStatus.UNKNOWN field = data.get("rebooted_at", None) if field is not None: @@ -1104,6 +1365,8 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("abuse_contact", None) if field is not None: args["abuse_contact"] = field + else: + args["abuse_contact"] = None field = data.get("interfaces", None) if field is not None: @@ -1112,44 +1375,64 @@ def unmarshal_Server(data: Any) -> Server: if field is not None else None ) + else: + args["interfaces"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("options", None) if field is not None: args["options"] = ( [unmarshal_ServerOption(v) for v in field] if field is not None else None ) + else: + args["options"] = field(default_factory=list) field = data.get("has_bmc", None) if field is not None: args["has_bmc"] = field + else: + args["has_bmc"] = False field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("is_outsourced", None) if field is not None: args["is_outsourced"] = field + else: + args["is_outsourced"] = False field = data.get("ipv6_slaac", None) if field is not None: args["ipv6_slaac"] = field + else: + args["ipv6_slaac"] = False field = data.get("qinq", None) if field is not None: args["qinq"] = field + else: + args["qinq"] = False field = data.get("is_rpnv2_member", None) if field is not None: args["is_rpnv2_member"] = field + else: + args["is_rpnv2_member"] = False field = data.get("is_hds", None) if field is not None: args["is_hds"] = field + else: + args["is_hds"] = False field = data.get("created_at", None) if field is not None: @@ -1213,10 +1496,14 @@ def unmarshal_RpnV2GroupSubnet(data: Any) -> RpnV2GroupSubnet: field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = None return RpnV2GroupSubnet(**args) @@ -1232,42 +1519,62 @@ def unmarshal_RpnV2Group(data: Any) -> RpnV2Group: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("compatible_rpnv1", None) if field is not None: args["compatible_rpnv1"] = field + else: + args["compatible_rpnv1"] = False field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = RpnV2GroupType.UNKNOWN_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = RpnV2GroupStatus.UNKNOWN_GROUP_STATUS field = data.get("owner", None) if field is not None: args["owner"] = field + else: + args["owner"] = None field = data.get("members_count", None) if field is not None: args["members_count"] = field + else: + args["members_count"] = 0 field = data.get("gateway", None) if field is not None: args["gateway"] = field + else: + args["gateway"] = None field = data.get("subnet", None) if field is not None: @@ -1295,20 +1602,26 @@ def unmarshal_Service(data: Any) -> Service: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("provisioning_status", None) if field is not None: args["provisioning_status"] = field + else: + args["provisioning_status"] = ServiceProvisioningStatus.UNKNOWN field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ServiceType.UNKNOWN_TYPE field = data.get("resource_id", None) if field is not None: args["resource_id"] = field else: - args["resource_id"] = None + args["resource_id"] = 0 field = data.get("offer", None) if field is not None: @@ -1358,30 +1671,44 @@ def unmarshal_FailoverBlock(data: Any) -> FailoverBlock: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("nameservers", None) if field is not None: args["nameservers"] = field + else: + args["nameservers"] = field(default_factory=list) field = data.get("ip_version", None) if field is not None: args["ip_version"] = field + else: + args["ip_version"] = FailoverBlockVersion.UNKNOWN_VERSION field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = 0 field = data.get("netmask", None) if field is not None: args["netmask"] = field + else: + args["netmask"] = None field = data.get("gateway_ip", None) if field is not None: args["gateway_ip"] = field + else: + args["gateway_ip"] = None return FailoverBlock(**args) @@ -1397,38 +1724,56 @@ def unmarshal_FailoverIP(data: Any) -> FailoverIP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("reverse", None) if field is not None: args["reverse"] = field + else: + args["reverse"] = None field = data.get("ip_version", None) if field is not None: args["ip_version"] = field + else: + args["ip_version"] = FailoverIPVersion.UNKNOWN_VERSION field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = 0 field = data.get("netmask", None) if field is not None: args["netmask"] = field + else: + args["netmask"] = None field = data.get("gateway_ip", None) if field is not None: args["gateway_ip"] = field + else: + args["gateway_ip"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = FailoverIPStatus.UNKNOWN_STATUS field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = FailoverIPInterfaceType.UNKNOWN field = data.get("mac", None) if field is not None: @@ -1440,7 +1785,7 @@ def unmarshal_FailoverIP(data: Any) -> FailoverIP: if field is not None: args["server_id"] = field else: - args["server_id"] = None + args["server_id"] = 0 field = data.get("block", None) if field is not None: @@ -1468,18 +1813,26 @@ def unmarshal_BMCAccess(data: Any) -> BMCAccess: field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("login", None) if field is not None: args["login"] = field + else: + args["login"] = None field = data.get("password", None) if field is not None: args["password"] = field + else: + args["password"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = BMCAccessStatus.UNKNOWN field = data.get("expires_at", None) if field is not None: @@ -1501,42 +1854,62 @@ def unmarshal_Backup(data: Any) -> Backup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("login", None) if field is not None: args["login"] = field + else: + args["login"] = None field = data.get("server", None) if field is not None: args["server"] = field + else: + args["server"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = BackupStatus.UNKNOWN_BACKUP_STATUS field = data.get("acl_enabled", None) if field is not None: args["acl_enabled"] = field + else: + args["acl_enabled"] = False field = data.get("autologin", None) if field is not None: args["autologin"] = field + else: + args["autologin"] = False field = data.get("quota_space", None) if field is not None: args["quota_space"] = field + else: + args["quota_space"] = 0 field = data.get("quota_space_used", None) if field is not None: args["quota_space_used"] = field + else: + args["quota_space_used"] = 0 field = data.get("quota_files", None) if field is not None: args["quota_files"] = field + else: + args["quota_files"] = 0 field = data.get("quota_files_used", None) if field is not None: args["quota_files_used"] = field + else: + args["quota_files_used"] = 0 return Backup(**args) @@ -1552,30 +1925,44 @@ def unmarshal_CanOrderResponse(data: Any) -> CanOrderResponse: field = data.get("can_order", None) if field is not None: args["can_order"] = field + else: + args["can_order"] = None field = data.get("quota_ok", None) if field is not None: args["quota_ok"] = field + else: + args["quota_ok"] = None field = data.get("phone_confirmed", None) if field is not None: args["phone_confirmed"] = field + else: + args["phone_confirmed"] = None field = data.get("email_confirmed", None) if field is not None: args["email_confirmed"] = field + else: + args["email_confirmed"] = None field = data.get("user_confirmed", None) if field is not None: args["user_confirmed"] = field + else: + args["user_confirmed"] = None field = data.get("payment_mode", None) if field is not None: args["payment_mode"] = field + else: + args["payment_mode"] = None field = data.get("billing_ok", None) if field is not None: args["billing_ok"] = field + else: + args["billing_ok"] = None field = data.get("message", None) if field is not None: @@ -1597,12 +1984,16 @@ def unmarshal_CreateFailoverIPsResponse(data: Any) -> CreateFailoverIPsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("services", None) if field is not None: args["services"] = ( [unmarshal_Service(v) for v in field] if field is not None else None ) + else: + args["services"] = None return CreateFailoverIPsResponse(**args) @@ -1620,10 +2011,14 @@ def unmarshal_GetIPv6BlockQuotasResponseQuota( field = data.get("quota", None) if field is not None: args["quota"] = field + else: + args["quota"] = None field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = None return GetIPv6BlockQuotasResponseQuota(**args) @@ -1643,10 +2038,14 @@ def unmarshal_GetIPv6BlockQuotasResponse(data: Any) -> GetIPv6BlockQuotasRespons if field is not None else None ) + else: + args["quotas"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return GetIPv6BlockQuotasResponse(**args) @@ -1662,18 +2061,26 @@ def unmarshal_GetRemainingQuotaResponse(data: Any) -> GetRemainingQuotaResponse: field = data.get("failover_ip_quota", None) if field is not None: args["failover_ip_quota"] = field + else: + args["failover_ip_quota"] = 0 field = data.get("failover_ip_remaining_quota", None) if field is not None: args["failover_ip_remaining_quota"] = field + else: + args["failover_ip_remaining_quota"] = 0 field = data.get("failover_block_quota", None) if field is not None: args["failover_block_quota"] = field + else: + args["failover_block_quota"] = 0 field = data.get("failover_block_remaining_quota", None) if field is not None: args["failover_block_remaining_quota"] = field + else: + args["failover_block_remaining_quota"] = 0 return GetRemainingQuotaResponse(**args) @@ -1689,12 +2096,14 @@ def unmarshal_GetRpnStatusResponse(data: Any) -> GetRpnStatusResponse: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = GetRpnStatusResponseStatus.UNKNOWN_STATUS field = data.get("operations_left", None) if field is not None: args["operations_left"] = field else: - args["operations_left"] = None + args["operations_left"] = 0 return GetRpnStatusResponse(**args) @@ -1710,32 +2119,46 @@ def unmarshal_IPv6Block(data: Any) -> IPv6Block: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("duid", None) if field is not None: args["duid"] = field + else: + args["duid"] = None field = data.get("nameservers", None) if field is not None: args["nameservers"] = field + else: + args["nameservers"] = field(default_factory=list) field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = 0 field = data.get("subnets", None) if field is not None: args["subnets"] = ( [unmarshal_IPv6Block(v) for v in field] if field is not None else None ) + else: + args["subnets"] = field(default_factory=list) field = data.get("delegation_status", None) if field is not None: args["delegation_status"] = field + else: + args["delegation_status"] = IPv6BlockDelegationStatus.UNKNOWN_STATUS return IPv6Block(**args) @@ -1751,22 +2174,32 @@ def unmarshal_Invoice(data: Any) -> Invoice: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("payment_method", None) if field is not None: args["payment_method"] = field + else: + args["payment_method"] = None field = data.get("content", None) if field is not None: args["content"] = field + else: + args["content"] = None field = data.get("transaction_id", None) if field is not None: args["transaction_id"] = field + else: + args["transaction_id"] = None field = data.get("total_with_taxes", None) if field is not None: @@ -1806,12 +2239,16 @@ def unmarshal_ListFailoverIPsResponse(data: Any) -> ListFailoverIPsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("failover_ips", None) if field is not None: args["failover_ips"] = ( [unmarshal_FailoverIP(v) for v in field] if field is not None else None ) + else: + args["failover_ips"] = field(default_factory=list) return ListFailoverIPsResponse(**args) @@ -1829,10 +2266,14 @@ def unmarshal_ListIPv6BlockSubnetsAvailableResponseSubnet( field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("cidr", None) if field is not None: args["cidr"] = field + else: + args["cidr"] = None return ListIPv6BlockSubnetsAvailableResponseSubnet(**args) @@ -1854,10 +2295,14 @@ def unmarshal_ListIPv6BlockSubnetsAvailableResponse( if field is not None else None ) + else: + args["subnet_availables"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListIPv6BlockSubnetsAvailableResponse(**args) @@ -1873,18 +2318,26 @@ def unmarshal_InvoiceSummary(data: Any) -> InvoiceSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("payment_method", None) if field is not None: args["payment_method"] = field + else: + args["payment_method"] = None field = data.get("transaction_id", None) if field is not None: args["transaction_id"] = field + else: + args["transaction_id"] = None field = data.get("total_with_taxes", None) if field is not None: @@ -1924,12 +2377,16 @@ def unmarshal_ListInvoicesResponse(data: Any) -> ListInvoicesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("invoices", None) if field is not None: args["invoices"] = ( [unmarshal_InvoiceSummary(v) for v in field] if field is not None else None ) + else: + args["invoices"] = None return ListInvoicesResponse(**args) @@ -1945,10 +2402,14 @@ def unmarshal_RpnSanIpRpnV2Group(data: Any) -> RpnSanIpRpnV2Group: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return RpnSanIpRpnV2Group(**args) @@ -1964,14 +2425,20 @@ def unmarshal_RpnSanIpServer(data: Any) -> RpnSanIpServer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None return RpnSanIpServer(**args) @@ -1987,6 +2454,8 @@ def unmarshal_RpnSanIp(data: Any) -> RpnSanIp: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = RpnSanIpType.UNKNOWN field = data.get("server", None) if field is not None: @@ -2020,12 +2489,16 @@ def unmarshal_ListIpsResponse(data: Any) -> ListIpsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("ips", None) if field is not None: args["ips"] = ( [unmarshal_RpnSanIp(v) for v in field] if field is not None else None ) + else: + args["ips"] = field(default_factory=list) return ListIpsResponse(**args) @@ -2041,10 +2514,14 @@ def unmarshal_ListOSResponse(data: Any) -> ListOSResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("os", None) if field is not None: args["os"] = [unmarshal_OS(v) for v in field] if field is not None else None + else: + args["os"] = field(default_factory=list) return ListOSResponse(**args) @@ -2060,12 +2537,16 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("offers", None) if field is not None: args["offers"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["offers"] = field(default_factory=list) return ListOffersResponse(**args) @@ -2081,14 +2562,20 @@ def unmarshal_RefundSummary(data: Any) -> RefundSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("method", None) if field is not None: args["method"] = field + else: + args["method"] = None field = data.get("total_with_taxes", None) if field is not None: @@ -2130,12 +2617,16 @@ def unmarshal_ListRefundsResponse(data: Any) -> ListRefundsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("refunds", None) if field is not None: args["refunds"] = ( [unmarshal_RefundSummary(v) for v in field] if field is not None else None ) + else: + args["refunds"] = None return ListRefundsResponse(**args) @@ -2151,24 +2642,34 @@ def unmarshal_RpnSanServer(data: Any) -> RpnSanServer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("sans", None) if field is not None: args["sans"] = ( [unmarshal_RpnSan(v) for v in field] if field is not None else None ) + else: + args["sans"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return RpnSanServer(**args) @@ -2186,12 +2687,16 @@ def unmarshal_ListRpnCapableSanServersResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("san_servers", None) if field is not None: args["san_servers"] = ( [unmarshal_RpnSanServer(v) for v in field] if field is not None else None ) + else: + args["san_servers"] = field(default_factory=list) return ListRpnCapableSanServersResponse(**args) @@ -2207,12 +2712,16 @@ def unmarshal_ListRpnCapableServersResponse(data: Any) -> ListRpnCapableServersR field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListRpnCapableServersResponse(**args) @@ -2228,26 +2737,38 @@ def unmarshal_RpnGroupMember(data: Any) -> RpnGroupMember: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = RpnGroupMemberStatus.UNKNOWN_RPN_MEMBER_STATUS field = data.get("group_id", None) if field is not None: args["group_id"] = field + else: + args["group_id"] = 0 field = data.get("group_name", None) if field is not None: args["group_name"] = field + else: + args["group_name"] = None field = data.get("group_owner", None) if field is not None: args["group_owner"] = field + else: + args["group_owner"] = None field = data.get("owner", None) if field is not None: args["owner"] = field + else: + args["owner"] = None field = data.get("san_server", None) if field is not None: @@ -2265,7 +2786,7 @@ def unmarshal_RpnGroupMember(data: Any) -> RpnGroupMember: if field is not None: args["speed"] = field else: - args["speed"] = None + args["speed"] = 0 return RpnGroupMember(**args) @@ -2281,12 +2802,16 @@ def unmarshal_ListRpnGroupMembersResponse(data: Any) -> ListRpnGroupMembersRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("members", None) if field is not None: args["members"] = ( [unmarshal_RpnGroupMember(v) for v in field] if field is not None else None ) + else: + args["members"] = field(default_factory=list) return ListRpnGroupMembersResponse(**args) @@ -2302,12 +2827,16 @@ def unmarshal_ListRpnGroupsResponse(data: Any) -> ListRpnGroupsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("rpn_groups", None) if field is not None: args["rpn_groups"] = ( [unmarshal_RpnGroup(v) for v in field] if field is not None else None ) + else: + args["rpn_groups"] = field(default_factory=list) return ListRpnGroupsResponse(**args) @@ -2323,12 +2852,16 @@ def unmarshal_ListRpnInvitesResponse(data: Any) -> ListRpnInvitesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("members", None) if field is not None: args["members"] = ( [unmarshal_RpnGroupMember(v) for v in field] if field is not None else None ) + else: + args["members"] = field(default_factory=list) return ListRpnInvitesResponse(**args) @@ -2344,30 +2877,44 @@ def unmarshal_RpnSanSummary(data: Any) -> RpnSanSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("server_hostname", None) if field is not None: args["server_hostname"] = field + else: + args["server_hostname"] = None field = data.get("iqn_suffix", None) if field is not None: args["iqn_suffix"] = field + else: + args["iqn_suffix"] = None field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = 0 field = data.get("created_at", None) if field is not None: @@ -2378,22 +2925,32 @@ def unmarshal_RpnSanSummary(data: Any) -> RpnSanSummary: field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = RpnSanStatus.UNKNOWN_STATUS field = data.get("storage_size", None) if field is not None: args["storage_size"] = field + else: + args["storage_size"] = 0 field = data.get("rpnv1_compatible", None) if field is not None: args["rpnv1_compatible"] = field + else: + args["rpnv1_compatible"] = False field = data.get("rpnv1_implicit", None) if field is not None: args["rpnv1_implicit"] = field + else: + args["rpnv1_implicit"] = False field = data.get("delivered_at", None) if field is not None: @@ -2431,12 +2988,16 @@ def unmarshal_ListRpnSansResponse(data: Any) -> ListRpnSansResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("rpn_sans", None) if field is not None: args["rpn_sans"] = ( [unmarshal_RpnSanSummary(v) for v in field] if field is not None else None ) + else: + args["rpn_sans"] = field(default_factory=list) return ListRpnSansResponse(**args) @@ -2452,38 +3013,56 @@ def unmarshal_RpnServerCapability(data: Any) -> RpnServerCapability: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("compatible_qinq", None) if field is not None: args["compatible_qinq"] = field + else: + args["compatible_qinq"] = False field = data.get("can_join_qinq_group", None) if field is not None: args["can_join_qinq_group"] = field + else: + args["can_join_qinq_group"] = False field = data.get("rpnv1_group_count", None) if field is not None: args["rpnv1_group_count"] = field + else: + args["rpnv1_group_count"] = 0 field = data.get("rpnv2_group_count", None) if field is not None: args["rpnv2_group_count"] = field + else: + args["rpnv2_group_count"] = 0 field = data.get("can_join_rpnv2_group", None) if field is not None: args["can_join_rpnv2_group"] = field + else: + args["can_join_rpnv2_group"] = False field = data.get("ip_address", None) if field is not None: @@ -2495,7 +3074,7 @@ def unmarshal_RpnServerCapability(data: Any) -> RpnServerCapability: if field is not None: args["rpn_version"] = field else: - args["rpn_version"] = None + args["rpn_version"] = 0 return RpnServerCapability(**args) @@ -2513,6 +3092,8 @@ def unmarshal_ListRpnServerCapabilitiesResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: @@ -2521,6 +3102,8 @@ def unmarshal_ListRpnServerCapabilitiesResponse( if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListRpnServerCapabilitiesResponse(**args) @@ -2538,12 +3121,16 @@ def unmarshal_ListRpnV2CapableResourcesResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListRpnV2CapableResourcesResponse(**args) @@ -2559,14 +3146,20 @@ def unmarshal_RpnV2Member(data: Any) -> RpnV2Member: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = RpnV2MemberStatus.UNKNOWN_MEMBER_STATUS field = data.get("vlan", None) if field is not None: args["vlan"] = field + else: + args["vlan"] = None field = data.get("server", None) if field is not None: @@ -2584,7 +3177,7 @@ def unmarshal_RpnV2Member(data: Any) -> RpnV2Member: if field is not None: args["speed"] = field else: - args["speed"] = None + args["speed"] = 0 return RpnV2Member(**args) @@ -2600,14 +3193,20 @@ def unmarshal_Log(data: Any) -> Log: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = LogAction.UNKNOWN_LOG_ACTION field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = LogStatus.UNKNOWN_LOG_STATUS field = data.get("group", None) if field is not None: @@ -2649,10 +3248,14 @@ def unmarshal_ListRpnV2GroupLogsResponse(data: Any) -> ListRpnV2GroupLogsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("logs", None) if field is not None: args["logs"] = [unmarshal_Log(v) for v in field] if field is not None else None + else: + args["logs"] = field(default_factory=list) return ListRpnV2GroupLogsResponse(**args) @@ -2668,12 +3271,16 @@ def unmarshal_ListRpnV2GroupsResponse(data: Any) -> ListRpnV2GroupsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("rpn_groups", None) if field is not None: args["rpn_groups"] = ( [unmarshal_RpnV2Group(v) for v in field] if field is not None else None ) + else: + args["rpn_groups"] = field(default_factory=list) return ListRpnV2GroupsResponse(**args) @@ -2689,12 +3296,16 @@ def unmarshal_ListRpnV2MembersResponse(data: Any) -> ListRpnV2MembersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("members", None) if field is not None: args["members"] = ( [unmarshal_RpnV2Member(v) for v in field] if field is not None else None ) + else: + args["members"] = field(default_factory=list) return ListRpnV2MembersResponse(**args) @@ -2710,22 +3321,32 @@ def unmarshal_ServerDisk(data: Any) -> ServerDisk: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("connector", None) if field is not None: args["connector"] = field + else: + args["connector"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = None field = data.get("is_addon", None) if field is not None: args["is_addon"] = field + else: + args["is_addon"] = None return ServerDisk(**args) @@ -2741,12 +3362,16 @@ def unmarshal_ListServerDisksResponse(data: Any) -> ListServerDisksResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("disks", None) if field is not None: args["disks"] = ( [unmarshal_ServerDisk(v) for v in field] if field is not None else None ) + else: + args["disks"] = field(default_factory=list) return ListServerDisksResponse(**args) @@ -2762,10 +3387,14 @@ def unmarshal_ServerEvent(data: Any) -> ServerEvent: field = data.get("event_id", None) if field is not None: args["event_id"] = field + else: + args["event_id"] = 0 field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("date", None) if field is not None: @@ -2787,12 +3416,16 @@ def unmarshal_ListServerEventsResponse(data: Any) -> ListServerEventsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("events", None) if field is not None: args["events"] = ( [unmarshal_ServerEvent(v) for v in field] if field is not None else None ) + else: + args["events"] = field(default_factory=list) return ListServerEventsResponse(**args) @@ -2808,22 +3441,32 @@ def unmarshal_ServerSummary(data: Any) -> ServerSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = 0 field = data.get("datacenter_name", None) if field is not None: args["datacenter_name"] = field + else: + args["datacenter_name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("created_at", None) if field is not None: @@ -2846,14 +3489,20 @@ def unmarshal_ServerSummary(data: Any) -> ServerSummary: field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = 0 field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ServerStatus.UNKNOWN field = data.get("interfaces", None) if field is not None: @@ -2862,28 +3511,38 @@ def unmarshal_ServerSummary(data: Any) -> ServerSummary: if field is not None else None ) + else: + args["interfaces"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("is_outsourced", None) if field is not None: args["is_outsourced"] = field + else: + args["is_outsourced"] = False field = data.get("qinq", None) if field is not None: args["qinq"] = field + else: + args["qinq"] = False field = data.get("is_hds", None) if field is not None: args["is_hds"] = field + else: + args["is_hds"] = False field = data.get("os_id", None) if field is not None: args["os_id"] = field else: - args["os_id"] = None + args["os_id"] = 0 field = data.get("level", None) if field is not None: @@ -2895,7 +3554,7 @@ def unmarshal_ServerSummary(data: Any) -> ServerSummary: if field is not None: args["rpn_version"] = field else: - args["rpn_version"] = None + args["rpn_version"] = 0 return ServerSummary(**args) @@ -2911,12 +3570,16 @@ def unmarshal_ListServersResponse(data: Any) -> ListServersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_ServerSummary(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListServersResponse(**args) @@ -2932,12 +3595,16 @@ def unmarshal_ListServicesResponse(data: Any) -> ListServicesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("services", None) if field is not None: args["services"] = ( [unmarshal_Service(v) for v in field] if field is not None else None ) + else: + args["services"] = field(default_factory=list) return ListServicesResponse(**args) @@ -2955,12 +3622,16 @@ def unmarshal_ListSubscribableServerOptionsResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("server_options", None) if field is not None: args["server_options"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["server_options"] = field(default_factory=list) return ListSubscribableServerOptionsResponse(**args) @@ -2976,12 +3647,16 @@ def unmarshal_RaidArray(data: Any) -> RaidArray: field = data.get("raid_level", None) if field is not None: args["raid_level"] = field + else: + args["raid_level"] = RaidArrayRaidLevel.NO_RAID field = data.get("disks", None) if field is not None: args["disks"] = ( [unmarshal_ServerDisk(v) for v in field] if field is not None else None ) + else: + args["disks"] = field(default_factory=list) return RaidArray(**args) @@ -2999,6 +3674,8 @@ def unmarshal_Raid(data: Any) -> Raid: args["raid_arrays"] = ( [unmarshal_RaidArray(v) for v in field] if field is not None else None ) + else: + args["raid_arrays"] = field(default_factory=list) return Raid(**args) @@ -3014,18 +3691,26 @@ def unmarshal_Refund(data: Any) -> Refund: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("method", None) if field is not None: args["method"] = field + else: + args["method"] = None field = data.get("content", None) if field is not None: args["content"] = field + else: + args["content"] = None field = data.get("total_with_taxes", None) if field is not None: @@ -3067,18 +3752,26 @@ def unmarshal_Rescue(data: Any) -> Rescue: field = data.get("os_id", None) if field is not None: args["os_id"] = field + else: + args["os_id"] = 0 field = data.get("login", None) if field is not None: args["login"] = field + else: + args["login"] = None field = data.get("password", None) if field is not None: args["password"] = field + else: + args["password"] = None field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = RescueProtocol.VNC return Rescue(**args) @@ -3094,22 +3787,32 @@ def unmarshal_Partition(data: Any) -> Partition: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = PartitionType.PRIMARY field = data.get("file_system", None) if field is not None: args["file_system"] = field + else: + args["file_system"] = PartitionFileSystem.UNKNOWN field = data.get("raid_level", None) if field is not None: args["raid_level"] = field + else: + args["raid_level"] = RaidArrayRaidLevel.NO_RAID field = data.get("capacity", None) if field is not None: args["capacity"] = field + else: + args["capacity"] = 0 field = data.get("connectors", None) if field is not None: args["connectors"] = field + else: + args["connectors"] = field(default_factory=list) field = data.get("mount_point", None) if field is not None: @@ -3133,6 +3836,8 @@ def unmarshal_ServerDefaultPartitioning(data: Any) -> ServerDefaultPartitioning: args["partitions"] = ( [unmarshal_Partition(v) for v in field] if field is not None else None ) + else: + args["partitions"] = field(default_factory=list) return ServerDefaultPartitioning(**args) @@ -3148,24 +3853,34 @@ def unmarshal_ServerInstall(data: Any) -> ServerInstall: field = data.get("os_id", None) if field is not None: args["os_id"] = field + else: + args["os_id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("partitions", None) if field is not None: args["partitions"] = ( [unmarshal_Partition(v) for v in field] if field is not None else None ) + else: + args["partitions"] = None field = data.get("ssh_key_ids", None) if field is not None: args["ssh_key_ids"] = field + else: + args["ssh_key_ids"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("user_login", None) if field is not None: @@ -3197,6 +3912,8 @@ def unmarshal_SubscribeStorageOptionsResponse( args["services"] = ( [unmarshal_Service(v) for v in field] if field is not None else None ) + else: + args["services"] = field(default_factory=list) return SubscribeStorageOptionsResponse(**args) @@ -3208,7 +3925,7 @@ def marshal_AttachFailoverIPToMacAddressRequest( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.mac is not None: output["mac"] = request.mac @@ -3244,7 +3961,9 @@ def marshal_CreateFailoverIPsRequest( output["quantity"] = request.quantity if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3262,7 +3981,9 @@ def marshal_CreateServerRequest( output["server_option_ids"] = request.server_option_ids if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.datacenter_name is not None: output["datacenter_name"] = request.datacenter_name @@ -3328,10 +4049,10 @@ def marshal_InstallPartition( output: Dict[str, Any] = {} if request.file_system is not None: - output["file_system"] = str(request.file_system) + output["file_system"] = request.file_system if request.raid_level is not None: - output["raid_level"] = str(request.raid_level) + output["raid_level"] = request.raid_level if request.capacity is not None: output["capacity"] = request.capacity @@ -3408,7 +4129,9 @@ def marshal_RpnSanApiCreateRpnSanRequest( output["offer_id"] = request.offer_id if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3456,7 +4179,9 @@ def marshal_RpnV1ApiCreateRpnGroupRequest( output["san_server_ids"] = request.san_server_ids if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3483,7 +4208,9 @@ def marshal_RpnV1ApiLeaveRpnGroupRequest( output["member_ids"] = request.member_ids if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3498,7 +4225,9 @@ def marshal_RpnV1ApiRpnGroupInviteRequest( output["server_ids"] = request.server_ids if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3540,10 +4269,12 @@ def marshal_RpnV2ApiCreateRpnV2GroupRequest( output["servers"] = request.servers if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ return output @@ -3654,7 +4385,7 @@ def marshal_UpdatableRaidArray( output: Dict[str, Any] = {} if request.raid_level is not None: - output["raid_level"] = str(request.raid_level) + output["raid_level"] = request.raid_level if request.disk_ids is not None: output["disk_ids"] = request.disk_ids diff --git a/scaleway/scaleway/dedibox/v1/types.py b/scaleway/scaleway/dedibox/v1/types.py index 4c4b12292..1ff06034d 100644 --- a/scaleway/scaleway/dedibox/v1/types.py +++ b/scaleway/scaleway/dedibox/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -707,7 +707,6 @@ class OfferSANInfo: @dataclass class OfferStorageInfo: max_quota: int - size: int @@ -781,34 +780,34 @@ class Offer: Payment frequency of the offer. """ - pricing: Optional[Money] + pricing: Optional[Money] = None """ Price of the offer. """ - server_info: Optional[OfferServerInfo] + server_info: Optional[OfferServerInfo] = None - service_level_info: Optional[OfferServiceLevelInfo] + service_level_info: Optional[OfferServiceLevelInfo] = None - rpn_info: Optional[OfferRPNInfo] + rpn_info: Optional[OfferRPNInfo] = None - san_info: Optional[OfferSANInfo] + san_info: Optional[OfferSANInfo] = None - antidos_info: Optional[OfferAntiDosInfo] + antidos_info: Optional[OfferAntiDosInfo] = None - backup_info: Optional[OfferBackupInfo] + backup_info: Optional[OfferBackupInfo] = None - usb_storage_info: Optional[OfferStorageInfo] + usb_storage_info: Optional[OfferStorageInfo] = None - storage_info: Optional[OfferStorageInfo] + storage_info: Optional[OfferStorageInfo] = None - license_info: Optional[OfferLicenseInfo] + license_info: Optional[OfferLicenseInfo] = None - failover_ip_info: Optional[OfferFailoverIpInfo] + failover_ip_info: Optional[OfferFailoverIpInfo] = None - failover_block_info: Optional[OfferFailoverBlockInfo] + failover_block_info: Optional[OfferFailoverBlockInfo] = None - bandwidth_info: Optional[OfferBandwidthInfo] + bandwidth_info: Optional[OfferBandwidthInfo] = None @dataclass @@ -921,27 +920,27 @@ class OS: Hostname max length. """ - max_partitions: Optional[int] + max_partitions: Optional[int] = 0 """ Maximum number of partitions which can be created. """ - panel_password_regex: Optional[str] + panel_password_regex: Optional[str] = None """ Regex used to validate the panel installation password. """ - requires_valid_hostname: Optional[bool] + requires_valid_hostname: Optional[bool] = False """ If both requires_valid_hostname & hostname_regex are set, it means that at least one of the criteria must be valid. """ - hostname_regex: Optional[str] + hostname_regex: Optional[str] = None """ If both requires_valid_hostname & hostname_regex are set, it means that at least one of the criteria must be valid. """ - released_at: Optional[datetime] + released_at: Optional[datetime] = None """ OS release date. """ @@ -950,23 +949,17 @@ class OS: @dataclass class ServerLocation: rack: str - room: str - datacenter_name: str @dataclass class ServerOption: options: List[ServerOption] - - offer: Optional[Offer] - - created_at: Optional[datetime] - - updated_at: Optional[datetime] - - expired_at: Optional[datetime] + offer: Optional[Offer] = None + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + expired_at: Optional[datetime] = None @dataclass @@ -1019,11 +1012,6 @@ class RpnSan: Offer ID. """ - created_at: Optional[datetime] - """ - Date of creation of the RPN SAN. - """ - offer_name: str """ Offer description. @@ -1040,7 +1028,6 @@ class RpnSan: """ iqn: str - rpnv1_compatible: bool """ True if the SAN is compatible with the RPNv1 technology. @@ -1051,19 +1038,23 @@ class RpnSan: True if the offer supports the RPNv1 implicitly, false if it must to be added to a group to support RPNv1. """ - offer: Optional[Offer] + created_at: Optional[datetime] = None + """ + Date of creation of the RPN SAN. + """ - delivered_at: Optional[datetime] + offer: Optional[Offer] = None + delivered_at: Optional[datetime] = None """ RPN SAN delivery date. """ - terminated_at: Optional[datetime] + terminated_at: Optional[datetime] = None """ RPN SAN termination date. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ RPN SAN expiration date. """ @@ -1111,7 +1102,7 @@ class RpnGroup: Rpn group project ID. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Rpn group creation date. """ @@ -1120,7 +1111,6 @@ class RpnGroup: @dataclass class RpnV2GroupSubnet: address: str - cidr: int @@ -1151,11 +1141,6 @@ class Server: Status of the server. """ - rebooted_at: Optional[datetime] - """ - Date of last reboot of the server. - """ - abuse_contact: str """ Abuse contact of the server. @@ -1211,42 +1196,47 @@ class Server: Whether or not the server is HDS. """ - created_at: Optional[datetime] + rebooted_at: Optional[datetime] = None + """ + Date of last reboot of the server. + """ + + created_at: Optional[datetime] = None """ Date of creation of the server. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date of last modification of the server. """ - expired_at: Optional[datetime] + expired_at: Optional[datetime] = None """ Date of release of the server. """ - offer: Optional[Offer] + offer: Optional[Offer] = None """ Offer of the server. """ - location: Optional[ServerLocation] + location: Optional[ServerLocation] = None """ Location of the server. """ - os: Optional[OS] + os: Optional[OS] = None """ OS installed on the server. """ - level: Optional[ServiceLevel] + level: Optional[ServiceLevel] = None """ Service level of the server. """ - rescue_os: Optional[OS] + rescue_os: Optional[OS] = None """ Rescue OS of the server. """ @@ -1293,16 +1283,13 @@ class FailoverBlock: @dataclass class RpnSanIpRpnV2Group: id: int - name: str @dataclass class RpnSanIpServer: id: int - hostname: str - datacenter_name: str @@ -1386,12 +1373,12 @@ class RpnV2Group: RPN V2 gateway. """ - subnet: Optional[RpnV2GroupSubnet] + subnet: Optional[RpnV2GroupSubnet] = None """ RPN V2 subnet. """ - rpnv1_group: Optional[RpnGroup] + rpnv1_group: Optional[RpnGroup] = None """ The RPNv1 group (if the compatibility was enabled). """ @@ -1414,26 +1401,22 @@ class RpnV2Member: RPN V2 member VLAN. """ - speed: Optional[int] + speed: Optional[int] = 0 """ RPN speed. """ - server: Optional[Server] + server: Optional[Server] = None - rpnv1_group: Optional[RpnGroup] + rpnv1_group: Optional[RpnGroup] = None @dataclass class ServerDisk: id: int - connector: str - type_: ServerDiskType - capacity: int - is_addon: bool @@ -1454,32 +1437,32 @@ class Service: Service type, either order or service. """ - resource_id: Optional[int] + resource_id: Optional[int] = 0 """ Resource ID of the service. """ - offer: Optional[Offer] + offer: Optional[Offer] = None """ Offer of the service. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the service. """ - delivered_at: Optional[datetime] + delivered_at: Optional[datetime] = None """ Delivery date of the service. """ - terminated_at: Optional[datetime] + terminated_at: Optional[datetime] = None """ Terminatation date of the service. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the service. """ @@ -1488,7 +1471,6 @@ class Service: @dataclass class GetIPv6BlockQuotasResponseQuota: quota: int - cidr: int @@ -1514,7 +1496,7 @@ class InstallPartition: Connectors of the installation partition. """ - mount_point: Optional[str] + mount_point: Optional[str] = None """ Mount point of the installation partition. """ @@ -1567,22 +1549,22 @@ class FailoverIP: The interface type. """ - mac: Optional[str] + mac: Optional[str] = None """ MAC address of the IP failover. """ - server_id: Optional[int] + server_id: Optional[int] = 0 """ Server ID linked to the IP failover. """ - block: Optional[FailoverBlock] + block: Optional[FailoverBlock] = None """ Block of the IP failover. """ - server_zone: Optional[str] + server_zone: Optional[str] = None """ The server zone (if assigned). """ @@ -1591,27 +1573,19 @@ class FailoverIP: @dataclass class ListIPv6BlockSubnetsAvailableResponseSubnet: address: str - cidr: int @dataclass class InvoiceSummary: id: int - status: InvoiceStatus - payment_method: InvoicePaymentMethod - transaction_id: int - - total_with_taxes: Optional[Money] - - total_without_taxes: Optional[Money] - - created_at: Optional[datetime] - - paid_at: Optional[datetime] + total_with_taxes: Optional[Money] = None + total_without_taxes: Optional[Money] = None + created_at: Optional[datetime] = None + paid_at: Optional[datetime] = None @dataclass @@ -1621,31 +1595,25 @@ class RpnSanIp: IP type (server | rpnv2_subnet). """ - ip: Optional[IP] + ip: Optional[IP] = None """ An IP object. """ - server: Optional[RpnSanIpServer] + server: Optional[RpnSanIpServer] = None - rpnv2_group: Optional[RpnSanIpRpnV2Group] + rpnv2_group: Optional[RpnSanIpRpnV2Group] = None @dataclass class RefundSummary: id: int - status: RefundStatus - method: RefundMethod - - total_with_taxes: Optional[Money] - - total_without_taxes: Optional[Money] - - created_at: Optional[datetime] - - refunded_at: Optional[datetime] + total_with_taxes: Optional[Money] = None + total_without_taxes: Optional[Money] = None + created_at: Optional[datetime] = None + refunded_at: Optional[datetime] = None @dataclass @@ -1680,17 +1648,17 @@ class RpnGroupMember: RPN member owner. """ - san_server: Optional[RpnSanServer] + san_server: Optional[RpnSanServer] = None """ Authorized RPN SAN server. """ - server: Optional[Server] + server: Optional[Server] = None """ Authorized rpn v1 capable server. """ - speed: Optional[int] + speed: Optional[int] = 0 """ RPN speed. """ @@ -1733,11 +1701,6 @@ class RpnSanSummary: Offer ID. """ - created_at: Optional[datetime] - """ - Date of creation of the RPN SAN. - """ - offer_name: str """ Offer description. @@ -1763,17 +1726,22 @@ class RpnSanSummary: True if the offer supports the RPNv1 implicitly, false if it must to be added to a group to support RPNv1. """ - delivered_at: Optional[datetime] + created_at: Optional[datetime] = None + """ + Date of creation of the RPN SAN. + """ + + delivered_at: Optional[datetime] = None """ RPN SAN delivery date. """ - terminated_at: Optional[datetime] + terminated_at: Optional[datetime] = None """ RPN SAN termination date. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ RPN SAN expiration date. """ @@ -1826,12 +1794,12 @@ class RpnServerCapability: True if server can join an rpnv2 group. """ - ip_address: Optional[str] + ip_address: Optional[str] = None """ Private IP address (if rpn compatiblle). """ - rpn_version: Optional[int] + rpn_version: Optional[int] = 0 """ Supported rpn version. """ @@ -1854,22 +1822,22 @@ class Log: Action status. """ - group: Optional[RpnV2Group] + group: Optional[RpnV2Group] = None """ RPN V2 group. """ - member: Optional[RpnV2Member] + member: Optional[RpnV2Member] = None """ RPN V2 member (if appliable). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date. """ - finished_at: Optional[datetime] + finished_at: Optional[datetime] = None """ Completion date. """ @@ -1887,7 +1855,7 @@ class ServerEvent: Description of the event. """ - date: Optional[datetime] + date: Optional[datetime] = None """ Date of the event. """ @@ -1920,21 +1888,6 @@ class ServerSummary: Hostname of the server. """ - created_at: Optional[datetime] - """ - Date of creation of the server. - """ - - updated_at: Optional[datetime] - """ - Date of last modification of the server. - """ - - expired_at: Optional[datetime] - """ - Date of release of the server. - """ - offer_id: int """ Offer ID of the server. @@ -1975,17 +1928,32 @@ class ServerSummary: Whether or not the server is HDS. """ - os_id: Optional[int] + created_at: Optional[datetime] = None + """ + Date of creation of the server. + """ + + updated_at: Optional[datetime] = None + """ + Date of last modification of the server. + """ + + expired_at: Optional[datetime] = None + """ + Date of release of the server. + """ + + os_id: Optional[int] = 0 """ OS ID installed on server. """ - level: Optional[ServiceLevel] + level: Optional[ServiceLevel] = None """ Service level of the server. """ - rpn_version: Optional[int] + rpn_version: Optional[int] = 0 """ Supported RPN version. """ @@ -2121,7 +2089,7 @@ class Partition: Connectors of the partition. """ - mount_point: Optional[str] + mount_point: Optional[str] = None """ Mount point of the partition. """ @@ -2147,17 +2115,19 @@ class AttachFailoverIPToMacAddressRequest: ID of the failover IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - type_: Optional[AttachFailoverIPToMacAddressRequestMacType] + type_: Optional[AttachFailoverIPToMacAddressRequestMacType] = ( + AttachFailoverIPToMacAddressRequestMacType.MAC_TYPE_UNKNOWN + ) """ A mac type. """ - mac: Optional[str] + mac: Optional[str] = None """ A valid mac address (existing or not). """ @@ -2175,7 +2145,7 @@ class AttachFailoverIPsRequest: List of ID of failovers IP to attach. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2203,7 +2173,7 @@ class BMCAccess: Status of the connection. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ The date after which the BMC (Baseboard Management Controller) access will be closed. """ @@ -2264,7 +2234,7 @@ class Backup: @dataclass class BillingApiCanOrderRequest: - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -2289,43 +2259,30 @@ class BillingApiGetRefundRequest: @dataclass class BillingApiListInvoicesRequest: - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListInvoicesRequestOrderBy] - - project_id: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListInvoicesRequestOrderBy] = None + project_id: Optional[str] = None @dataclass class BillingApiListRefundsRequest: - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListRefundsRequestOrderBy] - - project_id: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListRefundsRequestOrderBy] = None + project_id: Optional[str] = None @dataclass class CanOrderResponse: can_order: bool - quota_ok: bool - phone_confirmed: bool - email_confirmed: bool - user_confirmed: bool - payment_mode: bool - billing_ok: bool - - message: Optional[str] + message: Optional[str] = None @dataclass @@ -2335,7 +2292,7 @@ class CancelServerInstallRequest: Server ID of the server to cancel install. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2353,12 +2310,12 @@ class CreateFailoverIPsRequest: Quantity. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -2367,7 +2324,6 @@ class CreateFailoverIPsRequest: @dataclass class CreateFailoverIPsResponse: total_count: int - services: List[Service] @@ -2383,17 +2339,17 @@ class CreateServerRequest: Server option IDs of the new server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the new server. """ - datacenter_name: Optional[str] + datacenter_name: Optional[str] = None """ Datacenter name of the new server. """ @@ -2406,7 +2362,7 @@ class DeleteFailoverIPRequest: ID of the failover IP to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2419,7 +2375,7 @@ class DeleteServerRequest: Server ID to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2432,7 +2388,7 @@ class DeleteServiceRequest: ID of the service. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2445,7 +2401,7 @@ class DetachFailoverIPFromMacAddressRequest: ID of the failover IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2458,7 +2414,7 @@ class DetachFailoverIPsRequest: List of IDs of failovers IP to detach. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2471,7 +2427,7 @@ class GetBMCAccessRequest: ID of the server to get BMC access. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2484,7 +2440,7 @@ class GetFailoverIPRequest: ID of the failover IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2515,12 +2471,12 @@ class GetOSRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -2533,12 +2489,12 @@ class GetOfferRequest: ID of offer. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -2547,8 +2503,7 @@ class GetOfferRequest: @dataclass class GetOrderedServiceRequest: ordered_service_id: int - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2561,7 +2516,7 @@ class GetRaidRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2569,12 +2524,12 @@ class GetRaidRequest: @dataclass class GetRemainingQuotaRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -2610,7 +2565,7 @@ class GetRescueRequest: ID of the server to get rescue. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2623,7 +2578,7 @@ class GetRpnStatusResponse: If status = 'operational', you can perform rpn actions in write. """ - operations_left: Optional[int] + operations_left: Optional[int] = 0 """ Number of operations left to perform before being operational. """ @@ -2636,7 +2591,7 @@ class GetServerBackupRequest: Server ID of the backup. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2654,7 +2609,7 @@ class GetServerDefaultPartitioningRequest: OS ID of the default partitioning. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2667,7 +2622,7 @@ class GetServerInstallRequest: Server ID of the server to install. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2680,7 +2635,7 @@ class GetServerRequest: ID of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2693,7 +2648,7 @@ class GetServiceRequest: ID of the service. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2739,7 +2694,7 @@ class IPv6Block: @dataclass class IPv6BlockApiCreateIPv6BlockRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ @@ -2773,7 +2728,7 @@ class IPv6BlockApiDeleteIPv6BlockRequest: @dataclass class IPv6BlockApiGetIPv6BlockQuotasRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ @@ -2781,7 +2736,7 @@ class IPv6BlockApiGetIPv6BlockQuotasRequest: @dataclass class IPv6BlockApiGetIPv6BlockRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ @@ -2802,7 +2757,7 @@ class IPv6BlockApiUpdateIPv6BlockRequest: ID of the IPv6 block. """ - nameservers: Optional[List[str]] + nameservers: Optional[List[str]] = field(default_factory=list) """ DNS to link to the IPv6. """ @@ -2825,47 +2780,47 @@ class InstallServerRequest: Hostname of the server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - user_login: Optional[str] + user_login: Optional[str] = None """ User to install on the server. """ - user_password: Optional[str] + user_password: Optional[str] = None """ User password to install on the server. """ - panel_password: Optional[str] + panel_password: Optional[str] = None """ Panel password to install on the server. """ - root_password: Optional[str] + root_password: Optional[str] = None """ Root password to install on the server. """ - partitions: Optional[List[InstallPartition]] + partitions: Optional[List[InstallPartition]] = field(default_factory=list) """ Partitions to install on the server. """ - ssh_key_ids: Optional[List[str]] + ssh_key_ids: Optional[List[str]] = field(default_factory=list) """ SSH key IDs authorized on the server. """ - license_offer_id: Optional[int] + license_offer_id: Optional[int] = 0 """ Offer ID of license to install on server. """ - ip_id: Optional[int] + ip_id: Optional[int] = 0 """ IP to link at the license to install on server. """ @@ -2874,57 +2829,51 @@ class InstallServerRequest: @dataclass class Invoice: id: int - status: InvoiceStatus - payment_method: InvoicePaymentMethod - content: str - transaction_id: int - - total_with_taxes: Optional[Money] - - total_without_taxes: Optional[Money] - - created_at: Optional[datetime] - - paid_at: Optional[datetime] + total_with_taxes: Optional[Money] = None + total_without_taxes: Optional[Money] = None + created_at: Optional[datetime] = None + paid_at: Optional[datetime] = None @dataclass class ListFailoverIPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of failovers IP per page. """ - order_by: Optional[ListFailoverIPsRequestOrderBy] + order_by: Optional[ListFailoverIPsRequestOrderBy] = ( + ListFailoverIPsRequestOrderBy.IP_ASC + ) """ Order of the failovers IP. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter failovers IP by project ID. """ - search: Optional[str] + search: Optional[str] = None """ Filter failovers IP which matching with this field. """ - only_available: Optional[bool] + only_available: Optional[bool] = False """ True: return all failovers IP not attached on server false: return all failovers IP attached on server. @@ -2960,7 +2909,6 @@ class ListIPv6BlockSubnetsAvailableResponse: @dataclass class ListInvoicesResponse: total_count: int - invoices: List[InvoiceSummary] @@ -2984,32 +2932,32 @@ class ListOSRequest: Filter OS by compatible server ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of OS per page. """ - order_by: Optional[ListOSRequestOrderBy] + order_by: Optional[ListOSRequestOrderBy] = ListOSRequestOrderBy.CREATED_AT_ASC """ Order of the OS. """ - type_: Optional[OSType] + type_: Optional[OSType] = OSType.UNKNOWN_TYPE """ Type of the OS. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -3030,62 +2978,64 @@ class ListOSResponse: @dataclass class ListOffersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of offer per page. """ - order_by: Optional[ListOffersRequestOrderBy] + order_by: Optional[ListOffersRequestOrderBy] = ( + ListOffersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the offers. """ - commercial_range: Optional[str] + commercial_range: Optional[str] = None """ Filter on commercial range. """ - catalog: Optional[OfferCatalog] + catalog: Optional[OfferCatalog] = OfferCatalog.ALL """ Filter on catalog. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ - is_failover_ip: Optional[bool] + is_failover_ip: Optional[bool] = False """ Get the current failover IP offer. """ - is_failover_block: Optional[bool] + is_failover_block: Optional[bool] = False """ Get the current failover IP block offer. """ - sold_in: Optional[List[str]] + sold_in: Optional[List[str]] = None """ Filter offers depending on their datacenter. """ - available_only: Optional[bool] + available_only: Optional[bool] = False """ Set this filter to true to only return available offers. """ - is_rpn_san: Optional[bool] + is_rpn_san: Optional[bool] = False """ Get the RPN SAN offers. """ @@ -3107,7 +3057,6 @@ class ListOffersResponse: @dataclass class ListRefundsResponse: total_count: int - refunds: List[RefundSummary] @@ -3261,22 +3210,24 @@ class ListServerDisksRequest: Server ID of the server disks. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of server disk per page. """ - order_by: Optional[ListServerDisksRequestOrderBy] + order_by: Optional[ListServerDisksRequestOrderBy] = ( + ListServerDisksRequestOrderBy.CREATED_AT_ASC + ) """ Order of the server disks. """ @@ -3302,22 +3253,24 @@ class ListServerEventsRequest: Server ID of the server events. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of server event per page. """ - order_by: Optional[ListServerEventsRequestOrderBy] + order_by: Optional[ListServerEventsRequestOrderBy] = ( + ListServerEventsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the server events. """ @@ -3338,32 +3291,34 @@ class ListServerEventsResponse: @dataclass class ListServersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of server per page. """ - order_by: Optional[ListServersRequestOrderBy] + order_by: Optional[ListServersRequestOrderBy] = ( + ListServersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the servers. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter servers by project ID. """ - search: Optional[str] + search: Optional[str] = None """ Filter servers by hostname. """ @@ -3384,27 +3339,29 @@ class ListServersResponse: @dataclass class ListServicesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of service per page. """ - order_by: Optional[ListServicesRequestOrderBy] + order_by: Optional[ListServicesRequestOrderBy] = ( + ListServicesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the services. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ @@ -3430,17 +3387,17 @@ class ListSubscribableServerOptionsRequest: Server ID of the subscribable server options. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of subscribable server option per page. """ @@ -3461,65 +3418,43 @@ class ListSubscribableServerOptionsResponse: @dataclass class OfferFailoverBlockInfo: - onetime_fees: Optional[Offer] + onetime_fees: Optional[Offer] = None @dataclass class OfferFailoverIpInfo: - onetime_fees: Optional[Offer] + onetime_fees: Optional[Offer] = None @dataclass class OfferServerInfo: bandwidth: int - stock: OfferServerInfoStock - commercial_range: str - disks: List[Disk] - cpus: List[CPU] - memories: List[Memory] - persistent_memories: List[PersistentMemory] - raid_controllers: List[RaidController] - available_options: List[Offer] - connectivity: int - stock_by_datacenter: Dict[str, OfferServerInfoStock] - - rpn_version: Optional[int] - - onetime_fees: Optional[Offer] + rpn_version: Optional[int] = None + onetime_fees: Optional[Offer] = None @dataclass class OfferServiceLevelInfo: support_ticket: bool - support_phone: bool - sales_support: bool - git: str - sla: float - priority_support: bool - high_rpn_bandwidth: bool - customization: bool - antidos: bool - extra_failover_quota: int - available_options: List[Offer] @@ -3538,7 +3473,7 @@ class RebootServerRequest: Server ID to reboot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3547,20 +3482,13 @@ class RebootServerRequest: @dataclass class Refund: id: int - status: RefundStatus - method: RefundMethod - content: str - - total_with_taxes: Optional[Money] - - total_without_taxes: Optional[Money] - - created_at: Optional[datetime] - - refunded_at: Optional[datetime] + total_with_taxes: Optional[Money] = None + total_without_taxes: Optional[Money] = None + created_at: Optional[datetime] = None + refunded_at: Optional[datetime] = None @dataclass @@ -3588,17 +3516,17 @@ class Rescue: @dataclass class RpnApiGetRpnStatusRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ A project ID. """ - rpnv1_group_id: Optional[int] + rpnv1_group_id: Optional[int] = 0 """ An RPN v1 group ID. """ - rpnv2_group_id: Optional[int] + rpnv2_group_id: Optional[int] = 0 """ An RPN v2 group ID. """ @@ -3606,22 +3534,24 @@ class RpnApiGetRpnStatusRequest: @dataclass class RpnApiListRpnServerCapabilitiesRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of servers per page. """ - order_by: Optional[ListRpnServerCapabilitiesRequestOrderBy] + order_by: Optional[ListRpnServerCapabilitiesRequestOrderBy] = ( + ListRpnServerCapabilitiesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the servers. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter servers by project ID. """ @@ -3647,7 +3577,7 @@ class RpnSanApiCreateRpnSanRequest: Offer ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Your project ID. """ @@ -3676,7 +3606,7 @@ class RpnSanApiListAvailableIpsRequest: RPN SAN ID. """ - type_: Optional[RpnSanIpType] + type_: Optional[RpnSanIpType] = RpnSanIpType.UNKNOWN """ Filter by IP type (server | rpnv2_subnet). """ @@ -3689,7 +3619,7 @@ class RpnSanApiListIpsRequest: RPN SAN ID. """ - type_: Optional[RpnSanIpType] + type_: Optional[RpnSanIpType] = RpnSanIpType.UNKNOWN """ Filter by IP type (server | rpnv2_subnet). """ @@ -3697,22 +3627,24 @@ class RpnSanApiListIpsRequest: @dataclass class RpnSanApiListRpnSansRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of RPN SANs per page. """ - order_by: Optional[ListRpnSansRequestOrderBy] + order_by: Optional[ListRpnSansRequestOrderBy] = ( + ListRpnSansRequestOrderBy.CREATED_AT_ASC + ) """ Order of the RPN SANs. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter RPN SANs by project ID. """ @@ -3746,12 +3678,12 @@ class RpnV1ApiAddRpnGroupMembersRequest: The rpn v1 group ID. """ - server_ids: Optional[List[int]] + server_ids: Optional[List[int]] = field(default_factory=list) """ A collection of rpn v1 capable server IDs. """ - san_server_ids: Optional[List[int]] + san_server_ids: Optional[List[int]] = field(default_factory=list) """ A collection of rpn v1 capable RPN SAN server IDs. """ @@ -3764,17 +3696,17 @@ class RpnV1ApiCreateRpnGroupRequest: Rpn v1 group name. """ - server_ids: Optional[List[int]] + server_ids: Optional[List[int]] = field(default_factory=list) """ A collection of rpn v1 capable servers. """ - san_server_ids: Optional[List[int]] + san_server_ids: Optional[List[int]] = field(default_factory=list) """ A collection of rpn v1 capable rpn sans servers. """ - project_id: Optional[str] + project_id: Optional[str] = None """ A project ID. """ @@ -3821,7 +3753,7 @@ class RpnV1ApiLeaveRpnGroupRequest: A collection of rpn v1 group members IDs. """ - project_id: Optional[str] + project_id: Optional[str] = None """ A project ID. """ @@ -3829,22 +3761,24 @@ class RpnV1ApiLeaveRpnGroupRequest: @dataclass class RpnV1ApiListRpnCapableSanServersRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn capable resources per page. """ - order_by: Optional[ListRpnCapableSanServersRequestOrderBy] + order_by: Optional[ListRpnCapableSanServersRequestOrderBy] = ( + ListRpnCapableSanServersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn capable resources. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn capable resources by project ID. """ @@ -3852,22 +3786,24 @@ class RpnV1ApiListRpnCapableSanServersRequest: @dataclass class RpnV1ApiListRpnCapableServersRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn capable resources per page. """ - order_by: Optional[ListRpnCapableServersRequestOrderBy] + order_by: Optional[ListRpnCapableServersRequestOrderBy] = ( + ListRpnCapableServersRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn capable resources. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn capable resources by project ID. """ @@ -3875,27 +3811,29 @@ class RpnV1ApiListRpnCapableServersRequest: @dataclass class RpnV1ApiListRpnGroupMembersRequest: - page: Optional[int] + group_id: int """ - Page number. + Filter rpn v1 group members by group ID. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of rpn v1 group members per page. + Page number. """ - order_by: Optional[ListRpnGroupMembersRequestOrderBy] + page_size: Optional[int] = 0 """ - Order of the rpn v1 group members. + Number of rpn v1 group members per page. """ - group_id: int + order_by: Optional[ListRpnGroupMembersRequestOrderBy] = ( + ListRpnGroupMembersRequestOrderBy.CREATED_AT_ASC + ) """ - Filter rpn v1 group members by group ID. + Order of the rpn v1 group members. """ - project_id: Optional[str] + project_id: Optional[str] = None """ A project ID. """ @@ -3903,22 +3841,24 @@ class RpnV1ApiListRpnGroupMembersRequest: @dataclass class RpnV1ApiListRpnGroupsRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn v1 groups per page. """ - order_by: Optional[ListRpnGroupsRequestOrderBy] + order_by: Optional[ListRpnGroupsRequestOrderBy] = ( + ListRpnGroupsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn v1 groups. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn v1 groups by project ID. """ @@ -3926,22 +3866,24 @@ class RpnV1ApiListRpnGroupsRequest: @dataclass class RpnV1ApiListRpnInvitesRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn capable resources per page. """ - order_by: Optional[ListRpnInvitesRequestOrderBy] + order_by: Optional[ListRpnInvitesRequestOrderBy] = ( + ListRpnInvitesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn capable resources. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn capable resources by project ID. """ @@ -3967,7 +3909,7 @@ class RpnV1ApiRpnGroupInviteRequest: A collection of external server IDs. """ - project_id: Optional[str] + project_id: Optional[str] = None """ A project ID. """ @@ -3980,7 +3922,7 @@ class RpnV1ApiUpdateRpnGroupNameRequest: Rpn v1 group ID. """ - name: Optional[str] + name: Optional[str] = None """ New rpn v1 group name. """ @@ -4011,12 +3953,12 @@ class RpnV2ApiCreateRpnV2GroupRequest: A collection of server IDs. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the RPN V2 group. """ - type_: Optional[RpnV2GroupType] + type_: Optional[RpnV2GroupType] = RpnV2GroupType.UNKNOWN_TYPE """ RPN V2 group type (qing / standard). """ @@ -4074,22 +4016,24 @@ class RpnV2ApiGetRpnV2GroupRequest: @dataclass class RpnV2ApiListRpnV2CapableResourcesRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn v2 capable resources per page. """ - order_by: Optional[ListRpnV2CapableResourcesRequestOrderBy] + order_by: Optional[ListRpnV2CapableResourcesRequestOrderBy] = ( + ListRpnV2CapableResourcesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn v2 capable resources. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn v2 capable resources by project ID. """ @@ -4097,45 +4041,49 @@ class RpnV2ApiListRpnV2CapableResourcesRequest: @dataclass class RpnV2ApiListRpnV2GroupLogsRequest: - page: Optional[int] + group_id: int """ - Page number. + RPN V2 group ID. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of rpn v2 group logs per page. + Page number. """ - order_by: Optional[ListRpnV2GroupLogsRequestOrderBy] + page_size: Optional[int] = 0 """ - Order of the rpn v2 group logs. + Number of rpn v2 group logs per page. """ - group_id: int + order_by: Optional[ListRpnV2GroupLogsRequestOrderBy] = ( + ListRpnV2GroupLogsRequestOrderBy.CREATED_AT_ASC + ) """ - RPN V2 group ID. + Order of the rpn v2 group logs. """ @dataclass class RpnV2ApiListRpnV2GroupsRequest: - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of rpn v2 groups per page. """ - order_by: Optional[ListRpnV2GroupsRequestOrderBy] + order_by: Optional[ListRpnV2GroupsRequestOrderBy] = ( + ListRpnV2GroupsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the rpn v2 groups. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter rpn v2 groups by project ID. """ @@ -4143,27 +4091,31 @@ class RpnV2ApiListRpnV2GroupsRequest: @dataclass class RpnV2ApiListRpnV2MembersRequest: - page: Optional[int] + group_id: int """ - Page number. + RPN V2 group ID. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of rpn v2 group members per page. + Page number. """ - order_by: Optional[ListRpnV2MembersRequestOrderBy] + page_size: Optional[int] = 0 """ - Order of the rpn v2 group members. + Number of rpn v2 group members per page. """ - group_id: int + order_by: Optional[ListRpnV2MembersRequestOrderBy] = ( + ListRpnV2MembersRequestOrderBy.CREATED_AT_ASC + ) """ - RPN V2 group ID. + Order of the rpn v2 group members. """ - type_: Optional[ListRpnV2MembersRequestType] + type_: Optional[ListRpnV2MembersRequestType] = ( + ListRpnV2MembersRequestType.UNKNOWN_TYPE + ) """ Filter members by type. """ @@ -4176,7 +4128,7 @@ class RpnV2ApiUpdateRpnV2GroupNameRequest: RPN V2 group ID. """ - name: Optional[str] + name: Optional[str] = None """ RPN V2 group name. """ @@ -4194,7 +4146,7 @@ class RpnV2ApiUpdateRpnV2VlanForMembersRequest: RPN V2 member IDs. """ - vlan: Optional[int] + vlan: Optional[int] = 0 """ Min: 0. Max: 3967. @@ -4212,18 +4164,12 @@ class ServerDefaultPartitioning: @dataclass class ServerInstall: os_id: int - hostname: str - partitions: List[Partition] - ssh_key_ids: List[str] - status: ServerInstallStatus - - user_login: Optional[str] - - panel_url: Optional[str] + user_login: Optional[str] = None + panel_url: Optional[str] = None @dataclass @@ -4238,7 +4184,7 @@ class StartBMCAccessRequest: The IP authorized to connect to the given server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4256,7 +4202,7 @@ class StartRescueRequest: OS ID to use to start rescue. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4269,7 +4215,7 @@ class StartServerRequest: Server ID to start. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4282,7 +4228,7 @@ class StopBMCAccessRequest: ID of the server to stop BMC access. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4295,7 +4241,7 @@ class StopRescueRequest: ID of the server to stop rescue. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4308,7 +4254,7 @@ class StopServerRequest: Server ID to stop. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4326,7 +4272,7 @@ class SubscribeServerOptionRequest: Option ID to subscribe. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4344,7 +4290,7 @@ class SubscribeStorageOptionsRequest: Option IDs of the storage options to subscribe. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4370,7 +4316,7 @@ class UpdateRaidRequest: RAIDs to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4388,7 +4334,7 @@ class UpdateReverseRequest: Reverse to apply on the IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4401,22 +4347,22 @@ class UpdateServerBackupRequest: Server ID to update backup. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - password: Optional[str] + password: Optional[str] = None """ Password of the server backup. """ - autologin: Optional[bool] + autologin: Optional[bool] = False """ Autologin of the server backup. """ - acl_enabled: Optional[bool] + acl_enabled: Optional[bool] = False """ Boolean to enable or disable ACL. """ @@ -4429,17 +4375,17 @@ class UpdateServerRequest: Server ID to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - hostname: Optional[str] + hostname: Optional[str] = None """ Hostname of the server to update. """ - enable_ipv6: Optional[bool] + enable_ipv6: Optional[bool] = False """ Flag to enable or not the IPv6 of server. """ @@ -4452,12 +4398,12 @@ class UpdateServerTagsRequest: Server ID to update the tags. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of server to update. """ diff --git a/scaleway/scaleway/domain/v2beta1/marshalling.py b/scaleway/scaleway/domain/v2beta1/marshalling.py index 079c77d2e..a5722c6cc 100644 --- a/scaleway/scaleway/domain/v2beta1/marshalling.py +++ b/scaleway/scaleway/domain/v2beta1/marshalling.py @@ -13,7 +13,11 @@ resolve_one_of, ) from .types import ( + DomainFeatureStatus, + DomainStatus, LinkedProduct, + TaskStatus, + TaskType, ContactExtensionFRAssociationInfo, ContactExtensionFRCodeAuthAfnicInfo, ContactExtensionFRDunsInfo, @@ -131,6 +135,8 @@ def unmarshal_ContactExtensionFRAssociationInfo( field = data.get("publication_jo_page", None) if field is not None: args["publication_jo_page"] = field + else: + args["publication_jo_page"] = None field = data.get("publication_jo", None) if field is not None: @@ -156,6 +162,8 @@ def unmarshal_ContactExtensionFRCodeAuthAfnicInfo( field = data.get("code_auth_afnic", None) if field is not None: args["code_auth_afnic"] = field + else: + args["code_auth_afnic"] = None return ContactExtensionFRCodeAuthAfnicInfo(**args) @@ -171,10 +179,14 @@ def unmarshal_ContactExtensionFRDunsInfo(data: Any) -> ContactExtensionFRDunsInf field = data.get("duns_id", None) if field is not None: args["duns_id"] = field + else: + args["duns_id"] = None field = data.get("local_id", None) if field is not None: args["local_id"] = field + else: + args["local_id"] = None return ContactExtensionFRDunsInfo(**args) @@ -192,6 +204,8 @@ def unmarshal_ContactExtensionFRIndividualInfo( field = data.get("whois_opt_in", None) if field is not None: args["whois_opt_in"] = field + else: + args["whois_opt_in"] = None return ContactExtensionFRIndividualInfo(**args) @@ -209,6 +223,8 @@ def unmarshal_ContactExtensionFRTrademarkInfo( field = data.get("trademark_inpi", None) if field is not None: args["trademark_inpi"] = field + else: + args["trademark_inpi"] = None return ContactExtensionFRTrademarkInfo(**args) @@ -224,6 +240,8 @@ def unmarshal_ContactExtensionEU(data: Any) -> ContactExtensionEU: field = data.get("european_citizenship", None) if field is not None: args["european_citizenship"] = field + else: + args["european_citizenship"] = None return ContactExtensionEU(**args) @@ -239,6 +257,8 @@ def unmarshal_ContactExtensionFR(data: Any) -> ContactExtensionFR: field = data.get("mode", None) if field is not None: args["mode"] = field + else: + args["mode"] = None field = data.get("individual_info", None) if field is not None: @@ -286,10 +306,14 @@ def unmarshal_ContactExtensionNL(data: Any) -> ContactExtensionNL: field = data.get("legal_form", None) if field is not None: args["legal_form"] = field + else: + args["legal_form"] = None field = data.get("legal_form_registration_number", None) if field is not None: args["legal_form_registration_number"] = field + else: + args["legal_form_registration_number"] = None return ContactExtensionNL(**args) @@ -305,10 +329,14 @@ def unmarshal_ContactQuestion(data: Any) -> ContactQuestion: field = data.get("question", None) if field is not None: args["question"] = field + else: + args["question"] = None field = data.get("answer", None) if field is not None: args["answer"] = field + else: + args["answer"] = None return ContactQuestion(**args) @@ -324,78 +352,116 @@ def unmarshal_Contact(data: Any) -> Contact: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("legal_form", None) if field is not None: args["legal_form"] = field + else: + args["legal_form"] = None field = data.get("firstname", None) if field is not None: args["firstname"] = field + else: + args["firstname"] = None field = data.get("lastname", None) if field is not None: args["lastname"] = field + else: + args["lastname"] = None field = data.get("company_name", None) if field is not None: args["company_name"] = field + else: + args["company_name"] = None field = data.get("email", None) if field is not None: args["email"] = field + else: + args["email"] = None field = data.get("email_alt", None) if field is not None: args["email_alt"] = field + else: + args["email_alt"] = None field = data.get("phone_number", None) if field is not None: args["phone_number"] = field + else: + args["phone_number"] = None field = data.get("fax_number", None) if field is not None: args["fax_number"] = field + else: + args["fax_number"] = None field = data.get("address_line_1", None) if field is not None: args["address_line_1"] = field + else: + args["address_line_1"] = None field = data.get("address_line_2", None) if field is not None: args["address_line_2"] = field + else: + args["address_line_2"] = None field = data.get("zip", None) if field is not None: args["zip"] = field + else: + args["zip"] = None field = data.get("city", None) if field is not None: args["city"] = field + else: + args["city"] = None field = data.get("country", None) if field is not None: args["country"] = field + else: + args["country"] = None field = data.get("vat_identification_code", None) if field is not None: args["vat_identification_code"] = field + else: + args["vat_identification_code"] = None field = data.get("company_identification_code", None) if field is not None: args["company_identification_code"] = field + else: + args["company_identification_code"] = None field = data.get("lang", None) if field is not None: args["lang"] = field + else: + args["lang"] = None field = data.get("resale", None) if field is not None: args["resale"] = field + else: + args["resale"] = None field = data.get("whois_opt_in", None) if field is not None: args["whois_opt_in"] = field + else: + args["whois_opt_in"] = None field = data.get("questions", None) if field is not None: @@ -420,14 +486,20 @@ def unmarshal_Contact(data: Any) -> Contact: field = data.get("email_status", None) if field is not None: args["email_status"] = field + else: + args["email_status"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("extension_nl", None) if field is not None: @@ -449,36 +521,52 @@ def unmarshal_DNSZone(data: Any) -> DNSZone: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("subdomain", None) if field is not None: args["subdomain"] = field + else: + args["subdomain"] = None field = data.get("ns", None) if field is not None: args["ns"] = field + else: + args["ns"] = None field = data.get("ns_default", None) if field is not None: args["ns_default"] = field + else: + args["ns_default"] = None field = data.get("ns_master", None) if field is not None: args["ns_master"] = field + else: + args["ns_master"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("linked_products", None) if field is not None: args["linked_products"] = ( [LinkedProduct(v) for v in field] if field is not None else None ) + else: + args["linked_products"] = None field = data.get("message", None) if field is not None: @@ -506,18 +594,26 @@ def unmarshal_Host(data: Any) -> Host: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("ips", None) if field is not None: args["ips"] = field + else: + args["ips"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None return Host(**args) @@ -533,22 +629,32 @@ def unmarshal_SSLCertificate(data: Any) -> SSLCertificate: field = data.get("dns_zone", None) if field is not None: args["dns_zone"] = field + else: + args["dns_zone"] = None field = data.get("alternative_dns_zones", None) if field is not None: args["alternative_dns_zones"] = field + else: + args["alternative_dns_zones"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("private_key", None) if field is not None: args["private_key"] = field + else: + args["private_key"] = None field = data.get("certificate_chain", None) if field is not None: args["certificate_chain"] = field + else: + args["certificate_chain"] = None field = data.get("created_at", None) if field is not None: @@ -578,6 +684,8 @@ def unmarshal_CheckContactsCompatibilityResponseContactCheckResult( field = data.get("compatible", None) if field is not None: args["compatible"] = field + else: + args["compatible"] = None field = data.get("error_message", None) if field is not None: @@ -601,6 +709,8 @@ def unmarshal_CheckContactsCompatibilityResponse( field = data.get("compatible", None) if field is not None: args["compatible"] = field + else: + args["compatible"] = None field = data.get("owner_check_result", None) if field is not None: @@ -684,6 +794,8 @@ def unmarshal_DSRecordPublicKey(data: Any) -> DSRecordPublicKey: field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None return DSRecordPublicKey(**args) @@ -699,10 +811,14 @@ def unmarshal_DSRecordDigest(data: Any) -> DSRecordDigest: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("digest", None) if field is not None: args["digest"] = field + else: + args["digest"] = None field = data.get("public_key", None) if field is not None: @@ -724,10 +840,14 @@ def unmarshal_DSRecord(data: Any) -> DSRecord: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("algorithm", None) if field is not None: args["algorithm"] = field + else: + args["algorithm"] = None field = data.get("digest", None) if field is not None: @@ -755,10 +875,14 @@ def unmarshal_TldOffer(data: Any) -> TldOffer: field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = None field = data.get("operation_path", None) if field is not None: args["operation_path"] = field + else: + args["operation_path"] = None field = data.get("price", None) if field is not None: @@ -780,12 +904,16 @@ def unmarshal_DomainDNSSEC(data: Any) -> DomainDNSSEC: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("ds_records", None) if field is not None: args["ds_records"] = ( [unmarshal_DSRecord(v) for v in field] if field is not None else None ) + else: + args["ds_records"] = None return DomainDNSSEC(**args) @@ -803,6 +931,8 @@ def unmarshal_DomainRegistrationStatusExternalDomain( field = data.get("validation_token", None) if field is not None: args["validation_token"] = field + else: + args["validation_token"] = None return DomainRegistrationStatusExternalDomain(**args) @@ -820,14 +950,20 @@ def unmarshal_DomainRegistrationStatusTransfer( field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("vote_current_owner", None) if field is not None: args["vote_current_owner"] = field + else: + args["vote_current_owner"] = None field = data.get("vote_new_owner", None) if field is not None: args["vote_new_owner"] = field + else: + args["vote_new_owner"] = None return DomainRegistrationStatusTransfer(**args) @@ -843,22 +979,32 @@ def unmarshal_Tld(data: Any) -> Tld: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("dnssec_support", None) if field is not None: args["dnssec_support"] = field + else: + args["dnssec_support"] = None field = data.get("duration_in_years_min", None) if field is not None: args["duration_in_years_min"] = field + else: + args["duration_in_years_min"] = None field = data.get("duration_in_years_max", None) if field is not None: args["duration_in_years_max"] = field + else: + args["duration_in_years_max"] = None field = data.get("idn_support", None) if field is not None: args["idn_support"] = field + else: + args["idn_support"] = None field = data.get("offers", None) if field is not None: @@ -867,10 +1013,14 @@ def unmarshal_Tld(data: Any) -> Tld: if field is not None else None ) + else: + args["offers"] = None field = data.get("specifications", None) if field is not None: args["specifications"] = field + else: + args["specifications"] = None return Tld(**args) @@ -886,30 +1036,44 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("auto_renew_status", None) if field is not None: args["auto_renew_status"] = field + else: + args["auto_renew_status"] = DomainFeatureStatus.FEATURE_STATUS_UNKNOWN field = data.get("epp_code", None) if field is not None: args["epp_code"] = field + else: + args["epp_code"] = field(default_factory=list) field = data.get("registrar", None) if field is not None: args["registrar"] = field + else: + args["registrar"] = None field = data.get("is_external", None) if field is not None: args["is_external"] = field + else: + args["is_external"] = False field = data.get("dnssec", None) if field is not None: @@ -932,22 +1096,30 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainStatus.STATUS_UNKNOWN field = data.get("dns_zones", None) if field is not None: args["dns_zones"] = ( [unmarshal_DNSZone(v) for v in field] if field is not None else None ) + else: + args["dns_zones"] = field(default_factory=list) field = data.get("linked_products", None) if field is not None: args["linked_products"] = ( [LinkedProduct(v) for v in field] if field is not None else None ) + else: + args["linked_products"] = field(default_factory=list) field = data.get("pending_trade", None) if field is not None: args["pending_trade"] = field + else: + args["pending_trade"] = False field = data.get("owner_contact", None) if field is not None: @@ -1003,14 +1175,20 @@ def unmarshal_GetDNSZoneTsigKeyResponse(data: Any) -> GetDNSZoneTsigKeyResponse: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None field = data.get("algorithm", None) if field is not None: args["algorithm"] = field + else: + args["algorithm"] = None return GetDNSZoneTsigKeyResponse(**args) @@ -1026,14 +1204,20 @@ def unmarshal_RecordGeoIPConfigMatch(data: Any) -> RecordGeoIPConfigMatch: field = data.get("countries", None) if field is not None: args["countries"] = field + else: + args["countries"] = None field = data.get("continents", None) if field is not None: args["continents"] = field + else: + args["continents"] = None field = data.get("data", None) if field is not None: args["data"] = field + else: + args["data"] = None return RecordGeoIPConfigMatch(**args) @@ -1049,10 +1233,14 @@ def unmarshal_RecordViewConfigView(data: Any) -> RecordViewConfigView: field = data.get("subnet", None) if field is not None: args["subnet"] = field + else: + args["subnet"] = None field = data.get("data", None) if field is not None: args["data"] = field + else: + args["data"] = None return RecordViewConfigView(**args) @@ -1070,10 +1258,14 @@ def unmarshal_RecordWeightedConfigWeightedIP( field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("weight", None) if field is not None: args["weight"] = field + else: + args["weight"] = None return RecordWeightedConfigWeightedIP(**args) @@ -1093,10 +1285,14 @@ def unmarshal_RecordGeoIPConfig(data: Any) -> RecordGeoIPConfig: if field is not None else None ) + else: + args["matches"] = None field = data.get("default", None) if field is not None: args["default"] = field + else: + args["default"] = None return RecordGeoIPConfig(**args) @@ -1112,14 +1308,20 @@ def unmarshal_RecordHTTPServiceConfig(data: Any) -> RecordHTTPServiceConfig: field = data.get("ips", None) if field is not None: args["ips"] = field + else: + args["ips"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("strategy", None) if field is not None: args["strategy"] = field + else: + args["strategy"] = None field = data.get("must_contain", None) if field is not None: @@ -1151,6 +1353,8 @@ def unmarshal_RecordViewConfig(data: Any) -> RecordViewConfig: if field is not None else None ) + else: + args["views"] = None return RecordViewConfig(**args) @@ -1170,6 +1374,8 @@ def unmarshal_RecordWeightedConfig(data: Any) -> RecordWeightedConfig: if field is not None else None ) + else: + args["weighted_ips"] = None return RecordWeightedConfig(**args) @@ -1185,26 +1391,38 @@ def unmarshal_Record(data: Any) -> Record: field = data.get("data", None) if field is not None: args["data"] = field + else: + args["data"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("priority", None) if field is not None: args["priority"] = field + else: + args["priority"] = None field = data.get("ttl", None) if field is not None: args["ttl"] = field + else: + args["ttl"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("comment", None) if field is not None: @@ -1250,10 +1468,14 @@ def unmarshal_RecordIdentifier(data: Any) -> RecordIdentifier: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("data", None) if field is not None: @@ -1283,6 +1505,8 @@ def unmarshal_RecordChangeAdd(data: Any) -> RecordChangeAdd: args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = None return RecordChangeAdd(**args) @@ -1334,6 +1558,8 @@ def unmarshal_RecordChangeSet(data: Any) -> RecordChangeSet: args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = None field = data.get("id", None) if field is not None: @@ -1398,6 +1624,8 @@ def unmarshal_GetDNSZoneVersionDiffResponse(data: Any) -> GetDNSZoneVersionDiffR args["changes"] = ( [unmarshal_RecordChange(v) for v in field] if field is not None else None ) + else: + args["changes"] = None return GetDNSZoneVersionDiffResponse(**args) @@ -1413,6 +1641,8 @@ def unmarshal_GetDomainAuthCodeResponse(data: Any) -> GetDomainAuthCodeResponse: field = data.get("auth_code", None) if field is not None: args["auth_code"] = field + else: + args["auth_code"] = None return GetDomainAuthCodeResponse(**args) @@ -1430,6 +1660,8 @@ def unmarshal_ImportProviderDNSZoneResponse(data: Any) -> ImportProviderDNSZoneR args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = None return ImportProviderDNSZoneResponse(**args) @@ -1447,6 +1679,8 @@ def unmarshal_ImportRawDNSZoneResponse(data: Any) -> ImportRawDNSZoneResponse: args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = None return ImportRawDNSZoneResponse(**args) @@ -1462,14 +1696,20 @@ def unmarshal_ContactRolesRoles(data: Any) -> ContactRolesRoles: field = data.get("is_owner", None) if field is not None: args["is_owner"] = field + else: + args["is_owner"] = None field = data.get("is_administrative", None) if field is not None: args["is_administrative"] = field + else: + args["is_administrative"] = None field = data.get("is_technical", None) if field is not None: args["is_technical"] = field + else: + args["is_technical"] = None return ContactRolesRoles(**args) @@ -1489,6 +1729,8 @@ def unmarshal_ContactRoles(data: Any) -> ContactRoles: if field is not None else None ) + else: + args["roles"] = None field = data.get("contact", None) if field is not None: @@ -1510,12 +1752,16 @@ def unmarshal_ListContactsResponse(data: Any) -> ListContactsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("contacts", None) if field is not None: args["contacts"] = ( [unmarshal_ContactRoles(v) for v in field] if field is not None else None ) + else: + args["contacts"] = None return ListContactsResponse(**args) @@ -1531,10 +1777,14 @@ def unmarshal_Nameserver(data: Any) -> Nameserver: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None return Nameserver(**args) @@ -1554,6 +1804,8 @@ def unmarshal_ListDNSZoneNameserversResponse( args["ns"] = ( [unmarshal_Nameserver(v) for v in field] if field is not None else None ) + else: + args["ns"] = field(default_factory=list) return ListDNSZoneNameserversResponse(**args) @@ -1569,12 +1821,16 @@ def unmarshal_ListDNSZoneRecordsResponse(data: Any) -> ListDNSZoneRecordsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("records", None) if field is not None: args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = field(default_factory=list) return ListDNSZoneRecordsResponse(**args) @@ -1592,12 +1848,16 @@ def unmarshal_ListDNSZoneVersionRecordsResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("records", None) if field is not None: args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = field(default_factory=list) return ListDNSZoneVersionRecordsResponse(**args) @@ -1613,6 +1873,8 @@ def unmarshal_DNSZoneVersion(data: Any) -> DNSZoneVersion: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("created_at", None) if field is not None: @@ -1634,12 +1896,16 @@ def unmarshal_ListDNSZoneVersionsResponse(data: Any) -> ListDNSZoneVersionsRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("versions", None) if field is not None: args["versions"] = ( [unmarshal_DNSZoneVersion(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) return ListDNSZoneVersionsResponse(**args) @@ -1655,12 +1921,16 @@ def unmarshal_ListDNSZonesResponse(data: Any) -> ListDNSZonesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("dns_zones", None) if field is not None: args["dns_zones"] = ( [unmarshal_DNSZone(v) for v in field] if field is not None else None ) + else: + args["dns_zones"] = field(default_factory=list) return ListDNSZonesResponse(**args) @@ -1676,12 +1946,16 @@ def unmarshal_ListDomainHostsResponse(data: Any) -> ListDomainHostsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("hosts", None) if field is not None: args["hosts"] = ( [unmarshal_Host(v) for v in field] if field is not None else None ) + else: + args["hosts"] = None return ListDomainHostsResponse(**args) @@ -1697,30 +1971,44 @@ def unmarshal_DomainSummary(data: Any) -> DomainSummary: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("auto_renew_status", None) if field is not None: args["auto_renew_status"] = field + else: + args["auto_renew_status"] = None field = data.get("dnssec_status", None) if field is not None: args["dnssec_status"] = field + else: + args["dnssec_status"] = None field = data.get("epp_code", None) if field is not None: args["epp_code"] = field + else: + args["epp_code"] = None field = data.get("registrar", None) if field is not None: args["registrar"] = field + else: + args["registrar"] = None field = data.get("is_external", None) if field is not None: args["is_external"] = field + else: + args["is_external"] = None field = data.get("expired_at", None) if field is not None: @@ -1737,14 +2025,20 @@ def unmarshal_DomainSummary(data: Any) -> DomainSummary: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("pending_trade", None) if field is not None: args["pending_trade"] = field + else: + args["pending_trade"] = None field = data.get("external_domain_registration_status", None) if field is not None: @@ -1782,12 +2076,16 @@ def unmarshal_ListDomainsResponse(data: Any) -> ListDomainsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("domains", None) if field is not None: args["domains"] = ( [unmarshal_DomainSummary(v) for v in field] if field is not None else None ) + else: + args["domains"] = None return ListDomainsResponse(**args) @@ -1803,18 +2101,26 @@ def unmarshal_RenewableDomain(data: Any) -> RenewableDomain: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("renewable_duration_in_years", None) if field is not None: @@ -1872,12 +2178,16 @@ def unmarshal_ListRenewableDomainsResponse(data: Any) -> ListRenewableDomainsRes field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("domains", None) if field is not None: args["domains"] = ( [unmarshal_RenewableDomain(v) for v in field] if field is not None else None ) + else: + args["domains"] = None return ListRenewableDomainsResponse(**args) @@ -1893,12 +2203,16 @@ def unmarshal_ListSSLCertificatesResponse(data: Any) -> ListSSLCertificatesRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("certificates", None) if field is not None: args["certificates"] = ( [unmarshal_SSLCertificate(v) for v in field] if field is not None else None ) + else: + args["certificates"] = None return ListSSLCertificatesResponse(**args) @@ -1914,22 +2228,32 @@ def unmarshal_Task(data: Any) -> Task: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = TaskType.UNKNOWN field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TaskStatus.UNAVAILABLE field = data.get("domain", None) if field is not None: @@ -1975,12 +2299,16 @@ def unmarshal_ListTasksResponse(data: Any) -> ListTasksResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("tasks", None) if field is not None: args["tasks"] = ( [unmarshal_Task(v) for v in field] if field is not None else None ) + else: + args["tasks"] = None return ListTasksResponse(**args) @@ -1996,10 +2324,14 @@ def unmarshal_ListTldsResponse(data: Any) -> ListTldsResponse: field = data.get("tlds", None) if field is not None: args["tlds"] = [unmarshal_Tld(v) for v in field] if field is not None else None + else: + args["tlds"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListTldsResponse(**args) @@ -2015,18 +2347,26 @@ def unmarshal_OrderResponse(data: Any) -> OrderResponse: field = data.get("domains", None) if field is not None: args["domains"] = field + else: + args["domains"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("task_id", None) if field is not None: args["task_id"] = field + else: + args["task_id"] = None field = data.get("created_at", None) if field is not None: @@ -2050,6 +2390,8 @@ def unmarshal_RefreshDNSZoneResponse(data: Any) -> RefreshDNSZoneResponse: args["dns_zones"] = ( [unmarshal_DNSZone(v) for v in field] if field is not None else None ) + else: + args["dns_zones"] = field(default_factory=list) return RefreshDNSZoneResponse(**args) @@ -2067,18 +2409,26 @@ def unmarshal_RegisterExternalDomainResponse( field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("validation_token", None) if field is not None: args["validation_token"] = field + else: + args["validation_token"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("created_at", None) if field is not None: @@ -2111,10 +2461,14 @@ def unmarshal_AvailableDomain(data: Any) -> AvailableDomain: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("available", None) if field is not None: args["available"] = field + else: + args["available"] = None field = data.get("tld", None) if field is not None: @@ -2140,6 +2494,8 @@ def unmarshal_SearchAvailableDomainsResponse( args["available_domains"] = ( [unmarshal_AvailableDomain(v) for v in field] if field is not None else None ) + else: + args["available_domains"] = field(default_factory=list) return SearchAvailableDomainsResponse(**args) @@ -2159,6 +2515,8 @@ def unmarshal_UpdateDNSZoneNameserversResponse( args["ns"] = ( [unmarshal_Nameserver(v) for v in field] if field is not None else None ) + else: + args["ns"] = field(default_factory=list) return UpdateDNSZoneNameserversResponse(**args) @@ -2176,6 +2534,8 @@ def unmarshal_UpdateDNSZoneRecordsResponse(data: Any) -> UpdateDNSZoneRecordsRes args["records"] = ( [unmarshal_Record(v) for v in field] if field is not None else None ) + else: + args["records"] = field(default_factory=list) return UpdateDNSZoneRecordsResponse(**args) @@ -2211,7 +2571,9 @@ def marshal_CreateDNSZoneRequest( output["subdomain"] = request.subdomain if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -2336,10 +2698,12 @@ def marshal_ImportRawDNSZoneRequest( output["content"] = request.content if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.format is not None: - output["format"] = str(request.format) + output["format"] = request.format return output @@ -2475,7 +2839,7 @@ def marshal_ContactExtensionFR( ) if request.mode is not None: - output["mode"] = str(request.mode) + output["mode"] = request.mode return output @@ -2487,7 +2851,7 @@ def marshal_ContactExtensionNL( output: Dict[str, Any] = {} if request.legal_form is not None: - output["legal_form"] = str(request.legal_form) + output["legal_form"] = request.legal_form if request.legal_form_registration_number is not None: output["legal_form_registration_number"] = ( @@ -2519,7 +2883,7 @@ def marshal_NewContact( output: Dict[str, Any] = {} if request.legal_form is not None: - output["legal_form"] = str(request.legal_form) + output["legal_form"] = request.legal_form if request.firstname is not None: output["firstname"] = request.firstname @@ -2564,7 +2928,7 @@ def marshal_NewContact( output["company_identification_code"] = request.company_identification_code if request.lang is not None: - output["lang"] = str(request.lang) + output["lang"] = request.lang if request.resale is not None: output["resale"] = request.resale @@ -2659,7 +3023,9 @@ def marshal_RegistrarApiBuyDomainsRequest( output["duration_in_years"] = request.duration_in_years if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -2761,7 +3127,7 @@ def marshal_DSRecordDigest( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.digest is not None: output["digest"] = request.digest @@ -2798,7 +3164,7 @@ def marshal_DSRecord( output["key_id"] = request.key_id if request.algorithm is not None: - output["algorithm"] = str(request.algorithm) + output["algorithm"] = request.algorithm return output @@ -2825,7 +3191,9 @@ def marshal_RegistrarApiRegisterExternalDomainRequest( output["domain"] = request.domain if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -2952,7 +3320,9 @@ def marshal_RegistrarApiTransferInDomainRequest( ] if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -3012,7 +3382,7 @@ def marshal_RegistrarApiUpdateContactRequest( output["company_identification_code"] = request.company_identification_code if request.lang is not None: - output["lang"] = str(request.lang) + output["lang"] = request.lang if request.resale is not None: output["resale"] = request.resale @@ -3221,7 +3591,7 @@ def marshal_RecordHTTPServiceConfig( output["url"] = request.url if request.strategy is not None: - output["strategy"] = str(request.strategy) + output["strategy"] = request.strategy if request.must_contain is not None: output["must_contain"] = request.must_contain @@ -3306,7 +3676,7 @@ def marshal_Record( output["ttl"] = request.ttl if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.id is not None: output["id"] = request.id @@ -3327,7 +3697,7 @@ def marshal_RecordIdentifier( output["name"] = request.name if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.data is not None: output["data"] = request.data @@ -3470,6 +3840,8 @@ def marshal_UpdateDNSZoneRequest( output["new_dns_zone"] = request.new_dns_zone if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output diff --git a/scaleway/scaleway/domain/v2beta1/types.py b/scaleway/scaleway/domain/v2beta1/types.py index 2b10de0a1..5a7233a45 100644 --- a/scaleway/scaleway/domain/v2beta1/types.py +++ b/scaleway/scaleway/domain/v2beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -373,23 +373,19 @@ def __str__(self) -> str: @dataclass class RecordGeoIPConfigMatch: countries: List[str] - continents: List[str] - data: str @dataclass class RecordViewConfigView: subnet: str - data: str @dataclass class RecordWeightedConfigWeightedIP: ip: str - weight: int @@ -401,21 +397,16 @@ class DSRecordPublicKey: @dataclass class RecordGeoIPConfig: matches: List[RecordGeoIPConfigMatch] - default: str @dataclass class RecordHTTPServiceConfig: ips: List[str] - url: str - strategy: RecordHTTPServiceConfigStrategy - - must_contain: Optional[str] - - user_agent: Optional[str] + must_contain: Optional[str] = None + user_agent: Optional[str] = None @dataclass @@ -431,8 +422,7 @@ class RecordWeightedConfig: @dataclass class ContactExtensionFRAssociationInfo: publication_jo_page: int - - publication_jo: Optional[datetime] + publication_jo: Optional[datetime] = None @dataclass @@ -443,7 +433,6 @@ class ContactExtensionFRCodeAuthAfnicInfo: @dataclass class ContactExtensionFRDunsInfo: duns_id: str - local_id: str @@ -460,46 +449,34 @@ class ContactExtensionFRTrademarkInfo: @dataclass class DSRecordDigest: type_: DSRecordDigestType - digest: str - - public_key: Optional[DSRecordPublicKey] + public_key: Optional[DSRecordPublicKey] = None @dataclass class Record: data: str - name: str - priority: int - ttl: int - type_: RecordType - id: str + comment: Optional[str] = None + geo_ip_config: Optional[RecordGeoIPConfig] = None - comment: Optional[str] - - geo_ip_config: Optional[RecordGeoIPConfig] + http_service_config: Optional[RecordHTTPServiceConfig] = None - http_service_config: Optional[RecordHTTPServiceConfig] + weighted_config: Optional[RecordWeightedConfig] = None - weighted_config: Optional[RecordWeightedConfig] - - view_config: Optional[RecordViewConfig] + view_config: Optional[RecordViewConfig] = None @dataclass class RecordIdentifier: name: str - type_: RecordType - - data: Optional[str] - - ttl: Optional[int] + data: Optional[str] = None + ttl: Optional[int] = None @dataclass @@ -510,50 +487,43 @@ class ContactExtensionEU: @dataclass class ContactExtensionFR: mode: ContactExtensionFRMode + individual_info: Optional[ContactExtensionFRIndividualInfo] = None - individual_info: Optional[ContactExtensionFRIndividualInfo] - - duns_info: Optional[ContactExtensionFRDunsInfo] + duns_info: Optional[ContactExtensionFRDunsInfo] = None - association_info: Optional[ContactExtensionFRAssociationInfo] + association_info: Optional[ContactExtensionFRAssociationInfo] = None - trademark_info: Optional[ContactExtensionFRTrademarkInfo] + trademark_info: Optional[ContactExtensionFRTrademarkInfo] = None - code_auth_afnic_info: Optional[ContactExtensionFRCodeAuthAfnicInfo] + code_auth_afnic_info: Optional[ContactExtensionFRCodeAuthAfnicInfo] = None @dataclass class ContactExtensionNL: legal_form: ContactExtensionNLLegalForm - legal_form_registration_number: str @dataclass class ContactQuestion: question: str - answer: str @dataclass class TldOffer: action: str - operation_path: str - - price: Optional[Money] + price: Optional[Money] = None @dataclass class DSRecord: key_id: int - algorithm: DSRecordAlgorithm + digest: Optional[DSRecordDigest] = None - digest: Optional[DSRecordDigest] - - public_key: Optional[DSRecordPublicKey] + public_key: Optional[DSRecordPublicKey] = None @dataclass @@ -568,90 +538,60 @@ class RecordChangeClear: @dataclass class RecordChangeDelete: - id: Optional[str] + id: Optional[str] = None - id_fields: Optional[RecordIdentifier] + id_fields: Optional[RecordIdentifier] = None @dataclass class RecordChangeSet: records: List[Record] + id: Optional[str] = None - id: Optional[str] - - id_fields: Optional[RecordIdentifier] + id_fields: Optional[RecordIdentifier] = None @dataclass class ImportRawDNSZoneRequestTsigKey: name: str - key: str - algorithm: str @dataclass class Contact: id: str - legal_form: ContactLegalForm - firstname: str - lastname: str - company_name: str - email: str - email_alt: str - phone_number: str - fax_number: str - address_line_1: str - address_line_2: str - zip: str - city: str - country: str - vat_identification_code: str - company_identification_code: str - lang: StdLanguageCode - resale: bool - whois_opt_in: bool - - questions: Optional[List[ContactQuestion]] - - extension_fr: Optional[ContactExtensionFR] - - extension_eu: Optional[ContactExtensionEU] - email_status: ContactEmailStatus - state: str - status: ContactStatus - - extension_nl: Optional[ContactExtensionNL] + questions: Optional[List[ContactQuestion]] = None + extension_fr: Optional[ContactExtensionFR] = None + extension_eu: Optional[ContactExtensionEU] = None + extension_nl: Optional[ContactExtensionNL] = None @dataclass class ContactRolesRoles: is_owner: bool - is_administrative: bool - is_technical: bool @@ -663,124 +603,83 @@ class DomainRegistrationStatusExternalDomain: @dataclass class DomainRegistrationStatusTransfer: status: DomainRegistrationStatusTransferStatus - vote_current_owner: bool - vote_new_owner: bool @dataclass class Tld: name: str - dnssec_support: bool - duration_in_years_min: int - duration_in_years_max: int - idn_support: bool - offers: Dict[str, TldOffer] - specifications: Dict[str, str] @dataclass class NewContact: legal_form: ContactLegalForm - firstname: str - lastname: str - email: str - - company_name: Optional[str] - - email_alt: Optional[str] - phone_number: str - address_line_1: str - zip: str - city: str - country: str - - fax_number: Optional[str] - - address_line_2: Optional[str] - - vat_identification_code: Optional[str] - - company_identification_code: Optional[str] - lang: StdLanguageCode - resale: bool - whois_opt_in: bool - - questions: Optional[List[ContactQuestion]] - - extension_fr: Optional[ContactExtensionFR] - - extension_eu: Optional[ContactExtensionEU] - - state: Optional[str] - - extension_nl: Optional[ContactExtensionNL] + company_name: Optional[str] = None + email_alt: Optional[str] = None + fax_number: Optional[str] = None + address_line_2: Optional[str] = None + vat_identification_code: Optional[str] = None + company_identification_code: Optional[str] = None + questions: Optional[List[ContactQuestion]] = None + extension_fr: Optional[ContactExtensionFR] = None + extension_eu: Optional[ContactExtensionEU] = None + state: Optional[str] = None + extension_nl: Optional[ContactExtensionNL] = None @dataclass class CheckContactsCompatibilityResponseContactCheckResult: compatible: bool - - error_message: Optional[str] + error_message: Optional[str] = None @dataclass class DNSZone: domain: str - subdomain: str - ns: List[str] - ns_default: List[str] - ns_master: List[str] - status: DNSZoneStatus - project_id: str - linked_products: List[LinkedProduct] - - message: Optional[str] - - updated_at: Optional[datetime] + message: Optional[str] = None + updated_at: Optional[datetime] = None @dataclass class DomainDNSSEC: status: DomainFeatureStatus - ds_records: List[DSRecord] @dataclass class RecordChange: - add: Optional[RecordChangeAdd] + add: Optional[RecordChangeAdd] = None - set_: Optional[RecordChangeSet] + set_: Optional[RecordChangeSet] = None - delete: Optional[RecordChangeDelete] + delete: Optional[RecordChangeDelete] = None - clear: Optional[RecordChangeClear] + clear: Optional[RecordChangeClear] = None @dataclass @@ -791,8 +690,7 @@ class ImportProviderDNSZoneRequestOnlineV1: @dataclass class ImportRawDNSZoneRequestAXFRSource: name_server: str - - tsig_key: Optional[ImportRawDNSZoneRequestTsigKey] + tsig_key: Optional[ImportRawDNSZoneRequestTsigKey] = None @dataclass @@ -803,108 +701,74 @@ class ImportRawDNSZoneRequestBindSource: @dataclass class ContactRoles: roles: Dict[str, ContactRolesRoles] - - contact: Optional[Contact] + contact: Optional[Contact] = None @dataclass class Nameserver: name: str - ip: List[str] @dataclass class DNSZoneVersion: id: str - - created_at: Optional[datetime] + created_at: Optional[datetime] = None @dataclass class Host: domain: str - name: str - ips: List[str] - status: HostStatus @dataclass class DomainSummary: domain: str - project_id: str - auto_renew_status: DomainFeatureStatus - dnssec_status: DomainFeatureStatus - epp_code: List[str] - registrar: str - is_external: bool - - expired_at: Optional[datetime] - - updated_at: Optional[datetime] - status: DomainStatus - organization_id: str - pending_trade: bool - - created_at: Optional[datetime] - + expired_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + created_at: Optional[datetime] = None external_domain_registration_status: Optional[ DomainRegistrationStatusExternalDomain - ] + ] = None - transfer_registration_status: Optional[DomainRegistrationStatusTransfer] + transfer_registration_status: Optional[DomainRegistrationStatusTransfer] = None @dataclass class RenewableDomain: domain: str - project_id: str - organization_id: str - status: RenewableDomainStatus - - renewable_duration_in_years: Optional[int] - - expired_at: Optional[datetime] - - limit_renew_at: Optional[datetime] - - limit_redemption_at: Optional[datetime] - - estimated_delete_at: Optional[datetime] - - tld: Optional[Tld] + renewable_duration_in_years: Optional[int] = None + expired_at: Optional[datetime] = None + limit_renew_at: Optional[datetime] = None + limit_redemption_at: Optional[datetime] = None + estimated_delete_at: Optional[datetime] = None + tld: Optional[Tld] = None @dataclass class SSLCertificate: dns_zone: str - alternative_dns_zones: List[str] - status: SSLCertificateStatus - private_key: str - certificate_chain: str - - created_at: Optional[datetime] - - expired_at: Optional[datetime] + created_at: Optional[datetime] = None + expired_at: Optional[datetime] = None @dataclass @@ -934,27 +798,27 @@ class Task: The status of the task. """ - domain: Optional[str] + domain: Optional[str] = None """ The domain name associated to the task. """ - started_at: Optional[datetime] + started_at: Optional[datetime] = None """ Start date of the task. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update of the task. """ - message: Optional[str] + message: Optional[str] = None """ Error message associated to the task. """ - contact_identifier: Optional[str] + contact_identifier: Optional[str] = None """ Human-friendly contact identifier used when the task concerns a contact. """ @@ -963,39 +827,34 @@ class Task: @dataclass class TransferInDomainRequestTransferRequest: domain: str - auth_code: str @dataclass class UpdateContactRequestQuestion: - question: Optional[str] - - answer: Optional[str] + question: Optional[str] = None + answer: Optional[str] = None @dataclass class AvailableDomain: domain: str - available: bool - - tld: Optional[Tld] + tld: Optional[Tld] = None @dataclass class CheckContactsCompatibilityResponse: compatible: bool - - owner_check_result: Optional[CheckContactsCompatibilityResponseContactCheckResult] - + owner_check_result: Optional[ + CheckContactsCompatibilityResponseContactCheckResult + ] = None administrative_check_result: Optional[ CheckContactsCompatibilityResponseContactCheckResult - ] - + ] = None technical_check_result: Optional[ CheckContactsCompatibilityResponseContactCheckResult - ] + ] = None @dataclass @@ -1028,7 +887,7 @@ class CloneDNSZoneRequest: Specifies whether or not the destination DNS zone will be overwritten. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the destination DNS zone. """ @@ -1046,7 +905,7 @@ class CreateDNSZoneRequest: Subdomain of the DNS zone to create. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID in which to create the DNS zone. """ @@ -1055,8 +914,7 @@ class CreateDNSZoneRequest: @dataclass class CreateSSLCertificateRequest: dns_zone: str - - alternative_dns_zones: Optional[List[str]] + alternative_dns_zones: Optional[List[str]] = field(default_factory=list) @dataclass @@ -1066,7 +924,7 @@ class DeleteDNSZoneRequest: DNS zone to delete. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the DNS zone to delete. """ @@ -1100,11 +958,8 @@ class DeleteSSLCertificateResponse: @dataclass class Domain: domain: str - organization_id: str - project_id: str - auto_renew_status: DomainFeatureStatus """ Status of the automatic renewal of the domain. @@ -1115,23 +970,7 @@ class Domain: List of the domain's EPP codes. """ - dnssec: Optional[DomainDNSSEC] - """ - Status of the DNSSEC configuration of the domain. - """ - - expired_at: Optional[datetime] - """ - Date of expiration of the domain. - """ - - updated_at: Optional[datetime] - """ - Domain's last modification date. - """ - registrar: str - is_external: bool """ Indicates whether Scaleway is the domain's registrar. @@ -1157,31 +996,46 @@ class Domain: Indicates if a trade is ongoing. """ - owner_contact: Optional[Contact] + dnssec: Optional[DomainDNSSEC] = None + """ + Status of the DNSSEC configuration of the domain. + """ + + expired_at: Optional[datetime] = None + """ + Date of expiration of the domain. + """ + + updated_at: Optional[datetime] = None + """ + Domain's last modification date. + """ + + owner_contact: Optional[Contact] = None """ Contact information of the domain's owner. """ - technical_contact: Optional[Contact] + technical_contact: Optional[Contact] = None """ Contact information of the domain's technical contact. """ - administrative_contact: Optional[Contact] + administrative_contact: Optional[Contact] = None """ Contact information of the domain's administrative contact. """ - tld: Optional[Tld] + tld: Optional[Tld] = None """ Domain's TLD information. """ external_domain_registration_status: Optional[ DomainRegistrationStatusExternalDomain - ] + ] = None - transfer_registration_status: Optional[DomainRegistrationStatusTransfer] + transfer_registration_status: Optional[DomainRegistrationStatusTransfer] = None @dataclass @@ -1191,7 +1045,7 @@ class ExportRawDNSZoneRequest: DNS zone to export. """ - format: Optional[RawFormat] + format: Optional[RawFormat] = RawFormat.UNKNOWN_RAW_FORMAT """ DNS zone format. """ @@ -1205,9 +1059,7 @@ class GetDNSZoneTsigKeyRequest: @dataclass class GetDNSZoneTsigKeyResponse: name: str - key: str - algorithm: str @@ -1234,8 +1086,7 @@ class GetSSLCertificateRequest: @dataclass class ImportProviderDNSZoneRequest: dns_zone: str - - online_v1: Optional[ImportProviderDNSZoneRequestOnlineV1] + online_v1: Optional[ImportProviderDNSZoneRequestOnlineV1] = None @dataclass @@ -1250,15 +1101,12 @@ class ImportRawDNSZoneRequest: DNS zone to import. """ - content: Optional[str] - - project_id: Optional[str] - - format: Optional[RawFormat] - - bind_source: Optional[ImportRawDNSZoneRequestBindSource] + content: Optional[str] = None + project_id: Optional[str] = None + format: Optional[RawFormat] = RawFormat.UNKNOWN_RAW_FORMAT + bind_source: Optional[ImportRawDNSZoneRequestBindSource] = None - axfr_source: Optional[ImportRawDNSZoneRequestAXFRSource] + axfr_source: Optional[ImportRawDNSZoneRequestAXFRSource] = None @dataclass @@ -1269,20 +1117,19 @@ class ImportRawDNSZoneResponse: @dataclass class ListContactsResponse: total_count: int - contacts: List[ContactRoles] @dataclass class ListDNSZoneNameserversRequest: - project_id: Optional[str] + dns_zone: str """ - Project ID on which to filter the returned DNS zone name servers. + DNS zone on which to filter the returned DNS zone name servers. """ - dns_zone: str + project_id: Optional[str] = None """ - DNS zone on which to filter the returned DNS zone name servers. + Project ID on which to filter the returned DNS zone name servers. """ @@ -1296,42 +1143,44 @@ class ListDNSZoneNameserversResponse: @dataclass class ListDNSZoneRecordsRequest: - project_id: Optional[str] + dns_zone: str """ - Project ID on which to filter the returned DNS zone records. + DNS zone on which to filter the returned DNS zone records. """ - order_by: Optional[ListDNSZoneRecordsRequestOrderBy] + name: str """ - Sort order of the returned DNS zone records. + Name on which to filter the returned DNS zone records. """ - page: Optional[int] + project_id: Optional[str] = None """ - Page number to return, from the paginated results. + Project ID on which to filter the returned DNS zone records. """ - page_size: Optional[int] + order_by: Optional[ListDNSZoneRecordsRequestOrderBy] = ( + ListDNSZoneRecordsRequestOrderBy.NAME_ASC + ) """ - Maximum number of DNS zone records per page. + Sort order of the returned DNS zone records. """ - dns_zone: str + page: Optional[int] = 0 """ - DNS zone on which to filter the returned DNS zone records. + Page number to return, from the paginated results. """ - name: str + page_size: Optional[int] = 0 """ - Name on which to filter the returned DNS zone records. + Maximum number of DNS zone records per page. """ - type_: Optional[RecordType] + type_: Optional[RecordType] = RecordType.UNKNOWN """ Record type on which to filter the returned DNS zone records. """ - id: Optional[str] + id: Optional[str] = None """ Record ID on which to filter the returned DNS zone records. """ @@ -1352,18 +1201,17 @@ class ListDNSZoneRecordsResponse: @dataclass class ListDNSZoneVersionRecordsRequest: - page: Optional[int] + dns_zone_version_id: str + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of DNS zones versions records per page. """ - dns_zone_version_id: str - @dataclass class ListDNSZoneVersionRecordsResponse: @@ -1377,18 +1225,17 @@ class ListDNSZoneVersionRecordsResponse: @dataclass class ListDNSZoneVersionsRequest: - page: Optional[int] + dns_zone: str + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of DNS zones versions per page. """ - dns_zone: str - @dataclass class ListDNSZoneVersionsResponse: @@ -1407,57 +1254,59 @@ class ListDNSZonesRequest: Domain on which to filter the returned DNS zones. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID on which to filter the returned DNS zones. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID on which to filter the returned DNS zones. """ - order_by: Optional[ListDNSZonesRequestOrderBy] + order_by: Optional[ListDNSZonesRequestOrderBy] = ( + ListDNSZonesRequestOrderBy.DOMAIN_ASC + ) """ Sort order of the returned DNS zones. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of DNS zones to return per page. """ - dns_zone: Optional[str] + dns_zone: Optional[str] = None """ DNS zone on which to filter the returned DNS zones. """ - dns_zones: Optional[List[str]] + dns_zones: Optional[List[str]] = field(default_factory=list) """ DNS zones on which to filter the returned DNS zones. """ - created_after: Optional[datetime] + created_after: Optional[datetime] = None """ Only list DNS zones created after this date. """ - created_before: Optional[datetime] + created_before: Optional[datetime] = None """ Only list DNS zones created before this date. """ - updated_after: Optional[datetime] + updated_after: Optional[datetime] = None """ Only list DNS zones updated after this date. """ - updated_before: Optional[datetime] + updated_before: Optional[datetime] = None """ Only list DNS zones updated before this date. """ @@ -1479,46 +1328,38 @@ class ListDNSZonesResponse: @dataclass class ListDomainHostsResponse: total_count: int - hosts: List[Host] @dataclass class ListDomainsResponse: total_count: int - domains: List[DomainSummary] @dataclass class ListRenewableDomainsResponse: total_count: int - domains: List[RenewableDomain] @dataclass class ListSSLCertificatesRequest: dns_zone: str - - page: Optional[int] - - page_size: Optional[int] - - project_id: Optional[str] + page: Optional[int] = 0 + page_size: Optional[int] = 0 + project_id: Optional[str] = None @dataclass class ListSSLCertificatesResponse: total_count: int - certificates: List[SSLCertificate] @dataclass class ListTasksResponse: total_count: int - tasks: List[Task] @@ -1538,14 +1379,10 @@ class ListTldsResponse: @dataclass class OrderResponse: domains: List[str] - organization_id: str - project_id: str - task_id: str - - created_at: Optional[datetime] + created_at: Optional[datetime] = None @dataclass @@ -1577,69 +1414,57 @@ class RefreshDNSZoneResponse: @dataclass class RegisterExternalDomainResponse: domain: str - organization_id: str - validation_token: str - project_id: str - - created_at: Optional[datetime] + created_at: Optional[datetime] = None @dataclass class RegistrarApiBuyDomainsRequest: domains: List[str] - duration_in_years: int + project_id: Optional[str] = None + owner_contact_id: Optional[str] = None - project_id: Optional[str] - - owner_contact_id: Optional[str] + owner_contact: Optional[NewContact] = None - owner_contact: Optional[NewContact] + administrative_contact_id: Optional[str] = None - administrative_contact_id: Optional[str] + administrative_contact: Optional[NewContact] = None - administrative_contact: Optional[NewContact] + technical_contact_id: Optional[str] = None - technical_contact_id: Optional[str] - - technical_contact: Optional[NewContact] + technical_contact: Optional[NewContact] = None @dataclass class RegistrarApiCheckContactsCompatibilityRequest: - domains: Optional[List[str]] - - tlds: Optional[List[str]] - - owner_contact_id: Optional[str] + domains: Optional[List[str]] = None + tlds: Optional[List[str]] = None + owner_contact_id: Optional[str] = None - owner_contact: Optional[NewContact] + owner_contact: Optional[NewContact] = None - administrative_contact_id: Optional[str] + administrative_contact_id: Optional[str] = None - administrative_contact: Optional[NewContact] + administrative_contact: Optional[NewContact] = None - technical_contact_id: Optional[str] + technical_contact_id: Optional[str] = None - technical_contact: Optional[NewContact] + technical_contact: Optional[NewContact] = None @dataclass class RegistrarApiCreateDomainHostRequest: domain: str - name: str - - ips: Optional[List[str]] + ips: Optional[List[str]] = None @dataclass class RegistrarApiDeleteDomainHostRequest: domain: str - name: str @@ -1666,8 +1491,7 @@ class RegistrarApiEnableDomainAutoRenewRequest: @dataclass class RegistrarApiEnableDomainDNSSECRequest: domain: str - - ds_record: Optional[DSRecord] + ds_record: Optional[DSRecord] = None @dataclass @@ -1687,101 +1511,74 @@ class RegistrarApiGetDomainRequest: @dataclass class RegistrarApiListContactsRequest: - page: Optional[int] - - page_size: Optional[int] - - domain: Optional[str] - - project_id: Optional[str] - - organization_id: Optional[str] - - role: Optional[ListContactsRequestRole] - - email_status: Optional[ContactEmailStatus] + page: Optional[int] = None + page_size: Optional[int] = None + domain: Optional[str] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None + role: Optional[ListContactsRequestRole] = None + email_status: Optional[ContactEmailStatus] = None @dataclass class RegistrarApiListDomainHostsRequest: - page: Optional[int] - - page_size: Optional[int] - domain: str + page: Optional[int] = None + page_size: Optional[int] = None @dataclass class RegistrarApiListDomainsRequest: - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListDomainsRequestOrderBy] - - registrar: Optional[str] - - status: Optional[DomainStatus] - - project_id: Optional[str] - - organization_id: Optional[str] - - is_external: Optional[bool] - - domain: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListDomainsRequestOrderBy] = None + registrar: Optional[str] = None + status: Optional[DomainStatus] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None + is_external: Optional[bool] = None + domain: Optional[str] = None @dataclass class RegistrarApiListRenewableDomainsRequest: - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListRenewableDomainsRequestOrderBy] - - project_id: Optional[str] - - organization_id: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListRenewableDomainsRequestOrderBy] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None @dataclass class RegistrarApiListTasksRequest: - page: Optional[int] - - page_size: Optional[int] - - project_id: Optional[str] - - organization_id: Optional[str] - - domain: Optional[str] - - types: Optional[List[TaskType]] - - statuses: Optional[List[TaskStatus]] - - order_by: Optional[ListTasksRequestOrderBy] + page: Optional[int] = None + page_size: Optional[int] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None + domain: Optional[str] = None + types: Optional[List[TaskType]] = None + statuses: Optional[List[TaskStatus]] = None + order_by: Optional[ListTasksRequestOrderBy] = None @dataclass class RegistrarApiListTldsRequest: - tlds: Optional[List[str]] + tlds: Optional[List[str]] = field(default_factory=list) """ Array of TLDs to return. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned Projects. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Project per page. """ - order_by: Optional[ListTldsRequestOrderBy] + order_by: Optional[ListTldsRequestOrderBy] = ListTldsRequestOrderBy.NAME_ASC """ Sort order of the returned TLDs. """ @@ -1795,17 +1592,14 @@ class RegistrarApiLockDomainTransferRequest: @dataclass class RegistrarApiRegisterExternalDomainRequest: domain: str - - project_id: Optional[str] + project_id: Optional[str] = None @dataclass class RegistrarApiRenewDomainsRequest: domains: List[str] - duration_in_years: int - - force_late_renewal: Optional[bool] + force_late_renewal: Optional[bool] = False @dataclass @@ -1820,7 +1614,7 @@ class RegistrarApiSearchAvailableDomainsRequest: Search exact match. """ - tlds: Optional[List[str]] + tlds: Optional[List[str]] = field(default_factory=list) """ Array of tlds to search on. """ @@ -1829,31 +1623,27 @@ class RegistrarApiSearchAvailableDomainsRequest: @dataclass class RegistrarApiTradeDomainRequest: domain: str + project_id: Optional[str] = None + new_owner_contact_id: Optional[str] = None - project_id: Optional[str] - - new_owner_contact_id: Optional[str] - - new_owner_contact: Optional[NewContact] + new_owner_contact: Optional[NewContact] = None @dataclass class RegistrarApiTransferInDomainRequest: domains: List[TransferInDomainRequestTransferRequest] + project_id: Optional[str] = None + owner_contact_id: Optional[str] = None - project_id: Optional[str] - - owner_contact_id: Optional[str] - - owner_contact: Optional[NewContact] + owner_contact: Optional[NewContact] = None - administrative_contact_id: Optional[str] + administrative_contact_id: Optional[str] = None - administrative_contact: Optional[NewContact] + administrative_contact: Optional[NewContact] = None - technical_contact_id: Optional[str] + technical_contact_id: Optional[str] = None - technical_contact: Optional[NewContact] + technical_contact: Optional[NewContact] = None @dataclass @@ -1864,70 +1654,48 @@ class RegistrarApiUnlockDomainTransferRequest: @dataclass class RegistrarApiUpdateContactRequest: contact_id: str - - email: Optional[str] - - email_alt: Optional[str] - - phone_number: Optional[str] - - fax_number: Optional[str] - - address_line_1: Optional[str] - - address_line_2: Optional[str] - - zip: Optional[str] - - city: Optional[str] - - country: Optional[str] - - vat_identification_code: Optional[str] - - company_identification_code: Optional[str] - - lang: Optional[StdLanguageCode] - - resale: Optional[bool] - - questions: Optional[List[UpdateContactRequestQuestion]] - - extension_fr: Optional[ContactExtensionFR] - - extension_eu: Optional[ContactExtensionEU] - - whois_opt_in: Optional[bool] - - state: Optional[str] - - extension_nl: Optional[ContactExtensionNL] + email: Optional[str] = None + email_alt: Optional[str] = None + phone_number: Optional[str] = None + fax_number: Optional[str] = None + address_line_1: Optional[str] = None + address_line_2: Optional[str] = None + zip: Optional[str] = None + city: Optional[str] = None + country: Optional[str] = None + vat_identification_code: Optional[str] = None + company_identification_code: Optional[str] = None + lang: Optional[StdLanguageCode] = None + resale: Optional[bool] = None + questions: Optional[List[UpdateContactRequestQuestion]] = None + extension_fr: Optional[ContactExtensionFR] = None + extension_eu: Optional[ContactExtensionEU] = None + whois_opt_in: Optional[bool] = None + state: Optional[str] = None + extension_nl: Optional[ContactExtensionNL] = None @dataclass class RegistrarApiUpdateDomainHostRequest: domain: str - name: str - - ips: Optional[List[str]] + ips: Optional[List[str]] = None @dataclass class RegistrarApiUpdateDomainRequest: domain: str + technical_contact_id: Optional[str] = None - technical_contact_id: Optional[str] - - technical_contact: Optional[NewContact] + technical_contact: Optional[NewContact] = None - owner_contact_id: Optional[str] + owner_contact_id: Optional[str] = None - owner_contact: Optional[NewContact] + owner_contact: Optional[NewContact] = None - administrative_contact_id: Optional[str] + administrative_contact_id: Optional[str] = None - administrative_contact: Optional[NewContact] + administrative_contact: Optional[NewContact] = None @dataclass @@ -1986,12 +1754,12 @@ class UpdateDNSZoneRecordsRequest: Disable the creation of the target zone if it does not exist. Target zone creation is disabled by default. """ - return_all_records: Optional[bool] + return_all_records: Optional[bool] = False """ Specifies whether or not to return all the records. """ - serial: Optional[int] + serial: Optional[int] = 0 """ Use the provided serial (0) instead of the auto-increment serial. """ @@ -2012,12 +1780,12 @@ class UpdateDNSZoneRequest: DNS zone to update. """ - new_dns_zone: Optional[str] + new_dns_zone: Optional[str] = None """ Name of the new DNS zone to create. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID in which to create the new DNS zone. """ diff --git a/scaleway/scaleway/edge_services/v1beta1/marshalling.py b/scaleway/scaleway/edge_services/v1beta1/marshalling.py index d70c3e757..813894394 100644 --- a/scaleway/scaleway/edge_services/v1beta1/marshalling.py +++ b/scaleway/scaleway/edge_services/v1beta1/marshalling.py @@ -13,7 +13,13 @@ resolve_one_of, ) from .types import ( + DNSStageType, + PipelineStatus, + PlanName, + PurgeRequestStatus, RuleHttpMatchMethodFilter, + RuleHttpMatchPathFilterPathFilterType, + WafStageMode, ScalewayLb, ScalewayLbBackendConfig, ScalewayS3BackendConfig, @@ -97,20 +103,26 @@ def unmarshal_ScalewayLb(data: Any) -> ScalewayLb: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("frontend_id", None) if field is not None: args["frontend_id"] = field + else: + args["frontend_id"] = None field = data.get("is_ssl", None) if field is not None: args["is_ssl"] = field else: - args["is_ssl"] = None + args["is_ssl"] = False field = data.get("domain_name", None) if field is not None: @@ -134,6 +146,8 @@ def unmarshal_ScalewayLbBackendConfig(data: Any) -> ScalewayLbBackendConfig: args["lbs"] = ( [unmarshal_ScalewayLb(v) for v in field] if field is not None else None ) + else: + args["lbs"] = field(default_factory=list) return ScalewayLbBackendConfig(**args) @@ -162,7 +176,7 @@ def unmarshal_ScalewayS3BackendConfig(data: Any) -> ScalewayS3BackendConfig: if field is not None: args["is_website"] = field else: - args["is_website"] = None + args["is_website"] = False return ScalewayS3BackendConfig(**args) @@ -178,10 +192,14 @@ def unmarshal_BackendStage(data: Any) -> BackendStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("created_at", None) if field is not None: @@ -221,14 +239,20 @@ def unmarshal_CacheStage(data: Any) -> CacheStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("include_cookies", None) if field is not None: args["include_cookies"] = field + else: + args["include_cookies"] = False field = data.get("fallback_ttl", None) if field is not None: @@ -280,18 +304,26 @@ def unmarshal_DNSStage(data: Any) -> DNSStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("fqdns", None) if field is not None: args["fqdns"] = field + else: + args["fqdns"] = field(default_factory=list) field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = DNSStageType.UNKNOWN_TYPE field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("created_at", None) if field is not None: @@ -337,22 +369,32 @@ def unmarshal_PipelineError(data: Any) -> PipelineError: field = data.get("stage", None) if field is not None: args["stage"] = field + else: + args["stage"] = None field = data.get("code", None) if field is not None: args["code"] = field + else: + args["code"] = None field = data.get("severity", None) if field is not None: args["severity"] = field + else: + args["severity"] = None field = data.get("message", None) if field is not None: args["message"] = field + else: + args["message"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return PipelineError(**args) @@ -368,32 +410,46 @@ def unmarshal_Pipeline(data: Any) -> Pipeline: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = PipelineStatus.UNKNOWN_STATUS field = data.get("errors", None) if field is not None: args["errors"] = ( [unmarshal_PipelineError(v) for v in field] if field is not None else None ) + else: + args["errors"] = field(default_factory=list) field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("created_at", None) if field is not None: @@ -421,10 +477,14 @@ def unmarshal_RouteStage(data: Any) -> RouteStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("waf_stage_id", None) if field is not None: @@ -458,10 +518,14 @@ def unmarshal_TLSSecret(data: Any) -> TLSSecret: field = data.get("secret_id", None) if field is not None: args["secret_id"] = field + else: + args["secret_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None return TLSSecret(**args) @@ -477,20 +541,28 @@ def unmarshal_TLSStage(data: Any) -> TLSStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("secrets", None) if field is not None: args["secrets"] = ( [unmarshal_TLSSecret(v) for v in field] if field is not None else None ) + else: + args["secrets"] = field(default_factory=list) field = data.get("managed_certificate", None) if field is not None: args["managed_certificate"] = field + else: + args["managed_certificate"] = False field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("certificate_expires_at", None) if field is not None: @@ -550,18 +622,26 @@ def unmarshal_WafStage(data: Any) -> WafStage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("mode", None) if field is not None: args["mode"] = field + else: + args["mode"] = WafStageMode.UNKNOWN_MODE field = data.get("paranoia_level", None) if field is not None: args["paranoia_level"] = field + else: + args["paranoia_level"] = 0 field = data.get("created_at", None) if field is not None: @@ -597,36 +677,48 @@ def unmarshal_PipelineStages(data: Any) -> PipelineStages: args["dns_stages"] = ( [unmarshal_DNSStage(v) for v in field] if field is not None else None ) + else: + args["dns_stages"] = None field = data.get("tls_stages", None) if field is not None: args["tls_stages"] = ( [unmarshal_TLSStage(v) for v in field] if field is not None else None ) + else: + args["tls_stages"] = None field = data.get("cache_stages", None) if field is not None: args["cache_stages"] = ( [unmarshal_CacheStage(v) for v in field] if field is not None else None ) + else: + args["cache_stages"] = None field = data.get("backend_stages", None) if field is not None: args["backend_stages"] = ( [unmarshal_BackendStage(v) for v in field] if field is not None else None ) + else: + args["backend_stages"] = None field = data.get("waf_stages", None) if field is not None: args["waf_stages"] = ( [unmarshal_WafStage(v) for v in field] if field is not None else None ) + else: + args["waf_stages"] = None field = data.get("route_stages", None) if field is not None: args["route_stages"] = ( [unmarshal_RouteStage(v) for v in field] if field is not None else None ) + else: + args["route_stages"] = None field = data.get("pipeline", None) if field is not None: @@ -648,26 +740,32 @@ def unmarshal_PurgeRequest(data: Any) -> PurgeRequest: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pipeline_id", None) if field is not None: args["pipeline_id"] = field + else: + args["pipeline_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = PurgeRequestStatus.UNKNOWN_STATUS field = data.get("assets", None) if field is not None: args["assets"] = field else: - args["assets"] = None + args["assets"] = field(default_factory=list) field = data.get("all", None) if field is not None: args["all"] = field else: - args["all"] = None + args["all"] = False field = data.get("created_at", None) if field is not None: @@ -695,10 +793,16 @@ def unmarshal_RuleHttpMatchPathFilter(data: Any) -> RuleHttpMatchPathFilter: field = data.get("path_filter_type", None) if field is not None: args["path_filter_type"] = field + else: + args["path_filter_type"] = ( + RuleHttpMatchPathFilterPathFilterType.UNKNOWN_PATH_FILTER + ) field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None return RuleHttpMatchPathFilter(**args) @@ -716,6 +820,8 @@ def unmarshal_RuleHttpMatch(data: Any) -> RuleHttpMatch: args["method_filters"] = ( [RuleHttpMatchMethodFilter(v) for v in field] if field is not None else None ) + else: + args["method_filters"] = field(default_factory=list) field = data.get("path_filter", None) if field is not None: @@ -737,10 +843,14 @@ def unmarshal_RouteRule(data: Any) -> RouteRule: field = data.get("position", None) if field is not None: args["position"] = field + else: + args["position"] = 0 field = data.get("route_stage_id", None) if field is not None: args["route_stage_id"] = field + else: + args["route_stage_id"] = None field = data.get("rule_http_match", None) if field is not None: @@ -770,6 +880,8 @@ def unmarshal_AddRouteRulesResponse(data: Any) -> AddRouteRulesResponse: args["route_rules"] = ( [unmarshal_RouteRule(v) for v in field] if field is not None else None ) + else: + args["route_rules"] = field(default_factory=list) return AddRouteRulesResponse(**args) @@ -785,6 +897,8 @@ def unmarshal_CheckDomainResponse(data: Any) -> CheckDomainResponse: field = data.get("is_valid", None) if field is not None: args["is_valid"] = field + else: + args["is_valid"] = None return CheckDomainResponse(**args) @@ -800,10 +914,14 @@ def unmarshal_CheckLbOriginResponse(data: Any) -> CheckLbOriginResponse: field = data.get("is_valid", None) if field is not None: args["is_valid"] = field + else: + args["is_valid"] = None field = data.get("error_type", None) if field is not None: args["error_type"] = field + else: + args["error_type"] = None return CheckLbOriginResponse(**args) @@ -819,6 +937,8 @@ def unmarshal_CheckPEMChainResponse(data: Any) -> CheckPEMChainResponse: field = data.get("is_valid", None) if field is not None: args["is_valid"] = field + else: + args["is_valid"] = None return CheckPEMChainResponse(**args) @@ -834,18 +954,26 @@ def unmarshal_PlanDetails(data: Any) -> PlanDetails: field = data.get("plan_name", None) if field is not None: args["plan_name"] = field + else: + args["plan_name"] = PlanName.UNKNOWN_NAME field = data.get("package_gb", None) if field is not None: args["package_gb"] = field + else: + args["package_gb"] = 0 field = data.get("pipeline_limit", None) if field is not None: args["pipeline_limit"] = field + else: + args["pipeline_limit"] = 0 field = data.get("waf_requests", None) if field is not None: args["waf_requests"] = field + else: + args["waf_requests"] = 0 return PlanDetails(**args) @@ -884,22 +1012,32 @@ def unmarshal_GetBillingResponse(data: Any) -> GetBillingResponse: field = data.get("pipeline_number", None) if field is not None: args["pipeline_number"] = field + else: + args["pipeline_number"] = 0 field = data.get("current_plan_cache_usage", None) if field is not None: args["current_plan_cache_usage"] = field + else: + args["current_plan_cache_usage"] = 0 field = data.get("extra_cache_usage", None) if field is not None: args["extra_cache_usage"] = field + else: + args["extra_cache_usage"] = 0 field = data.get("current_plan_waf_usage", None) if field is not None: args["current_plan_waf_usage"] = field + else: + args["current_plan_waf_usage"] = 0 field = data.get("extra_waf_usage", None) if field is not None: args["extra_waf_usage"] = field + else: + args["extra_waf_usage"] = 0 field = data.get("plan_cost", None) if field is not None: @@ -920,6 +1058,8 @@ def unmarshal_GetBillingResponse(data: Any) -> GetBillingResponse: if field is not None else None ) + else: + args["plans_usage_details"] = field(default_factory=dict) field = data.get("extra_cache_cost", None) if field is not None: @@ -995,10 +1135,14 @@ def unmarshal_ListBackendStagesResponse(data: Any) -> ListBackendStagesResponse: args["stages"] = ( [unmarshal_BackendStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListBackendStagesResponse(**args) @@ -1016,10 +1160,14 @@ def unmarshal_ListCacheStagesResponse(data: Any) -> ListCacheStagesResponse: args["stages"] = ( [unmarshal_CacheStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListCacheStagesResponse(**args) @@ -1037,10 +1185,14 @@ def unmarshal_ListDNSStagesResponse(data: Any) -> ListDNSStagesResponse: args["stages"] = ( [unmarshal_DNSStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDNSStagesResponse(**args) @@ -1079,10 +1231,14 @@ def unmarshal_ListHeadStagesResponse(data: Any) -> ListHeadStagesResponse: if field is not None else None ) + else: + args["head_stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListHeadStagesResponse(**args) @@ -1100,10 +1256,14 @@ def unmarshal_ListPipelinesResponse(data: Any) -> ListPipelinesResponse: args["pipelines"] = ( [unmarshal_Pipeline(v) for v in field] if field is not None else None ) + else: + args["pipelines"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPipelinesResponse(**args) @@ -1123,10 +1283,14 @@ def unmarshal_ListPipelinesWithStagesResponse( args["pipelines"] = ( [unmarshal_PipelineStages(v) for v in field] if field is not None else None ) + else: + args["pipelines"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListPipelinesWithStagesResponse(**args) @@ -1142,12 +1306,16 @@ def unmarshal_ListPlansResponse(data: Any) -> ListPlansResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("plans", None) if field is not None: args["plans"] = ( [unmarshal_PlanDetails(v) for v in field] if field is not None else None ) + else: + args["plans"] = None return ListPlansResponse(**args) @@ -1165,10 +1333,14 @@ def unmarshal_ListPurgeRequestsResponse(data: Any) -> ListPurgeRequestsResponse: args["purge_requests"] = ( [unmarshal_PurgeRequest(v) for v in field] if field is not None else None ) + else: + args["purge_requests"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPurgeRequestsResponse(**args) @@ -1186,10 +1358,14 @@ def unmarshal_ListRouteRulesResponse(data: Any) -> ListRouteRulesResponse: args["route_rules"] = ( [unmarshal_RouteRule(v) for v in field] if field is not None else None ) + else: + args["route_rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListRouteRulesResponse(**args) @@ -1207,10 +1383,14 @@ def unmarshal_ListRouteStagesResponse(data: Any) -> ListRouteStagesResponse: args["stages"] = ( [unmarshal_RouteStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListRouteStagesResponse(**args) @@ -1228,10 +1408,14 @@ def unmarshal_ListTLSStagesResponse(data: Any) -> ListTLSStagesResponse: args["stages"] = ( [unmarshal_TLSStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListTLSStagesResponse(**args) @@ -1249,10 +1433,14 @@ def unmarshal_ListWafStagesResponse(data: Any) -> ListWafStagesResponse: args["stages"] = ( [unmarshal_WafStage(v) for v in field] if field is not None else None ) + else: + args["stages"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListWafStagesResponse(**args) @@ -1268,6 +1456,8 @@ def unmarshal_Plan(data: Any) -> Plan: field = data.get("plan_name", None) if field is not None: args["plan_name"] = field + else: + args["plan_name"] = None return Plan(**args) @@ -1285,6 +1475,8 @@ def unmarshal_SetRouteRulesResponse(data: Any) -> SetRouteRulesResponse: args["route_rules"] = ( [unmarshal_RouteRule(v) for v in field] if field is not None else None ) + else: + args["route_rules"] = field(default_factory=list) return SetRouteRulesResponse(**args) @@ -1296,7 +1488,7 @@ def marshal_RuleHttpMatchPathFilter( output: Dict[str, Any] = {} if request.path_filter_type is not None: - output["path_filter_type"] = str(request.path_filter_type) + output["path_filter_type"] = request.path_filter_type if request.value is not None: output["value"] = request.value @@ -1396,7 +1588,9 @@ def marshal_CheckDomainRequest( output["cname"] = request.cname if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1411,7 +1605,9 @@ def marshal_ScalewayLb( output["id"] = request.id if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone if request.frontend_id is not None: output["frontend_id"] = request.frontend_id @@ -1474,7 +1670,9 @@ def marshal_CheckPEMChainRequest( output["fqdn"] = request.fqdn if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1612,7 +1810,9 @@ def marshal_CreatePipelineRequest( output["description"] = request.description if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1667,7 +1867,9 @@ def marshal_TLSSecret( output["secret_id"] = request.secret_id if request.region is not None: - output["region"] = request.region or defaults.default_region + output["region"] = request.region + else: + output["region"] = defaults.default_region return output @@ -1734,7 +1936,7 @@ def marshal_CreateWafStageRequest( output["paranoia_level"] = request.paranoia_level if request.mode is not None: - output["mode"] = str(request.mode) + output["mode"] = request.mode return output @@ -1746,10 +1948,12 @@ def marshal_SelectPlanRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.plan_name is not None: - output["plan_name"] = str(request.plan_name) + output["plan_name"] = request.plan_name return output @@ -2037,7 +2241,7 @@ def marshal_UpdateWafStageRequest( ) if request.mode is not None: - output["mode"] = str(request.mode) + output["mode"] = request.mode if request.paranoia_level is not None: output["paranoia_level"] = request.paranoia_level diff --git a/scaleway/scaleway/edge_services/v1beta1/types.py b/scaleway/scaleway/edge_services/v1beta1/types.py index 21c36aa24..a62e46e2d 100644 --- a/scaleway/scaleway/edge_services/v1beta1/types.py +++ b/scaleway/scaleway/edge_services/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -282,12 +282,12 @@ class ScalewayLb: ID of the frontend linked to the Load Balancer. """ - is_ssl: Optional[bool] + is_ssl: Optional[bool] = False """ Defines whether the Load Balancer's frontend handles SSL connections. """ - domain_name: Optional[str] + domain_name: Optional[str] = None """ Fully Qualified Domain Name (in the format subdomain.example.com) to use in HTTP requests sent towards your Load Balancer. """ @@ -316,17 +316,17 @@ class ScalewayLbBackendConfig: @dataclass class ScalewayS3BackendConfig: - bucket_name: Optional[str] + bucket_name: Optional[str] = None """ Name of the Bucket. """ - bucket_region: Optional[str] + bucket_region: Optional[str] = None """ Region of the Bucket. """ - is_website: Optional[bool] + is_website: Optional[bool] = False """ Defines whether the bucket website feature is enabled. """ @@ -335,13 +335,9 @@ class ScalewayS3BackendConfig: @dataclass class PipelineError: stage: PipelineErrorStage - code: PipelineErrorCode - severity: PipelineErrorSeverity - message: str - type_: PipelineErrorType @@ -365,7 +361,7 @@ class RuleHttpMatch: HTTP methods to filter for. A request using any of these methods will be considered to match the rule. Possible values are `get`, `post`, `put`, `patch`, `delete`, `head`, `options`. All methods will match if none is provided. """ - path_filter: Optional[RuleHttpMatchPathFilter] + path_filter: Optional[RuleHttpMatchPathFilter] = None """ HTTP URL path to filter for. A request whose path matches the given filter will be considered to match the rule. All paths will match if none is provided. """ @@ -383,19 +379,19 @@ class BackendStage: Pipeline ID the backend stage belongs to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the backend stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the backend stage was last updated. """ - scaleway_s3: Optional[ScalewayS3BackendConfig] + scaleway_s3: Optional[ScalewayS3BackendConfig] = None - scaleway_lb: Optional[ScalewayLbBackendConfig] + scaleway_lb: Optional[ScalewayLbBackendConfig] = None @dataclass @@ -415,26 +411,26 @@ class CacheStage: Defines whether responses to requests with cookies must be stored in the cache. """ - fallback_ttl: Optional[str] + fallback_ttl: Optional[str] = None """ Time To Live (TTL) in seconds. Defines how long content is cached. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the cache stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the cache stage was last updated. """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None @dataclass @@ -459,21 +455,21 @@ class DNSStage: Pipeline ID the DNS stage belongs to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the DNS stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the DNS stage was last updated. """ - tls_stage_id: Optional[str] + tls_stage_id: Optional[str] = None - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass @@ -513,12 +509,12 @@ class Pipeline: Organization ID of the pipeline. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the pipeline was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the pipeline was last updated. """ @@ -536,17 +532,17 @@ class RouteStage: Pipeline ID the route stage belongs to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the route stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the route stage was last updated. """ - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None @dataclass @@ -571,28 +567,28 @@ class TLSStage: Pipeline ID the TLS stage belongs to. """ - certificate_expires_at: Optional[datetime] + certificate_expires_at: Optional[datetime] = None """ Expiration date of the certificate. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the TLS stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the TLS stage was last updated. """ - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None @dataclass @@ -617,24 +613,24 @@ class WafStage: Sensitivity level (`1`,`2`,`3`,`4`) to use when classifying requests as malicious. With a high level, requests are more likely to be classed as malicious, and false positives are expected. With a lower level, requests are more likely to be classed as benign. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the WAF stage was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the WAF stage was last updated. """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass class SetRouteRulesRequestRouteRule: - rule_http_match: Optional[RuleHttpMatch] + rule_http_match: Optional[RuleHttpMatch] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass @@ -649,15 +645,14 @@ class RouteRule: Route stage ID the route rule belongs to. """ - rule_http_match: Optional[RuleHttpMatch] + rule_http_match: Optional[RuleHttpMatch] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass class CheckPEMChainRequestSecretChain: secret_id: str - secret_region: str @@ -686,7 +681,7 @@ class PlanDetails: @dataclass class PlanUsageDetails: - plan_cost: Optional[Money] + plan_cost: Optional[Money] = None """ Cost to date (this month) for the corresponding Edge Services subscription plan. """ @@ -694,29 +689,23 @@ class PlanUsageDetails: @dataclass class HeadStageResponseHeadStage: - dns_stage_id: Optional[str] + dns_stage_id: Optional[str] = None @dataclass class ListHeadStagesResponseHeadStage: - dns_stage_id: Optional[str] + dns_stage_id: Optional[str] = None @dataclass class PipelineStages: dns_stages: List[DNSStage] - tls_stages: List[TLSStage] - cache_stages: List[CacheStage] - backend_stages: List[BackendStage] - waf_stages: List[WafStage] - route_stages: List[RouteStage] - - pipeline: Optional[Pipeline] + pipeline: Optional[Pipeline] = None @dataclass @@ -736,19 +725,19 @@ class PurgeRequest: Status of the purge request. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the purge request was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the purge request was last updated. """ - assets: Optional[List[str]] + assets: Optional[List[str]] = field(default_factory=list) - all: Optional[bool] + all: Optional[bool] = False @dataclass @@ -764,7 +753,6 @@ class SetHeadStageRequestRemoveHeadStage: @dataclass class SetHeadStageRequestSwapHeadStage: new_stage_id: str - current_stage_id: str @@ -783,14 +771,16 @@ class AddRouteRulesRequest: ID of the route stage to update. """ - route_rules: Optional[List[SetRouteRulesRequestRouteRule]] + route_rules: Optional[List[SetRouteRulesRequestRouteRule]] = field( + default_factory=list + ) """ List of rules to be checked against every HTTP request. The first matching rule will forward the request to its specified backend stage. If no rules are matched, the request is forwarded to the WAF stage defined by `waf_stage_id`. """ - after_position: Optional[int] + after_position: Optional[int] = 0 - before_position: Optional[int] + before_position: Optional[int] = 0 @dataclass @@ -804,10 +794,8 @@ class AddRouteRulesResponse: @dataclass class CheckDomainRequest: fqdn: str - cname: str - - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -817,25 +805,22 @@ class CheckDomainResponse: @dataclass class CheckLbOriginRequest: - lb: Optional[ScalewayLb] + lb: Optional[ScalewayLb] = None @dataclass class CheckLbOriginResponse: is_valid: bool - error_type: LbOriginError @dataclass class CheckPEMChainRequest: fqdn: str + project_id: Optional[str] = None + secret: Optional[CheckPEMChainRequestSecretChain] = None - project_id: Optional[str] - - secret: Optional[CheckPEMChainRequestSecretChain] - - raw: Optional[str] + raw: Optional[str] = None @dataclass @@ -850,52 +835,52 @@ class CreateBackendStageRequest: Pipeline ID the Backend stage belongs to. """ - scaleway_s3: Optional[ScalewayS3BackendConfig] + scaleway_s3: Optional[ScalewayS3BackendConfig] = None - scaleway_lb: Optional[ScalewayLbBackendConfig] + scaleway_lb: Optional[ScalewayLbBackendConfig] = None @dataclass class CreateCacheStageRequest: - fallback_ttl: Optional[str] + pipeline_id: str """ - Time To Live (TTL) in seconds. Defines how long content is cached. + Pipeline ID the Cache stage belongs to. """ - include_cookies: Optional[bool] + fallback_ttl: Optional[str] = None """ - Defines whether responses to requests with cookies must be stored in the cache. + Time To Live (TTL) in seconds. Defines how long content is cached. """ - pipeline_id: str + include_cookies: Optional[bool] = False """ - Pipeline ID the Cache stage belongs to. + Defines whether responses to requests with cookies must be stored in the cache. """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None @dataclass class CreateDNSStageRequest: - fqdns: Optional[List[str]] + pipeline_id: str """ - Fully Qualified Domain Name (in the format subdomain.example.com) to attach to the stage. + Pipeline ID the DNS stage belongs to. """ - pipeline_id: str + fqdns: Optional[List[str]] = field(default_factory=list) """ - Pipeline ID the DNS stage belongs to. + Fully Qualified Domain Name (in the format subdomain.example.com) to attach to the stage. """ - tls_stage_id: Optional[str] + tls_stage_id: Optional[str] = None - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass @@ -910,7 +895,7 @@ class CreatePipelineRequest: Description of the pipeline. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID in which the pipeline will be created. """ @@ -923,9 +908,9 @@ class CreatePurgeRequestRequest: Pipeline ID in which the purge request will be created. """ - assets: Optional[List[str]] + assets: Optional[List[str]] = field(default_factory=list) - all: Optional[bool] + all: Optional[bool] = False @dataclass @@ -935,33 +920,33 @@ class CreateRouteStageRequest: Pipeline ID the route stage belongs to. """ - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None @dataclass class CreateTLSStageRequest: - secrets: Optional[List[TLSSecret]] + pipeline_id: str """ - Secret (from Scaleway Secret Manager) containing your custom certificate. + Pipeline ID the TLS stage belongs to. """ - managed_certificate: Optional[bool] + secrets: Optional[List[TLSSecret]] = field(default_factory=list) """ - True when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint. + Secret (from Scaleway Secret Manager) containing your custom certificate. """ - pipeline_id: str + managed_certificate: Optional[bool] = False """ - Pipeline ID the TLS stage belongs to. + True when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint. """ - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None @dataclass @@ -976,12 +961,12 @@ class CreateWafStageRequest: Sensitivity level (`1`,`2`,`3`,`4`) to use when classifying requests as malicious. With a high level, requests are more likely to be classed as malicious, and false positives are expected. With a lower level, requests are more likely to be classed as benign. """ - mode: Optional[WafStageMode] + mode: Optional[WafStageMode] = WafStageMode.UNKNOWN_MODE """ Mode defining WAF behavior (`disable`/`log_only`/`enable`). """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass @@ -1002,7 +987,7 @@ class DeleteCacheStageRequest: @dataclass class DeleteCurrentPlanRequest: - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -1055,16 +1040,11 @@ class GetBackendStageRequest: @dataclass class GetBillingRequest: - project_id: Optional[str] + project_id: Optional[str] = None @dataclass class GetBillingResponse: - current_plan: Optional[PlanDetails] - """ - Information on the currently-selected, active Edge Services subscription plan. - """ - pipeline_number: int """ Total number of pipelines currently configured. @@ -1090,37 +1070,42 @@ class GetBillingResponse: Total number of extra requests processed by the WAF from the beginning of the month, not included in the subscription plans. """ - plan_cost: Optional[Money] + plans_usage_details: Dict[str, PlanUsageDetails] """ - Cost to date (this month) for Edge Service subscription plans. This comprises the pro-rata cost of the current subscription plan, and any previous subscription plans that were active earlier in the month. + Detailed costs and usage for all Edge Services subscription plans that were activated during the month. """ - extra_pipelines_cost: Optional[Money] + current_plan: Optional[PlanDetails] = None """ - Cost to date (this month) of pipelines not included in the subscription plans. + Information on the currently-selected, active Edge Services subscription plan. """ - plans_usage_details: Dict[str, PlanUsageDetails] + plan_cost: Optional[Money] = None """ - Detailed costs and usage for all Edge Services subscription plans that were activated during the month. + Cost to date (this month) for Edge Service subscription plans. This comprises the pro-rata cost of the current subscription plan, and any previous subscription plans that were active earlier in the month. """ - extra_cache_cost: Optional[Money] + extra_pipelines_cost: Optional[Money] = None + """ + Cost to date (this month) of pipelines not included in the subscription plans. + """ + + extra_cache_cost: Optional[Money] = None """ Cost to date (this month) of the data egressed from the cache that is not included in the subscription plans. """ - extra_waf_cost: Optional[Money] + extra_waf_cost: Optional[Money] = None """ Cost to date (this month) of the extra requests processed by the WAF that were not included in the subscription plans. """ - waf_add_on: Optional[Money] + waf_add_on: Optional[Money] = None """ Cost of activating WAF add-on (where subscription plan does not include WAF). """ - total_cost: Optional[Money] + total_cost: Optional[Money] = None """ Total cost to date (this month) of all Edge Services resources including active subscription plan, previously active plans, extra pipelines and extra egress cache data. """ @@ -1136,7 +1121,7 @@ class GetCacheStageRequest: @dataclass class GetCurrentPlanRequest: - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -1189,7 +1174,7 @@ class GetWafStageRequest: @dataclass class HeadStageResponse: - head_stage: Optional[HeadStageResponseHeadStage] + head_stage: Optional[HeadStageResponseHeadStage] = None """ Modified or created head stage. """ @@ -1197,37 +1182,39 @@ class HeadStageResponse: @dataclass class ListBackendStagesRequest: - order_by: Optional[ListBackendStagesRequestOrderBy] + pipeline_id: str """ - Sort order of backend stages in the response. + Pipeline ID to filter for. Only backend stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListBackendStagesRequestOrderBy] = ( + ListBackendStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of backend stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of backend stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only backend stages from this pipeline will be returned. + Number of backend stages to return per page. """ - bucket_name: Optional[str] + bucket_name: Optional[str] = None """ Bucket name to filter for. Only backend stages from this Bucket will be returned. """ - bucket_region: Optional[str] + bucket_region: Optional[str] = None """ Bucket region to filter for. Only backend stages with buckets in this region will be returned. """ - lb_id: Optional[str] + lb_id: Optional[str] = None """ Load Balancer ID to filter for. Only backend stages with this Load Balancer will be returned. """ @@ -1248,24 +1235,26 @@ class ListBackendStagesResponse: @dataclass class ListCacheStagesRequest: - order_by: Optional[ListCacheStagesRequestOrderBy] + pipeline_id: str """ - Sort order of cache stages in the response. + Pipeline ID to filter for. Only cache stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListCacheStagesRequestOrderBy] = ( + ListCacheStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of cache stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of cache stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only cache stages from this pipeline will be returned. + Number of cache stages to return per page. """ @@ -1284,27 +1273,29 @@ class ListCacheStagesResponse: @dataclass class ListDNSStagesRequest: - order_by: Optional[ListDNSStagesRequestOrderBy] + pipeline_id: str """ - Sort order of DNS stages in the response. + Pipeline ID to filter for. Only DNS stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListDNSStagesRequestOrderBy] = ( + ListDNSStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of DNS stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of DNS stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only DNS stages from this pipeline will be returned. + Number of DNS stages to return per page. """ - fqdn: Optional[str] + fqdn: Optional[str] = None """ Fully Qualified Domain Name to filter for (in the format subdomain.example.com). Only DNS stages with this FQDN will be returned. """ @@ -1330,12 +1321,12 @@ class ListHeadStagesRequest: ID of the pipeline to update. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of head stages to return per page. """ @@ -1356,37 +1347,39 @@ class ListHeadStagesResponse: @dataclass class ListPipelinesRequest: - order_by: Optional[ListPipelinesRequestOrderBy] + order_by: Optional[ListPipelinesRequestOrderBy] = ( + ListPipelinesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of pipelines in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of pipelines to return per page. """ - name: Optional[str] + name: Optional[str] = None """ Pipeline name to filter for. Only pipelines with this string within their name will be returned. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. Only pipelines from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. Only pipelines from this Project will be returned. """ - has_backend_stage_lb: Optional[bool] + has_backend_stage_lb: Optional[bool] = False """ Filter on backend stage. Only pipelines with a Load Balancer origin will be returned. """ @@ -1407,61 +1400,56 @@ class ListPipelinesResponse: @dataclass class ListPipelinesWithStagesRequest: - order_by: Optional[ListPipelinesWithStagesRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - name: Optional[str] - - organization_id: Optional[str] - - project_id: Optional[str] + order_by: Optional[ListPipelinesWithStagesRequestOrderBy] = None + page: Optional[int] = None + page_size: Optional[int] = None + name: Optional[str] = None + organization_id: Optional[str] = None + project_id: Optional[str] = None @dataclass class ListPipelinesWithStagesResponse: pipelines: List[PipelineStages] - total_count: int @dataclass class ListPlansResponse: total_count: int - plans: List[PlanDetails] @dataclass class ListPurgeRequestsRequest: - order_by: Optional[ListPurgeRequestsRequestOrderBy] + order_by: Optional[ListPurgeRequestsRequestOrderBy] = ( + ListPurgeRequestsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of purge requests in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of purge requests to return per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. Only purge requests from this Project will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. Only purge requests from this Project will be returned. """ - pipeline_id: Optional[str] + pipeline_id: Optional[str] = None """ Pipeline ID to filter for. Only purge requests from this pipeline will be returned. """ @@ -1503,24 +1491,26 @@ class ListRouteRulesResponse: @dataclass class ListRouteStagesRequest: - order_by: Optional[ListRouteStagesRequestOrderBy] + pipeline_id: str """ - Sort order of route stages in the response. + Pipeline ID to filter for. Only route stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListRouteStagesRequestOrderBy] = ( + ListRouteStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of route stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of route stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only route stages from this pipeline will be returned. + Number of route stages to return per page. """ @@ -1539,32 +1529,34 @@ class ListRouteStagesResponse: @dataclass class ListTLSStagesRequest: - order_by: Optional[ListTLSStagesRequestOrderBy] + pipeline_id: str """ - Sort order of TLS stages in the response. + Pipeline ID to filter for. Only TLS stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListTLSStagesRequestOrderBy] = ( + ListTLSStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of TLS stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of TLS stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only TLS stages from this pipeline will be returned. + Number of TLS stages to return per page. """ - secret_id: Optional[str] + secret_id: Optional[str] = None """ Secret ID to filter for. Only TLS stages with this Secret ID will be returned. """ - secret_region: Optional[str] + secret_region: Optional[str] = None """ Secret region to filter for. Only TLS stages with a Secret in this region will be returned. """ @@ -1585,24 +1577,26 @@ class ListTLSStagesResponse: @dataclass class ListWafStagesRequest: - order_by: Optional[ListWafStagesRequestOrderBy] + pipeline_id: str """ - Sort order of WAF stages in the response. + Pipeline ID to filter for. Only WAF stages from this pipeline will be returned. """ - page: Optional[int] + order_by: Optional[ListWafStagesRequestOrderBy] = ( + ListWafStagesRequestOrderBy.CREATED_AT_ASC + ) """ - Page number to return, from the paginated results. + Sort order of WAF stages in the response. """ - page_size: Optional[int] + page: Optional[int] = 0 """ - Number of WAF stages to return per page. + Page number to return, from the paginated results. """ - pipeline_id: str + page_size: Optional[int] = 0 """ - Pipeline ID to filter for. Only WAF stages from this pipeline will be returned. + Number of WAF stages to return per page. """ @@ -1626,50 +1620,36 @@ class Plan: @dataclass class SearchBackendStagesRequest: - order_by: Optional[SearchBackendStagesRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - project_id: Optional[str] - - bucket_name: Optional[str] - - bucket_region: Optional[str] - - lb_id: Optional[str] + order_by: Optional[SearchBackendStagesRequestOrderBy] = None + page: Optional[int] = None + page_size: Optional[int] = None + project_id: Optional[str] = None + bucket_name: Optional[str] = None + bucket_region: Optional[str] = None + lb_id: Optional[str] = None @dataclass class SearchRouteRulesRequest: - order_by: Optional[SearchRouteRulesRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - organization_id: Optional[str] - - project_id: Optional[str] + order_by: Optional[SearchRouteRulesRequestOrderBy] = None + page: Optional[int] = None + page_size: Optional[int] = None + organization_id: Optional[str] = None + project_id: Optional[str] = None @dataclass class SearchWafStagesRequest: - order_by: Optional[SearchWafStagesRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - project_id: Optional[str] + order_by: Optional[SearchWafStagesRequestOrderBy] = None + page: Optional[int] = None + page_size: Optional[int] = None + project_id: Optional[str] = None @dataclass class SelectPlanRequest: - project_id: Optional[str] - - plan_name: Optional[PlanName] + project_id: Optional[str] = None + plan_name: Optional[PlanName] = None @dataclass @@ -1679,11 +1659,11 @@ class SetHeadStageRequest: ID of the pipeline to update. """ - add_new_head_stage: Optional[SetHeadStageRequestAddNewHeadStage] + add_new_head_stage: Optional[SetHeadStageRequestAddNewHeadStage] = None - remove_head_stage: Optional[SetHeadStageRequestRemoveHeadStage] + remove_head_stage: Optional[SetHeadStageRequestRemoveHeadStage] = None - swap_head_stage: Optional[SetHeadStageRequestSwapHeadStage] + swap_head_stage: Optional[SetHeadStageRequestSwapHeadStage] = None @dataclass @@ -1693,7 +1673,9 @@ class SetRouteRulesRequest: ID of the route stage to update. """ - route_rules: Optional[List[SetRouteRulesRequestRouteRule]] + route_rules: Optional[List[SetRouteRulesRequestRouteRule]] = field( + default_factory=list + ) """ List of rules to be checked against every HTTP request. The first matching rule will forward the request to its specified backend stage. If no rules are matched, the request is forwarded to the WAF stage defined by `waf_stage_id`. """ @@ -1719,9 +1701,9 @@ class UpdateBackendStageRequest: Pipeline ID the Backend stage belongs to. """ - scaleway_s3: Optional[ScalewayS3BackendConfig] + scaleway_s3: Optional[ScalewayS3BackendConfig] = None - scaleway_lb: Optional[ScalewayLbBackendConfig] + scaleway_lb: Optional[ScalewayLbBackendConfig] = None @dataclass @@ -1731,21 +1713,21 @@ class UpdateCacheStageRequest: ID of the cache stage to update. """ - fallback_ttl: Optional[str] + fallback_ttl: Optional[str] = None """ Time To Live (TTL) in seconds. Defines how long content is cached. """ - include_cookies: Optional[bool] + include_cookies: Optional[bool] = False """ Defines whether responses to requests with cookies must be stored in the cache. """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None @dataclass @@ -1755,16 +1737,16 @@ class UpdateDNSStageRequest: ID of the DNS stage to update. """ - fqdns: Optional[List[str]] + fqdns: Optional[List[str]] = field(default_factory=list) """ Fully Qualified Domain Name (in the format subdomain.example.com) attached to the stage. """ - tls_stage_id: Optional[str] + tls_stage_id: Optional[str] = None - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None @dataclass @@ -1774,12 +1756,12 @@ class UpdatePipelineRequest: ID of the pipeline to update. """ - name: Optional[str] + name: Optional[str] = None """ Name of the pipeline. """ - description: Optional[str] + description: Optional[str] = None """ Description of the pipeline. """ @@ -1792,7 +1774,7 @@ class UpdateRouteStageRequest: ID of the route stage to update. """ - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None @dataclass @@ -1802,23 +1784,23 @@ class UpdateTLSStageRequest: ID of the TLS stage to update. """ - tls_secrets_config: Optional[TLSSecretsConfig] + tls_secrets_config: Optional[TLSSecretsConfig] = None """ Secret (from Scaleway Secret-Manager) containing your custom certificate. """ - managed_certificate: Optional[bool] + managed_certificate: Optional[bool] = False """ True when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint. """ - cache_stage_id: Optional[str] + cache_stage_id: Optional[str] = None - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None - route_stage_id: Optional[str] + route_stage_id: Optional[str] = None - waf_stage_id: Optional[str] + waf_stage_id: Optional[str] = None @dataclass @@ -1828,14 +1810,14 @@ class UpdateWafStageRequest: ID of the WAF stage to update. """ - mode: Optional[WafStageMode] + mode: Optional[WafStageMode] = WafStageMode.UNKNOWN_MODE """ Mode defining WAF behavior (`disable`/`log_only`/`enable`). """ - paranoia_level: Optional[int] + paranoia_level: Optional[int] = 0 """ Sensitivity level (`1`,`2`,`3`,`4`) to use when classifying requests as malicious. With a high level, requests are more likely to be classed as malicious, and false positives are expected. With a lower level, requests are more likely to be classed as benign. """ - backend_stage_id: Optional[str] + backend_stage_id: Optional[str] = None diff --git a/scaleway/scaleway/file/v1alpha1/marshalling.py b/scaleway/scaleway/file/v1alpha1/marshalling.py index e9b6d39da..d81d3a312 100644 --- a/scaleway/scaleway/file/v1alpha1/marshalling.py +++ b/scaleway/scaleway/file/v1alpha1/marshalling.py @@ -6,6 +6,8 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + AttachmentResourceType, + FileSystemStatus, FileSystem, Attachment, ListAttachmentsResponse, @@ -26,38 +28,56 @@ def unmarshal_FileSystem(data: Any) -> FileSystem: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = FileSystemStatus.UNKNOWN_STATUS field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("number_of_attachments", None) if field is not None: args["number_of_attachments"] = field + else: + args["number_of_attachments"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -85,18 +105,26 @@ def unmarshal_Attachment(data: Any) -> Attachment: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("filesystem_id", None) if field is not None: args["filesystem_id"] = field + else: + args["filesystem_id"] = None field = data.get("resource_id", None) if field is not None: args["resource_id"] = field + else: + args["resource_id"] = None field = data.get("resource_type", None) if field is not None: args["resource_type"] = field + else: + args["resource_type"] = AttachmentResourceType.UNKNOWN_RESOURCE_TYPE field = data.get("zone", None) if field is not None: @@ -120,10 +148,14 @@ def unmarshal_ListAttachmentsResponse(data: Any) -> ListAttachmentsResponse: args["attachments"] = ( [unmarshal_Attachment(v) for v in field] if field is not None else None ) + else: + args["attachments"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListAttachmentsResponse(**args) @@ -141,10 +173,14 @@ def unmarshal_ListFileSystemsResponse(data: Any) -> ListFileSystemsResponse: args["filesystems"] = ( [unmarshal_FileSystem(v) for v in field] if field is not None else None ) + else: + args["filesystems"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListFileSystemsResponse(**args) @@ -162,7 +198,9 @@ def marshal_CreateFileSystemRequest( output["size"] = request.size if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway/scaleway/file/v1alpha1/types.py b/scaleway/scaleway/file/v1alpha1/types.py index a4a542aa8..58fc14222 100644 --- a/scaleway/scaleway/file/v1alpha1/types.py +++ b/scaleway/scaleway/file/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -71,7 +71,7 @@ class Attachment: The type of the attached resource. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ The zone where the resource is located. """ @@ -128,12 +128,12 @@ class FileSystem: Region where the filesystem is located. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the filesystem. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the properties of the filesystem. """ @@ -155,17 +155,17 @@ class CreateFileSystemRequest: Must be compliant with the minimum (100 GB) and maximum (10 TB) allowed size. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project the filesystem belongs to. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the filesystem. """ @@ -182,7 +182,7 @@ class DeleteFileSystemRequest: UUID of the filesystem. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -199,7 +199,7 @@ class GetFileSystemRequest: UUID of the filesystem. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -211,37 +211,39 @@ class ListAttachmentsRequest: Request to list filesystem attachments with filtering and pagination options. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - filesystem_id: Optional[str] + filesystem_id: Optional[str] = None """ UUID of the File Storage volume. """ - resource_id: Optional[str] + resource_id: Optional[str] = None """ Filter by resource ID. """ - resource_type: Optional[AttachmentResourceType] + resource_type: Optional[AttachmentResourceType] = ( + AttachmentResourceType.UNKNOWN_RESOURCE_TYPE + ) """ Filter by resource type. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Filter by resource zone. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (starting at 1). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of entries per page (default: 20, max: 100). """ @@ -270,42 +272,44 @@ class ListFileSystemsRequest: Request to list filesystems with filtering and pagination options. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListFileSystemsRequestOrderBy] + order_by: Optional[ListFileSystemsRequestOrderBy] = ( + ListFileSystemsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by organization ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (starting at 1). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of entries per page (default: 20, max: 100). """ - name: Optional[str] + name: Optional[str] = None """ Filter the returned filesystems by their names. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. Only filesystems with one or more matching tags will be returned. """ @@ -339,23 +343,23 @@ class UpdateFileSystemRequest: UUID of the filesystem. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ When defined, is the new name of the filesystem. """ - size: Optional[int] + size: Optional[int] = 0 """ Size in bytes, with a granularity of 100 GB (10^11 bytes). Must be compliant with the minimum (100 GB) and maximum (10 TB) allowed size. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags assigned to the filesystem. """ diff --git a/scaleway/scaleway/flexibleip/v1alpha1/marshalling.py b/scaleway/scaleway/flexibleip/v1alpha1/marshalling.py index 6f754d003..bf8d63426 100644 --- a/scaleway/scaleway/flexibleip/v1alpha1/marshalling.py +++ b/scaleway/scaleway/flexibleip/v1alpha1/marshalling.py @@ -6,6 +6,9 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + FlexibleIPStatus, + MACAddressStatus, + MACAddressType, MACAddress, FlexibleIP, AttachFlexibleIPsResponse, @@ -32,22 +35,32 @@ def unmarshal_MACAddress(data: Any) -> MACAddress: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("mac_address", None) if field is not None: args["mac_address"] = field + else: + args["mac_address"] = None field = data.get("mac_type", None) if field is not None: args["mac_type"] = field + else: + args["mac_type"] = MACAddressType.UNKNOWN_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = MACAddressStatus.UNKNOWN field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("updated_at", None) if field is not None: @@ -75,30 +88,44 @@ def unmarshal_FlexibleIP(data: Any) -> FlexibleIP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = FlexibleIPStatus.UNKNOWN field = data.get("ip_address", None) if field is not None: args["ip_address"] = field + else: + args["ip_address"] = None field = data.get("updated_at", None) if field is not None: @@ -109,10 +136,14 @@ def unmarshal_FlexibleIP(data: Any) -> FlexibleIP: field = data.get("reverse", None) if field is not None: args["reverse"] = field + else: + args["reverse"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -146,12 +177,16 @@ def unmarshal_AttachFlexibleIPsResponse(data: Any) -> AttachFlexibleIPsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("flexible_ips", None) if field is not None: args["flexible_ips"] = ( [unmarshal_FlexibleIP(v) for v in field] if field is not None else None ) + else: + args["flexible_ips"] = field(default_factory=list) return AttachFlexibleIPsResponse(**args) @@ -167,12 +202,16 @@ def unmarshal_DetachFlexibleIPsResponse(data: Any) -> DetachFlexibleIPsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("flexible_ips", None) if field is not None: args["flexible_ips"] = ( [unmarshal_FlexibleIP(v) for v in field] if field is not None else None ) + else: + args["flexible_ips"] = field(default_factory=list) return DetachFlexibleIPsResponse(**args) @@ -188,12 +227,16 @@ def unmarshal_ListFlexibleIPsResponse(data: Any) -> ListFlexibleIPsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("flexible_ips", None) if field is not None: args["flexible_ips"] = ( [unmarshal_FlexibleIP(v) for v in field] if field is not None else None ) + else: + args["flexible_ips"] = field(default_factory=list) return ListFlexibleIPsResponse(**args) @@ -226,7 +269,9 @@ def marshal_CreateFlexibleIPRequest( output["is_ipv6"] = request.is_ipv6 if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -271,7 +316,7 @@ def marshal_GenerateMACAddrRequest( output: Dict[str, Any] = {} if request.mac_type is not None: - output["mac_type"] = str(request.mac_type) + output["mac_type"] = request.mac_type return output diff --git a/scaleway/scaleway/flexibleip/v1alpha1/types.py b/scaleway/scaleway/flexibleip/v1alpha1/types.py index 623c8c4e5..460c4611d 100644 --- a/scaleway/scaleway/flexibleip/v1alpha1/types.py +++ b/scaleway/scaleway/flexibleip/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -85,12 +85,12 @@ class MACAddress: MAC address IP Availability Zone. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the virtual MAC was last updated. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the virtual MAC was created. """ @@ -138,11 +138,6 @@ class FlexibleIP: IP of the flexible IP. """ - updated_at: Optional[datetime] - """ - Date on which the flexible IP was last updated. - """ - reverse: str """ Reverse DNS value. @@ -153,17 +148,22 @@ class FlexibleIP: Availability Zone of the flexible IP. """ - created_at: Optional[datetime] + updated_at: Optional[datetime] = None + """ + Date on which the flexible IP was last updated. + """ + + created_at: Optional[datetime] = None """ Date on which the flexible IP was created. """ - mac_address: Optional[MACAddress] + mac_address: Optional[MACAddress] = None """ MAC address of the flexible IP. """ - server_id: Optional[str] + server_id: Optional[str] = None """ ID of the server linked to the flexible IP. """ @@ -181,7 +181,7 @@ class AttachFlexibleIPRequest: ID of the server on which to attach the flexible IPs. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -212,27 +212,27 @@ class CreateFlexibleIPRequest: Defines whether the flexible IP has an IPv6 address. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project to associate with the Flexible IP. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to associate to the flexible IP. """ - server_id: Optional[str] + server_id: Optional[str] = None """ ID of the server to which the newly created flexible IP will be attached. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Value of the reverse DNS. """ @@ -245,7 +245,7 @@ class DeleteFlexibleIPRequest: ID of the flexible IP to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -258,7 +258,7 @@ class DeleteMACAddrRequest: If the flexible IP belongs to a MAC group, the MAC will be removed from both the MAC group and flexible IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -271,7 +271,7 @@ class DetachFlexibleIPRequest: List of flexible IP IDs to detach from a server. Multiple IDs can be provided. Note that flexible IPs must belong to the same MAC group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -302,7 +302,7 @@ class DuplicateMACAddrRequest: Note that flexible IPs need to be attached to the same server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -320,7 +320,7 @@ class GenerateMACAddrRequest: TODO. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -333,7 +333,7 @@ class GetFlexibleIPRequest: ID of the flexible IP. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -341,47 +341,49 @@ class GetFlexibleIPRequest: @dataclass class ListFlexibleIPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListFlexibleIPsRequestOrderBy] + order_by: Optional[ListFlexibleIPsRequestOrderBy] = ( + ListFlexibleIPsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the returned flexible IPs. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of flexible IPs per page. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tag, only flexible IPs with one or more matching tags will be returned. """ - status: Optional[List[FlexibleIPStatus]] + status: Optional[List[FlexibleIPStatus]] = field(default_factory=list) """ Filter by status, only flexible IPs with this status will be returned. """ - server_ids: Optional[List[str]] + server_ids: Optional[List[str]] = field(default_factory=list) """ Filter by server IDs, only flexible IPs with these server IDs will be returned. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID, only flexible IPs from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID, only flexible IPs from this Project will be returned. """ @@ -403,10 +405,8 @@ class ListFlexibleIPsResponse: @dataclass class MoveMACAddrRequest: fip_id: str - dst_fip_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -419,22 +419,22 @@ class UpdateFlexibleIPRequest: ID of the flexible IP to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - description: Optional[str] + description: Optional[str] = None """ Flexible IP description (max. 255 characters). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the flexible IP. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Value of the reverse DNS. """ diff --git a/scaleway/scaleway/function/v1beta1/marshalling.py b/scaleway/scaleway/function/v1beta1/marshalling.py index 2d4accbd8..b2cd891d2 100644 --- a/scaleway/scaleway/function/v1beta1/marshalling.py +++ b/scaleway/scaleway/function/v1beta1/marshalling.py @@ -10,6 +10,17 @@ resolve_one_of, ) from .types import ( + CronStatus, + DomainStatus, + FunctionHttpOption, + FunctionPrivacy, + FunctionRuntime, + FunctionSandbox, + FunctionStatus, + NamespaceStatus, + TokenStatus, + TriggerInputType, + TriggerStatus, Cron, Domain, SecretHashedValue, @@ -59,28 +70,38 @@ def unmarshal_Cron(data: Any) -> Cron: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("function_id", None) if field is not None: args["function_id"] = field + else: + args["function_id"] = None field = data.get("schedule", None) if field is not None: args["schedule"] = field + else: + args["schedule"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = CronStatus.UNKNOWN field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("args", None) if field is not None: args["args"] = field else: - args["args"] = None + args["args"] = field(default_factory=dict) return Cron(**args) @@ -96,22 +117,32 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("function_id", None) if field is not None: args["function_id"] = field + else: + args["function_id"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainStatus.UNKNOWN field = data.get("error_message", None) if field is not None: @@ -133,10 +164,14 @@ def unmarshal_SecretHashedValue(data: Any) -> SecretHashedValue: field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None field = data.get("hashed_value", None) if field is not None: args["hashed_value"] = field + else: + args["hashed_value"] = None return SecretHashedValue(**args) @@ -152,54 +187,80 @@ def unmarshal_Function(data: Any) -> Function: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("namespace_id", None) if field is not None: args["namespace_id"] = field + else: + args["namespace_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = FunctionStatus.UNKNOWN field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = field(default_factory=dict) field = data.get("min_scale", None) if field is not None: args["min_scale"] = field + else: + args["min_scale"] = 0 field = data.get("max_scale", None) if field is not None: args["max_scale"] = field + else: + args["max_scale"] = 0 field = data.get("runtime", None) if field is not None: args["runtime"] = field + else: + args["runtime"] = FunctionRuntime.UNKNOWN_RUNTIME field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field + else: + args["memory_limit"] = 0 field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field + else: + args["cpu_limit"] = 0 field = data.get("handler", None) if field is not None: args["handler"] = field + else: + args["handler"] = None field = data.get("privacy", None) if field is not None: args["privacy"] = field + else: + args["privacy"] = FunctionPrivacy.UNKNOWN_PRIVACY field = data.get("domain_name", None) if field is not None: args["domain_name"] = field + else: + args["domain_name"] = None field = data.get("secret_environment_variables", None) if field is not None: @@ -208,6 +269,8 @@ def unmarshal_Function(data: Any) -> Function: if field is not None else None ) + else: + args["secret_environment_variables"] = field(default_factory=list) field = data.get("timeout", None) if field is not None: @@ -236,22 +299,32 @@ def unmarshal_Function(data: Any) -> Function: field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("http_option", None) if field is not None: args["http_option"] = field + else: + args["http_option"] = FunctionHttpOption.UNKNOWN_HTTP_OPTION field = data.get("runtime_message", None) if field is not None: args["runtime_message"] = field + else: + args["runtime_message"] = None field = data.get("sandbox", None) if field is not None: args["sandbox"] = field + else: + args["sandbox"] = FunctionSandbox.UNKNOWN_SANDBOX field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -291,30 +364,44 @@ def unmarshal_Namespace(data: Any) -> Namespace: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = field(default_factory=dict) field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = NamespaceStatus.UNKNOWN field = data.get("registry_namespace_id", None) if field is not None: args["registry_namespace_id"] = field + else: + args["registry_namespace_id"] = None field = data.get("error_message", None) if field is not None: @@ -325,6 +412,8 @@ def unmarshal_Namespace(data: Any) -> Namespace: field = data.get("registry_endpoint", None) if field is not None: args["registry_endpoint"] = field + else: + args["registry_endpoint"] = None field = data.get("secret_environment_variables", None) if field is not None: @@ -333,14 +422,20 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None else None ) + else: + args["secret_environment_variables"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("description", None) if field is not None: @@ -364,7 +459,7 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None: args["vpc_integration_activated"] = field else: - args["vpc_integration_activated"] = None + args["vpc_integration_activated"] = False return Namespace(**args) @@ -380,14 +475,20 @@ def unmarshal_Token(data: Any) -> Token: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("token", None) if field is not None: args["token"] = field + else: + args["token"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TokenStatus.UNKNOWN field = data.get("function_id", None) if field is not None: @@ -433,18 +534,26 @@ def unmarshal_TriggerMnqNatsClientConfig(data: Any) -> TriggerMnqNatsClientConfi field = data.get("subject", None) if field is not None: args["subject"] = field + else: + args["subject"] = None field = data.get("mnq_nats_account_id", None) if field is not None: args["mnq_nats_account_id"] = field + else: + args["mnq_nats_account_id"] = None field = data.get("mnq_project_id", None) if field is not None: args["mnq_project_id"] = field + else: + args["mnq_project_id"] = None field = data.get("mnq_region", None) if field is not None: args["mnq_region"] = field + else: + args["mnq_region"] = None field = data.get("mnq_credential_id", None) if field is not None: @@ -466,14 +575,20 @@ def unmarshal_TriggerMnqSqsClientConfig(data: Any) -> TriggerMnqSqsClientConfig: field = data.get("queue", None) if field is not None: args["queue"] = field + else: + args["queue"] = None field = data.get("mnq_project_id", None) if field is not None: args["mnq_project_id"] = field + else: + args["mnq_project_id"] = None field = data.get("mnq_region", None) if field is not None: args["mnq_region"] = field + else: + args["mnq_region"] = None field = data.get("mnq_credential_id", None) if field is not None: @@ -495,18 +610,26 @@ def unmarshal_TriggerSqsClientConfig(data: Any) -> TriggerSqsClientConfig: field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("queue_url", None) if field is not None: args["queue_url"] = field + else: + args["queue_url"] = None field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None field = data.get("secret_key", None) if field is not None: args["secret_key"] = field + else: + args["secret_key"] = None return TriggerSqsClientConfig(**args) @@ -522,26 +645,38 @@ def unmarshal_Trigger(data: Any) -> Trigger: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("function_id", None) if field is not None: args["function_id"] = field + else: + args["function_id"] = None field = data.get("input_type", None) if field is not None: args["input_type"] = field + else: + args["input_type"] = TriggerInputType.UNKNOWN_INPUT_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TriggerStatus.UNKNOWN_STATUS field = data.get("error_message", None) if field is not None: @@ -581,10 +716,14 @@ def unmarshal_DownloadURL(data: Any) -> DownloadURL: field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("headers", None) if field is not None: args["headers"] = field + else: + args["headers"] = None return DownloadURL(**args) @@ -602,10 +741,14 @@ def unmarshal_ListCronsResponse(data: Any) -> ListCronsResponse: args["crons"] = ( [unmarshal_Cron(v) for v in field] if field is not None else None ) + else: + args["crons"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListCronsResponse(**args) @@ -623,10 +766,14 @@ def unmarshal_ListDomainsResponse(data: Any) -> ListDomainsResponse: args["domains"] = ( [unmarshal_Domain(v) for v in field] if field is not None else None ) + else: + args["domains"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDomainsResponse(**args) @@ -642,42 +789,62 @@ def unmarshal_Runtime(data: Any) -> Runtime: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("language", None) if field is not None: args["language"] = field + else: + args["language"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("default_handler", None) if field is not None: args["default_handler"] = field + else: + args["default_handler"] = None field = data.get("code_sample", None) if field is not None: args["code_sample"] = field + else: + args["code_sample"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("status_message", None) if field is not None: args["status_message"] = field + else: + args["status_message"] = None field = data.get("extension", None) if field is not None: args["extension"] = field + else: + args["extension"] = None field = data.get("implementation", None) if field is not None: args["implementation"] = field + else: + args["implementation"] = None field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None return Runtime(**args) @@ -695,10 +862,14 @@ def unmarshal_ListFunctionRuntimesResponse(data: Any) -> ListFunctionRuntimesRes args["runtimes"] = ( [unmarshal_Runtime(v) for v in field] if field is not None else None ) + else: + args["runtimes"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListFunctionRuntimesResponse(**args) @@ -716,10 +887,14 @@ def unmarshal_ListFunctionsResponse(data: Any) -> ListFunctionsResponse: args["functions"] = ( [unmarshal_Function(v) for v in field] if field is not None else None ) + else: + args["functions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListFunctionsResponse(**args) @@ -737,10 +912,14 @@ def unmarshal_ListNamespacesResponse(data: Any) -> ListNamespacesResponse: args["namespaces"] = ( [unmarshal_Namespace(v) for v in field] if field is not None else None ) + else: + args["namespaces"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNamespacesResponse(**args) @@ -758,10 +937,14 @@ def unmarshal_ListTokensResponse(data: Any) -> ListTokensResponse: args["tokens"] = ( [unmarshal_Token(v) for v in field] if field is not None else None ) + else: + args["tokens"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListTokensResponse(**args) @@ -777,12 +960,16 @@ def unmarshal_ListTriggersResponse(data: Any) -> ListTriggersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("triggers", None) if field is not None: args["triggers"] = ( [unmarshal_Trigger(v) for v in field] if field is not None else None ) + else: + args["triggers"] = field(default_factory=list) return ListTriggersResponse(**args) @@ -798,10 +985,14 @@ def unmarshal_UploadURL(data: Any) -> UploadURL: field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("headers", None) if field is not None: args["headers"] = field + else: + args["headers"] = field(default_factory=dict) return UploadURL(**args) @@ -879,7 +1070,7 @@ def marshal_CreateFunctionRequest( output["max_scale"] = request.max_scale if request.runtime is not None: - output["runtime"] = str(request.runtime) + output["runtime"] = request.runtime if request.memory_limit is not None: output["memory_limit"] = request.memory_limit @@ -891,7 +1082,7 @@ def marshal_CreateFunctionRequest( output["handler"] = request.handler if request.privacy is not None: - output["privacy"] = str(request.privacy) + output["privacy"] = request.privacy if request.description is not None: output["description"] = request.description @@ -903,10 +1094,10 @@ def marshal_CreateFunctionRequest( ] if request.http_option is not None: - output["http_option"] = str(request.http_option) + output["http_option"] = request.http_option if request.sandbox is not None: - output["sandbox"] = str(request.sandbox) + output["sandbox"] = request.sandbox if request.tags is not None: output["tags"] = request.tags @@ -933,7 +1124,9 @@ def marshal_CreateNamespaceRequest( output["environment_variables"] = request.environment_variables if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.description is not None: output["description"] = request.description @@ -1113,7 +1306,7 @@ def marshal_UpdateFunctionRequest( output["max_scale"] = request.max_scale if request.runtime is not None: - output["runtime"] = str(request.runtime) + output["runtime"] = request.runtime if request.memory_limit is not None: output["memory_limit"] = request.memory_limit @@ -1128,7 +1321,7 @@ def marshal_UpdateFunctionRequest( output["handler"] = request.handler if request.privacy is not None: - output["privacy"] = str(request.privacy) + output["privacy"] = request.privacy if request.description is not None: output["description"] = request.description @@ -1140,10 +1333,10 @@ def marshal_UpdateFunctionRequest( ] if request.http_option is not None: - output["http_option"] = str(request.http_option) + output["http_option"] = request.http_option if request.sandbox is not None: - output["sandbox"] = str(request.sandbox) + output["sandbox"] = request.sandbox if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway/scaleway/function/v1beta1/types.py b/scaleway/scaleway/function/v1beta1/types.py index 7d97d0aad..dcdb017e9 100644 --- a/scaleway/scaleway/function/v1beta1/types.py +++ b/scaleway/scaleway/function/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Any, Dict, List, Optional @@ -238,7 +238,6 @@ def __str__(self) -> str: @dataclass class SecretHashedValue: key: str - hashed_value: str @@ -264,7 +263,7 @@ class TriggerMnqNatsClientConfig: Currently, only the `fr-par` and `nl-ams` regions are available. """ - mnq_credential_id: Optional[str] + mnq_credential_id: Optional[str] = None """ ID of the Messaging and Queuing credentials used to subscribe to the NATS subject. """ @@ -287,7 +286,7 @@ class TriggerMnqSqsClientConfig: Currently, only the `fr-par` and `nl-ams` regions are available. """ - mnq_credential_id: Optional[str] + mnq_credential_id: Optional[str] = None """ ID of the Messaging and Queuing credentials used to read from the SQS queue. """ @@ -296,19 +295,15 @@ class TriggerMnqSqsClientConfig: @dataclass class TriggerSqsClientConfig: endpoint: str - queue_url: str - access_key: str - secret_key: str @dataclass class Secret: key: str - - value: Optional[str] + value: Optional[str] = None @dataclass @@ -355,11 +350,8 @@ class CreateTriggerRequestMnqSqsClientConfig: @dataclass class CreateTriggerRequestSqsClientConfig: endpoint: str - queue_url: str - access_key: str - secret_key: str @@ -390,7 +382,7 @@ class Cron: Name of the cron. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to pass with the cron. """ @@ -423,7 +415,7 @@ class Domain: State of the doamin. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Error message if the domain is in "error" state. """ @@ -432,23 +424,14 @@ class Domain: @dataclass class Runtime: name: str - language: str - version: str - default_handler: str - code_sample: str - status: RuntimeStatus - status_message: str - extension: str - implementation: str - logo_url: str @@ -524,66 +507,65 @@ class Function: Secret environment variables of the function. """ - timeout: Optional[str] + region: ScwRegion """ - Request processing time limit for the function. + Region in which the function is deployed. """ - error_message: Optional[str] + http_option: FunctionHttpOption """ - Error message if the function is in "error" state. + Possible values: + - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. + - enabled: Serve both HTTP and HTTPS traffic. """ - build_message: Optional[str] + runtime_message: str + sandbox: FunctionSandbox """ - Description of the current build step. + Execution environment of the function. """ - description: Optional[str] + tags: List[str] """ - Description of the function. + List of tags applied to the Serverless Function. """ - region: ScwRegion + timeout: Optional[str] = None """ - Region in which the function is deployed. + Request processing time limit for the function. """ - http_option: FunctionHttpOption + error_message: Optional[str] = None """ - Possible values: - - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. - - enabled: Serve both HTTP and HTTPS traffic. + Error message if the function is in "error" state. """ - runtime_message: str - - sandbox: FunctionSandbox + build_message: Optional[str] = None """ - Execution environment of the function. + Description of the current build step. """ - tags: List[str] + description: Optional[str] = None """ - List of tags applied to the Serverless Function. + Description of the function. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the function. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the function. """ - ready_at: Optional[datetime] + ready_at: Optional[datetime] = None """ Last date when the function was successfully deployed and set to ready. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the function can access other Scaleway resources in this Private Network. """ @@ -626,11 +608,6 @@ class Namespace: UUID of the registry namespace. """ - error_message: Optional[str] - """ - Error message if the namespace is in "error" state. - """ - registry_endpoint: str """ Registry endpoint of the namespace. @@ -651,22 +628,27 @@ class Namespace: List of tags applied to the Serverless Function Namespace. """ - description: Optional[str] + error_message: Optional[str] = None + """ + Error message if the namespace is in "error" state. + """ + + description: Optional[str] = None """ Description of the namespace. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the namespace. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the namespace. """ - vpc_integration_activated: Optional[bool] + vpc_integration_activated: Optional[bool] = False """ When activated, functions in the namespace can be connected to a Private Network. Note that activating the VPC integration can only be done when creating a new namespace. @@ -690,24 +672,24 @@ class Token: Status of the token. """ - public_key: Optional[str] + public_key: Optional[str] = None """ Public key of the token. """ - description: Optional[str] + description: Optional[str] = None """ Description of the token. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Date on which the token expires. """ - function_id: Optional[str] + function_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None @dataclass @@ -742,23 +724,22 @@ class Trigger: Status of the trigger. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Error message of the trigger. """ - scw_sqs_config: Optional[TriggerMnqSqsClientConfig] + scw_sqs_config: Optional[TriggerMnqSqsClientConfig] = None - scw_nats_config: Optional[TriggerMnqNatsClientConfig] + scw_nats_config: Optional[TriggerMnqNatsClientConfig] = None - sqs_config: Optional[TriggerSqsClientConfig] + sqs_config: Optional[TriggerSqsClientConfig] = None @dataclass class UpdateTriggerRequestSqsClientConfig: - access_key: Optional[str] - - secret_key: Optional[str] + access_key: Optional[str] = None + secret_key: Optional[str] = None @dataclass @@ -773,17 +754,17 @@ class CreateCronRequest: Schedule of the cron in UNIX cron format. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to use with the cron. """ - name: Optional[str] + name: Optional[str] = None """ Name of the cron. """ @@ -801,7 +782,7 @@ class CreateDomainRequest: UUID of the function to associate the domain with. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -814,81 +795,80 @@ class CreateFunctionRequest: UUID of the namespace the function will be created in. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the function to create. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the function. """ - min_scale: Optional[int] + min_scale: Optional[int] = 0 """ Minimum number of instances to scale the function to. """ - max_scale: Optional[int] + max_scale: Optional[int] = 0 """ Maximum number of instances to scale the function to. """ - runtime: Optional[FunctionRuntime] + runtime: Optional[FunctionRuntime] = FunctionRuntime.UNKNOWN_RUNTIME """ Runtime to use with the function. """ - memory_limit: Optional[int] + memory_limit: Optional[int] = 0 """ Memory limit of the function in MB. """ - timeout: Optional[str] + timeout: Optional[str] = None """ Request processing time limit for the function. """ - handler: Optional[str] + handler: Optional[str] = None """ Handler to use with the function. """ - privacy: Optional[FunctionPrivacy] + privacy: Optional[FunctionPrivacy] = FunctionPrivacy.UNKNOWN_PRIVACY """ Privacy setting of the function. """ - description: Optional[str] + description: Optional[str] = None """ Description of the function. """ - secret_environment_variables: Optional[List[Secret]] - - http_option: Optional[FunctionHttpOption] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) + http_option: Optional[FunctionHttpOption] = FunctionHttpOption.UNKNOWN_HTTP_OPTION """ Possible values: - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. - enabled: Serve both HTTP and HTTPS traffic. """ - sandbox: Optional[FunctionSandbox] + sandbox: Optional[FunctionSandbox] = FunctionSandbox.UNKNOWN_SANDBOX """ Execution environment of the function. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Function. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the function can access other Scaleway resources in this Private Network. @@ -903,34 +883,33 @@ class CreateNamespaceRequest: When activated, functions in the namespace can be connected to a Private Network. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] - - environment_variables: Optional[Dict[str, str]] + name: Optional[str] = None + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the namespace. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the project in which the namespace will be created. """ - description: Optional[str] + description: Optional[str] = None """ Description of the namespace. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the namespace. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Function Namespace. """ @@ -938,24 +917,24 @@ class CreateNamespaceRequest: @dataclass class CreateTokenRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the token. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Date on which the token expires. """ - function_id: Optional[str] + function_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None @dataclass @@ -970,21 +949,21 @@ class CreateTriggerRequest: ID of the function to trigger. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the trigger. """ - scw_sqs_config: Optional[CreateTriggerRequestMnqSqsClientConfig] + scw_sqs_config: Optional[CreateTriggerRequestMnqSqsClientConfig] = None - scw_nats_config: Optional[CreateTriggerRequestMnqNatsClientConfig] + scw_nats_config: Optional[CreateTriggerRequestMnqNatsClientConfig] = None - sqs_config: Optional[CreateTriggerRequestSqsClientConfig] + sqs_config: Optional[CreateTriggerRequestSqsClientConfig] = None @dataclass @@ -994,7 +973,7 @@ class DeleteCronRequest: UUID of the cron to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1007,7 +986,7 @@ class DeleteDomainRequest: UUID of the domain to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1020,7 +999,7 @@ class DeleteFunctionRequest: UUID of the function to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1033,7 +1012,7 @@ class DeleteNamespaceRequest: UUID of the namespace. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1046,7 +1025,7 @@ class DeleteTokenRequest: UUID of the token to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1059,7 +1038,7 @@ class DeleteTriggerRequest: ID of the trigger to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1072,7 +1051,7 @@ class DeployFunctionRequest: UUID of the function to deploy. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1081,7 +1060,6 @@ class DeployFunctionRequest: @dataclass class DownloadURL: url: str - headers: Dict[str, List[str]] @@ -1092,7 +1070,7 @@ class GetCronRequest: UUID of the cron to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1105,7 +1083,7 @@ class GetDomainRequest: UUID of the domain to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1118,7 +1096,7 @@ class GetFunctionDownloadURLRequest: UUID of the function to get the download URL for. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1131,7 +1109,7 @@ class GetFunctionRequest: UUID of the function. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1149,7 +1127,7 @@ class GetFunctionUploadURLRequest: Size of the archive to upload in bytes. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1162,7 +1140,7 @@ class GetNamespaceRequest: UUID of the namespace. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1175,7 +1153,7 @@ class GetTokenRequest: UUID of the token to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1188,7 +1166,7 @@ class GetTriggerRequest: ID of the trigger to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1201,22 +1179,22 @@ class ListCronsRequest: UUID of the function. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of crons per page. """ - order_by: Optional[ListCronsRequestOrderBy] + order_by: Optional[ListCronsRequestOrderBy] = ListCronsRequestOrderBy.CREATED_AT_ASC """ Order of the crons. """ @@ -1242,22 +1220,24 @@ class ListDomainsRequest: UUID of the function the domain is associated with. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of domains per page. """ - order_by: Optional[ListDomainsRequestOrderBy] + order_by: Optional[ListDomainsRequestOrderBy] = ( + ListDomainsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the domains. """ @@ -1278,7 +1258,7 @@ class ListDomainsResponse: @dataclass class ListFunctionRuntimesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1304,37 +1284,39 @@ class ListFunctionsRequest: UUID of the namespace the function belongs to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of functions per page. """ - order_by: Optional[ListFunctionsRequestOrderBy] + order_by: Optional[ListFunctionsRequestOrderBy] = ( + ListFunctionsRequestOrderBy.CREATED_AT_ASC + ) """ Order of the functions. """ - name: Optional[str] + name: Optional[str] = None """ Name of the function. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ UUID of the Organization the function belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project the function belongs to. """ @@ -1355,37 +1337,39 @@ class ListFunctionsResponse: @dataclass class ListNamespacesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of namespaces per page. """ - order_by: Optional[ListNamespacesRequestOrderBy] + order_by: Optional[ListNamespacesRequestOrderBy] = ( + ListNamespacesRequestOrderBy.CREATED_AT_ASC + ) """ Order of the namespaces. """ - name: Optional[str] + name: Optional[str] = None """ Name of the namespace. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ UUID of the Organization the namespace belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Project the namespace belongs to. """ @@ -1394,7 +1378,6 @@ class ListNamespacesRequest: @dataclass class ListNamespacesResponse: namespaces: List[Namespace] - total_count: int """ Total number of namespaces. @@ -1403,32 +1386,34 @@ class ListNamespacesResponse: @dataclass class ListTokensRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of tokens per page. """ - order_by: Optional[ListTokensRequestOrderBy] + order_by: Optional[ListTokensRequestOrderBy] = ( + ListTokensRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for the tokens. """ - function_id: Optional[str] + function_id: Optional[str] = None """ UUID of the function the token is associated with. """ - namespace_id: Optional[str] + namespace_id: Optional[str] = None """ UUID of the namespace the token is associated with. """ @@ -1437,37 +1422,38 @@ class ListTokensRequest: @dataclass class ListTokensResponse: tokens: List[Token] - total_count: int @dataclass class ListTriggersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of triggers to return per page. """ - order_by: Optional[ListTriggersRequestOrderBy] + order_by: Optional[ListTriggersRequestOrderBy] = ( + ListTriggersRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - function_id: Optional[str] + function_id: Optional[str] = None - namespace_id: Optional[str] + namespace_id: Optional[str] = None - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -1490,27 +1476,27 @@ class UpdateCronRequest: UUID of the cron to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - function_id: Optional[str] + function_id: Optional[str] = None """ UUID of the function to use the cron with. """ - schedule: Optional[str] + schedule: Optional[str] = None """ Schedule of the cron in UNIX cron format. """ - args: Optional[Dict[str, Any]] + args: Optional[Dict[str, Any]] = field(default_factory=dict) """ Arguments to use with the cron. """ - name: Optional[str] + name: Optional[str] = None """ Name of the cron. """ @@ -1523,84 +1509,84 @@ class UpdateFunctionRequest: UUID of the function to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the function to update. """ - min_scale: Optional[int] + min_scale: Optional[int] = 0 """ Minimum number of instances to scale the function to. """ - max_scale: Optional[int] + max_scale: Optional[int] = 0 """ Maximum number of instances to scale the function to. """ - runtime: Optional[FunctionRuntime] + runtime: Optional[FunctionRuntime] = FunctionRuntime.UNKNOWN_RUNTIME """ Runtime to use with the function. """ - memory_limit: Optional[int] + memory_limit: Optional[int] = 0 """ Memory limit of the function in MB. """ - timeout: Optional[str] + timeout: Optional[str] = None """ Processing time limit for the function. """ - redeploy: Optional[bool] + redeploy: Optional[bool] = False """ Redeploy failed function. """ - handler: Optional[str] + handler: Optional[str] = None """ Handler to use with the function. """ - privacy: Optional[FunctionPrivacy] + privacy: Optional[FunctionPrivacy] = FunctionPrivacy.UNKNOWN_PRIVACY """ Privacy setting of the function. """ - description: Optional[str] + description: Optional[str] = None """ Description of the function. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the function. """ - http_option: Optional[FunctionHttpOption] + http_option: Optional[FunctionHttpOption] = FunctionHttpOption.UNKNOWN_HTTP_OPTION """ Possible values: - redirected: Responds to HTTP request with a 301 redirect to ask the clients to use HTTPS. - enabled: Serve both HTTP and HTTPS traffic. """ - sandbox: Optional[FunctionSandbox] + sandbox: Optional[FunctionSandbox] = FunctionSandbox.UNKNOWN_SANDBOX """ Execution environment of the function. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Function. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ When connected to a Private Network, the function can access other Scaleway resources in this Private Network. @@ -1615,27 +1601,27 @@ class UpdateNamespaceRequest: UUID of the namespapce. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the namespace. """ - description: Optional[str] + description: Optional[str] = None """ Description of the namespace. """ - secret_environment_variables: Optional[List[Secret]] + secret_environment_variables: Optional[List[Secret]] = field(default_factory=list) """ Secret environment variables of the namespace. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Serverless Function Namespace. """ @@ -1648,22 +1634,22 @@ class UpdateTriggerRequest: ID of the trigger to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the trigger. """ - description: Optional[str] + description: Optional[str] = None """ Description of the trigger. """ - sqs_config: Optional[UpdateTriggerRequestSqsClientConfig] + sqs_config: Optional[UpdateTriggerRequestSqsClientConfig] = None @dataclass diff --git a/scaleway/scaleway/iam/v1alpha1/marshalling.py b/scaleway/scaleway/iam/v1alpha1/marshalling.py index 1ae7efd46..2010e2740 100644 --- a/scaleway/scaleway/iam/v1alpha1/marshalling.py +++ b/scaleway/scaleway/iam/v1alpha1/marshalling.py @@ -10,6 +10,15 @@ resolve_one_of, ) from .types import ( + GracePeriodType, + LocalityType, + LogAction, + LogResourceType, + PermissionSetScopeType, + SamlCertificateOrigin, + SamlCertificateType, + UserStatus, + UserType, JWT, APIKey, Application, @@ -93,22 +102,32 @@ def unmarshal_JWT(data: Any) -> JWT: field = data.get("jti", None) if field is not None: args["jti"] = field + else: + args["jti"] = None field = data.get("issuer_id", None) if field is not None: args["issuer_id"] = field + else: + args["issuer_id"] = None field = data.get("audience_id", None) if field is not None: args["audience_id"] = field + else: + args["audience_id"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("user_agent", None) if field is not None: args["user_agent"] = field + else: + args["user_agent"] = None field = data.get("created_at", None) if field is not None: @@ -142,14 +161,20 @@ def unmarshal_APIKey(data: Any) -> APIKey: field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("default_project_id", None) if field is not None: args["default_project_id"] = field + else: + args["default_project_id"] = None field = data.get("secret_key", None) if field is not None: @@ -166,18 +191,26 @@ def unmarshal_APIKey(data: Any) -> APIKey: field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = False field = data.get("deletable", None) if field is not None: args["deletable"] = field + else: + args["deletable"] = False field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("creation_ip", None) if field is not None: args["creation_ip"] = field + else: + args["creation_ip"] = None field = data.get("user_id", None) if field is not None: @@ -217,38 +250,56 @@ def unmarshal_Application(data: Any) -> Application: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = False field = data.get("deletable", None) if field is not None: args["deletable"] = field + else: + args["deletable"] = False field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("nb_api_keys", None) if field is not None: args["nb_api_keys"] = field + else: + args["nb_api_keys"] = 0 field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -276,42 +327,62 @@ def unmarshal_Group(data: Any) -> Group: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("user_ids", None) if field is not None: args["user_ids"] = field + else: + args["user_ids"] = field(default_factory=list) field = data.get("application_ids", None) if field is not None: args["application_ids"] = field + else: + args["application_ids"] = field(default_factory=list) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = False field = data.get("deletable", None) if field is not None: args["deletable"] = field + else: + args["deletable"] = False field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("created_at", None) if field is not None: @@ -339,34 +410,50 @@ def unmarshal_Log(data: Any) -> Log: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("user_agent", None) if field is not None: args["user_agent"] = field + else: + args["user_agent"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = LogAction.UNKNOWN_ACTION field = data.get("bearer_id", None) if field is not None: args["bearer_id"] = field + else: + args["bearer_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("resource_type", None) if field is not None: args["resource_type"] = field + else: + args["resource_type"] = LogResourceType.UNKNOWN_RESOURCE_TYPE field = data.get("resource_id", None) if field is not None: args["resource_id"] = field + else: + args["resource_id"] = None field = data.get("created_at", None) if field is not None: @@ -388,42 +475,62 @@ def unmarshal_Policy(data: Any) -> Policy: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = False field = data.get("deletable", None) if field is not None: args["deletable"] = field + else: + args["deletable"] = False field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("nb_rules", None) if field is not None: args["nb_rules"] = field + else: + args["nb_rules"] = 0 field = data.get("nb_scopes", None) if field is not None: args["nb_scopes"] = field + else: + args["nb_scopes"] = 0 field = data.get("nb_permission_sets", None) if field is not None: args["nb_permission_sets"] = field + else: + args["nb_permission_sets"] = 0 field = data.get("created_at", None) if field is not None: @@ -440,6 +547,8 @@ def unmarshal_Policy(data: Any) -> Policy: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("user_id", None) if field is not None: @@ -463,7 +572,7 @@ def unmarshal_Policy(data: Any) -> Policy: if field is not None: args["no_principal"] = field else: - args["no_principal"] = None + args["no_principal"] = False return Policy(**args) @@ -480,7 +589,7 @@ def unmarshal_QuotumLimit(data: Any) -> QuotumLimit: if field is not None: args["global_"] = field else: - args["global_"] = None + args["global_"] = False field = data.get("region", None) if field is not None: @@ -498,13 +607,13 @@ def unmarshal_QuotumLimit(data: Any) -> QuotumLimit: if field is not None: args["limit"] = field else: - args["limit"] = None + args["limit"] = 0 field = data.get("unlimited", None) if field is not None: args["unlimited"] = field else: - args["unlimited"] = None + args["unlimited"] = False return QuotumLimit(**args) @@ -520,40 +629,52 @@ def unmarshal_Quotum(data: Any) -> Quotum: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("pretty_name", None) if field is not None: args["pretty_name"] = field + else: + args["pretty_name"] = None field = data.get("unit", None) if field is not None: args["unit"] = field + else: + args["unit"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("locality_type", None) if field is not None: args["locality_type"] = field + else: + args["locality_type"] = LocalityType.GLOBAL field = data.get("limits", None) if field is not None: args["limits"] = ( [unmarshal_QuotumLimit(v) for v in field] if field is not None else None ) + else: + args["limits"] = field(default_factory=list) field = data.get("limit", None) if field is not None: args["limit"] = field else: - args["limit"] = None + args["limit"] = 0 field = data.get("unlimited", None) if field is not None: args["unlimited"] = field else: - args["unlimited"] = None + args["unlimited"] = False return Quotum(**args) @@ -569,30 +690,44 @@ def unmarshal_SSHKey(data: Any) -> SSHKey: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("public_key", None) if field is not None: args["public_key"] = field + else: + args["public_key"] = None field = data.get("fingerprint", None) if field is not None: args["fingerprint"] = field + else: + args["fingerprint"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("created_at", None) if field is not None: @@ -620,18 +755,26 @@ def unmarshal_SamlCertificate(data: Any) -> SamlCertificate: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = SamlCertificateType.UNKNOWN_CERTIFICATE_TYPE field = data.get("origin", None) if field is not None: args["origin"] = field + else: + args["origin"] = SamlCertificateOrigin.UNKNOWN_CERTIFICATE_ORIGIN field = data.get("content", None) if field is not None: args["content"] = field + else: + args["content"] = None field = data.get("expires_at", None) if field is not None: @@ -653,38 +796,56 @@ def unmarshal_User(data: Any) -> User: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("email", None) if field is not None: args["email"] = field + else: + args["email"] = None field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("first_name", None) if field is not None: args["first_name"] = field + else: + args["first_name"] = None field = data.get("last_name", None) if field is not None: args["last_name"] = field + else: + args["last_name"] = None field = data.get("phone_number", None) if field is not None: args["phone_number"] = field + else: + args["phone_number"] = None field = data.get("locale", None) if field is not None: args["locale"] = field + else: + args["locale"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("deletable", None) if field is not None: args["deletable"] = field + else: + args["deletable"] = False field = data.get("created_at", None) if field is not None: @@ -709,34 +870,44 @@ def unmarshal_User(data: Any) -> User: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = UserType.UNKNOWN_TYPE field = data.get("mfa", None) if field is not None: args["mfa"] = field + else: + args["mfa"] = False field = data.get("account_root_user_id", None) if field is not None: args["account_root_user_id"] = field + else: + args["account_root_user_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("locked", None) if field is not None: args["locked"] = field + else: + args["locked"] = False field = data.get("two_factor_enabled", None) if field is not None: args["two_factor_enabled"] = field else: - args["two_factor_enabled"] = None + args["two_factor_enabled"] = False field = data.get("status", None) if field is not None: args["status"] = field else: - args["status"] = None + args["status"] = UserStatus.UNKNOWN_STATUS return User(**args) @@ -752,10 +923,14 @@ def unmarshal_EncodedJWT(data: Any) -> EncodedJWT: field = data.get("token", None) if field is not None: args["token"] = field + else: + args["token"] = None field = data.get("renew_token", None) if field is not None: args["renew_token"] = field + else: + args["renew_token"] = None field = data.get("jwt", None) if field is not None: @@ -779,14 +954,20 @@ def unmarshal_ConnectionConnectedOrganization( field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("locked", None) if field is not None: args["locked"] = field + else: + args["locked"] = None return ConnectionConnectedOrganization(**args) @@ -802,14 +983,20 @@ def unmarshal_ConnectionConnectedUser(data: Any) -> ConnectionConnectedUser: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return ConnectionConnectedUser(**args) @@ -850,6 +1037,8 @@ def unmarshal_GetUserConnectionsResponse(data: Any) -> GetUserConnectionsRespons args["connections"] = ( [unmarshal_Connection(v) for v in field] if field is not None else None ) + else: + args["connections"] = field(default_factory=list) return GetUserConnectionsResponse(**args) @@ -867,6 +1056,8 @@ def unmarshal_InitiateUserConnectionResponse( field = data.get("token", None) if field is not None: args["token"] = field + else: + args["token"] = None return InitiateUserConnectionResponse(**args) @@ -884,10 +1075,14 @@ def unmarshal_ListAPIKeysResponse(data: Any) -> ListAPIKeysResponse: args["api_keys"] = ( [unmarshal_APIKey(v) for v in field] if field is not None else None ) + else: + args["api_keys"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListAPIKeysResponse(**args) @@ -905,10 +1100,14 @@ def unmarshal_ListApplicationsResponse(data: Any) -> ListApplicationsResponse: args["applications"] = ( [unmarshal_Application(v) for v in field] if field is not None else None ) + else: + args["applications"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListApplicationsResponse(**args) @@ -924,6 +1123,8 @@ def unmarshal_GracePeriod(data: Any) -> GracePeriod: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = GracePeriodType.UNKNOWN_GRACE_PERIOD_TYPE field = data.get("created_at", None) if field is not None: @@ -953,6 +1154,8 @@ def unmarshal_ListGracePeriodsResponse(data: Any) -> ListGracePeriodsResponse: args["grace_periods"] = ( [unmarshal_GracePeriod(v) for v in field] if field is not None else None ) + else: + args["grace_periods"] = field(default_factory=list) return ListGracePeriodsResponse(**args) @@ -970,10 +1173,14 @@ def unmarshal_ListGroupsResponse(data: Any) -> ListGroupsResponse: args["groups"] = ( [unmarshal_Group(v) for v in field] if field is not None else None ) + else: + args["groups"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListGroupsResponse(**args) @@ -989,10 +1196,14 @@ def unmarshal_ListJWTsResponse(data: Any) -> ListJWTsResponse: field = data.get("jwts", None) if field is not None: args["jwts"] = [unmarshal_JWT(v) for v in field] if field is not None else None + else: + args["jwts"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListJWTsResponse(**args) @@ -1008,10 +1219,14 @@ def unmarshal_ListLogsResponse(data: Any) -> ListLogsResponse: field = data.get("logs", None) if field is not None: args["logs"] = [unmarshal_Log(v) for v in field] if field is not None else None + else: + args["logs"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListLogsResponse(**args) @@ -1027,24 +1242,32 @@ def unmarshal_PermissionSet(data: Any) -> PermissionSet: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("scope_type", None) if field is not None: args["scope_type"] = field + else: + args["scope_type"] = PermissionSetScopeType.UNKNOWN_SCOPE_TYPE field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("categories", None) if field is not None: args["categories"] = field else: - args["categories"] = None + args["categories"] = field(default_factory=list) return PermissionSet(**args) @@ -1062,10 +1285,14 @@ def unmarshal_ListPermissionSetsResponse(data: Any) -> ListPermissionSetsRespons args["permission_sets"] = ( [unmarshal_PermissionSet(v) for v in field] if field is not None else None ) + else: + args["permission_sets"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPermissionSetsResponse(**args) @@ -1083,10 +1310,14 @@ def unmarshal_ListPoliciesResponse(data: Any) -> ListPoliciesResponse: args["policies"] = ( [unmarshal_Policy(v) for v in field] if field is not None else None ) + else: + args["policies"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPoliciesResponse(**args) @@ -1104,10 +1335,14 @@ def unmarshal_ListQuotaResponse(data: Any) -> ListQuotaResponse: args["quota"] = ( [unmarshal_Quotum(v) for v in field] if field is not None else None ) + else: + args["quota"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListQuotaResponse(**args) @@ -1123,26 +1358,32 @@ def unmarshal_Rule(data: Any) -> Rule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("permission_sets_scope_type", None) if field is not None: args["permission_sets_scope_type"] = field + else: + args["permission_sets_scope_type"] = PermissionSetScopeType.UNKNOWN_SCOPE_TYPE field = data.get("condition", None) if field is not None: args["condition"] = field + else: + args["condition"] = None field = data.get("permission_set_names", None) if field is not None: args["permission_set_names"] = field else: - args["permission_set_names"] = None + args["permission_set_names"] = field(default_factory=list) field = data.get("project_ids", None) if field is not None: args["project_ids"] = field else: - args["project_ids"] = None + args["project_ids"] = field(default_factory=list) field = data.get("organization_id", None) if field is not None: @@ -1172,10 +1413,14 @@ def unmarshal_ListRulesResponse(data: Any) -> ListRulesResponse: args["rules"] = ( [unmarshal_Rule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListRulesResponse(**args) @@ -1193,10 +1438,14 @@ def unmarshal_ListSSHKeysResponse(data: Any) -> ListSSHKeysResponse: args["ssh_keys"] = ( [unmarshal_SSHKey(v) for v in field] if field is not None else None ) + else: + args["ssh_keys"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSSHKeysResponse(**args) @@ -1214,6 +1463,8 @@ def unmarshal_ListSamlCertificatesResponse(data: Any) -> ListSamlCertificatesRes args["certificates"] = ( [unmarshal_SamlCertificate(v) for v in field] if field is not None else None ) + else: + args["certificates"] = field(default_factory=list) return ListSamlCertificatesResponse(**args) @@ -1231,10 +1482,14 @@ def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse: args["users"] = ( [unmarshal_User(v) for v in field] if field is not None else None ) + else: + args["users"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListUsersResponse(**args) @@ -1250,6 +1505,8 @@ def unmarshal_MFAOTP(data: Any) -> MFAOTP: field = data.get("secret", None) if field is not None: args["secret"] = field + else: + args["secret"] = None return MFAOTP(**args) @@ -1265,14 +1522,20 @@ def unmarshal_Organization(data: Any) -> Organization: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("alias", None) if field is not None: args["alias"] = field + else: + args["alias"] = None return Organization(**args) @@ -1288,10 +1551,14 @@ def unmarshal_OrganizationSecuritySettings(data: Any) -> OrganizationSecuritySet field = data.get("enforce_password_renewal", None) if field is not None: args["enforce_password_renewal"] = field + else: + args["enforce_password_renewal"] = False field = data.get("login_attempts_before_locked", None) if field is not None: args["login_attempts_before_locked"] = field + else: + args["login_attempts_before_locked"] = 0 field = data.get("grace_period_duration", None) if field is not None: @@ -1313,14 +1580,20 @@ def unmarshal_Saml(data: Any) -> Saml: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("entity_id", None) if field is not None: args["entity_id"] = field + else: + args["entity_id"] = None field = data.get("single_sign_on_url", None) if field is not None: args["single_sign_on_url"] = field + else: + args["single_sign_on_url"] = None return Saml(**args) @@ -1338,6 +1611,8 @@ def unmarshal_SetRulesResponse(data: Any) -> SetRulesResponse: args["rules"] = ( [unmarshal_Rule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return SetRulesResponse(**args) @@ -1353,6 +1628,8 @@ def unmarshal_ValidateUserMFAOTPResponse(data: Any) -> ValidateUserMFAOTPRespons field = data.get("recovery_codes", None) if field is not None: args["recovery_codes"] = field + else: + args["recovery_codes"] = field(default_factory=list) return ValidateUserMFAOTPResponse(**args) @@ -1402,7 +1679,7 @@ def marshal_AddSamlCertificateRequest( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.content is not None: output["content"] = request.content @@ -1455,9 +1732,9 @@ def marshal_CreateApplicationRequest( output["name"] = request.name if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id if request.tags is not None: output["tags"] = request.tags @@ -1475,9 +1752,9 @@ def marshal_CreateGroupRequest( output["description"] = request.description if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id if request.name is not None: output["name"] = request.name @@ -1581,9 +1858,9 @@ def marshal_CreatePolicyRequest( output["name"] = request.name if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id if request.rules is not None: output["rules"] = [marshal_RuleSpecs(item, defaults) for item in request.rules] @@ -1607,7 +1884,9 @@ def marshal_CreateSSHKeyRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1667,9 +1946,9 @@ def marshal_CreateUserRequest( ) if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) + output["organization_id"] = request.organization_id + else: + output["organization_id"] = defaults.default_organization_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway/scaleway/iam/v1alpha1/types.py b/scaleway/scaleway/iam/v1alpha1/types.py index 1708bdffc..2d3746817 100644 --- a/scaleway/scaleway/iam/v1alpha1/types.py +++ b/scaleway/scaleway/iam/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -227,32 +227,28 @@ def __str__(self) -> str: @dataclass class ConnectionConnectedOrganization: id: str - name: str - locked: bool @dataclass class ConnectionConnectedUser: id: str - username: str - type_: UserType @dataclass class QuotumLimit: - global_: Optional[bool] + global_: Optional[bool] = False - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None - limit: Optional[int] + limit: Optional[int] = 0 - unlimited: Optional[bool] + unlimited: Optional[bool] = False @dataclass @@ -282,17 +278,17 @@ class JWT: User-agent used during the creation of the JWT. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the JWT. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of the JWT. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the JWT. """ @@ -305,14 +301,14 @@ class RuleSpecs: Condition expression to evaluate. """ - permission_set_names: Optional[List[str]] + permission_set_names: Optional[List[str]] = field(default_factory=list) """ Names of permission sets bound to the rule. """ - project_ids: Optional[List[str]] + project_ids: Optional[List[str]] = field(default_factory=list) - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -365,12 +361,12 @@ class CreateUserRequestMember: @dataclass class Connection: - organization: Optional[ConnectionConnectedOrganization] + organization: Optional[ConnectionConnectedOrganization] = None """ Information about the connected organization. """ - user: Optional[ConnectionConnectedUser] + user: Optional[ConnectionConnectedUser] = None """ Information about the connected user. """ @@ -413,29 +409,29 @@ class APIKey: IP address of the device that created the API key. """ - secret_key: Optional[str] + secret_key: Optional[str] = None """ Secret key of the API Key. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of API key creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last API key update. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Date and time of API key expiration. """ - application_id: Optional[str] + application_id: Optional[str] = None - user_id: Optional[str] + user_id: Optional[str] = None @dataclass @@ -485,12 +481,12 @@ class Application: Tags associated with the user. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time application was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last application update. """ @@ -503,12 +499,12 @@ class GracePeriod: Type of grace period. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time the grace period was created. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Date and time the grace period expires. """ @@ -566,12 +562,12 @@ class Group: Defines whether or not the group is managed. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of group creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last group update. """ @@ -619,7 +615,7 @@ class Log: ID of the resource linked to the log. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the log. """ @@ -647,7 +643,7 @@ class PermissionSet: Description of the permission set. """ - categories: Optional[List[str]] + categories: Optional[List[str]] = field(default_factory=list) """ Categories of the permission set. """ @@ -675,16 +671,6 @@ class Policy: Organization ID of the policy. """ - created_at: Optional[datetime] - """ - Date and time of policy creation. - """ - - updated_at: Optional[datetime] - """ - Date and time of last policy update. - """ - editable: bool """ Defines whether or not a policy is editable. @@ -720,13 +706,23 @@ class Policy: Tags associated with the policy. """ - user_id: Optional[str] + created_at: Optional[datetime] = None + """ + Date and time of policy creation. + """ + + updated_at: Optional[datetime] = None + """ + Date and time of last policy update. + """ + + user_id: Optional[str] = None - group_id: Optional[str] + group_id: Optional[str] = None - application_id: Optional[str] + application_id: Optional[str] = None - no_principal: Optional[bool] + no_principal: Optional[bool] = False @dataclass @@ -761,9 +757,9 @@ class Quotum: Limits per locality. """ - limit: Optional[int] + limit: Optional[int] = 0 - unlimited: Optional[bool] + unlimited: Optional[bool] = False @dataclass @@ -783,16 +779,16 @@ class Rule: Condition expression to evaluate. """ - permission_set_names: Optional[List[str]] + permission_set_names: Optional[List[str]] = field(default_factory=list) """ Names of permission sets bound to the rule. """ - project_ids: Optional[List[str]] + project_ids: Optional[List[str]] = field(default_factory=list) - organization_id: Optional[str] + organization_id: Optional[str] = None - account_root_user_id: Optional[str] + account_root_user_id: Optional[str] = None @dataclass @@ -832,12 +828,12 @@ class SSHKey: SSH key status. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of SSH key. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update date of SSH key. """ @@ -865,7 +861,7 @@ class SamlCertificate: Content of the SAML certificate. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Date and time of the SAML certificate expiration. """ @@ -918,21 +914,6 @@ class User: Deletion status of user. Owners cannot be deleted. """ - created_at: Optional[datetime] - """ - Date user was created. - """ - - updated_at: Optional[datetime] - """ - Date of last user update. - """ - - last_login_at: Optional[datetime] - """ - Date of the last login. - """ - type_: UserType """ Type of user. @@ -958,12 +939,27 @@ class User: Defines whether the user is locked. """ - two_factor_enabled: Optional[bool] + created_at: Optional[datetime] = None + """ + Date user was created. + """ + + updated_at: Optional[datetime] = None + """ + Date of last user update. + """ + + last_login_at: Optional[datetime] = None + """ + Date of the last login. + """ + + two_factor_enabled: Optional[bool] = False """ Deprecated, use "mfa" instead. """ - status: Optional[UserStatus] + status: Optional[UserStatus] = UserStatus.UNKNOWN_STATUS """ Status of user invitation. """ @@ -976,9 +972,9 @@ class AddGroupMemberRequest: ID of the group. """ - user_id: Optional[str] + user_id: Optional[str] = None - application_id: Optional[str] + application_id: Optional[str] = None @dataclass @@ -988,12 +984,12 @@ class AddGroupMembersRequest: ID of the group. """ - user_ids: Optional[List[str]] + user_ids: Optional[List[str]] = field(default_factory=list) """ IDs of the users to add. """ - application_ids: Optional[List[str]] + application_ids: Optional[List[str]] = field(default_factory=list) """ IDs of the applications to add. """ @@ -1029,19 +1025,19 @@ class CreateAPIKeyRequest: Description of the API key (max length is 200 characters). """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the API key. """ - default_project_id: Optional[str] + default_project_id: Optional[str] = None """ Default Project ID to use with Object Storage. """ - application_id: Optional[str] + application_id: Optional[str] = None - user_id: Optional[str] + user_id: Optional[str] = None @dataclass @@ -1051,17 +1047,17 @@ class CreateApplicationRequest: Description of the application (max length is 200 characters). """ - name: Optional[str] + name: Optional[str] = None """ Name of the application to create (max length is 64 characters). """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the application (maximum of 10 tags). """ @@ -1074,17 +1070,17 @@ class CreateGroupRequest: Description of the group to create (max length is 200 chars). """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of Organization linked to the group. """ - name: Optional[str] + name: Optional[str] = None """ Name of the group to create (max length is 64 chars). MUST be unique inside an Organization. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the group (maximum of 10 tags). """ @@ -1115,7 +1111,7 @@ class CreateOrganizationSamlRequest: Single Sign-On URL of the SAML Identity Provider. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1128,33 +1124,33 @@ class CreatePolicyRequest: Description of the policy to create (max length is 200 characters). """ - name: Optional[str] + name: Optional[str] = None """ Name of the policy to create (max length is 64 characters). """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ - rules: Optional[List[RuleSpecs]] + rules: Optional[List[RuleSpecs]] = field(default_factory=list) """ Rules of the policy to create. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the policy (maximum of 10 tags). """ - user_id: Optional[str] + user_id: Optional[str] = None - group_id: Optional[str] + group_id: Optional[str] = None - application_id: Optional[str] + application_id: Optional[str] = None - no_principal: Optional[bool] + no_principal: Optional[bool] = False @dataclass @@ -1164,12 +1160,12 @@ class CreateSSHKeyRequest: SSH public key. Currently only the ssh-rsa, ssh-dss (DSA), ssh-ed25519 and ecdsa keys with NIST curves are supported. Max length is 65000. """ - name: Optional[str] + name: Optional[str] = None """ Name of the SSH key. Max length is 1000. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project the resource is attributed to. """ @@ -1185,19 +1181,19 @@ class CreateUserMFAOTPRequest: @dataclass class CreateUserRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the user. """ - email: Optional[str] + email: Optional[str] = None - member: Optional[CreateUserRequestMember] + member: Optional[CreateUserRequestMember] = None @dataclass @@ -1234,7 +1230,7 @@ class DeleteJWTRequest: @dataclass class DeleteOrganizationSamlRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1289,7 +1285,7 @@ class EncodedJWT: The encoded renew token. This token is necessary to renew the JWT. """ - jwt: Optional[JWT] + jwt: Optional[JWT] = None """ The renewed JWT. """ @@ -1337,7 +1333,7 @@ class GetLogRequest: @dataclass class GetOrganizationRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1345,7 +1341,7 @@ class GetOrganizationRequest: @dataclass class GetOrganizationSamlRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1353,7 +1349,7 @@ class GetOrganizationSamlRequest: @dataclass class GetOrganizationSecuritySettingsRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1374,7 +1370,7 @@ class GetQuotumRequest: Name of the quota to get. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -1443,64 +1439,66 @@ class JoinUserConnectionRequest: @dataclass class ListAPIKeysRequest: - order_by: Optional[ListAPIKeysRequestOrderBy] + order_by: Optional[ListAPIKeysRequestOrderBy] = ( + ListAPIKeysRequestOrderBy.CREATED_AT_ASC + ) """ Criteria for sorting results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of Organization. """ - editable: Optional[bool] + editable: Optional[bool] = False """ Defines whether to filter out editable API keys or not. """ - expired: Optional[bool] + expired: Optional[bool] = False """ Defines whether to filter out expired API keys or not. """ - access_key: Optional[str] + access_key: Optional[str] = None """ Filter by access key (deprecated in favor of `access_keys`). """ - description: Optional[str] + description: Optional[str] = None """ Filter by description. """ - bearer_id: Optional[str] + bearer_id: Optional[str] = None """ Filter by bearer ID. """ - bearer_type: Optional[BearerType] + bearer_type: Optional[BearerType] = BearerType.UNKNOWN_BEARER_TYPE """ Filter by type of bearer. """ - access_keys: Optional[List[str]] + access_keys: Optional[List[str]] = field(default_factory=list) """ Filter by a list of access keys. """ - application_id: Optional[str] + application_id: Optional[str] = None - user_id: Optional[str] + user_id: Optional[str] = None @dataclass @@ -1518,42 +1516,44 @@ class ListAPIKeysResponse: @dataclass class ListApplicationsRequest: - order_by: Optional[ListApplicationsRequestOrderBy] + order_by: Optional[ListApplicationsRequestOrderBy] = ( + ListApplicationsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater than 1. """ - name: Optional[str] + name: Optional[str] = None """ Name of the application to filter. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization to filter. """ - editable: Optional[bool] + editable: Optional[bool] = False """ Defines whether to filter out editable applications or not. """ - application_ids: Optional[List[str]] + application_ids: Optional[List[str]] = field(default_factory=list) """ Filter by list of IDs. """ - tag: Optional[str] + tag: Optional[str] = None """ Filter by tags containing a given string. """ @@ -1574,7 +1574,7 @@ class ListApplicationsResponse: @dataclass class ListGracePeriodsRequest: - user_id: Optional[str] + user_id: Optional[str] = None """ ID of the user to list grace periods for. """ @@ -1590,47 +1590,49 @@ class ListGracePeriodsResponse: @dataclass class ListGroupsRequest: - order_by: Optional[ListGroupsRequestOrderBy] + order_by: Optional[ListGroupsRequestOrderBy] = ( + ListGroupsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of groups. """ - page: Optional[int] + page: Optional[int] = 0 """ Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of items per page. Value must be between 1 and 100. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - name: Optional[str] + name: Optional[str] = None """ Name of group to find. """ - application_ids: Optional[List[str]] + application_ids: Optional[List[str]] = field(default_factory=list) """ Filter by a list of application IDs. """ - user_ids: Optional[List[str]] + user_ids: Optional[List[str]] = field(default_factory=list) """ Filter by a list of user IDs. """ - group_ids: Optional[List[str]] + group_ids: Optional[List[str]] = field(default_factory=list) """ Filter by a list of group IDs. """ - tag: Optional[str] + tag: Optional[str] = None """ Filter by tags containing a given string. """ @@ -1656,22 +1658,22 @@ class ListJWTsRequest: ID of the user to search. """ - order_by: Optional[ListJWTsRequestOrderBy] + order_by: Optional[ListJWTsRequestOrderBy] = ListJWTsRequestOrderBy.CREATED_AT_ASC """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater to 1. """ - expired: Optional[bool] + expired: Optional[bool] = False """ Filter out expired JWTs or not. """ @@ -1680,53 +1682,52 @@ class ListJWTsRequest: @dataclass class ListJWTsResponse: jwts: List[JWT] - total_count: int @dataclass class ListLogsRequest: - order_by: Optional[ListLogsRequestOrderBy] + order_by: Optional[ListLogsRequestOrderBy] = ListLogsRequestOrderBy.CREATED_AT_ASC """ Criteria for sorting results. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater to 1. """ - created_after: Optional[datetime] + created_after: Optional[datetime] = None """ Defined whether or not to filter out logs created after this timestamp. """ - created_before: Optional[datetime] + created_before: Optional[datetime] = None """ Defined whether or not to filter out logs created before this timestamp. """ - action: Optional[LogAction] + action: Optional[LogAction] = LogAction.UNKNOWN_ACTION """ Defined whether or not to filter out by a specific action. """ - resource_type: Optional[LogResourceType] + resource_type: Optional[LogResourceType] = LogResourceType.UNKNOWN_RESOURCE_TYPE """ Defined whether or not to filter out by a specific type of resource. """ - search: Optional[str] + search: Optional[str] = None """ Defined whether or not to filter out log by bearer ID or resource ID. """ @@ -1747,22 +1748,24 @@ class ListLogsResponse: @dataclass class ListPermissionSetsRequest: - order_by: Optional[ListPermissionSetsRequestOrderBy] + order_by: Optional[ListPermissionSetsRequestOrderBy] = ( + ListPermissionSetsRequestOrderBy.NAME_ASC + ) """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater than 1. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ @@ -1783,62 +1786,64 @@ class ListPermissionSetsResponse: @dataclass class ListPoliciesRequest: - order_by: Optional[ListPoliciesRequestOrderBy] + order_by: Optional[ListPoliciesRequestOrderBy] = ( + ListPoliciesRequestOrderBy.POLICY_NAME_ASC + ) """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater than 1. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization to filter. """ - editable: Optional[bool] + editable: Optional[bool] = False """ Defines whether or not filter out editable policies. """ - user_ids: Optional[List[str]] + user_ids: Optional[List[str]] = field(default_factory=list) """ Defines whether or not to filter by list of user IDs. """ - group_ids: Optional[List[str]] + group_ids: Optional[List[str]] = field(default_factory=list) """ Defines whether or not to filter by list of group IDs. """ - application_ids: Optional[List[str]] + application_ids: Optional[List[str]] = field(default_factory=list) """ Filter by a list of application IDs. """ - no_principal: Optional[bool] + no_principal: Optional[bool] = False """ Defines whether or not the policy is attributed to a principal. """ - policy_name: Optional[str] + policy_name: Optional[str] = None """ Name of the policy to fetch. """ - tag: Optional[str] + tag: Optional[str] = None """ Filter by tags containing a given string. """ - policy_ids: Optional[List[str]] + policy_ids: Optional[List[str]] = field(default_factory=list) """ Filter by a list of IDs. """ @@ -1859,27 +1864,27 @@ class ListPoliciesResponse: @dataclass class ListQuotaRequest: - order_by: Optional[ListQuotaRequestOrderBy] + order_by: Optional[ListQuotaRequestOrderBy] = ListQuotaRequestOrderBy.NAME_ASC """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater than 1. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - quotum_names: Optional[List[str]] + quotum_names: Optional[List[str]] = field(default_factory=list) """ List of quotum names to filter from. """ @@ -1905,12 +1910,12 @@ class ListRulesRequest: Id of policy to search. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater than 1. """ @@ -1931,37 +1936,39 @@ class ListRulesResponse: @dataclass class ListSSHKeysRequest: - order_by: Optional[ListSSHKeysRequestOrderBy] + order_by: Optional[ListSSHKeysRequestOrderBy] = ( + ListSSHKeysRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the SSH keys. """ - page: Optional[int] + page: Optional[int] = 0 """ Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of items per page. Value must be between 1 and 100. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - name: Optional[str] + name: Optional[str] = None """ Name of group to find. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - disabled: Optional[bool] + disabled: Optional[bool] = False """ Defines whether to include disabled SSH keys or not. """ @@ -1998,42 +2005,42 @@ class ListSamlCertificatesResponse: @dataclass class ListUsersRequest: - order_by: Optional[ListUsersRequestOrderBy] + order_by: Optional[ListUsersRequestOrderBy] = ListUsersRequestOrderBy.CREATED_AT_ASC """ Criteria for sorting results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of results per page. Value must be between 1 and 100. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. Value must be greater or equal to 1. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization to filter. """ - user_ids: Optional[List[str]] + user_ids: Optional[List[str]] = field(default_factory=list) """ Filter by list of IDs. """ - mfa: Optional[bool] + mfa: Optional[bool] = False """ Filter by MFA status. """ - tag: Optional[str] + tag: Optional[str] = None """ Filter by tags containing a given string. """ - type_: Optional[UserType] + type_: Optional[UserType] = UserType.UNKNOWN_TYPE """ Filter by user type. """ @@ -2067,7 +2074,7 @@ class MFAOTP: @dataclass class MigrateOrganizationGuestsRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -2103,7 +2110,7 @@ class OrganizationSecuritySettings: Number of login attempts before the account is locked. """ - grace_period_duration: Optional[str] + grace_period_duration: Optional[str] = None """ Duration of the grace period to renew password or enable MFA. """ @@ -2116,9 +2123,9 @@ class RemoveGroupMemberRequest: ID of the group. """ - user_id: Optional[str] + user_id: Optional[str] = None - application_id: Optional[str] + application_id: Optional[str] = None @dataclass @@ -2155,9 +2162,7 @@ class Saml: @dataclass class SetGroupMembersRequest: group_id: str - user_ids: List[str] - application_ids: List[str] @@ -2168,7 +2173,7 @@ class SetOrganizationAliasRequest: Alias of the Organization. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ @@ -2210,12 +2215,12 @@ class UpdateAPIKeyRequest: Access key to update. """ - default_project_id: Optional[str] + default_project_id: Optional[str] = None """ New default Project ID to set. """ - description: Optional[str] + description: Optional[str] = None """ New description to update. """ @@ -2228,17 +2233,17 @@ class UpdateApplicationRequest: ID of the application to update. """ - name: Optional[str] + name: Optional[str] = None """ New name for the application (max length is 64 chars). """ - description: Optional[str] + description: Optional[str] = None """ New description for the application (max length is 200 chars). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags for the application (maximum of 10 tags). """ @@ -2251,17 +2256,17 @@ class UpdateGroupRequest: ID of the group to update. """ - name: Optional[str] + name: Optional[str] = None """ New name for the group (max length is 64 chars). MUST be unique inside an Organization. """ - description: Optional[str] + description: Optional[str] = None """ New description for the group (max length is 200 chars). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags for the group (maximum of 10 tags). """ @@ -2269,17 +2274,17 @@ class UpdateGroupRequest: @dataclass class UpdateOrganizationSamlRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ - entity_id: Optional[str] + entity_id: Optional[str] = None """ Entity ID of the SAML Identity Provider. """ - single_sign_on_url: Optional[str] + single_sign_on_url: Optional[str] = None """ Single Sign-On URL of the SAML Identity Provider. """ @@ -2287,22 +2292,22 @@ class UpdateOrganizationSamlRequest: @dataclass class UpdateOrganizationSecuritySettingsRequest: - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the Organization. """ - enforce_password_renewal: Optional[bool] + enforce_password_renewal: Optional[bool] = False """ Defines whether password renewal is enforced during first login. """ - grace_period_duration: Optional[str] + grace_period_duration: Optional[str] = None """ Duration of the grace period to renew password or enable MFA. """ - login_attempts_before_locked: Optional[int] + login_attempts_before_locked: Optional[int] = 0 """ Number of login attempts before the account is locked. """ @@ -2315,40 +2320,39 @@ class UpdatePolicyRequest: Id of policy to update. """ - name: Optional[str] + name: Optional[str] = None """ New name for the policy (max length is 64 characters). """ - description: Optional[str] + description: Optional[str] = None """ New description of policy (max length is 200 characters). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags for the policy (maximum of 10 tags). """ - user_id: Optional[str] + user_id: Optional[str] = None - group_id: Optional[str] + group_id: Optional[str] = None - application_id: Optional[str] + application_id: Optional[str] = None - no_principal: Optional[bool] + no_principal: Optional[bool] = False @dataclass class UpdateSSHKeyRequest: ssh_key_id: str - - name: Optional[str] + name: Optional[str] = None """ Name of the SSH key. Max length is 1000. """ - disabled: Optional[bool] + disabled: Optional[bool] = False """ Enable or disable the SSH key. """ @@ -2374,32 +2378,32 @@ class UpdateUserRequest: ID of the user to update. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags for the user (maximum of 10 tags). """ - email: Optional[str] + email: Optional[str] = None """ IAM member email. """ - first_name: Optional[str] + first_name: Optional[str] = None """ IAM member first name. """ - last_name: Optional[str] + last_name: Optional[str] = None """ IAM member last name. """ - phone_number: Optional[str] + phone_number: Optional[str] = None """ IAM member phone number. """ - locale: Optional[str] + locale: Optional[str] = None """ IAM member locale. """ diff --git a/scaleway/scaleway/inference/v1/marshalling.py b/scaleway/scaleway/inference/v1/marshalling.py index 8fc4b104f..b28aeed98 100644 --- a/scaleway/scaleway/inference/v1/marshalling.py +++ b/scaleway/scaleway/inference/v1/marshalling.py @@ -10,6 +10,9 @@ resolve_one_of, ) from .types import ( + DeploymentStatus, + ModelStatus, + NodeTypeStock, EndpointPrivateNetworkDetails, EndpointPublicNetworkDetails, Endpoint, @@ -44,6 +47,8 @@ def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetwork field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None return EndpointPrivateNetworkDetails(**args) @@ -70,14 +75,20 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("disable_auth", None) if field is not None: args["disable_auth"] = field + else: + args["disable_auth"] = False field = data.get("public_network", None) if field is not None: @@ -105,14 +116,20 @@ def unmarshal_ModelSupportedQuantization(data: Any) -> ModelSupportedQuantizatio field = data.get("quantization_bits", None) if field is not None: args["quantization_bits"] = field + else: + args["quantization_bits"] = 0 field = data.get("allowed", None) if field is not None: args["allowed"] = field + else: + args["allowed"] = False field = data.get("max_context_size", None) if field is not None: args["max_context_size"] = field + else: + args["max_context_size"] = 0 return ModelSupportedQuantization(**args) @@ -128,6 +145,8 @@ def unmarshal_ModelSupportedNode(data: Any) -> ModelSupportedNode: field = data.get("node_type_name", None) if field is not None: args["node_type_name"] = field + else: + args["node_type_name"] = None field = data.get("quantizations", None) if field is not None: @@ -136,6 +155,8 @@ def unmarshal_ModelSupportedNode(data: Any) -> ModelSupportedNode: if field is not None else None ) + else: + args["quantizations"] = field(default_factory=list) return ModelSupportedNode(**args) @@ -155,6 +176,8 @@ def unmarshal_ModelSupportInfo(data: Any) -> ModelSupportInfo: if field is not None else None ) + else: + args["nodes"] = field(default_factory=list) return ModelSupportInfo(**args) @@ -170,6 +193,8 @@ def unmarshal_DeploymentQuantization(data: Any) -> DeploymentQuantization: field = data.get("bits", None) if field is not None: args["bits"] = field + else: + args["bits"] = None return DeploymentQuantization(**args) @@ -185,56 +210,82 @@ def unmarshal_Deployment(data: Any) -> Deployment: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DeploymentStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("node_type_name", None) if field is not None: args["node_type_name"] = field + else: + args["node_type_name"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 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("model_id", None) if field is not None: args["model_id"] = field + else: + args["model_id"] = None field = data.get("model_name", None) if field is not None: args["model_name"] = field + else: + args["model_name"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("error_message", None) if field is not None: @@ -274,34 +325,50 @@ def unmarshal_Model(data: Any) -> Model: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ModelStatus.UNKNOWN_STATUS field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("has_eula", None) if field is not None: args["has_eula"] = field + else: + args["has_eula"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("nodes_support", None) if field is not None: @@ -310,14 +377,20 @@ def unmarshal_Model(data: Any) -> Model: if field is not None else None ) + else: + args["nodes_support"] = field(default_factory=list) field = data.get("parameter_size_bits", None) if field is not None: args["parameter_size_bits"] = field + else: + args["parameter_size_bits"] = 0 field = data.get("size_bytes", None) if field is not None: args["size_bytes"] = field + else: + args["size_bytes"] = 0 field = data.get("error_message", None) if field is not None: @@ -353,10 +426,14 @@ def unmarshal_ListDeploymentsResponse(data: Any) -> ListDeploymentsResponse: args["deployments"] = ( [unmarshal_Deployment(v) for v in field] if field is not None else None ) + else: + args["deployments"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDeploymentsResponse(**args) @@ -374,10 +451,14 @@ def unmarshal_ListModelsResponse(data: Any) -> ListModelsResponse: args["models"] = ( [unmarshal_Model(v) for v in field] if field is not None else None ) + else: + args["models"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListModelsResponse(**args) @@ -393,42 +474,62 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN_STOCK field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("vram", None) if field is not None: args["vram"] = field + else: + args["vram"] = 0 field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("gpus", None) if field is not None: args["gpus"] = field + else: + args["gpus"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -458,10 +559,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -548,7 +653,9 @@ def marshal_CreateDeploymentRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.accept_eula is not None: output["accept_eula"] = request.accept_eula @@ -619,7 +726,9 @@ def marshal_CreateModelRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output diff --git a/scaleway/scaleway/inference/v1/types.py b/scaleway/scaleway/inference/v1/types.py index d69897b6a..38e55ab0b 100644 --- a/scaleway/scaleway/inference/v1/types.py +++ b/scaleway/scaleway/inference/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -139,9 +139,9 @@ class Endpoint: Defines whether the authentication is disabled. """ - public_network: Optional[EndpointPublicNetworkDetails] + public_network: Optional[EndpointPublicNetworkDetails] = None - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None @dataclass @@ -160,16 +160,15 @@ class EndpointSpec: When setting this field to true, the authentication will be disabled. """ - public_network: Optional[EndpointPublicNetworkDetails] + public_network: Optional[EndpointPublicNetworkDetails] = None - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None @dataclass class ModelSource: url: str - - secret: Optional[str] + secret: Optional[str] = None @dataclass @@ -239,22 +238,22 @@ class Deployment: Region of the deployment. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Displays information if your deployment is in error state. """ - quantization: Optional[DeploymentQuantization] + quantization: Optional[DeploymentQuantization] = None """ Quantization parameters for this deployment. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the deployment. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the deployment. """ @@ -317,17 +316,17 @@ class Model: Total size, in bytes, of the model files. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Displays information if your model is in error state. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the model. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the model. """ @@ -385,12 +384,12 @@ class NodeType: Region of the node type. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the node type. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the node type. """ @@ -413,43 +412,43 @@ class CreateDeploymentRequest: List of endpoints to create. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the deployment. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to create the deployment in. """ - accept_eula: Optional[bool] + accept_eula: Optional[bool] = False """ If the model has an EULA, you must accept it before proceeding. The terms of the EULA can be retrieved using the `GetModelEula` API call. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the deployment. """ - min_size: Optional[int] + min_size: Optional[int] = 0 """ Defines the minimum size of the pool. """ - max_size: Optional[int] + max_size: Optional[int] = 0 """ Defines the maximum size of the pool. """ - quantization: Optional[DeploymentQuantization] + quantization: Optional[DeploymentQuantization] = None """ Quantization settings to apply to this deployment. """ @@ -467,7 +466,7 @@ class CreateEndpointRequest: Specification of the endpoint. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -480,17 +479,17 @@ class CreateModelRequest: Where to import the model from. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the model. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to import the model in. """ @@ -503,7 +502,7 @@ class DeleteDeploymentRequest: ID of the deployment to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -516,7 +515,7 @@ class DeleteEndpointRequest: ID of the endpoint to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -529,7 +528,7 @@ class DeleteModelRequest: ID of the model to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -538,8 +537,7 @@ class DeleteModelRequest: @dataclass class GetDeploymentCertificateRequest: deployment_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -552,7 +550,7 @@ class GetDeploymentRequest: ID of the deployment to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -565,7 +563,7 @@ class GetModelRequest: ID of the model to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -573,42 +571,44 @@ class GetModelRequest: @dataclass class ListDeploymentsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of deployments to return per page. """ - order_by: Optional[ListDeploymentsRequestOrderBy] + order_by: Optional[ListDeploymentsRequestOrderBy] = ( + ListDeploymentsRequestOrderBy.CREATED_AT_DESC + ) """ Order in which to return results. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by deployment name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. """ @@ -629,37 +629,39 @@ class ListDeploymentsResponse: @dataclass class ListModelsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListModelsRequestOrderBy] + order_by: Optional[ListModelsRequestOrderBy] = ( + ListModelsRequestOrderBy.DISPLAY_RANK_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of models to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by model name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. """ @@ -685,17 +687,17 @@ class ListNodeTypesRequest: Include disabled node types in the response. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of node types to return per page. """ @@ -721,37 +723,37 @@ class UpdateDeploymentRequest: ID of the deployment to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the deployment. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the deployment. """ - min_size: Optional[int] + min_size: Optional[int] = 0 """ Defines the new minimum size of the pool. """ - max_size: Optional[int] + max_size: Optional[int] = 0 """ Defines the new maximum size of the pool. """ - model_id: Optional[str] + model_id: Optional[str] = None """ Id of the model to set to the deployment. """ - quantization: Optional[DeploymentQuantization] + quantization: Optional[DeploymentQuantization] = None """ Quantization to use to the deployment. """ @@ -764,12 +766,12 @@ class UpdateEndpointRequest: ID of the endpoint to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - disable_auth: Optional[bool] + disable_auth: Optional[bool] = False """ By default, deployments are protected by IAM authentication. When setting this field to true, the authentication will be disabled. diff --git a/scaleway/scaleway/inference/v1beta1/marshalling.py b/scaleway/scaleway/inference/v1beta1/marshalling.py index 8930c95d9..543130c27 100644 --- a/scaleway/scaleway/inference/v1beta1/marshalling.py +++ b/scaleway/scaleway/inference/v1beta1/marshalling.py @@ -10,6 +10,8 @@ resolve_one_of, ) from .types import ( + DeploymentStatus, + NodeTypeStock, EndpointPrivateNetworkDetails, EndpointPublicAccessDetails, Endpoint, @@ -49,6 +51,8 @@ def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetwork field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None return EndpointPrivateNetworkDetails(**args) @@ -75,14 +79,20 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None field = data.get("disable_auth", None) if field is not None: args["disable_auth"] = field + else: + args["disable_auth"] = False field = data.get("public_access", None) if field is not None: @@ -110,56 +120,82 @@ def unmarshal_Deployment(data: Any) -> Deployment: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DeploymentStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 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("model_name", None) if field is not None: args["model_name"] = field + else: + args["model_name"] = None field = data.get("model_id", None) if field is not None: args["model_id"] = field + else: + args["model_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("error_message", None) if field is not None: @@ -193,10 +229,14 @@ def unmarshal_ModelS3Model(data: Any) -> ModelS3Model: field = data.get("s3_url", None) if field is not None: args["s3_url"] = field + else: + args["s3_url"] = None field = data.get("python_dependencies", None) if field is not None: args["python_dependencies"] = field + else: + args["python_dependencies"] = None field = data.get("node_type", None) if field is not None: @@ -224,46 +264,68 @@ def unmarshal_Model(data: Any) -> Model: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("provider", None) if field is not None: args["provider"] = field + else: + args["provider"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("has_eula", None) if field is not None: args["has_eula"] = field + else: + args["has_eula"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("is_public", None) if field is not None: args["is_public"] = field + else: + args["is_public"] = False field = data.get("compatible_node_types", None) if field is not None: args["compatible_node_types"] = field + else: + args["compatible_node_types"] = field(default_factory=list) field = data.get("quantization_level", None) if field is not None: args["quantization_level"] = field + else: + args["quantization_level"] = None field = data.get("created_at", None) if field is not None: @@ -297,14 +359,20 @@ def unmarshal_ACLRule(data: Any) -> ACLRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None return ACLRule(**args) @@ -322,6 +390,8 @@ def unmarshal_AddDeploymentACLRulesResponse(data: Any) -> AddDeploymentACLRulesR args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return AddDeploymentACLRulesResponse(**args) @@ -337,6 +407,8 @@ def unmarshal_Eula(data: Any) -> Eula: field = data.get("content", None) if field is not None: args["content"] = field + else: + args["content"] = None return Eula(**args) @@ -356,10 +428,14 @@ def unmarshal_ListDeploymentACLRulesResponse( args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDeploymentACLRulesResponse(**args) @@ -377,10 +453,14 @@ def unmarshal_ListDeploymentsResponse(data: Any) -> ListDeploymentsResponse: args["deployments"] = ( [unmarshal_Deployment(v) for v in field] if field is not None else None ) + else: + args["deployments"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDeploymentsResponse(**args) @@ -398,10 +478,14 @@ def unmarshal_ListModelsResponse(data: Any) -> ListModelsResponse: args["models"] = ( [unmarshal_Model(v) for v in field] if field is not None else None ) + else: + args["models"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListModelsResponse(**args) @@ -417,42 +501,62 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN_STOCK field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("vram", None) if field is not None: args["vram"] = field + else: + args["vram"] = 0 field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("gpus", None) if field is not None: args["gpus"] = field + else: + args["gpus"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -482,10 +586,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -503,6 +611,8 @@ def unmarshal_SetDeploymentACLRulesResponse(data: Any) -> SetDeploymentACLRulesR args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return SetDeploymentACLRulesResponse(**args) @@ -606,7 +716,9 @@ def marshal_CreateDeploymentRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.accept_eula is not None: output["accept_eula"] = request.accept_eula diff --git a/scaleway/scaleway/inference/v1beta1/types.py b/scaleway/scaleway/inference/v1beta1/types.py index 1befe869c..86ea67df1 100644 --- a/scaleway/scaleway/inference/v1beta1/types.py +++ b/scaleway/scaleway/inference/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -105,20 +105,17 @@ class Endpoint: Defines whether the authentication is disabled. """ - public_access: Optional[EndpointPublicAccessDetails] + public_access: Optional[EndpointPublicAccessDetails] = None - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None @dataclass class ModelS3Model: s3_url: str - python_dependencies: Dict[str, str] - - node_type: Optional[str] - - triton_server_version: Optional[str] + node_type: Optional[str] = None + triton_server_version: Optional[str] = None @dataclass @@ -160,9 +157,9 @@ class EndpointSpec: When setting this field to true, the authentication will be disabled. """ - public: Optional[EndpointSpecPublic] + public: Optional[EndpointSpecPublic] = None - private_network: Optional[EndpointSpecPrivateNetwork] + private_network: Optional[EndpointSpecPrivateNetwork] = None @dataclass @@ -232,17 +229,17 @@ class Deployment: Region of the deployment. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Displays information if your deployment is in error state. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the deployment. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the deployment. """ @@ -305,17 +302,17 @@ class Model: Quantization level of the model. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the model. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the model. """ - s3_model: Optional[ModelS3Model] + s3_model: Optional[ModelS3Model] = None @dataclass @@ -370,12 +367,12 @@ class NodeType: Region of the node type. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the node type. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the node type. """ @@ -388,12 +385,12 @@ class AddDeploymentACLRulesRequest: ID of the deployment to add ACL rules to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - acls: Optional[List[ACLRuleRequest]] + acls: Optional[List[ACLRuleRequest]] = field(default_factory=list) """ List of ACL rules to add. """ @@ -424,38 +421,38 @@ class CreateDeploymentRequest: List of endpoints to create. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the deployment. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to create the deployment in. """ - accept_eula: Optional[bool] + accept_eula: Optional[bool] = False """ If the model has an EULA, you must accept it before proceeding. The terms of the EULA can be retrieved using the `GetModelEula` API call. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the deployment. """ - min_size: Optional[int] + min_size: Optional[int] = 0 """ Defines the minimum size of the pool. """ - max_size: Optional[int] + max_size: Optional[int] = 0 """ Defines the maximum size of the pool. """ @@ -473,7 +470,7 @@ class CreateEndpointRequest: Specification of the endpoint. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -486,7 +483,7 @@ class DeleteDeploymentACLRuleRequest: ID of the ACL rule to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -499,7 +496,7 @@ class DeleteDeploymentRequest: ID of the deployment to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -512,7 +509,7 @@ class DeleteEndpointRequest: ID of the endpoint to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -529,8 +526,7 @@ class Eula: @dataclass class GetDeploymentCertificateRequest: deployment_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -543,7 +539,7 @@ class GetDeploymentRequest: ID of the deployment to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -552,8 +548,7 @@ class GetDeploymentRequest: @dataclass class GetModelEulaRequest: model_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -566,7 +561,7 @@ class GetModelRequest: ID of the model to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -579,17 +574,17 @@ class ListDeploymentACLRulesRequest: ID of the deployment to list ACL rules for. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of ACL rules to return per page. """ @@ -610,42 +605,44 @@ class ListDeploymentACLRulesResponse: @dataclass class ListDeploymentsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of deployments to return per page. """ - order_by: Optional[ListDeploymentsRequestOrderBy] + order_by: Optional[ListDeploymentsRequestOrderBy] = ( + ListDeploymentsRequestOrderBy.CREATED_AT_DESC + ) """ Order in which to return results. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by deployment name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. """ @@ -666,37 +663,39 @@ class ListDeploymentsResponse: @dataclass class ListModelsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListModelsRequestOrderBy] + order_by: Optional[ListModelsRequestOrderBy] = ( + ListModelsRequestOrderBy.DISPLAY_RANK_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of models to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by model name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tags. """ @@ -722,17 +721,17 @@ class ListNodeTypesRequest: Include disabled node types in the response. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of node types to return per page. """ @@ -758,12 +757,12 @@ class SetDeploymentACLRulesRequest: ID of the deployment to set ACL rules for. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - acls: Optional[List[ACLRuleRequest]] + acls: Optional[List[ACLRuleRequest]] = field(default_factory=list) """ All existing ACL rules will be replaced by the new ones. """ @@ -784,27 +783,27 @@ class UpdateDeploymentRequest: ID of the deployment to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the deployment. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the deployment. """ - min_size: Optional[int] + min_size: Optional[int] = 0 """ Defines the new minimum size of the pool. """ - max_size: Optional[int] + max_size: Optional[int] = 0 """ Defines the new maximum size of the pool. """ @@ -817,12 +816,12 @@ class UpdateEndpointRequest: ID of the endpoint to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - disable_auth: Optional[bool] + disable_auth: Optional[bool] = False """ By default, deployments are protected by IAM authentication. When setting this field to true, the authentication will be disabled. diff --git a/scaleway/scaleway/instance/v1/marshalling.py b/scaleway/scaleway/instance/v1/marshalling.py index efcebf457..3384c73d2 100644 --- a/scaleway/scaleway/instance/v1/marshalling.py +++ b/scaleway/scaleway/instance/v1/marshalling.py @@ -21,8 +21,22 @@ _SetSnapshotRequest, ) from .types import ( + Arch, BootType, + PlacementGroupPolicyMode, + PlacementGroupPolicyType, + PrivateNICState, + SecurityGroupPolicy, + SecurityGroupState, ServerAction, + ServerIpIpFamily, + ServerIpProvisioningMode, + ServerIpState, + ServerState, + SnapshotState, + TaskStatus, + VolumeState, + VolumeVolumeType, PrivateNIC, ServerSummary, Bootscript, @@ -163,26 +177,38 @@ def unmarshal_PrivateNIC(data: Any) -> PrivateNIC: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("server_id", None) if field is not None: args["server_id"] = field + else: + args["server_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("mac_address", None) if field is not None: args["mac_address"] = field + else: + args["mac_address"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = PrivateNICState.AVAILABLE field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) return PrivateNIC(**args) @@ -198,10 +224,14 @@ def unmarshal_ServerSummary(data: Any) -> ServerSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return ServerSummary(**args) @@ -217,50 +247,74 @@ def unmarshal_Bootscript(data: Any) -> Bootscript: field = data.get("architecture", None) if field is not None: args["architecture"] = field + else: + args["architecture"] = None field = data.get("bootcmdargs", None) if field is not None: args["bootcmdargs"] = field + else: + args["bootcmdargs"] = None field = data.get("default", None) if field is not None: args["default"] = field + else: + args["default"] = None field = data.get("dtb", None) if field is not None: args["dtb"] = field + else: + args["dtb"] = None field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("initrd", None) if field is not None: args["initrd"] = field + else: + args["initrd"] = None field = data.get("kernel", None) if field is not None: args["kernel"] = field + else: + args["kernel"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("public", None) if field is not None: args["public"] = field + else: + args["public"] = None field = data.get("title", None) if field is not None: args["title"] = field + else: + args["title"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return Bootscript(**args) @@ -276,26 +330,38 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = VolumeVolumeType.L_SSD field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("export_uri", None) if field is not None: @@ -322,14 +388,20 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = VolumeState.AVAILABLE field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("server", None) if field is not None: @@ -351,18 +423,26 @@ def unmarshal_VolumeSummary(data: Any) -> VolumeSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = None return VolumeSummary(**args) @@ -378,14 +458,20 @@ def unmarshal_Image(data: Any) -> Image: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = None field = data.get("extra_volumes", None) if field is not None: @@ -394,14 +480,20 @@ def unmarshal_Image(data: Any) -> Image: if field is not None else None ) + else: + args["extra_volumes"] = None field = data.get("from_server", None) if field is not None: args["from_server"] = field + else: + args["from_server"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("creation_date", None) if field is not None: @@ -428,22 +520,32 @@ def unmarshal_Image(data: Any) -> Image: field = data.get("public", None) if field is not None: args["public"] = field + else: + args["public"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("root_volume", None) if field is not None: @@ -465,38 +567,56 @@ def unmarshal_PlacementGroup(data: Any) -> PlacementGroup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("policy_mode", None) if field is not None: args["policy_mode"] = field + else: + args["policy_mode"] = PlacementGroupPolicyMode.OPTIONAL field = data.get("policy_type", None) if field is not None: args["policy_type"] = field + else: + args["policy_type"] = PlacementGroupPolicyType.MAX_AVAILABILITY field = data.get("policy_respected", None) if field is not None: args["policy_respected"] = field + else: + args["policy_respected"] = False field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return PlacementGroup(**args) @@ -512,10 +632,14 @@ def unmarshal_SecurityGroupSummary(data: Any) -> SecurityGroupSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return SecurityGroupSummary(**args) @@ -531,10 +655,14 @@ def unmarshal_ServerFilesystem(data: Any) -> ServerFilesystem: field = data.get("filesystem_id", None) if field is not None: args["filesystem_id"] = field + else: + args["filesystem_id"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None return ServerFilesystem(**args) @@ -550,42 +678,62 @@ def unmarshal_ServerIp(data: Any) -> ServerIp: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("gateway", None) if field is not None: args["gateway"] = field + else: + args["gateway"] = None field = data.get("netmask", None) if field is not None: args["netmask"] = field + else: + args["netmask"] = None field = data.get("family", None) if field is not None: args["family"] = field + else: + args["family"] = ServerIpIpFamily.INET field = data.get("dynamic", None) if field is not None: args["dynamic"] = field + else: + args["dynamic"] = False field = data.get("provisioning_mode", None) if field is not None: args["provisioning_mode"] = field + else: + args["provisioning_mode"] = ServerIpProvisioningMode.MANUAL field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("ipam_id", None) if field is not None: args["ipam_id"] = field + else: + args["ipam_id"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = ServerIpState.UNKNOWN_STATE return ServerIp(**args) @@ -601,14 +749,20 @@ def unmarshal_ServerIpv6(data: Any) -> ServerIpv6: field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("gateway", None) if field is not None: args["gateway"] = field + else: + args["gateway"] = None field = data.get("netmask", None) if field is not None: args["netmask"] = field + else: + args["netmask"] = None return ServerIpv6(**args) @@ -624,22 +778,32 @@ def unmarshal_ServerLocation(data: Any) -> ServerLocation: field = data.get("cluster_id", None) if field is not None: args["cluster_id"] = field + else: + args["cluster_id"] = None field = data.get("hypervisor_id", None) if field is not None: args["hypervisor_id"] = field + else: + args["hypervisor_id"] = None field = data.get("node_id", None) if field is not None: args["node_id"] = field + else: + args["node_id"] = None field = data.get("platform_id", None) if field is not None: args["platform_id"] = field + else: + args["platform_id"] = None field = data.get("zone_id", None) if field is not None: args["zone_id"] = field + else: + args["zone_id"] = None return ServerLocation(**args) @@ -655,6 +819,8 @@ def unmarshal_ServerMaintenance(data: Any) -> ServerMaintenance: field = data.get("reason", None) if field is not None: args["reason"] = field + else: + args["reason"] = None field = data.get("start_date", None) if field is not None: @@ -676,6 +842,8 @@ def unmarshal_VolumeServer(data: Any) -> VolumeServer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: @@ -710,14 +878,20 @@ def unmarshal_VolumeServer(data: Any) -> VolumeServer: field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = None field = data.get("boot", None) if field is not None: args["boot"] = field + else: + args["boot"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("creation_date", None) if field is not None: @@ -761,32 +935,46 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("allowed_actions", None) if field is not None: args["allowed_actions"] = ( [ServerAction(v) for v in field] if field is not None else None ) + else: + args["allowed_actions"] = field(default_factory=list) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("commercial_type", None) if field is not None: args["commercial_type"] = field + else: + args["commercial_type"] = None field = data.get("creation_date", None) if field is not None: @@ -799,26 +987,32 @@ def unmarshal_Server(data: Any) -> Server: field = data.get("dynamic_ip_required", None) if field is not None: args["dynamic_ip_required"] = field + else: + args["dynamic_ip_required"] = False field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("routed_ip_enabled", None) if field is not None: args["routed_ip_enabled"] = field else: - args["routed_ip_enabled"] = None + args["routed_ip_enabled"] = False field = data.get("enable_ipv6", None) if field is not None: args["enable_ipv6"] = field else: - args["enable_ipv6"] = None + args["enable_ipv6"] = False field = data.get("image", None) if field is not None: @@ -843,18 +1037,26 @@ def unmarshal_Server(data: Any) -> Server: args["public_ips"] = ( [unmarshal_ServerIp(v) for v in field] if field is not None else None ) + else: + args["public_ips"] = field(default_factory=list) field = data.get("mac_address", None) if field is not None: args["mac_address"] = field + else: + args["mac_address"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = ServerState.RUNNING field = data.get("boot_type", None) if field is not None: args["boot_type"] = field + else: + args["boot_type"] = BootType.LOCAL field = data.get("volumes", None) if field is not None: @@ -863,6 +1065,8 @@ def unmarshal_Server(data: Any) -> Server: if field is not None else None ) + else: + args["volumes"] = field(default_factory=dict) field = data.get("maintenances", None) if field is not None: @@ -871,14 +1075,20 @@ def unmarshal_Server(data: Any) -> Server: if field is not None else None ) + else: + args["maintenances"] = field(default_factory=list) field = data.get("state_detail", None) if field is not None: args["state_detail"] = field + else: + args["state_detail"] = None field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = Arch.UNKNOWN_ARCH field = data.get("modification_date", None) if field is not None: @@ -917,10 +1127,14 @@ def unmarshal_Server(data: Any) -> Server: args["private_nics"] = ( [unmarshal_PrivateNIC(v) for v in field] if field is not None else None ) + else: + args["private_nics"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("filesystems", None) if field is not None: @@ -929,10 +1143,14 @@ def unmarshal_Server(data: Any) -> Server: if field is not None else None ) + else: + args["filesystems"] = field(default_factory=list) field = data.get("end_of_service", None) if field is not None: args["end_of_service"] = field + else: + args["end_of_service"] = False field = data.get("admin_password_encryption_ssh_key_id", None) if field is not None: @@ -1013,42 +1231,62 @@ def unmarshal_Ip(data: Any) -> Ip: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None field = data.get("prefix", None) if field is not None: args["prefix"] = field + else: + args["prefix"] = None field = data.get("ipam_id", None) if field is not None: args["ipam_id"] = field + else: + args["ipam_id"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("reverse", None) if field is not None: @@ -1127,66 +1365,94 @@ def unmarshal_SecurityGroup(data: Any) -> SecurityGroup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("enable_default_security", None) if field is not None: args["enable_default_security"] = field + else: + args["enable_default_security"] = False field = data.get("inbound_default_policy", None) if field is not None: args["inbound_default_policy"] = field + else: + args["inbound_default_policy"] = SecurityGroupPolicy.UNKNOWN_POLICY field = data.get("outbound_default_policy", None) if field is not None: args["outbound_default_policy"] = field + else: + args["outbound_default_policy"] = SecurityGroupPolicy.UNKNOWN_POLICY field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("project_default", None) if field is not None: args["project_default"] = field + else: + args["project_default"] = False field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_ServerSummary(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) field = data.get("stateful", None) if field is not None: args["stateful"] = field + else: + args["stateful"] = False field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = SecurityGroupState.AVAILABLE field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("organization_default", None) if field is not None: args["organization_default"] = field else: - args["organization_default"] = None + args["organization_default"] = False field = data.get("creation_date", None) if field is not None: @@ -1235,34 +1501,50 @@ def unmarshal_SecurityGroupRule(data: Any) -> SecurityGroupRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = None field = data.get("direction", None) if field is not None: args["direction"] = field + else: + args["direction"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = None field = data.get("ip_range", None) if field is not None: args["ip_range"] = field + else: + args["ip_range"] = None field = data.get("position", None) if field is not None: args["position"] = field + else: + args["position"] = None field = data.get("editable", None) if field is not None: args["editable"] = field + else: + args["editable"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("dest_port_from", None) if field is not None: @@ -1326,10 +1608,14 @@ def unmarshal_SnapshotBaseVolume(data: Any) -> SnapshotBaseVolume: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return SnapshotBaseVolume(**args) @@ -1345,38 +1631,56 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization", None) if field is not None: args["organization"] = field + else: + args["organization"] = None field = data.get("project", None) if field is not None: args["project"] = field + else: + args["project"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = VolumeVolumeType.L_SSD field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = SnapshotState.AVAILABLE field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("base_volume", None) if field is not None: @@ -1420,30 +1724,44 @@ def unmarshal_Task(data: Any) -> Task: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("progress", None) if field is not None: args["progress"] = field + else: + args["progress"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TaskStatus.PENDING field = data.get("href_from", None) if field is not None: args["href_from"] = field + else: + args["href_from"] = None field = data.get("href_result", None) if field is not None: args["href_result"] = field + else: + args["href_result"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("started_at", None) if field is not None: @@ -1566,54 +1884,80 @@ def unmarshal_Dashboard(data: Any) -> Dashboard: field = data.get("volumes_count", None) if field is not None: args["volumes_count"] = field + else: + args["volumes_count"] = None field = data.get("running_servers_count", None) if field is not None: args["running_servers_count"] = field + else: + args["running_servers_count"] = None field = data.get("servers_by_types", None) if field is not None: args["servers_by_types"] = field + else: + args["servers_by_types"] = None field = data.get("images_count", None) if field is not None: args["images_count"] = field + else: + args["images_count"] = None field = data.get("snapshots_count", None) if field is not None: args["snapshots_count"] = field + else: + args["snapshots_count"] = None field = data.get("servers_count", None) if field is not None: args["servers_count"] = field + else: + args["servers_count"] = None field = data.get("ips_count", None) if field is not None: args["ips_count"] = field + else: + args["ips_count"] = None field = data.get("security_groups_count", None) if field is not None: args["security_groups_count"] = field + else: + args["security_groups_count"] = None field = data.get("ips_unused", None) if field is not None: args["ips_unused"] = field + else: + args["ips_unused"] = None field = data.get("volumes_l_ssd_count", None) if field is not None: args["volumes_l_ssd_count"] = field + else: + args["volumes_l_ssd_count"] = None field = data.get("volumes_l_ssd_total_size", None) if field is not None: args["volumes_l_ssd_total_size"] = field + else: + args["volumes_l_ssd_total_size"] = None field = data.get("private_nics_count", None) if field is not None: args["private_nics_count"] = field + else: + args["private_nics_count"] = None field = data.get("placement_groups_count", None) if field is not None: args["placement_groups_count"] = field + else: + args["placement_groups_count"] = None field = data.get("volumes_b_ssd_count", None) if field is not None: @@ -1709,14 +2053,20 @@ def unmarshal_PlacementGroupServer(data: Any) -> PlacementGroupServer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("policy_respected", None) if field is not None: args["policy_respected"] = field + else: + args["policy_respected"] = False return PlacementGroupServer(**args) @@ -1738,6 +2088,8 @@ def unmarshal_GetPlacementGroupServersResponse( if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return GetPlacementGroupServersResponse(**args) @@ -1823,6 +2175,8 @@ def unmarshal_GetServerTypesAvailabilityResponseAvailability( field = data.get("availability", None) if field is not None: args["availability"] = field + else: + args["availability"] = None return GetServerTypesAvailabilityResponseAvailability(**args) @@ -1847,10 +2201,14 @@ def unmarshal_GetServerTypesAvailabilityResponse( if field is not None else None ) + else: + args["servers"] = field(default_factory=dict) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return GetServerTypesAvailabilityResponse(**args) @@ -1900,12 +2258,16 @@ def unmarshal_ListImagesResponse(data: Any) -> ListImagesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("images", None) if field is not None: args["images"] = ( [unmarshal_Image(v) for v in field] if field is not None else None ) + else: + args["images"] = field(default_factory=list) return ListImagesResponse(**args) @@ -1921,10 +2283,14 @@ def unmarshal_ListIpsResponse(data: Any) -> ListIpsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_Ip(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) return ListIpsResponse(**args) @@ -1940,12 +2306,16 @@ def unmarshal_ListPlacementGroupsResponse(data: Any) -> ListPlacementGroupsRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("placement_groups", None) if field is not None: args["placement_groups"] = ( [unmarshal_PlacementGroup(v) for v in field] if field is not None else None ) + else: + args["placement_groups"] = field(default_factory=list) return ListPlacementGroupsResponse(**args) @@ -1963,10 +2333,14 @@ def unmarshal_ListPrivateNICsResponse(data: Any) -> ListPrivateNICsResponse: args["private_nics"] = ( [unmarshal_PrivateNIC(v) for v in field] if field is not None else None ) + else: + args["private_nics"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListPrivateNICsResponse(**args) @@ -1984,6 +2358,8 @@ def unmarshal_ListSecurityGroupRulesResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("rules", None) if field is not None: @@ -1992,6 +2368,8 @@ def unmarshal_ListSecurityGroupRulesResponse( if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return ListSecurityGroupRulesResponse(**args) @@ -2007,12 +2385,16 @@ def unmarshal_ListSecurityGroupsResponse(data: Any) -> ListSecurityGroupsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("security_groups", None) if field is not None: args["security_groups"] = ( [unmarshal_SecurityGroup(v) for v in field] if field is not None else None ) + else: + args["security_groups"] = field(default_factory=list) return ListSecurityGroupsResponse(**args) @@ -2030,6 +2412,8 @@ def unmarshal_ListServerActionsResponse(data: Any) -> ListServerActionsResponse: args["actions"] = ( [ServerAction(v) for v in field] if field is not None else None ) + else: + args["actions"] = None return ListServerActionsResponse(**args) @@ -2045,6 +2429,8 @@ def unmarshal_ListServerUserDataResponse(data: Any) -> ListServerUserDataRespons field = data.get("user_data", None) if field is not None: args["user_data"] = field + else: + args["user_data"] = None return ListServerUserDataResponse(**args) @@ -2060,12 +2446,16 @@ def unmarshal_ListServersResponse(data: Any) -> ListServersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: args["servers"] = ( [unmarshal_Server(v) for v in field] if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return ListServersResponse(**args) @@ -2082,13 +2472,13 @@ def unmarshal_ServerTypeNetworkInterface(data: Any) -> ServerTypeNetworkInterfac if field is not None: args["internal_bandwidth"] = field else: - args["internal_bandwidth"] = None + args["internal_bandwidth"] = 0 field = data.get("internet_bandwidth", None) if field is not None: args["internet_bandwidth"] = field else: - args["internet_bandwidth"] = None + args["internet_bandwidth"] = 0 return ServerTypeNetworkInterface(**args) @@ -2106,10 +2496,14 @@ def unmarshal_ServerTypeVolumeConstraintSizes( 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 return ServerTypeVolumeConstraintSizes(**args) @@ -2125,16 +2519,20 @@ def unmarshal_ServerTypeCapabilities(data: Any) -> ServerTypeCapabilities: field = data.get("boot_types", None) if field is not None: args["boot_types"] = [BootType(v) for v in field] if field is not None else None + else: + args["boot_types"] = field(default_factory=list) field = data.get("max_file_systems", None) if field is not None: args["max_file_systems"] = field + else: + args["max_file_systems"] = 0 field = data.get("block_storage", None) if field is not None: args["block_storage"] = field else: - args["block_storage"] = None + args["block_storage"] = False return ServerTypeCapabilities(**args) @@ -2150,14 +2548,20 @@ def unmarshal_ServerTypeGPUInfo(data: Any) -> ServerTypeGPUInfo: field = data.get("gpu_manufacturer", None) if field is not None: args["gpu_manufacturer"] = field + else: + args["gpu_manufacturer"] = None field = data.get("gpu_name", None) if field is not None: args["gpu_name"] = field + else: + args["gpu_name"] = None field = data.get("gpu_memory", None) if field is not None: args["gpu_memory"] = field + else: + args["gpu_memory"] = 0 return ServerTypeGPUInfo(**args) @@ -2177,22 +2581,26 @@ def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork: if field is not None else None ) + else: + args["interfaces"] = field(default_factory=list) field = data.get("ipv6_support", None) if field is not None: args["ipv6_support"] = field + else: + args["ipv6_support"] = False field = data.get("sum_internal_bandwidth", None) if field is not None: args["sum_internal_bandwidth"] = field else: - args["sum_internal_bandwidth"] = None + args["sum_internal_bandwidth"] = 0 field = data.get("sum_internet_bandwidth", None) if field is not None: args["sum_internet_bandwidth"] = field else: - args["sum_internet_bandwidth"] = None + args["sum_internet_bandwidth"] = 0 return ServerTypeNetwork(**args) @@ -2228,31 +2636,43 @@ def unmarshal_ServerType(data: Any) -> ServerType: if field is not None: args["monthly_price"] = field else: - args["monthly_price"] = None + args["monthly_price"] = 0.0 field = data.get("hourly_price", None) if field is not None: args["hourly_price"] = field + else: + args["hourly_price"] = 0.0 field = data.get("alt_names", None) if field is not None: args["alt_names"] = field + else: + args["alt_names"] = field(default_factory=list) field = data.get("ncpus", None) if field is not None: args["ncpus"] = field + else: + args["ncpus"] = 0 field = data.get("ram", None) if field is not None: args["ram"] = field + else: + args["ram"] = 0 field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = Arch.UNKNOWN_ARCH field = data.get("end_of_service", None) if field is not None: args["end_of_service"] = field + else: + args["end_of_service"] = False field = data.get("per_volume_constraint", None) if field is not None: @@ -2272,7 +2692,7 @@ def unmarshal_ServerType(data: Any) -> ServerType: if field is not None: args["gpu"] = field else: - args["gpu"] = None + args["gpu"] = 0 field = data.get("gpu_info", None) if field is not None: @@ -2296,13 +2716,13 @@ def unmarshal_ServerType(data: Any) -> ServerType: if field is not None: args["scratch_storage_max_size"] = field else: - args["scratch_storage_max_size"] = None + args["scratch_storage_max_size"] = 0 field = data.get("block_bandwidth", None) if field is not None: args["block_bandwidth"] = field else: - args["block_bandwidth"] = None + args["block_bandwidth"] = 0 return ServerType(**args) @@ -2318,6 +2738,8 @@ def unmarshal_ListServersTypesResponse(data: Any) -> ListServersTypesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("servers", None) if field is not None: @@ -2326,6 +2748,8 @@ def unmarshal_ListServersTypesResponse(data: Any) -> ListServersTypesResponse: if field is not None else None ) + else: + args["servers"] = field(default_factory=dict) return ListServersTypesResponse(**args) @@ -2341,12 +2765,16 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("snapshots", None) if field is not None: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) return ListSnapshotsResponse(**args) @@ -2362,12 +2790,16 @@ def unmarshal_ListVolumesResponse(data: Any) -> ListVolumesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("volumes", None) if field is not None: args["volumes"] = ( [unmarshal_Volume(v) for v in field] if field is not None else None ) + else: + args["volumes"] = field(default_factory=list) return ListVolumesResponse(**args) @@ -2383,6 +2815,8 @@ def unmarshal_VolumeTypeCapabilities(data: Any) -> VolumeTypeCapabilities: field = data.get("snapshot", None) if field is not None: args["snapshot"] = field + else: + args["snapshot"] = None return VolumeTypeCapabilities(**args) @@ -2398,10 +2832,14 @@ def unmarshal_VolumeTypeConstraints(data: Any) -> VolumeTypeConstraints: field = data.get("min", None) if field is not None: args["min"] = field + else: + args["min"] = None field = data.get("max", None) if field is not None: args["max"] = field + else: + args["max"] = None return VolumeTypeConstraints(**args) @@ -2417,6 +2855,8 @@ def unmarshal_VolumeType(data: Any) -> VolumeType: field = data.get("display_name", None) if field is not None: args["display_name"] = field + else: + args["display_name"] = None field = data.get("capabilities", None) if field is not None: @@ -2444,6 +2884,8 @@ def unmarshal_ListVolumesTypesResponse(data: Any) -> ListVolumesTypesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("volumes", None) if field is not None: @@ -2452,6 +2894,8 @@ def unmarshal_ListVolumesTypesResponse(data: Any) -> ListVolumesTypesResponse: if field is not None else None ) + else: + args["volumes"] = field(default_factory=dict) return ListVolumesTypesResponse(**args) @@ -2469,10 +2913,14 @@ def unmarshal_MigrationPlan(data: Any) -> MigrationPlan: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("validation_key", None) if field is not None: args["validation_key"] = field + else: + args["validation_key"] = None field = data.get("volume", None) if field is not None: @@ -2511,6 +2959,8 @@ def unmarshal_ServerCompatibleTypes(data: Any) -> ServerCompatibleTypes: field = data.get("compatible_types", None) if field is not None: args["compatible_types"] = field + else: + args["compatible_types"] = field(default_factory=list) return ServerCompatibleTypes(**args) @@ -2549,6 +2999,8 @@ def unmarshal_SetPlacementGroupServersResponse( if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return SetPlacementGroupServersResponse(**args) @@ -2568,6 +3020,8 @@ def unmarshal_SetSecurityGroupRulesResponse(data: Any) -> SetSecurityGroupRulesR if field is not None else None ) + else: + args["rules"] = None return SetSecurityGroupRulesResponse(**args) @@ -2640,6 +3094,8 @@ def unmarshal_UpdatePlacementGroupServersResponse( if field is not None else None ) + else: + args["servers"] = field(default_factory=list) return UpdatePlacementGroupServersResponse(**args) @@ -2862,7 +3318,7 @@ def marshal_AttachServerVolumeRequest( output["volume_id"] = request.volume_id if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.boot is not None: output["boot"] = request.boot @@ -2877,9 +3333,9 @@ def marshal_CheckBlockMigrationOrganizationQuotasRequest( output: Dict[str, Any] = {} if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id return output @@ -2918,7 +3374,7 @@ def marshal_VolumeTemplate( output["size"] = request.size if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -2951,7 +3407,7 @@ def marshal_CreateImageRequest( output["root_volume"] = request.root_volume if request.arch is not None: - output["arch"] = str(request.arch) + output["arch"] = request.arch if request.name is not None: output["name"] = request.name @@ -3002,7 +3458,7 @@ def marshal_CreateIpRequest( output["server"] = request.server if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ return output @@ -3038,10 +3494,10 @@ def marshal_CreatePlacementGroupRequest( output["tags"] = request.tags if request.policy_mode is not None: - output["policy_mode"] = str(request.policy_mode) + output["policy_mode"] = request.policy_mode if request.policy_type is not None: - output["policy_type"] = str(request.policy_type) + output["policy_type"] = request.policy_type return output @@ -3120,10 +3576,10 @@ def marshal_CreateSecurityGroupRequest( output["tags"] = request.tags if request.inbound_default_policy is not None: - output["inbound_default_policy"] = str(request.inbound_default_policy) + output["inbound_default_policy"] = request.inbound_default_policy if request.outbound_default_policy is not None: - output["outbound_default_policy"] = str(request.outbound_default_policy) + output["outbound_default_policy"] = request.outbound_default_policy if request.enable_default_security is not None: output["enable_default_security"] = request.enable_default_security @@ -3138,13 +3594,13 @@ def marshal_CreateSecurityGroupRuleRequest( output: Dict[str, Any] = {} if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.direction is not None: - output["direction"] = str(request.direction) + output["direction"] = request.direction if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.ip_range is not None: output["ip_range"] = request.ip_range @@ -3171,7 +3627,7 @@ def marshal_VolumeServerTemplate( output: Dict[str, Any] = {} if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.id is not None: output["id"] = request.id @@ -3255,7 +3711,7 @@ def marshal_CreateServerRequest( output["public_ips"] = request.public_ips if request.boot_type is not None: - output["boot_type"] = str(request.boot_type) + output["boot_type"] = request.boot_type if request.tags is not None: output["tags"] = request.tags @@ -3308,7 +3764,7 @@ def marshal_CreateSnapshotRequest( output["tags"] = request.tags if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.bucket is not None: output["bucket"] = request.bucket @@ -3365,7 +3821,7 @@ def marshal_CreateVolumeRequest( output["tags"] = request.tags if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -3437,7 +3893,7 @@ def marshal_ServerActionRequestVolumeBackupTemplate( output: Dict[str, Any] = {} if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -3449,7 +3905,7 @@ def marshal_ServerActionRequest( output: Dict[str, Any] = {} if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.name is not None: output["name"] = request.name @@ -3488,7 +3944,7 @@ def marshal_Bootscript( output: Dict[str, Any] = {} if request.architecture is not None: - output["architecture"] = str(request.architecture) + output["architecture"] = request.architecture if request.bootcmdargs is not None: output["bootcmdargs"] = request.bootcmdargs @@ -3509,9 +3965,9 @@ def marshal_Bootscript( output["kernel"] = request.kernel if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.public is not None: output["public"] = request.public @@ -3520,10 +3976,14 @@ def marshal_Bootscript( output["title"] = request.title if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone return output @@ -3544,15 +4004,17 @@ def marshal_Volume( output["size"] = request.size if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.export_uri is not None: output["export_uri"] = request.export_uri @@ -3567,10 +4029,12 @@ def marshal_Volume( output["tags"] = request.tags if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone if request.server is not None: output["server"] = marshal_ServerSummary(request.server, defaults) @@ -3594,7 +4058,7 @@ def marshal_VolumeSummary( output["size"] = request.size if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -3609,7 +4073,7 @@ def marshal_SetImageRequest( output["name"] = request.name if request.arch is not None: - output["arch"] = str(request.arch) + output["arch"] = request.arch if request.creation_date is not None: output["creation_date"] = request.creation_date.isoformat() @@ -3635,18 +4099,20 @@ def marshal_SetImageRequest( } if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.root_volume is not None: output["root_volume"] = marshal_VolumeSummary(request.root_volume, defaults) if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -3664,18 +4130,20 @@ def marshal_SetPlacementGroupRequest( output["name"] = request.name if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.policy_mode is not None: - output["policy_mode"] = str(request.policy_mode) + output["policy_mode"] = request.policy_mode if request.policy_type is not None: - output["policy_type"] = str(request.policy_type) + output["policy_type"] = request.policy_type if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -3702,13 +4170,13 @@ def marshal_SetSecurityGroupRulesRequestRule( output: Dict[str, Any] = {} if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.direction is not None: - output["direction"] = str(request.direction) + output["direction"] = request.direction if request.ip_range is not None: output["ip_range"] = request.ip_range @@ -3771,7 +4239,7 @@ def marshal_UpdateImageRequest( output["name"] = request.name if request.arch is not None: - output["arch"] = str(request.arch) + output["arch"] = request.arch if request.extra_volumes is not None: output["extra_volumes"] = { @@ -3798,7 +4266,7 @@ def marshal_UpdateIpRequest( output["reverse"] = request.reverse if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.tags is not None: output["tags"] = request.tags @@ -3822,10 +4290,10 @@ def marshal_UpdatePlacementGroupRequest( output["tags"] = request.tags if request.policy_mode is not None: - output["policy_mode"] = str(request.policy_mode) + output["policy_mode"] = request.policy_mode if request.policy_type is not None: - output["policy_type"] = str(request.policy_type) + output["policy_type"] = request.policy_type return output @@ -3870,7 +4338,7 @@ def marshal_UpdateSecurityGroupRequest( output["enable_default_security"] = request.enable_default_security if request.inbound_default_policy is not None: - output["inbound_default_policy"] = str(request.inbound_default_policy) + output["inbound_default_policy"] = request.inbound_default_policy if request.tags is not None: output["tags"] = request.tags @@ -3882,7 +4350,7 @@ def marshal_UpdateSecurityGroupRequest( output["project_default"] = request.project_default if request.outbound_default_policy is not None: - output["outbound_default_policy"] = str(request.outbound_default_policy) + output["outbound_default_policy"] = request.outbound_default_policy if request.stateful is not None: output["stateful"] = request.stateful @@ -3897,13 +4365,13 @@ def marshal_UpdateSecurityGroupRuleRequest( output: Dict[str, Any] = {} if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.direction is not None: - output["direction"] = str(request.direction) + output["direction"] = request.direction if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.ip_range is not None: output["ip_range"] = request.ip_range @@ -3945,7 +4413,7 @@ def marshal_UpdateServerRequest( output["name"] = request.name if request.boot_type is not None: - output["boot_type"] = str(request.boot_type) + output["boot_type"] = request.boot_type if request.tags is not None: output["tags"] = request.tags @@ -4057,18 +4525,20 @@ def marshal__SetSecurityGroupRequest( output["stateful"] = request.stateful if request.inbound_default_policy is not None: - output["inbound_default_policy"] = str(request.inbound_default_policy) + output["inbound_default_policy"] = request.inbound_default_policy if request.outbound_default_policy is not None: - output["outbound_default_policy"] = str(request.outbound_default_policy) + output["outbound_default_policy"] = request.outbound_default_policy if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.organization_default is not None: output["organization_default"] = request.organization_default @@ -4100,13 +4570,13 @@ def marshal__SetSecurityGroupRuleRequest( output["editable"] = request.editable if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.direction is not None: - output["direction"] = str(request.direction) + output["direction"] = request.direction if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.dest_port_from is not None: output["dest_port_from"] = request.dest_port_from @@ -4130,7 +4600,7 @@ def marshal_Image( output["name"] = request.name if request.arch is not None: - output["arch"] = str(request.arch) + output["arch"] = request.arch if request.extra_volumes is not None: output["extra_volumes"] = { @@ -4142,9 +4612,9 @@ def marshal_Image( output["from_server"] = request.from_server if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.creation_date is not None: output["creation_date"] = request.creation_date.isoformat() @@ -4161,16 +4631,20 @@ def marshal_Image( output["public"] = request.public if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone if request.root_volume is not None: output["root_volume"] = marshal_VolumeSummary(request.root_volume, defaults) @@ -4191,27 +4665,31 @@ def marshal_PlacementGroup( output["name"] = request.name if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags if request.policy_mode is not None: - output["policy_mode"] = str(request.policy_mode) + output["policy_mode"] = request.policy_mode if request.policy_type is not None: - output["policy_type"] = str(request.policy_type) + output["policy_type"] = request.policy_type if request.policy_respected is not None: output["policy_respected"] = request.policy_respected if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone return output @@ -4235,7 +4713,7 @@ def marshal_PrivateNIC( output["mac_address"] = request.mac_address if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.tags is not None: output["tags"] = request.tags @@ -4277,13 +4755,13 @@ def marshal_ServerIp( output["netmask"] = request.netmask if request.family is not None: - output["family"] = str(request.family) + output["family"] = request.family if request.dynamic is not None: output["dynamic"] = request.dynamic if request.provisioning_mode is not None: - output["provisioning_mode"] = str(request.provisioning_mode) + output["provisioning_mode"] = request.provisioning_mode if request.tags is not None: output["tags"] = request.tags @@ -4292,7 +4770,7 @@ def marshal_ServerIp( output["ipam_id"] = request.ipam_id if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state return output @@ -4367,9 +4845,9 @@ def marshal__SetServerRequest( output["commercial_type"] = request.commercial_type if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.dynamic_ip_required is not None: output["dynamic_ip_required"] = request.dynamic_ip_required @@ -4384,7 +4862,9 @@ def marshal__SetServerRequest( output["state_detail"] = request.state_detail if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.allowed_actions is not None: output["allowed_actions"] = [str(item) for item in request.allowed_actions] @@ -4419,7 +4899,7 @@ def marshal__SetServerRequest( output["modification_date"] = request.modification_date.isoformat() if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.location is not None: output["location"] = marshal_ServerLocation(request.location, defaults) @@ -4428,7 +4908,7 @@ def marshal__SetServerRequest( output["ipv6"] = marshal_ServerIpv6(request.ipv6, defaults) if request.boot_type is not None: - output["boot_type"] = str(request.boot_type) + output["boot_type"] = request.boot_type if request.volumes is not None: output["volumes"] = { @@ -4447,7 +4927,7 @@ def marshal__SetServerRequest( ] if request.arch is not None: - output["arch"] = str(request.arch) + output["arch"] = request.arch if request.placement_group is not None: output["placement_group"] = marshal_PlacementGroup( @@ -4495,18 +4975,18 @@ def marshal__SetSnapshotRequest( output["name"] = request.name if request.organization is not None: - output["organization"] = ( - request.organization or defaults.default_organization_id - ) + output["organization"] = request.organization + else: + output["organization"] = defaults.default_organization_id if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.size is not None: output["size"] = request.size if request.state is not None: - output["state"] = str(request.state) + output["state"] = request.state if request.base_volume is not None: output["base_volume"] = marshal_SnapshotBaseVolume( @@ -4520,7 +5000,9 @@ def marshal__SetSnapshotRequest( output["modification_date"] = request.modification_date.isoformat() if request.project is not None: - output["project"] = request.project or defaults.default_project_id + output["project"] = request.project + else: + output["project"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway/scaleway/instance/v1/types.py b/scaleway/scaleway/instance/v1/types.py index 6388d37a5..b025241ff 100644 --- a/scaleway/scaleway/instance/v1/types.py +++ b/scaleway/scaleway/instance/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -311,34 +311,22 @@ def __str__(self) -> str: @dataclass class ServerSummary: id: str - name: str @dataclass class Bootscript: architecture: Arch - bootcmdargs: str - default: bool - dtb: str - id: str - initrd: str - kernel: str - organization: str - public: bool - title: str - project: str - zone: ScwZone """ Zone to target. If none is passed will use default zone from the config. @@ -377,37 +365,37 @@ class Volume: Volume Project ID. """ - export_uri: Optional[str] + tags: List[str] """ - Show the volume NBD export URI. + Volume tags. """ - creation_date: Optional[datetime] + state: VolumeState """ - Volume creation date. + Volume state. """ - modification_date: Optional[datetime] + zone: ScwZone """ - Volume modification date. + Zone in which the volume is located. """ - tags: List[str] + export_uri: Optional[str] = None """ - Volume tags. + Show the volume NBD export URI. """ - state: VolumeState + creation_date: Optional[datetime] = None """ - Volume state. + Volume creation date. """ - zone: ScwZone + modification_date: Optional[datetime] = None """ - Zone in which the volume is located. + Volume modification date. """ - server: Optional[ServerSummary] + server: Optional[ServerSummary] = None """ Instance attached to the volume. """ @@ -416,22 +404,19 @@ class Volume: @dataclass class VolumeSummary: id: str - name: str - size: int - volume_type: VolumeVolumeType @dataclass class ServerTypeNetworkInterface: - internal_bandwidth: Optional[int] + internal_bandwidth: Optional[int] = 0 """ Maximum internal bandwidth in bits per seconds. """ - internet_bandwidth: Optional[int] + internet_bandwidth: Optional[int] = 0 """ Maximum internet bandwidth in bits per seconds. """ @@ -453,37 +438,24 @@ class ServerTypeVolumeConstraintSizes: @dataclass class Image: id: str - name: str - arch: Arch - extra_volumes: Dict[str, Volume] - from_server: str - organization: str - - creation_date: Optional[datetime] - - modification_date: Optional[datetime] - - default_bootscript: Optional[Bootscript] - public: bool - state: ImageState - project: str - tags: List[str] - zone: ScwZone """ Zone to target. If none is passed will use default zone from the config. """ - root_volume: Optional[VolumeSummary] + creation_date: Optional[datetime] = None + modification_date: Optional[datetime] = None + default_bootscript: Optional[Bootscript] = None + root_volume: Optional[VolumeSummary] = None @dataclass @@ -571,14 +543,12 @@ class PrivateNIC: @dataclass class SecurityGroupSummary: id: str - name: str @dataclass class ServerFilesystem: filesystem_id: str - state: ServerFilesystemState @@ -656,53 +626,37 @@ class ServerIpv6: @dataclass class ServerLocation: cluster_id: str - hypervisor_id: str - node_id: str - platform_id: str - zone_id: str @dataclass class ServerMaintenance: reason: str - - start_date: Optional[datetime] + start_date: Optional[datetime] = None @dataclass class VolumeServer: id: str - - name: Optional[str] - - export_uri: Optional[str] - - organization: Optional[str] - - server: Optional[ServerSummary] - - size: Optional[int] - volume_type: VolumeServerVolumeType - boot: bool - zone: ScwZone """ Zone to target. If none is passed will use default zone from the config. """ - creation_date: Optional[datetime] - - modification_date: Optional[datetime] - - state: Optional[VolumeServerState] - - project: Optional[str] + name: Optional[str] = None + export_uri: Optional[str] = None + organization: Optional[str] = None + server: Optional[ServerSummary] = None + size: Optional[int] = None + creation_date: Optional[datetime] = None + modification_date: Optional[datetime] = None + state: Optional[VolumeServerState] = None + project: Optional[str] = None @dataclass @@ -730,7 +684,7 @@ class ServerTypeCapabilities: Max number of SFS (Scaleway File Systems) that can be attached to the Instance. """ - block_storage: Optional[bool] + block_storage: Optional[bool] = False """ Defines whether the Instance supports block storage. """ @@ -766,12 +720,12 @@ class ServerTypeNetwork: True if IPv6 is enabled. """ - sum_internal_bandwidth: Optional[int] + sum_internal_bandwidth: Optional[int] = 0 """ Total maximum internal bandwidth in bits per seconds. """ - sum_internet_bandwidth: Optional[int] + sum_internet_bandwidth: Optional[int] = 0 """ Total maximum internet bandwidth in bits per seconds. """ @@ -779,7 +733,7 @@ class ServerTypeNetwork: @dataclass class ServerTypeVolumeConstraintsByType: - l_ssd: Optional[ServerTypeVolumeConstraintSizes] + l_ssd: Optional[ServerTypeVolumeConstraintSizes] = None """ Local SSD volumes. """ @@ -793,7 +747,6 @@ class VolumeTypeCapabilities: @dataclass class VolumeTypeConstraints: min: int - max: int @@ -834,11 +787,6 @@ class Server: Instance commercial type (eg. GP1-M). """ - creation_date: Optional[datetime] - """ - Instance creation date. - """ - dynamic_ip_required: bool """ True if a dynamic IPv4 is required. @@ -914,62 +862,67 @@ class Server: True if the Instance type has reached end of service. """ - routed_ip_enabled: Optional[bool] + creation_date: Optional[datetime] = None + """ + Instance creation date. + """ + + routed_ip_enabled: Optional[bool] = False """ True to configure the instance so it uses the routed IP mode. Use of `routed_ip_enabled` as `False` is deprecated. """ - enable_ipv6: Optional[bool] + enable_ipv6: Optional[bool] = False """ True if IPv6 is enabled (deprecated and always `False` when `routed_ip_enabled` is `True`). """ - image: Optional[Image] + image: Optional[Image] = None """ Information about the Instance image. """ - private_ip: Optional[str] + private_ip: Optional[str] = None """ Private IP address of the Instance (deprecated and always `null` when `routed_ip_enabled` is `True`). """ - public_ip: Optional[ServerIp] + public_ip: Optional[ServerIp] = None """ Information about the public IP (deprecated in favor of `public_ips`). """ - modification_date: Optional[datetime] + modification_date: Optional[datetime] = None """ Instance modification date. """ - location: Optional[ServerLocation] + location: Optional[ServerLocation] = None """ Instance location. """ - ipv6: Optional[ServerIpv6] + ipv6: Optional[ServerIpv6] = None """ Instance IPv6 address (deprecated when `routed_ip_enabled` is `True`). """ - security_group: Optional[SecurityGroupSummary] + security_group: Optional[SecurityGroupSummary] = None """ Instance security group. """ - placement_group: Optional[PlacementGroup] + placement_group: Optional[PlacementGroup] = None """ Instance placement group. """ - admin_password_encryption_ssh_key_id: Optional[str] + admin_password_encryption_ssh_key_id: Optional[str] = None """ The public_key value of this key is used to encrypt the admin password. When set to an empty string, reset this value and admin_password_encrypted_value to an empty string so a new password may be generated. """ - admin_password_encrypted_value: Optional[str] + admin_password_encrypted_value: Optional[str] = None """ This value is reset when admin_password_encryption_ssh_key_id is set to an empty string. """ @@ -997,39 +950,29 @@ class VolumeTemplate: Type of the volume. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class Ip: id: str - address: str - organization: str - tags: List[str] - project: str - type_: IpType - state: IpState - prefix: str - ipam_id: str - zone: ScwZone """ Zone to target. If none is passed will use default zone from the config. """ - reverse: Optional[str] - - server: Optional[ServerSummary] + reverse: Optional[str] = None + server: Optional[ServerSummary] = None @dataclass @@ -1104,17 +1047,17 @@ class SecurityGroup: Zone in which the security group is located. """ - organization_default: Optional[bool] + organization_default: Optional[bool] = False """ True if it is your default security group for this Organization ID. """ - creation_date: Optional[datetime] + creation_date: Optional[datetime] = None """ Security group creation date. """ - modification_date: Optional[datetime] + modification_date: Optional[datetime] = None """ Security group modification date. """ @@ -1123,27 +1066,19 @@ class SecurityGroup: @dataclass class SecurityGroupRule: id: str - protocol: SecurityGroupRuleProtocol - direction: SecurityGroupRuleDirection - action: SecurityGroupRuleAction - ip_range: str - position: int - editable: bool - zone: ScwZone """ Zone to target. If none is passed will use default zone from the config. """ - dest_port_from: Optional[int] - - dest_port_to: Optional[int] + dest_port_from: Optional[int] = None + dest_port_to: Optional[int] = None @dataclass @@ -1153,37 +1088,37 @@ class VolumeServerTemplate: Type of the volume. """ - id: Optional[str] + id: Optional[str] = None """ UUID of the volume. """ - boot: Optional[bool] + boot: Optional[bool] = False """ Force the Instance to boot on this volume. """ - name: Optional[str] + name: Optional[str] = None """ Name of the volume. """ - size: Optional[int] + size: Optional[int] = 0 """ Disk size of the volume, must be a multiple of 512. """ - base_snapshot: Optional[str] + base_snapshot: Optional[str] = None """ ID of the snapshot on which this volume will be based. """ - organization: Optional[str] + organization: Optional[str] = None """ Organization ID of the volume. """ - project: Optional[str] + project: Optional[str] = None """ Project ID of the volume. """ @@ -1236,22 +1171,22 @@ class Snapshot: Snapshot zone. """ - base_volume: Optional[SnapshotBaseVolume] + base_volume: Optional[SnapshotBaseVolume] = None """ Volume on which the snapshot is based on. """ - creation_date: Optional[datetime] + creation_date: Optional[datetime] = None """ Snapshot creation date. """ - modification_date: Optional[datetime] + modification_date: Optional[datetime] = None """ Snapshot modification date. """ - error_reason: Optional[str] + error_reason: Optional[str] = None """ Reason for the failed snapshot import. """ @@ -1280,20 +1215,18 @@ class Task: """ href_from: str - href_result: str - zone: ScwZone """ Zone in which the task is executed. """ - started_at: Optional[datetime] + started_at: Optional[datetime] = None """ Task start date. """ - terminated_at: Optional[datetime] + terminated_at: Optional[datetime] = None """ Task end date. """ @@ -1302,34 +1235,20 @@ class Task: @dataclass class Dashboard: volumes_count: int - running_servers_count: int - servers_by_types: Dict[str, int] - images_count: int - snapshots_count: int - servers_count: int - ips_count: int - security_groups_count: int - ips_unused: int - volumes_l_ssd_count: int - volumes_l_ssd_total_size: int - private_nics_count: int - placement_groups_count: int - - volumes_b_ssd_count: Optional[int] - - volumes_b_ssd_total_size: Optional[int] + volumes_b_ssd_count: Optional[int] = None + volumes_b_ssd_total_size: Optional[int] = None @dataclass @@ -1357,11 +1276,6 @@ class GetServerTypesAvailabilityResponseAvailability: @dataclass class ServerType: - monthly_price: Optional[float] - """ - Estimated monthly price, for a 30 days month, in Euro. - """ - hourly_price: float """ Hourly price in Euro. @@ -1392,42 +1306,47 @@ class ServerType: True if this Instance type has reached end of service. """ - per_volume_constraint: Optional[ServerTypeVolumeConstraintsByType] + monthly_price: Optional[float] = 0.0 + """ + Estimated monthly price, for a 30 days month, in Euro. + """ + + per_volume_constraint: Optional[ServerTypeVolumeConstraintsByType] = None """ Additional volume constraints. """ - volumes_constraint: Optional[ServerTypeVolumeConstraintSizes] + volumes_constraint: Optional[ServerTypeVolumeConstraintSizes] = None """ Initial volume constraints. """ - gpu: Optional[int] + gpu: Optional[int] = 0 """ Number of GPU. """ - gpu_info: Optional[ServerTypeGPUInfo] + gpu_info: Optional[ServerTypeGPUInfo] = None """ GPU information. """ - network: Optional[ServerTypeNetwork] + network: Optional[ServerTypeNetwork] = None """ Network available for the Instance. """ - capabilities: Optional[ServerTypeCapabilities] + capabilities: Optional[ServerTypeCapabilities] = None """ Capabilities. """ - scratch_storage_max_size: Optional[int] + scratch_storage_max_size: Optional[int] = 0 """ Maximum available scratch storage. """ - block_bandwidth: Optional[int] + block_bandwidth: Optional[int] = 0 """ The maximum bandwidth allocated to block storage access (in bytes per second). """ @@ -1436,10 +1355,8 @@ class ServerType: @dataclass class VolumeType: display_name: str - - capabilities: Optional[VolumeTypeCapabilities] - - constraints: Optional[VolumeTypeConstraints] + capabilities: Optional[VolumeTypeCapabilities] = None + constraints: Optional[VolumeTypeConstraints] = None @dataclass @@ -1478,27 +1395,27 @@ class SetSecurityGroupRulesRequestRule: Position of this rule in the security group rules list. If several rules are passed with the same position, the resulting order is undefined. """ - id: Optional[str] + id: Optional[str] = None """ UUID of the security rule to update. If no value is provided, a new rule will be created. """ - dest_port_from: Optional[int] + dest_port_from: Optional[int] = 0 """ Beginning of the range of ports this rule applies to (inclusive). This value will be set to null if protocol is ICMP or ANY. """ - dest_port_to: Optional[int] + dest_port_to: Optional[int] = 0 """ End of the range of ports this rule applies to (inclusive). This value will be set to null if protocol is ICMP or ANY, or if it is equal to dest_port_from. """ - editable: Optional[bool] + editable: Optional[bool] = False """ Indicates if this rule is editable. Rules with the value false will be ignored. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone of the rule. This field is ignored. """ @@ -1515,7 +1432,6 @@ class VolumeImageUpdateTemplate: @dataclass class SecurityGroupTemplate: id: str - name: str @@ -1526,23 +1442,21 @@ class ApplyBlockMigrationRequest: A value to be retrieved from a call to the [Get a volume or snapshot's migration plan](#path-volumes-get-a-volume-or-snapshots-migration-plan) endpoint, to confirm that the volume and/or snapshots specified in said plan should be migrated. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - volume_id: Optional[str] + volume_id: Optional[str] = None - snapshot_id: Optional[str] + snapshot_id: Optional[str] = None @dataclass class AttachServerFileSystemRequest: server_id: str - filesystem_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1550,38 +1464,35 @@ class AttachServerFileSystemRequest: @dataclass class AttachServerFileSystemResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass class AttachServerVolumeRequest: server_id: str - volume_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - volume_type: Optional[AttachServerVolumeRequestVolumeType] - - boot: Optional[bool] + volume_type: Optional[AttachServerVolumeRequestVolumeType] = None + boot: Optional[bool] = None @dataclass class AttachServerVolumeResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass class CheckBlockMigrationOrganizationQuotasRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - organization: Optional[str] + organization: Optional[str] = None @dataclass @@ -1596,108 +1507,110 @@ class CreateImageRequest: Architecture of the image. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the image. """ - extra_volumes: Optional[Dict[str, VolumeTemplate]] + extra_volumes: Optional[Dict[str, VolumeTemplate]] = field(default_factory=dict) """ Additional volumes of the image. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the image. """ - public: Optional[bool] + public: Optional[bool] = False """ True to create a public image. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class CreateImageResponse: - image: Optional[Image] + image: Optional[Image] = None @dataclass class CreateIpRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the IP. """ - server: Optional[str] + server: Optional[str] = None """ UUID of the Instance you want to attach the IP to. """ - type_: Optional[IpType] + type_: Optional[IpType] = IpType.UNKNOWN_IPTYPE """ IP type to reserve (either 'routed_ipv4' or 'routed_ipv6'). """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class CreateIpResponse: - ip: Optional[Ip] + ip: Optional[Ip] = None @dataclass class CreatePlacementGroupRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the placement group. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the placement group. """ - policy_mode: Optional[PlacementGroupPolicyMode] + policy_mode: Optional[PlacementGroupPolicyMode] = PlacementGroupPolicyMode.OPTIONAL """ Operating mode of the placement group. """ - policy_type: Optional[PlacementGroupPolicyType] + policy_type: Optional[PlacementGroupPolicyType] = ( + PlacementGroupPolicyType.MAX_AVAILABILITY + ) """ Policy type of the placement group. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class CreatePlacementGroupResponse: - placement_group: Optional[PlacementGroup] + placement_group: Optional[PlacementGroup] = None @dataclass @@ -1712,22 +1625,22 @@ class CreatePrivateNICRequest: UUID of the private network where the private NIC will be attached. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Private NIC tags. """ - ip_ids: Optional[List[str]] + ip_ids: Optional[List[str]] = field(default_factory=list) """ Ip_ids defined from IPAM. """ - ipam_ip_ids: Optional[List[str]] + ipam_ip_ids: Optional[List[str]] = field(default_factory=list) """ UUID of IPAM ips, to be attached to the instance in the requested private network. """ @@ -1735,7 +1648,7 @@ class CreatePrivateNICRequest: @dataclass class CreatePrivateNICResponse: - private_nic: Optional[PrivateNIC] + private_nic: Optional[PrivateNIC] = None @dataclass @@ -1750,48 +1663,52 @@ class CreateSecurityGroupRequest: Whether the security group is stateful or not. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the security group. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the security group. """ - inbound_default_policy: Optional[SecurityGroupPolicy] + inbound_default_policy: Optional[SecurityGroupPolicy] = ( + SecurityGroupPolicy.UNKNOWN_POLICY + ) """ Default policy for inbound rules. """ - outbound_default_policy: Optional[SecurityGroupPolicy] + outbound_default_policy: Optional[SecurityGroupPolicy] = ( + SecurityGroupPolicy.UNKNOWN_POLICY + ) """ Default policy for outbound rules. """ - enable_default_security: Optional[bool] + enable_default_security: Optional[bool] = False """ True to block SMTP on IPv4 and IPv6. This feature is read only, please open a support ticket if you need to make it configurable. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None - organization_default: Optional[bool] + organization_default: Optional[bool] = False - project_default: Optional[bool] + project_default: Optional[bool] = False @dataclass class CreateSecurityGroupResponse: - security_group: Optional[SecurityGroup] + security_group: Optional[SecurityGroup] = None @dataclass @@ -1802,13 +1719,9 @@ class CreateSecurityGroupRuleRequest: """ protocol: SecurityGroupRuleProtocol - direction: SecurityGroupRuleDirection - action: SecurityGroupRuleAction - ip_range: str - position: int """ Position of this rule in the security group rules list. @@ -1819,17 +1732,17 @@ class CreateSecurityGroupRuleRequest: Indicates if this rule is editable (will be ignored). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - dest_port_from: Optional[int] + dest_port_from: Optional[int] = 0 """ Beginning of the range of ports to apply this rule to (inclusive). """ - dest_port_to: Optional[int] + dest_port_to: Optional[int] = 0 """ End of the range of ports to apply this rule to (inclusive). """ @@ -1837,190 +1750,189 @@ class CreateSecurityGroupRuleRequest: @dataclass class CreateSecurityGroupRuleResponse: - rule: Optional[SecurityGroupRule] + rule: Optional[SecurityGroupRule] = None @dataclass class CreateServerRequest: - zone: Optional[ScwZone] + commercial_type: str """ - Zone to target. If none is passed will use default zone from the config. + Define the Instance commercial type (i.e. GP1-S). """ - commercial_type: str + protected: bool """ - Define the Instance commercial type (i.e. GP1-S). + True to activate server protection option. + """ + + zone: Optional[ScwZone] = None + """ + Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Instance name. """ - dynamic_ip_required: Optional[bool] + dynamic_ip_required: Optional[bool] = False """ By default, `dynamic_ip_required` is true, a dynamic ip is attached to the instance (if no flexible ip is already attached). """ - routed_ip_enabled: Optional[bool] + routed_ip_enabled: Optional[bool] = False """ If true, configure the Instance so it uses the new routed IP mode. """ - image: Optional[str] + image: Optional[str] = None """ Instance image ID or label. """ - volumes: Optional[Dict[str, VolumeServerTemplate]] + volumes: Optional[Dict[str, VolumeServerTemplate]] = field(default_factory=dict) """ Volumes attached to the server. """ - enable_ipv6: Optional[bool] + enable_ipv6: Optional[bool] = False """ True if IPv6 is enabled on the server (deprecated and always `False` when `routed_ip_enabled` is `True`). """ - protected: bool - """ - True to activate server protection option. - """ - - public_ip: Optional[str] + public_ip: Optional[str] = None """ ID of the reserved IP to attach to the Instance. """ - public_ips: Optional[List[str]] + public_ips: Optional[List[str]] = field(default_factory=list) """ A list of reserved IP IDs to attach to the Instance. """ - boot_type: Optional[BootType] + boot_type: Optional[BootType] = BootType.LOCAL """ Boot type to use. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Instance tags. """ - security_group: Optional[str] + security_group: Optional[str] = None """ Security group ID. """ - placement_group: Optional[str] + placement_group: Optional[str] = None """ Placement group ID if Instance must be part of a placement group. """ - admin_password_encryption_ssh_key_id: Optional[str] + admin_password_encryption_ssh_key_id: Optional[str] = None """ The public_key value of this key is used to encrypt the admin password. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class CreateServerResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass class CreateSnapshotRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - volume_id: Optional[str] + volume_id: Optional[str] = None """ UUID of the volume. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the snapshot. """ - volume_type: Optional[SnapshotVolumeType] + volume_type: Optional[SnapshotVolumeType] = SnapshotVolumeType.UNKNOWN_VOLUME_TYPE """ Overrides the volume_type of the snapshot. If omitted, the volume type of the original volume will be used. """ - bucket: Optional[str] + bucket: Optional[str] = None """ Bucket name for snapshot imports. """ - key: Optional[str] + key: Optional[str] = None """ Object key for snapshot imports. """ - size: Optional[int] + size: Optional[int] = 0 """ Imported snapshot size, must be a multiple of 512. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None @dataclass class CreateSnapshotResponse: - snapshot: Optional[Snapshot] - - task: Optional[Task] + snapshot: Optional[Snapshot] = None + task: Optional[Task] = None @dataclass class CreateVolumeRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Volume name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Volume tags. """ - volume_type: Optional[VolumeVolumeType] + volume_type: Optional[VolumeVolumeType] = VolumeVolumeType.L_SSD """ Volume type. """ - project: Optional[str] + project: Optional[str] = None - organization: Optional[str] + organization: Optional[str] = None - size: Optional[int] + size: Optional[int] = 0 - base_snapshot: Optional[str] + base_snapshot: Optional[str] = None @dataclass class CreateVolumeResponse: - volume: Optional[Volume] + volume: Optional[Volume] = None @dataclass @@ -2030,7 +1942,7 @@ class DeleteImageRequest: UUID of the image you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2043,7 +1955,7 @@ class DeleteIpRequest: ID or address of the IP to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2056,7 +1968,7 @@ class DeletePlacementGroupRequest: UUID of the placement group you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2074,7 +1986,7 @@ class DeletePrivateNICRequest: Private NIC unique ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2087,7 +1999,7 @@ class DeleteSecurityGroupRequest: UUID of the security group you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2096,10 +2008,8 @@ class DeleteSecurityGroupRequest: @dataclass class DeleteSecurityGroupRuleRequest: security_group_id: str - security_group_rule_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2108,8 +2018,7 @@ class DeleteSecurityGroupRuleRequest: @dataclass class DeleteServerRequest: server_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2127,7 +2036,7 @@ class DeleteServerUserDataRequest: Key of the user data to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2140,7 +2049,7 @@ class DeleteSnapshotRequest: UUID of the snapshot you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2153,7 +2062,7 @@ class DeleteVolumeRequest: UUID of the volume you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2162,10 +2071,8 @@ class DeleteVolumeRequest: @dataclass class DetachServerFileSystemRequest: server_id: str - filesystem_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2173,16 +2080,14 @@ class DetachServerFileSystemRequest: @dataclass class DetachServerFileSystemResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass class DetachServerVolumeRequest: server_id: str - volume_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2190,7 +2095,7 @@ class DetachServerVolumeRequest: @dataclass class DetachServerVolumeResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass @@ -2210,7 +2115,7 @@ class ExportSnapshotRequest: Snapshot ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2218,24 +2123,23 @@ class ExportSnapshotRequest: @dataclass class ExportSnapshotResponse: - task: Optional[Task] + task: Optional[Task] = None @dataclass class GetDashboardRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - organization: Optional[str] - - project: Optional[str] + organization: Optional[str] = None + project: Optional[str] = None @dataclass class GetDashboardResponse: - dashboard: Optional[Dashboard] + dashboard: Optional[Dashboard] = None @dataclass @@ -2245,7 +2149,7 @@ class GetImageRequest: UUID of the image you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2253,7 +2157,7 @@ class GetImageRequest: @dataclass class GetImageResponse: - image: Optional[Image] + image: Optional[Image] = None @dataclass @@ -2263,7 +2167,7 @@ class GetIpRequest: IP ID or address to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2271,7 +2175,7 @@ class GetIpRequest: @dataclass class GetIpResponse: - ip: Optional[Ip] + ip: Optional[Ip] = None @dataclass @@ -2281,7 +2185,7 @@ class GetPlacementGroupRequest: UUID of the placement group you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2289,7 +2193,7 @@ class GetPlacementGroupRequest: @dataclass class GetPlacementGroupResponse: - placement_group: Optional[PlacementGroup] + placement_group: Optional[PlacementGroup] = None @dataclass @@ -2299,7 +2203,7 @@ class GetPlacementGroupServersRequest: UUID of the placement group you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2325,7 +2229,7 @@ class GetPrivateNICRequest: Private NIC unique ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2333,7 +2237,7 @@ class GetPrivateNICRequest: @dataclass class GetPrivateNICResponse: - private_nic: Optional[PrivateNIC] + private_nic: Optional[PrivateNIC] = None @dataclass @@ -2343,7 +2247,7 @@ class GetSecurityGroupRequest: UUID of the security group you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2351,16 +2255,14 @@ class GetSecurityGroupRequest: @dataclass class GetSecurityGroupResponse: - security_group: Optional[SecurityGroup] + security_group: Optional[SecurityGroup] = None @dataclass class GetSecurityGroupRuleRequest: security_group_id: str - security_group_rule_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2368,7 +2270,7 @@ class GetSecurityGroupRuleRequest: @dataclass class GetSecurityGroupRuleResponse: - rule: Optional[SecurityGroupRule] + rule: Optional[SecurityGroupRule] = None @dataclass @@ -2378,7 +2280,7 @@ class GetServerCompatibleTypesRequest: UUID of the Instance you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2391,7 +2293,7 @@ class GetServerRequest: UUID of the Instance you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2399,22 +2301,22 @@ class GetServerRequest: @dataclass class GetServerResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass class GetServerTypesAvailabilityRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ @@ -2437,7 +2339,7 @@ class GetSnapshotRequest: UUID of the snapshot you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2445,7 +2347,7 @@ class GetSnapshotRequest: @dataclass class GetSnapshotResponse: - snapshot: Optional[Snapshot] + snapshot: Optional[Snapshot] = None @dataclass @@ -2455,7 +2357,7 @@ class GetVolumeRequest: UUID of the volume you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2463,12 +2365,12 @@ class GetVolumeRequest: @dataclass class GetVolumeResponse: - volume: Optional[Volume] + volume: Optional[Volume] = None @dataclass class ListDefaultSecurityGroupRulesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2476,26 +2378,19 @@ class ListDefaultSecurityGroupRulesRequest: @dataclass class ListImagesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - organization: Optional[str] - - per_page: Optional[int] - - page: Optional[int] - - name: Optional[str] - - public: Optional[bool] - - arch: Optional[str] - - project: Optional[str] - - tags: Optional[str] + organization: Optional[str] = None + per_page: Optional[int] = None + page: Optional[int] = None + name: Optional[str] = None + public: Optional[bool] = None + arch: Optional[str] = None + project: Optional[str] = None + tags: Optional[str] = None @dataclass @@ -2513,42 +2408,42 @@ class ListImagesResponse: @dataclass class ListIpsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project: Optional[str] + project: Optional[str] = None """ Project ID in which the IPs are reserved. """ - organization: Optional[str] + organization: Optional[str] = None """ Organization ID in which the IPs are reserved. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ Filter IPs with these exact tags (to filter with several tags, use commas to separate them). """ - name: Optional[str] + name: Optional[str] = None """ Filter on the IP address (Works as a LIKE operation on the IP address). """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ - type_: Optional[str] + type_: Optional[str] = None """ Filter on the IP Mobility IP type (whose value should be either 'routed_ipv4' or 'routed_ipv6'). """ @@ -2569,37 +2464,37 @@ class ListIpsResponse: @dataclass class ListPlacementGroupsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ - organization: Optional[str] + organization: Optional[str] = None """ List only placement groups of this Organization ID. """ - project: Optional[str] + project: Optional[str] = None """ List only placement groups of this Project ID. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ List placement groups with these exact tags (to filter with several tags, use commas to separate them). """ - name: Optional[str] + name: Optional[str] = None """ Filter placement groups by name (for eg. "cluster1" will return "cluster100" and "cluster1" but not "foo"). """ @@ -2625,22 +2520,22 @@ class ListPrivateNICsRequest: Instance to which the private NIC is attached. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ Private NIC tags. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ @@ -2649,7 +2544,6 @@ class ListPrivateNICsRequest: @dataclass class ListPrivateNICsResponse: private_nics: List[PrivateNIC] - total_count: int @@ -2660,17 +2554,17 @@ class ListSecurityGroupRulesRequest: UUID of the security group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ @@ -2691,42 +2585,42 @@ class ListSecurityGroupRulesResponse: @dataclass class ListSecurityGroupsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the security group. """ - organization: Optional[str] + organization: Optional[str] = None """ Security group Organization ID. """ - project: Optional[str] + project: Optional[str] = None """ Security group Project ID. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ List security groups with these exact tags (to filter with several tags, use commas to separate them). """ - project_default: Optional[bool] + project_default: Optional[bool] = False """ Filter security groups with this value for project_default. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ @@ -2748,8 +2642,7 @@ class ListSecurityGroupsResponse: @dataclass class ListServerActionsRequest: server_id: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2767,7 +2660,7 @@ class ListServerUserDataRequest: UUID of the Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2780,87 +2673,89 @@ class ListServerUserDataResponse: @dataclass class ListServersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ - organization: Optional[str] + organization: Optional[str] = None """ List only Instances of this Organization ID. """ - project: Optional[str] + project: Optional[str] = None """ List only Instances of this Project ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter Instances by name (eg. "server1" will return "server100" and "server1" but not "foo"). """ - private_ip: Optional[str] + private_ip: Optional[str] = None """ List Instances by private_ip. """ - without_ip: Optional[bool] + without_ip: Optional[bool] = False """ List Instances that are not attached to a public IP. """ - with_ip: Optional[str] + with_ip: Optional[str] = None """ List Instances by IP (both private_ip and public_ip are supported). """ - commercial_type: Optional[str] + commercial_type: Optional[str] = None """ List Instances of this commercial type. """ - state: Optional[ServerState] + state: Optional[ServerState] = ServerState.RUNNING """ List Instances in this state. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ List Instances with these exact tags (to filter with several tags, use commas to separate them). """ - private_network: Optional[str] + private_network: Optional[str] = None """ List Instances in this Private Network. """ - order: Optional[ListServersRequestOrder] + order: Optional[ListServersRequestOrder] = ( + ListServersRequestOrder.CREATION_DATE_DESC + ) """ Define the order of the returned servers. """ - private_networks: Optional[List[str]] + private_networks: Optional[List[str]] = None """ List Instances from the given Private Networks (use commas to separate them). """ - private_nic_mac_address: Optional[str] + private_nic_mac_address: Optional[str] = None """ List Instances associated with the given private NIC MAC address. """ - servers: Optional[List[str]] + servers: Optional[List[str]] = None """ List Instances from these server ids (use commas to separate them). """ @@ -2881,14 +2776,13 @@ class ListServersResponse: @dataclass class ListServersTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] - - page: Optional[int] + per_page: Optional[int] = None + page: Optional[int] = None @dataclass @@ -2906,42 +2800,42 @@ class ListServersTypesResponse: @dataclass class ListSnapshotsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - organization: Optional[str] + organization: Optional[str] = None """ List snapshots only for this Organization ID. """ - project: Optional[str] + project: Optional[str] = None """ List snapshots only for this Project ID. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ Number of snapshots returned per page (positive integer lower or equal to 100). """ - page: Optional[int] + page: Optional[int] = 0 """ Page to be returned. """ - name: Optional[str] + name: Optional[str] = None """ List snapshots of the requested name. """ - tags: Optional[str] + tags: Optional[str] = None """ List snapshots that have the requested tag. """ - base_volume_id: Optional[str] + base_volume_id: Optional[str] = None """ List snapshots originating only from this volume. """ @@ -2962,42 +2856,42 @@ class ListSnapshotsResponse: @dataclass class ListVolumesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - volume_type: Optional[VolumeVolumeType] + volume_type: Optional[VolumeVolumeType] = VolumeVolumeType.L_SSD """ Filter by volume type. """ - per_page: Optional[int] + per_page: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to return. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to return. """ - organization: Optional[str] + organization: Optional[str] = None """ Filter volume by Organization ID. """ - project: Optional[str] + project: Optional[str] = None """ Filter volume by Project ID. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = None """ Filter volumes with these exact tags (to filter with several tags, use commas to separate them). """ - name: Optional[str] + name: Optional[str] = None """ Filter volume by name (for eg. "vol" will return "myvolume" but not "data"). """ @@ -3018,14 +2912,13 @@ class ListVolumesResponse: @dataclass class ListVolumesTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - per_page: Optional[int] - - page: Optional[int] + per_page: Optional[int] = None + page: Optional[int] = None @dataclass @@ -3053,7 +2946,7 @@ class MigrationPlan: A value to be passed to the call to the [Migrate a volume and/or snapshots to SBS](#path-volumes-migrate-a-volume-andor-snapshots-to-sbs-scaleway-block-storage) endpoint, to confirm that the execution of the plan is being requested. """ - volume: Optional[Volume] + volume: Optional[Volume] = None """ A volume which will be migrated to SBS together with the snapshots, if present. """ @@ -3061,14 +2954,14 @@ class MigrationPlan: @dataclass class PlanBlockMigrationRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - volume_id: Optional[str] + volume_id: Optional[str] = None - snapshot_id: Optional[str] + snapshot_id: Optional[str] = None @dataclass @@ -3078,29 +2971,31 @@ class ServerActionRequest: UUID of the Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - action: Optional[ServerAction] + action: Optional[ServerAction] = ServerAction.POWERON """ Action to perform on the Instance. """ - name: Optional[str] + name: Optional[str] = None """ Name of the backup you want to create. This field should only be specified when performing a backup action. """ - volumes: Optional[Dict[str, ServerActionRequestVolumeBackupTemplate]] + volumes: Optional[Dict[str, ServerActionRequestVolumeBackupTemplate]] = field( + default_factory=dict + ) """ For each volume UUID, the snapshot parameters of the volume. This field should only be specified when performing a backup action. """ - disable_ipv6: Optional[bool] + disable_ipv6: Optional[bool] = False """ Disable IPv6 on the Instance while performing migration to routed IPs. This field should only be specified when performing a enable_routed_ip action. @@ -3109,7 +3004,7 @@ class ServerActionRequest: @dataclass class ServerActionResponse: - task: Optional[Task] + task: Optional[Task] = None @dataclass @@ -3122,65 +3017,46 @@ class ServerCompatibleTypes: @dataclass class SetImageRequest: - zone: Optional[ScwZone] - """ - Zone to target. If none is passed will use default zone from the config. - """ - id: str - name: str - - arch: Optional[Arch] - - creation_date: Optional[datetime] - - modification_date: Optional[datetime] - from_server: str - public: bool + zone: Optional[ScwZone] = None + """ + Zone to target. If none is passed will use default zone from the config. + """ - default_bootscript: Optional[Bootscript] - - extra_volumes: Optional[Dict[str, Volume]] - - organization: Optional[str] - - root_volume: Optional[VolumeSummary] - - state: Optional[ImageState] - - project: Optional[str] - - tags: Optional[List[str]] + arch: Optional[Arch] = None + creation_date: Optional[datetime] = None + modification_date: Optional[datetime] = None + default_bootscript: Optional[Bootscript] = None + extra_volumes: Optional[Dict[str, Volume]] = None + organization: Optional[str] = None + root_volume: Optional[VolumeSummary] = None + state: Optional[ImageState] = None + project: Optional[str] = None + tags: Optional[List[str]] = None @dataclass class SetPlacementGroupRequest: placement_group_id: str - name: str - - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - organization: Optional[str] - - policy_mode: Optional[PlacementGroupPolicyMode] - - policy_type: Optional[PlacementGroupPolicyType] - - project: Optional[str] - - tags: Optional[List[str]] + organization: Optional[str] = None + policy_mode: Optional[PlacementGroupPolicyMode] = None + policy_type: Optional[PlacementGroupPolicyType] = None + project: Optional[str] = None + tags: Optional[List[str]] = None @dataclass class SetPlacementGroupResponse: - placement_group: Optional[PlacementGroup] + placement_group: Optional[PlacementGroup] = None @dataclass @@ -3195,7 +3071,7 @@ class SetPlacementGroupServersRequest: An array of the Instances' UUIDs you want to configure. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3216,12 +3092,14 @@ class SetSecurityGroupRulesRequest: UUID of the security group to update the rules on. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - rules: Optional[List[SetSecurityGroupRulesRequestRule]] + rules: Optional[List[SetSecurityGroupRulesRequestRule]] = field( + default_factory=list + ) """ List of rules to update in the security group. """ @@ -3239,32 +3117,34 @@ class UpdateImageRequest: UUID of the image. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the image. """ - arch: Optional[Arch] + arch: Optional[Arch] = Arch.UNKNOWN_ARCH """ Architecture of the image. """ - extra_volumes: Optional[Dict[str, VolumeImageUpdateTemplate]] + extra_volumes: Optional[Dict[str, VolumeImageUpdateTemplate]] = field( + default_factory=dict + ) """ Additional snapshots of the image, with extra_volumeKey being the position of the snapshot in the image. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the image. """ - public: Optional[bool] + public: Optional[bool] = False """ True to set the image as public. """ @@ -3272,7 +3152,7 @@ class UpdateImageRequest: @dataclass class UpdateImageResponse: - image: Optional[Image] + image: Optional[Image] = None @dataclass @@ -3282,32 +3162,32 @@ class UpdateIpRequest: IP ID or IP address. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse domain name. """ - type_: Optional[IpType] + type_: Optional[IpType] = IpType.UNKNOWN_IPTYPE """ Should have no effect. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ An array of keywords you want to tag this IP with. """ - server: Optional[str] + server: Optional[str] = None @dataclass class UpdateIpResponse: - ip: Optional[Ip] + ip: Optional[Ip] = None @dataclass @@ -3317,27 +3197,29 @@ class UpdatePlacementGroupRequest: UUID of the placement group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the placement group. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the placement group. """ - policy_mode: Optional[PlacementGroupPolicyMode] + policy_mode: Optional[PlacementGroupPolicyMode] = PlacementGroupPolicyMode.OPTIONAL """ Operating mode of the placement group. """ - policy_type: Optional[PlacementGroupPolicyType] + policy_type: Optional[PlacementGroupPolicyType] = ( + PlacementGroupPolicyType.MAX_AVAILABILITY + ) """ Policy type of the placement group. """ @@ -3345,7 +3227,7 @@ class UpdatePlacementGroupRequest: @dataclass class UpdatePlacementGroupResponse: - placement_group: Optional[PlacementGroup] + placement_group: Optional[PlacementGroup] = None @dataclass @@ -3360,7 +3242,7 @@ class UpdatePlacementGroupServersRequest: An array of the Instances' UUIDs you want to configure. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3386,12 +3268,12 @@ class UpdatePrivateNICRequest: Private NIC unique ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags used to select private NIC/s. """ @@ -3404,52 +3286,56 @@ class UpdateSecurityGroupRequest: UUID of the security group. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the security group. """ - description: Optional[str] + description: Optional[str] = None """ Description of the security group. """ - enable_default_security: Optional[bool] + enable_default_security: Optional[bool] = False """ True to block SMTP on IPv4 and IPv6. This feature is read only, please open a support ticket if you need to make it configurable. """ - inbound_default_policy: Optional[SecurityGroupPolicy] + inbound_default_policy: Optional[SecurityGroupPolicy] = ( + SecurityGroupPolicy.UNKNOWN_POLICY + ) """ Default inbound policy. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the security group. """ - organization_default: Optional[bool] + organization_default: Optional[bool] = False """ Please use project_default instead. """ - project_default: Optional[bool] + project_default: Optional[bool] = False """ True use this security group for future Instances created in this project. """ - outbound_default_policy: Optional[SecurityGroupPolicy] + outbound_default_policy: Optional[SecurityGroupPolicy] = ( + SecurityGroupPolicy.UNKNOWN_POLICY + ) """ Default outbound policy. """ - stateful: Optional[bool] + stateful: Optional[bool] = False """ True to set the security group as stateful. """ @@ -3457,7 +3343,7 @@ class UpdateSecurityGroupRequest: @dataclass class UpdateSecurityGroupResponse: - security_group: Optional[SecurityGroup] + security_group: Optional[SecurityGroup] = None @dataclass @@ -3472,42 +3358,46 @@ class UpdateSecurityGroupRuleRequest: UUID of the rule. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - protocol: Optional[SecurityGroupRuleProtocol] + protocol: Optional[SecurityGroupRuleProtocol] = ( + SecurityGroupRuleProtocol.UNKNOWN_PROTOCOL + ) """ Protocol family this rule applies to. """ - direction: Optional[SecurityGroupRuleDirection] + direction: Optional[SecurityGroupRuleDirection] = ( + SecurityGroupRuleDirection.UNKNOWN_DIRECTION + ) """ Direction the rule applies to. """ - action: Optional[SecurityGroupRuleAction] + action: Optional[SecurityGroupRuleAction] = SecurityGroupRuleAction.UNKNOWN_ACTION """ Action to apply when the rule matches a packet. """ - ip_range: Optional[str] + ip_range: Optional[str] = None """ Range of IP addresses these rules apply to. """ - dest_port_from: Optional[int] + dest_port_from: Optional[int] = 0 """ Beginning of the range of ports this rule applies to (inclusive). If 0 is provided, unset the parameter. """ - dest_port_to: Optional[int] + dest_port_to: Optional[int] = 0 """ End of the range of ports this rule applies to (inclusive). If 0 is provided, unset the parameter. """ - position: Optional[int] + position: Optional[int] = 0 """ Position of this rule in the security group rules list. """ @@ -3515,7 +3405,7 @@ class UpdateSecurityGroupRuleRequest: @dataclass class UpdateSecurityGroupRuleResponse: - rule: Optional[SecurityGroupRule] + rule: Optional[SecurityGroupRule] = None @dataclass @@ -3525,57 +3415,52 @@ class UpdateServerRequest: UUID of the Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Instance. """ - boot_type: Optional[BootType] - - tags: Optional[List[str]] + boot_type: Optional[BootType] = BootType.LOCAL + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Instance. """ - volumes: Optional[Dict[str, VolumeServerTemplate]] - - dynamic_ip_required: Optional[bool] - - routed_ip_enabled: Optional[bool] + volumes: Optional[Dict[str, VolumeServerTemplate]] = field(default_factory=dict) + dynamic_ip_required: Optional[bool] = False + routed_ip_enabled: Optional[bool] = False """ True to configure the instance so it uses the new routed IP mode (once this is set to True you cannot set it back to False). """ - public_ips: Optional[List[str]] + public_ips: Optional[List[str]] = field(default_factory=list) """ A list of reserved IP IDs to attach to the Instance. """ - enable_ipv6: Optional[bool] - - protected: Optional[bool] + enable_ipv6: Optional[bool] = False + protected: Optional[bool] = False """ True to activate server protection option. """ - security_group: Optional[SecurityGroupTemplate] - - placement_group: Optional[str] + security_group: Optional[SecurityGroupTemplate] = None + placement_group: Optional[str] = None """ Placement group ID if Instance must be part of a placement group. """ - private_nics: Optional[List[str]] + private_nics: Optional[List[str]] = field(default_factory=list) """ Instance private NICs. """ - commercial_type: Optional[str] + commercial_type: Optional[str] = None """ Warning: This field has some restrictions: - Cannot be changed if the Instance is not in `stopped` state. @@ -3584,7 +3469,7 @@ class UpdateServerRequest: - Local storage requirements of the target commercial_types must be fulfilled (i.e. if an Instance has 80GB of local storage, it can be changed into a GP1-XS, which has a maximum of 150GB, but it cannot be changed into a DEV1-S, which has only 20GB). """ - admin_password_encryption_ssh_key_id: Optional[str] + admin_password_encryption_ssh_key_id: Optional[str] = None """ The public_key value of this key is used to encrypt the admin password. When set to an empty string, reset this value and admin_password_encrypted_value to an empty string so a new password may be generated. """ @@ -3592,7 +3477,7 @@ class UpdateServerRequest: @dataclass class UpdateServerResponse: - server: Optional[Server] + server: Optional[Server] = None @dataclass @@ -3602,17 +3487,17 @@ class UpdateSnapshotRequest: UUID of the snapshot. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the snapshot. """ @@ -3620,7 +3505,7 @@ class UpdateSnapshotRequest: @dataclass class UpdateSnapshotResponse: - snapshot: Optional[Snapshot] + snapshot: Optional[Snapshot] = None @dataclass @@ -3630,22 +3515,22 @@ class UpdateVolumeRequest: UUID of the volume. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Volume name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the volume. """ - size: Optional[int] + size: Optional[int] = 0 """ Volume disk size, must be a multiple of 512. """ @@ -3653,4 +3538,4 @@ class UpdateVolumeRequest: @dataclass class UpdateVolumeResponse: - volume: Optional[Volume] + volume: Optional[Volume] = None diff --git a/scaleway/scaleway/interlink/v1beta1/marshalling.py b/scaleway/scaleway/interlink/v1beta1/marshalling.py index 477ccc33b..8f54d2528 100644 --- a/scaleway/scaleway/interlink/v1beta1/marshalling.py +++ b/scaleway/scaleway/interlink/v1beta1/marshalling.py @@ -10,6 +10,9 @@ resolve_one_of, ) from .types import ( + BgpStatus, + DedicatedConnectionStatus, + LinkStatus, DedicatedConnection, BgpConfig, PartnerHost, @@ -44,42 +47,62 @@ def unmarshal_DedicatedConnection(data: Any) -> DedicatedConnection: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DedicatedConnectionStatus.UNKNOWN_STATUS field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("pop_id", None) if field is not None: args["pop_id"] = field + else: + args["pop_id"] = None field = data.get("bandwidth_mbps", None) if field is not None: args["bandwidth_mbps"] = field + else: + args["bandwidth_mbps"] = 0 field = data.get("available_link_bandwidths", None) if field is not None: args["available_link_bandwidths"] = field + else: + args["available_link_bandwidths"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -113,14 +136,20 @@ def unmarshal_BgpConfig(data: Any) -> BgpConfig: field = data.get("asn", None) if field is not None: args["asn"] = field + else: + args["asn"] = 0 field = data.get("ipv4", None) if field is not None: args["ipv4"] = field + else: + args["ipv4"] = None field = data.get("ipv6", None) if field is not None: args["ipv6"] = field + else: + args["ipv6"] = None return BgpConfig(**args) @@ -136,10 +165,14 @@ def unmarshal_PartnerHost(data: Any) -> PartnerHost: field = data.get("partner_id", None) if field is not None: args["partner_id"] = field + else: + args["partner_id"] = None field = data.get("pairing_key", None) if field is not None: args["pairing_key"] = field + else: + args["pairing_key"] = None field = data.get("disapproved_reason", None) if field is not None: @@ -161,6 +194,8 @@ def unmarshal_SelfHost(data: Any) -> SelfHost: field = data.get("connection_id", None) if field is not None: args["connection_id"] = field + else: + args["connection_id"] = None return SelfHost(**args) @@ -176,54 +211,80 @@ def unmarshal_Link(data: Any) -> Link: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("pop_id", None) if field is not None: args["pop_id"] = field + else: + args["pop_id"] = None field = data.get("bandwidth_mbps", None) if field is not None: args["bandwidth_mbps"] = field + else: + args["bandwidth_mbps"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = LinkStatus.UNKNOWN_LINK_STATUS field = data.get("bgp_v4_status", None) if field is not None: args["bgp_v4_status"] = field + else: + args["bgp_v4_status"] = BgpStatus.UNKNOWN_BGP_STATUS field = data.get("bgp_v6_status", None) if field is not None: args["bgp_v6_status"] = field + else: + args["bgp_v6_status"] = BgpStatus.UNKNOWN_BGP_STATUS field = data.get("enable_route_propagation", None) if field is not None: args["enable_route_propagation"] = field + else: + args["enable_route_propagation"] = False field = data.get("vlan", None) if field is not None: args["vlan"] = field + else: + args["vlan"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("vpc_id", None) if field is not None: @@ -299,22 +360,32 @@ def unmarshal_Partner(data: Any) -> Partner: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("contact_email", None) if field is not None: args["contact_email"] = field + else: + args["contact_email"] = None field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("portal_url", None) if field is not None: args["portal_url"] = field + else: + args["portal_url"] = None field = data.get("created_at", None) if field is not None: @@ -342,34 +413,50 @@ def unmarshal_Pop(data: Any) -> Pop: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("hosting_provider_name", None) if field is not None: args["hosting_provider_name"] = field + else: + args["hosting_provider_name"] = None field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("city", None) if field is not None: args["city"] = field + else: + args["city"] = None field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("available_link_bandwidths_mbps", None) if field is not None: args["available_link_bandwidths_mbps"] = field + else: + args["available_link_bandwidths_mbps"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None return Pop(**args) @@ -385,38 +472,56 @@ def unmarshal_RoutingPolicy(data: Any) -> RoutingPolicy: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("prefix_filter_in", None) if field is not None: args["prefix_filter_in"] = field + else: + args["prefix_filter_in"] = field(default_factory=list) field = data.get("prefix_filter_out", None) if field is not None: args["prefix_filter_out"] = field + else: + args["prefix_filter_out"] = field(default_factory=list) field = data.get("is_ipv6", None) if field is not None: args["is_ipv6"] = field + else: + args["is_ipv6"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -450,10 +555,14 @@ def unmarshal_ListDedicatedConnectionsResponse( if field is not None else None ) + else: + args["connections"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDedicatedConnectionsResponse(**args) @@ -471,10 +580,14 @@ def unmarshal_ListLinksResponse(data: Any) -> ListLinksResponse: args["links"] = ( [unmarshal_Link(v) for v in field] if field is not None else None ) + else: + args["links"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListLinksResponse(**args) @@ -492,10 +605,14 @@ def unmarshal_ListPartnersResponse(data: Any) -> ListPartnersResponse: args["partners"] = ( [unmarshal_Partner(v) for v in field] if field is not None else None ) + else: + args["partners"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPartnersResponse(**args) @@ -511,10 +628,14 @@ def unmarshal_ListPopsResponse(data: Any) -> ListPopsResponse: field = data.get("pops", None) if field is not None: args["pops"] = [unmarshal_Pop(v) for v in field] if field is not None else None + else: + args["pops"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPopsResponse(**args) @@ -532,10 +653,14 @@ def unmarshal_ListRoutingPoliciesResponse(data: Any) -> ListRoutingPoliciesRespo args["routing_policies"] = ( [unmarshal_RoutingPolicy(v) for v in field] if field is not None else None ) + else: + args["routing_policies"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListRoutingPoliciesResponse(**args) @@ -594,7 +719,9 @@ def marshal_CreateLinkRequest( output["bandwidth_mbps"] = request.bandwidth_mbps if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -621,7 +748,9 @@ def marshal_CreateRoutingPolicyRequest( output["is_ipv6"] = request.is_ipv6 if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags diff --git a/scaleway/scaleway/interlink/v1beta1/types.py b/scaleway/scaleway/interlink/v1beta1/types.py index 56696a502..103ac7581 100644 --- a/scaleway/scaleway/interlink/v1beta1/types.py +++ b/scaleway/scaleway/interlink/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -147,7 +147,7 @@ class PartnerHost: Used to identify a link from a user or partner's point of view. """ - disapproved_reason: Optional[str] + disapproved_reason: Optional[str] = None """ Reason given by partner to explain why they did not approve the request for a hosted link. """ @@ -213,17 +213,17 @@ class DedicatedConnection: Region of the dedicated connection. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the dedicated connection. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the dedicated connection. """ - demarcation_info: Optional[str] + demarcation_info: Optional[str] = None """ Demarcation details required by the data center to set up the supporting Cross Connect. This generally includes the physical space in the facility, the cabinet or rack the connection should land in, the patch panel to go in, the port designation, and the media type. """ @@ -286,59 +286,59 @@ class Link: Defines whether route propagation is enabled or not. To enable or disable route propagation, use the dedicated endpoint. """ - vpc_id: Optional[str] + vlan: int """ - ID of the Scaleway VPC attached to the link. + VLAN of the link. """ - routing_policy_id: Optional[str] + region: ScwRegion """ - Deprecated. Use routing_policy_v4_id or routing_policy_v6_id instead. + Region of the link. """ - created_at: Optional[datetime] + vpc_id: Optional[str] = None """ - Creation date of the link. + ID of the Scaleway VPC attached to the link. """ - updated_at: Optional[datetime] + routing_policy_id: Optional[str] = None """ - Last modification date of the link. + Deprecated. Use routing_policy_v4_id or routing_policy_v6_id instead. """ - vlan: int + created_at: Optional[datetime] = None """ - VLAN of the link. + Creation date of the link. """ - region: ScwRegion + updated_at: Optional[datetime] = None """ - Region of the link. + Last modification date of the link. """ - scw_bgp_config: Optional[BgpConfig] + scw_bgp_config: Optional[BgpConfig] = None """ BGP configuration on Scaleway's side. """ - peer_bgp_config: Optional[BgpConfig] + peer_bgp_config: Optional[BgpConfig] = None """ BGP configuration on peer's side (on-premises or other hosting provider). """ - routing_policy_v4_id: Optional[str] + routing_policy_v4_id: Optional[str] = None """ ID of the routing policy IPv4 attached to the link. """ - routing_policy_v6_id: Optional[str] + routing_policy_v6_id: Optional[str] = None """ ID of the routing policy IPv6 attached to the link. """ - partner: Optional[PartnerHost] + partner: Optional[PartnerHost] = None - self_: Optional[SelfHost] + self_: Optional[SelfHost] = None @dataclass @@ -368,12 +368,12 @@ class Partner: URL of the partner's portal. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the partner. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the partner. """ @@ -469,12 +469,12 @@ class RoutingPolicy: Region of the routing policy. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of the routing policy. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last modification date of the routing policy. """ @@ -492,7 +492,7 @@ class AttachRoutingPolicyRequest: ID of the routing policy to be attached. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -510,7 +510,7 @@ class AttachVpcRequest: ID of the VPC to attach. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -533,34 +533,34 @@ class CreateLinkRequest: Desired bandwidth for the link. Must be compatible with available link bandwidths and remaining bandwidth capacity of the connection. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to create the link in. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the link. """ - peer_asn: Optional[int] + peer_asn: Optional[int] = 0 """ For self-hosted links we need the peer AS Number to establish BGP session. If not given, a default one will be assigned. """ - vlan: Optional[int] + vlan: Optional[int] = 0 """ For self-hosted links only, it is possible to choose the VLAN ID. If the VLAN is not available (ie already taken or out of range), an error is returned. """ - connection_id: Optional[str] + connection_id: Optional[str] = None - partner_id: Optional[str] + partner_id: Optional[str] = None @dataclass @@ -575,27 +575,27 @@ class CreateRoutingPolicyRequest: IP prefixes version of the routing policy. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to create the routing policy in. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the routing policy. """ - prefix_filter_in: Optional[List[str]] + prefix_filter_in: Optional[List[str]] = field(default_factory=list) """ IP prefixes to accept from the peer (ranges of route announcements to accept). """ - prefix_filter_out: Optional[List[str]] + prefix_filter_out: Optional[List[str]] = field(default_factory=list) """ IP prefix filters to advertise to the peer (ranges of routes to advertise). """ @@ -608,7 +608,7 @@ class DeleteLinkRequest: ID of the link to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -621,7 +621,7 @@ class DeleteRoutingPolicyRequest: ID of the routing policy to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -639,7 +639,7 @@ class DetachRoutingPolicyRequest: ID of the routing policy to be detached. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -652,7 +652,7 @@ class DetachVpcRequest: ID of the link to detach the VPC from. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -665,7 +665,7 @@ class DisableRoutePropagationRequest: ID of the link on which to disable route propagation. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -678,7 +678,7 @@ class EnableRoutePropagationRequest: ID of the link on which to enable route propagation. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -691,7 +691,7 @@ class GetDedicatedConnectionRequest: ID of connection to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -704,7 +704,7 @@ class GetLinkRequest: ID of the link to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -717,7 +717,7 @@ class GetPartnerRequest: ID of partner to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -730,7 +730,7 @@ class GetPopRequest: ID of PoP to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -743,7 +743,7 @@ class GetRoutingPolicyRequest: ID of the routing policy to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -751,57 +751,61 @@ class GetRoutingPolicyRequest: @dataclass class ListDedicatedConnectionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListDedicatedConnectionsRequestOrderBy] + order_by: Optional[ListDedicatedConnectionsRequestOrderBy] = ( + ListDedicatedConnectionsRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of connections to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. """ - name: Optional[str] + name: Optional[str] = None """ Link name to filter for. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. """ - status: Optional[DedicatedConnectionStatus] + status: Optional[DedicatedConnectionStatus] = ( + DedicatedConnectionStatus.UNKNOWN_STATUS + ) """ Connection status to filter for. """ - bandwidth_mbps: Optional[int] + bandwidth_mbps: Optional[int] = 0 """ Filter for dedicated connections with this bandwidth size. """ - pop_id: Optional[str] + pop_id: Optional[str] = None """ Filter for dedicated connections present in this PoP. """ @@ -822,97 +826,97 @@ class ListDedicatedConnectionsResponse: @dataclass class ListLinksRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListLinksRequestOrderBy] + order_by: Optional[ListLinksRequestOrderBy] = ListLinksRequestOrderBy.CREATED_AT_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of links to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. """ - name: Optional[str] + name: Optional[str] = None """ Link name to filter for. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. """ - status: Optional[LinkStatus] + status: Optional[LinkStatus] = LinkStatus.UNKNOWN_LINK_STATUS """ Link status to filter for. """ - bgp_v4_status: Optional[BgpStatus] + bgp_v4_status: Optional[BgpStatus] = BgpStatus.UNKNOWN_BGP_STATUS """ BGP IPv4 status to filter for. """ - bgp_v6_status: Optional[BgpStatus] + bgp_v6_status: Optional[BgpStatus] = BgpStatus.UNKNOWN_BGP_STATUS """ BGP IPv6 status to filter for. """ - pop_id: Optional[str] + pop_id: Optional[str] = None """ Filter for links attached to this PoP (via connections). """ - bandwidth_mbps: Optional[int] + bandwidth_mbps: Optional[int] = 0 """ Filter for link bandwidth (in Mbps). """ - partner_id: Optional[str] + partner_id: Optional[str] = None """ Filter for links hosted by this partner. """ - vpc_id: Optional[str] + vpc_id: Optional[str] = None """ Filter for links attached to this VPC. """ - routing_policy_id: Optional[str] + routing_policy_id: Optional[str] = None """ Filter for links using this routing policy. """ - pairing_key: Optional[str] + pairing_key: Optional[str] = None """ Filter for the link with this pairing_key. """ - kind: Optional[LinkKind] + kind: Optional[LinkKind] = LinkKind.HOSTED """ Filter for hosted or self-hosted links. """ - connection_id: Optional[str] + connection_id: Optional[str] = None """ Filter for links self-hosted on this connection. """ @@ -933,27 +937,27 @@ class ListLinksResponse: @dataclass class ListPartnersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPartnersRequestOrderBy] + order_by: Optional[ListPartnersRequestOrderBy] = ListPartnersRequestOrderBy.NAME_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of partners to return per page. """ - pop_ids: Optional[List[str]] + pop_ids: Optional[List[str]] = field(default_factory=list) """ Filter for partners present (offering a connection) in one of these PoPs. """ @@ -974,47 +978,47 @@ class ListPartnersResponse: @dataclass class ListPopsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPopsRequestOrderBy] + order_by: Optional[ListPopsRequestOrderBy] = ListPopsRequestOrderBy.NAME_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of PoPs to return per page. """ - name: Optional[str] + name: Optional[str] = None """ PoP name to filter for. """ - hosting_provider_name: Optional[str] + hosting_provider_name: Optional[str] = None """ Hosting provider name to filter for. """ - partner_id: Optional[str] + partner_id: Optional[str] = None """ Filter for PoPs hosting an available shared connection from this partner. """ - link_bandwidth_mbps: Optional[int] + link_bandwidth_mbps: Optional[int] = 0 """ Filter for PoPs with a shared connection allowing this bandwidth size. Note that we cannot guarantee that PoPs returned will have available capacity. """ - dedicated_available: Optional[bool] + dedicated_available: Optional[bool] = False """ Filter for PoPs with a dedicated connection available for self-hosted links. """ @@ -1035,47 +1039,49 @@ class ListPopsResponse: @dataclass class ListRoutingPoliciesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListRoutingPoliciesRequestOrderBy] + order_by: Optional[ListRoutingPoliciesRequestOrderBy] = ( + ListRoutingPoliciesRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of routing policies to return per page. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. """ - name: Optional[str] + name: Optional[str] = None """ Routing policy name to filter for. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. """ - ipv6: Optional[bool] + ipv6: Optional[bool] = False """ Filter for the routing policies based on IP prefixes version. """ @@ -1084,7 +1090,6 @@ class ListRoutingPoliciesRequest: @dataclass class ListRoutingPoliciesResponse: routing_policies: List[RoutingPolicy] - total_count: int @@ -1095,22 +1100,22 @@ class UpdateLinkRequest: ID of the link to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the link. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the link. """ - peer_asn: Optional[int] + peer_asn: Optional[int] = 0 """ For self-hosted links, AS Number to establish BGP session. """ @@ -1123,27 +1128,27 @@ class UpdateRoutingPolicyRequest: ID of the routing policy to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the routing policy. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to apply to the routing policy. """ - prefix_filter_in: Optional[List[str]] + prefix_filter_in: Optional[List[str]] = field(default_factory=list) """ IP prefixes to accept from the peer (ranges of route announcements to accept). """ - prefix_filter_out: Optional[List[str]] + prefix_filter_out: Optional[List[str]] = field(default_factory=list) """ IP prefix filters for routes to advertise to the peer (ranges of routes to advertise). """ diff --git a/scaleway/scaleway/iot/v1/marshalling.py b/scaleway/scaleway/iot/v1/marshalling.py index fce648a7b..8dddf7afb 100644 --- a/scaleway/scaleway/iot/v1/marshalling.py +++ b/scaleway/scaleway/iot/v1/marshalling.py @@ -13,6 +13,15 @@ resolve_one_of, ) from .types import ( + DeviceMessageFiltersRulePolicy, + DeviceStatus, + HubProductPlan, + HubStatus, + NetworkNetworkType, + RouteDatabaseConfigEngine, + RouteRestConfigHttpVerb, + RouteRouteType, + RouteS3ConfigS3Strategy, DeviceMessageFiltersRule, DeviceMessageFilters, Device, @@ -71,12 +80,14 @@ def unmarshal_DeviceMessageFiltersRule(data: Any) -> DeviceMessageFiltersRule: field = data.get("policy", None) if field is not None: args["policy"] = field + else: + args["policy"] = DeviceMessageFiltersRulePolicy.UNKNOWN field = data.get("topics", None) if field is not None: args["topics"] = field else: - args["topics"] = None + args["topics"] = field(default_factory=list) return DeviceMessageFiltersRule(**args) @@ -115,22 +126,32 @@ def unmarshal_Device(data: Any) -> Device: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DeviceStatus.UNKNOWN field = data.get("hub_id", None) if field is not None: args["hub_id"] = field + else: + args["hub_id"] = None field = data.get("last_activity_at", None) if field is not None: @@ -143,18 +164,26 @@ def unmarshal_Device(data: Any) -> Device: field = data.get("is_connected", None) if field is not None: args["is_connected"] = field + else: + args["is_connected"] = False field = data.get("allow_insecure", None) if field is not None: args["allow_insecure"] = field + else: + args["allow_insecure"] = False field = data.get("allow_multiple_connections", None) if field is not None: args["allow_multiple_connections"] = field + else: + args["allow_multiple_connections"] = False field = data.get("has_custom_certificate", None) if field is not None: args["has_custom_certificate"] = field + else: + args["has_custom_certificate"] = False field = data.get("message_filters", None) if field is not None: @@ -188,26 +217,38 @@ def unmarshal_Network(data: Any) -> Network: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = NetworkNetworkType.UNKNOWN field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("hub_id", None) if field is not None: args["hub_id"] = field + else: + args["hub_id"] = None field = data.get("topic_prefix", None) if field is not None: args["topic_prefix"] = field + else: + args["topic_prefix"] = None field = data.get("created_at", None) if field is not None: @@ -229,6 +270,8 @@ def unmarshal_HubTwinsGraphiteConfig(data: Any) -> HubTwinsGraphiteConfig: field = data.get("push_uri", None) if field is not None: args["push_uri"] = field + else: + args["push_uri"] = None return HubTwinsGraphiteConfig(**args) @@ -244,62 +287,92 @@ def unmarshal_Hub(data: Any) -> Hub: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["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"] = HubStatus.UNKNOWN field = data.get("product_plan", None) if field is not None: args["product_plan"] = field + else: + args["product_plan"] = HubProductPlan.PLAN_UNKNOWN field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("device_count", None) if field is not None: args["device_count"] = field + else: + args["device_count"] = 0 field = data.get("connected_device_count", None) if field is not None: args["connected_device_count"] = field + else: + args["connected_device_count"] = 0 field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("disable_events", None) if field is not None: args["disable_events"] = field + else: + args["disable_events"] = False field = data.get("events_topic_prefix", None) if field is not None: args["events_topic_prefix"] = field + else: + args["events_topic_prefix"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("enable_device_auto_provisioning", None) if field is not None: args["enable_device_auto_provisioning"] = field + else: + args["enable_device_auto_provisioning"] = False field = data.get("has_custom_ca", None) if field is not None: args["has_custom_ca"] = field + else: + args["has_custom_ca"] = False field = data.get("created_at", None) if field is not None: @@ -333,10 +406,14 @@ def unmarshal_Certificate(data: Any) -> Certificate: field = data.get("crt", None) if field is not None: args["crt"] = field + else: + args["crt"] = None field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None return Certificate(**args) @@ -375,6 +452,8 @@ def unmarshal_CreateNetworkResponse(data: Any) -> CreateNetworkResponse: field = data.get("secret", None) if field is not None: args["secret"] = field + else: + args["secret"] = None field = data.get("network", None) if field is not None: @@ -396,6 +475,8 @@ def unmarshal_GetDeviceCertificateResponse(data: Any) -> GetDeviceCertificateRes field = data.get("certificate_pem", None) if field is not None: args["certificate_pem"] = field + else: + args["certificate_pem"] = None field = data.get("device", None) if field is not None: @@ -419,6 +500,8 @@ def unmarshal_GetDeviceMetricsResponse(data: Any) -> GetDeviceMetricsResponse: args["metrics"] = ( [unmarshal_TimeSeries(v) for v in field] if field is not None else None ) + else: + args["metrics"] = field(default_factory=list) return GetDeviceMetricsResponse(**args) @@ -434,6 +517,8 @@ def unmarshal_GetHubCAResponse(data: Any) -> GetHubCAResponse: field = data.get("ca_cert_pem", None) if field is not None: args["ca_cert_pem"] = field + else: + args["ca_cert_pem"] = None return GetHubCAResponse(**args) @@ -451,6 +536,8 @@ def unmarshal_GetHubMetricsResponse(data: Any) -> GetHubMetricsResponse: args["metrics"] = ( [unmarshal_TimeSeries(v) for v in field] if field is not None else None ) + else: + args["metrics"] = field(default_factory=list) return GetHubMetricsResponse(**args) @@ -466,12 +553,16 @@ def unmarshal_ListDevicesResponse(data: Any) -> ListDevicesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("devices", None) if field is not None: args["devices"] = ( [unmarshal_Device(v) for v in field] if field is not None else None ) + else: + args["devices"] = field(default_factory=list) return ListDevicesResponse(**args) @@ -487,10 +578,14 @@ def unmarshal_ListHubsResponse(data: Any) -> ListHubsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("hubs", None) if field is not None: args["hubs"] = [unmarshal_Hub(v) for v in field] if field is not None else None + else: + args["hubs"] = field(default_factory=list) return ListHubsResponse(**args) @@ -506,12 +601,16 @@ def unmarshal_ListNetworksResponse(data: Any) -> ListNetworksResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("networks", None) if field is not None: args["networks"] = ( [unmarshal_Network(v) for v in field] if field is not None else None ) + else: + args["networks"] = field(default_factory=list) return ListNetworksResponse(**args) @@ -527,22 +626,32 @@ def unmarshal_RouteSummary(data: Any) -> RouteSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("hub_id", None) if field is not None: args["hub_id"] = field + else: + args["hub_id"] = None field = data.get("topic", None) if field is not None: args["topic"] = field + else: + args["topic"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = RouteRouteType.UNKNOWN field = data.get("created_at", None) if field is not None: @@ -570,12 +679,16 @@ def unmarshal_ListRoutesResponse(data: Any) -> ListRoutesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("routes", None) if field is not None: args["routes"] = ( [unmarshal_RouteSummary(v) for v in field] if field is not None else None ) + else: + args["routes"] = field(default_factory=list) return ListRoutesResponse(**args) @@ -593,6 +706,8 @@ def unmarshal_ListTwinDocumentsResponseDocumentSummary( field = data.get("document_name", None) if field is not None: args["document_name"] = field + else: + args["document_name"] = None return ListTwinDocumentsResponseDocumentSummary(**args) @@ -612,6 +727,8 @@ def unmarshal_ListTwinDocumentsResponse(data: Any) -> ListTwinDocumentsResponse: if field is not None else None ) + else: + args["documents"] = field(default_factory=list) return ListTwinDocumentsResponse(**args) @@ -652,30 +769,44 @@ def unmarshal_RouteDatabaseConfig(data: Any) -> RouteDatabaseConfig: field = data.get("engine", None) if field is not None: args["engine"] = field + else: + args["engine"] = RouteDatabaseConfigEngine.UNKNOWN field = data.get("host", None) if field is not None: args["host"] = field + else: + args["host"] = None field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = None field = data.get("dbname", None) if field is not None: args["dbname"] = field + else: + args["dbname"] = None field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("password", None) if field is not None: args["password"] = field + else: + args["password"] = None field = data.get("query", None) if field is not None: args["query"] = field + else: + args["query"] = None return RouteDatabaseConfig(**args) @@ -691,14 +822,20 @@ def unmarshal_RouteRestConfig(data: Any) -> RouteRestConfig: field = data.get("verb", None) if field is not None: args["verb"] = field + else: + args["verb"] = RouteRestConfigHttpVerb.UNKNOWN field = data.get("uri", None) if field is not None: args["uri"] = field + else: + args["uri"] = None field = data.get("headers", None) if field is not None: args["headers"] = field + else: + args["headers"] = field(default_factory=dict) return RouteRestConfig(**args) @@ -714,18 +851,26 @@ def unmarshal_RouteS3Config(data: Any) -> RouteS3Config: field = data.get("bucket_region", None) if field is not None: args["bucket_region"] = field + else: + args["bucket_region"] = None field = data.get("bucket_name", None) if field is not None: args["bucket_name"] = field + else: + args["bucket_name"] = None field = data.get("object_prefix", None) if field is not None: args["object_prefix"] = field + else: + args["object_prefix"] = None field = data.get("strategy", None) if field is not None: args["strategy"] = field + else: + args["strategy"] = RouteS3ConfigS3Strategy.UNKNOWN return RouteS3Config(**args) @@ -741,22 +886,32 @@ def unmarshal_Route(data: Any) -> Route: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("hub_id", None) if field is not None: args["hub_id"] = field + else: + args["hub_id"] = None field = data.get("topic", None) if field is not None: args["topic"] = field + else: + args["topic"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = RouteRouteType.UNKNOWN field = data.get("created_at", None) if field is not None: @@ -802,6 +957,8 @@ def unmarshal_SetDeviceCertificateResponse(data: Any) -> SetDeviceCertificateRes field = data.get("certificate_pem", None) if field is not None: args["certificate_pem"] = field + else: + args["certificate_pem"] = None field = data.get("device", None) if field is not None: @@ -823,20 +980,26 @@ def unmarshal_TwinDocument(data: Any) -> TwinDocument: field = data.get("twin_id", None) if field is not None: args["twin_id"] = field + else: + args["twin_id"] = None field = data.get("document_name", None) if field is not None: args["document_name"] = field + else: + args["document_name"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = 0 field = data.get("data", None) if field is not None: args["data"] = field else: - args["data"] = None + args["data"] = field(default_factory=dict) return TwinDocument(**args) @@ -848,7 +1011,7 @@ def marshal_DeviceMessageFiltersRule( output: Dict[str, Any] = {} if request.policy is not None: - output["policy"] = str(request.policy) + output["policy"] = request.policy if request.topics is not None: output["topics"] = request.topics @@ -932,13 +1095,15 @@ def marshal_CreateHubRequest( ) if request.product_plan is not None: - output["product_plan"] = str(request.product_plan) + output["product_plan"] = request.product_plan if request.name is not None: output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.disable_events is not None: output["disable_events"] = request.disable_events @@ -956,7 +1121,7 @@ def marshal_CreateNetworkRequest( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.hub_id is not None: output["hub_id"] = request.hub_id @@ -995,7 +1160,7 @@ def marshal_CreateRouteRequestDatabaseConfig( output["query"] = request.query if request.engine is not None: - output["engine"] = str(request.engine) + output["engine"] = request.engine return output @@ -1007,7 +1172,7 @@ def marshal_CreateRouteRequestRestConfig( output: Dict[str, Any] = {} if request.verb is not None: - output["verb"] = str(request.verb) + output["verb"] = request.verb if request.uri is not None: output["uri"] = request.uri @@ -1034,7 +1199,7 @@ def marshal_CreateRouteRequestS3Config( output["object_prefix"] = request.object_prefix if request.strategy is not None: - output["strategy"] = str(request.strategy) + output["strategy"] = request.strategy return output @@ -1182,7 +1347,7 @@ def marshal_UpdateHubRequest( output["name"] = request.name if request.product_plan is not None: - output["product_plan"] = str(request.product_plan) + output["product_plan"] = request.product_plan if request.disable_events is not None: output["disable_events"] = request.disable_events @@ -1205,7 +1370,7 @@ def marshal_UpdateRouteRequestDatabaseConfig( output: Dict[str, Any] = {} if request.engine is not None: - output["engine"] = str(request.engine) + output["engine"] = request.engine if request.host is not None: output["host"] = request.host @@ -1235,7 +1400,7 @@ def marshal_UpdateRouteRequestRestConfig( output: Dict[str, Any] = {} if request.verb is not None: - output["verb"] = str(request.verb) + output["verb"] = request.verb if request.uri is not None: output["uri"] = request.uri @@ -1253,7 +1418,7 @@ def marshal_UpdateRouteRequestS3Config( output: Dict[str, Any] = {} if request.strategy is not None: - output["strategy"] = str(request.strategy) + output["strategy"] = request.strategy if request.bucket_region is not None: output["bucket_region"] = request.bucket_region diff --git a/scaleway/scaleway/iot/v1/types.py b/scaleway/scaleway/iot/v1/types.py index b6d2338ab..e8f2881d2 100644 --- a/scaleway/scaleway/iot/v1/types.py +++ b/scaleway/scaleway/iot/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Any, Dict, List, Optional @@ -174,7 +174,7 @@ class DeviceMessageFiltersRule: If set to `reject`, all topics in the topics list will be denied, with all other topics being allowed. """ - topics: Optional[List[str]] + topics: Optional[List[str]] = field(default_factory=list) """ List of topics to accept or reject. It must be valid MQTT topics and up to 65535 characters. """ @@ -182,12 +182,12 @@ class DeviceMessageFiltersRule: @dataclass class DeviceMessageFilters: - publish: Optional[DeviceMessageFiltersRule] + publish: Optional[DeviceMessageFiltersRule] = None """ Filtering rule to restrict topics the device can publish to. """ - subscribe: Optional[DeviceMessageFiltersRule] + subscribe: Optional[DeviceMessageFiltersRule] = None """ Filtering rule to restrict topics the device can subscribe to. """ @@ -201,7 +201,6 @@ class HubTwinsGraphiteConfig: @dataclass class Certificate: crt: str - key: str @@ -232,11 +231,6 @@ class Device: Hub ID. """ - last_activity_at: Optional[datetime] - """ - Last connection/activity date of a device. - """ - is_connected: bool """ Defines whether the device is connected to the Hub. @@ -257,17 +251,22 @@ class Device: Assigning a custom certificate allows a device to authenticate using that specific certificate without checking the Hub's CA certificate. """ - message_filters: Optional[DeviceMessageFilters] + last_activity_at: Optional[datetime] = None + """ + Last connection/activity date of a device. + """ + + message_filters: Optional[DeviceMessageFilters] = None """ Filter-sets to restrict the topics the device can publish/subscribe to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date at which the device was added. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date at which the device was last modified. """ @@ -305,7 +304,7 @@ class Network: This prefix will be prepended to all topics for this Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date at which the network was created. """ @@ -314,37 +313,26 @@ class Network: @dataclass class CreateRouteRequestDatabaseConfig: host: str - port: int - dbname: str - username: str - password: str - query: str - engine: RouteDatabaseConfigEngine @dataclass class CreateRouteRequestRestConfig: verb: RouteRestConfigHttpVerb - uri: str - headers: Dict[str, str] @dataclass class CreateRouteRequestS3Config: bucket_region: str - bucket_name: str - object_prefix: str - strategy: RouteS3ConfigS3Strategy @@ -425,17 +413,17 @@ class Hub: Flag is automatically set to `false` after Hub creation, as Hub certificates are managed by Scaleway. Once a custom certificate authority is set, the flag will be set to `true`. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Hub creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Hub last modification date. """ - twins_graphite_config: Optional[HubTwinsGraphiteConfig] + twins_graphite_config: Optional[HubTwinsGraphiteConfig] = None @dataclass @@ -465,12 +453,12 @@ class RouteSummary: Route type. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date at which the route was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date at which the route was last updated. """ @@ -566,38 +554,27 @@ class RouteS3Config: @dataclass class UpdateRouteRequestDatabaseConfig: engine: RouteDatabaseConfigEngine - - host: Optional[str] - - port: Optional[int] - - dbname: Optional[str] - - username: Optional[str] - - password: Optional[str] - - query: Optional[str] + host: Optional[str] = None + port: Optional[int] = None + dbname: Optional[str] = None + username: Optional[str] = None + password: Optional[str] = None + query: Optional[str] = None @dataclass class UpdateRouteRequestRestConfig: verb: RouteRestConfigHttpVerb - - uri: Optional[str] - - headers: Optional[Dict[str, str]] + uri: Optional[str] = None + headers: Optional[Dict[str, str]] = None @dataclass class UpdateRouteRequestS3Config: strategy: RouteS3ConfigS3Strategy - - bucket_region: Optional[str] - - bucket_name: Optional[str] - - object_prefix: Optional[str] + bucket_region: Optional[str] = None + bucket_name: Optional[str] = None + object_prefix: Optional[str] = None @dataclass @@ -617,22 +594,22 @@ class CreateDeviceRequest: Defines whether to allow multiple physical devices to connect with this device's credentials. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Device name. """ - message_filters: Optional[DeviceMessageFilters] + message_filters: Optional[DeviceMessageFilters] = None """ Filter-sets to authorize or deny the device to publish/subscribe to specific topics. """ - description: Optional[str] + description: Optional[str] = None """ Device description. """ @@ -640,12 +617,12 @@ class CreateDeviceRequest: @dataclass class CreateDeviceResponse: - device: Optional[Device] + device: Optional[Device] = None """ Information related to the created device. """ - certificate: Optional[Certificate] + certificate: Optional[Certificate] = None """ Device certificate. """ @@ -658,32 +635,32 @@ class CreateHubRequest: Hub product plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Hub name (up to 255 characters). """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project/Organization ID to filter for, only Hubs from this Project/Organization will be returned. """ - disable_events: Optional[bool] + disable_events: Optional[bool] = False """ Disable Hub events. """ - events_topic_prefix: Optional[str] + events_topic_prefix: Optional[str] = None """ Topic prefix (default '$SCW/events') of Hub events. """ - twins_graphite_config: Optional[HubTwinsGraphiteConfig] + twins_graphite_config: Optional[HubTwinsGraphiteConfig] = None @dataclass @@ -703,12 +680,12 @@ class CreateNetworkRequest: Topic prefix for the Network. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Network name. """ @@ -721,7 +698,7 @@ class CreateNetworkResponse: Endpoint Key to keep secret. This cannot be retrieved later. """ - network: Optional[Network] + network: Optional[Network] = None """ Information related to the created network. """ @@ -739,21 +716,21 @@ class CreateRouteRequest: Topic the route subscribes to. It must be a valid MQTT topic and up to 65535 characters. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Route name. """ - s3_config: Optional[CreateRouteRequestS3Config] + s3_config: Optional[CreateRouteRequestS3Config] = None - db_config: Optional[CreateRouteRequestDatabaseConfig] + db_config: Optional[CreateRouteRequestDatabaseConfig] = None - rest_config: Optional[CreateRouteRequestRestConfig] + rest_config: Optional[CreateRouteRequestRestConfig] = None @dataclass @@ -763,7 +740,7 @@ class DeleteDeviceRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -776,12 +753,12 @@ class DeleteHubRequest: Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - delete_devices: Optional[bool] + delete_devices: Optional[bool] = False """ Defines whether to force the deletion of devices added to this Hub or reject the operation. """ @@ -794,7 +771,7 @@ class DeleteNetworkRequest: Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -807,7 +784,7 @@ class DeleteRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -825,7 +802,7 @@ class DeleteTwinDocumentRequest: Name of the document. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -838,7 +815,7 @@ class DeleteTwinDocumentsRequest: Twin ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -851,7 +828,7 @@ class DisableDeviceRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -864,7 +841,7 @@ class DisableHubRequest: Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -877,7 +854,7 @@ class EnableDeviceRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -890,7 +867,7 @@ class EnableHubRequest: Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -903,7 +880,7 @@ class GetDeviceCertificateRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -916,7 +893,7 @@ class GetDeviceCertificateResponse: Device certificate. """ - device: Optional[Device] + device: Optional[Device] = None """ Information related to the created device. """ @@ -929,12 +906,12 @@ class GetDeviceMetricsRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - start_date: Optional[datetime] + start_date: Optional[datetime] = None """ Start date used to compute the best scale for the returned metrics. """ @@ -955,7 +932,7 @@ class GetDeviceRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -964,8 +941,7 @@ class GetDeviceRequest: @dataclass class GetHubCARequest: hub_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -983,12 +959,12 @@ class GetHubMetricsRequest: Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - start_date: Optional[datetime] + start_date: Optional[datetime] = None """ Start date used to compute the best scale for returned metrics. """ @@ -1009,7 +985,7 @@ class GetHubRequest: Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1022,7 +998,7 @@ class GetNetworkRequest: Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1035,7 +1011,7 @@ class GetRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1053,7 +1029,7 @@ class GetTwinDocumentRequest: Name of the document. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1061,42 +1037,42 @@ class GetTwinDocumentRequest: @dataclass class ListDevicesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of devices to return within a page. Maximum value is 100. """ - order_by: Optional[ListDevicesRequestOrderBy] + order_by: Optional[ListDevicesRequestOrderBy] = ListDevicesRequestOrderBy.NAME_ASC """ Ordering of requested devices. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter for, only devices with this name will be returned. """ - hub_id: Optional[str] + hub_id: Optional[str] = None """ Hub ID to filter for, only devices attached to this Hub will be returned. """ - allow_insecure: Optional[bool] + allow_insecure: Optional[bool] = False """ Defines whether to filter the allow_insecure flag. """ - status: Optional[DeviceStatus] + status: Optional[DeviceStatus] = DeviceStatus.UNKNOWN """ Device status (enabled, disabled, etc.). """ @@ -1117,37 +1093,37 @@ class ListDevicesResponse: @dataclass class ListHubsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Hubs to return within a page. Maximum value is 100. """ - order_by: Optional[ListHubsRequestOrderBy] + order_by: Optional[ListHubsRequestOrderBy] = ListHubsRequestOrderBy.NAME_ASC """ Sort order of Hubs in the response. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Only list Hubs of this Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Only list Hubs of this Organization ID. """ - name: Optional[str] + name: Optional[str] = None """ Hub name. """ @@ -1168,37 +1144,37 @@ class ListHubsResponse: @dataclass class ListNetworksRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of networks to return. The maximum value is 100. """ - order_by: Optional[ListNetworksRequestOrderBy] + order_by: Optional[ListNetworksRequestOrderBy] = ListNetworksRequestOrderBy.NAME_ASC """ Ordering of requested routes. """ - name: Optional[str] + name: Optional[str] = None """ Network name to filter for. """ - hub_id: Optional[str] + hub_id: Optional[str] = None """ Hub ID to filter for. """ - topic_prefix: Optional[str] + topic_prefix: Optional[str] = None """ Topic prefix to filter for. """ @@ -1219,32 +1195,32 @@ class ListNetworksResponse: @dataclass class ListRoutesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of routes to return within a page. Maximum value is 100. """ - order_by: Optional[ListRoutesRequestOrderBy] + order_by: Optional[ListRoutesRequestOrderBy] = ListRoutesRequestOrderBy.NAME_ASC """ Ordering of requested routes. """ - hub_id: Optional[str] + hub_id: Optional[str] = None """ Hub ID to filter for. """ - name: Optional[str] + name: Optional[str] = None """ Route name to filter for. """ @@ -1270,7 +1246,7 @@ class ListTwinDocumentsRequest: Twin ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1296,17 +1272,17 @@ class PatchTwinDocumentRequest: Name of the document. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - version: Optional[int] + version: Optional[int] = 0 """ If set, ensures that the current version of the document matches before persisting the update. """ - data: Optional[Dict[str, Any]] + data: Optional[Dict[str, Any]] = field(default_factory=dict) """ A json data that will be applied on the document's current data. Patching rules: @@ -1329,17 +1305,17 @@ class PutTwinDocumentRequest: Name of the document. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - version: Optional[int] + version: Optional[int] = 0 """ If set, ensures that the current version of the document matches before persisting the update. """ - data: Optional[Dict[str, Any]] + data: Optional[Dict[str, Any]] = field(default_factory=dict) """ New data that will replace the contents of the document. """ @@ -1352,7 +1328,7 @@ class RenewDeviceCertificateRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1360,12 +1336,12 @@ class RenewDeviceCertificateRequest: @dataclass class RenewDeviceCertificateResponse: - device: Optional[Device] + device: Optional[Device] = None """ Information related to the created device. """ - certificate: Optional[Certificate] + certificate: Optional[Certificate] = None """ Device certificate. """ @@ -1398,21 +1374,21 @@ class Route: Route type. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date at which the route was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date at which the route was last updated. """ - s3_config: Optional[RouteS3Config] + s3_config: Optional[RouteS3Config] = None - db_config: Optional[RouteDatabaseConfig] + db_config: Optional[RouteDatabaseConfig] = None - rest_config: Optional[RouteRestConfig] + rest_config: Optional[RouteRestConfig] = None @dataclass @@ -1427,7 +1403,7 @@ class SetDeviceCertificateRequest: PEM-encoded custom certificate. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1436,8 +1412,7 @@ class SetDeviceCertificateRequest: @dataclass class SetDeviceCertificateResponse: certificate_pem: str - - device: Optional[Device] + device: Optional[Device] = None @dataclass @@ -1457,7 +1432,7 @@ class SetHubCARequest: Challenge is a PEM-encoded certificate that acts as proof of possession of the CA. It must be signed by the CA, and have a Common Name equal to the Hub ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1480,7 +1455,7 @@ class TwinDocument: New version of the document. """ - data: Optional[Dict[str, Any]] + data: Optional[Dict[str, Any]] = field(default_factory=dict) """ New data related to the document. """ @@ -1493,32 +1468,32 @@ class UpdateDeviceRequest: Device ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description for the device. """ - allow_insecure: Optional[bool] + allow_insecure: Optional[bool] = False """ Defines whether to allow plain and server-authenticated SSL connections in addition to mutually-authenticated ones. """ - allow_multiple_connections: Optional[bool] + allow_multiple_connections: Optional[bool] = False """ Defines whether to allow multiple physical devices to connect with this device's credentials. """ - message_filters: Optional[DeviceMessageFilters] + message_filters: Optional[DeviceMessageFilters] = None """ Filter-sets to restrict the topics the device can publish/subscribe to. """ - hub_id: Optional[str] + hub_id: Optional[str] = None """ Change Hub for this device, additional fees may apply, see IoT Hub pricing. """ @@ -1531,37 +1506,37 @@ class UpdateHubRequest: ID of the Hub you want to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Hub name (up to 255 characters). """ - product_plan: Optional[HubProductPlan] + product_plan: Optional[HubProductPlan] = HubProductPlan.PLAN_UNKNOWN """ Hub product plan. """ - disable_events: Optional[bool] + disable_events: Optional[bool] = False """ Disable Hub events. """ - events_topic_prefix: Optional[str] + events_topic_prefix: Optional[str] = None """ Topic prefix of Hub events. """ - enable_device_auto_provisioning: Optional[bool] + enable_device_auto_provisioning: Optional[bool] = False """ Enable device auto provisioning. """ - twins_graphite_config: Optional[HubTwinsGraphiteConfig] + twins_graphite_config: Optional[HubTwinsGraphiteConfig] = None @dataclass @@ -1571,23 +1546,23 @@ class UpdateRouteRequest: Route id. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Route name. """ - topic: Optional[str] + topic: Optional[str] = None """ Topic the route subscribes to. It must be a valid MQTT topic and up to 65535 characters. """ - s3_config: Optional[UpdateRouteRequestS3Config] + s3_config: Optional[UpdateRouteRequestS3Config] = None - db_config: Optional[UpdateRouteRequestDatabaseConfig] + db_config: Optional[UpdateRouteRequestDatabaseConfig] = None - rest_config: Optional[UpdateRouteRequestRestConfig] + rest_config: Optional[UpdateRouteRequestRestConfig] = None diff --git a/scaleway/scaleway/jobs/v1alpha1/marshalling.py b/scaleway/scaleway/jobs/v1alpha1/marshalling.py index 44470d626..2d727a553 100644 --- a/scaleway/scaleway/jobs/v1alpha1/marshalling.py +++ b/scaleway/scaleway/jobs/v1alpha1/marshalling.py @@ -46,6 +46,8 @@ def unmarshal_SecretEnvVar(data: Any) -> SecretEnvVar: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return SecretEnvVar(**args) @@ -61,6 +63,8 @@ def unmarshal_SecretFile(data: Any) -> SecretFile: field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None return SecretFile(**args) @@ -76,14 +80,20 @@ def unmarshal_Secret(data: Any) -> Secret: field = data.get("secret_id", None) if field is not None: args["secret_id"] = field + else: + args["secret_id"] = None field = data.get("secret_manager_id", None) if field is not None: args["secret_manager_id"] = field + else: + args["secret_manager_id"] = None field = data.get("secret_manager_version", None) if field is not None: args["secret_manager_version"] = field + else: + args["secret_manager_version"] = None field = data.get("file", None) if field is not None: @@ -111,10 +121,14 @@ def unmarshal_CronSchedule(data: Any) -> CronSchedule: field = data.get("schedule", None) if field is not None: args["schedule"] = field + else: + args["schedule"] = None field = data.get("timezone", None) if field is not None: args["timezone"] = field + else: + args["timezone"] = None return CronSchedule(**args) @@ -130,30 +144,44 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field + else: + args["cpu_limit"] = None field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field + else: + args["memory_limit"] = None field = data.get("image_uri", None) if field is not None: args["image_uri"] = field + else: + args["image_uri"] = None field = data.get("command", None) if field is not None: args["command"] = field + else: + args["command"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("created_at", None) if field is not None: @@ -170,18 +198,26 @@ def unmarshal_JobDefinition(data: Any) -> JobDefinition: field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("local_storage_capacity", None) if field is not None: args["local_storage_capacity"] = field + else: + args["local_storage_capacity"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("job_timeout", None) if field is not None: @@ -209,30 +245,44 @@ def unmarshal_JobRun(data: Any) -> JobRun: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("job_definition_id", None) if field is not None: args["job_definition_id"] = field + else: + args["job_definition_id"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = None field = data.get("error_message", None) if field is not None: args["error_message"] = field + else: + args["error_message"] = None field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field + else: + args["cpu_limit"] = None field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field + else: + args["memory_limit"] = None field = data.get("command", None) if field is not None: args["command"] = field + else: + args["command"] = None field = data.get("created_at", None) if field is not None: @@ -269,14 +319,20 @@ def unmarshal_JobRun(data: Any) -> JobRun: field = data.get("environment_variables", None) if field is not None: args["environment_variables"] = field + else: + args["environment_variables"] = None field = data.get("local_storage_capacity", None) if field is not None: args["local_storage_capacity"] = field + else: + args["local_storage_capacity"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("started_at", None) if field is not None: @@ -302,6 +358,8 @@ def unmarshal_CreateJobDefinitionSecretsResponse( args["secrets"] = ( [unmarshal_Secret(v) for v in field] if field is not None else None ) + else: + args["secrets"] = field(default_factory=list) return CreateJobDefinitionSecretsResponse(**args) @@ -317,6 +375,8 @@ def unmarshal_JobsLimits(data: Any) -> JobsLimits: field = data.get("secrets_per_job_definition", None) if field is not None: args["secrets_per_job_definition"] = field + else: + args["secrets_per_job_definition"] = None return JobsLimits(**args) @@ -336,10 +396,14 @@ def unmarshal_ListJobDefinitionSecretsResponse( args["secrets"] = ( [unmarshal_Secret(v) for v in field] if field is not None else None ) + else: + args["secrets"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListJobDefinitionSecretsResponse(**args) @@ -357,10 +421,14 @@ def unmarshal_ListJobDefinitionsResponse(data: Any) -> ListJobDefinitionsRespons args["job_definitions"] = ( [unmarshal_JobDefinition(v) for v in field] if field is not None else None ) + else: + args["job_definitions"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListJobDefinitionsResponse(**args) @@ -378,10 +446,14 @@ def unmarshal_ListJobRunsResponse(data: Any) -> ListJobRunsResponse: args["job_runs"] = ( [unmarshal_JobRun(v) for v in field] if field is not None else None ) + else: + args["job_runs"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListJobRunsResponse(**args) @@ -397,10 +469,14 @@ def unmarshal_Resource(data: Any) -> Resource: field = data.get("cpu_limit", None) if field is not None: args["cpu_limit"] = field + else: + args["cpu_limit"] = None field = data.get("memory_limit", None) if field is not None: args["memory_limit"] = field + else: + args["memory_limit"] = None return Resource(**args) @@ -418,6 +494,8 @@ def unmarshal_ListJobsResourcesResponse(data: Any) -> ListJobsResourcesResponse: args["resources"] = ( [unmarshal_Resource(v) for v in field] if field is not None else None ) + else: + args["resources"] = None return ListJobsResourcesResponse(**args) @@ -435,6 +513,8 @@ def unmarshal_StartJobDefinitionResponse(data: Any) -> StartJobDefinitionRespons args["job_runs"] = ( [unmarshal_JobRun(v) for v in field] if field is not None else None ) + else: + args["job_runs"] = None return StartJobDefinitionResponse(**args) @@ -482,7 +562,9 @@ def marshal_CreateJobDefinitionRequest( output["local_storage_capacity"] = request.local_storage_capacity if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.environment_variables is not None: output["environment_variables"] = { diff --git a/scaleway/scaleway/jobs/v1alpha1/types.py b/scaleway/scaleway/jobs/v1alpha1/types.py index 742d07950..08cfe7836 100644 --- a/scaleway/scaleway/jobs/v1alpha1/types.py +++ b/scaleway/scaleway/jobs/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -71,19 +71,16 @@ class CronSchedule: @dataclass class CreateJobDefinitionRequestCronScheduleConfig: schedule: str - timezone: str @dataclass class CreateJobDefinitionSecretsRequestSecretConfig: secret_manager_id: str - secret_manager_version: str + path: Optional[str] = None - path: Optional[str] - - env_var_name: Optional[str] + env_var_name: Optional[str] = None @dataclass @@ -103,97 +100,68 @@ class Secret: Version of the secret in Secret Manager. """ - file: Optional[SecretFile] + file: Optional[SecretFile] = None - env_var: Optional[SecretEnvVar] + env_var: Optional[SecretEnvVar] = None @dataclass class JobDefinition: id: str - name: str - cpu_limit: int - memory_limit: int - image_uri: str - command: str - project_id: str - - created_at: Optional[datetime] - - updated_at: Optional[datetime] - environment_variables: Dict[str, str] - description: str - local_storage_capacity: int - region: ScwRegion """ Region to target. If none is passed will use default region from the config. """ - job_timeout: Optional[str] - - cron_schedule: Optional[CronSchedule] + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + job_timeout: Optional[str] = None + cron_schedule: Optional[CronSchedule] = None @dataclass class JobRun: id: str - job_definition_id: str - state: JobRunState - error_message: str - cpu_limit: int - memory_limit: int - command: str - - created_at: Optional[datetime] - - updated_at: Optional[datetime] - - terminated_at: Optional[datetime] - - exit_code: Optional[int] - - run_duration: Optional[str] - environment_variables: Dict[str, str] - local_storage_capacity: int - region: ScwRegion """ Region to target. If none is passed will use default region from the config. """ - started_at: Optional[datetime] + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + terminated_at: Optional[datetime] = None + exit_code: Optional[int] = None + run_duration: Optional[str] = None + started_at: Optional[datetime] = None @dataclass class Resource: cpu_limit: int - memory_limit: int @dataclass class UpdateJobDefinitionRequestCronScheduleConfig: - schedule: Optional[str] - - timezone: Optional[str] + schedule: Optional[str] = None + timezone: Optional[str] = None @dataclass @@ -223,37 +191,37 @@ class CreateJobDefinitionRequest: Description of the job. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the job definition. """ - local_storage_capacity: Optional[int] + local_storage_capacity: Optional[int] = 0 """ Local storage capacity of the job (in MiB). """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Scaleway Project containing the job. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the job. """ - job_timeout: Optional[str] + job_timeout: Optional[str] = None """ Timeout of the job in seconds. """ - cron_schedule: Optional[CreateJobDefinitionRequestCronScheduleConfig] + cron_schedule: Optional[CreateJobDefinitionRequestCronScheduleConfig] = None """ Configure a cron for the job. """ @@ -271,7 +239,7 @@ class CreateJobDefinitionSecretsRequest: List of secrets to inject into the job. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -292,7 +260,7 @@ class DeleteJobDefinitionRequest: UUID of the job definition to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -310,7 +278,7 @@ class DeleteJobDefinitionSecretRequest: UUID of the secret reference within the job. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -323,7 +291,7 @@ class GetJobDefinitionRequest: UUID of the job definition to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -341,7 +309,7 @@ class GetJobDefinitionSecretRequest: UUID of the secret reference within the job. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -354,7 +322,7 @@ class GetJobRunRequest: UUID of the job run to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -362,7 +330,7 @@ class GetJobRunRequest: @dataclass class GetJobsLimitsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -380,7 +348,7 @@ class ListJobDefinitionSecretsRequest: UUID of the job definition. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -401,63 +369,50 @@ class ListJobDefinitionSecretsResponse: @dataclass class ListJobDefinitionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListJobDefinitionsRequestOrderBy] - - project_id: Optional[str] - - organization_id: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListJobDefinitionsRequestOrderBy] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None @dataclass class ListJobDefinitionsResponse: job_definitions: List[JobDefinition] - total_count: int @dataclass class ListJobRunsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListJobRunsRequestOrderBy] - - job_definition_id: Optional[str] - - project_id: Optional[str] - - organization_id: Optional[str] - - state: Optional[JobRunState] - - states: Optional[List[JobRunState]] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListJobRunsRequestOrderBy] = None + job_definition_id: Optional[str] = None + project_id: Optional[str] = None + organization_id: Optional[str] = None + state: Optional[JobRunState] = None + states: Optional[List[JobRunState]] = None @dataclass class ListJobRunsResponse: job_runs: List[JobRun] - total_count: int @dataclass class ListJobsResourcesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -475,22 +430,22 @@ class StartJobDefinitionRequest: UUID of the job definition to start. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - command: Optional[str] + command: Optional[str] = None """ Contextual startup command for this specific job run. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Contextual environment variables for this specific job run. """ - replicas: Optional[int] + replicas: Optional[int] = 0 """ Number of jobs to run. """ @@ -508,7 +463,7 @@ class StopJobRunRequest: UUID of the job run to stop. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -521,57 +476,57 @@ class UpdateJobDefinitionRequest: UUID of the job definition to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the job definition. """ - cpu_limit: Optional[int] + cpu_limit: Optional[int] = 0 """ CPU limit of the job. """ - memory_limit: Optional[int] + memory_limit: Optional[int] = 0 """ Memory limit of the job (in MiB). """ - local_storage_capacity: Optional[int] + local_storage_capacity: Optional[int] = 0 """ Local storage capacity of the job (in MiB). """ - image_uri: Optional[str] + image_uri: Optional[str] = None """ Image to use for the job. """ - command: Optional[str] + command: Optional[str] = None """ Startup command. """ - environment_variables: Optional[Dict[str, str]] + environment_variables: Optional[Dict[str, str]] = field(default_factory=dict) """ Environment variables of the job. """ - description: Optional[str] + description: Optional[str] = None """ Description of the job. """ - job_timeout: Optional[str] + job_timeout: Optional[str] = None """ Timeout of the job in seconds. """ - cron_schedule: Optional[UpdateJobDefinitionRequestCronScheduleConfig] + cron_schedule: Optional[UpdateJobDefinitionRequestCronScheduleConfig] = None @dataclass @@ -586,16 +541,16 @@ class UpdateJobDefinitionSecretRequest: UUID of the secret reference within the job. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - secret_manager_version: Optional[str] + secret_manager_version: Optional[str] = None """ Version of the secret in Secret Manager. """ - path: Optional[str] + path: Optional[str] = None - env_var_name: Optional[str] + env_var_name: Optional[str] = None diff --git a/scaleway/scaleway/k8s/v1/marshalling.py b/scaleway/scaleway/k8s/v1/marshalling.py index cc86a46c1..f4265c470 100644 --- a/scaleway/scaleway/k8s/v1/marshalling.py +++ b/scaleway/scaleway/k8s/v1/marshalling.py @@ -10,7 +10,16 @@ resolve_one_of, ) from .types import ( + AutoscalerEstimator, + AutoscalerExpander, CNI, + ClusterStatus, + ClusterTypeAvailability, + ClusterTypeResiliency, + MaintenanceWindowDayOfTheWeek, + NodeStatus, + PoolStatus, + PoolVolumeType, Runtime, PoolUpgradePolicy, Pool, @@ -73,10 +82,14 @@ def unmarshal_PoolUpgradePolicy(data: Any) -> PoolUpgradePolicy: 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) @@ -92,42 +105,62 @@ def unmarshal_Pool(data: Any) -> Pool: 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: @@ -144,38 +177,56 @@ def unmarshal_Pool(data: Any) -> Pool: 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(default_factory=list) field = data.get("kubelet_args", None) if field is not None: args["kubelet_args"] = field + else: + args["kubelet_args"] = field(default_factory=dict) 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: @@ -193,13 +244,13 @@ def unmarshal_Pool(data: Any) -> Pool: if field is not None: args["root_volume_size"] = field else: - args["root_volume_size"] = None + 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"] = None + args["new_images_enabled"] = False return Pool(**args) @@ -215,36 +266,52 @@ def unmarshal_Version(data: Any) -> Version: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("label", None) if field is not None: args["label"] = field + else: + args["label"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("available_cnis", None) if field is not None: args["available_cnis"] = [CNI(v) for v in field] if field is not None else None + else: + args["available_cnis"] = field(default_factory=list) field = data.get("available_container_runtimes", None) if field is not None: args["available_container_runtimes"] = ( [Runtime(v) for v in field] if field is not None else None ) + else: + args["available_container_runtimes"] = field(default_factory=list) field = data.get("available_feature_gates", None) if field is not None: args["available_feature_gates"] = field + else: + args["available_feature_gates"] = field(default_factory=list) field = data.get("available_admission_plugins", None) if field is not None: args["available_admission_plugins"] = field + else: + args["available_admission_plugins"] = field(default_factory=list) field = data.get("available_kubelet_args", None) if field is not None: args["available_kubelet_args"] = field + else: + args["available_kubelet_args"] = field(default_factory=dict) return Version(**args) @@ -260,10 +327,14 @@ def unmarshal_MaintenanceWindow(data: Any) -> MaintenanceWindow: field = data.get("start_hour", None) if field is not None: args["start_hour"] = field + else: + args["start_hour"] = 0 field = data.get("day", None) if field is not None: args["day"] = field + else: + args["day"] = MaintenanceWindowDayOfTheWeek.ANY return MaintenanceWindow(**args) @@ -279,6 +350,8 @@ def unmarshal_ClusterAutoUpgrade(data: Any) -> ClusterAutoUpgrade: field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("maintenance_window", None) if field is not None: @@ -300,42 +373,62 @@ def unmarshal_ClusterAutoscalerConfig(data: Any) -> ClusterAutoscalerConfig: field = data.get("scale_down_disabled", None) if field is not None: args["scale_down_disabled"] = field + else: + args["scale_down_disabled"] = False field = data.get("scale_down_delay_after_add", None) if field is not None: args["scale_down_delay_after_add"] = field + else: + args["scale_down_delay_after_add"] = None field = data.get("estimator", None) if field is not None: args["estimator"] = field + else: + args["estimator"] = AutoscalerEstimator.UNKNOWN_ESTIMATOR field = data.get("expander", None) if field is not None: args["expander"] = field + else: + args["expander"] = AutoscalerExpander.UNKNOWN_EXPANDER field = data.get("ignore_daemonsets_utilization", None) if field is not None: args["ignore_daemonsets_utilization"] = field + else: + args["ignore_daemonsets_utilization"] = False field = data.get("balance_similar_node_groups", None) if field is not None: args["balance_similar_node_groups"] = field + else: + args["balance_similar_node_groups"] = False field = data.get("expendable_pods_priority_cutoff", None) if field is not None: args["expendable_pods_priority_cutoff"] = field + else: + args["expendable_pods_priority_cutoff"] = 0 field = data.get("scale_down_unneeded_time", None) if field is not None: args["scale_down_unneeded_time"] = field + else: + args["scale_down_unneeded_time"] = None field = data.get("scale_down_utilization_threshold", None) if field is not None: args["scale_down_utilization_threshold"] = field + else: + args["scale_down_utilization_threshold"] = 0.0 field = data.get("max_graceful_termination_sec", None) if field is not None: args["max_graceful_termination_sec"] = field + else: + args["max_graceful_termination_sec"] = 0 return ClusterAutoscalerConfig(**args) @@ -351,30 +444,44 @@ def unmarshal_ClusterOpenIDConnectConfig(data: Any) -> ClusterOpenIDConnectConfi field = data.get("issuer_url", None) if field is not None: args["issuer_url"] = field + else: + args["issuer_url"] = None field = data.get("client_id", None) if field is not None: args["client_id"] = field + else: + args["client_id"] = None field = data.get("username_claim", None) if field is not None: args["username_claim"] = field + else: + args["username_claim"] = None field = data.get("username_prefix", None) if field is not None: args["username_prefix"] = field + else: + args["username_prefix"] = None field = data.get("groups_claim", None) if field is not None: args["groups_claim"] = field + else: + args["groups_claim"] = field(default_factory=list) field = data.get("groups_prefix", None) if field is not None: args["groups_prefix"] = field + else: + args["groups_prefix"] = None field = data.get("required_claim", None) if field is not None: args["required_claim"] = field + else: + args["required_claim"] = field(default_factory=list) return ClusterOpenIDConnectConfig(**args) @@ -390,66 +497,98 @@ def unmarshal_Cluster(data: Any) -> Cluster: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = 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"] = ClusterStatus.UNKNOWN field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("cni", None) if field is not None: args["cni"] = field + else: + args["cni"] = CNI.UNKNOWN_CNI field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("cluster_url", None) if field is not None: args["cluster_url"] = field + else: + args["cluster_url"] = None field = data.get("dns_wildcard", None) if field is not None: args["dns_wildcard"] = field + else: + args["dns_wildcard"] = None field = data.get("upgrade_available", None) if field is not None: args["upgrade_available"] = field + else: + args["upgrade_available"] = False field = data.get("feature_gates", None) if field is not None: args["feature_gates"] = field + else: + args["feature_gates"] = field(default_factory=list) field = data.get("admission_plugins", None) if field is not None: args["admission_plugins"] = field + else: + args["admission_plugins"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -484,22 +623,32 @@ def unmarshal_Cluster(data: Any) -> Cluster: field = data.get("apiserver_cert_sans", None) if field is not None: args["apiserver_cert_sans"] = field + else: + args["apiserver_cert_sans"] = field(default_factory=list) field = data.get("iam_nodes_group_id", None) if field is not None: args["iam_nodes_group_id"] = field + else: + args["iam_nodes_group_id"] = None field = data.get("pod_cidr", None) if field is not None: args["pod_cidr"] = field + else: + args["pod_cidr"] = None field = data.get("service_cidr", None) if field is not None: args["service_cidr"] = field + else: + args["service_cidr"] = None field = data.get("service_dns_ip", None) if field is not None: args["service_dns_ip"] = field + else: + args["service_dns_ip"] = None field = data.get("private_network_id", None) if field is not None: @@ -519,13 +668,13 @@ def unmarshal_Cluster(data: Any) -> Cluster: if field is not None: args["acl_available"] = field else: - args["acl_available"] = None + args["acl_available"] = False field = data.get("new_images_enabled", None) if field is not None: args["new_images_enabled"] = field else: - args["new_images_enabled"] = None + args["new_images_enabled"] = False return Cluster(**args) @@ -541,26 +690,38 @@ def unmarshal_Node(data: Any) -> Node: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("pool_id", None) if field is not None: args["pool_id"] = field + else: + args["pool_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("provider_id", None) if field is not None: args["provider_id"] = field + else: + args["provider_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("public_ip_v4", None) if field is not None: @@ -578,11 +739,13 @@ def unmarshal_Node(data: Any) -> Node: if field is not None: args["conditions"] = field else: - args["conditions"] = None + args["conditions"] = field(default_factory=dict) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = NodeStatus.UNKNOWN field = data.get("error_message", None) if field is not None: @@ -616,10 +779,14 @@ def unmarshal_ACLRule(data: Any) -> ACLRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("ip", None) if field is not None: @@ -631,7 +798,7 @@ def unmarshal_ACLRule(data: Any) -> ACLRule: if field is not None: args["scaleway_ranges"] = field else: - args["scaleway_ranges"] = None + args["scaleway_ranges"] = False return ACLRule(**args) @@ -649,6 +816,8 @@ def unmarshal_AddClusterACLRulesResponse(data: Any) -> AddClusterACLRulesRespons args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return AddClusterACLRulesResponse(**args) @@ -664,14 +833,20 @@ def unmarshal_ExternalNodeCoreV1Taint(data: Any) -> ExternalNodeCoreV1Taint: field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None field = data.get("effect", None) if field is not None: args["effect"] = field + else: + args["effect"] = None return ExternalNodeCoreV1Taint(**args) @@ -687,50 +862,74 @@ def unmarshal_ExternalNode(data: Any) -> ExternalNode: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("cluster_url", None) if field is not None: args["cluster_url"] = field + else: + args["cluster_url"] = None field = data.get("pool_version", None) if field is not None: args["pool_version"] = field + else: + args["pool_version"] = None field = data.get("cluster_ca", None) if field is not None: args["cluster_ca"] = field + else: + args["cluster_ca"] = None field = data.get("kube_token", None) if field is not None: args["kube_token"] = field + else: + args["kube_token"] = None field = data.get("kubelet_config", None) if field is not None: args["kubelet_config"] = field + else: + args["kubelet_config"] = None field = data.get("external_ip", None) if field is not None: args["external_ip"] = field + else: + args["external_ip"] = None field = data.get("containerd_version", None) if field is not None: args["containerd_version"] = field + else: + args["containerd_version"] = None field = data.get("runc_version", None) if field is not None: args["runc_version"] = field + else: + args["runc_version"] = None field = data.get("cni_plugins_version", None) if field is not None: args["cni_plugins_version"] = field + else: + args["cni_plugins_version"] = None field = data.get("node_labels", None) if field is not None: args["node_labels"] = field + else: + args["node_labels"] = None field = data.get("node_taints", None) if field is not None: @@ -739,10 +938,14 @@ def unmarshal_ExternalNode(data: Any) -> ExternalNode: if field is not None else None ) + else: + args["node_taints"] = None field = data.get("iam_token", None) if field is not None: args["iam_token"] = field + else: + args["iam_token"] = None return ExternalNode(**args) @@ -758,10 +961,14 @@ def unmarshal_ExternalNodeAuth(data: Any) -> ExternalNodeAuth: field = data.get("node_secret_key", None) if field is not None: args["node_secret_key"] = field + else: + args["node_secret_key"] = None field = data.get("metadata_url", None) if field is not None: args["metadata_url"] = field + else: + args["metadata_url"] = None return ExternalNodeAuth(**args) @@ -777,12 +984,16 @@ def unmarshal_ListClusterACLRulesResponse(data: Any) -> ListClusterACLRulesRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("rules", None) if field is not None: args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return ListClusterACLRulesResponse(**args) @@ -798,38 +1009,56 @@ def unmarshal_ClusterType(data: Any) -> ClusterType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("availability", None) if field is not None: args["availability"] = field + else: + args["availability"] = ClusterTypeAvailability.AVAILABLE field = data.get("max_nodes", None) if field is not None: args["max_nodes"] = field + else: + args["max_nodes"] = 0 field = data.get("sla", None) if field is not None: args["sla"] = field + else: + args["sla"] = 0.0 field = data.get("resiliency", None) if field is not None: args["resiliency"] = field + else: + args["resiliency"] = ClusterTypeResiliency.UNKNOWN_RESILIENCY field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("dedicated", None) if field is not None: args["dedicated"] = field + else: + args["dedicated"] = False field = data.get("audit_logs_supported", None) if field is not None: args["audit_logs_supported"] = field + else: + args["audit_logs_supported"] = False field = data.get("max_etcd_size", None) if field is not None: args["max_etcd_size"] = field + else: + args["max_etcd_size"] = 0 field = data.get("commitment_delay", None) if field is not None: @@ -855,10 +1084,14 @@ def unmarshal_ListClusterAvailableTypesResponse( args["cluster_types"] = ( [unmarshal_ClusterType(v) for v in field] if field is not None else None ) + else: + args["cluster_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListClusterAvailableTypesResponse(**args) @@ -878,6 +1111,8 @@ def unmarshal_ListClusterAvailableVersionsResponse( args["versions"] = ( [unmarshal_Version(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) return ListClusterAvailableVersionsResponse(**args) @@ -893,12 +1128,16 @@ def unmarshal_ListClusterTypesResponse(data: Any) -> ListClusterTypesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("cluster_types", None) if field is not None: args["cluster_types"] = ( [unmarshal_ClusterType(v) for v in field] if field is not None else None ) + else: + args["cluster_types"] = field(default_factory=list) return ListClusterTypesResponse(**args) @@ -914,12 +1153,16 @@ def unmarshal_ListClustersResponse(data: Any) -> ListClustersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("clusters", None) if field is not None: args["clusters"] = ( [unmarshal_Cluster(v) for v in field] if field is not None else None ) + else: + args["clusters"] = field(default_factory=list) return ListClustersResponse(**args) @@ -935,12 +1178,16 @@ def unmarshal_ListNodesResponse(data: Any) -> ListNodesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("nodes", None) if field is not None: args["nodes"] = ( [unmarshal_Node(v) for v in field] if field is not None else None ) + else: + args["nodes"] = field(default_factory=list) return ListNodesResponse(**args) @@ -956,12 +1203,16 @@ def unmarshal_ListPoolsResponse(data: Any) -> ListPoolsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("pools", None) if field is not None: args["pools"] = ( [unmarshal_Pool(v) for v in field] if field is not None else None ) + else: + args["pools"] = field(default_factory=list) return ListPoolsResponse(**args) @@ -979,6 +1230,8 @@ def unmarshal_ListVersionsResponse(data: Any) -> ListVersionsResponse: args["versions"] = ( [unmarshal_Version(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) return ListVersionsResponse(**args) @@ -994,14 +1247,20 @@ def unmarshal_NodeMetadataCoreV1Taint(data: Any) -> NodeMetadataCoreV1Taint: field = data.get("key", None) if field is not None: args["key"] = field + else: + args["key"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None field = data.get("effect", None) if field is not None: args["effect"] = field + else: + args["effect"] = None return NodeMetadataCoreV1Taint(**args) @@ -1017,34 +1276,50 @@ def unmarshal_NodeMetadata(data: Any) -> NodeMetadata: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("cluster_url", None) if field is not None: args["cluster_url"] = field + else: + args["cluster_url"] = None field = data.get("cluster_ca", None) if field is not None: args["cluster_ca"] = field + else: + args["cluster_ca"] = None field = data.get("credential_provider_config", None) if field is not None: args["credential_provider_config"] = field + else: + args["credential_provider_config"] = None field = data.get("pool_version", None) if field is not None: args["pool_version"] = field + else: + args["pool_version"] = None field = data.get("kubelet_config", None) if field is not None: args["kubelet_config"] = field + else: + args["kubelet_config"] = None field = data.get("node_labels", None) if field is not None: args["node_labels"] = field + else: + args["node_labels"] = None field = data.get("node_taints", None) if field is not None: @@ -1053,42 +1328,62 @@ def unmarshal_NodeMetadata(data: Any) -> NodeMetadata: if field is not None else None ) + else: + args["node_taints"] = None field = data.get("provider_id", None) if field is not None: args["provider_id"] = field + else: + args["provider_id"] = None field = data.get("resolvconf_path", None) if field is not None: args["resolvconf_path"] = field + else: + args["resolvconf_path"] = None field = data.get("has_gpu", None) if field is not None: args["has_gpu"] = field + else: + args["has_gpu"] = None field = data.get("external_ip", None) if field is not None: args["external_ip"] = field + else: + args["external_ip"] = None field = data.get("repo_uri", None) if field is not None: args["repo_uri"] = field + else: + args["repo_uri"] = None field = data.get("installer_tags", None) if field is not None: args["installer_tags"] = field + else: + args["installer_tags"] = None field = data.get("updater_bin_url", None) if field is not None: args["updater_bin_url"] = field + else: + args["updater_bin_url"] = None field = data.get("updater_bin_version", None) if field is not None: args["updater_bin_version"] = field + else: + args["updater_bin_version"] = None field = data.get("updater_bin_path", None) if field is not None: args["updater_bin_path"] = field + else: + args["updater_bin_path"] = None return NodeMetadata(**args) @@ -1106,6 +1401,8 @@ def unmarshal_SetClusterACLRulesResponse(data: Any) -> SetClusterACLRulesRespons args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return SetClusterACLRulesResponse(**args) @@ -1158,7 +1455,7 @@ def marshal_MaintenanceWindow( output["start_hour"] = request.start_hour if request.day is not None: - output["day"] = str(request.day) + output["day"] = request.day return output @@ -1202,10 +1499,10 @@ def marshal_CreateClusterRequestAutoscalerConfig( output: Dict[str, Any] = {} if request.estimator is not None: - output["estimator"] = str(request.estimator) + output["estimator"] = request.estimator if request.expander is not None: - output["expander"] = str(request.expander) + output["expander"] = request.expander if request.scale_down_disabled is not None: output["scale_down_disabled"] = request.scale_down_disabled @@ -1287,7 +1584,7 @@ def marshal_CreateClusterRequestPoolConfig( output["size"] = request.size if request.container_runtime is not None: - output["container_runtime"] = str(request.container_runtime) + output["container_runtime"] = request.container_runtime if request.placement_group_id is not None: output["placement_group_id"] = request.placement_group_id @@ -1310,10 +1607,12 @@ def marshal_CreateClusterRequestPoolConfig( } if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone if request.root_volume_type is not None: - output["root_volume_type"] = str(request.root_volume_type) + output["root_volume_type"] = request.root_volume_type if request.public_ip_disabled is not None: output["public_ip_disabled"] = request.public_ip_disabled @@ -1366,7 +1665,7 @@ def marshal_CreateClusterRequest( output["version"] = request.version if request.cni is not None: - output["cni"] = str(request.cni) + output["cni"] = request.cni if request.name is not None: output["name"] = request.name @@ -1470,7 +1769,7 @@ def marshal_CreatePoolRequest( output["max_size"] = request.max_size if request.container_runtime is not None: - output["container_runtime"] = str(request.container_runtime) + output["container_runtime"] = request.container_runtime if request.tags is not None: output["tags"] = request.tags @@ -1486,10 +1785,12 @@ def marshal_CreatePoolRequest( ) if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone + output["zone"] = request.zone + else: + output["zone"] = defaults.default_zone if request.root_volume_type is not None: - output["root_volume_type"] = str(request.root_volume_type) + output["root_volume_type"] = request.root_volume_type if request.root_volume_size is not None: output["root_volume_size"] = request.root_volume_size @@ -1562,10 +1863,10 @@ def marshal_UpdateClusterRequestAutoscalerConfig( output: Dict[str, Any] = {} if request.estimator is not None: - output["estimator"] = str(request.estimator) + output["estimator"] = request.estimator if request.expander is not None: - output["expander"] = str(request.expander) + output["expander"] = request.expander if request.scale_down_disabled is not None: output["scale_down_disabled"] = request.scale_down_disabled diff --git a/scaleway/scaleway/k8s/v1/types.py b/scaleway/scaleway/k8s/v1/types.py index ec4c047b2..e01af6041 100644 --- a/scaleway/scaleway/k8s/v1/types.py +++ b/scaleway/scaleway/k8s/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import Dict, List, Optional @@ -212,18 +212,17 @@ class MaintenanceWindow: @dataclass class PoolUpgradePolicy: max_unavailable: int - max_surge: int @dataclass class CreateClusterRequestPoolConfigUpgradePolicy: - max_unavailable: Optional[int] + max_unavailable: Optional[int] = 0 """ The maximum number of nodes that can be not ready at the same time. """ - max_surge: Optional[int] + max_surge: Optional[int] = 0 """ The maximum number of nodes to be created during the upgrade. """ @@ -236,7 +235,7 @@ class ClusterAutoUpgrade: Defines whether auto upgrade is enabled for the cluster. """ - maintenance_window: Optional[MaintenanceWindow] + maintenance_window: Optional[MaintenanceWindow] = None """ Maintenance window of the cluster auto upgrades. """ @@ -385,16 +384,6 @@ class Pool: Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. """ - created_at: Optional[datetime] - """ - Date on which the pool was created. - """ - - updated_at: Optional[datetime] - """ - Date on which the pool was last updated. - """ - container_runtime: Runtime """ Customization of the container runtime is available for each pool. @@ -443,22 +432,32 @@ class Pool: Cluster region of the pool. """ - placement_group_id: Optional[str] + 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] + upgrade_policy: Optional[PoolUpgradePolicy] = None """ Pool upgrade policy. """ - root_volume_size: Optional[int] + root_volume_size: Optional[int] = 0 """ System volume disk size. """ - new_images_enabled: Optional[bool] + new_images_enabled: Optional[bool] = False """ Defines whether the pool is migrated to new images. """ @@ -471,9 +470,9 @@ class ACLRuleRequest: Description of the ACL. """ - ip: Optional[str] + ip: Optional[str] = None - scaleway_ranges: Optional[bool] + scaleway_ranges: Optional[bool] = False @dataclass @@ -488,9 +487,9 @@ class ACLRule: Description of the ACL. """ - ip: Optional[str] + ip: Optional[str] = None - scaleway_ranges: Optional[bool] + scaleway_ranges: Optional[bool] = False @dataclass @@ -500,7 +499,7 @@ class CreateClusterRequestAutoUpgrade: Defines whether auto upgrade is enabled for the cluster. """ - maintenance_window: Optional[MaintenanceWindow] + maintenance_window: Optional[MaintenanceWindow] = None """ Maintenance window of the cluster auto upgrades. """ @@ -518,42 +517,42 @@ class CreateClusterRequestAutoscalerConfig: Type of node group expander to be used in scale up. """ - scale_down_disabled: Optional[bool] + scale_down_disabled: Optional[bool] = False """ Disable the cluster autoscaler. """ - scale_down_delay_after_add: Optional[str] + scale_down_delay_after_add: Optional[str] = None """ How long after scale up the scale down evaluation resumes. """ - ignore_daemonsets_utilization: Optional[bool] + ignore_daemonsets_utilization: Optional[bool] = False """ Ignore DaemonSet pods when calculating resource utilization for scaling down. """ - balance_similar_node_groups: Optional[bool] + balance_similar_node_groups: Optional[bool] = False """ Detect similar node groups and balance the number of nodes between them. """ - expendable_pods_priority_cutoff: Optional[int] + expendable_pods_priority_cutoff: Optional[int] = 0 """ Pods with priority below cutoff will be expendable. They can be killed without any consideration during scale down and they won't cause scale up. Pods with null priority (PodPriority disabled) are non expendable. """ - scale_down_unneeded_time: Optional[str] + scale_down_unneeded_time: Optional[str] = None """ How long a node should be unneeded before it is eligible to be scaled down. """ - scale_down_utilization_threshold: Optional[float] + 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. """ - max_graceful_termination_sec: Optional[int] + 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. """ @@ -571,27 +570,27 @@ class CreateClusterRequestOpenIDConnectConfig: A client ID that all tokens must be issued for. """ - username_claim: Optional[str] + username_claim: Optional[str] = None """ JWT claim to use as the user name. The default is `sub`, which is expected to be the end user's unique identifier. Admins can choose other claims, such as `email` or `name`, depending on their provider. However, claims other than `email` will be prefixed with the issuer URL to prevent name collision. """ - username_prefix: Optional[str] + username_prefix: Optional[str] = None """ Prefix prepended to username claims to prevent name collision (such as `system:` users). For example, the value `oidc:` will create usernames like `oidc:jane.doe`. If this flag is not provided and `username_claim` is a value other than `email`, the prefix defaults to `( Issuer URL )#` where `( Issuer URL )` is the value of `issuer_url`. The value `-` can be used to disable all prefixing. """ - groups_claim: Optional[List[str]] + groups_claim: Optional[List[str]] = field(default_factory=list) """ JWT claim to use as the user's group. """ - groups_prefix: Optional[str] + groups_prefix: Optional[str] = None """ Prefix prepended to group claims to prevent name collision (such as `system:` groups). For example, the value `oidc:` will create group names like `oidc:engineering` and `oidc:infra`. """ - required_claim: Optional[List[str]] + required_claim: Optional[List[str]] = field(default_factory=list) """ Multiple key=value pairs describing a required claim in the ID token. If set, the claims are verified to be present in the ID token with a matching value. """ @@ -624,21 +623,6 @@ class CreateClusterRequestPoolConfig: Customization of the container runtime is available for each pool. """ - placement_group_id: Optional[str] - """ - Placement group ID in which all the nodes of the pool will be created, placement groups are limited to 20 instances. - """ - - min_size: Optional[int] - """ - Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. - """ - - max_size: Optional[int] - """ - Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. - """ - autohealing: bool """ Defines whether the autohealing feature is enabled for the pool. @@ -672,17 +656,32 @@ class CreateClusterRequestPoolConfig: 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. """ - upgrade_policy: Optional[CreateClusterRequestPoolConfigUpgradePolicy] + 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. + """ + + min_size: Optional[int] = 0 + """ + Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + """ + + max_size: Optional[int] = 0 + """ + Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + """ + + upgrade_policy: Optional[CreateClusterRequestPoolConfigUpgradePolicy] = None """ Pool upgrade policy. """ - root_volume_size: Optional[int] + root_volume_size: Optional[int] = 0 """ System volume disk size. """ - security_group_id: Optional[str] + security_group_id: Optional[str] = None """ 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. """ @@ -690,17 +689,14 @@ class CreateClusterRequestPoolConfig: @dataclass class CreatePoolRequestUpgradePolicy: - max_unavailable: Optional[int] - - max_surge: Optional[int] + max_unavailable: Optional[int] = None + max_surge: Optional[int] = None @dataclass class ExternalNodeCoreV1Taint: key: str - value: str - effect: str @@ -751,7 +747,7 @@ class ClusterType: Maximum amount of data that can be stored in etcd for the offer. """ - commitment_delay: Optional[str] + commitment_delay: Optional[str] = None """ Time period during which you can no longer switch to a lower offer. """ @@ -882,72 +878,72 @@ class Cluster: List of enabled admission plugins. """ - created_at: Optional[datetime] + apiserver_cert_sans: List[str] """ - Date on which the cluster was created. + Additional Subject Alternative Names for the Kubernetes API server certificate. """ - updated_at: Optional[datetime] + iam_nodes_group_id: str """ - Date on which the cluster was last updated. + IAM group that nodes are members of (this field might be empty during early stage of cluster creation). """ - autoscaler_config: Optional[ClusterAutoscalerConfig] + pod_cidr: str """ - Autoscaler config for the cluster. + Subnet used for the Pod CIDR. """ - auto_upgrade: Optional[ClusterAutoUpgrade] + service_cidr: str """ - Auto upgrade Kubernetes version of the cluster. + Subnet used for the Service CIDR. """ - open_id_connect_config: Optional[ClusterOpenIDConnectConfig] + service_dns_ip: str """ - This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. + IP used for the DNS Service. """ - apiserver_cert_sans: List[str] + created_at: Optional[datetime] = None """ - Additional Subject Alternative Names for the Kubernetes API server certificate. + Date on which the cluster was created. """ - iam_nodes_group_id: str + updated_at: Optional[datetime] = None """ - IAM group that nodes are members of (this field might be empty during early stage of cluster creation). + Date on which the cluster was last updated. """ - pod_cidr: str + autoscaler_config: Optional[ClusterAutoscalerConfig] = None """ - Subnet used for the Pod CIDR. + Autoscaler config for the cluster. """ - service_cidr: str + auto_upgrade: Optional[ClusterAutoUpgrade] = None """ - Subnet used for the Service CIDR. + Auto upgrade Kubernetes version of the cluster. """ - service_dns_ip: str + open_id_connect_config: Optional[ClusterOpenIDConnectConfig] = None """ - IP used for the DNS Service. + This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Private network ID for internal cluster communication. """ - commitment_ends_at: Optional[datetime] + commitment_ends_at: Optional[datetime] = None """ Date on which it will be possible to switch to a smaller offer. """ - acl_available: Optional[bool] + acl_available: Optional[bool] = False """ Defines whether ACL is available on the cluster. """ - new_images_enabled: Optional[bool] + new_images_enabled: Optional[bool] = False """ Defines whether all pools are migrated to new images. """ @@ -985,37 +981,37 @@ class Node: Name of the node. """ - public_ip_v4: Optional[str] + status: NodeStatus """ - Public IPv4 address of the node. + Status of the node. """ - public_ip_v6: Optional[str] + public_ip_v4: Optional[str] = None """ - Public IPv6 address of the node. + Public IPv4 address of the node. """ - conditions: Optional[Dict[str, str]] + public_ip_v6: Optional[str] = None """ - Conditions of the node. These conditions contain the Node Problem Detector conditions, as well as some in house conditions. + Public IPv6 address of the node. """ - status: NodeStatus + conditions: Optional[Dict[str, str]] = field(default_factory=dict) """ - Status of the node. + Conditions of the node. These conditions contain the Node Problem Detector conditions, as well as some in house conditions. """ - error_message: Optional[str] + error_message: Optional[str] = None """ Details of the error, if any occurred when managing the node. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the node was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the node was last updated. """ @@ -1024,20 +1020,18 @@ class Node: @dataclass class NodeMetadataCoreV1Taint: key: str - value: str - effect: str @dataclass class UpdateClusterRequestAutoUpgrade: - enable: Optional[bool] + enable: Optional[bool] = False """ Defines whether auto upgrade is enabled for the cluster. """ - maintenance_window: Optional[MaintenanceWindow] + maintenance_window: Optional[MaintenanceWindow] = None """ Maintenance window of the cluster auto upgrades. """ @@ -1055,42 +1049,42 @@ class UpdateClusterRequestAutoscalerConfig: Type of node group expander to be used in scale up. """ - scale_down_disabled: Optional[bool] + scale_down_disabled: Optional[bool] = False """ Disable the cluster autoscaler. """ - scale_down_delay_after_add: Optional[str] + scale_down_delay_after_add: Optional[str] = None """ How long after scale up the scale down evaluation resumes. """ - ignore_daemonsets_utilization: Optional[bool] + ignore_daemonsets_utilization: Optional[bool] = False """ Ignore DaemonSet pods when calculating resource utilization for scaling down. """ - balance_similar_node_groups: Optional[bool] + balance_similar_node_groups: Optional[bool] = False """ Detect similar node groups and balance the number of nodes between them. """ - expendable_pods_priority_cutoff: Optional[int] + expendable_pods_priority_cutoff: Optional[int] = 0 """ Pods with priority below cutoff will be expendable. They can be killed without any consideration during scale down and they won't cause scale up. Pods with null priority (PodPriority disabled) are non expendable. """ - scale_down_unneeded_time: Optional[str] + scale_down_unneeded_time: Optional[str] = None """ How long a node should be unneeded before it is eligible to be scaled down. """ - scale_down_utilization_threshold: Optional[float] + 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. """ - max_graceful_termination_sec: Optional[int] + 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. """ @@ -1098,37 +1092,37 @@ class UpdateClusterRequestAutoscalerConfig: @dataclass class UpdateClusterRequestOpenIDConnectConfig: - issuer_url: Optional[str] + issuer_url: Optional[str] = None """ URL of the provider which allows the API server to discover public signing keys. Only URLs using the `https://` scheme are accepted. This is typically the provider's discovery URL without a path, for example "https://accounts.google.com" or "https://login.salesforce.com". """ - client_id: Optional[str] + client_id: Optional[str] = None """ A client ID that all tokens must be issued for. """ - username_claim: Optional[str] + username_claim: Optional[str] = None """ JWT claim to use as the user name. The default is `sub`, which is expected to be the end user's unique identifier. Admins can choose other claims, such as `email` or `name`, depending on their provider. However, claims other than `email` will be prefixed with the issuer URL to prevent name collision. """ - username_prefix: Optional[str] + username_prefix: Optional[str] = None """ Prefix prepended to username claims to prevent name collision (such as `system:` users). For example, the value `oidc:` will create usernames like `oidc:jane.doe`. If this flag is not provided and `username_claim` is a value other than `email`, the prefix defaults to `( Issuer URL )#` where `( Issuer URL )` is the value of `issuer_url`. The value `-` can be used to disable all prefixing. """ - groups_claim: Optional[List[str]] + groups_claim: Optional[List[str]] = field(default_factory=list) """ JWT claim to use as the user's group. """ - groups_prefix: Optional[str] + groups_prefix: Optional[str] = None """ Prefix prepended to group claims to prevent name collision (such as `system:` groups). For example, the value `oidc:` will create group names like `oidc:engineering` and `oidc:infra`. """ - required_claim: Optional[List[str]] + required_claim: Optional[List[str]] = field(default_factory=list) """ Multiple key=value pairs describing a required claim in the ID token. If set, the claims are verified to be present in the ID token with a matching value. """ @@ -1136,9 +1130,8 @@ class UpdateClusterRequestOpenIDConnectConfig: @dataclass class UpdatePoolRequestUpgradePolicy: - max_unavailable: Optional[int] - - max_surge: Optional[int] + max_unavailable: Optional[int] = None + max_surge: Optional[int] = None @dataclass @@ -1148,12 +1141,12 @@ class AddClusterACLRulesRequest: ID of the cluster whose ACLs will be added. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - acls: Optional[List[ACLRuleRequest]] + acls: Optional[List[ACLRuleRequest]] = field(default_factory=list) """ ACLs to add. """ @@ -1174,7 +1167,7 @@ class AuthExternalNodeRequest: Pool the node will be attached to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1202,86 +1195,85 @@ class CreateClusterRequest: Container Network Interface (CNI) plugin running in the cluster. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Cluster name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the cluster. """ - pools: Optional[List[CreateClusterRequestPoolConfig]] + pools: Optional[List[CreateClusterRequestPoolConfig]] = field(default_factory=list) """ Pools created along with the cluster. """ - autoscaler_config: Optional[CreateClusterRequestAutoscalerConfig] + autoscaler_config: Optional[CreateClusterRequestAutoscalerConfig] = None """ Autoscaler configuration for the cluster. It allows you to set (to an extent) your preferred autoscaler configuration, which is an implementation of the cluster-autoscaler (https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler/). """ - auto_upgrade: Optional[CreateClusterRequestAutoUpgrade] + auto_upgrade: Optional[CreateClusterRequestAutoUpgrade] = None """ Auto upgrade configuration of the cluster. This configuration enables to set a specific 2-hour time window in which the cluster can be automatically updated to the latest patch version. """ - feature_gates: Optional[List[str]] + feature_gates: Optional[List[str]] = field(default_factory=list) """ List of feature gates to enable. """ - admission_plugins: Optional[List[str]] + admission_plugins: Optional[List[str]] = field(default_factory=list) """ List of admission plugins to enable. """ - open_id_connect_config: Optional[CreateClusterRequestOpenIDConnectConfig] + open_id_connect_config: Optional[CreateClusterRequestOpenIDConnectConfig] = None """ OpenID Connect configuration of the cluster. This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. """ - apiserver_cert_sans: Optional[List[str]] + apiserver_cert_sans: Optional[List[str]] = field(default_factory=list) """ Additional Subject Alternative Names for the Kubernetes API server certificate. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Private network ID for internal cluster communication (cannot be changed later). """ - pod_cidr: Optional[str] + pod_cidr: Optional[str] = None """ Subnet used for the Pod CIDR (cannot be changed later). """ - service_cidr: Optional[str] + service_cidr: Optional[str] = None """ Subnet used for the Service CIDR (cannot be changed later). """ - service_dns_ip: Optional[str] + service_dns_ip: Optional[str] = None """ IP used for the DNS Service (cannot be changes later). If unset, default to Service CIDR's network + 10. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass class CreateExternalNodeRequest: pool_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1289,11 +1281,6 @@ class CreateExternalNodeRequest: @dataclass class CreatePoolRequest: - region: Optional[ScwRegion] - """ - Region to target. If none is passed will use default region from the config. - """ - cluster_id: str """ Cluster ID to which the pool will be attached. @@ -1314,62 +1301,67 @@ class CreatePoolRequest: Size (number of nodes) of the pool. """ - name: Optional[str] + autohealing: bool """ - Pool name. + Defines whether the autohealing feature is enabled for the pool. """ - placement_group_id: Optional[str] + public_ip_disabled: bool """ - Placement group ID in which all the nodes of the pool will be created, placement groups are limited to 20 instances. + 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. """ - min_size: Optional[int] + region: Optional[ScwRegion] = None """ - Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + Region to target. If none is passed will use default region from the config. """ - autohealing: bool + name: Optional[str] = None """ - Defines whether the autohealing feature is enabled for the pool. + Pool name. """ - public_ip_disabled: bool + placement_group_id: Optional[str] = None """ - 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. + Placement group ID in which all the nodes of the pool will be created, placement groups are limited to 20 instances. """ - max_size: Optional[int] + min_size: Optional[int] = 0 + """ + Defines the minimum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. + """ + + max_size: Optional[int] = 0 """ Defines the maximum size of the pool. Note that this field is only used when autoscaling is enabled on the pool. """ - container_runtime: Optional[Runtime] + container_runtime: Optional[Runtime] = Runtime.UNKNOWN_RUNTIME """ Customization of the container runtime is available for each pool. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags associated with the pool, see [managing tags](https://www.scaleway.com/en/docs/containers/kubernetes/api-cli/managing-tags). """ - kubelet_args: Optional[Dict[str, str]] + kubelet_args: Optional[Dict[str, str]] = field(default_factory=dict) """ Kubelet arguments to be used by this pool. Note that this feature is experimental. """ - upgrade_policy: Optional[CreatePoolRequestUpgradePolicy] + upgrade_policy: Optional[CreatePoolRequestUpgradePolicy] = None """ Pool upgrade policy. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone in which the pool's nodes will be spawned. """ - root_volume_type: Optional[PoolVolumeType] + root_volume_type: Optional[PoolVolumeType] = PoolVolumeType.DEFAULT_VOLUME_TYPE """ * `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 @@ -1377,12 +1369,12 @@ class CreatePoolRequest: * `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. """ - root_volume_size: Optional[int] + root_volume_size: Optional[int] = 0 """ System volume disk size. """ - security_group_id: Optional[str] + security_group_id: Optional[str] = None """ 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. """ @@ -1395,7 +1387,7 @@ class DeleteACLRuleRequest: ID of the ACL rule to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1413,7 +1405,7 @@ class DeleteClusterRequest: Defines whether all volumes (including retain volume type), empty Private Networks and Load Balancers with a name starting with the cluster ID will also be deleted. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1436,7 +1428,7 @@ class DeleteNodeRequest: Add a new node after the deletion of this node. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1449,7 +1441,7 @@ class DeletePoolRequest: ID of the pool to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1458,38 +1450,24 @@ class DeletePoolRequest: @dataclass class ExternalNode: id: str - name: str - cluster_url: str - pool_version: str - cluster_ca: str - kube_token: str - kubelet_config: str - external_ip: str - containerd_version: str - runc_version: str - cni_plugins_version: str - node_labels: Dict[str, str] - node_taints: List[ExternalNodeCoreV1Taint] - iam_token: str @dataclass class ExternalNodeAuth: node_secret_key: str - metadata_url: str @@ -1500,12 +1478,12 @@ class GetClusterKubeConfigRequest: Cluster ID for which to download the kubeconfig. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - redacted: Optional[bool] + redacted: Optional[bool] = False """ Hide the legacy token from the kubeconfig. """ @@ -1518,7 +1496,7 @@ class GetClusterRequest: ID of the requested cluster. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1526,7 +1504,7 @@ class GetClusterRequest: @dataclass class GetNodeMetadataRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1539,7 +1517,7 @@ class GetNodeRequest: ID of the requested node. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1552,7 +1530,7 @@ class GetPoolRequest: ID of the requested pool. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1565,7 +1543,7 @@ class GetVersionRequest: Requested version name. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1578,17 +1556,17 @@ class ListClusterACLRulesRequest: ID of the cluster whose ACLs will be listed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned ACLs. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of ACLs per page. """ @@ -1614,7 +1592,7 @@ class ListClusterAvailableTypesRequest: Cluster ID for which the available Kubernetes types will be listed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1640,7 +1618,7 @@ class ListClusterAvailableVersionsRequest: Cluster ID for which the available Kubernetes versions will be listed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1656,17 +1634,17 @@ class ListClusterAvailableVersionsResponse: @dataclass class ListClusterTypesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number, from the paginated results, to return for cluster-types. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of clusters per page. """ @@ -1687,52 +1665,54 @@ class ListClusterTypesResponse: @dataclass class ListClustersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID on which to filter the returned clusters. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID on which to filter the returned clusters. """ - order_by: Optional[ListClustersRequestOrderBy] + order_by: Optional[ListClustersRequestOrderBy] = ( + ListClustersRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of returned clusters. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return for clusters, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of clusters per page. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter on, only clusters containing this substring in their name will be returned. """ - status: Optional[ClusterStatus] + status: Optional[ClusterStatus] = ClusterStatus.UNKNOWN """ Status to filter on, only clusters with this status will be returned. """ - type_: Optional[str] + type_: Optional[str] = None """ Type to filter on, only clusters with this type will be returned. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Private Network ID to filter on, only clusters within this Private Network will be returned. """ @@ -1758,37 +1738,37 @@ class ListNodesRequest: Cluster ID from which the nodes will be listed from. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - pool_id: Optional[str] + pool_id: Optional[str] = None """ Pool ID on which to filter the returned nodes. """ - order_by: Optional[ListNodesRequestOrderBy] + order_by: Optional[ListNodesRequestOrderBy] = ListNodesRequestOrderBy.CREATED_AT_ASC """ Sort order of the returned nodes. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned nodes. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of nodes per page. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter on, only nodes containing this substring in their name will be returned. """ - status: Optional[NodeStatus] + status: Optional[NodeStatus] = NodeStatus.UNKNOWN """ Status to filter on, only nodes with this status will be returned. """ @@ -1814,32 +1794,32 @@ class ListPoolsRequest: ID of the cluster whose pools will be listed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPoolsRequestOrderBy] + order_by: Optional[ListPoolsRequestOrderBy] = ListPoolsRequestOrderBy.CREATED_AT_ASC """ Sort order of returned pools. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number for the returned pools. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of pools per page. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter on, only pools containing this substring in their name will be returned. """ - status: Optional[PoolStatus] + status: Optional[PoolStatus] = PoolStatus.UNKNOWN """ Status to filter on, only pools with this status will be returned. """ @@ -1860,7 +1840,7 @@ class ListPoolsResponse: @dataclass class ListVersionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1877,51 +1857,33 @@ class ListVersionsResponse: @dataclass class MigratePoolsToNewImagesRequest: cluster_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - pool_ids: Optional[List[str]] + pool_ids: Optional[List[str]] = None @dataclass class NodeMetadata: id: str - name: str - cluster_url: str - cluster_ca: str - credential_provider_config: str - pool_version: str - kubelet_config: str - node_labels: Dict[str, str] - node_taints: List[NodeMetadataCoreV1Taint] - provider_id: str - resolvconf_path: str - has_gpu: bool - external_ip: str - repo_uri: str - installer_tags: List[str] - updater_bin_url: str - updater_bin_version: str - updater_bin_path: str @@ -1932,7 +1894,7 @@ class RebootNodeRequest: ID of the node to reboot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1945,7 +1907,7 @@ class ReplaceNodeRequest: ID of the node to replace. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1958,7 +1920,7 @@ class ResetClusterAdminTokenRequest: Cluster ID on which the admin token will be renewed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1971,12 +1933,12 @@ class SetClusterACLRulesRequest: ID of the cluster whose ACLs will be set. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - acls: Optional[List[ACLRuleRequest]] + acls: Optional[List[ACLRuleRequest]] = field(default_factory=list) """ ACLs to set. """ @@ -2002,7 +1964,7 @@ class SetClusterTypeRequest: Type of the cluster. Note that some migrations are not possible (please refer to product documentation). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2015,52 +1977,52 @@ class UpdateClusterRequest: ID of the cluster to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ New external name for the cluster. """ - description: Optional[str] + description: Optional[str] = None """ New description for the cluster. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags associated with the cluster. """ - autoscaler_config: Optional[UpdateClusterRequestAutoscalerConfig] + autoscaler_config: Optional[UpdateClusterRequestAutoscalerConfig] = None """ New autoscaler config for the cluster. """ - auto_upgrade: Optional[UpdateClusterRequestAutoUpgrade] + auto_upgrade: Optional[UpdateClusterRequestAutoUpgrade] = None """ New auto upgrade configuration for the cluster. Note that all fields needs to be set. """ - feature_gates: Optional[List[str]] + feature_gates: Optional[List[str]] = field(default_factory=list) """ List of feature gates to enable. """ - admission_plugins: Optional[List[str]] + admission_plugins: Optional[List[str]] = field(default_factory=list) """ List of admission plugins to enable. """ - open_id_connect_config: Optional[UpdateClusterRequestOpenIDConnectConfig] + open_id_connect_config: Optional[UpdateClusterRequestOpenIDConnectConfig] = None """ OpenID Connect configuration of the cluster. This configuration enables to update the OpenID Connect configuration of the Kubernetes API server. """ - apiserver_cert_sans: Optional[List[str]] + apiserver_cert_sans: Optional[List[str]] = field(default_factory=list) """ Additional Subject Alternative Names for the Kubernetes API server certificate. """ @@ -2073,47 +2035,47 @@ class UpdatePoolRequest: ID of the pool to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - autoscaling: Optional[bool] + autoscaling: Optional[bool] = False """ New value for the pool autoscaling enablement. """ - size: Optional[int] + size: Optional[int] = 0 """ New desired pool size. """ - min_size: Optional[int] + min_size: Optional[int] = 0 """ New minimum size for the pool. """ - max_size: Optional[int] + max_size: Optional[int] = 0 """ New maximum size for the pool. """ - autohealing: Optional[bool] + autohealing: Optional[bool] = False """ New value for the pool autohealing enablement. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags associated with the pool. """ - kubelet_args: Optional[Dict[str, str]] + kubelet_args: Optional[Dict[str, str]] = field(default_factory=dict) """ New Kubelet arguments to be used by this pool. Note that this feature is experimental. """ - upgrade_policy: Optional[UpdatePoolRequestUpgradePolicy] + upgrade_policy: Optional[UpdatePoolRequestUpgradePolicy] = None """ New upgrade policy for the pool. """ @@ -2136,7 +2098,7 @@ class UpgradeClusterRequest: Defines whether pools will also be upgraded once the control plane is upgraded. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2154,7 +2116,7 @@ class UpgradePoolRequest: New Kubernetes version for the pool. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ diff --git a/scaleway/scaleway/key_manager/v1alpha1/marshalling.py b/scaleway/scaleway/key_manager/v1alpha1/marshalling.py index 2893172b1..14875dc86 100644 --- a/scaleway/scaleway/key_manager/v1alpha1/marshalling.py +++ b/scaleway/scaleway/key_manager/v1alpha1/marshalling.py @@ -10,6 +10,10 @@ resolve_one_of, ) from .types import ( + DataKeyAlgorithmSymmetricEncryption, + KeyAlgorithmSymmetricEncryption, + KeyOrigin, + KeyState, KeyRotationPolicy, KeyUsage, Key, @@ -68,7 +72,9 @@ def unmarshal_KeyUsage(data: Any) -> KeyUsage: if field is not None: args["symmetric_encryption"] = field else: - args["symmetric_encryption"] = None + args["symmetric_encryption"] = ( + KeyAlgorithmSymmetricEncryption.UNKNOWN_SYMMETRIC_ENCRYPTION + ) field = data.get("asymmetric_encryption", None) if field is not None: @@ -96,22 +102,32 @@ def unmarshal_Key(data: Any) -> Key: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("state", None) if field is not None: args["state"] = field + else: + args["state"] = KeyState.UNKNOWN_STATE field = data.get("rotation_count", None) if field is not None: args["rotation_count"] = field + else: + args["rotation_count"] = 0 field = data.get("usage", None) if field is not None: @@ -134,22 +150,32 @@ def unmarshal_Key(data: Any) -> Key: field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("locked", None) if field is not None: args["locked"] = field + else: + args["locked"] = False field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("origin", None) if field is not None: args["origin"] = field + else: + args["origin"] = KeyOrigin.UNKNOWN_ORIGIN field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("description", None) if field is not None: @@ -191,14 +217,22 @@ def unmarshal_DataKey(data: Any) -> DataKey: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("algorithm", None) if field is not None: args["algorithm"] = field + else: + args["algorithm"] = ( + DataKeyAlgorithmSymmetricEncryption.UNKNOWN_SYMMETRIC_ENCRYPTION + ) field = data.get("ciphertext", None) if field is not None: args["ciphertext"] = field + else: + args["ciphertext"] = None field = data.get("plaintext", None) if field is not None: @@ -226,10 +260,14 @@ def unmarshal_DecryptResponse(data: Any) -> DecryptResponse: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("plaintext", None) if field is not None: args["plaintext"] = field + else: + args["plaintext"] = None field = data.get("ciphertext", None) if field is not None: @@ -251,10 +289,14 @@ def unmarshal_EncryptResponse(data: Any) -> EncryptResponse: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("ciphertext", None) if field is not None: args["ciphertext"] = field + else: + args["ciphertext"] = None return EncryptResponse(**args) @@ -270,10 +312,14 @@ def unmarshal_ListKeysResponse(data: Any) -> ListKeysResponse: field = data.get("keys", None) if field is not None: args["keys"] = [unmarshal_Key(v) for v in field] if field is not None else None + else: + args["keys"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListKeysResponse(**args) @@ -289,6 +335,8 @@ def unmarshal_PublicKey(data: Any) -> PublicKey: field = data.get("pem", None) if field is not None: args["pem"] = field + else: + args["pem"] = None return PublicKey(**args) @@ -304,10 +352,14 @@ def unmarshal_SignResponse(data: Any) -> SignResponse: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("signature", None) if field is not None: args["signature"] = field + else: + args["signature"] = None return SignResponse(**args) @@ -323,10 +375,14 @@ def unmarshal_VerifyResponse(data: Any) -> VerifyResponse: field = data.get("key_id", None) if field is not None: args["key_id"] = field + else: + args["key_id"] = None field = data.get("valid", None) if field is not None: args["valid"] = field + else: + args["valid"] = False return VerifyResponse(**args) @@ -386,7 +442,9 @@ def marshal_CreateKeyRequest( output["unprotected"] = request.unprotected if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -406,7 +464,7 @@ def marshal_CreateKeyRequest( ) if request.origin is not None: - output["origin"] = str(request.origin) + output["origin"] = request.origin return output @@ -451,7 +509,7 @@ def marshal_GenerateDataKeyRequest( output["without_plaintext"] = request.without_plaintext if request.algorithm is not None: - output["algorithm"] = str(request.algorithm) + output["algorithm"] = request.algorithm return output diff --git a/scaleway/scaleway/key_manager/v1alpha1/types.py b/scaleway/scaleway/key_manager/v1alpha1/types.py index 1ce57e4d0..fdadc54dd 100644 --- a/scaleway/scaleway/key_manager/v1alpha1/types.py +++ b/scaleway/scaleway/key_manager/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -100,12 +100,12 @@ def __str__(self) -> str: @dataclass class KeyRotationPolicy: - rotation_period: Optional[str] + rotation_period: Optional[str] = None """ Time interval between two key rotations. The minimum duration is 24 hours and the maximum duration is 1 year (876000 hours). """ - next_rotation_at: Optional[datetime] + next_rotation_at: Optional[datetime] = None """ Timestamp indicating the next scheduled rotation. """ @@ -113,11 +113,13 @@ class KeyRotationPolicy: @dataclass class KeyUsage: - symmetric_encryption: Optional[KeyAlgorithmSymmetricEncryption] + symmetric_encryption: Optional[KeyAlgorithmSymmetricEncryption] = ( + KeyAlgorithmSymmetricEncryption.UNKNOWN_SYMMETRIC_ENCRYPTION + ) - asymmetric_encryption: Optional[KeyAlgorithmAsymmetricEncryption] + asymmetric_encryption: Optional[KeyAlgorithmAsymmetricEncryption] = None - asymmetric_signing: Optional[KeyAlgorithmAsymmetricSigning] + asymmetric_signing: Optional[KeyAlgorithmAsymmetricSigning] = None @dataclass @@ -147,21 +149,6 @@ class Key: The rotation count tracks the number of times the key has been rotated. """ - usage: Optional[KeyUsage] - """ - Keys with a usage set to `symmetric_encryption` can encrypt and decrypt data using the `AES-256-GCM` key algorithm. Key Manager currently only supports `AES-256-GCM`. - """ - - created_at: Optional[datetime] - """ - Key creation date. - """ - - updated_at: Optional[datetime] - """ - Key last modification date. - """ - protected: bool """ Returns `true` if key protection is applied to the key. @@ -187,22 +174,37 @@ class Key: Region where the key is stored. """ - description: Optional[str] + usage: Optional[KeyUsage] = None + """ + Keys with a usage set to `symmetric_encryption` can encrypt and decrypt data using the `AES-256-GCM` key algorithm. Key Manager currently only supports `AES-256-GCM`. + """ + + created_at: Optional[datetime] = None + """ + Key creation date. + """ + + updated_at: Optional[datetime] = None + """ + Key last modification date. + """ + + description: Optional[str] = None """ Description of the key. """ - rotated_at: Optional[datetime] + rotated_at: Optional[datetime] = None """ Key last rotation date. """ - rotation_policy: Optional[KeyRotationPolicy] + rotation_policy: Optional[KeyRotationPolicy] = None """ Key rotation policy. """ - deletion_requested_at: Optional[datetime] + deletion_requested_at: Optional[datetime] = None """ Returns the time at which deletion was requested. """ @@ -215,42 +217,42 @@ class CreateKeyRequest: Default value is `false`. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the key. """ - name: Optional[str] + name: Optional[str] = None """ (Optional) Name of the key. """ - usage: Optional[KeyUsage] + usage: Optional[KeyUsage] = None """ See the `Key.Algorithm.SymmetricEncryption` enum for a description of values. """ - description: Optional[str] + description: Optional[str] = None """ (Optional) Description of the key. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ (Optional) List of the key's tags. """ - rotation_policy: Optional[KeyRotationPolicy] + rotation_policy: Optional[KeyRotationPolicy] = None """ If not specified, no rotation policy will be applied to the key. """ - origin: Optional[KeyOrigin] + origin: Optional[KeyOrigin] = KeyOrigin.UNKNOWN_ORIGIN """ Refer to the `Key.Origin` enum for a description of values. """ @@ -273,12 +275,12 @@ class DataKey: Your data encryption key's ciphertext can be stored safely. It can only be decrypted through the keys you create in Key Manager, using the relevant key ID. """ - plaintext: Optional[str] + plaintext: Optional[str] = None """ (Optional) Your data encryption key's plaintext allows you to use the key immediately upon creation. It must neither be stored or shared. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Data encryption key creation date. """ @@ -296,12 +298,12 @@ class DecryptRequest: Data size must be between 1 and 131071 bytes. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - associated_data: Optional[str] + associated_data: Optional[str] = None """ The additional data must match the value passed in the encryption request. Only supported by keys with a usage set to `symmetric_encryption`. """ @@ -319,7 +321,7 @@ class DecryptResponse: Key's decrypted data. """ - ciphertext: Optional[str] + ciphertext: Optional[str] = None """ If the data was already encrypted with the latest key rotation, no output will be returned in the response object. """ @@ -332,7 +334,7 @@ class DeleteKeyMaterialRequest: ID of the key of which to delete the key material. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -345,7 +347,7 @@ class DeleteKeyRequest: ID of the key to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -358,7 +360,7 @@ class DisableKeyRequest: ID of the key to disable. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -371,7 +373,7 @@ class EnableKeyRequest: ID of the key to enable. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -389,12 +391,12 @@ class EncryptRequest: Data size must be between 1 and 65535 bytes. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - associated_data: Optional[str] + associated_data: Optional[str] = None """ Additional data which will not be encrypted, but authenticated and appended to the encrypted payload. Only supported by keys with a usage set to `symmetric_encryption`. """ @@ -426,12 +428,14 @@ class GenerateDataKeyRequest: Set it to `true` if you do not wish the plaintext to be returned in the response object. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - algorithm: Optional[DataKeyAlgorithmSymmetricEncryption] + algorithm: Optional[DataKeyAlgorithmSymmetricEncryption] = ( + DataKeyAlgorithmSymmetricEncryption.UNKNOWN_SYMMETRIC_ENCRYPTION + ) """ See the `DataKey.Algorithm.SymmetricEncryption` enum for a description of values. """ @@ -444,7 +448,7 @@ class GetKeyRequest: ID of the key to target. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -457,7 +461,7 @@ class GetPublicKeyRequest: ID of the key. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -475,12 +479,12 @@ class ImportKeyMaterialRequest: The key material The key material is a random sequence of bytes used to derive a cryptographic key. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - salt: Optional[str] + salt: Optional[str] = None """ A salt is random data added to key material to ensure unique derived keys, even if the input is similar. It helps strengthen security when the key material has low randomness (low entropy). """ @@ -493,38 +497,35 @@ class ListKeysRequest: Filter keys based on their deletion status. By default, only keys not scheduled for deletion are returned in the output. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ (Optional) Filter by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ (Optional) Filter by Project ID. """ - order_by: Optional[ListKeysRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - tags: Optional[List[str]] + order_by: Optional[ListKeysRequestOrderBy] = ListKeysRequestOrderBy.NAME_ASC + page: Optional[int] = 0 + page_size: Optional[int] = 0 + tags: Optional[List[str]] = field(default_factory=list) """ (Optional) List of tags to filter on. """ - name: Optional[str] + name: Optional[str] = None """ (Optional) Filter by key name. """ - usage: Optional[ListKeysRequestUsage] + usage: Optional[ListKeysRequestUsage] = ListKeysRequestUsage.UNKNOWN_USAGE """ Select from symmetric encryption, asymmetric encryption, or asymmetric signing. """ @@ -550,7 +551,7 @@ class ProtectKeyRequest: ID of the key to apply key protection to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -564,8 +565,7 @@ class PublicKey: @dataclass class RestoreKeyRequest: key_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -578,7 +578,7 @@ class RotateKeyRequest: ID of the key to rotate. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -596,7 +596,7 @@ class SignRequest: The digest must be generated using the same algorithm defined in the key’s algorithm settings. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -622,7 +622,7 @@ class UnprotectKeyRequest: ID of the key to remove key protection from. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -635,27 +635,27 @@ class UpdateKeyRequest: ID of the key to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ (Optional) Updated name of the key. """ - description: Optional[str] + description: Optional[str] = None """ (Optional) Updated description of the key. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ (Optional) Updated list of the key's tags. """ - rotation_policy: Optional[KeyRotationPolicy] + rotation_policy: Optional[KeyRotationPolicy] = None """ If not specified, the key's existing rotation policy applies. """ @@ -678,7 +678,7 @@ class VerifyRequest: The message signature to verify. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ diff --git a/scaleway/scaleway/lb/v1/marshalling.py b/scaleway/scaleway/lb/v1/marshalling.py index b64fe7a73..d5a6e87da 100644 --- a/scaleway/scaleway/lb/v1/marshalling.py +++ b/scaleway/scaleway/lb/v1/marshalling.py @@ -10,6 +10,23 @@ resolve_one_of, ) from .types import ( + AclActionRedirectRedirectType, + AclActionType, + AclHttpFilter, + BackendServerStatsHealthCheckStatus, + BackendServerStatsServerState, + CertificateStatus, + CertificateType, + ForwardPortAlgorithm, + InstanceStatus, + LbStatus, + LbTypeStock, + OnMarkedDownAction, + PrivateNetworkStatus, + Protocol, + ProxyProtocol, + SSLCompatibilityLevel, + StickySessionsType, Ip, SubscriberEmailConfig, SubscriberWebhookConfig, @@ -117,30 +134,44 @@ def unmarshal_Ip(data: Any) -> Ip: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("ip_address", None) if field is not None: args["ip_address"] = field + else: + args["ip_address"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("reverse", None) if field is not None: args["reverse"] = field + else: + args["reverse"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("lb_id", None) if field is not None: @@ -168,6 +199,8 @@ def unmarshal_SubscriberEmailConfig(data: Any) -> SubscriberEmailConfig: field = data.get("email", None) if field is not None: args["email"] = field + else: + args["email"] = None return SubscriberEmailConfig(**args) @@ -183,6 +216,8 @@ def unmarshal_SubscriberWebhookConfig(data: Any) -> SubscriberWebhookConfig: field = data.get("uri", None) if field is not None: args["uri"] = field + else: + args["uri"] = None return SubscriberWebhookConfig(**args) @@ -198,10 +233,14 @@ def unmarshal_Subscriber(data: Any) -> Subscriber: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("email_config", None) if field is not None: @@ -229,20 +268,26 @@ def unmarshal_HealthCheckHttpConfig(data: Any) -> HealthCheckHttpConfig: field = data.get("uri", None) if field is not None: args["uri"] = field + else: + args["uri"] = None field = data.get("method", None) if field is not None: args["method"] = field + else: + args["method"] = None field = data.get("host_header", None) if field is not None: args["host_header"] = field + else: + args["host_header"] = None field = data.get("code", None) if field is not None: args["code"] = field else: - args["code"] = None + args["code"] = 0 return HealthCheckHttpConfig(**args) @@ -258,24 +303,32 @@ def unmarshal_HealthCheckHttpsConfig(data: Any) -> HealthCheckHttpsConfig: field = data.get("uri", None) if field is not None: args["uri"] = field + else: + args["uri"] = None field = data.get("method", None) if field is not None: args["method"] = field + else: + args["method"] = None field = data.get("host_header", None) if field is not None: args["host_header"] = field + else: + args["host_header"] = None field = data.get("sni", None) if field is not None: args["sni"] = field + else: + args["sni"] = None field = data.get("code", None) if field is not None: args["code"] = field else: - args["code"] = None + args["code"] = 0 return HealthCheckHttpsConfig(**args) @@ -302,6 +355,8 @@ def unmarshal_HealthCheckMysqlConfig(data: Any) -> HealthCheckMysqlConfig: field = data.get("user", None) if field is not None: args["user"] = field + else: + args["user"] = None return HealthCheckMysqlConfig(**args) @@ -317,6 +372,8 @@ def unmarshal_HealthCheckPgsqlConfig(data: Any) -> HealthCheckPgsqlConfig: field = data.get("user", None) if field is not None: args["user"] = field + else: + args["user"] = None return HealthCheckPgsqlConfig(**args) @@ -354,10 +411,14 @@ def unmarshal_HealthCheck(data: Any) -> HealthCheck: field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("check_max_retries", None) if field is not None: args["check_max_retries"] = field + else: + args["check_max_retries"] = 0 field = data.get("check_delay", None) if field is not None: @@ -386,6 +447,8 @@ def unmarshal_HealthCheck(data: Any) -> HealthCheck: field = data.get("check_send_proxy", None) if field is not None: args["check_send_proxy"] = field + else: + args["check_send_proxy"] = False field = data.get("pgsql_config", None) if field is not None: @@ -437,18 +500,26 @@ def unmarshal_Instance(data: Any) -> Instance: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceStatus.UNKNOWN field = data.get("ip_address", None) if field is not None: args["ip_address"] = field + else: + args["ip_address"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -482,68 +553,102 @@ def unmarshal_Lb(data: Any) -> Lb: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = LbStatus.UNKNOWN field = data.get("instances", None) if field is not None: args["instances"] = ( [unmarshal_Instance(v) for v in field] if field is not None else None ) + else: + args["instances"] = field(default_factory=list) field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("ip", None) if field is not None: args["ip"] = [unmarshal_Ip(v) for v in field] if field is not None else None + else: + args["ip"] = field(default_factory=list) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("frontend_count", None) if field is not None: args["frontend_count"] = field + else: + args["frontend_count"] = 0 field = data.get("backend_count", None) if field is not None: args["backend_count"] = field + else: + args["backend_count"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("ssl_compatibility_level", None) if field is not None: args["ssl_compatibility_level"] = field + else: + args["ssl_compatibility_level"] = ( + SSLCompatibilityLevel.SSL_COMPATIBILITY_LEVEL_UNKNOWN + ) field = data.get("private_network_count", None) if field is not None: args["private_network_count"] = field + else: + args["private_network_count"] = 0 field = data.get("route_count", None) if field is not None: args["route_count"] = field + else: + args["route_count"] = 0 field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("subscriber", None) if field is not None: @@ -583,42 +688,62 @@ def unmarshal_Backend(data: Any) -> Backend: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("forward_protocol", None) if field is not None: args["forward_protocol"] = field + else: + args["forward_protocol"] = Protocol.TCP field = data.get("forward_port", None) if field is not None: args["forward_port"] = field + else: + args["forward_port"] = 0 field = data.get("forward_port_algorithm", None) if field is not None: args["forward_port_algorithm"] = field + else: + args["forward_port_algorithm"] = ForwardPortAlgorithm.ROUNDROBIN field = data.get("sticky_sessions", None) if field is not None: args["sticky_sessions"] = field + else: + args["sticky_sessions"] = StickySessionsType.NONE field = data.get("sticky_sessions_cookie_name", None) if field is not None: args["sticky_sessions_cookie_name"] = field + else: + args["sticky_sessions_cookie_name"] = None field = data.get("pool", None) if field is not None: args["pool"] = field + else: + args["pool"] = field(default_factory=list) field = data.get("on_marked_down_action", None) if field is not None: args["on_marked_down_action"] = field + else: + args["on_marked_down_action"] = OnMarkedDownAction.ON_MARKED_DOWN_ACTION_NONE field = data.get("proxy_protocol", None) if field is not None: args["proxy_protocol"] = field + else: + args["proxy_protocol"] = ProxyProtocol.PROXY_PROTOCOL_UNKNOWN field = data.get("health_check", None) if field is not None: @@ -636,7 +761,7 @@ def unmarshal_Backend(data: Any) -> Backend: if field is not None: args["send_proxy_v2"] = field else: - args["send_proxy_v2"] = None + args["send_proxy_v2"] = False field = data.get("timeout_server", None) if field is not None: @@ -678,31 +803,31 @@ def unmarshal_Backend(data: Any) -> Backend: if field is not None: args["ssl_bridging"] = field else: - args["ssl_bridging"] = None + args["ssl_bridging"] = False field = data.get("ignore_ssl_server_verify", None) if field is not None: args["ignore_ssl_server_verify"] = field else: - args["ignore_ssl_server_verify"] = None + args["ignore_ssl_server_verify"] = False field = data.get("redispatch_attempt_count", None) if field is not None: args["redispatch_attempt_count"] = field else: - args["redispatch_attempt_count"] = None + args["redispatch_attempt_count"] = 0 field = data.get("max_retries", None) if field is not None: args["max_retries"] = field else: - args["max_retries"] = None + args["max_retries"] = 0 field = data.get("max_connections", None) if field is not None: args["max_connections"] = field else: - args["max_connections"] = None + args["max_connections"] = 0 field = data.get("timeout_queue", None) if field is not None: @@ -724,26 +849,38 @@ def unmarshal_Certificate(data: Any) -> Certificate: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = CertificateType.LETSENCRYT field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("common_name", None) if field is not None: args["common_name"] = field + else: + args["common_name"] = None field = data.get("subject_alternative_name", None) if field is not None: args["subject_alternative_name"] = field + else: + args["subject_alternative_name"] = field(default_factory=list) field = data.get("fingerprint", None) if field is not None: args["fingerprint"] = field + else: + args["fingerprint"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = CertificateStatus.PENDING field = data.get("not_valid_before", None) if field is not None: @@ -770,6 +907,8 @@ def unmarshal_Certificate(data: Any) -> Certificate: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("created_at", None) if field is not None: @@ -803,18 +942,26 @@ def unmarshal_Frontend(data: Any) -> Frontend: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("inbound_port", None) if field is not None: args["inbound_port"] = field + else: + args["inbound_port"] = 0 field = data.get("certificate_ids", None) if field is not None: args["certificate_ids"] = field + else: + args["certificate_ids"] = field(default_factory=list) field = data.get("backend", None) if field is not None: @@ -837,10 +984,14 @@ def unmarshal_Frontend(data: Any) -> Frontend: field = data.get("enable_http3", None) if field is not None: args["enable_http3"] = field + else: + args["enable_http3"] = False field = data.get("enable_access_logs", None) if field is not None: args["enable_access_logs"] = field + else: + args["enable_access_logs"] = False field = data.get("certificate", None) if field is not None: @@ -864,7 +1015,7 @@ def unmarshal_Frontend(data: Any) -> Frontend: if field is not None: args["connection_rate_limit"] = field else: - args["connection_rate_limit"] = None + args["connection_rate_limit"] = 0 return Frontend(**args) @@ -880,16 +1031,20 @@ def unmarshal_AclActionRedirect(data: Any) -> AclActionRedirect: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = AclActionRedirectRedirectType.LOCATION field = data.get("target", None) if field is not None: args["target"] = field + else: + args["target"] = None field = data.get("code", None) if field is not None: args["code"] = field else: - args["code"] = None + args["code"] = 0 return AclActionRedirect(**args) @@ -905,6 +1060,8 @@ def unmarshal_AclAction(data: Any) -> AclAction: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = AclActionType.ALLOW field = data.get("redirect", None) if field is not None: @@ -926,22 +1083,32 @@ def unmarshal_AclMatch(data: Any) -> AclMatch: field = data.get("ip_subnet", None) if field is not None: args["ip_subnet"] = field + else: + args["ip_subnet"] = field(default_factory=list) field = data.get("ips_edge_services", None) if field is not None: args["ips_edge_services"] = field + else: + args["ips_edge_services"] = False field = data.get("http_filter", None) if field is not None: args["http_filter"] = field + else: + args["http_filter"] = AclHttpFilter.ACL_HTTP_FILTER_NONE field = data.get("http_filter_value", None) if field is not None: args["http_filter_value"] = field + else: + args["http_filter_value"] = field(default_factory=list) field = data.get("invert", None) if field is not None: args["invert"] = field + else: + args["invert"] = False field = data.get("http_filter_option", None) if field is not None: @@ -963,18 +1130,26 @@ def unmarshal_Acl(data: Any) -> Acl: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("index", None) if field is not None: args["index"] = field + else: + args["index"] = 0 field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("match", None) if field is not None: @@ -1049,7 +1224,7 @@ def unmarshal_PrivateNetworkStaticConfig(data: Any) -> PrivateNetworkStaticConfi if field is not None: args["ip_address"] = field else: - args["ip_address"] = None + args["ip_address"] = field(default_factory=list) return PrivateNetworkStaticConfig(**args) @@ -1065,14 +1240,20 @@ def unmarshal_PrivateNetwork(data: Any) -> PrivateNetwork: field = data.get("ipam_ids", None) if field is not None: args["ipam_ids"] = field + else: + args["ipam_ids"] = field(default_factory=list) field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = PrivateNetworkStatus.UNKNOWN field = data.get("lb", None) if field is not None: @@ -1124,6 +1305,8 @@ def unmarshal_RouteMatch(data: Any) -> RouteMatch: field = data.get("match_subdomains", None) if field is not None: args["match_subdomains"] = field + else: + args["match_subdomains"] = False field = data.get("sni", None) if field is not None: @@ -1157,14 +1340,20 @@ def unmarshal_Route(data: Any) -> Route: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("frontend_id", None) if field is not None: args["frontend_id"] = field + else: + args["frontend_id"] = None field = data.get("backend_id", None) if field is not None: args["backend_id"] = field + else: + args["backend_id"] = None field = data.get("match", None) if field is not None: @@ -1198,22 +1387,32 @@ def unmarshal_BackendServerStats(data: Any) -> BackendServerStats: field = data.get("instance_id", None) if field is not None: args["instance_id"] = field + else: + args["instance_id"] = None field = data.get("backend_id", None) if field is not None: args["backend_id"] = field + else: + args["backend_id"] = None field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("server_state", None) if field is not None: args["server_state"] = field + else: + args["server_state"] = BackendServerStatsServerState.STOPPED field = data.get("last_health_check_status", None) if field is not None: args["last_health_check_status"] = field + else: + args["last_health_check_status"] = BackendServerStatsHealthCheckStatus.UNKNOWN field = data.get("server_state_changed_at", None) if field is not None: @@ -1241,6 +1440,8 @@ def unmarshal_LbStats(data: Any) -> LbStats: if field is not None else None ) + else: + args["backend_servers_stats"] = field(default_factory=list) return LbStats(**args) @@ -1256,10 +1457,14 @@ def unmarshal_ListAclResponse(data: Any) -> ListAclResponse: field = data.get("acls", None) if field is not None: args["acls"] = [unmarshal_Acl(v) for v in field] if field is not None else None + else: + args["acls"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListAclResponse(**args) @@ -1279,10 +1484,14 @@ def unmarshal_ListBackendStatsResponse(data: Any) -> ListBackendStatsResponse: if field is not None else None ) + else: + args["backend_servers_stats"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListBackendStatsResponse(**args) @@ -1300,10 +1509,14 @@ def unmarshal_ListBackendsResponse(data: Any) -> ListBackendsResponse: args["backends"] = ( [unmarshal_Backend(v) for v in field] if field is not None else None ) + else: + args["backends"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListBackendsResponse(**args) @@ -1321,10 +1534,14 @@ def unmarshal_ListCertificatesResponse(data: Any) -> ListCertificatesResponse: args["certificates"] = ( [unmarshal_Certificate(v) for v in field] if field is not None else None ) + else: + args["certificates"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListCertificatesResponse(**args) @@ -1342,10 +1559,14 @@ def unmarshal_ListFrontendsResponse(data: Any) -> ListFrontendsResponse: args["frontends"] = ( [unmarshal_Frontend(v) for v in field] if field is not None else None ) + else: + args["frontends"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListFrontendsResponse(**args) @@ -1361,10 +1582,14 @@ def unmarshal_ListIpsResponse(data: Any) -> ListIpsResponse: field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_Ip(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListIpsResponse(**args) @@ -1382,10 +1607,14 @@ def unmarshal_ListLbPrivateNetworksResponse(data: Any) -> ListLbPrivateNetworksR args["private_network"] = ( [unmarshal_PrivateNetwork(v) for v in field] if field is not None else None ) + else: + args["private_network"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListLbPrivateNetworksResponse(**args) @@ -1401,18 +1630,26 @@ def unmarshal_LbType(data: Any) -> LbType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = LbTypeStock.UNKNOWN field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("region", None) if field is not None: @@ -1436,10 +1673,14 @@ def unmarshal_ListLbTypesResponse(data: Any) -> ListLbTypesResponse: args["lb_types"] = ( [unmarshal_LbType(v) for v in field] if field is not None else None ) + else: + args["lb_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListLbTypesResponse(**args) @@ -1455,10 +1696,14 @@ def unmarshal_ListLbsResponse(data: Any) -> ListLbsResponse: field = data.get("lbs", None) if field is not None: args["lbs"] = [unmarshal_Lb(v) for v in field] if field is not None else None + else: + args["lbs"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListLbsResponse(**args) @@ -1476,10 +1721,14 @@ def unmarshal_ListRoutesResponse(data: Any) -> ListRoutesResponse: args["routes"] = ( [unmarshal_Route(v) for v in field] if field is not None else None ) + else: + args["routes"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListRoutesResponse(**args) @@ -1497,10 +1746,14 @@ def unmarshal_ListSubscriberResponse(data: Any) -> ListSubscriberResponse: args["subscribers"] = ( [unmarshal_Subscriber(v) for v in field] if field is not None else None ) + else: + args["subscribers"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSubscriberResponse(**args) @@ -1516,10 +1769,14 @@ def unmarshal_SetAclsResponse(data: Any) -> SetAclsResponse: field = data.get("acls", None) if field is not None: args["acls"] = [unmarshal_Acl(v) for v in field] if field is not None else None + else: + args["acls"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return SetAclsResponse(**args) @@ -1609,7 +1866,7 @@ def marshal_AclActionRedirect( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.target is not None: output["target"] = request.target @@ -1627,7 +1884,7 @@ def marshal_AclAction( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.redirect is not None: output["redirect"] = marshal_AclActionRedirect(request.redirect, defaults) @@ -1648,7 +1905,7 @@ def marshal_AclMatch( output["ips_edge_services"] = request.ips_edge_services if request.http_filter is not None: - output["http_filter"] = str(request.http_filter) + output["http_filter"] = request.http_filter if request.http_filter_value is not None: output["http_filter_value"] = request.http_filter_value @@ -1857,16 +2114,16 @@ def marshal_CreateBackendRequest( output: Dict[str, Any] = {} if request.forward_protocol is not None: - output["forward_protocol"] = str(request.forward_protocol) + output["forward_protocol"] = request.forward_protocol if request.forward_port is not None: output["forward_port"] = request.forward_port if request.forward_port_algorithm is not None: - output["forward_port_algorithm"] = str(request.forward_port_algorithm) + output["forward_port_algorithm"] = request.forward_port_algorithm if request.sticky_sessions is not None: - output["sticky_sessions"] = str(request.sticky_sessions) + output["sticky_sessions"] = request.sticky_sessions if request.sticky_sessions_cookie_name is not None: output["sticky_sessions_cookie_name"] = request.sticky_sessions_cookie_name @@ -1893,10 +2150,10 @@ def marshal_CreateBackendRequest( output["timeout_tunnel"] = request.timeout_tunnel if request.on_marked_down_action is not None: - output["on_marked_down_action"] = str(request.on_marked_down_action) + output["on_marked_down_action"] = request.on_marked_down_action if request.proxy_protocol is not None: - output["proxy_protocol"] = str(request.proxy_protocol) + output["proxy_protocol"] = request.proxy_protocol if request.failover_host is not None: output["failover_host"] = request.failover_host @@ -2098,7 +2355,7 @@ def marshal_CreateLbRequest( output["tags"] = request.tags if request.ssl_compatibility_level is not None: - output["ssl_compatibility_level"] = str(request.ssl_compatibility_level) + output["ssl_compatibility_level"] = request.ssl_compatibility_level return output @@ -2298,16 +2555,16 @@ def marshal_UpdateBackendRequest( output["name"] = request.name if request.forward_protocol is not None: - output["forward_protocol"] = str(request.forward_protocol) + output["forward_protocol"] = request.forward_protocol if request.forward_port is not None: output["forward_port"] = request.forward_port if request.forward_port_algorithm is not None: - output["forward_port_algorithm"] = str(request.forward_port_algorithm) + output["forward_port_algorithm"] = request.forward_port_algorithm if request.sticky_sessions is not None: - output["sticky_sessions"] = str(request.sticky_sessions) + output["sticky_sessions"] = request.sticky_sessions if request.sticky_sessions_cookie_name is not None: output["sticky_sessions_cookie_name"] = request.sticky_sessions_cookie_name @@ -2325,10 +2582,10 @@ def marshal_UpdateBackendRequest( output["timeout_tunnel"] = request.timeout_tunnel if request.on_marked_down_action is not None: - output["on_marked_down_action"] = str(request.on_marked_down_action) + output["on_marked_down_action"] = request.on_marked_down_action if request.proxy_protocol is not None: - output["proxy_protocol"] = str(request.proxy_protocol) + output["proxy_protocol"] = request.proxy_protocol if request.failover_host is not None: output["failover_host"] = request.failover_host @@ -2504,7 +2761,7 @@ def marshal_UpdateLbRequest( output["tags"] = request.tags if request.ssl_compatibility_level is not None: - output["ssl_compatibility_level"] = str(request.ssl_compatibility_level) + output["ssl_compatibility_level"] = request.ssl_compatibility_level return output @@ -2631,16 +2888,16 @@ def marshal_ZonedApiCreateBackendRequest( output: Dict[str, Any] = {} if request.forward_protocol is not None: - output["forward_protocol"] = str(request.forward_protocol) + output["forward_protocol"] = request.forward_protocol if request.forward_port is not None: output["forward_port"] = request.forward_port if request.forward_port_algorithm is not None: - output["forward_port_algorithm"] = str(request.forward_port_algorithm) + output["forward_port_algorithm"] = request.forward_port_algorithm if request.sticky_sessions is not None: - output["sticky_sessions"] = str(request.sticky_sessions) + output["sticky_sessions"] = request.sticky_sessions if request.sticky_sessions_cookie_name is not None: output["sticky_sessions_cookie_name"] = request.sticky_sessions_cookie_name @@ -2667,10 +2924,10 @@ def marshal_ZonedApiCreateBackendRequest( output["timeout_tunnel"] = request.timeout_tunnel if request.on_marked_down_action is not None: - output["on_marked_down_action"] = str(request.on_marked_down_action) + output["on_marked_down_action"] = request.on_marked_down_action if request.proxy_protocol is not None: - output["proxy_protocol"] = str(request.proxy_protocol) + output["proxy_protocol"] = request.proxy_protocol if request.failover_host is not None: output["failover_host"] = request.failover_host @@ -2845,7 +3102,7 @@ def marshal_ZonedApiCreateLbRequest( output["tags"] = request.tags if request.ssl_compatibility_level is not None: - output["ssl_compatibility_level"] = str(request.ssl_compatibility_level) + output["ssl_compatibility_level"] = request.ssl_compatibility_level return output @@ -3044,16 +3301,16 @@ def marshal_ZonedApiUpdateBackendRequest( output["name"] = request.name if request.forward_protocol is not None: - output["forward_protocol"] = str(request.forward_protocol) + output["forward_protocol"] = request.forward_protocol if request.forward_port is not None: output["forward_port"] = request.forward_port if request.forward_port_algorithm is not None: - output["forward_port_algorithm"] = str(request.forward_port_algorithm) + output["forward_port_algorithm"] = request.forward_port_algorithm if request.sticky_sessions is not None: - output["sticky_sessions"] = str(request.sticky_sessions) + output["sticky_sessions"] = request.sticky_sessions if request.sticky_sessions_cookie_name is not None: output["sticky_sessions_cookie_name"] = request.sticky_sessions_cookie_name @@ -3071,10 +3328,10 @@ def marshal_ZonedApiUpdateBackendRequest( output["timeout_tunnel"] = request.timeout_tunnel if request.on_marked_down_action is not None: - output["on_marked_down_action"] = str(request.on_marked_down_action) + output["on_marked_down_action"] = request.on_marked_down_action if request.proxy_protocol is not None: - output["proxy_protocol"] = str(request.proxy_protocol) + output["proxy_protocol"] = request.proxy_protocol if request.failover_host is not None: output["failover_host"] = request.failover_host @@ -3250,7 +3507,7 @@ def marshal_ZonedApiUpdateLbRequest( output["tags"] = request.tags if request.ssl_compatibility_level is not None: - output["ssl_compatibility_level"] = str(request.ssl_compatibility_level) + output["ssl_compatibility_level"] = request.ssl_compatibility_level return output diff --git a/scaleway/scaleway/lb/v1/types.py b/scaleway/scaleway/lb/v1/types.py index 4d8290ed1..0cf85d3e1 100644 --- a/scaleway/scaleway/lb/v1/types.py +++ b/scaleway/scaleway/lb/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -310,7 +310,7 @@ class HealthCheckHttpConfig: The HTTP host header used when performing a health check on backend servers. """ - code: Optional[int] + code: Optional[int] = 0 """ The HTTP response code that should be returned for a health check to be considered successful. """ @@ -338,7 +338,7 @@ class HealthCheckHttpsConfig: The SNI value used when performing a health check on backend servers over SSL. """ - code: Optional[int] + code: Optional[int] = 0 """ The HTTP response code that should be returned for a health check to be considered successful. """ @@ -397,17 +397,17 @@ class Instance: The zone the Instance is in. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Instance was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the Instance was last updated. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ The region the Instance is in. """ @@ -450,12 +450,12 @@ class Ip: The zone the IP address is in. """ - lb_id: Optional[str] + lb_id: Optional[str] = None """ Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ The region the IP address is in. """ @@ -477,9 +477,9 @@ class Subscriber: Subscriber name. """ - email_config: Optional[SubscriberEmailConfig] + email_config: Optional[SubscriberEmailConfig] = None - webhook_config: Optional[SubscriberWebhookConfig] + webhook_config: Optional[SubscriberWebhookConfig] = None @dataclass @@ -499,34 +499,34 @@ class HealthCheck: Defines whether proxy protocol should be activated for the health check. """ - check_delay: Optional[str] + check_delay: Optional[str] = None """ Time to wait between two consecutive health checks. """ - check_timeout: Optional[str] + check_timeout: Optional[str] = None """ Maximum time a backend server has to reply to the health check. """ - transient_check_delay: Optional[str] + transient_check_delay: Optional[str] = None """ Time to wait between two consecutive health checks when a backend server is in a transient state (going UP or DOWN). """ - tcp_config: Optional[HealthCheckTcpConfig] + tcp_config: Optional[HealthCheckTcpConfig] = None - mysql_config: Optional[HealthCheckMysqlConfig] + mysql_config: Optional[HealthCheckMysqlConfig] = None - pgsql_config: Optional[HealthCheckPgsqlConfig] + pgsql_config: Optional[HealthCheckPgsqlConfig] = None - ldap_config: Optional[HealthCheckLdapConfig] + ldap_config: Optional[HealthCheckLdapConfig] = None - redis_config: Optional[HealthCheckRedisConfig] + redis_config: Optional[HealthCheckRedisConfig] = None - http_config: Optional[HealthCheckHttpConfig] + http_config: Optional[HealthCheckHttpConfig] = None - https_config: Optional[HealthCheckHttpsConfig] + https_config: Optional[HealthCheckHttpsConfig] = None @dataclass @@ -611,22 +611,22 @@ class Lb: The zone the Load Balancer is in. """ - subscriber: Optional[Subscriber] + subscriber: Optional[Subscriber] = None """ Subscriber information. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Load Balancer was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the Load Balancer was last updated. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ The region the Load Balancer is in. """ @@ -644,7 +644,7 @@ class AclActionRedirect: Redirect target. For a location redirect, you can use a URL e.g. `https://scaleway.com`. Using a scheme name (e.g. `https`, `http`, `ftp`, `git`) will replace the request's original scheme. This can be useful to implement HTTP to HTTPS redirects. Valid placeholders that can be used in a `location` redirect to preserve parts of the original request in the redirection URL are \{\{host\}\}, \{\{query\}\}, \{\{path\}\} and \{\{scheme\}\}. """ - code: Optional[int] + code: Optional[int] = 0 """ HTTP redirect code to use. Valid values are 301, 302, 303, 307 and 308. Default value is 302. """ @@ -702,77 +702,77 @@ class Backend: Protocol to use between the Load Balancer and backend servers. Allows the backend servers to be informed of the client's real IP address. The PROXY protocol must be supported by the backend servers' software. """ - health_check: Optional[HealthCheck] + health_check: Optional[HealthCheck] = None """ Object defining the health check to be carried out by the backend when checking the status and health of backend servers. """ - lb: Optional[Lb] + lb: Optional[Lb] = None """ Load Balancer the backend is attached to. """ - send_proxy_v2: Optional[bool] + send_proxy_v2: Optional[bool] = False """ Deprecated in favor of proxy_protocol field. """ - timeout_server: Optional[str] + timeout_server: Optional[str] = None """ Maximum allowed time for a backend server to process a request. """ - timeout_connect: Optional[str] + timeout_connect: Optional[str] = None """ Maximum allowed time for establishing a connection to a backend server. """ - timeout_tunnel: Optional[str] + timeout_tunnel: Optional[str] = None """ Maximum allowed tunnel inactivity time after Websocket is established (takes precedence over client and server timeout). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date at which the backend was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date at which the backend was updated. """ - failover_host: Optional[str] + failover_host: Optional[str] = None """ Scaleway Object Storage bucket website to be served as failover if all backend servers are down, e.g. failover-website.s3-website.fr-par.scw.cloud. """ - ssl_bridging: Optional[bool] + ssl_bridging: Optional[bool] = False """ Defines whether to enable SSL bridging between the Load Balancer and backend servers. """ - ignore_ssl_server_verify: Optional[bool] + ignore_ssl_server_verify: Optional[bool] = False """ Defines whether the server certificate verification should be ignored. """ - redispatch_attempt_count: Optional[int] + redispatch_attempt_count: Optional[int] = 0 """ Whether to use another backend server on each attempt. """ - max_retries: Optional[int] + max_retries: Optional[int] = 0 """ Number of retries when a backend server connection failed. """ - max_connections: Optional[int] + max_connections: Optional[int] = 0 """ Maximum number of connections allowed per backend server. """ - timeout_queue: Optional[str] + timeout_queue: Optional[str] = None """ Maximum time for a request to be left pending in queue when `max_connections` is reached. """ @@ -810,37 +810,37 @@ class Certificate: Certificate status. """ - not_valid_before: Optional[datetime] + name: str """ - Lower validity bound. + Certificate name. """ - not_valid_after: Optional[datetime] + not_valid_before: Optional[datetime] = None """ - Upper validity bound. + Lower validity bound. """ - lb: Optional[Lb] + not_valid_after: Optional[datetime] = None """ - Load Balancer object the certificate is attached to. + Upper validity bound. """ - name: str + lb: Optional[Lb] = None """ - Certificate name. + Load Balancer object the certificate is attached to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the certificate was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the certificate was last updated. """ - status_details: Optional[str] + status_details: Optional[str] = None """ Additional information about the certificate status (useful in case of certificate generation failure, for example). """ @@ -853,7 +853,7 @@ class AclAction: Action to take when incoming traffic matches an ACL filter. """ - redirect: Optional[AclActionRedirect] + redirect: Optional[AclActionRedirect] = None """ Redirection parameters when using an ACL with a `redirect` action. """ @@ -886,7 +886,7 @@ class AclMatch: Defines whether to invert the match condition. If set to `true`, the ACL carries out its action when the condition DOES NOT match. """ - http_filter_option: Optional[str] + http_filter_option: Optional[str] = None """ Name of the HTTP header to filter on if `http_header_match` was selected in `http_filter`. """ @@ -914,47 +914,47 @@ class Frontend: List of SSL/TLS certificate IDs to bind to the frontend. """ - backend: Optional[Backend] + enable_http3: bool """ - Backend object the frontend is attached to. + Defines whether to enable HTTP/3 protocol on the frontend. """ - lb: Optional[Lb] + enable_access_logs: bool """ - Load Balancer object the frontend is attached to. + Defines whether to enable access logs on the frontend. """ - timeout_client: Optional[str] + backend: Optional[Backend] = None """ - Maximum allowed inactivity time on the client side. + Backend object the frontend is attached to. """ - enable_http3: bool + lb: Optional[Lb] = None """ - Defines whether to enable HTTP/3 protocol on the frontend. + Load Balancer object the frontend is attached to. """ - enable_access_logs: bool + timeout_client: Optional[str] = None """ - Defines whether to enable access logs on the frontend. + Maximum allowed inactivity time on the client side. """ - certificate: Optional[Certificate] + certificate: Optional[Certificate] = None """ Certificate, deprecated in favor of certificate_ids array. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the frontend was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the frontend was last updated. """ - connection_rate_limit: Optional[int] + connection_rate_limit: Optional[int] = 0 """ Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second. """ @@ -962,7 +962,7 @@ class Frontend: @dataclass class PrivateNetworkDHCPConfig: - ip_id: Optional[str] + ip_id: Optional[str] = None @dataclass @@ -972,7 +972,7 @@ class PrivateNetworkIpamConfig: @dataclass class PrivateNetworkStaticConfig: - ip_address: Optional[List[str]] + ip_address: Optional[List[str]] = field(default_factory=list) """ Array of a local IP address for the Load Balancer on this Private Network. """ @@ -985,11 +985,11 @@ class RouteMatch: If true, all subdomains will match. """ - sni: Optional[str] + sni: Optional[str] = None - host_header: Optional[str] + host_header: Optional[str] = None - path_begin: Optional[str] + path_begin: Optional[str] = None @dataclass @@ -1040,7 +1040,7 @@ class BackendServerStats: Last health check status (unknown/neutral/failed/passed/condpass). """ - server_state_changed_at: Optional[datetime] + server_state_changed_at: Optional[datetime] = None """ Time since last operational change. """ @@ -1068,27 +1068,27 @@ class Acl: ACL description. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` & `http_filter_value` are required. """ - action: Optional[AclAction] + action: Optional[AclAction] = None """ Action to take when incoming traffic matches an ACL filter. """ - frontend: Optional[Frontend] + frontend: Optional[Frontend] = None """ ACL is attached to this frontend object. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the ACL was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the ACL was last updated. """ @@ -1111,26 +1111,26 @@ class PrivateNetwork: Status of Private Network connection. """ - lb: Optional[Lb] + lb: Optional[Lb] = None """ Load Balancer object which is attached to the Private Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Private Network was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the PN was last updated. """ - static_config: Optional[PrivateNetworkStaticConfig] + static_config: Optional[PrivateNetworkStaticConfig] = None - dhcp_config: Optional[PrivateNetworkDHCPConfig] + dhcp_config: Optional[PrivateNetworkDHCPConfig] = None - ipam_config: Optional[PrivateNetworkIpamConfig] + ipam_config: Optional[PrivateNetworkIpamConfig] = None @dataclass @@ -1155,7 +1155,7 @@ class LbType: The zone the Load Balancer stock is in. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ The region the Load Balancer stock is in. """ @@ -1178,17 +1178,17 @@ class Route: ID of the target backend. """ - match: Optional[RouteMatch] + match: Optional[RouteMatch] = None """ Object defining the match condition for a route to be applied. If an incoming client session matches the specified condition (i.e. it has a matching SNI value or HTTP Host header value), it will be passed to the target backend. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the route was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the route was last updated. """ @@ -1216,7 +1216,7 @@ class AclSpec: ACL description. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` and `http_filter_value` are required. """ @@ -1234,7 +1234,7 @@ class AddBackendServersRequest: List of IP addresses to add to backend servers. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1252,21 +1252,21 @@ class AttachPrivateNetworkRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - ipam_ids: Optional[List[str]] + ipam_ids: Optional[List[str]] = field(default_factory=list) """ IPAM ID of a pre-reserved IP address to assign to the Load Balancer on this Private Network. In the future, it will be possible to specify multiple IPs in this field (IPv4 and IPv6), for now only one ID of an IPv4 address is expected. When null, a new private IP address is created for the Load Balancer on this Private Network. """ - static_config: Optional[PrivateNetworkStaticConfig] + static_config: Optional[PrivateNetworkStaticConfig] = None - dhcp_config: Optional[PrivateNetworkDHCPConfig] + dhcp_config: Optional[PrivateNetworkDHCPConfig] = None - ipam_config: Optional[PrivateNetworkIpamConfig] + ipam_config: Optional[PrivateNetworkIpamConfig] = None @dataclass @@ -1295,17 +1295,17 @@ class CreateAclRequest: ACL description. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ ACL name. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` & `http_filter_value` are required. """ @@ -1353,77 +1353,79 @@ class CreateBackendRequest: List of backend server IP addresses (IPv4 or IPv6) the backend should forward traffic to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the backend. """ - send_proxy_v2: Optional[bool] + send_proxy_v2: Optional[bool] = False """ Deprecated in favor of proxy_protocol field. """ - timeout_server: Optional[str] + timeout_server: Optional[str] = None """ Maximum allowed time for a backend server to process a request. """ - timeout_connect: Optional[str] + timeout_connect: Optional[str] = None """ Maximum allowed time for establishing a connection to a backend server. """ - timeout_tunnel: Optional[str] + timeout_tunnel: Optional[str] = None """ Maximum allowed tunnel inactivity time after Websocket is established (takes precedence over client and server timeout). """ - on_marked_down_action: Optional[OnMarkedDownAction] + on_marked_down_action: Optional[OnMarkedDownAction] = ( + OnMarkedDownAction.ON_MARKED_DOWN_ACTION_NONE + ) """ Action to take when a backend server is marked as down. """ - proxy_protocol: Optional[ProxyProtocol] + proxy_protocol: Optional[ProxyProtocol] = ProxyProtocol.PROXY_PROTOCOL_UNKNOWN """ Protocol to use between the Load Balancer and backend servers. Allows the backend servers to be informed of the client's real IP address. The PROXY protocol must be supported by the backend servers' software. """ - failover_host: Optional[str] + failover_host: Optional[str] = None """ Scaleway Object Storage bucket website to be served as failover if all backend servers are down, e.g. failover-website.s3-website.fr-par.scw.cloud. """ - ssl_bridging: Optional[bool] + ssl_bridging: Optional[bool] = False """ Defines whether to enable SSL bridging between the Load Balancer and backend servers. """ - ignore_ssl_server_verify: Optional[bool] + ignore_ssl_server_verify: Optional[bool] = False """ Defines whether the server certificate verification should be ignored. """ - redispatch_attempt_count: Optional[int] + redispatch_attempt_count: Optional[int] = 0 """ Whether to use another backend server on each attempt. """ - max_retries: Optional[int] + max_retries: Optional[int] = 0 """ Number of retries when a backend server connection failed. """ - max_connections: Optional[int] + max_connections: Optional[int] = 0 """ Maximum number of connections allowed per backend server. """ - timeout_queue: Optional[str] + timeout_queue: Optional[str] = None """ Maximum time for a request to be left pending in queue when `max_connections` is reached. """ @@ -1436,19 +1438,19 @@ class CreateCertificateRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the certificate. """ - letsencrypt: Optional[CreateCertificateRequestLetsencryptConfig] + letsencrypt: Optional[CreateCertificateRequestLetsencryptConfig] = None - custom_certificate: Optional[CreateCertificateRequestCustomCertificate] + custom_certificate: Optional[CreateCertificateRequestCustomCertificate] = None @dataclass @@ -1478,32 +1480,32 @@ class CreateFrontendRequest: Defines whether to enable access logs on the frontend. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the frontend. """ - timeout_client: Optional[str] + timeout_client: Optional[str] = None """ Maximum allowed inactivity time on the client side. """ - certificate_id: Optional[str] + certificate_id: Optional[str] = None """ Certificate ID, deprecated in favor of certificate_ids array. """ - certificate_ids: Optional[List[str]] + certificate_ids: Optional[List[str]] = field(default_factory=list) """ List of SSL/TLS certificate IDs to bind to the frontend. """ - connection_rate_limit: Optional[int] + connection_rate_limit: Optional[int] = 0 """ Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second. """ @@ -1516,24 +1518,24 @@ class CreateIpRequest: If true, creates a Flexible IP with an ipv6 address. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse DNS (domain name) for the IP address. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the IP. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -1548,49 +1550,51 @@ class CreateLbRequest: Load Balancer commercial offer type. Use the Load Balancer types endpoint to retrieve a list of available offer types. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the Load Balancer. """ - ip_id: Optional[str] + ip_id: Optional[str] = None """ ID of an existing flexible IP address to attach to the Load Balancer. """ - assign_flexible_ip: Optional[bool] + assign_flexible_ip: Optional[bool] = False """ Defines whether to automatically assign a flexible public IP to the Load Balancer. Default value is `true` (assign). """ - assign_flexible_ipv6: Optional[bool] + assign_flexible_ipv6: Optional[bool] = False """ Defines whether to automatically assign a flexible public IPv6 to the Load Balancer. Default value is `false` (do not assign). """ - ip_ids: Optional[List[str]] + ip_ids: Optional[List[str]] = field(default_factory=list) """ List of IP IDs to attach to the Load Balancer. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Load Balancer. """ - ssl_compatibility_level: Optional[SSLCompatibilityLevel] + ssl_compatibility_level: Optional[SSLCompatibilityLevel] = ( + SSLCompatibilityLevel.SSL_COMPATIBILITY_LEVEL_UNKNOWN + ) """ Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and do not need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -1605,12 +1609,12 @@ class CreateRouteRequest: ID of the target backend for the route. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - match: Optional[RouteMatch] + match: Optional[RouteMatch] = None """ Object defining the match condition for a route to be applied. If an incoming client session matches the specified condition (i.e. it has a matching SNI value or HTTP Host header value), it will be passed to the target backend. """ @@ -1627,18 +1631,18 @@ class CreateSubscriberRequest: Subscriber name. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None - email_config: Optional[SubscriberEmailConfig] + email_config: Optional[SubscriberEmailConfig] = None - webhook_config: Optional[SubscriberWebhookConfig] + webhook_config: Optional[SubscriberWebhookConfig] = None @dataclass @@ -1648,7 +1652,7 @@ class DeleteAclRequest: ACL ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1661,7 +1665,7 @@ class DeleteBackendRequest: ID of the backend to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1674,7 +1678,7 @@ class DeleteCertificateRequest: Certificate ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1687,7 +1691,7 @@ class DeleteFrontendRequest: ID of the frontend to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1705,7 +1709,7 @@ class DeleteLbRequest: Defines whether the Load Balancer's flexible IP should be deleted. Set to true to release the flexible IP, or false to keep it available in your account for future Load Balancers. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1718,7 +1722,7 @@ class DeleteRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1731,7 +1735,7 @@ class DeleteSubscriberRequest: Subscriber ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1749,7 +1753,7 @@ class DetachPrivateNetworkRequest: Set your instance private network id. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1762,7 +1766,7 @@ class GetAclRequest: ACL ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1775,7 +1779,7 @@ class GetBackendRequest: Backend ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1788,7 +1792,7 @@ class GetCertificateRequest: Certificate ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1801,7 +1805,7 @@ class GetFrontendRequest: Frontend ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1814,7 +1818,7 @@ class GetIpRequest: IP address ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1827,7 +1831,7 @@ class GetLbRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1844,12 +1848,12 @@ class GetLbStatsRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - backend_id: Optional[str] + backend_id: Optional[str] = None """ ID of the backend. """ @@ -1862,7 +1866,7 @@ class GetRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1875,7 +1879,7 @@ class GetSubscriberRequest: Subscriber ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1909,27 +1913,27 @@ class ListAclsRequest: Frontend ID (ACLs attached to this frontend will be returned in the response). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListAclRequestOrderBy] + order_by: Optional[ListAclRequestOrderBy] = ListAclRequestOrderBy.CREATED_AT_ASC """ Sort order of ACLs in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of ACLs to return. """ - name: Optional[str] + name: Optional[str] = None """ ACL name to filter for. """ @@ -1942,22 +1946,22 @@ class ListBackendStatsRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of items to return. """ - backend_id: Optional[str] + backend_id: Optional[str] = None """ ID of the backend. """ @@ -1983,27 +1987,29 @@ class ListBackendsRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the backend to filter for. """ - order_by: Optional[ListBackendsRequestOrderBy] + order_by: Optional[ListBackendsRequestOrderBy] = ( + ListBackendsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of backends in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of backends to return. """ @@ -2029,27 +2035,29 @@ class ListCertificatesRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListCertificatesRequestOrderBy] + order_by: Optional[ListCertificatesRequestOrderBy] = ( + ListCertificatesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of certificates in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of certificates to return. """ - name: Optional[str] + name: Optional[str] = None """ Certificate name to filter for, only certificates of this name will be returned. """ @@ -2075,27 +2083,29 @@ class ListFrontendsRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the frontend to filter for. """ - order_by: Optional[ListFrontendsRequestOrderBy] + order_by: Optional[ListFrontendsRequestOrderBy] = ( + ListFrontendsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of frontends in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of frontends to return. """ @@ -2116,42 +2126,42 @@ class ListFrontendsResponse: @dataclass class ListIPsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of IP addresses to return. """ - ip_address: Optional[str] + ip_address: Optional[str] = None """ IP address to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for, only Load Balancer IP addresses from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Load Balancer IP addresses from this Project will be returned. """ - ip_type: Optional[ListIpsRequestIpType] + ip_type: Optional[ListIpsRequestIpType] = ListIpsRequestIpType.ALL """ IP type to filter for. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tag to filter for, only IPs with one or more matching tags will be returned. """ @@ -2177,22 +2187,24 @@ class ListLbPrivateNetworksRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPrivateNetworksRequestOrderBy] + order_by: Optional[ListPrivateNetworksRequestOrderBy] = ( + ListPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of Private Network objects in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of objects to return. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ @@ -2213,17 +2225,17 @@ class ListLbPrivateNetworksResponse: @dataclass class ListLbTypesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of items to return. """ @@ -2244,42 +2256,42 @@ class ListLbTypesResponse: @dataclass class ListLbsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Load Balancer name to filter for. """ - order_by: Optional[ListLbsRequestOrderBy] + order_by: Optional[ListLbsRequestOrderBy] = ListLbsRequestOrderBy.CREATED_AT_ASC """ Sort order of Load Balancers in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Load Balancers to return. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for, only Load Balancers from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Load Balancers from this Project will be returned. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tag, only Load Balancers with one or more matching tags will be returned. """ @@ -2300,27 +2312,29 @@ class ListLbsResponse: @dataclass class ListRoutesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListRoutesRequestOrderBy] + order_by: Optional[ListRoutesRequestOrderBy] = ( + ListRoutesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of routes in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of route objects to return. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - frontend_id: Optional[str] + frontend_id: Optional[str] = None """ Frontend ID to filter for, only Routes from this Frontend will be returned. """ @@ -2341,37 +2355,39 @@ class ListRoutesResponse: @dataclass class ListSubscriberRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListSubscriberRequestOrderBy] + order_by: Optional[ListSubscriberRequestOrderBy] = ( + ListSubscriberRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of subscribers in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of items to return. """ - name: Optional[str] + name: Optional[str] = None """ Subscriber name to search for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter subscribers by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter subscribers by Project ID. """ @@ -2402,7 +2418,7 @@ class MigrateLbRequest: Load Balancer type to migrate to (use the List all Load Balancer offer types endpoint to get a list of available offer types). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2415,7 +2431,7 @@ class ReleaseIpRequest: IP address ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2433,7 +2449,7 @@ class RemoveBackendServersRequest: List of IP addresses to remove from backend servers. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2464,7 +2480,7 @@ class SetBackendServersRequest: List of IP addresses for backend servers. Any other existing backend servers will be removed. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2482,7 +2498,7 @@ class SubscribeToLbRequest: Subscriber ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2495,7 +2511,7 @@ class UnsubscribeFromLbRequest: Load Balancer ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2523,17 +2539,17 @@ class UpdateAclRequest: Priority of this ACL (ACLs are applied in ascending order, 0 is the first ACL executed). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` & `http_filter_value` are required. """ - description: Optional[str] + description: Optional[str] = None """ ACL description. """ @@ -2576,72 +2592,74 @@ class UpdateBackendRequest: Cookie name for cookie-based sticky sessions. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - send_proxy_v2: Optional[bool] + send_proxy_v2: Optional[bool] = False """ Deprecated in favor of proxy_protocol field. """ - timeout_server: Optional[str] + timeout_server: Optional[str] = None """ Maximum allowed time for a backend server to process a request. """ - timeout_connect: Optional[str] + timeout_connect: Optional[str] = None """ Maximum allowed time for establishing a connection to a backend server. """ - timeout_tunnel: Optional[str] + timeout_tunnel: Optional[str] = None """ Maximum allowed tunnel inactivity time after Websocket is established (takes precedence over client and server timeout). """ - on_marked_down_action: Optional[OnMarkedDownAction] + on_marked_down_action: Optional[OnMarkedDownAction] = ( + OnMarkedDownAction.ON_MARKED_DOWN_ACTION_NONE + ) """ Action to take when a backend server is marked as down. """ - proxy_protocol: Optional[ProxyProtocol] + proxy_protocol: Optional[ProxyProtocol] = ProxyProtocol.PROXY_PROTOCOL_UNKNOWN """ Protocol to use between the Load Balancer and backend servers. Allows the backend servers to be informed of the client's real IP address. The PROXY protocol must be supported by the backend servers' software. """ - failover_host: Optional[str] + failover_host: Optional[str] = None """ Scaleway Object Storage bucket website to be served as failover if all backend servers are down, e.g. failover-website.s3-website.fr-par.scw.cloud. """ - ssl_bridging: Optional[bool] + ssl_bridging: Optional[bool] = False """ Defines whether to enable SSL bridging between the Load Balancer and backend servers. """ - ignore_ssl_server_verify: Optional[bool] + ignore_ssl_server_verify: Optional[bool] = False """ Defines whether the server certificate verification should be ignored. """ - redispatch_attempt_count: Optional[int] + redispatch_attempt_count: Optional[int] = 0 """ Whether to use another backend server on each attempt. """ - max_retries: Optional[int] + max_retries: Optional[int] = 0 """ Number of retries when a backend server connection failed. """ - max_connections: Optional[int] + max_connections: Optional[int] = 0 """ Maximum number of connections allowed per backend server. """ - timeout_queue: Optional[str] + timeout_queue: Optional[str] = None """ Maximum time for a request to be left pending in queue when `max_connections` is reached. """ @@ -2659,7 +2677,7 @@ class UpdateCertificateRequest: Certificate name. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2692,32 +2710,32 @@ class UpdateFrontendRequest: Defines whether to enable HTTP/3 protocol on the frontend. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - timeout_client: Optional[str] + timeout_client: Optional[str] = None """ Maximum allowed inactivity time on the client side. """ - certificate_id: Optional[str] + certificate_id: Optional[str] = None """ Certificate ID, deprecated in favor of certificate_ids array. """ - certificate_ids: Optional[List[str]] + certificate_ids: Optional[List[str]] = field(default_factory=list) """ List of SSL/TLS certificate IDs to bind to the frontend. """ - connection_rate_limit: Optional[int] + connection_rate_limit: Optional[int] = 0 """ Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second. """ - enable_access_logs: Optional[bool] + enable_access_logs: Optional[bool] = False """ Defines whether to enable access logs on the frontend. """ @@ -2745,39 +2763,39 @@ class UpdateHealthCheckRequest: Defines whether proxy protocol should be activated for the health check. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - check_delay: Optional[str] + check_delay: Optional[str] = None """ Time to wait between two consecutive health checks. """ - check_timeout: Optional[str] + check_timeout: Optional[str] = None """ Maximum time a backend server has to reply to the health check. """ - transient_check_delay: Optional[str] + transient_check_delay: Optional[str] = None """ Time to wait between two consecutive health checks when a backend server is in a transient state (going UP or DOWN). """ - tcp_config: Optional[HealthCheckTcpConfig] + tcp_config: Optional[HealthCheckTcpConfig] = None - mysql_config: Optional[HealthCheckMysqlConfig] + mysql_config: Optional[HealthCheckMysqlConfig] = None - pgsql_config: Optional[HealthCheckPgsqlConfig] + pgsql_config: Optional[HealthCheckPgsqlConfig] = None - ldap_config: Optional[HealthCheckLdapConfig] + ldap_config: Optional[HealthCheckLdapConfig] = None - redis_config: Optional[HealthCheckRedisConfig] + redis_config: Optional[HealthCheckRedisConfig] = None - http_config: Optional[HealthCheckHttpConfig] + http_config: Optional[HealthCheckHttpConfig] = None - https_config: Optional[HealthCheckHttpsConfig] + https_config: Optional[HealthCheckHttpsConfig] = None @dataclass @@ -2787,22 +2805,22 @@ class UpdateIpRequest: IP address ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse DNS (domain name) for the IP address. """ - lb_id: Optional[str] + lb_id: Optional[str] = None """ ID of the server on which to attach the flexible IP. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the IP. """ @@ -2825,17 +2843,19 @@ class UpdateLbRequest: Load Balancer description. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Load Balancer. """ - ssl_compatibility_level: Optional[SSLCompatibilityLevel] + ssl_compatibility_level: Optional[SSLCompatibilityLevel] = ( + SSLCompatibilityLevel.SSL_COMPATIBILITY_LEVEL_UNKNOWN + ) """ Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and don't need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort. """ @@ -2853,12 +2873,12 @@ class UpdateRouteRequest: ID of the target backend for the route. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - match: Optional[RouteMatch] + match: Optional[RouteMatch] = None """ Object defining the match condition for a route to be applied. If an incoming client session matches the specified condition (i.e. it has a matching SNI value or HTTP Host header value), it will be passed to the target backend. """ @@ -2876,14 +2896,14 @@ class UpdateSubscriberRequest: Subscriber name. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - email_config: Optional[SubscriberEmailConfig] + email_config: Optional[SubscriberEmailConfig] = None - webhook_config: Optional[SubscriberWebhookConfig] + webhook_config: Optional[SubscriberWebhookConfig] = None @dataclass @@ -2898,7 +2918,7 @@ class ZonedApiAddBackendServersRequest: List of IP addresses to add to backend servers. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -2916,21 +2936,21 @@ class ZonedApiAttachPrivateNetworkRequest: Private Network ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ipam_ids: Optional[List[str]] + ipam_ids: Optional[List[str]] = field(default_factory=list) """ IPAM ID of a pre-reserved IP address to assign to the Load Balancer on this Private Network. In the future, it will be possible to specify multiple IPs in this field (IPv4 and IPv6), for now only one ID of an IPv4 address is expected. When null, a new private IP address is created for the Load Balancer on this Private Network. """ - static_config: Optional[PrivateNetworkStaticConfig] + static_config: Optional[PrivateNetworkStaticConfig] = None - dhcp_config: Optional[PrivateNetworkDHCPConfig] + dhcp_config: Optional[PrivateNetworkDHCPConfig] = None - ipam_config: Optional[PrivateNetworkIpamConfig] + ipam_config: Optional[PrivateNetworkIpamConfig] = None @dataclass @@ -2959,17 +2979,17 @@ class ZonedApiCreateAclRequest: ACL description. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ ACL name. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` & `http_filter_value` are required. """ @@ -3017,77 +3037,79 @@ class ZonedApiCreateBackendRequest: List of backend server IP addresses (IPv4 or IPv6) the backend should forward traffic to. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the backend. """ - send_proxy_v2: Optional[bool] + send_proxy_v2: Optional[bool] = False """ Deprecated in favor of proxy_protocol field. """ - timeout_server: Optional[str] + timeout_server: Optional[str] = None """ Maximum allowed time for a backend server to process a request. """ - timeout_connect: Optional[str] + timeout_connect: Optional[str] = None """ Maximum allowed time for establishing a connection to a backend server. """ - timeout_tunnel: Optional[str] + timeout_tunnel: Optional[str] = None """ Maximum allowed tunnel inactivity time after Websocket is established (takes precedence over client and server timeout). """ - on_marked_down_action: Optional[OnMarkedDownAction] + on_marked_down_action: Optional[OnMarkedDownAction] = ( + OnMarkedDownAction.ON_MARKED_DOWN_ACTION_NONE + ) """ Action to take when a backend server is marked as down. """ - proxy_protocol: Optional[ProxyProtocol] + proxy_protocol: Optional[ProxyProtocol] = ProxyProtocol.PROXY_PROTOCOL_UNKNOWN """ Protocol to use between the Load Balancer and backend servers. Allows the backend servers to be informed of the client's real IP address. The PROXY protocol must be supported by the backend servers' software. """ - failover_host: Optional[str] + failover_host: Optional[str] = None """ Scaleway Object Storage bucket website to be served as failover if all backend servers are down, e.g. failover-website.s3-website.fr-par.scw.cloud. """ - ssl_bridging: Optional[bool] + ssl_bridging: Optional[bool] = False """ Defines whether to enable SSL bridging between the Load Balancer and backend servers. """ - ignore_ssl_server_verify: Optional[bool] + ignore_ssl_server_verify: Optional[bool] = False """ Defines whether the server certificate verification should be ignored. """ - redispatch_attempt_count: Optional[int] + redispatch_attempt_count: Optional[int] = 0 """ Whether to use another backend server on each attempt. """ - max_retries: Optional[int] + max_retries: Optional[int] = 0 """ Number of retries when a backend server connection failed. """ - max_connections: Optional[int] + max_connections: Optional[int] = 0 """ Maximum number of connections allowed per backend server. """ - timeout_queue: Optional[str] + timeout_queue: Optional[str] = None """ Maximum time for a request to be left pending in queue when `max_connections` is reached. """ @@ -3100,19 +3122,19 @@ class ZonedApiCreateCertificateRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the certificate. """ - letsencrypt: Optional[CreateCertificateRequestLetsencryptConfig] + letsencrypt: Optional[CreateCertificateRequestLetsencryptConfig] = None - custom_certificate: Optional[CreateCertificateRequestCustomCertificate] + custom_certificate: Optional[CreateCertificateRequestCustomCertificate] = None @dataclass @@ -3142,32 +3164,32 @@ class ZonedApiCreateFrontendRequest: Defines whether to enable access logs on the frontend. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the frontend. """ - timeout_client: Optional[str] + timeout_client: Optional[str] = None """ Maximum allowed inactivity time on the client side. """ - certificate_id: Optional[str] + certificate_id: Optional[str] = None """ Certificate ID, deprecated in favor of certificate_ids array. """ - certificate_ids: Optional[List[str]] + certificate_ids: Optional[List[str]] = field(default_factory=list) """ List of SSL/TLS certificate IDs to bind to the frontend. """ - connection_rate_limit: Optional[int] + connection_rate_limit: Optional[int] = 0 """ Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second. """ @@ -3180,24 +3202,24 @@ class ZonedApiCreateIpRequest: If true, creates a Flexible IP with an ipv6 address. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse DNS (domain name) for the IP address. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the IP. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -3212,49 +3234,51 @@ class ZonedApiCreateLbRequest: Load Balancer commercial offer type. Use the Load Balancer types endpoint to retrieve a list of available offer types. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the Load Balancer. """ - ip_id: Optional[str] + ip_id: Optional[str] = None """ ID of an existing flexible IP address to attach to the Load Balancer. """ - assign_flexible_ip: Optional[bool] + assign_flexible_ip: Optional[bool] = False """ Defines whether to automatically assign a flexible public IP to the Load Balancer. Default value is `true` (assign). """ - assign_flexible_ipv6: Optional[bool] + assign_flexible_ipv6: Optional[bool] = False """ Defines whether to automatically assign a flexible public IPv6 to the Load Balancer. Default value is `false` (do not assign). """ - ip_ids: Optional[List[str]] + ip_ids: Optional[List[str]] = field(default_factory=list) """ List of IP IDs to attach to the Load Balancer. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Load Balancer. """ - ssl_compatibility_level: Optional[SSLCompatibilityLevel] + ssl_compatibility_level: Optional[SSLCompatibilityLevel] = ( + SSLCompatibilityLevel.SSL_COMPATIBILITY_LEVEL_UNKNOWN + ) """ Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and do not need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -3269,12 +3293,12 @@ class ZonedApiCreateRouteRequest: ID of the target backend for the route. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - match: Optional[RouteMatch] + match: Optional[RouteMatch] = None """ Object defining the match condition for a route to be applied. If an incoming client session matches the specified condition (i.e. it has a matching SNI value or HTTP Host header value), it will be passed to the target backend. """ @@ -3291,18 +3315,18 @@ class ZonedApiCreateSubscriberRequest: Subscriber name. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None - email_config: Optional[SubscriberEmailConfig] + email_config: Optional[SubscriberEmailConfig] = None - webhook_config: Optional[SubscriberWebhookConfig] + webhook_config: Optional[SubscriberWebhookConfig] = None @dataclass @@ -3312,7 +3336,7 @@ class ZonedApiDeleteAclRequest: ACL ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3325,7 +3349,7 @@ class ZonedApiDeleteBackendRequest: ID of the backend to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3338,7 +3362,7 @@ class ZonedApiDeleteCertificateRequest: Certificate ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3351,7 +3375,7 @@ class ZonedApiDeleteFrontendRequest: ID of the frontend to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3369,7 +3393,7 @@ class ZonedApiDeleteLbRequest: Defines whether the Load Balancer's flexible IP should be deleted. Set to true to release the flexible IP, or false to keep it available in your account for future Load Balancers. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3382,7 +3406,7 @@ class ZonedApiDeleteRouteRequest: Route ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3395,7 +3419,7 @@ class ZonedApiDeleteSubscriberRequest: Subscriber ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3413,7 +3437,7 @@ class ZonedApiDetachPrivateNetworkRequest: Set your instance private network id. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3426,7 +3450,7 @@ class ZonedApiGetAclRequest: ACL ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3439,7 +3463,7 @@ class ZonedApiGetBackendRequest: Backend ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3452,7 +3476,7 @@ class ZonedApiGetCertificateRequest: Certificate ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3465,7 +3489,7 @@ class ZonedApiGetFrontendRequest: Frontend ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3478,7 +3502,7 @@ class ZonedApiGetIpRequest: IP address ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3491,7 +3515,7 @@ class ZonedApiGetLbRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3508,12 +3532,12 @@ class ZonedApiGetLbStatsRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - backend_id: Optional[str] + backend_id: Optional[str] = None """ ID of the backend. """ @@ -3526,7 +3550,7 @@ class ZonedApiGetRouteRequest: Route ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3539,7 +3563,7 @@ class ZonedApiGetSubscriberRequest: Subscriber ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3552,27 +3576,27 @@ class ZonedApiListAclsRequest: Frontend ID (ACLs attached to this frontend will be returned in the response). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListAclRequestOrderBy] + order_by: Optional[ListAclRequestOrderBy] = ListAclRequestOrderBy.CREATED_AT_ASC """ Sort order of ACLs in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of ACLs to return. """ - name: Optional[str] + name: Optional[str] = None """ ACL name to filter for. """ @@ -3585,22 +3609,22 @@ class ZonedApiListBackendStatsRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of items to return. """ - backend_id: Optional[str] + backend_id: Optional[str] = None """ ID of the backend. """ @@ -3613,27 +3637,29 @@ class ZonedApiListBackendsRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the backend to filter for. """ - order_by: Optional[ListBackendsRequestOrderBy] + order_by: Optional[ListBackendsRequestOrderBy] = ( + ListBackendsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of backends in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of backends to return. """ @@ -3646,27 +3672,29 @@ class ZonedApiListCertificatesRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListCertificatesRequestOrderBy] + order_by: Optional[ListCertificatesRequestOrderBy] = ( + ListCertificatesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of certificates in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of certificates to return. """ - name: Optional[str] + name: Optional[str] = None """ Certificate name to filter for, only certificates of this name will be returned. """ @@ -3679,27 +3707,29 @@ class ZonedApiListFrontendsRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the frontend to filter for. """ - order_by: Optional[ListFrontendsRequestOrderBy] + order_by: Optional[ListFrontendsRequestOrderBy] = ( + ListFrontendsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of frontends in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of frontends to return. """ @@ -3707,42 +3737,42 @@ class ZonedApiListFrontendsRequest: @dataclass class ZonedApiListIPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of IP addresses to return. """ - ip_address: Optional[str] + ip_address: Optional[str] = None """ IP address to filter for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for, only Load Balancer IP addresses from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Load Balancer IP addresses from this Project will be returned. """ - ip_type: Optional[ListIpsRequestIpType] + ip_type: Optional[ListIpsRequestIpType] = ListIpsRequestIpType.ALL """ IP type to filter for. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tag to filter for, only IPs with one or more matching tags will be returned. """ @@ -3755,22 +3785,24 @@ class ZonedApiListLbPrivateNetworksRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListPrivateNetworksRequestOrderBy] + order_by: Optional[ListPrivateNetworksRequestOrderBy] = ( + ListPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of Private Network objects in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of objects to return. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ @@ -3778,17 +3810,17 @@ class ZonedApiListLbPrivateNetworksRequest: @dataclass class ZonedApiListLbTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of items to return. """ @@ -3796,42 +3828,42 @@ class ZonedApiListLbTypesRequest: @dataclass class ZonedApiListLbsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Load Balancer name to filter for. """ - order_by: Optional[ListLbsRequestOrderBy] + order_by: Optional[ListLbsRequestOrderBy] = ListLbsRequestOrderBy.CREATED_AT_ASC """ Sort order of Load Balancers in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Load Balancers to return. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for, only Load Balancers from this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Load Balancers from this Project will be returned. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by tag, only Load Balancers with one or more matching tags will be returned. """ @@ -3839,27 +3871,29 @@ class ZonedApiListLbsRequest: @dataclass class ZonedApiListRoutesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListRoutesRequestOrderBy] + order_by: Optional[ListRoutesRequestOrderBy] = ( + ListRoutesRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of routes in the response. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of route objects to return. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - frontend_id: Optional[str] + frontend_id: Optional[str] = None """ Frontend ID to filter for, only Routes from this Frontend will be returned. """ @@ -3867,37 +3901,39 @@ class ZonedApiListRoutesRequest: @dataclass class ZonedApiListSubscriberRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListSubscriberRequestOrderBy] + order_by: Optional[ListSubscriberRequestOrderBy] = ( + ListSubscriberRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of subscribers in the response. """ - page: Optional[int] + page: Optional[int] = 0 """ The page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of items to return. """ - name: Optional[str] + name: Optional[str] = None """ Subscriber name to search for. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter subscribers by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter subscribers by Project ID. """ @@ -3915,7 +3951,7 @@ class ZonedApiMigrateLbRequest: Load Balancer type to migrate to (use the List all Load Balancer offer types endpoint to get a list of available offer types). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3928,7 +3964,7 @@ class ZonedApiReleaseIpRequest: IP address ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3946,7 +3982,7 @@ class ZonedApiRemoveBackendServersRequest: List of IP addresses to remove from backend servers. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3964,7 +4000,7 @@ class ZonedApiSetAclsRequest: Frontend ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -3982,7 +4018,7 @@ class ZonedApiSetBackendServersRequest: List of IP addresses for backend servers. Any other existing backend servers will be removed. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4000,7 +4036,7 @@ class ZonedApiSubscribeToLbRequest: Subscriber ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4013,7 +4049,7 @@ class ZonedApiUnsubscribeFromLbRequest: Load Balancer ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4041,17 +4077,17 @@ class ZonedApiUpdateAclRequest: Priority of this ACL (ACLs are applied in ascending order, 0 is the first ACL executed). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - match: Optional[AclMatch] + match: Optional[AclMatch] = None """ ACL match filter object. One of `ip_subnet`, `ips_edge_services` or `http_filter` & `http_filter_value` are required. """ - description: Optional[str] + description: Optional[str] = None """ ACL description. """ @@ -4094,72 +4130,74 @@ class ZonedApiUpdateBackendRequest: Cookie name for cookie-based sticky sessions. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - send_proxy_v2: Optional[bool] + send_proxy_v2: Optional[bool] = False """ Deprecated in favor of proxy_protocol field. """ - timeout_server: Optional[str] + timeout_server: Optional[str] = None """ Maximum allowed time for a backend server to process a request. """ - timeout_connect: Optional[str] + timeout_connect: Optional[str] = None """ Maximum allowed time for establishing a connection to a backend server. """ - timeout_tunnel: Optional[str] + timeout_tunnel: Optional[str] = None """ Maximum allowed tunnel inactivity time after Websocket is established (takes precedence over client and server timeout). """ - on_marked_down_action: Optional[OnMarkedDownAction] + on_marked_down_action: Optional[OnMarkedDownAction] = ( + OnMarkedDownAction.ON_MARKED_DOWN_ACTION_NONE + ) """ Action to take when a backend server is marked as down. """ - proxy_protocol: Optional[ProxyProtocol] + proxy_protocol: Optional[ProxyProtocol] = ProxyProtocol.PROXY_PROTOCOL_UNKNOWN """ Protocol to use between the Load Balancer and backend servers. Allows the backend servers to be informed of the client's real IP address. The PROXY protocol must be supported by the backend servers' software. """ - failover_host: Optional[str] + failover_host: Optional[str] = None """ Scaleway Object Storage bucket website to be served as failover if all backend servers are down, e.g. failover-website.s3-website.fr-par.scw.cloud. """ - ssl_bridging: Optional[bool] + ssl_bridging: Optional[bool] = False """ Defines whether to enable SSL bridging between the Load Balancer and backend servers. """ - ignore_ssl_server_verify: Optional[bool] + ignore_ssl_server_verify: Optional[bool] = False """ Defines whether the server certificate verification should be ignored. """ - redispatch_attempt_count: Optional[int] + redispatch_attempt_count: Optional[int] = 0 """ Whether to use another backend server on each attempt. """ - max_retries: Optional[int] + max_retries: Optional[int] = 0 """ Number of retries when a backend server connection failed. """ - max_connections: Optional[int] + max_connections: Optional[int] = 0 """ Maximum number of connections allowed per backend server. """ - timeout_queue: Optional[str] + timeout_queue: Optional[str] = None """ Maximum time for a request to be left pending in queue when `max_connections` is reached. """ @@ -4177,7 +4215,7 @@ class ZonedApiUpdateCertificateRequest: Certificate name. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -4210,32 +4248,32 @@ class ZonedApiUpdateFrontendRequest: Defines whether to enable HTTP/3 protocol on the frontend. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - timeout_client: Optional[str] + timeout_client: Optional[str] = None """ Maximum allowed inactivity time on the client side. """ - certificate_id: Optional[str] + certificate_id: Optional[str] = None """ Certificate ID, deprecated in favor of certificate_ids array. """ - certificate_ids: Optional[List[str]] + certificate_ids: Optional[List[str]] = field(default_factory=list) """ List of SSL/TLS certificate IDs to bind to the frontend. """ - connection_rate_limit: Optional[int] + connection_rate_limit: Optional[int] = 0 """ Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second. """ - enable_access_logs: Optional[bool] + enable_access_logs: Optional[bool] = False """ Defines whether to enable access logs on the frontend. """ @@ -4263,39 +4301,39 @@ class ZonedApiUpdateHealthCheckRequest: Defines whether proxy protocol should be activated for the health check. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - check_delay: Optional[str] + check_delay: Optional[str] = None """ Time to wait between two consecutive health checks. """ - check_timeout: Optional[str] + check_timeout: Optional[str] = None """ Maximum time a backend server has to reply to the health check. """ - transient_check_delay: Optional[str] + transient_check_delay: Optional[str] = None """ Time to wait between two consecutive health checks when a backend server is in a transient state (going UP or DOWN). """ - tcp_config: Optional[HealthCheckTcpConfig] + tcp_config: Optional[HealthCheckTcpConfig] = None - mysql_config: Optional[HealthCheckMysqlConfig] + mysql_config: Optional[HealthCheckMysqlConfig] = None - pgsql_config: Optional[HealthCheckPgsqlConfig] + pgsql_config: Optional[HealthCheckPgsqlConfig] = None - ldap_config: Optional[HealthCheckLdapConfig] + ldap_config: Optional[HealthCheckLdapConfig] = None - redis_config: Optional[HealthCheckRedisConfig] + redis_config: Optional[HealthCheckRedisConfig] = None - http_config: Optional[HealthCheckHttpConfig] + http_config: Optional[HealthCheckHttpConfig] = None - https_config: Optional[HealthCheckHttpsConfig] + https_config: Optional[HealthCheckHttpsConfig] = None @dataclass @@ -4305,22 +4343,22 @@ class ZonedApiUpdateIpRequest: IP address ID. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse DNS (domain name) for the IP address. """ - lb_id: Optional[str] + lb_id: Optional[str] = None """ ID of the server on which to attach the flexible IP. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the IP. """ @@ -4343,17 +4381,19 @@ class ZonedApiUpdateLbRequest: Load Balancer description. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Load Balancer. """ - ssl_compatibility_level: Optional[SSLCompatibilityLevel] + ssl_compatibility_level: Optional[SSLCompatibilityLevel] = ( + SSLCompatibilityLevel.SSL_COMPATIBILITY_LEVEL_UNKNOWN + ) """ Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and don't need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort. """ @@ -4371,12 +4411,12 @@ class ZonedApiUpdateRouteRequest: ID of the target backend for the route. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - match: Optional[RouteMatch] + match: Optional[RouteMatch] = None """ Object defining the match condition for a route to be applied. If an incoming client session matches the specified condition (i.e. it has a matching SNI value or HTTP Host header value), it will be passed to the target backend. """ @@ -4394,11 +4434,11 @@ class ZonedApiUpdateSubscriberRequest: Subscriber name. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - email_config: Optional[SubscriberEmailConfig] + email_config: Optional[SubscriberEmailConfig] = None - webhook_config: Optional[SubscriberWebhookConfig] + webhook_config: Optional[SubscriberWebhookConfig] = None diff --git a/scaleway/scaleway/marketplace/v2/marshalling.py b/scaleway/scaleway/marketplace/v2/marshalling.py index c3c22a3e1..7d49dce30 100644 --- a/scaleway/scaleway/marketplace/v2/marshalling.py +++ b/scaleway/scaleway/marketplace/v2/marshalling.py @@ -5,6 +5,7 @@ from dateutil import parser from .types import ( + LocalImageType, Category, Image, LocalImage, @@ -27,14 +28,20 @@ def unmarshal_Category(data: Any) -> Category: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None return Category(**args) @@ -50,26 +57,38 @@ def unmarshal_Image(data: Any) -> Image: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("logo", None) if field is not None: args["logo"] = field + else: + args["logo"] = None field = data.get("categories", None) if field is not None: args["categories"] = field + else: + args["categories"] = field(default_factory=list) field = data.get("label", None) if field is not None: args["label"] = field + else: + args["label"] = None field = data.get("created_at", None) if field is not None: @@ -105,26 +124,38 @@ def unmarshal_LocalImage(data: Any) -> LocalImage: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("compatible_commercial_types", None) if field is not None: args["compatible_commercial_types"] = field + else: + args["compatible_commercial_types"] = field(default_factory=list) field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("label", None) if field is not None: args["label"] = field + else: + args["label"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = LocalImageType.UNKNOWN_TYPE return LocalImage(**args) @@ -140,10 +171,14 @@ def unmarshal_Version(data: Any) -> Version: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("created_at", None) if field is not None: @@ -181,10 +216,14 @@ def unmarshal_ListCategoriesResponse(data: Any) -> ListCategoriesResponse: args["categories"] = ( [unmarshal_Category(v) for v in field] if field is not None else None ) + else: + args["categories"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListCategoriesResponse(**args) @@ -202,10 +241,14 @@ def unmarshal_ListImagesResponse(data: Any) -> ListImagesResponse: args["images"] = ( [unmarshal_Image(v) for v in field] if field is not None else None ) + else: + args["images"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListImagesResponse(**args) @@ -223,10 +266,14 @@ def unmarshal_ListLocalImagesResponse(data: Any) -> ListLocalImagesResponse: args["local_images"] = ( [unmarshal_LocalImage(v) for v in field] if field is not None else None ) + else: + args["local_images"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListLocalImagesResponse(**args) @@ -244,9 +291,13 @@ def unmarshal_ListVersionsResponse(data: Any) -> ListVersionsResponse: args["versions"] = ( [unmarshal_Version(v) for v in field] if field is not None else None ) + else: + args["versions"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListVersionsResponse(**args) diff --git a/scaleway/scaleway/marketplace/v2/types.py b/scaleway/scaleway/marketplace/v2/types.py index fd972c3a8..fda64d01b 100644 --- a/scaleway/scaleway/marketplace/v2/types.py +++ b/scaleway/scaleway/marketplace/v2/types.py @@ -57,9 +57,7 @@ def __str__(self) -> str: @dataclass class Category: id: str - name: str - description: str @@ -96,17 +94,17 @@ class Image: This label can be used in the image field of the server creation request. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of this image. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date of the last modification of this image. """ - valid_until: Optional[datetime] + valid_until: Optional[datetime] = None """ Expiration date of this image. """ @@ -157,17 +155,17 @@ class Version: Name of this version. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date of this image version. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date of the last modification of this version. """ - published_at: Optional[datetime] + published_at: Optional[datetime] = None """ Date this version was officially published. """ @@ -198,15 +196,13 @@ class GetVersionRequest: @dataclass class ListCategoriesRequest: - page_size: Optional[int] - - page: Optional[int] + page_size: Optional[int] = None + page: Optional[int] = None @dataclass class ListCategoriesResponse: categories: List[Category] - total_count: int @@ -217,27 +213,27 @@ class ListImagesRequest: Choose to include end-of-life images. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to display. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to display. """ - order_by: Optional[ListImagesRequestOrderBy] + order_by: Optional[ListImagesRequestOrderBy] = ListImagesRequestOrderBy.NAME_ASC """ Ordering to use. """ - arch: Optional[str] + arch: Optional[str] = None """ Choose for which machine architecture to return images. """ - category: Optional[str] + category: Optional[str] = None """ Choose the category of images to get. """ @@ -246,64 +242,60 @@ class ListImagesRequest: @dataclass class ListImagesResponse: images: List[Image] - total_count: int @dataclass class ListLocalImagesRequest: - page_size: Optional[int] + page_size: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to display. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to display. """ - order_by: Optional[ListLocalImagesRequestOrderBy] + order_by: Optional[ListLocalImagesRequestOrderBy] = ( + ListLocalImagesRequestOrderBy.TYPE_ASC + ) """ Ordering to use. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Filter local images available on this Availability Zone. """ - type_: Optional[LocalImageType] + type_: Optional[LocalImageType] = LocalImageType.UNKNOWN_TYPE """ Filter by type. """ - image_id: Optional[str] + image_id: Optional[str] = None - version_id: Optional[str] + version_id: Optional[str] = None - image_label: Optional[str] + image_label: Optional[str] = None @dataclass class ListLocalImagesResponse: local_images: List[LocalImage] - total_count: int @dataclass class ListVersionsRequest: image_id: str - - page_size: Optional[int] - - page: Optional[int] - - order_by: Optional[ListVersionsRequestOrderBy] + page_size: Optional[int] = None + page: Optional[int] = None + order_by: Optional[ListVersionsRequestOrderBy] = None @dataclass class ListVersionsResponse: versions: List[Version] - total_count: int diff --git a/scaleway/scaleway/mnq/v1beta1/marshalling.py b/scaleway/scaleway/mnq/v1beta1/marshalling.py index a61ebfcb1..1fb55617a 100644 --- a/scaleway/scaleway/mnq/v1beta1/marshalling.py +++ b/scaleway/scaleway/mnq/v1beta1/marshalling.py @@ -6,6 +6,8 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + SnsInfoStatus, + SqsInfoStatus, NatsAccount, File, NatsCredentials, @@ -44,22 +46,32 @@ def unmarshal_NatsAccount(data: Any) -> NatsAccount: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -87,10 +99,14 @@ def unmarshal_File(data: Any) -> File: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("content", None) if field is not None: args["content"] = field + else: + args["content"] = None return File(**args) @@ -106,18 +122,26 @@ def unmarshal_NatsCredentials(data: Any) -> NatsCredentials: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("nats_account_id", None) if field is not None: args["nats_account_id"] = field + else: + args["nats_account_id"] = None field = data.get("checksum", None) if field is not None: args["checksum"] = field + else: + args["checksum"] = None field = data.get("created_at", None) if field is not None: @@ -152,19 +176,19 @@ def unmarshal_SnsPermissions(data: Any) -> SnsPermissions: if field is not None: args["can_publish"] = field else: - args["can_publish"] = None + args["can_publish"] = False field = data.get("can_receive", None) if field is not None: args["can_receive"] = field else: - args["can_receive"] = None + args["can_receive"] = False field = data.get("can_manage", None) if field is not None: args["can_manage"] = field else: - args["can_manage"] = None + args["can_manage"] = False return SnsPermissions(**args) @@ -180,30 +204,44 @@ def unmarshal_SnsCredentials(data: Any) -> SnsCredentials: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None field = data.get("secret_key", None) if field is not None: args["secret_key"] = field + else: + args["secret_key"] = None field = data.get("secret_checksum", None) if field is not None: args["secret_checksum"] = field + else: + args["secret_checksum"] = None field = data.get("created_at", None) if field is not None: @@ -238,19 +276,19 @@ def unmarshal_SqsPermissions(data: Any) -> SqsPermissions: if field is not None: args["can_publish"] = field else: - args["can_publish"] = None + args["can_publish"] = False field = data.get("can_receive", None) if field is not None: args["can_receive"] = field else: - args["can_receive"] = None + args["can_receive"] = False field = data.get("can_manage", None) if field is not None: args["can_manage"] = field else: - args["can_manage"] = None + args["can_manage"] = False return SqsPermissions(**args) @@ -266,30 +304,44 @@ def unmarshal_SqsCredentials(data: Any) -> SqsCredentials: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None field = data.get("secret_key", None) if field is not None: args["secret_key"] = field + else: + args["secret_key"] = None field = data.get("secret_checksum", None) if field is not None: args["secret_checksum"] = field + else: + args["secret_checksum"] = None field = data.get("created_at", None) if field is not None: @@ -323,12 +375,16 @@ def unmarshal_ListNatsAccountsResponse(data: Any) -> ListNatsAccountsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("nats_accounts", None) if field is not None: args["nats_accounts"] = ( [unmarshal_NatsAccount(v) for v in field] if field is not None else None ) + else: + args["nats_accounts"] = field(default_factory=list) return ListNatsAccountsResponse(**args) @@ -344,12 +400,16 @@ def unmarshal_ListNatsCredentialsResponse(data: Any) -> ListNatsCredentialsRespo field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("nats_credentials", None) if field is not None: args["nats_credentials"] = ( [unmarshal_NatsCredentials(v) for v in field] if field is not None else None ) + else: + args["nats_credentials"] = field(default_factory=list) return ListNatsCredentialsResponse(**args) @@ -365,12 +425,16 @@ def unmarshal_ListSnsCredentialsResponse(data: Any) -> ListSnsCredentialsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("sns_credentials", None) if field is not None: args["sns_credentials"] = ( [unmarshal_SnsCredentials(v) for v in field] if field is not None else None ) + else: + args["sns_credentials"] = field(default_factory=list) return ListSnsCredentialsResponse(**args) @@ -386,12 +450,16 @@ def unmarshal_ListSqsCredentialsResponse(data: Any) -> ListSqsCredentialsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("sqs_credentials", None) if field is not None: args["sqs_credentials"] = ( [unmarshal_SqsCredentials(v) for v in field] if field is not None else None ) + else: + args["sqs_credentials"] = field(default_factory=list) return ListSqsCredentialsResponse(**args) @@ -407,18 +475,26 @@ def unmarshal_SnsInfo(data: Any) -> SnsInfo: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SnsInfoStatus.UNKNOWN_STATUS field = data.get("sns_endpoint_url", None) if field is not None: args["sns_endpoint_url"] = field + else: + args["sns_endpoint_url"] = None field = data.get("created_at", None) if field is not None: @@ -446,18 +522,26 @@ def unmarshal_SqsInfo(data: Any) -> SqsInfo: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SqsInfoStatus.UNKNOWN_STATUS field = data.get("sqs_endpoint_url", None) if field is not None: args["sqs_endpoint_url"] = field + else: + args["sqs_endpoint_url"] = None field = data.get("created_at", None) if field is not None: @@ -484,7 +568,9 @@ def marshal_NatsApiCreateNatsAccountRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -523,7 +609,9 @@ def marshal_SnsApiActivateSnsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -553,7 +641,9 @@ def marshal_SnsApiCreateSnsCredentialsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -571,7 +661,9 @@ def marshal_SnsApiDeactivateSnsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -598,7 +690,9 @@ def marshal_SqsApiActivateSqsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -628,7 +722,9 @@ def marshal_SqsApiCreateSqsCredentialsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -646,7 +742,9 @@ def marshal_SqsApiDeactivateSqsRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output diff --git a/scaleway/scaleway/mnq/v1beta1/types.py b/scaleway/scaleway/mnq/v1beta1/types.py index 29a4a641d..631b7c479 100644 --- a/scaleway/scaleway/mnq/v1beta1/types.py +++ b/scaleway/scaleway/mnq/v1beta1/types.py @@ -96,17 +96,17 @@ class File: @dataclass class SnsPermissions: - can_publish: Optional[bool] + can_publish: Optional[bool] = False """ Defines whether the credentials bearer can publish messages to the service (publish to Topics and Events topics). """ - can_receive: Optional[bool] + can_receive: Optional[bool] = False """ Defines whether the credentials bearer can receive messages from the service (configure subscriptions). """ - can_manage: Optional[bool] + can_manage: Optional[bool] = False """ Defines whether the credentials bearer can manage the associated Topics and Events topics or subscriptions. """ @@ -114,17 +114,17 @@ class SnsPermissions: @dataclass class SqsPermissions: - can_publish: Optional[bool] + can_publish: Optional[bool] = False """ Defines whether the credentials bearer can publish messages to the service (send messages to Queues queues). """ - can_receive: Optional[bool] + can_receive: Optional[bool] = False """ Defines whether the credentials bearer can receive messages from Queues queues. """ - can_manage: Optional[bool] + can_manage: Optional[bool] = False """ Defines whether the credentials bearer can manage the associated Queues queues. """ @@ -157,12 +157,12 @@ class NatsAccount: Region where the NATS account is deployed. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ NATS account creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ NATS account last modification date. """ @@ -190,17 +190,17 @@ class NatsCredentials: Checksum of the credentials file. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ NATS credentials creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ NATS credentials last modification date. """ - credentials: Optional[File] + credentials: Optional[File] = None """ Object containing the credentials file (Only returned by **Create Nats Credentials** call). """ @@ -243,17 +243,17 @@ class SnsCredentials: Checksum of the Secret key. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Credentials creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Credentials last modification date. """ - permissions: Optional[SnsPermissions] + permissions: Optional[SnsPermissions] = None """ Permissions associated with these credentials. """ @@ -296,17 +296,17 @@ class SqsCredentials: Checksum of the Secret key. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Credentials creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Credentials last modification date. """ - permissions: Optional[SqsPermissions] + permissions: Optional[SqsPermissions] = None """ Permissions associated with these credentials. """ @@ -366,17 +366,17 @@ class ListSqsCredentialsResponse: @dataclass class NatsApiCreateNatsAccountRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ NATS account name. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project containing the NATS account. """ @@ -389,12 +389,12 @@ class NatsApiCreateNatsCredentialsRequest: NATS account containing the credentials. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the credentials. """ @@ -407,7 +407,7 @@ class NatsApiDeleteNatsAccountRequest: ID of the NATS account to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -420,7 +420,7 @@ class NatsApiDeleteNatsCredentialsRequest: ID of the credentials to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -433,7 +433,7 @@ class NatsApiGetNatsAccountRequest: ID of the NATS account to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -446,7 +446,7 @@ class NatsApiGetNatsCredentialsRequest: ID of the credentials to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -454,27 +454,29 @@ class NatsApiGetNatsCredentialsRequest: @dataclass class NatsApiListNatsAccountsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only NATS accounts in this Project. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of NATS accounts to return per page. """ - order_by: Optional[ListNatsAccountsRequestOrderBy] + order_by: Optional[ListNatsAccountsRequestOrderBy] = ( + ListNatsAccountsRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ @@ -482,32 +484,34 @@ class NatsApiListNatsAccountsRequest: @dataclass class NatsApiListNatsCredentialsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only NATS accounts in this Project. """ - nats_account_id: Optional[str] + nats_account_id: Optional[str] = None """ Include only credentials for this NATS account. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of credentials to return per page. """ - order_by: Optional[ListNatsCredentialsRequestOrderBy] + order_by: Optional[ListNatsCredentialsRequestOrderBy] = ( + ListNatsCredentialsRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ @@ -520,12 +524,12 @@ class NatsApiUpdateNatsAccountRequest: ID of the NATS account to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ NATS account name. """ @@ -533,12 +537,12 @@ class NatsApiUpdateNatsAccountRequest: @dataclass class SnsApiActivateSnsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project on which to activate the Topics and Events service. """ @@ -546,22 +550,22 @@ class SnsApiActivateSnsRequest: @dataclass class SnsApiCreateSnsCredentialsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project containing the Topics and Events credentials. """ - name: Optional[str] + name: Optional[str] = None """ Name of the credentials. """ - permissions: Optional[SnsPermissions] + permissions: Optional[SnsPermissions] = None """ Permissions associated with these credentials. """ @@ -569,12 +573,12 @@ class SnsApiCreateSnsCredentialsRequest: @dataclass class SnsApiDeactivateSnsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project on which to deactivate the Topics and Events service. """ @@ -587,7 +591,7 @@ class SnsApiDeleteSnsCredentialsRequest: ID of the credentials to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -600,7 +604,7 @@ class SnsApiGetSnsCredentialsRequest: ID of the Topics and Events credentials to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -608,12 +612,12 @@ class SnsApiGetSnsCredentialsRequest: @dataclass class SnsApiGetSnsInfoRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project to retrieve Topics and Events info from. """ @@ -621,27 +625,29 @@ class SnsApiGetSnsInfoRequest: @dataclass class SnsApiListSnsCredentialsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only Topics and Events credentials in this Project. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of credentials to return per page. """ - order_by: Optional[ListSnsCredentialsRequestOrderBy] + order_by: Optional[ListSnsCredentialsRequestOrderBy] = ( + ListSnsCredentialsRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ @@ -654,17 +660,17 @@ class SnsApiUpdateSnsCredentialsRequest: ID of the Topics and Events credentials to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the credentials. """ - permissions: Optional[SnsPermissions] + permissions: Optional[SnsPermissions] = None """ Permissions associated with these credentials. """ @@ -692,12 +698,12 @@ class SnsInfo: Endpoint of the Topics and Events service for this region and project. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Topics and Events creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Topics and Events last modification date. """ @@ -705,12 +711,12 @@ class SnsInfo: @dataclass class SqsApiActivateSqsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project on which to activate the Queues service. """ @@ -718,22 +724,22 @@ class SqsApiActivateSqsRequest: @dataclass class SqsApiCreateSqsCredentialsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project containing the Queues credentials. """ - name: Optional[str] + name: Optional[str] = None """ Name of the credentials. """ - permissions: Optional[SqsPermissions] + permissions: Optional[SqsPermissions] = None """ Permissions associated with these credentials. """ @@ -741,12 +747,12 @@ class SqsApiCreateSqsCredentialsRequest: @dataclass class SqsApiDeactivateSqsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project on which to deactivate the Queues service. """ @@ -759,7 +765,7 @@ class SqsApiDeleteSqsCredentialsRequest: ID of the credentials to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -772,7 +778,7 @@ class SqsApiGetSqsCredentialsRequest: ID of the Queues credentials to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -780,12 +786,12 @@ class SqsApiGetSqsCredentialsRequest: @dataclass class SqsApiGetSqsInfoRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project to retrieve Queues info from. """ @@ -793,27 +799,29 @@ class SqsApiGetSqsInfoRequest: @dataclass class SqsApiListSqsCredentialsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only Queues credentials in this Project. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of credentials to return per page. """ - order_by: Optional[ListSqsCredentialsRequestOrderBy] + order_by: Optional[ListSqsCredentialsRequestOrderBy] = ( + ListSqsCredentialsRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ @@ -826,17 +834,17 @@ class SqsApiUpdateSqsCredentialsRequest: ID of the Queues credentials to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the credentials. """ - permissions: Optional[SqsPermissions] + permissions: Optional[SqsPermissions] = None """ Permissions associated with these credentials. """ @@ -864,12 +872,12 @@ class SqsInfo: Endpoint of the Queues service for this region and project. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Queues creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Queues last modification date. """ diff --git a/scaleway/scaleway/mongodb/v1/marshalling.py b/scaleway/scaleway/mongodb/v1/marshalling.py index 9d4184b4f..fdb272d2c 100644 --- a/scaleway/scaleway/mongodb/v1/marshalling.py +++ b/scaleway/scaleway/mongodb/v1/marshalling.py @@ -10,6 +10,11 @@ resolve_one_of, ) from .types import ( + InstanceStatus, + NodeTypeStock, + SnapshotStatus, + UserRoleRole, + VolumeType, EndpointPrivateNetworkDetails, EndpointPublicNetworkDetails, Endpoint, @@ -56,6 +61,8 @@ def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetwork field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None return EndpointPrivateNetworkDetails(**args) @@ -82,14 +89,20 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("dns_record", None) if field is not None: args["dns_record"] = field + else: + args["dns_record"] = None field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("private_network", None) if field is not None: @@ -117,14 +130,20 @@ def unmarshal_InstanceSnapshotSchedule(data: Any) -> InstanceSnapshotSchedule: field = data.get("frequency_hours", None) if field is not None: args["frequency_hours"] = field + else: + args["frequency_hours"] = None field = data.get("retention_days", None) if field is not None: args["retention_days"] = field + else: + args["retention_days"] = None field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = None field = data.get("next_update", None) if field is not None: @@ -154,10 +173,14 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = VolumeType.UNKNOWN_TYPE field = data.get("size_bytes", None) if field is not None: args["size_bytes"] = field + else: + args["size_bytes"] = 0 return Volume(**args) @@ -173,48 +196,70 @@ def unmarshal_Instance(data: Any) -> Instance: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceStatus.UNKNOWN_STATUS field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("node_amount", None) if field is not None: args["node_amount"] = field + else: + args["node_amount"] = 0 field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("volume", None) if field is not None: @@ -248,34 +293,50 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["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"] = SnapshotStatus.UNKNOWN_STATUS field = data.get("size_bytes", None) if field is not None: args["size_bytes"] = field + else: + args["size_bytes"] = 0 field = data.get("instance_name", None) if field is not None: args["instance_name"] = field + else: + args["instance_name"] = None field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("volume_type", None) if field is not None: args["volume_type"] = field + else: + args["volume_type"] = VolumeType.UNKNOWN_TYPE field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("instance_id", None) if field is not None: @@ -315,6 +376,8 @@ def unmarshal_UserRole(data: Any) -> UserRole: field = data.get("role", None) if field is not None: args["role"] = field + else: + args["role"] = UserRoleRole.UNKNOWN_ROLE field = data.get("database_name", None) if field is not None: @@ -326,7 +389,7 @@ def unmarshal_UserRole(data: Any) -> UserRole: if field is not None: args["any_database"] = field else: - args["any_database"] = None + args["any_database"] = False return UserRole(**args) @@ -342,12 +405,16 @@ def unmarshal_User(data: Any) -> User: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("roles", None) if field is not None: args["roles"] = ( [unmarshal_UserRole(v) for v in field] if field is not None else None ) + else: + args["roles"] = field(default_factory=list) return User(**args) @@ -363,6 +430,8 @@ def unmarshal_Database(data: Any) -> Database: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return Database(**args) @@ -380,10 +449,14 @@ def unmarshal_ListDatabasesResponse(data: Any) -> ListDatabasesResponse: args["databases"] = ( [unmarshal_Database(v) for v in field] if field is not None else None ) + else: + args["databases"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabasesResponse(**args) @@ -401,10 +474,14 @@ def unmarshal_ListInstancesResponse(data: Any) -> ListInstancesResponse: args["instances"] = ( [unmarshal_Instance(v) for v in field] if field is not None else None ) + else: + args["instances"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstancesResponse(**args) @@ -420,22 +497,32 @@ def unmarshal_NodeTypeVolumeType(data: Any) -> NodeTypeVolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = VolumeType.UNKNOWN_TYPE field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("min_size_bytes", None) if field is not None: args["min_size_bytes"] = field + else: + args["min_size_bytes"] = 0 field = data.get("max_size_bytes", None) if field is not None: args["max_size_bytes"] = field + else: + args["max_size_bytes"] = 0 field = data.get("chunk_size_bytes", None) if field is not None: args["chunk_size_bytes"] = field + else: + args["chunk_size_bytes"] = 0 return NodeTypeVolumeType(**args) @@ -451,22 +538,32 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN_STOCK field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory_bytes", None) if field is not None: args["memory_bytes"] = field + else: + args["memory_bytes"] = 0 field = data.get("available_volume_types", None) if field is not None: @@ -475,18 +572,26 @@ def unmarshal_NodeType(data: Any) -> NodeType: if field is not None else None ) + else: + args["available_volume_types"] = field(default_factory=list) field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("instance_range", None) if field is not None: args["instance_range"] = field + else: + args["instance_range"] = None return NodeType(**args) @@ -504,10 +609,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -525,10 +634,14 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSnapshotsResponse(**args) @@ -546,10 +659,14 @@ def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse: args["users"] = ( [unmarshal_User(v) for v in field] if field is not None else None ) + else: + args["users"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListUsersResponse(**args) @@ -565,6 +682,8 @@ def unmarshal_Version(data: Any) -> Version: field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("end_of_life_at", None) if field is not None: @@ -590,10 +709,14 @@ def unmarshal_ListVersionsResponse(data: Any) -> ListVersionsResponse: args["versions"] = ( [unmarshal_Version(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVersionsResponse(**args) @@ -666,7 +789,7 @@ def marshal_Volume( output: Dict[str, Any] = {} if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.size_bytes is not None: output["size_bytes"] = request.size_bytes @@ -696,7 +819,9 @@ def marshal_CreateInstanceRequest( output["password"] = request.password if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -764,7 +889,7 @@ def marshal_RestoreSnapshotRequest( output["node_amount"] = request.node_amount if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -790,7 +915,7 @@ def marshal_UserRole( ) if request.role is not None: - output["role"] = str(request.role) + output["role"] = request.role return output diff --git a/scaleway/scaleway/mongodb/v1/types.py b/scaleway/scaleway/mongodb/v1/types.py index fa3193f51..76c2401d1 100644 --- a/scaleway/scaleway/mongodb/v1/types.py +++ b/scaleway/scaleway/mongodb/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -164,22 +164,18 @@ class Endpoint: TCP port of the endpoint. """ - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None - public_network: Optional[EndpointPublicNetworkDetails] + public_network: Optional[EndpointPublicNetworkDetails] = None @dataclass class InstanceSnapshotSchedule: frequency_hours: int - retention_days: int - enabled: bool - - next_update: Optional[datetime] - - last_run: Optional[datetime] + next_update: Optional[datetime] = None + last_run: Optional[datetime] = None @dataclass @@ -230,16 +226,16 @@ class UserRole: Name of the preset role. """ - database_name: Optional[str] + database_name: Optional[str] = None - any_database: Optional[bool] + any_database: Optional[bool] = False @dataclass class EndpointSpec: - public_network: Optional[EndpointSpecPublicNetworkDetails] + public_network: Optional[EndpointSpecPublicNetworkDetails] = None - private_network: Optional[EndpointSpecPrivateNetworkDetails] + private_network: Optional[EndpointSpecPrivateNetworkDetails] = None @dataclass @@ -304,17 +300,17 @@ class Instance: Region the Database Instance is in. """ - volume: Optional[Volume] + volume: Optional[Volume] = None """ Volumes of the Database Instance. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ - snapshot_schedule: Optional[InstanceSnapshotSchedule] + snapshot_schedule: Optional[InstanceSnapshotSchedule] = None """ Snapshot schedule configuration of the Database Instance. """ @@ -410,22 +406,22 @@ class Snapshot: Region of the snapshot. """ - instance_id: Optional[str] + instance_id: Optional[str] = None """ UUID of the Database Instance. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Updated date (must follow the ISO 8601 format). """ @@ -451,7 +447,7 @@ class Version: MongoDB® major engine version. """ - end_of_life_at: Optional[datetime] + end_of_life_at: Optional[datetime] = None """ Date of End of Life. """ @@ -469,7 +465,7 @@ class CreateEndpointRequest: EndpointSpec used to expose your Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -502,32 +498,32 @@ class CreateInstanceRequest: Password of the initial user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ The Project ID on which the Database Instance will be created. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to apply to the Database Instance. """ - volume: Optional[Volume] + volume: Optional[Volume] = None """ Instance volume information. """ - endpoints: Optional[List[EndpointSpec]] + endpoints: Optional[List[EndpointSpec]] = field(default_factory=list) """ One or multiple EndpointSpec used to expose your Database Instance. """ @@ -545,12 +541,12 @@ class CreateSnapshotRequest: Name of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the snapshot (must follow the ISO 8601 format). """ @@ -573,7 +569,7 @@ class CreateUserRequest: Password of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -586,7 +582,7 @@ class DeleteEndpointRequest: UUID of the Endpoint to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -599,7 +595,7 @@ class DeleteInstanceRequest: UUID of the Database Instance to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -612,7 +608,7 @@ class DeleteSnapshotRequest: UUID of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -630,7 +626,7 @@ class DeleteUserRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -643,7 +639,7 @@ class GetInstanceCertificateRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -656,7 +652,7 @@ class GetInstanceRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -669,7 +665,7 @@ class GetSnapshotRequest: UUID of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -682,19 +678,20 @@ class ListDatabasesRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListDatabasesRequestOrderBy] + order_by: Optional[ListDatabasesRequestOrderBy] = ( + ListDatabasesRequestOrderBy.NAME_ASC + ) """ Criteria to use when requesting user listing. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -712,39 +709,40 @@ class ListDatabasesResponse: @dataclass class ListInstancesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List Database Instances that have a given tag. """ - name: Optional[str] + name: Optional[str] = None """ Lists Database Instances that match a name pattern. """ - order_by: Optional[ListInstancesRequestOrderBy] + order_by: Optional[ListInstancesRequestOrderBy] = ( + ListInstancesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering Database Instance listings. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID of the Database Instance. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to list the instances of. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -762,19 +760,18 @@ class ListInstancesResponse: @dataclass class ListNodeTypesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - include_disabled: Optional[bool] + include_disabled: Optional[bool] = False """ Defines whether or not to include disabled types. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -792,39 +789,40 @@ class ListNodeTypesResponse: @dataclass class ListSnapshotsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - instance_id: Optional[str] + instance_id: Optional[str] = None """ Instance ID the snapshots belongs to. """ - name: Optional[str] + name: Optional[str] = None """ Lists database snapshots that match a name pattern. """ - order_by: Optional[ListSnapshotsRequestOrderBy] + order_by: Optional[ListSnapshotsRequestOrderBy] = ( + ListSnapshotsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering snapshot listings. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID the snapshots belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to list the snapshots of. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -847,24 +845,23 @@ class ListUsersRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the user. """ - order_by: Optional[ListUsersRequestOrderBy] + order_by: Optional[ListUsersRequestOrderBy] = ListUsersRequestOrderBy.NAME_ASC """ Criteria to use when requesting user listing. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -882,16 +879,14 @@ class ListUsersResponse: @dataclass class ListVersionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - version: Optional[str] - - page: Optional[int] - - page_size: Optional[int] + version: Optional[str] = None + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -934,7 +929,7 @@ class RestoreSnapshotRequest: Instance volume type. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -952,12 +947,12 @@ class SetUserRoleRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - roles: Optional[List[UserRole]] + roles: Optional[List[UserRole]] = field(default_factory=list) """ List of roles assigned to the user, along with the corresponding database where each role is granted. """ @@ -970,32 +965,32 @@ class UpdateInstanceRequest: UUID of the Database Instance to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of a Database Instance. """ - snapshot_schedule_frequency_hours: Optional[int] + snapshot_schedule_frequency_hours: Optional[int] = 0 """ In hours. """ - snapshot_schedule_retention_days: Optional[int] + snapshot_schedule_retention_days: Optional[int] = 0 """ In days. """ - is_snapshot_schedule_enabled: Optional[bool] + is_snapshot_schedule_enabled: Optional[bool] = False """ Defines whether or not the snapshot schedule is enabled. """ @@ -1008,17 +1003,17 @@ class UpdateSnapshotRequest: UUID of the Snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the snapshot (must follow the ISO 8601 format). """ @@ -1036,12 +1031,12 @@ class UpdateUserRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - password: Optional[str] + password: Optional[str] = None """ Password of the database user. """ @@ -1054,9 +1049,9 @@ class UpgradeInstanceRequest: UUID of the Database Instance you want to upgrade. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - volume_size_bytes: Optional[int] + volume_size_bytes: Optional[int] = 0 diff --git a/scaleway/scaleway/mongodb/v1alpha1/marshalling.py b/scaleway/scaleway/mongodb/v1alpha1/marshalling.py index e058309e7..96f7bde92 100644 --- a/scaleway/scaleway/mongodb/v1alpha1/marshalling.py +++ b/scaleway/scaleway/mongodb/v1alpha1/marshalling.py @@ -10,6 +10,12 @@ resolve_one_of, ) from .types import ( + InstanceStatus, + NodeTypeStock, + SettingPropertyType, + SnapshotStatus, + UserRoleRole, + VolumeType, EndpointPrivateNetworkDetails, EndpointPublicDetails, Endpoint, @@ -59,6 +65,8 @@ def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetwork field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None return EndpointPrivateNetworkDetails(**args) @@ -85,18 +93,26 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("ips", None) if field is not None: args["ips"] = field + else: + args["ips"] = field(default_factory=list) field = data.get("dns_records", None) if field is not None: args["dns_records"] = field + else: + args["dns_records"] = field(default_factory=list) field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("private_network", None) if field is not None: @@ -124,10 +140,14 @@ def unmarshal_InstanceSetting(data: Any) -> InstanceSetting: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None return InstanceSetting(**args) @@ -143,14 +163,20 @@ def unmarshal_InstanceSnapshotSchedule(data: Any) -> InstanceSnapshotSchedule: field = data.get("frequency_hours", None) if field is not None: args["frequency_hours"] = field + else: + args["frequency_hours"] = None field = data.get("retention_days", None) if field is not None: args["retention_days"] = field + else: + args["retention_days"] = None field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = None field = data.get("next_update", None) if field is not None: @@ -180,10 +206,14 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = VolumeType.UNKNOWN_TYPE field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 return Volume(**args) @@ -199,50 +229,72 @@ def unmarshal_Instance(data: Any) -> Instance: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceStatus.UNKNOWN_STATUS field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("settings", None) if field is not None: args["settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) field = data.get("node_number", None) if field is not None: args["node_number"] = field + else: + args["node_number"] = 0 field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("volume", None) if field is not None: @@ -276,6 +328,8 @@ def unmarshal_SnapshotVolumeType(data: Any) -> SnapshotVolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return SnapshotVolumeType(**args) @@ -291,34 +345,50 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("instance_id", None) if field is not None: args["instance_id"] = field + else: + args["instance_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"] = SnapshotStatus.UNKNOWN_STATUS field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("instance_name", None) if field is not None: args["instance_name"] = field + else: + args["instance_name"] = None field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("expires_at", None) if field is not None: @@ -358,6 +428,8 @@ def unmarshal_UserRole(data: Any) -> UserRole: field = data.get("role", None) if field is not None: args["role"] = field + else: + args["role"] = UserRoleRole.UNKNOWN_ROLE field = data.get("database", None) if field is not None: @@ -369,7 +441,7 @@ def unmarshal_UserRole(data: Any) -> UserRole: if field is not None: args["any_database"] = field else: - args["any_database"] = None + args["any_database"] = False return UserRole(**args) @@ -385,12 +457,16 @@ def unmarshal_User(data: Any) -> User: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("roles", None) if field is not None: args["roles"] = ( [unmarshal_UserRole(v) for v in field] if field is not None else None ) + else: + args["roles"] = field(default_factory=list) return User(**args) @@ -408,10 +484,14 @@ def unmarshal_ListInstancesResponse(data: Any) -> ListInstancesResponse: args["instances"] = ( [unmarshal_Instance(v) for v in field] if field is not None else None ) + else: + args["instances"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstancesResponse(**args) @@ -427,22 +507,32 @@ def unmarshal_NodeTypeVolumeType(data: Any) -> NodeTypeVolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = VolumeType.UNKNOWN_TYPE field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = 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("chunk_size", None) if field is not None: args["chunk_size"] = field + else: + args["chunk_size"] = 0 return NodeTypeVolumeType(**args) @@ -458,22 +548,32 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN_STOCK field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("available_volume_types", None) if field is not None: @@ -482,18 +582,26 @@ def unmarshal_NodeType(data: Any) -> NodeType: if field is not None else None ) + else: + args["available_volume_types"] = field(default_factory=list) field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("instance_range", None) if field is not None: args["instance_range"] = field + else: + args["instance_range"] = None return NodeType(**args) @@ -511,10 +619,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -532,10 +644,14 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSnapshotsResponse(**args) @@ -553,10 +669,14 @@ def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse: args["users"] = ( [unmarshal_User(v) for v in field] if field is not None else None ) + else: + args["users"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListUsersResponse(**args) @@ -572,22 +692,32 @@ def unmarshal_Setting(data: Any) -> Setting: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("default_value", None) if field is not None: args["default_value"] = field + else: + args["default_value"] = None field = data.get("hot_configurable", None) if field is not None: args["hot_configurable"] = field + else: + args["hot_configurable"] = False field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("property_type", None) if field is not None: args["property_type"] = field + else: + args["property_type"] = SettingPropertyType.BOOLEAN field = data.get("unit", None) if field is not None: @@ -605,25 +735,25 @@ def unmarshal_Setting(data: Any) -> Setting: if field is not None: args["int_min"] = field else: - args["int_min"] = None + args["int_min"] = 0 field = data.get("int_max", None) if field is not None: args["int_max"] = field else: - args["int_max"] = None + args["int_max"] = 0 field = data.get("float_min", None) if field is not None: args["float_min"] = field else: - args["float_min"] = None + args["float_min"] = 0.0 field = data.get("float_max", None) if field is not None: args["float_max"] = field else: - args["float_max"] = None + args["float_max"] = 0.0 return Setting(**args) @@ -639,12 +769,16 @@ def unmarshal_Version(data: Any) -> Version: field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("available_settings", None) if field is not None: args["available_settings"] = ( [unmarshal_Setting(v) for v in field] if field is not None else None ) + else: + args["available_settings"] = field(default_factory=list) field = data.get("end_of_life_at", None) if field is not None: @@ -670,10 +804,14 @@ def unmarshal_ListVersionsResponse(data: Any) -> ListVersionsResponse: args["versions"] = ( [unmarshal_Version(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListVersionsResponse(**args) @@ -749,7 +887,7 @@ def marshal_CreateInstanceRequestVolumeDetails( output["volume_size"] = request.volume_size if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -776,7 +914,9 @@ def marshal_CreateInstanceRequest( output["password"] = request.password if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -834,7 +974,7 @@ def marshal_RestoreSnapshotRequestVolumeDetails( output: Dict[str, Any] = {} if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type return output @@ -881,7 +1021,7 @@ def marshal_UserRole( ) if request.role is not None: - output["role"] = str(request.role) + output["role"] = request.role return output diff --git a/scaleway/scaleway/mongodb/v1alpha1/types.py b/scaleway/scaleway/mongodb/v1alpha1/types.py index 537e0c080..f29db9a0e 100644 --- a/scaleway/scaleway/mongodb/v1alpha1/types.py +++ b/scaleway/scaleway/mongodb/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -167,9 +167,9 @@ class Endpoint: TCP port of the endpoint. """ - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None - public: Optional[EndpointPublicDetails] + public: Optional[EndpointPublicDetails] = None @dataclass @@ -188,14 +188,10 @@ class InstanceSetting: @dataclass class InstanceSnapshotSchedule: frequency_hours: int - retention_days: int - enabled: bool - - next_update: Optional[datetime] - - last_run: Optional[datetime] + next_update: Optional[datetime] = None + last_run: Optional[datetime] = None @dataclass @@ -251,9 +247,9 @@ class UserRole: Name of the preset role. """ - database: Optional[str] + database: Optional[str] = None - any_database: Optional[bool] + any_database: Optional[bool] = False @dataclass @@ -283,32 +279,32 @@ class Setting: Setting type. """ - unit: Optional[str] + unit: Optional[str] = None """ Setting base unit. """ - string_constraint: Optional[str] + string_constraint: Optional[str] = None """ Validation regex for string type settings. """ - int_min: Optional[int] + int_min: Optional[int] = 0 """ Minimum value for int types. """ - int_max: Optional[int] + int_max: Optional[int] = 0 """ Maximum value for int types. """ - float_min: Optional[float] + float_min: Optional[float] = 0.0 """ Minimum value for float types. """ - float_max: Optional[float] + float_max: Optional[float] = 0.0 """ Maximum value for float types. """ @@ -316,9 +312,9 @@ class Setting: @dataclass class EndpointSpec: - public: Optional[EndpointSpecPublicDetails] + public: Optional[EndpointSpecPublicDetails] = None - private_network: Optional[EndpointSpecPrivateNetworkDetails] + private_network: Optional[EndpointSpecPrivateNetworkDetails] = None @dataclass @@ -391,17 +387,17 @@ class Instance: Region the Database Instance is in. """ - volume: Optional[Volume] + volume: Optional[Volume] = None """ Volumes of the Database Instance. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ - snapshot_schedule: Optional[InstanceSnapshotSchedule] + snapshot_schedule: Optional[InstanceSnapshotSchedule] = None """ Snapshot schedule configuration of the Database Instance. """ @@ -497,22 +493,22 @@ class Snapshot: Region of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Updated date (must follow the ISO 8601 format). """ - volume_type: Optional[SnapshotVolumeType] + volume_type: Optional[SnapshotVolumeType] = None """ Type of volume where data is stored - sbs_5k or sbs_15k. """ @@ -543,7 +539,7 @@ class Version: Instance settings available to be updated. """ - end_of_life_at: Optional[datetime] + end_of_life_at: Optional[datetime] = None """ Date of End of Life. """ @@ -569,7 +565,7 @@ class CreateEndpointRequest: EndpointSpec used to expose your Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -602,32 +598,32 @@ class CreateInstanceRequest: Password of the initial user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ The Project ID on which the Database Instance will be created. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to apply to the Database Instance. """ - volume: Optional[CreateInstanceRequestVolumeDetails] + volume: Optional[CreateInstanceRequestVolumeDetails] = None """ Instance volume information. """ - endpoints: Optional[List[EndpointSpec]] + endpoints: Optional[List[EndpointSpec]] = field(default_factory=list) """ One or multiple EndpointSpec used to expose your Database Instance. """ @@ -645,12 +641,12 @@ class CreateSnapshotRequest: Name of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the snapshot (must follow the ISO 8601 format). """ @@ -673,7 +669,7 @@ class CreateUserRequest: Password of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -686,7 +682,7 @@ class DeleteEndpointRequest: UUID of the Endpoint to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -699,7 +695,7 @@ class DeleteInstanceRequest: UUID of the Database Instance to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -712,7 +708,7 @@ class DeleteSnapshotRequest: UUID of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -730,7 +726,7 @@ class DeleteUserRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -743,7 +739,7 @@ class GetInstanceCertificateRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -756,7 +752,7 @@ class GetInstanceRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -769,7 +765,7 @@ class GetSnapshotRequest: UUID of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -777,39 +773,40 @@ class GetSnapshotRequest: @dataclass class ListInstancesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List Database Instances that have a given tag. """ - name: Optional[str] + name: Optional[str] = None """ Lists Database Instances that match a name pattern. """ - order_by: Optional[ListInstancesRequestOrderBy] + order_by: Optional[ListInstancesRequestOrderBy] = ( + ListInstancesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering Database Instance listings. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID of the Database Instance. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -827,19 +824,18 @@ class ListInstancesResponse: @dataclass class ListNodeTypesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - include_disabled_types: Optional[bool] + include_disabled_types: Optional[bool] = False """ Defines whether or not to include disabled types. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -857,39 +853,40 @@ class ListNodeTypesResponse: @dataclass class ListSnapshotsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - instance_id: Optional[str] + instance_id: Optional[str] = None """ Instance ID the snapshots belongs to. """ - name: Optional[str] + name: Optional[str] = None """ Lists database snapshots that match a name pattern. """ - order_by: Optional[ListSnapshotsRequestOrderBy] + order_by: Optional[ListSnapshotsRequestOrderBy] = ( + ListSnapshotsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering snapshot listings. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID the snapshots belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to list the snapshots of. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -912,24 +909,23 @@ class ListUsersRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the user. """ - order_by: Optional[ListUsersRequestOrderBy] + order_by: Optional[ListUsersRequestOrderBy] = ListUsersRequestOrderBy.NAME_ASC """ Criteria to use when requesting user listing. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -947,16 +943,14 @@ class ListUsersResponse: @dataclass class ListVersionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - version: Optional[str] - - page: Optional[int] - - page_size: Optional[int] + version: Optional[str] = None + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -999,7 +993,7 @@ class RestoreSnapshotRequest: Instance volume information. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1017,12 +1011,12 @@ class SetUserRoleRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - roles: Optional[List[UserRole]] + roles: Optional[List[UserRole]] = field(default_factory=list) """ List of roles assigned to the user, along with the corresponding database where each role is granted. """ @@ -1035,17 +1029,17 @@ class UpdateInstanceRequest: UUID of the Database Instance to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of a Database Instance. """ @@ -1058,17 +1052,17 @@ class UpdateSnapshotRequest: UUID of the Snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date of the snapshot (must follow the ISO 8601 format). """ @@ -1086,12 +1080,12 @@ class UpdateUserRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - password: Optional[str] + password: Optional[str] = None """ Password of the database user. """ @@ -1104,9 +1098,9 @@ class UpgradeInstanceRequest: UUID of the Database Instance you want to upgrade. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - volume_size: Optional[int] + volume_size: Optional[int] = 0 diff --git a/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py b/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py index 07b14b443..a1f63b49a 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py @@ -8,6 +8,8 @@ unmarshal_Money, ) from .types import ( + PublicCatalogProductPropertiesHardwareCPUArch, + PublicCatalogProductStatus, PublicCatalogProductPropertiesHardwareCPUPhysical, PublicCatalogProductPropertiesHardwareCPUVirtual, PublicCatalogProductPropertiesHardwareCPU, @@ -44,22 +46,32 @@ def unmarshal_PublicCatalogProductPropertiesHardwareCPUPhysical( field = data.get("sockets", None) if field is not None: args["sockets"] = field + else: + args["sockets"] = 0 field = data.get("cores_per_socket", None) if field is not None: args["cores_per_socket"] = field + else: + args["cores_per_socket"] = 0 field = data.get("threads_per_core", None) if field is not None: args["threads_per_core"] = field + else: + args["threads_per_core"] = 0 field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("benchmark", None) if field is not None: args["benchmark"] = field + else: + args["benchmark"] = 0 return PublicCatalogProductPropertiesHardwareCPUPhysical(**args) @@ -77,6 +89,8 @@ def unmarshal_PublicCatalogProductPropertiesHardwareCPUVirtual( field = data.get("count", None) if field is not None: args["count"] = field + else: + args["count"] = 0 return PublicCatalogProductPropertiesHardwareCPUVirtual(**args) @@ -94,18 +108,26 @@ def unmarshal_PublicCatalogProductPropertiesHardwareCPU( field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("arch", None) if field is not None: args["arch"] = field + else: + args["arch"] = PublicCatalogProductPropertiesHardwareCPUArch.UNKNOWN_ARCH field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("threads", None) if field is not None: args["threads"] = field + else: + args["threads"] = 0 field = data.get("virtual", None) if field is not None: @@ -139,14 +161,20 @@ def unmarshal_PublicCatalogProductPropertiesHardwareGPU( field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("count", None) if field is not None: args["count"] = field + else: + args["count"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return PublicCatalogProductPropertiesHardwareGPU(**args) @@ -164,18 +192,26 @@ def unmarshal_PublicCatalogProductPropertiesHardwareNetwork( field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("internal_bandwidth", None) if field is not None: args["internal_bandwidth"] = field + else: + args["internal_bandwidth"] = 0 field = data.get("public_bandwidth", None) if field is not None: args["public_bandwidth"] = field + else: + args["public_bandwidth"] = 0 field = data.get("max_public_bandwidth", None) if field is not None: args["max_public_bandwidth"] = field + else: + args["max_public_bandwidth"] = 0 return PublicCatalogProductPropertiesHardwareNetwork(**args) @@ -193,14 +229,20 @@ def unmarshal_PublicCatalogProductPropertiesHardwareRAM( field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None return PublicCatalogProductPropertiesHardwareRAM(**args) @@ -218,10 +260,14 @@ def unmarshal_PublicCatalogProductPropertiesHardwareStorage( field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("total", None) if field is not None: args["total"] = field + else: + args["total"] = 0 return PublicCatalogProductPropertiesHardwareStorage(**args) @@ -239,6 +285,8 @@ def unmarshal_PublicCatalogProductPropertiesAppleSilicon( field = data.get("range", None) if field is not None: args["range"] = field + else: + args["range"] = None return PublicCatalogProductPropertiesAppleSilicon(**args) @@ -256,10 +304,14 @@ def unmarshal_PublicCatalogProductPropertiesBlockStorage( field = data.get("min_volume_size", None) if field is not None: args["min_volume_size"] = field + else: + args["min_volume_size"] = 0 field = data.get("max_volume_size", None) if field is not None: args["max_volume_size"] = field + else: + args["max_volume_size"] = 0 return PublicCatalogProductPropertiesBlockStorage(**args) @@ -277,6 +329,8 @@ def unmarshal_PublicCatalogProductPropertiesDedibox( field = data.get("range", None) if field is not None: args["range"] = field + else: + args["range"] = None return PublicCatalogProductPropertiesDedibox(**args) @@ -294,6 +348,8 @@ def unmarshal_PublicCatalogProductPropertiesElasticMetal( field = data.get("range", None) if field is not None: args["range"] = field + else: + args["range"] = None return PublicCatalogProductPropertiesElasticMetal(**args) @@ -354,14 +410,20 @@ def unmarshal_PublicCatalogProductPropertiesInstance( field = data.get("range", None) if field is not None: args["range"] = field + else: + args["range"] = None field = data.get("offer_id", None) if field is not None: args["offer_id"] = field + else: + args["offer_id"] = None field = data.get("recommended_replacement_offer_ids", None) if field is not None: args["recommended_replacement_offer_ids"] = field + else: + args["recommended_replacement_offer_ids"] = field(default_factory=list) return PublicCatalogProductPropertiesInstance(**args) @@ -403,7 +465,7 @@ def unmarshal_PublicCatalogProductLocality(data: Any) -> PublicCatalogProductLoc if field is not None: args["global_"] = field else: - args["global_"] = None + args["global_"] = False field = data.get("region", None) if field is not None: @@ -511,10 +573,14 @@ def unmarshal_PublicCatalogProductUnitOfMeasure( field = data.get("unit", None) if field is not None: args["unit"] = field + else: + args["unit"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None return PublicCatalogProductUnitOfMeasure(**args) @@ -530,26 +596,38 @@ def unmarshal_PublicCatalogProduct(data: Any) -> PublicCatalogProduct: field = data.get("sku", None) if field is not None: args["sku"] = field + else: + args["sku"] = None field = data.get("service_category", None) if field is not None: args["service_category"] = field + else: + args["service_category"] = None field = data.get("product", None) if field is not None: args["product"] = field + else: + args["product"] = None field = data.get("variant", None) if field is not None: args["variant"] = field + else: + args["variant"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = PublicCatalogProductStatus.UNKNOWN_STATUS field = data.get("locality", None) if field is not None: @@ -611,9 +689,13 @@ def unmarshal_ListPublicCatalogProductsResponse( if field is not None else None ) + else: + args["products"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPublicCatalogProductsResponse(**args) diff --git a/scaleway/scaleway/product_catalog/v2alpha1/types.py b/scaleway/scaleway/product_catalog/v2alpha1/types.py index b44dfd6a0..e2af2ff90 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/types.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -143,9 +143,9 @@ class PublicCatalogProductPropertiesHardwareCPU: The total number of threads. """ - virtual: Optional[PublicCatalogProductPropertiesHardwareCPUVirtual] + virtual: Optional[PublicCatalogProductPropertiesHardwareCPUVirtual] = None - physical: Optional[PublicCatalogProductPropertiesHardwareCPUPhysical] + physical: Optional[PublicCatalogProductPropertiesHardwareCPUPhysical] = None @dataclass @@ -259,27 +259,27 @@ class PublicCatalogProductPropertiesElasticMetal: @dataclass class PublicCatalogProductPropertiesHardware: - cpu: Optional[PublicCatalogProductPropertiesHardwareCPU] + cpu: Optional[PublicCatalogProductPropertiesHardwareCPU] = None """ The CPU hardware properties. """ - ram: Optional[PublicCatalogProductPropertiesHardwareRAM] + ram: Optional[PublicCatalogProductPropertiesHardwareRAM] = None """ The RAM hardware properties. """ - storage: Optional[PublicCatalogProductPropertiesHardwareStorage] + storage: Optional[PublicCatalogProductPropertiesHardwareStorage] = None """ The storage hardware properties. """ - network: Optional[PublicCatalogProductPropertiesHardwareNetwork] + network: Optional[PublicCatalogProductPropertiesHardwareNetwork] = None """ The network hardware properties. """ - gpu: Optional[PublicCatalogProductPropertiesHardwareGPU] + gpu: Optional[PublicCatalogProductPropertiesHardwareGPU] = None """ The GPU hardware properties. """ @@ -305,25 +305,24 @@ class PublicCatalogProductPropertiesInstance: @dataclass class PublicCatalogProductEnvironmentalImpactEstimation: - kg_co2_equivalent: Optional[float] - - m3_water_usage: Optional[float] + kg_co2_equivalent: Optional[float] = None + m3_water_usage: Optional[float] = None @dataclass class PublicCatalogProductLocality: - global_: Optional[bool] + global_: Optional[bool] = False - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None - datacenter: Optional[str] + datacenter: Optional[str] = None @dataclass class PublicCatalogProductPrice: - retail_price: Optional[Money] + retail_price: Optional[Money] = None """ The retail price of the product. """ @@ -331,26 +330,25 @@ class PublicCatalogProductPrice: @dataclass class PublicCatalogProductProperties: - hardware: Optional[PublicCatalogProductPropertiesHardware] + hardware: Optional[PublicCatalogProductPropertiesHardware] = None """ The hardware properties of the product (if supported). """ - dedibox: Optional[PublicCatalogProductPropertiesDedibox] + dedibox: Optional[PublicCatalogProductPropertiesDedibox] = None - elastic_metal: Optional[PublicCatalogProductPropertiesElasticMetal] + elastic_metal: Optional[PublicCatalogProductPropertiesElasticMetal] = None - apple_silicon: Optional[PublicCatalogProductPropertiesAppleSilicon] + apple_silicon: Optional[PublicCatalogProductPropertiesAppleSilicon] = None - instance: Optional[PublicCatalogProductPropertiesInstance] + instance: Optional[PublicCatalogProductPropertiesInstance] = None - block_storage: Optional[PublicCatalogProductPropertiesBlockStorage] + block_storage: Optional[PublicCatalogProductPropertiesBlockStorage] = None @dataclass class PublicCatalogProductUnitOfMeasure: unit: PublicCatalogProductUnitOfMeasureCountableUnit - size: int @@ -386,34 +384,34 @@ class PublicCatalogProduct: The status of the product. """ - locality: Optional[PublicCatalogProductLocality] + locality: Optional[PublicCatalogProductLocality] = None """ The locality of the product. """ - price: Optional[PublicCatalogProductPrice] + price: Optional[PublicCatalogProductPrice] = None """ The price of the product. """ - properties: Optional[PublicCatalogProductProperties] + properties: Optional[PublicCatalogProductProperties] = None """ The properties of the product. """ environmental_impact_estimation: Optional[ PublicCatalogProductEnvironmentalImpactEstimation - ] + ] = None """ The environmental impact estimation of the product. """ - unit_of_measure: Optional[PublicCatalogProductUnitOfMeasure] + unit_of_measure: Optional[PublicCatalogProductUnitOfMeasure] = None """ The unit of measure of the product. """ - end_of_life_at: Optional[datetime] + end_of_life_at: Optional[datetime] = None """ The end of life date of the product. """ @@ -434,25 +432,27 @@ class ListPublicCatalogProductsResponse: @dataclass class PublicCatalogApiListPublicCatalogProductsRequest: - page: Optional[int] + page: Optional[int] = 0 """ Number of the page. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ The number of products per page. Value must be greater or equal to 1. """ - product_types: Optional[List[ListPublicCatalogProductsRequestProductType]] + product_types: Optional[List[ListPublicCatalogProductsRequestProductType]] = field( + default_factory=list + ) """ The list of filtered product categories. """ - global_: Optional[bool] + global_: Optional[bool] = False - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None - datacenter: Optional[str] + datacenter: Optional[str] = None diff --git a/scaleway/scaleway/qaas/v1alpha1/__init__.py b/scaleway/scaleway/qaas/v1alpha1/__init__.py index 6e7c77ed7..53c554e19 100644 --- a/scaleway/scaleway/qaas/v1alpha1/__init__.py +++ b/scaleway/scaleway/qaas/v1alpha1/__init__.py @@ -9,6 +9,7 @@ from .types import ListBookingsRequestOrderBy from .types import ListJobResultsRequestOrderBy from .types import ListJobsRequestOrderBy +from .types import ListModelsRequestOrderBy from .types import ListPlatformsRequestOrderBy from .types import ListProcessResultsRequestOrderBy from .types import ListProcessesRequestOrderBy @@ -31,6 +32,7 @@ from .types import Booking from .types import JobResult from .types import Job +from .types import Model from .types import Platform from .types import ProcessResult from .types import Process @@ -38,6 +40,7 @@ from .types import CancelJobRequest from .types import CancelProcessRequest from .types import CreateJobRequest +from .types import CreateModelRequest from .types import CreateProcessRequest from .types import CreateSessionRequest from .types import DeleteJobRequest @@ -47,6 +50,7 @@ from .types import GetBookingRequest from .types import GetJobCircuitRequest from .types import GetJobRequest +from .types import GetModelRequest from .types import GetPlatformRequest from .types import GetProcessRequest from .types import GetSessionRequest @@ -58,6 +62,8 @@ from .types import ListJobResultsResponse from .types import ListJobsRequest from .types import ListJobsResponse +from .types import ListModelsRequest +from .types import ListModelsResponse from .types import ListPlatformsRequest from .types import ListPlatformsResponse from .types import ListProcessResultsRequest @@ -85,6 +91,7 @@ "ListBookingsRequestOrderBy", "ListJobResultsRequestOrderBy", "ListJobsRequestOrderBy", + "ListModelsRequestOrderBy", "ListPlatformsRequestOrderBy", "ListProcessResultsRequestOrderBy", "ListProcessesRequestOrderBy", @@ -107,6 +114,7 @@ "Booking", "JobResult", "Job", + "Model", "Platform", "ProcessResult", "Process", @@ -114,6 +122,7 @@ "CancelJobRequest", "CancelProcessRequest", "CreateJobRequest", + "CreateModelRequest", "CreateProcessRequest", "CreateSessionRequest", "DeleteJobRequest", @@ -123,6 +132,7 @@ "GetBookingRequest", "GetJobCircuitRequest", "GetJobRequest", + "GetModelRequest", "GetPlatformRequest", "GetProcessRequest", "GetSessionRequest", @@ -134,6 +144,8 @@ "ListJobResultsResponse", "ListJobsRequest", "ListJobsResponse", + "ListModelsRequest", + "ListModelsResponse", "ListPlatformsRequest", "ListPlatformsResponse", "ListProcessResultsRequest", diff --git a/scaleway/scaleway/qaas/v1alpha1/api.py b/scaleway/scaleway/qaas/v1alpha1/api.py index f750854c7..5508f7c03 100644 --- a/scaleway/scaleway/qaas/v1alpha1/api.py +++ b/scaleway/scaleway/qaas/v1alpha1/api.py @@ -18,6 +18,7 @@ ListBookingsRequestOrderBy, ListJobResultsRequestOrderBy, ListJobsRequestOrderBy, + ListModelsRequestOrderBy, ListPlatformsRequestOrderBy, ListProcessResultsRequestOrderBy, ListProcessesRequestOrderBy, @@ -29,6 +30,7 @@ Application, Booking, CreateJobRequest, + CreateModelRequest, CreateProcessRequest, CreateSessionRequest, CreateSessionRequestBookingDemand, @@ -39,11 +41,13 @@ ListBookingsResponse, ListJobResultsResponse, ListJobsResponse, + ListModelsResponse, ListPlatformsResponse, ListProcessResultsResponse, ListProcessesResponse, ListSessionACLsResponse, ListSessionsResponse, + Model, Platform, Process, ProcessResult, @@ -64,6 +68,7 @@ unmarshal_Application, unmarshal_Booking, unmarshal_Job, + unmarshal_Model, unmarshal_Platform, unmarshal_Process, unmarshal_Session, @@ -71,12 +76,14 @@ unmarshal_ListBookingsResponse, unmarshal_ListJobResultsResponse, unmarshal_ListJobsResponse, + unmarshal_ListModelsResponse, unmarshal_ListPlatformsResponse, unmarshal_ListProcessResultsResponse, unmarshal_ListProcessesResponse, unmarshal_ListSessionACLsResponse, unmarshal_ListSessionsResponse, marshal_CreateJobRequest, + marshal_CreateModelRequest, marshal_CreateProcessRequest, marshal_CreateSessionRequest, marshal_UpdateBookingRequest, @@ -331,6 +338,8 @@ def create_job( circuit: JobCircuit, tags: Optional[List[str]] = None, max_duration: Optional[str] = None, + model_id: Optional[str] = None, + parameters: Optional[str] = None, ) -> Job: """ Create a job. @@ -340,6 +349,8 @@ def create_job( :param circuit: Quantum circuit that should be executed. :param tags: Tags of the job. :param max_duration: Maximum duration of the job. + :param model_id: Computation model ID to be executed by the job. + :param parameters: Execution parameters for this job. :return: :class:`Job ` Usage: @@ -362,6 +373,8 @@ def create_job( circuit=circuit, tags=tags, max_duration=max_duration, + model_id=model_id, + parameters=parameters, ), self.client, ), @@ -780,6 +793,7 @@ def create_session( tags: Optional[List[str]] = None, deduplication_id: Optional[str] = None, booking_demand: Optional[CreateSessionRequestBookingDemand] = None, + model_id: Optional[str] = None, ) -> Session: """ Create a session. @@ -792,6 +806,7 @@ def create_session( :param tags: Tags of the session. :param deduplication_id: Deduplication ID of the session. :param booking_demand: A booking demand to schedule the session, only applicable if the platform is bookable. + :param model_id: Default computation model ID to be executed by job assigned to this session. :return: :class:`Session ` Usage: @@ -815,6 +830,7 @@ def create_session( tags=tags, deduplication_id=deduplication_id, booking_demand=booking_demand, + model_id=model_id, ), self.client, ), @@ -1655,3 +1671,138 @@ def update_booking( self._throw_on_error(res) return unmarshal_Booking(res.json()) + + def create_model( + self, + *, + project_id: Optional[str] = None, + payload: Optional[str] = None, + ) -> Model: + """ + Create a new model. + Create and register a new model that can be executed through next jobs. A model can also be assigned to a Session. + :param project_id: Project ID to attach this model. + :param payload: The serialized model data. + :return: :class:`Model ` + + Usage: + :: + + result = api.create_model() + """ + + res = self._request( + "POST", + "/qaas/v1alpha1/models", + body=marshal_CreateModelRequest( + CreateModelRequest( + project_id=project_id, + payload=payload, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_Model(res.json()) + + def get_model( + self, + *, + model_id: str, + ) -> Model: + """ + Get model information. + Retrieve information about of the provided **model ID**. + :param model_id: Unique ID of the model. + :return: :class:`Model ` + + Usage: + :: + + result = api.get_model( + model_id="example", + ) + """ + + param_model_id = validate_path_param("model_id", model_id) + + res = self._request( + "GET", + f"/qaas/v1alpha1/models/{param_model_id}", + ) + + self._throw_on_error(res) + return unmarshal_Model(res.json()) + + def list_models( + self, + *, + project_id: Optional[str] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListModelsRequestOrderBy] = None, + ) -> ListModelsResponse: + """ + List all models attached to the **project ID**. + Retrieve information about all models of the provided **project ID**. + :param project_id: List models belonging to this project ID. + :param page: Page number. + :param page_size: Maximum number of results to return per page. + :param order_by: Sort order of the returned results. + :return: :class:`ListModelsResponse ` + + Usage: + :: + + result = api.list_models() + """ + + res = self._request( + "GET", + "/qaas/v1alpha1/models", + params={ + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListModelsResponse(res.json()) + + def list_models_all( + self, + *, + project_id: Optional[str] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListModelsRequestOrderBy] = None, + ) -> List[Model]: + """ + List all models attached to the **project ID**. + Retrieve information about all models of the provided **project ID**. + :param project_id: List models belonging to this project ID. + :param page: Page number. + :param page_size: Maximum number of results to return per page. + :param order_by: Sort order of the returned results. + :return: :class:`List[Model] ` + + Usage: + :: + + result = api.list_models_all() + """ + + return fetch_all_pages( + type=ListModelsResponse, + key="models", + fetcher=self.list_models, + args={ + "project_id": project_id, + "page": page, + "page_size": page_size, + "order_by": order_by, + }, + ) diff --git a/scaleway/scaleway/qaas/v1alpha1/marshalling.py b/scaleway/scaleway/qaas/v1alpha1/marshalling.py index 35fd793a4..60d3f84ff 100644 --- a/scaleway/scaleway/qaas/v1alpha1/marshalling.py +++ b/scaleway/scaleway/qaas/v1alpha1/marshalling.py @@ -13,11 +13,21 @@ resolve_one_of, ) from .types import ( + ApplicationType, + BookingStatus, + JobStatus, + PlatformAvailability, + PlatformTechnology, + PlatformType, + ProcessStatus, SessionAccess, + SessionOriginType, + SessionStatus, JobCircuit, Application, Booking, Job, + Model, PlatformBookingRequirement, PlatformHardware, Platform, @@ -28,6 +38,7 @@ JobResult, ListJobResultsResponse, ListJobsResponse, + ListModelsResponse, ListPlatformsResponse, ProcessResult, ListProcessResultsResponse, @@ -35,6 +46,7 @@ ListSessionACLsResponse, ListSessionsResponse, CreateJobRequest, + CreateModelRequest, CreateProcessRequest, CreateSessionRequestBookingDemand, CreateSessionRequest, @@ -79,22 +91,32 @@ def unmarshal_Application(data: Any) -> Application: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = ApplicationType.UNKNOWN_TYPE field = data.get("compatible_platform_ids", None) if field is not None: args["compatible_platform_ids"] = field + else: + args["compatible_platform_ids"] = field(default_factory=list) field = data.get("input_template", None) if field is not None: args["input_template"] = field + else: + args["input_template"] = None return Application(**args) @@ -110,18 +132,26 @@ def unmarshal_Booking(data: Any) -> Booking: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = BookingStatus.UNKNOWN_STATUS field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("progress_message", None) if field is not None: args["progress_message"] = field + else: + args["progress_message"] = None field = data.get("created_at", None) if field is not None: @@ -163,24 +193,26 @@ def unmarshal_Job(data: Any) -> Job: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("session_id", None) if field is not None: args["session_id"] = field - - field = data.get("status", None) - if field is not None: - args["status"] = field + else: + args["session_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field else: - args["tags"] = None + args["tags"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -194,6 +226,12 @@ def unmarshal_Job(data: Any) -> Job: else: args["started_at"] = None + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = JobStatus.UNKNOWN_STATUS + field = data.get("updated_at", None) if field is not None: args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -218,9 +256,56 @@ def unmarshal_Job(data: Any) -> Job: else: args["result_distribution"] = None + field = data.get("model_id", None) + if field is not None: + args["model_id"] = field + else: + args["model_id"] = None + + field = data.get("parameters", None) + if field is not None: + args["parameters"] = field + else: + args["parameters"] = None + return Job(**args) +def unmarshal_Model(data: Any) -> Model: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Model' 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("project_id", None) + if field is not None: + args["project_id"] = field + else: + args["project_id"] = None + + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("url", None) + if field is not None: + args["url"] = field + else: + args["url"] = None + + return Model(**args) + + def unmarshal_PlatformBookingRequirement(data: Any) -> PlatformBookingRequirement: if not isinstance(data, dict): raise TypeError( @@ -267,26 +352,38 @@ def unmarshal_PlatformHardware(data: Any) -> PlatformHardware: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("gpus", None) if field is not None: args["gpus"] = field + else: + args["gpus"] = 0 field = data.get("gpus_network", None) if field is not None: args["gpus_network"] = field + else: + args["gpus_network"] = None field = data.get("ram", None) if field is not None: args["ram"] = field + else: + args["ram"] = 0 field = data.get("vram", None) if field is not None: args["vram"] = field + else: + args["vram"] = 0 return PlatformHardware(**args) @@ -302,62 +399,92 @@ def unmarshal_Platform(data: Any) -> Platform: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("provider_name", None) if field is not None: args["provider_name"] = field + else: + args["provider_name"] = None field = data.get("backend_name", None) if field is not None: args["backend_name"] = field + else: + args["backend_name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = PlatformType.UNKNOWN_TYPE field = data.get("technology", None) if field is not None: args["technology"] = field + else: + args["technology"] = PlatformTechnology.UNKNOWN_TECHNOLOGY field = data.get("max_qubit_count", None) if field is not None: args["max_qubit_count"] = field + else: + args["max_qubit_count"] = 0 field = data.get("max_shot_count", None) if field is not None: args["max_shot_count"] = field + else: + args["max_shot_count"] = 0 field = data.get("max_circuit_count", None) if field is not None: args["max_circuit_count"] = field + else: + args["max_circuit_count"] = 0 field = data.get("availability", None) if field is not None: args["availability"] = field + else: + args["availability"] = PlatformAvailability.UNKNOWN_AVAILABILITY field = data.get("metadata", None) if field is not None: args["metadata"] = field + else: + args["metadata"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("documentation_url", None) if field is not None: args["documentation_url"] = field + else: + args["documentation_url"] = None field = data.get("is_bookable", None) if field is not None: args["is_bookable"] = field + else: + args["is_bookable"] = False field = data.get("price_per_hour", None) if field is not None: @@ -403,14 +530,20 @@ def unmarshal_Process(data: Any) -> Process: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("attached_session_ids", None) if field is not None: args["attached_session_ids"] = field + else: + args["attached_session_ids"] = field(default_factory=list) field = data.get("application_id", None) if field is not None: @@ -421,14 +554,20 @@ def unmarshal_Process(data: Any) -> Process: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ProcessStatus.UNKNOWN_STATUS field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("platform_id", None) if field is not None: @@ -466,7 +605,7 @@ def unmarshal_Process(data: Any) -> Process: if field is not None: args["progress"] = field else: - args["progress"] = None + args["progress"] = 0 field = data.get("progress_message", None) if field is not None: @@ -494,44 +633,56 @@ def unmarshal_Session(data: Any) -> Session: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("platform_id", None) if field is not None: args["platform_id"] = field + else: + args["platform_id"] = None field = data.get("waiting_job_count", None) if field is not None: args["waiting_job_count"] = field - - 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 + args["waiting_job_count"] = 0 field = data.get("finished_job_count", None) if field is not None: args["finished_job_count"] = field + else: + args["finished_job_count"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SessionStatus.UNKNOWN_STATUS field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("deduplication_id", None) if field is not None: args["deduplication_id"] = field + else: + args["deduplication_id"] = None - field = data.get("origin_type", None) + field = data.get("created_at", None) if field is not None: - args["origin_type"] = field + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None field = data.get("started_at", None) if field is not None: @@ -569,7 +720,13 @@ def unmarshal_Session(data: Any) -> Session: if field is not None: args["tags"] = field else: - args["tags"] = None + args["tags"] = field(default_factory=list) + + field = data.get("origin_type", None) + if field is not None: + args["origin_type"] = field + else: + args["origin_type"] = SessionOriginType.UNKNOWN_ORIGIN_TYPE field = data.get("origin_id", None) if field is not None: @@ -589,6 +746,12 @@ def unmarshal_Session(data: Any) -> Session: else: args["booking_id"] = None + field = data.get("model_id", None) + if field is not None: + args["model_id"] = field + else: + args["model_id"] = None + return Session(**args) @@ -603,12 +766,16 @@ def unmarshal_ListApplicationsResponse(data: Any) -> ListApplicationsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("applications", None) if field is not None: args["applications"] = ( [unmarshal_Application(v) for v in field] if field is not None else None ) + else: + args["applications"] = field(default_factory=list) return ListApplicationsResponse(**args) @@ -624,12 +791,16 @@ def unmarshal_ListBookingsResponse(data: Any) -> ListBookingsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("bookings", None) if field is not None: args["bookings"] = ( [unmarshal_Booking(v) for v in field] if field is not None else None ) + else: + args["bookings"] = field(default_factory=list) return ListBookingsResponse(**args) @@ -645,6 +816,8 @@ def unmarshal_JobResult(data: Any) -> JobResult: field = data.get("job_id", None) if field is not None: args["job_id"] = field + else: + args["job_id"] = None field = data.get("result", None) if field is not None: @@ -678,12 +851,16 @@ def unmarshal_ListJobResultsResponse(data: Any) -> ListJobResultsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("job_results", None) if field is not None: args["job_results"] = ( [unmarshal_JobResult(v) for v in field] if field is not None else None ) + else: + args["job_results"] = field(default_factory=list) return ListJobResultsResponse(**args) @@ -699,14 +876,43 @@ def unmarshal_ListJobsResponse(data: Any) -> ListJobsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("jobs", None) if field is not None: args["jobs"] = [unmarshal_Job(v) for v in field] if field is not None else None + else: + args["jobs"] = field(default_factory=list) return ListJobsResponse(**args) +def unmarshal_ListModelsResponse(data: Any) -> ListModelsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = 0 + + field = data.get("models", None) + if field is not None: + args["models"] = ( + [unmarshal_Model(v) for v in field] if field is not None else None + ) + else: + args["models"] = field(default_factory=list) + + return ListModelsResponse(**args) + + def unmarshal_ListPlatformsResponse(data: Any) -> ListPlatformsResponse: if not isinstance(data, dict): raise TypeError( @@ -718,12 +924,16 @@ def unmarshal_ListPlatformsResponse(data: Any) -> ListPlatformsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("platforms", None) if field is not None: args["platforms"] = ( [unmarshal_Platform(v) for v in field] if field is not None else None ) + else: + args["platforms"] = field(default_factory=list) return ListPlatformsResponse(**args) @@ -739,10 +949,14 @@ def unmarshal_ProcessResult(data: Any) -> ProcessResult: field = data.get("process_id", None) if field is not None: args["process_id"] = field + else: + args["process_id"] = None field = data.get("result", None) if field is not None: args["result"] = field + else: + args["result"] = None field = data.get("created_at", None) if field is not None: @@ -764,12 +978,16 @@ def unmarshal_ListProcessResultsResponse(data: Any) -> ListProcessResultsRespons field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("process_results", None) if field is not None: args["process_results"] = ( [unmarshal_ProcessResult(v) for v in field] if field is not None else None ) + else: + args["process_results"] = field(default_factory=list) return ListProcessResultsResponse(**args) @@ -785,12 +1003,16 @@ def unmarshal_ListProcessesResponse(data: Any) -> ListProcessesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("processes", None) if field is not None: args["processes"] = ( [unmarshal_Process(v) for v in field] if field is not None else None ) + else: + args["processes"] = field(default_factory=list) return ListProcessesResponse(**args) @@ -806,10 +1028,14 @@ def unmarshal_ListSessionACLsResponse(data: Any) -> ListSessionACLsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("acls", None) if field is not None: args["acls"] = [SessionAccess(v) for v in field] if field is not None else None + else: + args["acls"] = None return ListSessionACLsResponse(**args) @@ -825,12 +1051,16 @@ def unmarshal_ListSessionsResponse(data: Any) -> ListSessionsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("sessions", None) if field is not None: args["sessions"] = ( [unmarshal_Session(v) for v in field] if field is not None else None ) + else: + args["sessions"] = field(default_factory=list) return ListSessionsResponse(**args) @@ -881,6 +1111,29 @@ def marshal_CreateJobRequest( if request.max_duration is not None: output["max_duration"] = request.max_duration + if request.model_id is not None: + output["model_id"] = request.model_id + + if request.parameters is not None: + output["parameters"] = request.parameters + + return output + + +def marshal_CreateModelRequest( + request: CreateModelRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.project_id is not None: + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id + + if request.payload is not None: + output["payload"] = request.payload + return output @@ -894,7 +1147,9 @@ def marshal_CreateProcessRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.platform_id is not None: output["platform_id"] = request.platform_id @@ -939,7 +1194,9 @@ def marshal_CreateSessionRequest( output["platform_id"] = request.platform_id if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -961,6 +1218,9 @@ def marshal_CreateSessionRequest( request.booking_demand, defaults ) + if request.model_id is not None: + output["model_id"] = request.model_id + return output diff --git a/scaleway/scaleway/qaas/v1alpha1/types.py b/scaleway/scaleway/qaas/v1alpha1/types.py index f0157bba2..188310169 100644 --- a/scaleway/scaleway/qaas/v1alpha1/types.py +++ b/scaleway/scaleway/qaas/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -93,6 +93,14 @@ def __str__(self) -> str: return str(self.value) +class ListModelsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_DESC = "created_at_desc" + CREATED_AT_ASC = "created_at_asc" + + def __str__(self) -> str: + return str(self.value) + + class ListPlatformsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): NAME_ASC = "name_asc" NAME_DESC = "name_desc" @@ -234,22 +242,22 @@ def __str__(self) -> str: @dataclass class PlatformBookingRequirement: - min_duration: Optional[str] + min_duration: Optional[str] = None """ Minimal duration of any booking based on this platform. """ - max_duration: Optional[str] + max_duration: Optional[str] = None """ Maximal duration of any bookings based on this platform. """ - max_cancellation_duration: Optional[str] + max_cancellation_duration: Optional[str] = None """ Allowed time to cancel a booking attached to this platform before the beginning of the session. """ - max_planification_duration: Optional[str] + max_planification_duration: Optional[str] = None """ Allowed planification time from now where the platform can be booked in the future. """ @@ -290,18 +298,16 @@ class PlatformHardware: @dataclass class JobCircuit: - perceval_circuit: Optional[str] + perceval_circuit: Optional[str] = None - qiskit_circuit: Optional[str] + qiskit_circuit: Optional[str] = None @dataclass class CreateSessionRequestBookingDemand: - started_at: Optional[datetime] - - finished_at: Optional[datetime] - - description: Optional[str] + started_at: Optional[datetime] = None + finished_at: Optional[datetime] = None + description: Optional[str] = None @dataclass @@ -354,22 +360,22 @@ class Booking: Any progress message of the booking. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Time at which the booking was created. """ - started_at: Optional[datetime] + started_at: Optional[datetime] = None """ Time at which the booking starts. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Time at which the booking was updated. """ - finished_at: Optional[datetime] + finished_at: Optional[datetime] = None """ Time at which the booking finishes. """ @@ -382,17 +388,17 @@ class JobResult: ID of the parent job. """ - result: Optional[str] + result: Optional[str] = None """ Result in JSON format. """ - url: Optional[str] + url: Optional[str] = None """ URL to download a large result (optional). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation time of the result. """ @@ -420,41 +426,74 @@ class Job: Job status. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the job. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Time at which the job was created. """ - started_at: Optional[datetime] + started_at: Optional[datetime] = None """ Time at which the job was started. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Time at which the job was updated. """ - progress_message: Optional[str] + progress_message: Optional[str] = None """ Last progress message, if the job has started. """ - job_duration: Optional[str] + job_duration: Optional[str] = None """ Duration of the job, if the job is finished. """ - result_distribution: Optional[str] + result_distribution: Optional[str] = None """ Result of the job, if the job is finished. """ + model_id: Optional[str] = None + """ + Computation model ID executed by the job. + """ + + parameters: Optional[str] = None + """ + Execution parameters for this job. + """ + + +@dataclass +class Model: + id: str + """ + Unique ID of the model. + """ + + project_id: str + """ + Project ID in which the model has been created. + """ + + created_at: Optional[datetime] = None + """ + Time at which the model was created. + """ + + url: Optional[str] = None + """ + Storage URL of the model. + """ + @dataclass class Platform: @@ -533,27 +572,27 @@ class Platform: Specify if the platform is bookable. """ - price_per_hour: Optional[Money] + price_per_hour: Optional[Money] = None """ Price to be paid per hour (excluding free tiers). """ - price_per_shot: Optional[Money] + price_per_shot: Optional[Money] = None """ Price to be paid per shot (excluding free tiers). """ - price_per_circuit: Optional[Money] + price_per_circuit: Optional[Money] = None """ Price to be paid per circuit setup before its execution (excluding free tiers). """ - hardware: Optional[PlatformHardware] + hardware: Optional[PlatformHardware] = None """ Specifications of the underlying hardware. """ - booking_requirement: Optional[PlatformBookingRequirement] + booking_requirement: Optional[PlatformBookingRequirement] = None """ Booking constraints to fit if the platform is bookable. """ @@ -571,7 +610,7 @@ class ProcessResult: Result in JSON format. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation time of the result. """ @@ -594,11 +633,6 @@ class Process: List of sessions generated by the process. """ - application_id: Optional[str] - """ - Application ID for which the process has been created. - """ - status: ProcessStatus """ Status of the process. @@ -614,42 +648,47 @@ class Process: Tags of the process. """ - platform_id: Optional[str] + application_id: Optional[str] = None + """ + Application ID for which the process has been created. + """ + + platform_id: Optional[str] = None """ Platform ID for which the process has been created. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Time at which the process was created. """ - started_at: Optional[datetime] + started_at: Optional[datetime] = None """ Time at which the process started. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Time at which the process was updated. """ - finished_at: Optional[datetime] + finished_at: Optional[datetime] = None """ Time at which the process was finished. """ - progress: Optional[int] + progress: Optional[int] = 0 """ Progress of the process, from 0 to 1. """ - progress_message: Optional[str] + progress_message: Optional[str] = None """ Any progress of the process. """ - input: Optional[str] + input: Optional[str] = None """ Input payload of the process as JSON string. """ @@ -677,11 +716,6 @@ class Session: Number of waiting jobs linked to the session. """ - created_at: Optional[datetime] - """ - The time at which the session was created. - """ - finished_job_count: int """ Number of finished jobs linked to the session. @@ -707,51 +741,61 @@ class Session: Resource type that creates the session. """ - started_at: Optional[datetime] + created_at: Optional[datetime] = None + """ + The time at which the session was created. + """ + + started_at: Optional[datetime] = None """ The time at which the session started. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ The time at which the session was updated. """ - terminated_at: Optional[datetime] + terminated_at: Optional[datetime] = None """ The time at which the session was terminated. """ - max_idle_duration: Optional[str] + max_idle_duration: Optional[str] = None """ Maximum idle time before the session ends. """ - max_duration: Optional[str] + max_duration: Optional[str] = None """ Maximum duration before the session ends. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the session. """ - origin_id: Optional[str] + origin_id: Optional[str] = None """ Unique ID of the session's origin resource (if exists). """ - progress_message: Optional[str] + progress_message: Optional[str] = None """ Any progress of the session. """ - booking_id: Optional[str] + booking_id: Optional[str] = None """ An optional booking unique ID of an attached booking. """ + model_id: Optional[str] = None + """ + Default computation model ID to be executed by job assigned to this session. + """ + @dataclass class CancelJobRequest: @@ -786,16 +830,39 @@ class CreateJobRequest: Quantum circuit that should be executed. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the job. """ - max_duration: Optional[str] + max_duration: Optional[str] = None """ Maximum duration of the job. """ + model_id: Optional[str] = None + """ + Computation model ID to be executed by the job. + """ + + parameters: Optional[str] = None + """ + Execution parameters for this job. + """ + + +@dataclass +class CreateModelRequest: + project_id: Optional[str] = None + """ + Project ID to attach this model. + """ + + payload: Optional[str] = None + """ + The serialized model data. + """ + @dataclass class CreateProcessRequest: @@ -804,27 +871,27 @@ class CreateProcessRequest: Name of the process. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project in which the process was created. """ - platform_id: Optional[str] + platform_id: Optional[str] = None """ ID of the platform for which the process was created. """ - application_id: Optional[str] + application_id: Optional[str] = None """ ID of the application for which the process was created. """ - input: Optional[str] + input: Optional[str] = None """ Process parameters in JSON format. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the process. """ @@ -837,41 +904,46 @@ class CreateSessionRequest: ID of the Platform for which the session was created. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project in which the session was created. """ - name: Optional[str] + name: Optional[str] = None """ Name of the session. """ - max_idle_duration: Optional[str] + max_idle_duration: Optional[str] = None """ Maximum idle duration before the session ends. """ - max_duration: Optional[str] + max_duration: Optional[str] = None """ Maximum duration before the session ends. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the session. """ - deduplication_id: Optional[str] + deduplication_id: Optional[str] = None """ Deduplication ID of the session. """ - booking_demand: Optional[CreateSessionRequestBookingDemand] + booking_demand: Optional[CreateSessionRequestBookingDemand] = None """ A booking demand to schedule the session, only applicable if the platform is bookable. """ + model_id: Optional[str] = None + """ + Default computation model ID to be executed by job assigned to this session. + """ + @dataclass class DeleteJobRequest: @@ -929,6 +1001,14 @@ class GetJobRequest: """ +@dataclass +class GetModelRequest: + model_id: str + """ + Unique ID of the model. + """ + + @dataclass class GetPlatformRequest: platform_id: str @@ -955,27 +1035,29 @@ class GetSessionRequest: @dataclass class ListApplicationsRequest: - name: Optional[str] + name: Optional[str] = None """ List applications with this name. """ - application_type: Optional[ApplicationType] + application_type: Optional[ApplicationType] = ApplicationType.UNKNOWN_TYPE """ List applications with this type. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of applications a to return per page. """ - order_by: Optional[ListApplicationsRequestOrderBy] + order_by: Optional[ListApplicationsRequestOrderBy] = ( + ListApplicationsRequestOrderBy.NAME_ASC + ) """ Sort order of the returned applications. """ @@ -996,27 +1078,29 @@ class ListApplicationsResponse: @dataclass class ListBookingsRequest: - project_id: Optional[str] + project_id: Optional[str] = None """ List bookings belonging to this project ID. """ - platform_id: Optional[str] + platform_id: Optional[str] = None """ List bookings attached to this platform ID. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of results to return per page. """ - order_by: Optional[ListBookingsRequestOrderBy] + order_by: Optional[ListBookingsRequestOrderBy] = ( + ListBookingsRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of the returned results. """ @@ -1042,17 +1126,19 @@ class ListJobResultsRequest: ID of the job. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of results to return per page. """ - order_by: Optional[ListJobResultsRequestOrderBy] + order_by: Optional[ListJobResultsRequestOrderBy] = ( + ListJobResultsRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of the returned results. """ @@ -1073,29 +1159,29 @@ class ListJobResultsResponse: @dataclass class ListJobsRequest: - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List jobs with these tags. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of jobs to return per page. """ - order_by: Optional[ListJobsRequestOrderBy] + order_by: Optional[ListJobsRequestOrderBy] = ListJobsRequestOrderBy.CREATED_AT_DESC """ Sort order of the returned jobs. """ - session_id: Optional[str] + session_id: Optional[str] = None - project_id: Optional[str] + project_id: Optional[str] = None @dataclass @@ -1111,44 +1197,86 @@ class ListJobsResponse: """ +@dataclass +class ListModelsRequest: + project_id: Optional[str] = None + """ + List models belonging to this project ID. + """ + + page: Optional[int] = 0 + """ + Page number. + """ + + page_size: Optional[int] = 0 + """ + Maximum number of results to return per page. + """ + + order_by: Optional[ListModelsRequestOrderBy] = ( + ListModelsRequestOrderBy.CREATED_AT_DESC + ) + """ + Sort order of the returned results. + """ + + +@dataclass +class ListModelsResponse: + total_count: int + """ + Total number of models. + """ + + models: List[Model] + """ + List of models. + """ + + @dataclass class ListPlatformsRequest: - provider_name: Optional[str] + provider_name: Optional[str] = None """ List platforms with this provider name. """ - backend_name: Optional[str] + backend_name: Optional[str] = None """ List platforms with this backend name. """ - name: Optional[str] + name: Optional[str] = None """ List platforms with this name. """ - platform_type: Optional[PlatformType] + platform_type: Optional[PlatformType] = PlatformType.UNKNOWN_TYPE """ List platforms with this type. """ - platform_technology: Optional[PlatformTechnology] + platform_technology: Optional[PlatformTechnology] = ( + PlatformTechnology.UNKNOWN_TECHNOLOGY + ) """ List platforms with this technology. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of platforms to return per page. """ - order_by: Optional[ListPlatformsRequestOrderBy] + order_by: Optional[ListPlatformsRequestOrderBy] = ( + ListPlatformsRequestOrderBy.NAME_ASC + ) """ Sort order of the returned platforms. """ @@ -1174,17 +1302,19 @@ class ListProcessResultsRequest: ID of the process. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of results to return per page. """ - order_by: Optional[ListProcessResultsRequestOrderBy] + order_by: Optional[ListProcessResultsRequestOrderBy] = ( + ListProcessResultsRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of the returned results. """ @@ -1205,32 +1335,34 @@ class ListProcessResultsResponse: @dataclass class ListProcessesRequest: - application_id: Optional[str] + application_id: Optional[str] = None """ List processes that have been created for this application. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List processes with these tags. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of processes to return per page. """ - order_by: Optional[ListProcessesRequestOrderBy] + order_by: Optional[ListProcessesRequestOrderBy] = ( + ListProcessesRequestOrderBy.CREATED_AT_DESC + ) """ Sort order of the returned processes. """ - project_id: Optional[str] + project_id: Optional[str] = None """ List processes belonging to this project ID. """ @@ -1252,49 +1384,45 @@ class ListProcessesResponse: @dataclass class ListSessionACLsRequest: session_id: str - - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListSessionACLsRequestOrderBy] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListSessionACLsRequestOrderBy] = None @dataclass class ListSessionACLsResponse: total_count: int - acls: List[SessionAccess] @dataclass class ListSessionsRequest: - platform_id: Optional[str] + platform_id: Optional[str] = None """ List sessions that have been created for this platform. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List sessions with these tags. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of sessions to return per page. """ - order_by: Optional[ListSessionsRequestOrderBy] + order_by: Optional[ListSessionsRequestOrderBy] = ListSessionsRequestOrderBy.NAME_ASC """ Sort order of the returned sessions. """ - project_id: Optional[str] + project_id: Optional[str] = None """ List sessions belonging to this project ID. """ @@ -1328,7 +1456,7 @@ class UpdateBookingRequest: Unique ID of the booking. """ - description: Optional[str] + description: Optional[str] = None """ Description of the booking slot. """ @@ -1341,12 +1469,12 @@ class UpdateJobRequest: Unique ID of the job. """ - name: Optional[str] + name: Optional[str] = None """ Name of the job. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the job. """ @@ -1359,12 +1487,12 @@ class UpdateProcessRequest: Unique ID of the process. """ - name: Optional[str] + name: Optional[str] = None """ Name of the process. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the process. """ @@ -1377,22 +1505,22 @@ class UpdateSessionRequest: Unique ID of the session. """ - name: Optional[str] + name: Optional[str] = None """ Name of the session. """ - max_idle_duration: Optional[str] + max_idle_duration: Optional[str] = None """ Maximum idle duration before the session ends. """ - max_duration: Optional[str] + max_duration: Optional[str] = None """ Maximum time before the session ends. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the session. """ diff --git a/scaleway/scaleway/rdb/v1/marshalling.py b/scaleway/scaleway/rdb/v1/marshalling.py index 7c47f87d0..06094a856 100644 --- a/scaleway/scaleway/rdb/v1/marshalling.py +++ b/scaleway/scaleway/rdb/v1/marshalling.py @@ -13,6 +13,19 @@ resolve_one_of, ) from .types import ( + DatabaseBackupStatus, + EndpointPrivateNetworkDetailsProvisioningMode, + EngineSettingPropertyType, + InstanceLogStatus, + InstanceStatus, + MaintenanceStatus, + NodeTypeGeneration, + NodeTypeStock, + Permission, + ReadReplicaStatus, + SnapshotStatus, + StorageClass, + VolumeType, EndpointDirectAccessDetails, EndpointLoadBalancerDetails, EndpointPrivateNetworkDetails, @@ -132,18 +145,26 @@ def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetwork field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("service_ip", None) if field is not None: args["service_ip"] = field + else: + args["service_ip"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("provisioning_mode", None) if field is not None: args["provisioning_mode"] = field + else: + args["provisioning_mode"] = EndpointPrivateNetworkDetailsProvisioningMode.STATIC return EndpointPrivateNetworkDetails(**args) @@ -159,10 +180,14 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("ip", None) if field is not None: @@ -214,14 +239,20 @@ def unmarshal_Maintenance(data: Any) -> Maintenance: field = data.get("reason", None) if field is not None: args["reason"] = field + else: + args["reason"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = MaintenanceStatus.UNKNOWN field = data.get("is_applicable", None) if field is not None: args["is_applicable"] = field + else: + args["is_applicable"] = False field = data.get("starts_at", None) if field is not None: @@ -261,28 +292,40 @@ def unmarshal_ReadReplica(data: Any) -> ReadReplica: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ReadReplicaStatus.UNKNOWN field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("same_zone", None) if field is not None: args["same_zone"] = field + else: + args["same_zone"] = False field = data.get("instance_id", None) if field is not None: args["instance_id"] = field + else: + args["instance_id"] = None return ReadReplica(**args) @@ -298,28 +341,38 @@ def unmarshal_DatabaseBackup(data: Any) -> DatabaseBackup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("instance_id", None) if field is not None: args["instance_id"] = field + else: + args["instance_id"] = None field = data.get("database_name", None) if field is not None: args["database_name"] = field + else: + args["database_name"] = 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"] = DatabaseBackupStatus.UNKNOWN field = data.get("size", None) if field is not None: args["size"] = field else: - args["size"] = None + args["size"] = 0 field = data.get("expires_at", None) if field is not None: @@ -342,14 +395,20 @@ def unmarshal_DatabaseBackup(data: Any) -> DatabaseBackup: field = data.get("instance_name", None) if field is not None: args["instance_name"] = field + else: + args["instance_name"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("same_region", None) if field is not None: args["same_region"] = field + else: + args["same_region"] = False field = data.get("download_url", None) if field is not None: @@ -379,18 +438,26 @@ def unmarshal_Database(data: Any) -> Database: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("owner", None) if field is not None: args["owner"] = field + else: + args["owner"] = None field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 return Database(**args) @@ -406,18 +473,26 @@ def unmarshal_InstanceLog(data: Any) -> InstanceLog: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceLogStatus.UNKNOWN field = data.get("node_name", None) if field is not None: args["node_name"] = field + else: + args["node_name"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("download_url", None) if field is not None: @@ -451,14 +526,20 @@ def unmarshal_BackupSchedule(data: Any) -> BackupSchedule: field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = 0 field = data.get("retention", None) if field is not None: args["retention"] = field + else: + args["retention"] = 0 field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("next_run_at", None) if field is not None: @@ -482,6 +563,8 @@ def unmarshal_EncryptionAtRest(data: Any) -> EncryptionAtRest: field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = None return EncryptionAtRest(**args) @@ -497,10 +580,14 @@ def unmarshal_InstanceSetting(data: Any) -> InstanceSetting: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None return InstanceSetting(**args) @@ -517,13 +604,13 @@ def unmarshal_LogsPolicy(data: Any) -> LogsPolicy: if field is not None: args["max_age_retention"] = field else: - args["max_age_retention"] = None + args["max_age_retention"] = 0 field = data.get("total_disk_retention", None) if field is not None: args["total_disk_retention"] = field else: - args["total_disk_retention"] = None + args["total_disk_retention"] = 0 return LogsPolicy(**args) @@ -539,18 +626,26 @@ def unmarshal_UpgradableVersion(data: Any) -> UpgradableVersion: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("minor_version", None) if field is not None: args["minor_version"] = field + else: + args["minor_version"] = None return UpgradableVersion(**args) @@ -566,14 +661,20 @@ def unmarshal_Volume(data: Any) -> Volume: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = None return Volume(**args) @@ -589,18 +690,26 @@ def unmarshal_Instance(data: Any) -> Instance: field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("created_at", None) if field is not None: @@ -617,14 +726,20 @@ def unmarshal_Instance(data: Any) -> Instance: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = InstanceStatus.UNKNOWN field = data.get("engine", None) if field is not None: args["engine"] = field + else: + args["engine"] = None field = data.get("upgradable_version", None) if field is not None: @@ -633,20 +748,28 @@ def unmarshal_Instance(data: Any) -> Instance: if field is not None else None ) + else: + args["upgradable_version"] = field(default_factory=list) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("settings", None) if field is not None: args["settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) field = data.get("is_ha_cluster", None) if field is not None: args["is_ha_cluster"] = field + else: + args["is_ha_cluster"] = False field = data.get("endpoint", None) if field is not None: @@ -665,32 +788,44 @@ def unmarshal_Instance(data: Any) -> Instance: args["read_replicas"] = ( [unmarshal_ReadReplica(v) for v in field] if field is not None else None ) + else: + args["read_replicas"] = field(default_factory=list) field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("init_settings", None) if field is not None: args["init_settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["init_settings"] = field(default_factory=list) field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("backup_same_region", None) if field is not None: args["backup_same_region"] = field + else: + args["backup_same_region"] = False field = data.get("maintenances", None) if field is not None: args["maintenances"] = ( [unmarshal_Maintenance(v) for v in field] if field is not None else None ) + else: + args["maintenances"] = field(default_factory=list) field = data.get("logs_policy", None) if field is not None: @@ -718,14 +853,20 @@ def unmarshal_Privilege(data: Any) -> Privilege: field = data.get("permission", None) if field is not None: args["permission"] = field + else: + args["permission"] = Permission.READONLY field = data.get("database_name", None) if field is not None: args["database_name"] = field + else: + args["database_name"] = None field = data.get("user_name", None) if field is not None: args["user_name"] = field + else: + args["user_name"] = None return Privilege(**args) @@ -741,10 +882,14 @@ def unmarshal_SnapshotVolumeType(data: Any) -> SnapshotVolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = None return SnapshotVolumeType(**args) @@ -760,36 +905,50 @@ def unmarshal_Snapshot(data: Any) -> Snapshot: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("instance_id", None) if field is not None: args["instance_id"] = field + else: + args["instance_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"] = SnapshotStatus.UNKNOWN field = data.get("instance_name", None) if field is not None: args["instance_name"] = field + else: + args["instance_name"] = None field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("size", None) if field is not None: args["size"] = field else: - args["size"] = None + args["size"] = 0 field = data.get("expires_at", None) if field is not None: @@ -829,10 +988,14 @@ def unmarshal_User(data: Any) -> User: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("is_admin", None) if field is not None: args["is_admin"] = field + else: + args["is_admin"] = False return User(**args) @@ -848,22 +1011,32 @@ def unmarshal_ACLRule(data: Any) -> ACLRule: field = data.get("ip", None) if field is not None: args["ip"] = field + else: + args["ip"] = None field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = None field = data.get("direction", None) if field is not None: args["direction"] = field + else: + args["direction"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("port", None) if field is not None: @@ -887,6 +1060,8 @@ def unmarshal_AddInstanceACLRulesResponse(data: Any) -> AddInstanceACLRulesRespo args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return AddInstanceACLRulesResponse(**args) @@ -904,6 +1079,8 @@ def unmarshal_AddInstanceSettingsResponse(data: Any) -> AddInstanceSettingsRespo args["settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) return AddInstanceSettingsResponse(**args) @@ -923,6 +1100,8 @@ def unmarshal_DeleteInstanceACLRulesResponse( args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return DeleteInstanceACLRulesResponse(**args) @@ -942,6 +1121,8 @@ def unmarshal_DeleteInstanceSettingsResponse( args["settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) return DeleteInstanceSettingsResponse(**args) @@ -959,6 +1140,8 @@ def unmarshal_InstanceMetrics(data: Any) -> InstanceMetrics: args["timeseries"] = ( [unmarshal_TimeSeries(v) for v in field] if field is not None else None ) + else: + args["timeseries"] = field(default_factory=list) return InstanceMetrics(**args) @@ -976,10 +1159,14 @@ def unmarshal_ListDatabaseBackupsResponse(data: Any) -> ListDatabaseBackupsRespo args["database_backups"] = ( [unmarshal_DatabaseBackup(v) for v in field] if field is not None else None ) + else: + args["database_backups"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabaseBackupsResponse(**args) @@ -995,22 +1182,32 @@ def unmarshal_EngineSetting(data: Any) -> EngineSetting: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("default_value", None) if field is not None: args["default_value"] = field + else: + args["default_value"] = None field = data.get("hot_configurable", None) if field is not None: args["hot_configurable"] = field + else: + args["hot_configurable"] = False field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("property_type", None) if field is not None: args["property_type"] = field + else: + args["property_type"] = EngineSettingPropertyType.BOOLEAN field = data.get("unit", None) if field is not None: @@ -1028,25 +1225,25 @@ def unmarshal_EngineSetting(data: Any) -> EngineSetting: if field is not None: args["int_min"] = field else: - args["int_min"] = None + args["int_min"] = 0 field = data.get("int_max", None) if field is not None: args["int_max"] = field else: - args["int_max"] = None + args["int_max"] = 0 field = data.get("float_min", None) if field is not None: args["float_min"] = field else: - args["float_min"] = None + args["float_min"] = 0.0 field = data.get("float_max", None) if field is not None: args["float_max"] = field else: - args["float_max"] = None + args["float_max"] = 0.0 return EngineSetting(**args) @@ -1062,30 +1259,42 @@ def unmarshal_EngineVersion(data: Any) -> EngineVersion: field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("available_settings", None) if field is not None: args["available_settings"] = ( [unmarshal_EngineSetting(v) for v in field] if field is not None else None ) + else: + args["available_settings"] = field(default_factory=list) field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("available_init_settings", None) if field is not None: args["available_init_settings"] = ( [unmarshal_EngineSetting(v) for v in field] if field is not None else None ) + else: + args["available_init_settings"] = field(default_factory=list) field = data.get("end_of_life", None) if field is not None: @@ -1109,20 +1318,28 @@ def unmarshal_DatabaseEngine(data: Any) -> DatabaseEngine: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("versions", None) if field is not None: args["versions"] = ( [unmarshal_EngineVersion(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None return DatabaseEngine(**args) @@ -1140,10 +1357,14 @@ def unmarshal_ListDatabaseEnginesResponse(data: Any) -> ListDatabaseEnginesRespo args["engines"] = ( [unmarshal_DatabaseEngine(v) for v in field] if field is not None else None ) + else: + args["engines"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabaseEnginesResponse(**args) @@ -1161,10 +1382,14 @@ def unmarshal_ListDatabasesResponse(data: Any) -> ListDatabasesResponse: args["databases"] = ( [unmarshal_Database(v) for v in field] if field is not None else None ) + else: + args["databases"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabasesResponse(**args) @@ -1182,10 +1407,14 @@ def unmarshal_ListInstanceACLRulesResponse(data: Any) -> ListInstanceACLRulesRes args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstanceACLRulesResponse(**args) @@ -1203,10 +1432,14 @@ def unmarshal_ListInstanceLogsDetailsResponseInstanceLogDetail( field = data.get("log_name", None) if field is not None: args["log_name"] = field + else: + args["log_name"] = None field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = None return ListInstanceLogsDetailsResponseInstanceLogDetail(**args) @@ -1231,6 +1464,8 @@ def unmarshal_ListInstanceLogsDetailsResponse( if field is not None else None ) + else: + args["details"] = field(default_factory=list) return ListInstanceLogsDetailsResponse(**args) @@ -1248,6 +1483,8 @@ def unmarshal_ListInstanceLogsResponse(data: Any) -> ListInstanceLogsResponse: args["instance_logs"] = ( [unmarshal_InstanceLog(v) for v in field] if field is not None else None ) + else: + args["instance_logs"] = field(default_factory=list) return ListInstanceLogsResponse(**args) @@ -1265,10 +1502,14 @@ def unmarshal_ListInstancesResponse(data: Any) -> ListInstancesResponse: args["instances"] = ( [unmarshal_Instance(v) for v in field] if field is not None else None ) + else: + args["instances"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListInstancesResponse(**args) @@ -1284,10 +1525,14 @@ def unmarshal_NodeTypeVolumeConstraintSizes(data: Any) -> NodeTypeVolumeConstrai 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 return NodeTypeVolumeConstraintSizes(**args) @@ -1303,26 +1548,38 @@ def unmarshal_NodeTypeVolumeType(data: Any) -> NodeTypeVolumeType: field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = VolumeType.LSSD field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = 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("chunk_size", None) if field is not None: args["chunk_size"] = field + else: + args["chunk_size"] = 0 field = data.get("class", None) if field is not None: args["class_"] = field + else: + args["class_"] = StorageClass.UNKNOWN_STORAGE_CLASS return NodeTypeVolumeType(**args) @@ -1338,30 +1595,44 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("volume_constraint", None) if field is not None: @@ -1373,7 +1644,7 @@ def unmarshal_NodeType(data: Any) -> NodeType: if field is not None: args["is_bssd_compatible"] = field else: - args["is_bssd_compatible"] = None + args["is_bssd_compatible"] = False field = data.get("available_volume_types", None) if field is not None: @@ -1382,22 +1653,32 @@ def unmarshal_NodeType(data: Any) -> NodeType: if field is not None else None ) + else: + args["available_volume_types"] = field(default_factory=list) field = data.get("is_ha_required", None) if field is not None: args["is_ha_required"] = field + else: + args["is_ha_required"] = False field = data.get("generation", None) if field is not None: args["generation"] = field + else: + args["generation"] = NodeTypeGeneration.UNKNOWN_GENERATION field = data.get("instance_range", None) if field is not None: args["instance_range"] = field + else: + args["instance_range"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None return NodeType(**args) @@ -1415,10 +1696,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -1436,10 +1721,14 @@ def unmarshal_ListPrivilegesResponse(data: Any) -> ListPrivilegesResponse: args["privileges"] = ( [unmarshal_Privilege(v) for v in field] if field is not None else None ) + else: + args["privileges"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPrivilegesResponse(**args) @@ -1457,10 +1746,14 @@ def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: args["snapshots"] = ( [unmarshal_Snapshot(v) for v in field] if field is not None else None ) + else: + args["snapshots"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSnapshotsResponse(**args) @@ -1478,10 +1771,14 @@ def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse: args["users"] = ( [unmarshal_User(v) for v in field] if field is not None else None ) + else: + args["users"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListUsersResponse(**args) @@ -1499,6 +1796,8 @@ def unmarshal_PrepareInstanceLogsResponse(data: Any) -> PrepareInstanceLogsRespo args["instance_logs"] = ( [unmarshal_InstanceLog(v) for v in field] if field is not None else None ) + else: + args["instance_logs"] = field(default_factory=list) return PrepareInstanceLogsResponse(**args) @@ -1516,6 +1815,8 @@ def unmarshal_SetInstanceACLRulesResponse(data: Any) -> SetInstanceACLRulesRespo args["rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = field(default_factory=list) return SetInstanceACLRulesResponse(**args) @@ -1533,6 +1834,8 @@ def unmarshal_SetInstanceSettingsResponse(data: Any) -> SetInstanceSettingsRespo args["settings"] = ( [unmarshal_InstanceSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) return SetInstanceSettingsResponse(**args) @@ -1814,7 +2117,7 @@ def marshal_CreateInstanceRequest( ] if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) + output["volume_type"] = request.volume_type if request.init_endpoints is not None: output["init_endpoints"] = [ @@ -2084,7 +2387,7 @@ def marshal_SetPrivilegeRequest( output["user_name"] = request.user_name if request.permission is not None: - output["permission"] = str(request.permission) + output["permission"] = request.permission return output diff --git a/scaleway/scaleway/rdb/v1/types.py b/scaleway/scaleway/rdb/v1/types.py index 7ffe6d373..d7bb81ef8 100644 --- a/scaleway/scaleway/rdb/v1/types.py +++ b/scaleway/scaleway/rdb/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -337,32 +337,32 @@ class EngineSetting: Setting type. """ - unit: Optional[str] + unit: Optional[str] = None """ Setting base unit. """ - string_constraint: Optional[str] + string_constraint: Optional[str] = None """ Validation regex for string type settings. """ - int_min: Optional[int] + int_min: Optional[int] = 0 """ Minimum value for int types. """ - int_max: Optional[int] + int_max: Optional[int] = 0 """ Maximum value for int types. """ - float_min: Optional[float] + float_min: Optional[float] = 0.0 """ Minimum value for float types. """ - float_max: Optional[float] + float_max: Optional[float] = 0.0 """ Maximum value for float types. """ @@ -380,20 +380,20 @@ class Endpoint: TCP port of the endpoint. """ - name: Optional[str] + name: Optional[str] = None """ Name of the endpoint. """ - ip: Optional[str] + ip: Optional[str] = None - hostname: Optional[str] + hostname: Optional[str] = None - private_network: Optional[EndpointPrivateNetworkDetails] + private_network: Optional[EndpointPrivateNetworkDetails] = None - load_balancer: Optional[EndpointLoadBalancerDetails] + load_balancer: Optional[EndpointLoadBalancerDetails] = None - direct_access: Optional[EndpointDirectAccessDetails] + direct_access: Optional[EndpointDirectAccessDetails] = None @dataclass @@ -408,9 +408,9 @@ class EndpointSpecPrivateNetwork: UUID of the Private Network to be connected to the Database Instance. """ - service_ip: Optional[str] + service_ip: Optional[str] = None - ipam_config: Optional[EndpointSpecPrivateNetworkIpamConfig] + ipam_config: Optional[EndpointSpecPrivateNetworkIpamConfig] = None @dataclass @@ -425,9 +425,9 @@ class ReadReplicaEndpointSpecPrivateNetwork: UUID of the Private Network to be connected to the Read Replica. """ - service_ip: Optional[str] + service_ip: Optional[str] = None - ipam_config: Optional[ReadReplicaEndpointSpecPrivateNetworkIpamConfig] + ipam_config: Optional[ReadReplicaEndpointSpecPrivateNetworkIpamConfig] = None @dataclass @@ -462,7 +462,7 @@ class EngineVersion: Engine settings available to be set at database initialization. """ - end_of_life: Optional[datetime] + end_of_life: Optional[datetime] = None """ End of life date. """ @@ -485,7 +485,7 @@ class BackupSchedule: Defines whether the backup schedule feature is disabled. """ - next_run_at: Optional[datetime] + next_run_at: Optional[datetime] = None """ Next run of the backup schedule (accurate to 10 minutes). """ @@ -499,18 +499,17 @@ class EncryptionAtRest: @dataclass class InstanceSetting: name: str - value: str @dataclass class LogsPolicy: - max_age_retention: Optional[int] + max_age_retention: Optional[int] = 0 """ Max age (in days) of remote logs to keep on the Database Instance. """ - total_disk_retention: Optional[int] + total_disk_retention: Optional[int] = 0 """ Max disk size of remote logs to keep on the Database Instance. """ @@ -533,22 +532,22 @@ class Maintenance: Indicate if the maintenance can be applied by the user. """ - starts_at: Optional[datetime] + starts_at: Optional[datetime] = None """ Start date of the maintenance window. """ - stops_at: Optional[datetime] + stops_at: Optional[datetime] = None """ End date of the maintenance window. """ - closed_at: Optional[datetime] + closed_at: Optional[datetime] = None """ Closed maintenance date. """ - forced_at: Optional[datetime] + forced_at: Optional[datetime] = None """ Time when Scaleway-side maintenance will be applied. """ @@ -590,20 +589,15 @@ class ReadReplica: @dataclass class UpgradableVersion: id: str - name: str - version: str - minor_version: str @dataclass class Volume: type_: VolumeType - size: int - class_: StorageClass @@ -656,44 +650,37 @@ class NodeTypeVolumeType: @dataclass class SnapshotVolumeType: type_: VolumeType - class_: StorageClass @dataclass class ACLRuleRequest: ip: str - description: str @dataclass class ACLRule: ip: str - protocol: ACLRuleProtocol - direction: ACLRuleDirection - action: ACLRuleAction - description: str - - port: Optional[int] + port: Optional[int] = None @dataclass class EndpointSpec: - load_balancer: Optional[EndpointSpecLoadBalancer] + load_balancer: Optional[EndpointSpecLoadBalancer] = None - private_network: Optional[EndpointSpecPrivateNetwork] + private_network: Optional[EndpointSpecPrivateNetwork] = None @dataclass class ReadReplicaEndpointSpec: - direct_access: Optional[ReadReplicaEndpointSpecDirectAccess] + direct_access: Optional[ReadReplicaEndpointSpecDirectAccess] = None - private_network: Optional[ReadReplicaEndpointSpecPrivateNetwork] + private_network: Optional[ReadReplicaEndpointSpecPrivateNetwork] = None @dataclass @@ -723,47 +710,47 @@ class DatabaseBackup: Status of the backup. """ - size: Optional[int] + instance_name: str """ - Size of the database backup. + Name of the Database Instance of the backup. """ - expires_at: Optional[datetime] + region: ScwRegion """ - Expiration date (must follow the ISO 8601 format). + Region of the database backup. """ - created_at: Optional[datetime] + same_region: bool """ - Creation date (must follow the ISO 8601 format). + Store logical backups in the same region as the source Database Instance. """ - updated_at: Optional[datetime] + size: Optional[int] = 0 """ - Updated date (must follow the ISO 8601 format). + Size of the database backup. """ - instance_name: str + expires_at: Optional[datetime] = None """ - Name of the Database Instance of the backup. + Expiration date (must follow the ISO 8601 format). """ - region: ScwRegion + created_at: Optional[datetime] = None """ - Region of the database backup. + Creation date (must follow the ISO 8601 format). """ - same_region: bool + updated_at: Optional[datetime] = None """ - Store logical backups in the same region as the source Database Instance. + Updated date (must follow the ISO 8601 format). """ - download_url: Optional[str] + download_url: Optional[str] = None """ URL you can download the backup from. """ - download_url_expires_at: Optional[datetime] + download_url_expires_at: Optional[datetime] = None """ Expiration date of the download link. """ @@ -818,7 +805,6 @@ class Database: @dataclass class ListInstanceLogsDetailsResponseInstanceLogDetail: log_name: str - size: int @@ -844,17 +830,17 @@ class InstanceLog: Region the Database Instance is in. """ - download_url: Optional[str] + download_url: Optional[str] = None """ Presigned Object Storage URL to download your log file. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ @@ -882,16 +868,6 @@ class Instance: Organization ID the Database Instance belongs to. """ - created_at: Optional[datetime] - """ - Creation date (must follow the ISO 8601 format). - """ - - volume: Optional[Volume] - """ - Volumes of the Database Instance. - """ - project_id: str """ Project ID the Database Instance belongs to. @@ -927,16 +903,6 @@ class Instance: Defines whether or not High-Availability is enabled. """ - endpoint: Optional[Endpoint] - """ - Endpoint of the Database Instance. - """ - - backup_schedule: Optional[BackupSchedule] - """ - Backup schedule of the Database Instance. - """ - read_replicas: List[ReadReplica] """ Read Replicas of the Database Instance. @@ -967,12 +933,32 @@ class Instance: List of Database Instance maintenance events. """ - logs_policy: Optional[LogsPolicy] + created_at: Optional[datetime] = None + """ + Creation date (must follow the ISO 8601 format). + """ + + volume: Optional[Volume] = None + """ + Volumes of the Database Instance. + """ + + endpoint: Optional[Endpoint] = None + """ + Endpoint of the Database Instance. + """ + + backup_schedule: Optional[BackupSchedule] = None + """ + Backup schedule of the Database Instance. + """ + + logs_policy: Optional[LogsPolicy] = None """ Logs policy of the Database Instance. """ - encryption: Optional[EncryptionAtRest] + encryption: Optional[EncryptionAtRest] = None """ Encryption at rest settings for your Database Instance. """ @@ -1015,16 +1001,6 @@ class NodeType: The Node Type is currently in beta. """ - volume_constraint: Optional[NodeTypeVolumeConstraintSizes] - """ - [deprecated] Node Type volume constraints. - """ - - is_bssd_compatible: Optional[bool] - """ - The Node Type is compliant with Block Storage. - """ - available_volume_types: List[NodeTypeVolumeType] """ Available storage options for the Node Type. @@ -1050,6 +1026,16 @@ class NodeType: Region the Node Type is in. """ + volume_constraint: Optional[NodeTypeVolumeConstraintSizes] = None + """ + [deprecated] Node Type volume constraints. + """ + + is_bssd_compatible: Optional[bool] = False + """ + The Node Type is compliant with Block Storage. + """ + @dataclass class Privilege: @@ -1106,27 +1092,27 @@ class Snapshot: Region of this snapshot. """ - size: Optional[int] + size: Optional[int] = 0 """ Size of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date (must follow the ISO 8601 format). """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Updated date (must follow the ISO 8601 format). """ - volume_type: Optional[SnapshotVolumeType] + volume_type: Optional[SnapshotVolumeType] = None """ Type of volume where data is stored (lssd, bssd or sbs). """ @@ -1170,7 +1156,7 @@ class AddInstanceACLRulesRequest: ACL rules to add to the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1196,7 +1182,7 @@ class AddInstanceSettingsRequest: Settings to add to the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1217,7 +1203,7 @@ class ApplyInstanceMaintenanceRequest: UUID of the Database Instance you want to apply maintenance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1235,12 +1221,12 @@ class CloneInstanceRequest: Name of the Database Instance clone. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - node_type: Optional[str] + node_type: Optional[str] = None """ Node type of the clone. """ @@ -1258,17 +1244,17 @@ class CreateDatabaseBackupRequest: Name of the database you want to back up. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the backup. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ @@ -1286,7 +1272,7 @@ class CreateDatabaseRequest: Name of the database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1299,12 +1285,12 @@ class CreateEndpointRequest: UUID of the Database Instance you to which you want to add an endpoint. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - endpoint_spec: Optional[EndpointSpec] + endpoint_spec: Optional[EndpointSpec] = None """ Specification of the endpoint you want to create. """ @@ -1322,17 +1308,17 @@ class CreateInstanceFromSnapshotRequest: Name of the Database Instance created with the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - is_ha_cluster: Optional[bool] + is_ha_cluster: Optional[bool] = False """ Defines whether or not High-Availability is enabled on the new Database Instance. """ - node_type: Optional[str] + node_type: Optional[str] = None """ The node type used to restore the snapshot. """ @@ -1360,16 +1346,6 @@ class CreateInstanceRequest: Type of node to use for the Database Instance. """ - region: Optional[ScwRegion] - """ - Region to target. If none is passed will use default region from the config. - """ - - name: Optional[str] - """ - Name of the Database Instance. - """ - is_ha_cluster: bool """ Defines whether or not High-Availability is enabled. @@ -1390,34 +1366,44 @@ class CreateInstanceRequest: Defines whether to or not to store logical backups in the same region as the Database Instance. """ - tags: Optional[List[str]] + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + name: Optional[str] = None + """ + Name of the Database Instance. + """ + + tags: Optional[List[str]] = field(default_factory=list) """ Tags to apply to the Database Instance. """ - init_settings: Optional[List[InstanceSetting]] + init_settings: Optional[List[InstanceSetting]] = field(default_factory=list) """ List of engine settings to be set upon Database Instance initialization. """ - volume_type: Optional[VolumeType] + volume_type: Optional[VolumeType] = VolumeType.LSSD """ Type of volume where data is stored (lssd, bssd, ...). """ - init_endpoints: Optional[List[EndpointSpec]] + init_endpoints: Optional[List[EndpointSpec]] = field(default_factory=list) """ One or multiple EndpointSpec used to expose your Database Instance. A load_balancer public endpoint is systematically created. """ - encryption: Optional[EncryptionAtRest] + encryption: Optional[EncryptionAtRest] = None """ Encryption at rest settings for your Database Instance. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -1432,7 +1418,7 @@ class CreateReadReplicaEndpointRequest: Specification of the endpoint you want to create. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1445,17 +1431,17 @@ class CreateReadReplicaRequest: UUID of the Database Instance you want to create a Read Replica from. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - endpoint_spec: Optional[List[ReadReplicaEndpointSpec]] + endpoint_spec: Optional[List[ReadReplicaEndpointSpec]] = field(default_factory=list) """ Specification of the endpoint you want to create. """ - same_zone: Optional[bool] + same_zone: Optional[bool] = False """ Defines whether to create the replica in the same availability zone as the main instance nodes or not. """ @@ -1468,17 +1454,17 @@ class CreateSnapshotRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ @@ -1506,7 +1492,7 @@ class CreateUserRequest: Defines whether the user will have administrative privileges. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1519,7 +1505,7 @@ class DeleteDatabaseBackupRequest: UUID of the database backup to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1537,7 +1523,7 @@ class DeleteDatabaseRequest: Name of the database to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1550,7 +1536,7 @@ class DeleteEndpointRequest: This endpoint can also be used to delete a Read Replica endpoint. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1568,7 +1554,7 @@ class DeleteInstanceACLRulesRequest: IP addresses defined in the ACL rules of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1589,7 +1575,7 @@ class DeleteInstanceRequest: UUID of the Database Instance to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1607,7 +1593,7 @@ class DeleteInstanceSettingsRequest: Settings names to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1628,7 +1614,7 @@ class DeleteReadReplicaRequest: UUID of the Read Replica. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1641,7 +1627,7 @@ class DeleteSnapshotRequest: UUID of the snapshot to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1659,7 +1645,7 @@ class DeleteUserRequest: Name of the user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1672,7 +1658,7 @@ class ExportDatabaseBackupRequest: UUID of the database backup you want to export. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1685,7 +1671,7 @@ class GetDatabaseBackupRequest: UUID of the database backup. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1698,7 +1684,7 @@ class GetEndpointRequest: UUID of the endpoint you want to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1711,7 +1697,7 @@ class GetInstanceCertificateRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1724,7 +1710,7 @@ class GetInstanceLogRequest: UUID of the instance_log you want. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1737,22 +1723,22 @@ class GetInstanceMetricsRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - start_date: Optional[datetime] + start_date: Optional[datetime] = None """ Start date to gather metrics from. """ - end_date: Optional[datetime] + end_date: Optional[datetime] = None """ End date to gather metrics from. """ - metric_name: Optional[str] + metric_name: Optional[str] = None """ Name of the metric to gather. """ @@ -1765,7 +1751,7 @@ class GetInstanceRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1778,7 +1764,7 @@ class GetReadReplicaRequest: UUID of the Read Replica. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1791,7 +1777,7 @@ class GetSnapshotRequest: UUID of the snapshot. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1807,39 +1793,40 @@ class InstanceMetrics: @dataclass class ListDatabaseBackupsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the database backups. """ - order_by: Optional[ListDatabaseBackupsRequestOrderBy] + order_by: Optional[ListDatabaseBackupsRequestOrderBy] = ( + ListDatabaseBackupsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering database backups listing. """ - instance_id: Optional[str] + instance_id: Optional[str] = None """ UUID of the Database Instance. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID of the Organization the database backups belong to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID of the Project the database backups belong to. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -1857,24 +1844,23 @@ class ListDatabaseBackupsResponse: @dataclass class ListDatabaseEnginesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the database engine. """ - version: Optional[str] + version: Optional[str] = None """ Version of the database engine. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -1897,34 +1883,35 @@ class ListDatabasesRequest: UUID of the Database Instance to list the databases of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the database. """ - managed: Optional[bool] + managed: Optional[bool] = False """ Defines whether or not the database is managed. """ - owner: Optional[str] + owner: Optional[str] = None """ User that owns this database. """ - order_by: Optional[ListDatabasesRequestOrderBy] + order_by: Optional[ListDatabasesRequestOrderBy] = ( + ListDatabasesRequestOrderBy.NAME_ASC + ) """ Criteria to use when ordering database listing. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -1947,14 +1934,13 @@ class ListInstanceACLRulesRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -1977,7 +1963,7 @@ class ListInstanceLogsDetailsRequest: UUID of the Database Instance you want logs of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1998,12 +1984,14 @@ class ListInstanceLogsRequest: UUID of the Database Instance you want logs of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListInstanceLogsRequestOrderBy] + order_by: Optional[ListInstanceLogsRequestOrderBy] = ( + ListInstanceLogsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering Database Instance logs listing. """ @@ -2019,44 +2007,45 @@ class ListInstanceLogsResponse: @dataclass class ListInstancesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List Database Instances that have a given tag. """ - name: Optional[str] + name: Optional[str] = None """ Lists Database Instances that match a name pattern. """ - order_by: Optional[ListInstancesRequestOrderBy] + order_by: Optional[ListInstancesRequestOrderBy] = ( + ListInstancesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering Database Instance listings. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Please use project_id instead. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to list the Database Instance of. """ - has_maintenances: Optional[bool] + has_maintenances: Optional[bool] = False """ Filter to only list instances with a scheduled maintenance. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -2079,14 +2068,13 @@ class ListNodeTypesRequest: Defines whether or not to include disabled types. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -2109,26 +2097,26 @@ class ListPrivilegesRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPrivilegesRequestOrderBy] + order_by: Optional[ListPrivilegesRequestOrderBy] = ( + ListPrivilegesRequestOrderBy.USER_NAME_ASC + ) """ Criteria to use when ordering privileges listing. """ - page: Optional[int] - - page_size: Optional[int] - - database_name: Optional[str] + page: Optional[int] = 0 + page_size: Optional[int] = 0 + database_name: Optional[str] = None """ Name of the database. """ - user_name: Optional[str] + user_name: Optional[str] = None """ Name of the user. """ @@ -2149,39 +2137,40 @@ class ListPrivilegesResponse: @dataclass class ListSnapshotsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - order_by: Optional[ListSnapshotsRequestOrderBy] + order_by: Optional[ListSnapshotsRequestOrderBy] = ( + ListSnapshotsRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering snapshot listing. """ - instance_id: Optional[str] + instance_id: Optional[str] = None """ UUID of the Database Instance. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID the snapshots belongs to. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID the snapshots belongs to. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -2204,24 +2193,23 @@ class ListUsersRequest: UUID of the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the user. """ - order_by: Optional[ListUsersRequestOrderBy] + order_by: Optional[ListUsersRequestOrderBy] = ListUsersRequestOrderBy.NAME_ASC """ Criteria to use when requesting user listing. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -2249,7 +2237,7 @@ class MigrateEndpointRequest: UUID of the instance you want to attach the endpoint to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2262,17 +2250,17 @@ class PrepareInstanceLogsRequest: UUID of the Database Instance you want logs of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - start_date: Optional[datetime] + start_date: Optional[datetime] = None """ Start datetime of your log. (RFC 3339 format). """ - end_date: Optional[datetime] + end_date: Optional[datetime] = None """ End datetime of your log. (RFC 3339 format). """ @@ -2293,7 +2281,7 @@ class PromoteReadReplicaRequest: UUID of the Read Replica. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2306,12 +2294,12 @@ class PurgeInstanceLogsRequest: UUID of the Database Instance you want logs of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - log_name: Optional[str] + log_name: Optional[str] = None """ Given log name to purge. """ @@ -2324,7 +2312,7 @@ class RenewInstanceCertificateRequest: UUID of the Database Instance you want logs of. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2337,7 +2325,7 @@ class ResetReadReplicaRequest: UUID of the Read Replica. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2350,7 +2338,7 @@ class RestartInstanceRequest: UUID of the Database Instance you want to restart. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2368,12 +2356,12 @@ class RestoreDatabaseBackupRequest: Defines the Database Instance where the backup has to be restored. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - database_name: Optional[str] + database_name: Optional[str] = None """ Defines the destination database to restore into a specified database (the default destination is set to the origin database of the backup). """ @@ -2391,7 +2379,7 @@ class SetInstanceACLRulesRequest: ACL rules to define for the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2417,7 +2405,7 @@ class SetInstanceSettingsRequest: Settings to define for the Database Instance. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -2448,12 +2436,12 @@ class SetPrivilegeRequest: Name of the user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - permission: Optional[Permission] + permission: Optional[Permission] = Permission.READONLY """ Permission to set (Read, Read/Write, All, Custom). """ @@ -2466,17 +2454,17 @@ class UpdateDatabaseBackupRequest: UUID of the database backup to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Backup. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ @@ -2489,47 +2477,47 @@ class UpdateInstanceRequest: UUID of the Database Instance to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - backup_schedule_frequency: Optional[int] + backup_schedule_frequency: Optional[int] = 0 """ In hours. """ - backup_schedule_retention: Optional[int] + backup_schedule_retention: Optional[int] = 0 """ In days. """ - is_backup_schedule_disabled: Optional[bool] + is_backup_schedule_disabled: Optional[bool] = False """ Defines whether or not the backup schedule is disabled. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of a Database Instance. """ - logs_policy: Optional[LogsPolicy] + logs_policy: Optional[LogsPolicy] = None """ Logs policy of the Database Instance. """ - backup_same_region: Optional[bool] + backup_same_region: Optional[bool] = False """ Store logical backups in the same region as the Database Instance. """ - backup_schedule_start_hour: Optional[int] + backup_schedule_start_hour: Optional[int] = 0 """ Defines the start time of the autobackup. """ @@ -2542,17 +2530,17 @@ class UpdateSnapshotRequest: UUID of the snapshot to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the snapshot. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date (must follow the ISO 8601 format). """ @@ -2570,17 +2558,17 @@ class UpdateUserRequest: Name of the database user. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - password: Optional[str] + password: Optional[str] = None """ Password of the database user. Password must be between 8 and 128 characters, contain at least one digit, one uppercase, one lowercase and one special character. """ - is_admin: Optional[bool] + is_admin: Optional[bool] = False """ Defines whether or not this user got administrative privileges. """ @@ -2593,21 +2581,21 @@ class UpgradeInstanceRequest: UUID of the Database Instance you want to upgrade. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - node_type: Optional[str] + node_type: Optional[str] = None - enable_ha: Optional[bool] + enable_ha: Optional[bool] = False - volume_size: Optional[int] + volume_size: Optional[int] = 0 - volume_type: Optional[VolumeType] + volume_type: Optional[VolumeType] = VolumeType.LSSD - upgradable_version_id: Optional[str] + upgradable_version_id: Optional[str] = None - major_upgrade_workflow: Optional[UpgradeInstanceRequestMajorUpgradeWorkflow] + major_upgrade_workflow: Optional[UpgradeInstanceRequestMajorUpgradeWorkflow] = None - enable_encryption: Optional[bool] + enable_encryption: Optional[bool] = False diff --git a/scaleway/scaleway/redis/v1/marshalling.py b/scaleway/scaleway/redis/v1/marshalling.py index 7f9727b06..ace2f1d01 100644 --- a/scaleway/scaleway/redis/v1/marshalling.py +++ b/scaleway/scaleway/redis/v1/marshalling.py @@ -13,6 +13,10 @@ resolve_one_of, ) from .types import ( + AvailableClusterSettingPropertyType, + ClusterStatus, + NodeTypeStock, + PrivateNetworkProvisioningMode, ACLRule, PrivateNetwork, PublicNetwork, @@ -60,6 +64,8 @@ def unmarshal_ACLRule(data: Any) -> ACLRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("ip_cidr", None) if field is not None: @@ -87,18 +93,26 @@ def unmarshal_PrivateNetwork(data: Any) -> PrivateNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("service_ips", None) if field is not None: args["service_ips"] = field + else: + args["service_ips"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("provisioning_mode", None) if field is not None: args["provisioning_mode"] = field + else: + args["provisioning_mode"] = PrivateNetworkProvisioningMode.STATIC return PrivateNetwork(**args) @@ -125,14 +139,20 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: field = data.get("port", None) if field is not None: args["port"] = field + else: + args["port"] = 0 field = data.get("ips", None) if field is not None: args["ips"] = field + else: + args["ips"] = field(default_factory=list) field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("private_network", None) if field is not None: @@ -160,10 +180,14 @@ def unmarshal_ClusterSetting(data: Any) -> ClusterSetting: field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None return ClusterSetting(**args) @@ -179,46 +203,66 @@ def unmarshal_Cluster(data: Any) -> Cluster: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ClusterStatus.UNKNOWN field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("endpoints", None) if field is not None: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("node_type", None) if field is not None: args["node_type"] = field + else: + args["node_type"] = None field = data.get("tls_enabled", None) if field is not None: args["tls_enabled"] = field + else: + args["tls_enabled"] = False field = data.get("cluster_settings", None) if field is not None: args["cluster_settings"] = ( [unmarshal_ClusterSetting(v) for v in field] if field is not None else None ) + else: + args["cluster_settings"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -237,22 +281,32 @@ def unmarshal_Cluster(data: Any) -> Cluster: args["acl_rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["acl_rules"] = field(default_factory=list) field = data.get("cluster_size", None) if field is not None: args["cluster_size"] = field + else: + args["cluster_size"] = 0 field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("user_name", None) if field is not None: args["user_name"] = field + else: + args["user_name"] = None field = data.get("upgradable_versions", None) if field is not None: args["upgradable_versions"] = field + else: + args["upgradable_versions"] = field(default_factory=list) return Cluster(**args) @@ -270,10 +324,14 @@ def unmarshal_AddAclRulesResponse(data: Any) -> AddAclRulesResponse: args["acl_rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["acl_rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return AddAclRulesResponse(**args) @@ -291,10 +349,14 @@ def unmarshal_AddEndpointsResponse(data: Any) -> AddEndpointsResponse: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return AddEndpointsResponse(**args) @@ -312,6 +374,8 @@ def unmarshal_ClusterMetricsResponse(data: Any) -> ClusterMetricsResponse: args["timeseries"] = ( [unmarshal_TimeSeries(v) for v in field] if field is not None else None ) + else: + args["timeseries"] = field(default_factory=list) return ClusterMetricsResponse(**args) @@ -329,6 +393,8 @@ def unmarshal_ClusterSettingsResponse(data: Any) -> ClusterSettingsResponse: args["settings"] = ( [unmarshal_ClusterSetting(v) for v in field] if field is not None else None ) + else: + args["settings"] = field(default_factory=list) return ClusterSettingsResponse(**args) @@ -344,18 +410,26 @@ def unmarshal_AvailableClusterSetting(data: Any) -> AvailableClusterSetting: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = AvailableClusterSettingPropertyType.UNKNOWN field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("deprecated", None) if field is not None: args["deprecated"] = field + else: + args["deprecated"] = False field = data.get("default_value", None) if field is not None: @@ -367,13 +441,13 @@ def unmarshal_AvailableClusterSetting(data: Any) -> AvailableClusterSetting: if field is not None: args["max_value"] = field else: - args["max_value"] = None + args["max_value"] = 0 field = data.get("min_value", None) if field is not None: args["min_value"] = field else: - args["min_value"] = None + args["min_value"] = 0 field = data.get("regex", None) if field is not None: @@ -395,6 +469,8 @@ def unmarshal_ClusterVersion(data: Any) -> ClusterVersion: field = data.get("version", None) if field is not None: args["version"] = field + else: + args["version"] = None field = data.get("available_settings", None) if field is not None: @@ -403,14 +479,20 @@ def unmarshal_ClusterVersion(data: Any) -> ClusterVersion: if field is not None else None ) + else: + args["available_settings"] = field(default_factory=list) field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("end_of_life_at", None) if field is not None: @@ -436,10 +518,14 @@ def unmarshal_ListClusterVersionsResponse(data: Any) -> ListClusterVersionsRespo args["versions"] = ( [unmarshal_ClusterVersion(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListClusterVersionsResponse(**args) @@ -457,10 +543,14 @@ def unmarshal_ListClustersResponse(data: Any) -> ListClustersResponse: args["clusters"] = ( [unmarshal_Cluster(v) for v in field] if field is not None else None ) + else: + args["clusters"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListClustersResponse(**args) @@ -476,34 +566,50 @@ def unmarshal_NodeType(data: Any) -> NodeType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("stock_status", None) if field is not None: args["stock_status"] = field + else: + args["stock_status"] = NodeTypeStock.UNKNOWN field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("vcpus", None) if field is not None: args["vcpus"] = field + else: + args["vcpus"] = 0 field = data.get("memory", None) if field is not None: args["memory"] = field + else: + args["memory"] = 0 field = data.get("disabled", None) if field is not None: args["disabled"] = field + else: + args["disabled"] = False field = data.get("beta", None) if field is not None: args["beta"] = field + else: + args["beta"] = False field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return NodeType(**args) @@ -521,10 +627,14 @@ def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: args["node_types"] = ( [unmarshal_NodeType(v) for v in field] if field is not None else None ) + else: + args["node_types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNodeTypesResponse(**args) @@ -542,6 +652,8 @@ def unmarshal_SetAclRulesResponse(data: Any) -> SetAclRulesResponse: args["acl_rules"] = ( [unmarshal_ACLRule(v) for v in field] if field is not None else None ) + else: + args["acl_rules"] = field(default_factory=list) return SetAclRulesResponse(**args) @@ -559,6 +671,8 @@ def unmarshal_SetEndpointsResponse(data: Any) -> SetEndpointsResponse: args["endpoints"] = ( [unmarshal_Endpoint(v) for v in field] if field is not None else None ) + else: + args["endpoints"] = field(default_factory=list) return SetEndpointsResponse(**args) @@ -711,7 +825,9 @@ def marshal_CreateClusterRequest( output["node_type"] = request.node_type if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name diff --git a/scaleway/scaleway/redis/v1/types.py b/scaleway/scaleway/redis/v1/types.py index a4a9c8ea2..8568790ca 100644 --- a/scaleway/scaleway/redis/v1/types.py +++ b/scaleway/scaleway/redis/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -115,7 +115,7 @@ class EndpointSpecPrivateNetworkSpec: Endpoint IPv4 address with a CIDR notation. You must provide at least one IPv4 per node. """ - ipam_config: Optional[EndpointSpecPrivateNetworkSpecIpamConfig] + ipam_config: Optional[EndpointSpecPrivateNetworkSpecIpamConfig] = None """ Automated configuration of your Private Network endpoint with Scaleway IPAM service. """ @@ -148,22 +148,22 @@ class AvailableClusterSetting: Defines whether or not the setting is deprecated. """ - default_value: Optional[str] + default_value: Optional[str] = None """ Default value of the setting. """ - max_value: Optional[int] + max_value: Optional[int] = 0 """ Optional maximum value of the setting. """ - min_value: Optional[int] + min_value: Optional[int] = 0 """ Optional minimum value of the setting. """ - regex: Optional[str] + regex: Optional[str] = None """ Optional validation rule of the setting. """ @@ -176,12 +176,12 @@ class ACLRule: ID of the rule. """ - ip_cidr: Optional[str] + ip_cidr: Optional[str] = None """ IPv4 network address of the rule. """ - description: Optional[str] + description: Optional[str] = None """ Description of the rule. """ @@ -217,9 +217,9 @@ class Endpoint: UUID of the endpoint. """ - private_network: Optional[PrivateNetwork] + private_network: Optional[PrivateNetwork] = None - public_network: Optional[PublicNetwork] + public_network: Optional[PublicNetwork] = None @dataclass @@ -237,9 +237,9 @@ class ACLRuleSpec: @dataclass class EndpointSpec: - private_network: Optional[EndpointSpecPrivateNetworkSpec] + private_network: Optional[EndpointSpecPrivateNetworkSpec] = None - public_network: Optional[EndpointSpecPublicNetworkSpec] + public_network: Optional[EndpointSpecPublicNetworkSpec] = None @dataclass @@ -264,7 +264,7 @@ class ClusterVersion: Zone of the Redis™ Database Instance. """ - end_of_life_at: Optional[datetime] + end_of_life_at: Optional[datetime] = None """ Date of End of Life. """ @@ -322,16 +322,6 @@ class Cluster: List of Database Instance settings. """ - created_at: Optional[datetime] - """ - Creation date (Format ISO 8601). - """ - - updated_at: Optional[datetime] - """ - Update date (Format ISO 8601). - """ - acl_rules: List[ACLRule] """ List of ACL rules. @@ -357,6 +347,16 @@ class Cluster: List of engine versions the Database Instance can upgrade to. """ + created_at: Optional[datetime] = None + """ + Creation date (Format ISO 8601). + """ + + updated_at: Optional[datetime] = None + """ + Update date (Format ISO 8601). + """ + @dataclass class NodeType: @@ -413,7 +413,7 @@ class AddAclRulesRequest: ACLs rules to add to the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -444,7 +444,7 @@ class AddClusterSettingsRequest: Settings to add to the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -462,7 +462,7 @@ class AddEndpointsRequest: Endpoints to add to the Database Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -509,57 +509,57 @@ class CreateClusterRequest: Type of node to use for the Database Instance. """ - zone: Optional[ScwZone] + user_name: str """ - Zone to target. If none is passed will use default zone from the config. + Name of the user created upon Database Instance creation. """ - project_id: Optional[str] + password: str """ - Project ID in which to create the Database Instance. + Password of the user. """ - name: Optional[str] + tls_enabled: bool """ - Name of the Database Instance. + Defines whether or not TLS is enabled. """ - tags: Optional[List[str]] + zone: Optional[ScwZone] = None """ - Tags to apply to the Database Instance. + Zone to target. If none is passed will use default zone from the config. """ - user_name: str + project_id: Optional[str] = None """ - Name of the user created upon Database Instance creation. + Project ID in which to create the Database Instance. """ - password: str + name: Optional[str] = None """ - Password of the user. + Name of the Database Instance. """ - tls_enabled: bool + tags: Optional[List[str]] = field(default_factory=list) """ - Defines whether or not TLS is enabled. + Tags to apply to the Database Instance. """ - cluster_size: Optional[int] + cluster_size: Optional[int] = 0 """ Number of nodes in the Redis™ cluster. """ - acl_rules: Optional[List[ACLRuleSpec]] + acl_rules: Optional[List[ACLRuleSpec]] = field(default_factory=list) """ List of ACLRuleSpec used to secure your publicly exposed cluster. """ - endpoints: Optional[List[EndpointSpec]] + endpoints: Optional[List[EndpointSpec]] = field(default_factory=list) """ Zero or multiple EndpointSpec used to expose your cluster publicly and inside private networks. If no EndpoindSpec is given the cluster will be publicly exposed by default. """ - cluster_settings: Optional[List[ClusterSetting]] + cluster_settings: Optional[List[ClusterSetting]] = field(default_factory=list) """ List of advanced settings to be set upon Database Instance initialization. """ @@ -572,7 +572,7 @@ class DeleteAclRuleRequest: UUID of the ACL rule you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -585,7 +585,7 @@ class DeleteClusterRequest: UUID of the Database Instance to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -603,7 +603,7 @@ class DeleteClusterSettingRequest: Setting name to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -616,7 +616,7 @@ class DeleteEndpointRequest: UUID of the endpoint you want to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -629,7 +629,7 @@ class GetAclRuleRequest: UUID of the ACL rule you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -642,7 +642,7 @@ class GetClusterCertificateRequest: UUID of the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -655,22 +655,22 @@ class GetClusterMetricsRequest: UUID of the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - start_at: Optional[datetime] + start_at: Optional[datetime] = None """ Start date. """ - end_at: Optional[datetime] + end_at: Optional[datetime] = None """ End date. """ - metric_name: Optional[str] + metric_name: Optional[str] = None """ Name of the metric to gather. """ @@ -683,7 +683,7 @@ class GetClusterRequest: UUID of the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -696,7 +696,7 @@ class GetEndpointRequest: UUID of the endpoint you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -719,19 +719,18 @@ class ListClusterVersionsRequest: Defines whether or not to include deprecated Redis™ engine versions. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - version: Optional[str] + version: Optional[str] = None """ List Redis™ engine versions that match a given name pattern. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -749,44 +748,45 @@ class ListClusterVersionsResponse: @dataclass class ListClustersRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter by Database Instance tags. """ - name: Optional[str] + name: Optional[str] = None """ Filter by Database Instance names. """ - order_by: Optional[ListClustersRequestOrderBy] + order_by: Optional[ListClustersRequestOrderBy] = ( + ListClustersRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering the list. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - version: Optional[str] + version: Optional[str] = None """ Filter by Redis™ engine version. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -809,14 +809,13 @@ class ListNodeTypesRequest: Defines whether or not to include disabled types. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -839,16 +838,16 @@ class MigrateClusterRequest: UUID of the Database Instance to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - version: Optional[str] + version: Optional[str] = None - node_type: Optional[str] + node_type: Optional[str] = None - cluster_size: Optional[int] + cluster_size: Optional[int] = 0 @dataclass @@ -858,7 +857,7 @@ class RenewClusterCertificateRequest: UUID of the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -876,7 +875,7 @@ class SetAclRulesRequest: ACLs rules to define for the cluster. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -902,7 +901,7 @@ class SetClusterSettingsRequest: Settings to define for the Database Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -920,7 +919,7 @@ class SetEndpointsRequest: Endpoints to define for the Database Instance. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -941,27 +940,27 @@ class UpdateClusterRequest: UUID of the Database Instance to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Database Instance. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Database Instance tags. """ - user_name: Optional[str] + user_name: Optional[str] = None """ Name of the Database Instance user. """ - password: Optional[str] + password: Optional[str] = None """ Password of the Database Instance user. """ @@ -974,11 +973,11 @@ class UpdateEndpointRequest: UUID of the endpoint you want to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - private_network: Optional[EndpointSpecPrivateNetworkSpec] + private_network: Optional[EndpointSpecPrivateNetworkSpec] = None - public_network: Optional[EndpointSpecPublicNetworkSpec] + public_network: Optional[EndpointSpecPublicNetworkSpec] = None diff --git a/scaleway/scaleway/registry/v1/marshalling.py b/scaleway/scaleway/registry/v1/marshalling.py index 1ac359a95..47ca3b797 100644 --- a/scaleway/scaleway/registry/v1/marshalling.py +++ b/scaleway/scaleway/registry/v1/marshalling.py @@ -10,6 +10,10 @@ resolve_one_of, ) from .types import ( + ImageStatus, + ImageVisibility, + NamespaceStatus, + TagStatus, Image, Namespace, Tag, @@ -33,30 +37,44 @@ def unmarshal_Image(data: Any) -> Image: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("namespace_id", None) if field is not None: args["namespace_id"] = field + else: + args["namespace_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = ImageStatus.UNKNOWN field = data.get("visibility", None) if field is not None: args["visibility"] = field + else: + args["visibility"] = ImageVisibility.VISIBILITY_UNKNOWN field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("status_message", None) if field is not None: @@ -90,50 +108,74 @@ def unmarshal_Namespace(data: Any) -> Namespace: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = NamespaceStatus.UNKNOWN field = data.get("status_message", None) if field is not None: args["status_message"] = field + else: + args["status_message"] = None field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("is_public", None) if field is not None: args["is_public"] = field + else: + args["is_public"] = False field = data.get("size", None) if field is not None: args["size"] = field + else: + args["size"] = 0 field = data.get("image_count", None) if field is not None: args["image_count"] = field + else: + args["image_count"] = 0 field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -161,22 +203,32 @@ def unmarshal_Tag(data: Any) -> Tag: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("image_id", None) if field is not None: args["image_id"] = field + else: + args["image_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = TagStatus.UNKNOWN field = data.get("digest", None) if field is not None: args["digest"] = field + else: + args["digest"] = None field = data.get("created_at", None) if field is not None: @@ -206,10 +258,14 @@ def unmarshal_ListImagesResponse(data: Any) -> ListImagesResponse: args["images"] = ( [unmarshal_Image(v) for v in field] if field is not None else None ) + else: + args["images"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListImagesResponse(**args) @@ -227,10 +283,14 @@ def unmarshal_ListNamespacesResponse(data: Any) -> ListNamespacesResponse: args["namespaces"] = ( [unmarshal_Namespace(v) for v in field] if field is not None else None ) + else: + args["namespaces"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListNamespacesResponse(**args) @@ -246,10 +306,14 @@ def unmarshal_ListTagsResponse(data: Any) -> ListTagsResponse: field = data.get("tags", None) if field is not None: args["tags"] = [unmarshal_Tag(v) for v in field] if field is not None else None + else: + args["tags"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListTagsResponse(**args) @@ -297,7 +361,7 @@ def marshal_UpdateImageRequest( output: Dict[str, Any] = {} if request.visibility is not None: - output["visibility"] = str(request.visibility) + output["visibility"] = request.visibility return output diff --git a/scaleway/scaleway/registry/v1/types.py b/scaleway/scaleway/registry/v1/types.py index e5e425dad..487672162 100644 --- a/scaleway/scaleway/registry/v1/types.py +++ b/scaleway/scaleway/registry/v1/types.py @@ -127,17 +127,17 @@ class Image: List of docker tags of the image. """ - status_message: Optional[str] + status_message: Optional[str] = None """ Details of the image status. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of image creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last update. """ @@ -205,12 +205,12 @@ class Namespace: Region the namespace belongs to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last update. """ @@ -243,12 +243,12 @@ class Tag: Hash of the tag content. Several tags of a same image may have the same digest. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last update. """ @@ -266,19 +266,19 @@ class CreateNamespaceRequest: Defines whether or not namespace is public. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the namespace. """ - project_id: Optional[str] + project_id: Optional[str] = None - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -288,7 +288,7 @@ class DeleteImageRequest: UUID of the image. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -301,7 +301,7 @@ class DeleteNamespaceRequest: UUID of the namespace. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -314,12 +314,12 @@ class DeleteTagRequest: UUID of the tag. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - force: Optional[bool] + force: Optional[bool] = False """ If two tags share the same digest the deletion will fail unless this parameter is set to true (deprecated). """ @@ -332,7 +332,7 @@ class GetImageRequest: UUID of the image. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -345,7 +345,7 @@ class GetNamespaceRequest: UUID of the namespace. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -358,7 +358,7 @@ class GetTagRequest: UUID of the tag. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -366,42 +366,44 @@ class GetTagRequest: @dataclass class ListImagesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to display. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to display. """ - order_by: Optional[ListImagesRequestOrderBy] + order_by: Optional[ListImagesRequestOrderBy] = ( + ListImagesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering image listings. Possible values are `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`, `region`, `status_asc` and `status_desc`. The default value is `created_at_asc`. """ - namespace_id: Optional[str] + namespace_id: Optional[str] = None """ Filter by the namespace ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by the image name (exact match). """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ @@ -422,37 +424,39 @@ class ListImagesResponse: @dataclass class ListNamespacesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to display. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to display. """ - order_by: Optional[ListNamespacesRequestOrderBy] + order_by: Optional[ListNamespacesRequestOrderBy] = ( + ListNamespacesRequestOrderBy.CREATED_AT_ASC + ) """ Criteria to use when ordering namespace listings. Possible values are `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`, `region`, `status_asc` and `status_desc`. The default value is `created_at_asc`. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID. """ - name: Optional[str] + name: Optional[str] = None """ Filter by the namespace name (exact match). """ @@ -478,27 +482,27 @@ class ListTagsRequest: UUID of the image. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ A positive integer to choose the page to display. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ A positive integer lower or equal to 100 to select the number of items to display. """ - order_by: Optional[ListTagsRequestOrderBy] + order_by: Optional[ListTagsRequestOrderBy] = ListTagsRequestOrderBy.CREATED_AT_ASC """ Criteria to use when ordering tag listings. Possible values are `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`, `region`, `status_asc` and `status_desc`. The default value is `created_at_asc`. """ - name: Optional[str] + name: Optional[str] = None """ Filter by the tag name (exact match). """ @@ -524,12 +528,12 @@ class UpdateImageRequest: ID of the image to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - visibility: Optional[ImageVisibility] + visibility: Optional[ImageVisibility] = ImageVisibility.VISIBILITY_UNKNOWN """ Set to `public` to allow the image to be pulled without authentication. Else, set to `private`. Set to `inherit` to keep the same visibility configuration as the namespace. """ @@ -542,17 +546,17 @@ class UpdateNamespaceRequest: ID of the namespace to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Namespace description. """ - is_public: Optional[bool] + is_public: Optional[bool] = False """ Defines whether or not the namespace is public. """ diff --git a/scaleway/scaleway/secret/v1beta1/marshalling.py b/scaleway/scaleway/secret/v1beta1/marshalling.py index 3bf186c9f..161afc1b3 100644 --- a/scaleway/scaleway/secret/v1beta1/marshalling.py +++ b/scaleway/scaleway/secret/v1beta1/marshalling.py @@ -6,8 +6,11 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + EphemeralPolicyAction, Product, + SecretStatus, SecretType, + SecretVersionStatus, EphemeralProperties, SecretVersion, EphemeralPolicy, @@ -40,6 +43,8 @@ def unmarshal_EphemeralProperties(data: Any) -> EphemeralProperties: field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = EphemeralPolicyAction.UNKNOWN_ACTION field = data.get("expires_at", None) if field is not None: @@ -51,7 +56,7 @@ def unmarshal_EphemeralProperties(data: Any) -> EphemeralProperties: if field is not None: args["expires_once_accessed"] = field else: - args["expires_once_accessed"] = None + args["expires_once_accessed"] = False return EphemeralProperties(**args) @@ -67,18 +72,26 @@ def unmarshal_SecretVersion(data: Any) -> SecretVersion: field = data.get("revision", None) if field is not None: args["revision"] = field + else: + args["revision"] = 0 field = data.get("secret_id", None) if field is not None: args["secret_id"] = field + else: + args["secret_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = SecretVersionStatus.UNKNOWN_STATUS field = data.get("latest", None) if field is not None: args["latest"] = field + else: + args["latest"] = False field = data.get("created_at", None) if field is not None: @@ -132,6 +145,8 @@ def unmarshal_EphemeralPolicy(data: Any) -> EphemeralPolicy: field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = EphemeralPolicyAction.UNKNOWN_ACTION field = data.get("time_to_live", None) if field is not None: @@ -143,7 +158,7 @@ def unmarshal_EphemeralPolicy(data: Any) -> EphemeralPolicy: if field is not None: args["expires_once_accessed"] = field else: - args["expires_once_accessed"] = None + args["expires_once_accessed"] = False return EphemeralPolicy(**args) @@ -159,50 +174,74 @@ def unmarshal_Secret(data: Any) -> Secret: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_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"] = SecretStatus.UNKNOWN_STATUS field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("version_count", None) if field is not None: args["version_count"] = field + else: + args["version_count"] = 0 field = data.get("managed", None) if field is not None: args["managed"] = field + else: + args["managed"] = False field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = SecretType.UNKNOWN_TYPE field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None field = data.get("used_by", None) if field is not None: args["used_by"] = [Product(v) for v in field] if field is not None else None + else: + args["used_by"] = field(default_factory=list) field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -256,24 +295,32 @@ def unmarshal_AccessSecretVersionResponse(data: Any) -> AccessSecretVersionRespo field = data.get("secret_id", None) if field is not None: args["secret_id"] = field + else: + args["secret_id"] = None field = data.get("revision", None) if field is not None: args["revision"] = field + else: + args["revision"] = 0 field = data.get("data", None) if field is not None: args["data"] = field + else: + args["data"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = SecretType.UNKNOWN_TYPE field = data.get("data_crc32", None) if field is not None: args["data_crc32"] = field else: - args["data_crc32"] = None + args["data_crc32"] = 0 return AccessSecretVersionResponse(**args) @@ -304,22 +351,32 @@ def unmarshal_BrowseSecretsResponseItemSecretDetails( field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = None field = data.get("version_count", None) if field is not None: args["version_count"] = field + else: + args["version_count"] = None field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("ephemeral_policy", None) if field is not None: @@ -341,6 +398,8 @@ def unmarshal_BrowseSecretsResponseItem(data: Any) -> BrowseSecretsResponseItem: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("created_at", None) if field is not None: @@ -384,14 +443,20 @@ def unmarshal_BrowseSecretsResponse(data: Any) -> BrowseSecretsResponse: if field is not None else None ) + else: + args["items"] = field(default_factory=list) field = data.get("current_path", None) if field is not None: args["current_path"] = field + else: + args["current_path"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return BrowseSecretsResponse(**args) @@ -407,10 +472,14 @@ def unmarshal_ListSecretTypesResponse(data: Any) -> ListSecretTypesResponse: field = data.get("types", None) if field is not None: args["types"] = [SecretType(v) for v in field] if field is not None else None + else: + args["types"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSecretTypesResponse(**args) @@ -428,10 +497,14 @@ def unmarshal_ListSecretVersionsResponse(data: Any) -> ListSecretVersionsRespons args["versions"] = ( [unmarshal_SecretVersion(v) for v in field] if field is not None else None ) + else: + args["versions"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSecretVersionsResponse(**args) @@ -449,10 +522,14 @@ def unmarshal_ListSecretsResponse(data: Any) -> ListSecretsResponse: args["secrets"] = ( [unmarshal_Secret(v) for v in field] if field is not None else None ) + else: + args["secrets"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListSecretsResponse(**args) @@ -468,10 +545,14 @@ def unmarshal_ListTagsResponse(data: Any) -> ListTagsResponse: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListTagsResponse(**args) @@ -483,7 +564,7 @@ def marshal_AddSecretOwnerRequest( output: Dict[str, Any] = {} if request.product is not None: - output["product"] = str(request.product) + output["product"] = request.product return output @@ -495,7 +576,7 @@ def marshal_EphemeralPolicy( output: Dict[str, Any] = {} if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.time_to_live is not None: output["time_to_live"] = request.time_to_live @@ -519,7 +600,9 @@ def marshal_CreateSecretRequest( output["protected"] = request.protected if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -528,7 +611,7 @@ def marshal_CreateSecretRequest( output["description"] = request.description if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.path is not None: output["path"] = request.path @@ -598,7 +681,7 @@ def marshal_EphemeralProperties( output: Dict[str, Any] = {} if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.expires_at is not None: output["expires_at"] = request.expires_at.isoformat() diff --git a/scaleway/scaleway/secret/v1beta1/types.py b/scaleway/scaleway/secret/v1beta1/types.py index aa5423e89..aefb41692 100644 --- a/scaleway/scaleway/secret/v1beta1/types.py +++ b/scaleway/scaleway/secret/v1beta1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -96,12 +96,12 @@ class EphemeralPolicy: See the `EphemeralPolicy.Action` enum for a description of values. """ - time_to_live: Optional[str] + time_to_live: Optional[str] = None """ Time frame, from one second and up to one year, during which the secret's versions are valid. """ - expires_once_accessed: Optional[bool] + expires_once_accessed: Optional[bool] = False """ Returns `true` if the version expires after a single user access. """ @@ -115,16 +115,11 @@ class BrowseSecretsResponseItemFolderDetails: @dataclass class BrowseSecretsResponseItemSecretDetails: id: str - tags: List[str] - version_count: int - protected: bool - type_: SecretType - - ephemeral_policy: Optional[EphemeralPolicy] + ephemeral_policy: Optional[EphemeralPolicy] = None @dataclass @@ -134,12 +129,12 @@ class EphemeralProperties: See `EphemeralPolicy.Action` enum for a description of values. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ (Optional.) If not specified, the version does not have an expiration date. """ - expires_once_accessed: Optional[bool] + expires_once_accessed: Optional[bool] = False """ (Optional.) If not specified, the version can be accessed an unlimited amount of times. """ @@ -148,14 +143,11 @@ class EphemeralProperties: @dataclass class BrowseSecretsResponseItem: name: str + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + secret: Optional[BrowseSecretsResponseItemSecretDetails] = None - created_at: Optional[datetime] - - updated_at: Optional[datetime] - - secret: Optional[BrowseSecretsResponseItemSecretDetails] - - folder: Optional[BrowseSecretsResponseItemFolderDetails] + folder: Optional[BrowseSecretsResponseItemFolderDetails] = None @dataclass @@ -184,32 +176,32 @@ class SecretVersion: Returns `true` if the version is the latest. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the version's creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update of the version. """ - deleted_at: Optional[datetime] + deleted_at: Optional[datetime] = None """ Date and time of the version's deletion. """ - description: Optional[str] + description: Optional[str] = None """ Description of the version. """ - ephemeral_properties: Optional[EphemeralProperties] + ephemeral_properties: Optional[EphemeralProperties] = None """ Returns the version's expiration date, whether it expires after being accessed once, and the action to perform (disable or delete) once the version expires. """ - deletion_requested_at: Optional[datetime] + deletion_requested_at: Optional[datetime] = None """ Returns the time at which deletion was requested. """ @@ -278,32 +270,32 @@ class Secret: Region of the secret. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the secret's creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update of the secret. """ - description: Optional[str] + description: Optional[str] = None """ Updated description of the secret. """ - ephemeral_policy: Optional[EphemeralPolicy] + ephemeral_policy: Optional[EphemeralPolicy] = None """ (Optional.) Policy that defines whether/when a secret's versions expire. By default, the policy is applied to all the secret's versions. """ - deletion_requested_at: Optional[datetime] + deletion_requested_at: Optional[datetime] = None """ Returns the time at which deletion was requested. """ - key_id: Optional[str] + key_id: Optional[str] = None """ (Optional.) The Scaleway Key Manager key ID used to encrypt and decrypt secret versions. """ @@ -329,12 +321,12 @@ class AccessSecretVersionByPathRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ @@ -355,7 +347,7 @@ class AccessSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -383,7 +375,7 @@ class AccessSecretVersionResponse: See the `Secret.Type` enum for a description of values. """ - data_crc32: Optional[int] + data_crc32: Optional[int] = 0 """ This field is only available if a CRC32 was supplied during the creation of the version. """ @@ -396,12 +388,12 @@ class AddSecretOwnerRequest: ID of the secret. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - product: Optional[Product] + product: Optional[Product] = Product.UNKNOWN_PRODUCT """ See `Product` enum for description of values. """ @@ -427,28 +419,27 @@ class BrowseSecretsRequest: Filter secrets and folders for a given prefix (default /). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID (optional). """ - order_by: Optional[BrowseSecretsRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - tags: Optional[List[str]] + order_by: Optional[BrowseSecretsRequestOrderBy] = ( + BrowseSecretsRequestOrderBy.NAME_ASC + ) + page: Optional[int] = 0 + page_size: Optional[int] = 0 + tags: Optional[List[str]] = field(default_factory=list) """ Filter secrets by tags. """ - type_: Optional[SecretType] + type_: Optional[SecretType] = SecretType.UNKNOWN_TYPE """ Filter by secret type (optional). """ @@ -484,42 +475,42 @@ class CreateSecretRequest: A protected secret cannot be deleted. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project containing the secret. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of the secret's tags. """ - description: Optional[str] + description: Optional[str] = None """ Description of the secret. """ - type_: Optional[SecretType] + type_: Optional[SecretType] = SecretType.UNKNOWN_TYPE """ (Optional.) See the `Secret.Type` enum for a description of values. If not specified, the type is `Opaque`. """ - path: Optional[str] + path: Optional[str] = None """ (Optional.) Location of the secret in the directory structure. If not specified, the path is `/`. """ - ephemeral_policy: Optional[EphemeralPolicy] + ephemeral_policy: Optional[EphemeralPolicy] = None """ (Optional.) Policy that defines whether/when a secret's versions expire. By default, the policy is applied to all the secret's versions. """ - key_id: Optional[str] + key_id: Optional[str] = None """ (Optional.) The Scaleway Key Manager key ID will be used to encrypt and decrypt secret versions. If not specified, Secret Manager will use a Key Manager internal key. """ @@ -537,22 +528,22 @@ class CreateSecretVersionRequest: The base64-encoded secret payload of the version. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the version. """ - disable_previous: Optional[bool] + disable_previous: Optional[bool] = False """ (Optional.) If there is no previous version or if the previous version was already disabled, does nothing. """ - data_crc32: Optional[int] + data_crc32: Optional[int] = 0 """ If specified, Secret Manager will verify the integrity of the data received against the given CRC32 checksum. An error is returned if the CRC32 does not match. If, however, the CRC32 matches, it will be stored and returned along with the SecretVersion on future access requests. """ @@ -598,7 +589,7 @@ class DeleteSecretRequest: ID of the secret. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -619,7 +610,7 @@ class DeleteSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -640,7 +631,7 @@ class DisableSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -661,7 +652,7 @@ class EnableSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -674,7 +665,7 @@ class GetSecretRequest: ID of the secret. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -695,7 +686,7 @@ class GetSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -703,19 +694,18 @@ class GetSecretVersionRequest: @dataclass class ListSecretTypesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -738,16 +728,14 @@ class ListSecretVersionsRequest: ID of the secret. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] - - status: Optional[List[SecretVersionStatus]] + page: Optional[int] = 0 + page_size: Optional[int] = 0 + status: Optional[List[SecretVersionStatus]] = field(default_factory=list) """ Filter results by status. """ @@ -773,48 +761,45 @@ class ListSecretsRequest: Filter by whether the secret was scheduled for deletion / not scheduled for deletion. By default, it will display only not scheduled for deletion secrets. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by Organization ID (optional). """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by Project ID (optional). """ - order_by: Optional[ListSecretsRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - tags: Optional[List[str]] + order_by: Optional[ListSecretsRequestOrderBy] = ListSecretsRequestOrderBy.NAME_ASC + page: Optional[int] = 0 + page_size: Optional[int] = 0 + tags: Optional[List[str]] = field(default_factory=list) """ List of tags to filter on (optional). """ - name: Optional[str] + name: Optional[str] = None """ Filter by secret name (optional). """ - path: Optional[str] + path: Optional[str] = None """ Filter by exact path (optional). """ - ephemeral: Optional[bool] + ephemeral: Optional[bool] = False """ Filter by ephemeral / not ephemeral (optional). """ - type_: Optional[SecretType] + type_: Optional[SecretType] = SecretType.UNKNOWN_TYPE """ Filter by secret type (optional). """ @@ -835,19 +820,18 @@ class ListSecretsResponse: @dataclass class ListTagsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project to target. """ - page: Optional[int] - - page_size: Optional[int] + page: Optional[int] = 0 + page_size: Optional[int] = 0 @dataclass @@ -870,7 +854,7 @@ class ProtectSecretRequest: ID of the secret to enable secret protection for. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -879,8 +863,7 @@ class ProtectSecretRequest: @dataclass class RestoreSecretRequest: secret_id: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -889,10 +872,8 @@ class RestoreSecretRequest: @dataclass class RestoreSecretVersionRequest: secret_id: str - revision: str - - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -913,7 +894,7 @@ class UnprotectSecretRequest: ID of the secret to disable secret protection for. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -926,32 +907,32 @@ class UpdateSecretRequest: ID of the secret. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Secret's updated name (optional). """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Secret's updated list of tags (optional). """ - description: Optional[str] + description: Optional[str] = None """ Description of the secret. """ - path: Optional[str] + path: Optional[str] = None """ (Optional.) Location of the folder in the directory structure. If not specified, the path is `/`. """ - ephemeral_policy: Optional[EphemeralPolicy] + ephemeral_policy: Optional[EphemeralPolicy] = None """ (Optional.) Policy that defines whether/when a secret's versions expire. """ @@ -972,17 +953,17 @@ class UpdateSecretVersionRequest: - "latest_enabled" (the latest enabled revision). """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Description of the version. """ - ephemeral_properties: Optional[EphemeralProperties] + ephemeral_properties: Optional[EphemeralProperties] = None """ (Optional.) Properties that defines the version's expiration date, whether it expires after being accessed once, and the action to perform (disable or delete) once the version expires. """ diff --git a/scaleway/scaleway/serverless_sqldb/v1alpha1/marshalling.py b/scaleway/scaleway/serverless_sqldb/v1alpha1/marshalling.py index 13a841b17..29f5be0eb 100644 --- a/scaleway/scaleway/serverless_sqldb/v1alpha1/marshalling.py +++ b/scaleway/scaleway/serverless_sqldb/v1alpha1/marshalling.py @@ -6,6 +6,8 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + DatabaseBackupStatus, + DatabaseStatus, DatabaseBackup, Database, ListDatabaseBackupsResponse, @@ -27,26 +29,38 @@ def unmarshal_DatabaseBackup(data: Any) -> DatabaseBackup: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DatabaseBackupStatus.UNKNOWN_STATUS field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("database_id", None) if field is not None: args["database_id"] = field + else: + args["database_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -64,13 +78,13 @@ def unmarshal_DatabaseBackup(data: Any) -> DatabaseBackup: if field is not None: args["size"] = field else: - args["size"] = None + args["size"] = 0 field = data.get("db_size", None) if field is not None: args["db_size"] = field else: - args["db_size"] = None + args["db_size"] = 0 field = data.get("download_url", None) if field is not None: @@ -100,50 +114,74 @@ def unmarshal_Database(data: Any) -> Database: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["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"] = DatabaseStatus.UNKNOWN_STATUS field = data.get("endpoint", None) if field is not None: args["endpoint"] = field + else: + args["endpoint"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("cpu_min", None) if field is not None: args["cpu_min"] = field + else: + args["cpu_min"] = 0 field = data.get("cpu_max", None) if field is not None: args["cpu_max"] = field + else: + args["cpu_max"] = 0 field = data.get("cpu_current", None) if field is not None: args["cpu_current"] = field + else: + args["cpu_current"] = 0 field = data.get("started", None) if field is not None: args["started"] = field + else: + args["started"] = False field = data.get("engine_major_version", None) if field is not None: args["engine_major_version"] = field + else: + args["engine_major_version"] = 0 field = data.get("created_at", None) if field is not None: @@ -167,10 +205,14 @@ def unmarshal_ListDatabaseBackupsResponse(data: Any) -> ListDatabaseBackupsRespo args["backups"] = ( [unmarshal_DatabaseBackup(v) for v in field] if field is not None else None ) + else: + args["backups"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabaseBackupsResponse(**args) @@ -188,10 +230,14 @@ def unmarshal_ListDatabasesResponse(data: Any) -> ListDatabasesResponse: args["databases"] = ( [unmarshal_Database(v) for v in field] if field is not None else None ) + else: + args["databases"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDatabasesResponse(**args) @@ -212,7 +258,9 @@ def marshal_CreateDatabaseRequest( output["cpu_max"] = request.cpu_max if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.from_backup_id is not None: output["from_backup_id"] = request.from_backup_id diff --git a/scaleway/scaleway/serverless_sqldb/v1alpha1/types.py b/scaleway/scaleway/serverless_sqldb/v1alpha1/types.py index 6ec7e7258..10616c04b 100644 --- a/scaleway/scaleway/serverless_sqldb/v1alpha1/types.py +++ b/scaleway/scaleway/serverless_sqldb/v1alpha1/types.py @@ -88,32 +88,32 @@ class DatabaseBackup: Region of the database backup. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date. """ - expires_at: Optional[datetime] + expires_at: Optional[datetime] = None """ Expiration date. """ - size: Optional[int] + size: Optional[int] = 0 """ Size (in bytes) of the database backup file. """ - db_size: Optional[int] + db_size: Optional[int] = 0 """ Size (in bytes) of the database when backup has been done. """ - download_url: Optional[str] + download_url: Optional[str] = None """ Download URL of the exported database backup. """ - download_url_expires_at: Optional[datetime] + download_url_expires_at: Optional[datetime] = None """ Expiration date of the download URL. """ @@ -181,7 +181,7 @@ class Database: The major version of the underlying database engine. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Creation date. """ @@ -204,17 +204,17 @@ class CreateDatabaseRequest: The maximum number of CPU units for your Serverless SQL Database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ The ID of your Scaleway project. """ - from_backup_id: Optional[str] + from_backup_id: Optional[str] = None """ The ID of the backup to create the database from. """ @@ -227,7 +227,7 @@ class DeleteDatabaseRequest: UUID of the Serverless SQL Database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -240,7 +240,7 @@ class ExportDatabaseBackupRequest: UUID of the Serverless SQL Database backup. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -253,7 +253,7 @@ class GetDatabaseBackupRequest: UUID of the Serverless SQL Database backup. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -266,7 +266,7 @@ class GetDatabaseRequest: UUID of the Serverless SQL DB database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -279,32 +279,34 @@ class ListDatabaseBackupsRequest: Filter by the UUID of the Serverless SQL Database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by the UUID of the Scaleway organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter by the UUID of the Scaleway project. """ - page: Optional[int] + page: Optional[int] = None """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = None """ Page size. """ - order_by: Optional[ListDatabaseBackupsRequestOrderBy] + order_by: Optional[ListDatabaseBackupsRequestOrderBy] = ( + ListDatabaseBackupsRequestOrderBy.CREATED_AT_DESC + ) """ Sorting criteria. One of `created_at_asc`, `created_at_desc`. """ @@ -325,37 +327,39 @@ class ListDatabaseBackupsResponse: @dataclass class ListDatabasesRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter by the UUID of the Scaleway organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ UUID of the Scaleway project. """ - page: Optional[int] + page: Optional[int] = None """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = None """ Page size. """ - name: Optional[str] + name: Optional[str] = None """ Filter by the name of the database. """ - order_by: Optional[ListDatabasesRequestOrderBy] + order_by: Optional[ListDatabasesRequestOrderBy] = ( + ListDatabasesRequestOrderBy.CREATED_AT_ASC + ) """ Sorting criteria. One of `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`. """ @@ -386,7 +390,7 @@ class RestoreDatabaseFromBackupRequest: UUID of the Serverless SQL Database backup to restore. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -399,17 +403,17 @@ class UpdateDatabaseRequest: UUID of the Serverless SQL Database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - cpu_min: Optional[int] + cpu_min: Optional[int] = 0 """ The minimum number of CPU units for your Serverless SQL Database. """ - cpu_max: Optional[int] + cpu_max: Optional[int] = 0 """ The maximum number of CPU units for your Serverless SQL Database. """ diff --git a/scaleway/scaleway/tem/v1alpha1/marshalling.py b/scaleway/scaleway/tem/v1alpha1/marshalling.py index 522b5dec8..9f9565f0d 100644 --- a/scaleway/scaleway/tem/v1alpha1/marshalling.py +++ b/scaleway/scaleway/tem/v1alpha1/marshalling.py @@ -6,7 +6,18 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + BlocklistType, + DomainLastStatusAutoconfigStateReason, + DomainLastStatusRecordStatus, + DomainReputationStatus, + DomainStatus, EmailFlag, + EmailRcptType, + EmailStatus, + OfferName, + PoolStatus, + ProjectSettingsPeriodicReportFrequency, + WebhookEventStatus, WebhookEventType, EmailTry, Email, @@ -66,14 +77,20 @@ def unmarshal_EmailTry(data: Any) -> EmailTry: field = data.get("rank", None) if field is not None: args["rank"] = field + else: + args["rank"] = 0 field = data.get("code", None) if field is not None: args["code"] = field + else: + args["code"] = 0 field = data.get("message", None) if field is not None: args["message"] = field + else: + args["message"] = None field = data.get("tried_at", None) if field is not None: @@ -95,22 +112,32 @@ def unmarshal_Email(data: Any) -> Email: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("message_id", None) if field is not None: args["message_id"] = field + else: + args["message_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("mail_from", None) if field is not None: args["mail_from"] = field + else: + args["mail_from"] = None field = data.get("mail_rcpt", None) if field is not None: args["mail_rcpt"] = field + else: + args["mail_rcpt"] = None field = data.get("rcpt_to", None) if field is not None: @@ -121,28 +148,40 @@ def unmarshal_Email(data: Any) -> Email: field = data.get("rcpt_type", None) if field is not None: args["rcpt_type"] = field + else: + args["rcpt_type"] = EmailRcptType.UNKNOWN_RCPT_TYPE field = data.get("subject", None) if field is not None: args["subject"] = field + else: + args["subject"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = EmailStatus.UNKNOWN field = data.get("try_count", None) if field is not None: args["try_count"] = field + else: + args["try_count"] = 0 field = data.get("last_tries", None) if field is not None: args["last_tries"] = ( [unmarshal_EmailTry(v) for v in field] if field is not None else None ) + else: + args["last_tries"] = field(default_factory=list) field = data.get("flags", None) if field is not None: args["flags"] = [EmailFlag(v) for v in field] if field is not None else None + else: + args["flags"] = field(default_factory=list) field = data.get("created_at", None) if field is not None: @@ -176,10 +215,14 @@ def unmarshal_DomainRecordsDMARC(data: Any) -> DomainRecordsDMARC: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None return DomainRecordsDMARC(**args) @@ -212,10 +255,14 @@ def unmarshal_DomainReputation(data: Any) -> DomainReputation: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainReputationStatus.UNKNOWN_STATUS field = data.get("score", None) if field is not None: args["score"] = field + else: + args["score"] = 0 field = data.get("scored_at", None) if field is not None: @@ -227,7 +274,7 @@ def unmarshal_DomainReputation(data: Any) -> DomainReputation: if field is not None: args["previous_score"] = field else: - args["previous_score"] = None + args["previous_score"] = 0 field = data.get("previous_scored_at", None) if field is not None: @@ -251,18 +298,26 @@ def unmarshal_DomainStatistics(data: Any) -> DomainStatistics: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("sent_count", None) if field is not None: args["sent_count"] = field + else: + args["sent_count"] = None field = data.get("failed_count", None) if field is not None: args["failed_count"] = field + else: + args["failed_count"] = None field = data.get("canceled_count", None) if field is not None: args["canceled_count"] = field + else: + args["canceled_count"] = None return DomainStatistics(**args) @@ -278,30 +333,44 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_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"] = DomainStatus.UNKNOWN field = data.get("spf_config", None) if field is not None: args["spf_config"] = field + else: + args["spf_config"] = None field = data.get("dkim_config", None) if field is not None: args["dkim_config"] = field + else: + args["dkim_config"] = None field = data.get("created_at", None) if field is not None: @@ -328,10 +397,14 @@ def unmarshal_Domain(data: Any) -> Domain: field = data.get("autoconfig", None) if field is not None: args["autoconfig"] = field + else: + args["autoconfig"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("revoked_at", None) if field is not None: @@ -377,38 +450,56 @@ def unmarshal_OfferSubscription(data: Any) -> OfferSubscription: field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = OfferName.UNKNOWN_NAME field = data.get("sla", None) if field is not None: args["sla"] = field + else: + args["sla"] = 0.0 field = data.get("max_domains", None) if field is not None: args["max_domains"] = field + else: + args["max_domains"] = 0 field = data.get("max_dedicated_ips", None) if field is not None: args["max_dedicated_ips"] = field + else: + args["max_dedicated_ips"] = 0 field = data.get("max_webhooks_per_domain", None) if field is not None: args["max_webhooks_per_domain"] = field + else: + args["max_webhooks_per_domain"] = 0 field = data.get("max_custom_blocklists_per_domain", None) if field is not None: args["max_custom_blocklists_per_domain"] = field + else: + args["max_custom_blocklists_per_domain"] = 0 field = data.get("included_monthly_emails", None) if field is not None: args["included_monthly_emails"] = field + else: + args["included_monthly_emails"] = 0 field = data.get("subscribed_at", None) if field is not None: @@ -440,32 +531,46 @@ def unmarshal_Webhook(data: Any) -> Webhook: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("domain_id", None) if field is not None: args["domain_id"] = field + else: + args["domain_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("event_types", None) if field is not None: args["event_types"] = ( [WebhookEventType(v) for v in field] if field is not None else None ) + else: + args["event_types"] = field(default_factory=list) field = data.get("sns_arn", None) if field is not None: args["sns_arn"] = field + else: + args["sns_arn"] = None field = data.get("created_at", None) if field is not None: @@ -493,26 +598,38 @@ def unmarshal_Blocklist(data: Any) -> Blocklist: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("domain_id", None) if field is not None: args["domain_id"] = field + else: + args["domain_id"] = None field = data.get("email", None) if field is not None: args["email"] = field + else: + args["email"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = BlocklistType.UNKNOWN_TYPE field = data.get("reason", None) if field is not None: args["reason"] = field + else: + args["reason"] = None field = data.get("custom", None) if field is not None: args["custom"] = field + else: + args["custom"] = False field = data.get("created_at", None) if field is not None: @@ -548,6 +665,8 @@ def unmarshal_BulkCreateBlocklistsResponse(data: Any) -> BulkCreateBlocklistsRes args["blocklists"] = ( [unmarshal_Blocklist(v) for v in field] if field is not None else None ) + else: + args["blocklists"] = field(default_factory=list) return BulkCreateBlocklistsResponse(**args) @@ -565,6 +684,8 @@ def unmarshal_CreateEmailResponse(data: Any) -> CreateEmailResponse: args["emails"] = ( [unmarshal_Email(v) for v in field] if field is not None else None ) + else: + args["emails"] = field(default_factory=list) return CreateEmailResponse(**args) @@ -582,16 +703,20 @@ def unmarshal_DomainLastStatusAutoconfigState( field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("autoconfigurable", None) if field is not None: args["autoconfigurable"] = field + else: + args["autoconfigurable"] = False field = data.get("reason", None) if field is not None: args["reason"] = field else: - args["reason"] = None + args["reason"] = DomainLastStatusAutoconfigStateReason.UNKNOWN_REASON return DomainLastStatusAutoconfigState(**args) @@ -607,6 +732,8 @@ def unmarshal_DomainLastStatusDkimRecord(data: Any) -> DomainLastStatusDkimRecor field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainLastStatusRecordStatus.UNKNOWN_RECORD_STATUS field = data.get("last_valid_at", None) if field is not None: @@ -636,6 +763,8 @@ def unmarshal_DomainLastStatusDmarcRecord(data: Any) -> DomainLastStatusDmarcRec field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainLastStatusRecordStatus.UNKNOWN_RECORD_STATUS field = data.get("last_valid_at", None) if field is not None: @@ -665,6 +794,8 @@ def unmarshal_DomainLastStatusSpfRecord(data: Any) -> DomainLastStatusSpfRecord: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainLastStatusRecordStatus.UNKNOWN_RECORD_STATUS field = data.get("last_valid_at", None) if field is not None: @@ -694,10 +825,14 @@ def unmarshal_DomainLastStatus(data: Any) -> DomainLastStatus: field = data.get("domain_id", None) if field is not None: args["domain_id"] = field + else: + args["domain_id"] = None field = data.get("domain_name", None) if field is not None: args["domain_name"] = field + else: + args["domain_name"] = None field = data.get("spf_record", None) if field is not None: @@ -737,12 +872,16 @@ def unmarshal_ListBlocklistsResponse(data: Any) -> ListBlocklistsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("blocklists", None) if field is not None: args["blocklists"] = ( [unmarshal_Blocklist(v) for v in field] if field is not None else None ) + else: + args["blocklists"] = field(default_factory=list) return ListBlocklistsResponse(**args) @@ -758,12 +897,16 @@ def unmarshal_ListDomainsResponse(data: Any) -> ListDomainsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("domains", None) if field is not None: args["domains"] = ( [unmarshal_Domain(v) for v in field] if field is not None else None ) + else: + args["domains"] = field(default_factory=list) return ListDomainsResponse(**args) @@ -779,12 +922,16 @@ def unmarshal_ListEmailsResponse(data: Any) -> ListEmailsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("emails", None) if field is not None: args["emails"] = ( [unmarshal_Email(v) for v in field] if field is not None else None ) + else: + args["emails"] = field(default_factory=list) return ListEmailsResponse(**args) @@ -802,6 +949,8 @@ def unmarshal_ListOfferSubscriptionsResponse( field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("offer_subscriptions", None) if field is not None: @@ -810,6 +959,8 @@ def unmarshal_ListOfferSubscriptionsResponse( if field is not None else None ) + else: + args["offer_subscriptions"] = field(default_factory=list) return ListOfferSubscriptionsResponse(**args) @@ -825,30 +976,44 @@ def unmarshal_Offer(data: Any) -> Offer: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = OfferName.UNKNOWN_NAME field = data.get("sla", None) if field is not None: args["sla"] = field + else: + args["sla"] = 0.0 field = data.get("max_domains", None) if field is not None: args["max_domains"] = field + else: + args["max_domains"] = 0 field = data.get("max_dedicated_ips", None) if field is not None: args["max_dedicated_ips"] = field + else: + args["max_dedicated_ips"] = 0 field = data.get("included_monthly_emails", None) if field is not None: args["included_monthly_emails"] = field + else: + args["included_monthly_emails"] = 0 field = data.get("max_webhooks_per_domain", None) if field is not None: args["max_webhooks_per_domain"] = field + else: + args["max_webhooks_per_domain"] = 0 field = data.get("max_custom_blocklists_per_domain", None) if field is not None: args["max_custom_blocklists_per_domain"] = field + else: + args["max_custom_blocklists_per_domain"] = 0 field = data.get("created_at", None) if field is not None: @@ -876,12 +1041,16 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("offers", None) if field is not None: args["offers"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["offers"] = field(default_factory=list) return ListOffersResponse(**args) @@ -897,14 +1066,20 @@ def unmarshal_Pool(data: Any) -> Pool: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = PoolStatus.UNKNOWN_STATUS field = data.get("ips", None) if field is not None: args["ips"] = field + else: + args["ips"] = field(default_factory=list) field = data.get("details", None) if field is not None: @@ -938,12 +1113,16 @@ def unmarshal_ListPoolsResponse(data: Any) -> ListPoolsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("pools", None) if field is not None: args["pools"] = ( [unmarshal_Pool(v) for v in field] if field is not None else None ) + else: + args["pools"] = field(default_factory=list) return ListPoolsResponse(**args) @@ -959,34 +1138,50 @@ def unmarshal_WebhookEvent(data: Any) -> WebhookEvent: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("webhook_id", None) if field is not None: args["webhook_id"] = field + else: + args["webhook_id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("domain_id", None) if field is not None: args["domain_id"] = field + else: + args["domain_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = WebhookEventType.UNKNOWN_TYPE field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = WebhookEventStatus.UNKNOWN_STATUS field = data.get("data", None) if field is not None: args["data"] = field + else: + args["data"] = None field = data.get("created_at", None) if field is not None: @@ -1020,12 +1215,16 @@ def unmarshal_ListWebhookEventsResponse(data: Any) -> ListWebhookEventsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("webhook_events", None) if field is not None: args["webhook_events"] = ( [unmarshal_WebhookEvent(v) for v in field] if field is not None else None ) + else: + args["webhook_events"] = field(default_factory=list) return ListWebhookEventsResponse(**args) @@ -1041,12 +1240,16 @@ def unmarshal_ListWebhooksResponse(data: Any) -> ListWebhooksResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("webhooks", None) if field is not None: args["webhooks"] = ( [unmarshal_Webhook(v) for v in field] if field is not None else None ) + else: + args["webhooks"] = field(default_factory=list) return ListWebhooksResponse(**args) @@ -1062,26 +1265,38 @@ def unmarshal_ProjectConsumption(data: Any) -> ProjectConsumption: field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("domains_count", None) if field is not None: args["domains_count"] = field + else: + args["domains_count"] = 0 field = data.get("dedicated_ips_count", None) if field is not None: args["dedicated_ips_count"] = field + else: + args["dedicated_ips_count"] = 0 field = data.get("monthly_emails_count", None) if field is not None: args["monthly_emails_count"] = field + else: + args["monthly_emails_count"] = 0 field = data.get("webhooks_count", None) if field is not None: args["webhooks_count"] = field + else: + args["webhooks_count"] = 0 field = data.get("custom_blocklists_count", None) if field is not None: args["custom_blocklists_count"] = field + else: + args["custom_blocklists_count"] = 0 return ProjectConsumption(**args) @@ -1097,18 +1312,26 @@ def unmarshal_ProjectSettingsPeriodicReport(data: Any) -> ProjectSettingsPeriodi field = data.get("enabled", None) if field is not None: args["enabled"] = field + else: + args["enabled"] = False field = data.get("frequency", None) if field is not None: args["frequency"] = field + else: + args["frequency"] = ProjectSettingsPeriodicReportFrequency.UNKNOWN_FREQUENCY field = data.get("sending_hour", None) if field is not None: args["sending_hour"] = field + else: + args["sending_hour"] = 0 field = data.get("sending_day", None) if field is not None: args["sending_day"] = field + else: + args["sending_day"] = 0 return ProjectSettingsPeriodicReport(**args) @@ -1141,26 +1364,38 @@ def unmarshal_Statistics(data: Any) -> Statistics: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("new_count", None) if field is not None: args["new_count"] = field + else: + args["new_count"] = 0 field = data.get("sending_count", None) if field is not None: args["sending_count"] = field + else: + args["sending_count"] = 0 field = data.get("sent_count", None) if field is not None: args["sent_count"] = field + else: + args["sent_count"] = 0 field = data.get("failed_count", None) if field is not None: args["failed_count"] = field + else: + args["failed_count"] = 0 field = data.get("canceled_count", None) if field is not None: args["canceled_count"] = field + else: + args["canceled_count"] = 0 return Statistics(**args) @@ -1178,7 +1413,7 @@ def marshal_BulkCreateBlocklistsRequest( output["emails"] = request.emails if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ if request.reason is not None: output["reason"] = request.reason @@ -1199,7 +1434,9 @@ def marshal_CreateDomainRequest( output["autoconfig"] = request.autoconfig if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.accept_tos is not None: output["accept_tos"] = request.accept_tos @@ -1289,7 +1526,9 @@ def marshal_CreateEmailRequest( ] if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.attachments is not None: output["attachments"] = [ @@ -1325,7 +1564,9 @@ def marshal_CreateWebhookRequest( output["sns_arn"] = request.sns_arn if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.event_types is not None: output["event_types"] = [str(item) for item in request.event_types] @@ -1352,10 +1593,12 @@ def marshal_UpdateOfferSubscriptionRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: - output["name"] = str(request.name) + output["name"] = request.name return output @@ -1370,7 +1613,7 @@ def marshal_UpdateProjectSettingsRequestUpdatePeriodicReport( output["enabled"] = request.enabled if request.frequency is not None: - output["frequency"] = str(request.frequency) + output["frequency"] = request.frequency if request.sending_hour is not None: output["sending_hour"] = request.sending_hour diff --git a/scaleway/scaleway/tem/v1alpha1/types.py b/scaleway/scaleway/tem/v1alpha1/types.py index 0f40682c4..4a669a9b4 100644 --- a/scaleway/scaleway/tem/v1alpha1/types.py +++ b/scaleway/scaleway/tem/v1alpha1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -235,7 +235,7 @@ class EmailTry: The SMTP message received. If the attempt did not reach an SMTP server, the message returned explains what happened. """ - tried_at: Optional[datetime] + tried_at: Optional[datetime] = None """ Date of the attempt to send the email. """ @@ -243,7 +243,7 @@ class EmailTry: @dataclass class DomainRecords: - dmarc: Optional[DomainRecordsDMARC] + dmarc: Optional[DomainRecordsDMARC] = None """ DMARC TXT record specification. """ @@ -261,17 +261,17 @@ class DomainReputation: A range from 0 to 100 that determines your domain's reputation score. A score of `0` means a bad domain reputation and a score of `100` means an excellent domain reputation. """ - scored_at: Optional[datetime] + scored_at: Optional[datetime] = None """ Time and date the score was calculated. """ - previous_score: Optional[int] + previous_score: Optional[int] = 0 """ The previously-calculated domain's reputation score. """ - previous_scored_at: Optional[datetime] + previous_scored_at: Optional[datetime] = None """ Time and date the previous reputation score was calculated. """ @@ -280,11 +280,8 @@ class DomainReputation: @dataclass class DomainStatistics: total_count: int - sent_count: int - failed_count: int - canceled_count: int @@ -320,17 +317,17 @@ class Blocklist: True if this blocklist was created manually. False for an automatic Transactional Email blocklist. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the blocklist creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of the blocklist's last update. """ - ends_at: Optional[datetime] + ends_at: Optional[datetime] = None """ Date and time when the blocklist ends. Empty if the blocklist has no end. """ @@ -343,7 +340,7 @@ class CreateEmailRequestAddress: Email address. """ - name: Optional[str] + name: Optional[str] = None """ (Optional) Name displayed. """ @@ -407,11 +404,6 @@ class Email: Email address of the recipient. """ - rcpt_to: Optional[str] - """ - Deprecated. Email address of the recipient. - """ - rcpt_type: EmailRcptType """ Type of recipient. @@ -442,17 +434,22 @@ class Email: Flags categorize emails. They allow you to obtain more information about recurring errors, for example. """ - created_at: Optional[datetime] + rcpt_to: Optional[str] = None + """ + Deprecated. Email address of the recipient. + """ + + created_at: Optional[datetime] = None """ Creation date of the email object. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Last update of the email object. """ - status_details: Optional[str] + status_details: Optional[str] = None """ Additional status information. """ @@ -470,7 +467,9 @@ class DomainLastStatusAutoconfigState: Whether the domain can be auto-configured or not. """ - reason: Optional[DomainLastStatusAutoconfigStateReason] + reason: Optional[DomainLastStatusAutoconfigStateReason] = ( + DomainLastStatusAutoconfigStateReason.UNKNOWN_REASON + ) """ The reason that the domain cannot be auto-configurable. """ @@ -483,12 +482,12 @@ class DomainLastStatusDkimRecord: Status of the DKIM record's configuration. """ - last_valid_at: Optional[datetime] + last_valid_at: Optional[datetime] = None """ Time and date the DKIM record was last valid. """ - error: Optional[str] + error: Optional[str] = None """ An error text displays in case the record is not valid. """ @@ -501,12 +500,12 @@ class DomainLastStatusDmarcRecord: Status of the DMARC record's configuration. """ - last_valid_at: Optional[datetime] + last_valid_at: Optional[datetime] = None """ Time and date the DMARC record was last valid. """ - error: Optional[str] + error: Optional[str] = None """ An error text displays in case the record is not valid. """ @@ -519,12 +518,12 @@ class DomainLastStatusSpfRecord: Status of the SPF record's configuration. """ - last_valid_at: Optional[datetime] + last_valid_at: Optional[datetime] = None """ Time and date the SPF record was last valid. """ - error: Optional[str] + error: Optional[str] = None """ An error text displays in case the record is not valid. """ @@ -567,52 +566,52 @@ class Domain: DKIM public key to record in the DNS zone. """ - created_at: Optional[datetime] + autoconfig: bool """ - Date and time of domain creation. + Status of auto-configuration for the domain's DNS zone. """ - next_check_at: Optional[datetime] + region: ScwRegion """ - Date and time of the next scheduled check. + Region to target. If none is passed will use default region from the config. """ - last_valid_at: Optional[datetime] + created_at: Optional[datetime] = None """ - Date and time the domain was last valid. + Date and time of domain creation. """ - autoconfig: bool + next_check_at: Optional[datetime] = None """ - Status of auto-configuration for the domain's DNS zone. + Date and time of the next scheduled check. """ - region: ScwRegion + last_valid_at: Optional[datetime] = None """ - Region to target. If none is passed will use default region from the config. + Date and time the domain was last valid. """ - revoked_at: Optional[datetime] + revoked_at: Optional[datetime] = None """ Date and time of the domain's deletion. """ - last_error: Optional[str] + last_error: Optional[str] = None """ Deprecated. Error message returned if the last check failed. """ - statistics: Optional[DomainStatistics] + statistics: Optional[DomainStatistics] = None """ Domain's statistics. """ - reputation: Optional[DomainReputation] + reputation: Optional[DomainReputation] = None """ The domain's reputation is available when your domain is checked and has sent enough emails. """ - records: Optional[DomainRecords] + records: Optional[DomainRecords] = None """ List of records to configure to validate a domain. """ @@ -665,12 +664,12 @@ class OfferSubscription: Number of emails included in the offer-subscription per month. """ - subscribed_at: Optional[datetime] + subscribed_at: Optional[datetime] = None """ Date and time of the subscription. """ - cancellation_available_at: Optional[datetime] + cancellation_available_at: Optional[datetime] = None """ Date and time of the end of the offer-subscription commitment. """ @@ -713,12 +712,12 @@ class Offer: Max number of active custom blocklists that can be associated with the offer. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the offer creation. """ - commitment_period: Optional[str] + commitment_period: Optional[str] = None """ Period of commitment. """ @@ -741,17 +740,17 @@ class Pool: IPs of the pool. """ - details: Optional[str] + details: Optional[str] = None """ Details of the pool. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone of the pool. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse hostname of all IPs of the pool. """ @@ -799,17 +798,17 @@ class WebhookEvent: Data sent to the Webhook destination. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the Webhook Event creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last Webhook Event updates. """ - email_id: Optional[str] + email_id: Optional[str] = None """ Optional Email ID if the event is triggered by an Email resource. """ @@ -852,12 +851,12 @@ class Webhook: Scaleway SNS ARN topic to push the events to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date and time of the Webhook creation. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date and time of last Webhook updates. """ @@ -888,22 +887,24 @@ class ProjectSettingsPeriodicReport: @dataclass class UpdateProjectSettingsRequestUpdatePeriodicReport: - enabled: Optional[bool] + enabled: Optional[bool] = False """ (Optional) Enable or disable periodic report notifications. """ - frequency: Optional[ProjectSettingsPeriodicReportFrequency] + frequency: Optional[ProjectSettingsPeriodicReportFrequency] = ( + ProjectSettingsPeriodicReportFrequency.UNKNOWN_FREQUENCY + ) """ (Optional) Frequency at which you receive periodic report notifications. """ - sending_hour: Optional[int] + sending_hour: Optional[int] = 0 """ (Optional) Hour at which you receive periodic report notifications. """ - sending_day: Optional[int] + sending_day: Optional[int] = 0 """ (Optional) On which day you receive periodic report notifications (1-7 weekly, 1-28 monthly). """ @@ -916,22 +917,22 @@ class BulkCreateBlocklistsRequest: Domain ID linked to the blocklist. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - emails: Optional[List[str]] + emails: Optional[List[str]] = field(default_factory=list) """ Email blocked by the blocklist. """ - type_: Optional[BlocklistType] + type_: Optional[BlocklistType] = BlocklistType.UNKNOWN_TYPE """ Type of blocklist. """ - reason: Optional[str] + reason: Optional[str] = None """ Reason to block the email. """ @@ -952,7 +953,7 @@ class CancelEmailRequest: ID of the email to cancel. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -965,7 +966,7 @@ class CheckDomainRequest: ID of the domain to check. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -983,17 +984,17 @@ class CreateDomainRequest: Activate auto-configuration of the domain's DNS zone. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project to which the domain belongs. """ - accept_tos: Optional[bool] + accept_tos: Optional[bool] = False """ Deprecated. Accept Scaleway's Terms of Service. """ @@ -1021,42 +1022,46 @@ class CreateEmailRequest: HTML content. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - to: Optional[List[CreateEmailRequestAddress]] + to: Optional[List[CreateEmailRequestAddress]] = field(default_factory=list) """ An array of the primary recipient's information. """ - cc: Optional[List[CreateEmailRequestAddress]] + cc: Optional[List[CreateEmailRequestAddress]] = field(default_factory=list) """ An array of the carbon copy recipient's information. """ - bcc: Optional[List[CreateEmailRequestAddress]] + bcc: Optional[List[CreateEmailRequestAddress]] = field(default_factory=list) """ An array of the blind carbon copy recipient's information. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project in which to create the email. """ - attachments: Optional[List[CreateEmailRequestAttachment]] + attachments: Optional[List[CreateEmailRequestAttachment]] = field( + default_factory=list + ) """ Array of attachments. """ - send_before: Optional[datetime] + send_before: Optional[datetime] = None """ Maximum date to deliver the email. """ - additional_headers: Optional[List[CreateEmailRequestHeader]] + additional_headers: Optional[List[CreateEmailRequestHeader]] = field( + default_factory=list + ) """ Array of additional headers as key-value. """ @@ -1087,17 +1092,17 @@ class CreateWebhookRequest: Scaleway SNS ARN topic to push the events to. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project to which the Webhook belongs. """ - event_types: Optional[List[WebhookEventType]] + event_types: Optional[List[WebhookEventType]] = field(default_factory=list) """ List of event types that will trigger an event. """ @@ -1110,7 +1115,7 @@ class DeleteBlocklistRequest: ID of the blocklist to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1123,7 +1128,7 @@ class DeleteWebhookRequest: ID of the Webhook to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1141,22 +1146,22 @@ class DomainLastStatus: The domain name (example.com). """ - spf_record: Optional[DomainLastStatusSpfRecord] + spf_record: Optional[DomainLastStatusSpfRecord] = None """ The SPF record verification data. """ - dkim_record: Optional[DomainLastStatusDkimRecord] + dkim_record: Optional[DomainLastStatusDkimRecord] = None """ The DKIM record verification data. """ - dmarc_record: Optional[DomainLastStatusDmarcRecord] + dmarc_record: Optional[DomainLastStatusDmarcRecord] = None """ The DMARC record verification data. """ - autoconfig_state: Optional[DomainLastStatusAutoconfigState] + autoconfig_state: Optional[DomainLastStatusAutoconfigState] = None """ The verification state of domain auto-configuration. """ @@ -1169,7 +1174,7 @@ class GetDomainLastStatusRequest: ID of the domain to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1182,7 +1187,7 @@ class GetDomainRequest: ID of the domain. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1195,7 +1200,7 @@ class GetEmailRequest: ID of the email to retrieve. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1203,12 +1208,12 @@ class GetEmailRequest: @dataclass class GetProjectConsumptionRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ @@ -1216,12 +1221,12 @@ class GetProjectConsumptionRequest: @dataclass class GetProjectSettingsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ @@ -1229,32 +1234,32 @@ class GetProjectSettingsRequest: @dataclass class GetStatisticsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ (Optional) Number of emails for this Project. """ - domain_id: Optional[str] + domain_id: Optional[str] = None """ (Optional) Number of emails sent from this domain (must be coherent with the `project_id` and the `organization_id`). """ - since: Optional[datetime] + since: Optional[datetime] = None """ (Optional) Number of emails created after this date. """ - until: Optional[datetime] + until: Optional[datetime] = None """ (Optional) Number of emails created before this date. """ - mail_from: Optional[str] + mail_from: Optional[str] = None """ (Optional) Number of emails sent with this sender's email address. """ @@ -1267,7 +1272,7 @@ class GetWebhookRequest: ID of the Webhook to check. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1280,37 +1285,39 @@ class ListBlocklistsRequest: (Optional) Filter by a domain ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListBlocklistsRequestOrderBy] + order_by: Optional[ListBlocklistsRequestOrderBy] = ( + ListBlocklistsRequestOrderBy.CREATED_AT_DESC + ) """ (Optional) List blocklist corresponding to specific criteria. """ - page: Optional[int] + page: Optional[int] = 0 """ (Optional) Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ (Optional) Requested page size. Value must be between 1 and 100. """ - email: Optional[str] + email: Optional[str] = None """ (Optional) Filter by an email address. """ - type_: Optional[BlocklistType] + type_: Optional[BlocklistType] = BlocklistType.UNKNOWN_TYPE """ (Optional) Filter by a blocklist type. """ - custom: Optional[bool] + custom: Optional[bool] = False """ (Optional) Filter by custom blocklist (true) or automatic Transactional Email blocklist (false). """ @@ -1331,37 +1338,37 @@ class ListBlocklistsResponse: @dataclass class ListDomainsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Requested page size. Value must be between 1 and 1000. """ - project_id: Optional[str] + project_id: Optional[str] = None """ (Optional) ID of the Project in which to list the domains. """ - status: Optional[List[DomainStatus]] + status: Optional[List[DomainStatus]] = field(default_factory=list) """ (Optional) List domains under specific statuses. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ (Optional) ID of the Organization in which to list the domains. """ - name: Optional[str] + name: Optional[str] = None """ (Optional) Names of the domains to list. """ @@ -1382,76 +1389,76 @@ class ListDomainsResponse: @dataclass class ListEmailsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] - - page_size: Optional[int] - - project_id: Optional[str] + page: Optional[int] = 0 + page_size: Optional[int] = 0 + project_id: Optional[str] = None """ (Optional) ID of the Project in which to list the emails. """ - domain_id: Optional[str] + domain_id: Optional[str] = None """ (Optional) ID of the domain for which to list the emails. """ - message_id: Optional[str] + message_id: Optional[str] = None """ (Optional) ID of the message for which to list the emails. """ - since: Optional[datetime] + since: Optional[datetime] = None """ (Optional) List emails created after this date. """ - until: Optional[datetime] + until: Optional[datetime] = None """ (Optional) List emails created before this date. """ - mail_from: Optional[str] + mail_from: Optional[str] = None """ (Optional) List emails sent with this sender's email address. """ - mail_to: Optional[str] + mail_to: Optional[str] = None """ Deprecated. List emails sent to this recipient's email address. """ - mail_rcpt: Optional[str] + mail_rcpt: Optional[str] = None """ (Optional) List emails sent to this recipient's email address. """ - statuses: Optional[List[EmailStatus]] + statuses: Optional[List[EmailStatus]] = field(default_factory=list) """ (Optional) List emails with any of these statuses. """ - subject: Optional[str] + subject: Optional[str] = None """ (Optional) List emails with this subject. """ - search: Optional[str] + search: Optional[str] = None """ (Optional) List emails by searching to all fields. """ - order_by: Optional[ListEmailsRequestOrderBy] + order_by: Optional[ListEmailsRequestOrderBy] = ( + ListEmailsRequestOrderBy.CREATED_AT_DESC + ) """ (Optional) List emails corresponding to specific criteria. """ - flags: Optional[List[EmailFlag]] + flags: Optional[List[EmailFlag]] = field(default_factory=list) """ (Optional) List emails containing only specific flags. """ @@ -1472,12 +1479,12 @@ class ListEmailsResponse: @dataclass class ListOfferSubscriptionsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1498,7 +1505,7 @@ class ListOfferSubscriptionsResponse: @dataclass class ListOffersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1519,22 +1526,22 @@ class ListOffersResponse: @dataclass class ListPoolsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Requested page size. Value must be between 1 and 1000. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ @@ -1560,52 +1567,54 @@ class ListWebhookEventsRequest: ID of the Webhook linked to the events. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListWebhookEventsRequestOrderBy] + order_by: Optional[ListWebhookEventsRequestOrderBy] = ( + ListWebhookEventsRequestOrderBy.CREATED_AT_DESC + ) """ (Optional) List Webhook events corresponding to specific criteria. """ - page: Optional[int] + page: Optional[int] = 0 """ Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Requested page size. Value must be between 1 and 100. """ - email_id: Optional[str] + email_id: Optional[str] = None """ ID of the email linked to the events. """ - event_types: Optional[List[WebhookEventType]] + event_types: Optional[List[WebhookEventType]] = field(default_factory=list) """ List of event types linked to the events. """ - statuses: Optional[List[WebhookEventStatus]] + statuses: Optional[List[WebhookEventStatus]] = field(default_factory=list) """ List of event statuses. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the webhook Project. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ ID of the webhook Organization. """ - domain_id: Optional[str] + domain_id: Optional[str] = None """ ID of the domain to watch for triggering events. """ @@ -1626,37 +1635,39 @@ class ListWebhookEventsResponse: @dataclass class ListWebhooksRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListWebhooksRequestOrderBy] + order_by: Optional[ListWebhooksRequestOrderBy] = ( + ListWebhooksRequestOrderBy.CREATED_AT_DESC + ) """ (Optional) List Webhooks corresponding to specific criteria. """ - page: Optional[int] + page: Optional[int] = 0 """ (Optional) Requested page number. Value must be greater or equal to 1. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ (Optional) Requested page size. Value must be between 1 and 100. """ - project_id: Optional[str] + project_id: Optional[str] = None """ (Optional) ID of the Project for which to list the Webhooks. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ (Optional) ID of the Organization for which to list the Webhooks. """ - domain_id: Optional[str] + domain_id: Optional[str] = None """ (Optional) ID of the Domain for which to list the Webhooks. """ @@ -1710,7 +1721,7 @@ class ProjectConsumption: @dataclass class ProjectSettings: - periodic_report: Optional[ProjectSettingsPeriodicReport] + periodic_report: Optional[ProjectSettingsPeriodicReport] = None """ Information about your periodic report. """ @@ -1723,7 +1734,7 @@ class RevokeDomainRequest: ID of the domain to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1769,12 +1780,12 @@ class UpdateDomainRequest: ID of the domain to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - autoconfig: Optional[bool] + autoconfig: Optional[bool] = False """ (Optional) If set to true, activate auto-configuration of the domain's DNS zone. """ @@ -1782,17 +1793,17 @@ class UpdateDomainRequest: @dataclass class UpdateOfferSubscriptionRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Project. """ - name: Optional[OfferName] + name: Optional[OfferName] = OfferName.UNKNOWN_NAME """ Name of the offer-subscription. """ @@ -1800,17 +1811,17 @@ class UpdateOfferSubscriptionRequest: @dataclass class UpdateProjectSettingsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project. """ - periodic_report: Optional[UpdateProjectSettingsRequestUpdatePeriodicReport] + periodic_report: Optional[UpdateProjectSettingsRequestUpdatePeriodicReport] = None """ Periodic report update details - all fields are optional. """ @@ -1823,22 +1834,22 @@ class UpdateWebhookRequest: ID of the Webhook to update. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name of the Webhook to update. """ - event_types: Optional[List[WebhookEventType]] + event_types: Optional[List[WebhookEventType]] = field(default_factory=list) """ List of event types to update. """ - sns_arn: Optional[str] + sns_arn: Optional[str] = None """ Scaleway SNS ARN topic to update. """ diff --git a/scaleway/scaleway/test/v1/marshalling.py b/scaleway/scaleway/test/v1/marshalling.py index c8a19fb63..1157c2e0c 100644 --- a/scaleway/scaleway/test/v1/marshalling.py +++ b/scaleway/scaleway/test/v1/marshalling.py @@ -30,30 +30,44 @@ def unmarshal_Human(data: Any) -> Human: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("height", None) if field is not None: args["height"] = field + else: + args["height"] = None field = data.get("shoe_size", None) if field is not None: args["shoe_size"] = field + else: + args["shoe_size"] = None field = data.get("altitude_in_meter", None) if field is not None: args["altitude_in_meter"] = field + else: + args["altitude_in_meter"] = None field = data.get("altitude_in_millimeter", None) if field is not None: args["altitude_in_millimeter"] = field + else: + args["altitude_in_millimeter"] = None field = data.get("fingers_count", None) if field is not None: args["fingers_count"] = field + else: + args["fingers_count"] = None field = data.get("created_at", None) if field is not None: @@ -70,26 +84,38 @@ def unmarshal_Human(data: Any) -> Human: field = data.get("hair_count", None) if field is not None: args["hair_count"] = field + else: + args["hair_count"] = None field = data.get("is_happy", None) if field is not None: args["is_happy"] = field + else: + args["is_happy"] = None field = data.get("eyes_color", None) if field is not None: args["eyes_color"] = field + else: + args["eyes_color"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None return Human(**args) @@ -105,12 +131,16 @@ def unmarshal_ListHumansResponse(data: Any) -> ListHumansResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None field = data.get("humans", None) if field is not None: args["humans"] = ( [unmarshal_Human(v) for v in field] if field is not None else None ) + else: + args["humans"] = None return ListHumansResponse(**args) @@ -126,10 +156,14 @@ def unmarshal_RegisterResponse(data: Any) -> RegisterResponse: field = data.get("secret_key", None) if field is not None: args["secret_key"] = field + else: + args["secret_key"] = None field = data.get("access_key", None) if field is not None: args["access_key"] = field + else: + args["access_key"] = None return RegisterResponse(**args) @@ -183,7 +217,7 @@ def marshal_CreateHumanRequest( output["name"] = request.name if request.eyes_color is not None: - output["eyes_color"] = str(request.eyes_color) + output["eyes_color"] = request.eyes_color return output @@ -228,7 +262,7 @@ def marshal_UpdateHumanRequest( output["is_happy"] = request.is_happy if request.eyes_color is not None: - output["eyes_color"] = str(request.eyes_color) + output["eyes_color"] = request.eyes_color if request.name is not None: output["name"] = request.name diff --git a/scaleway/scaleway/test/v1/types.py b/scaleway/scaleway/test/v1/types.py index bc83e5e82..0b54440f1 100644 --- a/scaleway/scaleway/test/v1/types.py +++ b/scaleway/scaleway/test/v1/types.py @@ -51,59 +51,36 @@ def __str__(self) -> str: @dataclass class Human: id: str - organization_id: str - height: float - shoe_size: float - altitude_in_meter: int - altitude_in_millimeter: int - fingers_count: int - - created_at: Optional[datetime] - - updated_at: Optional[datetime] - hair_count: int - is_happy: bool - eyes_color: EyeColors - status: HumanStatus - name: str - project_id: str + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None @dataclass class CreateHumanRequest: height: float - shoe_size: float - altitude_in_meter: int - altitude_in_millimeter: int - fingers_count: int - hair_count: int - is_happy: bool - name: str + eyes_color: Optional[EyeColors] = None + project_id: Optional[str] = None - eyes_color: Optional[EyeColors] - - project_id: Optional[str] - - organization_id: Optional[str] + organization_id: Optional[str] = None @dataclass @@ -124,21 +101,16 @@ class GetHumanRequest: @dataclass class ListHumansRequest: - page: Optional[int] - - page_size: Optional[int] - - order_by: Optional[ListHumansRequestOrderBy] - - organization_id: Optional[str] - - project_id: Optional[str] + page: Optional[int] = None + page_size: Optional[int] = None + order_by: Optional[ListHumansRequestOrderBy] = None + organization_id: Optional[str] = None + project_id: Optional[str] = None @dataclass class ListHumansResponse: total_count: int - humans: List[Human] @@ -150,7 +122,6 @@ class RegisterRequest: @dataclass class RegisterResponse: secret_key: str - access_key: str @@ -177,23 +148,16 @@ class UpdateHumanRequest: UUID of the human you want to update. """ - height: Optional[float] + height: Optional[float] = 0.0 """ Height of the human in meters. """ - shoe_size: Optional[float] - - altitude_in_meter: Optional[int] - - altitude_in_millimeter: Optional[int] - - fingers_count: Optional[int] - - hair_count: Optional[int] - - is_happy: Optional[bool] - - eyes_color: Optional[EyeColors] - - name: Optional[str] + shoe_size: Optional[float] = 0.0 + altitude_in_meter: Optional[int] = 0 + altitude_in_millimeter: Optional[int] = 0 + fingers_count: Optional[int] = 0 + hair_count: Optional[int] = 0 + is_happy: Optional[bool] = False + eyes_color: Optional[EyeColors] = EyeColors.UNKNOWN + name: Optional[str] = None diff --git a/scaleway/scaleway/vpc/v2/marshalling.py b/scaleway/scaleway/vpc/v2/marshalling.py index edbc3275a..8be8eee8d 100644 --- a/scaleway/scaleway/vpc/v2/marshalling.py +++ b/scaleway/scaleway/vpc/v2/marshalling.py @@ -41,22 +41,32 @@ def unmarshal_Subnet(data: Any) -> Subnet: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("subnet", None) if field is not None: args["subnet"] = field + else: + args["subnet"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("vpc_id", None) if field is not None: args["vpc_id"] = field + else: + args["vpc_id"] = None field = data.get("created_at", None) if field is not None: @@ -84,44 +94,64 @@ def unmarshal_PrivateNetwork(data: Any) -> PrivateNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("subnets", None) if field is not None: args["subnets"] = ( [unmarshal_Subnet(v) for v in field] if field is not None else None ) + else: + args["subnets"] = field(default_factory=list) field = data.get("vpc_id", None) if field is not None: args["vpc_id"] = field + else: + args["vpc_id"] = None field = data.get("dhcp_enabled", None) if field is not None: args["dhcp_enabled"] = field + else: + args["dhcp_enabled"] = False field = data.get("default_route_propagation_enabled", None) if field is not None: args["default_route_propagation_enabled"] = field + else: + args["default_route_propagation_enabled"] = False field = data.get("created_at", None) if field is not None: @@ -149,30 +179,44 @@ def unmarshal_Route(data: Any) -> Route: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("description", None) if field is not None: args["description"] = field + else: + args["description"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("vpc_id", None) if field is not None: args["vpc_id"] = field + else: + args["vpc_id"] = None field = data.get("destination", None) if field is not None: args["destination"] = field + else: + args["destination"] = None field = data.get("is_read_only", None) if field is not None: args["is_read_only"] = field + else: + args["is_read_only"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("nexthop_resource_id", None) if field is not None: @@ -212,42 +256,62 @@ def unmarshal_VPC(data: Any) -> VPC: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("is_default", None) if field is not None: args["is_default"] = field + else: + args["is_default"] = False field = data.get("private_network_count", None) if field is not None: args["private_network_count"] = field + else: + args["private_network_count"] = 0 field = data.get("routing_enabled", None) if field is not None: args["routing_enabled"] = field + else: + args["routing_enabled"] = False field = data.get("custom_routes_propagation_enabled", None) if field is not None: args["custom_routes_propagation_enabled"] = field + else: + args["custom_routes_propagation_enabled"] = False field = data.get("created_at", None) if field is not None: @@ -275,6 +339,8 @@ def unmarshal_AddSubnetsResponse(data: Any) -> AddSubnetsResponse: field = data.get("subnets", None) if field is not None: args["subnets"] = field + else: + args["subnets"] = None return AddSubnetsResponse(**args) @@ -290,6 +356,8 @@ def unmarshal_DeleteSubnetsResponse(data: Any) -> DeleteSubnetsResponse: field = data.get("subnets", None) if field is not None: args["subnets"] = field + else: + args["subnets"] = None return DeleteSubnetsResponse(**args) @@ -305,34 +373,50 @@ def unmarshal_AclRule(data: Any) -> AclRule: field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = None field = data.get("source", None) if field is not None: args["source"] = field + else: + args["source"] = None field = data.get("src_port_low", None) if field is not None: args["src_port_low"] = field + else: + args["src_port_low"] = None field = data.get("src_port_high", None) if field is not None: args["src_port_high"] = field + else: + args["src_port_high"] = None field = data.get("destination", None) if field is not None: args["destination"] = field + else: + args["destination"] = None field = data.get("dst_port_low", None) if field is not None: args["dst_port_low"] = field + else: + args["dst_port_low"] = None field = data.get("dst_port_high", None) if field is not None: args["dst_port_high"] = field + else: + args["dst_port_high"] = None field = data.get("action", None) if field is not None: args["action"] = field + else: + args["action"] = None field = data.get("description", None) if field is not None: @@ -356,10 +440,14 @@ def unmarshal_GetAclResponse(data: Any) -> GetAclResponse: args["rules"] = ( [unmarshal_AclRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = None field = data.get("default_policy", None) if field is not None: args["default_policy"] = field + else: + args["default_policy"] = None return GetAclResponse(**args) @@ -377,10 +465,14 @@ def unmarshal_ListPrivateNetworksResponse(data: Any) -> ListPrivateNetworksRespo args["private_networks"] = ( [unmarshal_PrivateNetwork(v) for v in field] if field is not None else None ) + else: + args["private_networks"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListPrivateNetworksResponse(**args) @@ -398,10 +490,14 @@ def unmarshal_ListSubnetsResponse(data: Any) -> ListSubnetsResponse: args["subnets"] = ( [unmarshal_Subnet(v) for v in field] if field is not None else None ) + else: + args["subnets"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListSubnetsResponse(**args) @@ -417,10 +513,14 @@ def unmarshal_ListVPCsResponse(data: Any) -> ListVPCsResponse: field = data.get("vpcs", None) if field is not None: args["vpcs"] = [unmarshal_VPC(v) for v in field] if field is not None else None + else: + args["vpcs"] = None field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = None return ListVPCsResponse(**args) @@ -438,10 +538,14 @@ def unmarshal_SetAclResponse(data: Any) -> SetAclResponse: args["rules"] = ( [unmarshal_AclRule(v) for v in field] if field is not None else None ) + else: + args["rules"] = None field = data.get("default_policy", None) if field is not None: args["default_policy"] = field + else: + args["default_policy"] = None return SetAclResponse(**args) @@ -473,7 +577,9 @@ def marshal_CreatePrivateNetworkRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -527,7 +633,9 @@ def marshal_CreateVPCRequest( output["name"] = request.name if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -554,7 +662,7 @@ def marshal_AclRule( output: Dict[str, Any] = {} if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol if request.source is not None: output["source"] = request.source @@ -575,7 +683,7 @@ def marshal_AclRule( output["dst_port_high"] = request.dst_port_high if request.action is not None: - output["action"] = str(request.action) + output["action"] = request.action if request.description is not None: output["description"] = request.description @@ -596,7 +704,7 @@ def marshal_SetAclRequest( output["is_ipv6"] = request.is_ipv6 if request.default_policy is not None: - output["default_policy"] = str(request.default_policy) + output["default_policy"] = request.default_policy return output diff --git a/scaleway/scaleway/vpc/v2/types.py b/scaleway/scaleway/vpc/v2/types.py index 0185930b1..6df407aeb 100644 --- a/scaleway/scaleway/vpc/v2/types.py +++ b/scaleway/scaleway/vpc/v2/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -89,12 +89,12 @@ class Subnet: VPC the subnet belongs to. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Subnet creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Subnet last modification date. """ @@ -152,12 +152,12 @@ class PrivateNetwork: Defines whether default v4 and v6 routes are propagated for this Private Network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the Private Network was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the Private Network was last modified. """ @@ -200,22 +200,22 @@ class Route: Region of the Route. """ - nexthop_resource_id: Optional[str] + nexthop_resource_id: Optional[str] = None """ ID of the nexthop resource. """ - nexthop_private_network_id: Optional[str] + nexthop_private_network_id: Optional[str] = None """ ID of the nexthop private network. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the Route was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the Route was last modified. """ @@ -263,7 +263,7 @@ class AclRule: Policy to apply to the packet. """ - description: Optional[str] + description: Optional[str] = None """ Rule description. """ @@ -321,12 +321,12 @@ class VPC: Defines whether the VPC advertises custom routes between its Private Networks. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date the VPC was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date the VPC was last modified. """ @@ -339,12 +339,12 @@ class AddSubnetsRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - subnets: Optional[List[str]] + subnets: Optional[List[str]] = field(default_factory=list) """ Private Network subnets CIDR. """ @@ -362,32 +362,32 @@ class CreatePrivateNetworkRequest: Defines whether default v4 and v6 routes are propagated for this Private Network. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the Private Network. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Scaleway Project in which to create the Private Network. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the Private Network. """ - subnets: Optional[List[str]] + subnets: Optional[List[str]] = field(default_factory=list) """ Private Network subnets CIDR. """ - vpc_id: Optional[str] + vpc_id: Optional[str] = None """ VPC in which to create the Private Network. """ @@ -410,22 +410,22 @@ class CreateRouteRequest: Destination of the Route. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Route. """ - nexthop_resource_id: Optional[str] + nexthop_resource_id: Optional[str] = None """ ID of the nexthop resource. """ - nexthop_private_network_id: Optional[str] + nexthop_private_network_id: Optional[str] = None """ ID of the nexthop private network. """ @@ -438,22 +438,22 @@ class CreateVPCRequest: Enable routing between Private Networks in the VPC. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the VPC. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Scaleway Project in which to create the VPC. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the VPC. """ @@ -466,7 +466,7 @@ class DeletePrivateNetworkRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -479,7 +479,7 @@ class DeleteRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -492,12 +492,12 @@ class DeleteSubnetsRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - subnets: Optional[List[str]] + subnets: Optional[List[str]] = field(default_factory=list) """ Private Network subnets CIDR. """ @@ -515,7 +515,7 @@ class DeleteVPCRequest: VPC ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -528,7 +528,7 @@ class EnableCustomRoutesPropagationRequest: VPC ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -541,7 +541,7 @@ class EnableDHCPRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -554,7 +554,7 @@ class EnableRoutingRequest: VPC ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -572,7 +572,7 @@ class GetAclRequest: Defines whether this set of ACL rules is for IPv6 (false = IPv4). Each Network ACL can have rules for only one IP type. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -581,7 +581,6 @@ class GetAclRequest: @dataclass class GetAclResponse: rules: List[AclRule] - default_policy: Action @@ -592,7 +591,7 @@ class GetPrivateNetworkRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -605,7 +604,7 @@ class GetRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -618,7 +617,7 @@ class GetVPCRequest: VPC ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -626,57 +625,59 @@ class GetVPCRequest: @dataclass class ListPrivateNetworksRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListPrivateNetworksRequestOrderBy] + order_by: Optional[ListPrivateNetworksRequestOrderBy] = ( + ListPrivateNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the returned Private Networks. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Private Networks to return per page. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter for. Only Private Networks with names containing this string will be returned. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. Only Private Networks with one or more matching tags will be returned. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. Only Private Networks belonging to this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. Only Private Networks belonging to this Project will be returned. """ - private_network_ids: Optional[List[str]] + private_network_ids: Optional[List[str]] = field(default_factory=list) """ Private Network IDs to filter for. Only Private Networks with one of these IDs will be returned. """ - vpc_id: Optional[str] + vpc_id: Optional[str] = None """ VPC ID to filter for. Only Private Networks belonging to this VPC will be returned. """ - dhcp_enabled: Optional[bool] + dhcp_enabled: Optional[bool] = False """ DHCP status to filter for. When true, only Private Networks with managed DHCP enabled will be returned. """ @@ -685,48 +686,49 @@ class ListPrivateNetworksRequest: @dataclass class ListPrivateNetworksResponse: private_networks: List[PrivateNetwork] - total_count: int @dataclass class ListSubnetsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListSubnetsRequestOrderBy] + order_by: Optional[ListSubnetsRequestOrderBy] = ( + ListSubnetsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order of the returned subnets. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of Private Networks to return per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. Only subnets belonging to this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. Only subnets belonging to this Project will be returned. """ - subnet_ids: Optional[List[str]] + subnet_ids: Optional[List[str]] = field(default_factory=list) """ Subnet IDs to filter for. Only subnets matching the specified IDs will be returned. """ - vpc_id: Optional[str] + vpc_id: Optional[str] = None """ VPC ID to filter for. Only subnets belonging to this VPC will be returned. """ @@ -735,58 +737,57 @@ class ListSubnetsRequest: @dataclass class ListSubnetsResponse: subnets: List[Subnet] - total_count: int @dataclass class ListVPCsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - order_by: Optional[ListVPCsRequestOrderBy] + order_by: Optional[ListVPCsRequestOrderBy] = ListVPCsRequestOrderBy.CREATED_AT_ASC """ Sort order of the returned VPCs. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Maximum number of VPCs to return per page. """ - name: Optional[str] + name: Optional[str] = None """ Name to filter for. Only VPCs with names containing this string will be returned. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for. Only VPCs with one or more matching tags will be returned. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for. Only VPCs belonging to this Organization will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for. Only VPCs belonging to this Project will be returned. """ - is_default: Optional[bool] + is_default: Optional[bool] = False """ Defines whether to filter only for VPCs which are the default one for their Project. """ - routing_enabled: Optional[bool] + routing_enabled: Optional[bool] = False """ Defines whether to filter only for VPCs which route traffic between their Private Networks. """ @@ -795,7 +796,6 @@ class ListVPCsRequest: @dataclass class ListVPCsResponse: vpcs: List[VPC] - total_count: int @@ -821,7 +821,7 @@ class SetAclRequest: Action to take for packets which do not match any rules. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -830,7 +830,6 @@ class SetAclRequest: @dataclass class SetAclResponse: rules: List[AclRule] - default_policy: Action @@ -841,22 +840,22 @@ class UpdatePrivateNetworkRequest: Private Network ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the Private Network. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the Private Network. """ - default_route_propagation_enabled: Optional[bool] + default_route_propagation_enabled: Optional[bool] = False """ Defines whether default v4 and v6 routes are propagated for this Private Network. """ @@ -869,32 +868,32 @@ class UpdateRouteRequest: Route ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - description: Optional[str] + description: Optional[str] = None """ Route description. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags of the Route. """ - destination: Optional[str] + destination: Optional[str] = None """ Destination of the Route. """ - nexthop_resource_id: Optional[str] + nexthop_resource_id: Optional[str] = None """ ID of the nexthop resource. """ - nexthop_private_network_id: Optional[str] + nexthop_private_network_id: Optional[str] = None """ ID of the nexthop private network. """ @@ -907,17 +906,17 @@ class UpdateVPCRequest: VPC ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the VPC. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the VPC. """ diff --git a/scaleway/scaleway/vpcgw/v1/marshalling.py b/scaleway/scaleway/vpcgw/v1/marshalling.py index 56aeb3ac7..0ef4bf0d1 100644 --- a/scaleway/scaleway/vpcgw/v1/marshalling.py +++ b/scaleway/scaleway/vpcgw/v1/marshalling.py @@ -10,6 +10,10 @@ resolve_one_of, ) from .types import ( + DHCPEntryType, + GatewayNetworkStatus, + GatewayStatus, + PATRuleProtocol, DHCP, IpamConfig, GatewayNetwork, @@ -60,26 +64,38 @@ def unmarshal_DHCP(data: Any) -> DHCP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("subnet", None) if field is not None: args["subnet"] = field + else: + args["subnet"] = None field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("pool_low", None) if field is not None: args["pool_low"] = field + else: + args["pool_low"] = None field = data.get("created_at", None) if field is not None: @@ -96,34 +112,50 @@ def unmarshal_DHCP(data: Any) -> DHCP: field = data.get("pool_high", None) if field is not None: args["pool_high"] = field + else: + args["pool_high"] = None field = data.get("enable_dynamic", None) if field is not None: args["enable_dynamic"] = field + else: + args["enable_dynamic"] = False field = data.get("push_default_route", None) if field is not None: args["push_default_route"] = field + else: + args["push_default_route"] = False field = data.get("push_dns_server", None) if field is not None: args["push_dns_server"] = field + else: + args["push_dns_server"] = False field = data.get("dns_servers_override", None) if field is not None: args["dns_servers_override"] = field + else: + args["dns_servers_override"] = field(default_factory=list) field = data.get("dns_search", None) if field is not None: args["dns_search"] = field + else: + args["dns_search"] = field(default_factory=list) field = data.get("dns_local_name", None) if field is not None: args["dns_local_name"] = field + else: + args["dns_local_name"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("valid_lifetime", None) if field is not None: @@ -157,10 +189,14 @@ def unmarshal_IpamConfig(data: Any) -> IpamConfig: field = data.get("push_default_route", None) if field is not None: args["push_default_route"] = field + else: + args["push_default_route"] = False field = data.get("ipam_ip_id", None) if field is not None: args["ipam_ip_id"] = field + else: + args["ipam_ip_id"] = None return IpamConfig(**args) @@ -176,14 +212,20 @@ def unmarshal_GatewayNetwork(data: Any) -> GatewayNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("gateway_id", None) if field is not None: args["gateway_id"] = field + else: + args["gateway_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("created_at", None) if field is not None: @@ -206,18 +248,26 @@ def unmarshal_GatewayNetwork(data: Any) -> GatewayNetwork: field = data.get("enable_masquerade", None) if field is not None: args["enable_masquerade"] = field + else: + args["enable_masquerade"] = False field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = GatewayNetworkStatus.UNKNOWN field = data.get("enable_dhcp", None) if field is not None: args["enable_dhcp"] = field + else: + args["enable_dhcp"] = False field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("dhcp", None) if field is not None: @@ -251,26 +301,38 @@ def unmarshal_IP(data: Any) -> IP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -310,30 +372,44 @@ def unmarshal_DHCPEntry(data: Any) -> DHCPEntry: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("gateway_network_id", None) if field is not None: args["gateway_network_id"] = field + else: + args["gateway_network_id"] = None field = data.get("mac_address", None) if field is not None: args["mac_address"] = field + else: + args["mac_address"] = None field = data.get("ip_address", None) if field is not None: args["ip_address"] = field + else: + args["ip_address"] = None field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = DHCPEntryType.UNKNOWN field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -361,14 +437,20 @@ def unmarshal_GatewayType(data: Any) -> GatewayType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("bandwidth", None) if field is not None: args["bandwidth"] = field + else: + args["bandwidth"] = 0 field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return GatewayType(**args) @@ -384,14 +466,20 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("created_at", None) if field is not None: @@ -414,28 +502,40 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = GatewayStatus.UNKNOWN field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("gateway_networks", None) if field is not None: args["gateway_networks"] = ( [unmarshal_GatewayNetwork(v) for v in field] if field is not None else None ) + else: + args["gateway_networks"] = field(default_factory=list) field = data.get("upstream_dns_servers", None) if field is not None: args["upstream_dns_servers"] = field + else: + args["upstream_dns_servers"] = field(default_factory=list) field = data.get("bastion_enabled", None) if field is not None: args["bastion_enabled"] = field + else: + args["bastion_enabled"] = False field = data.get("ip", None) if field is not None: @@ -458,22 +558,32 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("bastion_port", None) if field is not None: args["bastion_port"] = field + else: + args["bastion_port"] = 0 field = data.get("smtp_enabled", None) if field is not None: args["smtp_enabled"] = field + else: + args["smtp_enabled"] = False field = data.get("is_legacy", None) if field is not None: args["is_legacy"] = field + else: + args["is_legacy"] = False field = data.get("ip_mobility_enabled", None) if field is not None: args["ip_mobility_enabled"] = field + else: + args["ip_mobility_enabled"] = False field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return Gateway(**args) @@ -489,30 +599,44 @@ def unmarshal_PATRule(data: Any) -> PATRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("gateway_id", None) if field is not None: args["gateway_id"] = field + else: + args["gateway_id"] = None field = data.get("public_port", None) if field is not None: args["public_port"] = field + else: + args["public_port"] = 0 field = data.get("private_ip", None) if field is not None: args["private_ip"] = field + else: + args["private_ip"] = None field = data.get("private_port", None) if field is not None: args["private_port"] = field + else: + args["private_port"] = 0 field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = PATRuleProtocol.UNKNOWN field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -542,10 +666,14 @@ def unmarshal_ListDHCPEntriesResponse(data: Any) -> ListDHCPEntriesResponse: args["dhcp_entries"] = ( [unmarshal_DHCPEntry(v) for v in field] if field is not None else None ) + else: + args["dhcp_entries"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDHCPEntriesResponse(**args) @@ -563,10 +691,14 @@ def unmarshal_ListDHCPsResponse(data: Any) -> ListDHCPsResponse: args["dhcps"] = ( [unmarshal_DHCP(v) for v in field] if field is not None else None ) + else: + args["dhcps"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListDHCPsResponse(**args) @@ -584,10 +716,14 @@ def unmarshal_ListGatewayNetworksResponse(data: Any) -> ListGatewayNetworksRespo args["gateway_networks"] = ( [unmarshal_GatewayNetwork(v) for v in field] if field is not None else None ) + else: + args["gateway_networks"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListGatewayNetworksResponse(**args) @@ -605,6 +741,8 @@ def unmarshal_ListGatewayTypesResponse(data: Any) -> ListGatewayTypesResponse: args["types"] = ( [unmarshal_GatewayType(v) for v in field] if field is not None else None ) + else: + args["types"] = field(default_factory=list) return ListGatewayTypesResponse(**args) @@ -622,10 +760,14 @@ def unmarshal_ListGatewaysResponse(data: Any) -> ListGatewaysResponse: args["gateways"] = ( [unmarshal_Gateway(v) for v in field] if field is not None else None ) + else: + args["gateways"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListGatewaysResponse(**args) @@ -641,10 +783,14 @@ def unmarshal_ListIPsResponse(data: Any) -> ListIPsResponse: field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_IP(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListIPsResponse(**args) @@ -662,10 +808,14 @@ def unmarshal_ListPATRulesResponse(data: Any) -> ListPATRulesResponse: args["pat_rules"] = ( [unmarshal_PATRule(v) for v in field] if field is not None else None ) + else: + args["pat_rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPATRulesResponse(**args) @@ -683,6 +833,8 @@ def unmarshal_SetDHCPEntriesResponse(data: Any) -> SetDHCPEntriesResponse: args["dhcp_entries"] = ( [unmarshal_DHCPEntry(v) for v in field] if field is not None else None ) + else: + args["dhcp_entries"] = field(default_factory=list) return SetDHCPEntriesResponse(**args) @@ -700,6 +852,8 @@ def unmarshal_SetPATRulesResponse(data: Any) -> SetPATRulesResponse: args["pat_rules"] = ( [unmarshal_PATRule(v) for v in field] if field is not None else None ) + else: + args["pat_rules"] = field(default_factory=list) return SetPATRulesResponse(**args) @@ -714,7 +868,9 @@ def marshal_CreateDHCPRequest( output["subnet"] = request.subnet if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.address is not None: output["address"] = request.address @@ -847,7 +1003,9 @@ def marshal_CreateGatewayRequest( output["enable_bastion"] = request.enable_bastion if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -874,7 +1032,9 @@ def marshal_CreateIPRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -901,7 +1061,7 @@ def marshal_CreatePATRuleRequest( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output @@ -955,7 +1115,7 @@ def marshal_SetPATRulesRequestRule( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output @@ -1145,7 +1305,7 @@ def marshal_UpdatePATRuleRequest( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output diff --git a/scaleway/scaleway/vpcgw/v1/types.py b/scaleway/scaleway/vpcgw/v1/types.py index bb1c21bdc..f04583d95 100644 --- a/scaleway/scaleway/vpcgw/v1/types.py +++ b/scaleway/scaleway/vpcgw/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -163,16 +163,6 @@ class DHCP: Low IP (inclusive) of the dynamic address pool. Must be in the config's subnet. """ - created_at: Optional[datetime] - """ - Date the DHCP configuration was created. - """ - - updated_at: Optional[datetime] - """ - Configuration last modification date. - """ - pool_high: str """ High IP (inclusive) of the dynamic address pool. Must be in the config's subnet. @@ -213,17 +203,27 @@ class DHCP: Zone of this DHCP configuration. """ - valid_lifetime: Optional[str] + created_at: Optional[datetime] = None + """ + Date the DHCP configuration was created. + """ + + updated_at: Optional[datetime] = None + """ + Configuration last modification date. + """ + + valid_lifetime: Optional[str] = None """ How long DHCP entries will be valid for. """ - renew_timer: Optional[str] + renew_timer: Optional[str] = None """ After how long a renew will be attempted. Must be 30s lower than `rebind_timer`. """ - rebind_timer: Optional[str] + rebind_timer: Optional[str] = None """ After how long a DHCP client will query for a new lease if previous renews fail. Must be 30s lower than `valid_lifetime`. """ @@ -259,52 +259,52 @@ class GatewayNetwork: ID of the connected Private Network. """ - created_at: Optional[datetime] + enable_masquerade: bool """ - Connection creation date. + Defines whether the gateway masquerades traffic for this Private Network (Dynamic NAT). """ - updated_at: Optional[datetime] + status: GatewayNetworkStatus """ - Connection last modification date. + Current status of the Public Gateway's connection to the Private Network. """ - mac_address: Optional[str] + enable_dhcp: bool """ - MAC address of the gateway in the Private Network (if the gateway is up and running). + Defines whether DHCP is enabled on the connected Private Network. """ - enable_masquerade: bool + zone: ScwZone """ - Defines whether the gateway masquerades traffic for this Private Network (Dynamic NAT). + Zone of the GatewayNetwork connection. """ - status: GatewayNetworkStatus + created_at: Optional[datetime] = None """ - Current status of the Public Gateway's connection to the Private Network. + Connection creation date. """ - enable_dhcp: bool + updated_at: Optional[datetime] = None """ - Defines whether DHCP is enabled on the connected Private Network. + Connection last modification date. """ - zone: ScwZone + mac_address: Optional[str] = None """ - Zone of the GatewayNetwork connection. + MAC address of the gateway in the Private Network (if the gateway is up and running). """ - dhcp: Optional[DHCP] + dhcp: Optional[DHCP] = None """ DHCP configuration for the connected Private Network. """ - address: Optional[str] + address: Optional[str] = None """ Address of the Gateway (in CIDR form) to use when DHCP is not used. """ - ipam_config: Optional[IpamConfig] + ipam_config: Optional[IpamConfig] = None """ IPAM IP configuration used. """ @@ -360,22 +360,22 @@ class IP: Zone of the IP address. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ IP address creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ IP address last modification date. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse domain name for the IP address. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Public Gateway associated with the IP address. """ @@ -388,72 +388,72 @@ class CreateDHCPRequest: Subnet for the DHCP server. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project to create the DHCP configuration in. """ - address: Optional[str] + address: Optional[str] = None """ IP address of the DHCP server. This will be the gateway's address in the Private Network. Defaults to the first address of the subnet. """ - pool_low: Optional[str] + pool_low: Optional[str] = None """ Low IP (inclusive) of the dynamic address pool. Must be in the config's subnet. Defaults to the second address of the subnet. """ - pool_high: Optional[str] + pool_high: Optional[str] = None """ High IP (inclusive) of the dynamic address pool. Must be in the config's subnet. Defaults to the last address of the subnet. """ - enable_dynamic: Optional[bool] + enable_dynamic: Optional[bool] = False """ Defines whether to enable dynamic pooling of IPs. When false, only pre-existing DHCP reservations will be handed out. Defaults to true. """ - valid_lifetime: Optional[str] + valid_lifetime: Optional[str] = None """ How long DHCP entries will be valid for. Defaults to 1h (3600s). """ - renew_timer: Optional[str] + renew_timer: Optional[str] = None """ After how long a renew will be attempted. Must be 30s lower than `rebind_timer`. Defaults to 50m (3000s). """ - rebind_timer: Optional[str] + rebind_timer: Optional[str] = None """ After how long a DHCP client will query for a new lease if previous renews fail. Must be 30s lower than `valid_lifetime`. Defaults to 51m (3060s). """ - push_default_route: Optional[bool] + push_default_route: Optional[bool] = False """ Defines whether the gateway should push a default route to DHCP clients or only hand out IPs. Defaults to true. """ - push_dns_server: Optional[bool] + push_dns_server: Optional[bool] = False """ Defines whether the gateway should push custom DNS servers to clients. This allows for Instance hostname -> IP resolution. Defaults to true. """ - dns_servers_override: Optional[List[str]] + dns_servers_override: Optional[List[str]] = field(default_factory=list) """ Array of DNS server IP addresses used to override the DNS server list pushed to DHCP clients, instead of the gateway itself. """ - dns_search: Optional[List[str]] + dns_search: Optional[List[str]] = field(default_factory=list) """ Array of search paths in addition to the pushed DNS configuration. """ - dns_local_name: Optional[str] + dns_local_name: Optional[str] = None """ TLD given to hostnames in the Private Network. Allowed characters are `a-z0-9-.`. Defaults to the slugified Private Network name if created along a GatewayNetwork, or else to `priv`. """ @@ -466,7 +466,7 @@ class CreateGatewayNetworkRequestIpamConfig: Enabling the default route also enables masquerading. """ - ipam_ip_id: Optional[str] + ipam_ip_id: Optional[str] = None """ Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. """ @@ -509,12 +509,12 @@ class DHCPEntry: Zone of this DHCP entry. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ DHCP entry creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ DHCP entry last modification date. """ @@ -537,21 +537,6 @@ class Gateway: Owning Project. """ - created_at: Optional[datetime] - """ - Gateway creation date. - """ - - updated_at: Optional[datetime] - """ - Gateway last modification date. - """ - - type_: Optional[GatewayType] - """ - Gateway type (commercial offer). - """ - status: GatewayStatus """ Current status of the gateway. @@ -582,21 +567,6 @@ class Gateway: Defines whether SSH bastion is enabled on the gateway. """ - ip: Optional[IP] - """ - Public IP address of the gateway. - """ - - version: Optional[str] - """ - Version of the running gateway software. - """ - - can_upgrade_to: Optional[str] - """ - Newly available gateway software version that can be updated to. - """ - bastion_port: int """ Port of the SSH bastion. @@ -622,6 +592,36 @@ class Gateway: Zone of the gateway. """ + created_at: Optional[datetime] = None + """ + Gateway creation date. + """ + + updated_at: Optional[datetime] = None + """ + Gateway last modification date. + """ + + type_: Optional[GatewayType] = None + """ + Gateway type (commercial offer). + """ + + ip: Optional[IP] = None + """ + Public IP address of the gateway. + """ + + version: Optional[str] = None + """ + Version of the running gateway software. + """ + + can_upgrade_to: Optional[str] = None + """ + Newly available gateway software version that can be updated to. + """ + @dataclass class PATRule: @@ -660,12 +660,12 @@ class PATRule: Zone of the PAT rule. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ PAT rule creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ PAT rule last modification date. """ @@ -709,12 +709,12 @@ class SetPATRulesRequestRule: @dataclass class UpdateGatewayNetworkRequestIpamConfig: - push_default_route: Optional[bool] + push_default_route: Optional[bool] = False """ Enabling the default route also enables masquerading. """ - ipam_ip_id: Optional[str] + ipam_ip_id: Optional[str] = None """ Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. """ @@ -737,7 +737,7 @@ class CreateDHCPEntryRequest: IP address to give to the device. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -760,24 +760,24 @@ class CreateGatewayNetworkRequest: Note: this setting is ignored when passing `ipam_config`. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - enable_dhcp: Optional[bool] + enable_dhcp: Optional[bool] = False """ Defaults to `true` if either `dhcp_id` or `dhcp` are present. If set to `true`, either `dhcp_id` or `dhcp` must be present. Note: this setting is ignored when passing `ipam_config`. """ - dhcp_id: Optional[str] + dhcp_id: Optional[str] = None - dhcp: Optional[CreateDHCPRequest] + dhcp: Optional[CreateDHCPRequest] = None - address: Optional[str] + address: Optional[str] = None - ipam_config: Optional[CreateGatewayNetworkRequestIpamConfig] + ipam_config: Optional[CreateGatewayNetworkRequestIpamConfig] = None @dataclass @@ -797,37 +797,37 @@ class CreateGatewayRequest: Defines whether SSH bastion should be enabled the gateway. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Scaleway Project to create the gateway in. """ - name: Optional[str] + name: Optional[str] = None """ Name for the gateway. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the gateway. """ - upstream_dns_servers: Optional[List[str]] + upstream_dns_servers: Optional[List[str]] = field(default_factory=list) """ Array of DNS server IP addresses to override the gateway's default recursive DNS servers. """ - ip_id: Optional[str] + ip_id: Optional[str] = None """ Existing IP address to attach to the gateway. """ - bastion_port: Optional[int] + bastion_port: Optional[int] = 0 """ Port of the SSH bastion. """ @@ -835,17 +835,17 @@ class CreateGatewayRequest: @dataclass class CreateIPRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project to create the IP address in. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to give to the IP address. """ @@ -873,12 +873,12 @@ class CreatePATRuleRequest: Private port to translate to. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - protocol: Optional[PATRuleProtocol] + protocol: Optional[PATRuleProtocol] = PATRuleProtocol.UNKNOWN """ Protocol the rule should apply to. """ @@ -891,7 +891,7 @@ class DeleteDHCPEntryRequest: ID of the DHCP entry to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -904,7 +904,7 @@ class DeleteDHCPRequest: DHCP configuration ID to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -922,7 +922,7 @@ class DeleteGatewayNetworkRequest: Defines whether to clean up attached DHCP configurations (if any, and if not attached to another Gateway Network). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -940,7 +940,7 @@ class DeleteGatewayRequest: Defines whether to clean up attached DHCP configurations (if any, and if not attached to another Gateway Network). """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -953,7 +953,7 @@ class DeleteIPRequest: ID of the IP address to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -966,7 +966,7 @@ class DeletePATRuleRequest: ID of the PAT rule to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -979,7 +979,7 @@ class EnableIPMobilityRequest: ID of the gateway to upgrade to IP mobility. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -992,7 +992,7 @@ class GetDHCPEntryRequest: ID of the DHCP entry to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1005,7 +1005,7 @@ class GetDHCPRequest: ID of the DHCP configuration to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1018,7 +1018,7 @@ class GetGatewayNetworkRequest: ID of the GatewayNetwork to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1031,7 +1031,7 @@ class GetGatewayRequest: ID of the gateway to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1044,7 +1044,7 @@ class GetIPRequest: ID of the IP address to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1057,7 +1057,7 @@ class GetPATRuleRequest: ID of the PAT rule to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1065,47 +1065,49 @@ class GetPATRuleRequest: @dataclass class ListDHCPEntriesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListDHCPEntriesRequestOrderBy] + order_by: Optional[ListDHCPEntriesRequestOrderBy] = ( + ListDHCPEntriesRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ DHCP entries per page. """ - gateway_network_id: Optional[str] + gateway_network_id: Optional[str] = None """ Filter for entries on this GatewayNetwork. """ - mac_address: Optional[str] + mac_address: Optional[str] = None """ Filter for entries with this MAC address. """ - ip_address: Optional[str] + ip_address: Optional[str] = None """ Filter for entries with this IP address. """ - hostname: Optional[str] + hostname: Optional[str] = None """ Filter for entries with this hostname substring. """ - type_: Optional[DHCPEntryType] + type_: Optional[DHCPEntryType] = DHCPEntryType.UNKNOWN """ Filter for entries of this type. """ @@ -1126,42 +1128,42 @@ class ListDHCPEntriesResponse: @dataclass class ListDHCPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListDHCPsRequestOrderBy] + order_by: Optional[ListDHCPsRequestOrderBy] = ListDHCPsRequestOrderBy.CREATED_AT_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ DHCP configurations per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Include only DHCP configuration objects in this Organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only DHCP configuration objects in this Project. """ - address: Optional[str] + address: Optional[str] = None """ Filter for DHCP configuration objects with this DHCP server IP address (the gateway's address in the Private Network). """ - has_address: Optional[str] + has_address: Optional[str] = None """ Filter for DHCP configuration objects with subnets containing this IP address. """ @@ -1182,47 +1184,49 @@ class ListDHCPsResponse: @dataclass class ListGatewayNetworksRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListGatewayNetworksRequestOrderBy] + order_by: Optional[ListGatewayNetworksRequestOrderBy] = ( + ListGatewayNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ GatewayNetworks per page. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Filter for GatewayNetworks connected to this gateway. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Filter for GatewayNetworks connected to this Private Network. """ - enable_masquerade: Optional[bool] + enable_masquerade: Optional[bool] = False """ Filter for GatewayNetworks with this `enable_masquerade` setting. """ - dhcp_id: Optional[str] + dhcp_id: Optional[str] = None """ Filter for GatewayNetworks using this DHCP configuration. """ - status: Optional[GatewayNetworkStatus] + status: Optional[GatewayNetworkStatus] = GatewayNetworkStatus.UNKNOWN """ Filter for GatewayNetworks with this current status this status. Use `unknown` to include all statuses. """ @@ -1243,7 +1247,7 @@ class ListGatewayNetworksResponse: @dataclass class ListGatewayTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1259,57 +1263,59 @@ class ListGatewayTypesResponse: @dataclass class ListGatewaysRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListGatewaysRequestOrderBy] + order_by: Optional[ListGatewaysRequestOrderBy] = ( + ListGatewaysRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Gateways per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Include only gateways in this Organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only gateways in this Project. """ - name: Optional[str] + name: Optional[str] = None """ Filter for gateways which have this search term in their name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter for gateways with these tags. """ - type_: Optional[str] + type_: Optional[str] = None """ Filter for gateways of this type. """ - status: Optional[GatewayStatus] + status: Optional[GatewayStatus] = GatewayStatus.UNKNOWN """ Filter for gateways with this current status. Use `unknown` to include all statuses. """ - private_network_id: Optional[str] + private_network_id: Optional[str] = None """ Filter for gateways attached to this Private nNetwork. """ @@ -1330,47 +1336,47 @@ class ListGatewaysResponse: @dataclass class ListIPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListIPsRequestOrderBy] + order_by: Optional[ListIPsRequestOrderBy] = ListIPsRequestOrderBy.CREATED_AT_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ IP addresses per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Filter for IP addresses in this Organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter for IP addresses in this Project. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter for IP addresses with these tags. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Filter for IP addresses that have a reverse containing this string. """ - is_free: Optional[bool] + is_free: Optional[bool] = False """ Filter based on whether the IP is attached to a gateway or not. """ @@ -1391,37 +1397,39 @@ class ListIPsResponse: @dataclass class ListPATRulesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListPATRulesRequestOrderBy] + order_by: Optional[ListPATRulesRequestOrderBy] = ( + ListPATRulesRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ PAT rules per page. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Filter for PAT rules on this Gateway. """ - private_ip: Optional[str] + private_ip: Optional[str] = None """ Filter for PAT rules targeting this private ip. """ - protocol: Optional[PATRuleProtocol] + protocol: Optional[PATRuleProtocol] = PATRuleProtocol.UNKNOWN """ Filter for PAT rules with this protocol. """ @@ -1447,7 +1455,7 @@ class MigrateToV2Request: ID of the gateway to put into IPAM mode. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1460,7 +1468,7 @@ class RefreshSSHKeysRequest: ID of the gateway to refresh SSH keys on. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1473,12 +1481,14 @@ class SetDHCPEntriesRequest: ID of the Gateway Network on which to set DHCP reservation list. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - dhcp_entries: Optional[List[SetDHCPEntriesRequestEntry]] + dhcp_entries: Optional[List[SetDHCPEntriesRequestEntry]] = field( + default_factory=list + ) """ New list of DHCP reservations. """ @@ -1504,7 +1514,7 @@ class SetPATRulesRequest: New list of PAT rules. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1525,12 +1535,12 @@ class UpdateDHCPEntryRequest: ID of the DHCP entry to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ip_address: Optional[str] + ip_address: Optional[str] = None """ New IP address to give to the device. """ @@ -1543,72 +1553,72 @@ class UpdateDHCPRequest: DHCP configuration to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - subnet: Optional[str] + subnet: Optional[str] = None """ Subnet for the DHCP server. """ - address: Optional[str] + address: Optional[str] = None """ IP address of the DHCP server. This will be the Public Gateway's address in the Private Network. It must be part of config's subnet. """ - pool_low: Optional[str] + pool_low: Optional[str] = None """ Low IP (inclusive) of the dynamic address pool. Must be in the config's subnet. """ - pool_high: Optional[str] + pool_high: Optional[str] = None """ High IP (inclusive) of the dynamic address pool. Must be in the config's subnet. """ - enable_dynamic: Optional[bool] + enable_dynamic: Optional[bool] = False """ Defines whether to enable dynamic pooling of IPs. When false, only pre-existing DHCP reservations will be handed out. Defaults to true. """ - valid_lifetime: Optional[str] + valid_lifetime: Optional[str] = None """ How long DHCP entries will be valid for. """ - renew_timer: Optional[str] + renew_timer: Optional[str] = None """ After how long a renew will be attempted. Must be 30s lower than `rebind_timer`. """ - rebind_timer: Optional[str] + rebind_timer: Optional[str] = None """ After how long a DHCP client will query for a new lease if previous renews fail. Must be 30s lower than `valid_lifetime`. """ - push_default_route: Optional[bool] + push_default_route: Optional[bool] = False """ Defines whether the gateway should push a default route to DHCP clients, or only hand out IPs. """ - push_dns_server: Optional[bool] + push_dns_server: Optional[bool] = False """ Defines whether the gateway should push custom DNS servers to clients. This allows for instance hostname -> IP resolution. """ - dns_servers_override: Optional[List[str]] + dns_servers_override: Optional[List[str]] = field(default_factory=list) """ Array of DNS server IP addresses used to override the DNS server list pushed to DHCP clients, instead of the gateway itself. """ - dns_search: Optional[List[str]] + dns_search: Optional[List[str]] = field(default_factory=list) """ Array of search paths in addition to the pushed DNS configuration. """ - dns_local_name: Optional[str] + dns_local_name: Optional[str] = None """ TLD given to hostnames in the Private Networks. If an instance with hostname `foo` gets a lease, and this is set to `bar`, `foo.bar` will resolve. Allowed characters are `a-z0-9-.`. """ @@ -1621,27 +1631,27 @@ class UpdateGatewayNetworkRequest: ID of the GatewayNetwork to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - enable_masquerade: Optional[bool] + enable_masquerade: Optional[bool] = False """ Note: this setting is ignored when passing `ipam_config`. """ - enable_dhcp: Optional[bool] + enable_dhcp: Optional[bool] = False """ Defaults to `true` if `dhcp_id` is present. If set to `true`, `dhcp_id` must be present. Note: this setting is ignored when passing `ipam_config`. """ - dhcp_id: Optional[str] + dhcp_id: Optional[str] = None - address: Optional[str] + address: Optional[str] = None - ipam_config: Optional[UpdateGatewayNetworkRequestIpamConfig] + ipam_config: Optional[UpdateGatewayNetworkRequestIpamConfig] = None @dataclass @@ -1651,37 +1661,37 @@ class UpdateGatewayRequest: ID of the gateway to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the gateway. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the gateway. """ - upstream_dns_servers: Optional[List[str]] + upstream_dns_servers: Optional[List[str]] = field(default_factory=list) """ Array of DNS server IP addresses to override the gateway's default recursive DNS servers. """ - enable_bastion: Optional[bool] + enable_bastion: Optional[bool] = False """ Defines whether SSH bastion should be enabled the gateway. """ - bastion_port: Optional[int] + bastion_port: Optional[int] = 0 """ Port of the SSH bastion. """ - enable_smtp: Optional[bool] + enable_smtp: Optional[bool] = False """ Defines whether SMTP traffic should be allowed to pass through the gateway. """ @@ -1694,22 +1704,22 @@ class UpdateIPRequest: ID of the IP address to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to give to the IP address. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse to set on the address. Empty string to unset. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Gateway to attach the IP address to. Empty string to detach. """ @@ -1722,27 +1732,27 @@ class UpdatePATRuleRequest: ID of the PAT rule to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - public_port: Optional[int] + public_port: Optional[int] = 0 """ Public port to listen on. """ - private_ip: Optional[str] + private_ip: Optional[str] = None """ Private IP to forward data to. """ - private_port: Optional[int] + private_port: Optional[int] = 0 """ Private port to translate to. """ - protocol: Optional[PATRuleProtocol] + protocol: Optional[PATRuleProtocol] = PATRuleProtocol.UNKNOWN """ Protocol the rule should apply to. """ @@ -1755,12 +1765,12 @@ class UpgradeGatewayRequest: ID of the gateway to upgrade. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - type_: Optional[str] + type_: Optional[str] = None """ Gateway type (commercial offer). """ diff --git a/scaleway/scaleway/vpcgw/v2/marshalling.py b/scaleway/scaleway/vpcgw/v2/marshalling.py index 2c01ee753..93a7820f4 100644 --- a/scaleway/scaleway/vpcgw/v2/marshalling.py +++ b/scaleway/scaleway/vpcgw/v2/marshalling.py @@ -6,6 +6,9 @@ from scaleway_core.profile import ProfileDefaults from .types import ( + GatewayNetworkStatus, + GatewayStatus, + PatRuleProtocol, GatewayNetwork, IP, Gateway, @@ -46,34 +49,50 @@ def unmarshal_GatewayNetwork(data: Any) -> GatewayNetwork: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("gateway_id", None) if field is not None: args["gateway_id"] = field + else: + args["gateway_id"] = None field = data.get("private_network_id", None) if field is not None: args["private_network_id"] = field + else: + args["private_network_id"] = None field = data.get("masquerade_enabled", None) if field is not None: args["masquerade_enabled"] = field + else: + args["masquerade_enabled"] = False field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = GatewayNetworkStatus.UNKNOWN_STATUS field = data.get("push_default_route", None) if field is not None: args["push_default_route"] = field + else: + args["push_default_route"] = False field = data.get("ipam_ip_id", None) if field is not None: args["ipam_ip_id"] = field + else: + args["ipam_ip_id"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -107,26 +126,38 @@ def unmarshal_IP(data: Any) -> IP: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("address", None) if field is not None: args["address"] = field + else: + args["address"] = None field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -166,30 +197,44 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("organization_id", None) if field is not None: args["organization_id"] = field + else: + args["organization_id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = None field = data.get("bandwidth", None) if field is not None: args["bandwidth"] = field + else: + args["bandwidth"] = 0 field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = GatewayStatus.UNKNOWN_STATUS field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("created_at", None) if field is not None: @@ -206,16 +251,22 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("gateway_networks", None) if field is not None: args["gateway_networks"] = ( [unmarshal_GatewayNetwork(v) for v in field] if field is not None else None ) + else: + args["gateway_networks"] = field(default_factory=list) field = data.get("bastion_enabled", None) if field is not None: args["bastion_enabled"] = field + else: + args["bastion_enabled"] = False field = data.get("ipv4", None) if field is not None: @@ -238,22 +289,32 @@ def unmarshal_Gateway(data: Any) -> Gateway: field = data.get("bastion_port", None) if field is not None: args["bastion_port"] = field + else: + args["bastion_port"] = 0 field = data.get("smtp_enabled", None) if field is not None: args["smtp_enabled"] = field + else: + args["smtp_enabled"] = False field = data.get("is_legacy", None) if field is not None: args["is_legacy"] = field + else: + args["is_legacy"] = False field = data.get("bastion_allowed_ips", None) if field is not None: args["bastion_allowed_ips"] = field + else: + args["bastion_allowed_ips"] = field(default_factory=list) field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return Gateway(**args) @@ -269,30 +330,44 @@ def unmarshal_PatRule(data: Any) -> PatRule: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("gateway_id", None) if field is not None: args["gateway_id"] = field + else: + args["gateway_id"] = None field = data.get("public_port", None) if field is not None: args["public_port"] = field + else: + args["public_port"] = 0 field = data.get("private_ip", None) if field is not None: args["private_ip"] = field + else: + args["private_ip"] = None field = data.get("private_port", None) if field is not None: args["private_port"] = field + else: + args["private_port"] = 0 field = data.get("protocol", None) if field is not None: args["protocol"] = field + else: + args["protocol"] = PatRuleProtocol.UNKNOWN_PROTOCOL field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None field = data.get("created_at", None) if field is not None: @@ -320,6 +395,8 @@ def unmarshal_AddBastionAllowedIPsResponse(data: Any) -> AddBastionAllowedIPsRes field = data.get("ip_ranges", None) if field is not None: args["ip_ranges"] = field + else: + args["ip_ranges"] = field(default_factory=list) return AddBastionAllowedIPsResponse(**args) @@ -337,10 +414,14 @@ def unmarshal_ListGatewayNetworksResponse(data: Any) -> ListGatewayNetworksRespo args["gateway_networks"] = ( [unmarshal_GatewayNetwork(v) for v in field] if field is not None else None ) + else: + args["gateway_networks"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListGatewayNetworksResponse(**args) @@ -356,14 +437,20 @@ def unmarshal_GatewayType(data: Any) -> GatewayType: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("bandwidth", None) if field is not None: args["bandwidth"] = field + else: + args["bandwidth"] = 0 field = data.get("zone", None) if field is not None: args["zone"] = field + else: + args["zone"] = None return GatewayType(**args) @@ -381,6 +468,8 @@ def unmarshal_ListGatewayTypesResponse(data: Any) -> ListGatewayTypesResponse: args["types"] = ( [unmarshal_GatewayType(v) for v in field] if field is not None else None ) + else: + args["types"] = field(default_factory=list) return ListGatewayTypesResponse(**args) @@ -398,10 +487,14 @@ def unmarshal_ListGatewaysResponse(data: Any) -> ListGatewaysResponse: args["gateways"] = ( [unmarshal_Gateway(v) for v in field] if field is not None else None ) + else: + args["gateways"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListGatewaysResponse(**args) @@ -417,10 +510,14 @@ def unmarshal_ListIPsResponse(data: Any) -> ListIPsResponse: field = data.get("ips", None) if field is not None: args["ips"] = [unmarshal_IP(v) for v in field] if field is not None else None + else: + args["ips"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListIPsResponse(**args) @@ -438,10 +535,14 @@ def unmarshal_ListPatRulesResponse(data: Any) -> ListPatRulesResponse: args["pat_rules"] = ( [unmarshal_PatRule(v) for v in field] if field is not None else None ) + else: + args["pat_rules"] = field(default_factory=list) field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 return ListPatRulesResponse(**args) @@ -457,6 +558,8 @@ def unmarshal_SetBastionAllowedIPsResponse(data: Any) -> SetBastionAllowedIPsRes field = data.get("ip_ranges", None) if field is not None: args["ip_ranges"] = field + else: + args["ip_ranges"] = field(default_factory=list) return SetBastionAllowedIPsResponse(**args) @@ -474,6 +577,8 @@ def unmarshal_SetPatRulesResponse(data: Any) -> SetPatRulesResponse: args["pat_rules"] = ( [unmarshal_PatRule(v) for v in field] if field is not None else None ) + else: + args["pat_rules"] = field(default_factory=list) return SetPatRulesResponse(**args) @@ -530,7 +635,9 @@ def marshal_CreateGatewayRequest( output["enable_bastion"] = request.enable_bastion if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.name is not None: output["name"] = request.name @@ -554,7 +661,9 @@ def marshal_CreateIPRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -581,7 +690,7 @@ def marshal_CreatePatRuleRequest( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output @@ -614,7 +723,7 @@ def marshal_SetPatRulesRequestRule( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output @@ -712,7 +821,7 @@ def marshal_UpdatePatRuleRequest( output["private_port"] = request.private_port if request.protocol is not None: - output["protocol"] = str(request.protocol) + output["protocol"] = request.protocol return output diff --git a/scaleway/scaleway/vpcgw/v2/types.py b/scaleway/scaleway/vpcgw/v2/types.py index dfd76cccd..e00685d65 100644 --- a/scaleway/scaleway/vpcgw/v2/types.py +++ b/scaleway/scaleway/vpcgw/v2/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -140,17 +140,17 @@ class GatewayNetwork: Zone of the GatewayNetwork connection. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Connection creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Connection last modification date. """ - mac_address: Optional[str] + mac_address: Optional[str] = None """ MAC address of the gateway in the Private Network (if the gateway is up and running). """ @@ -188,22 +188,22 @@ class IP: Zone of the IP address. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ IP address creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ IP address last modification date. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse domain name for the IP address. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Public Gateway associated with the IP address. """ @@ -264,16 +264,6 @@ class Gateway: Name of the gateway. """ - created_at: Optional[datetime] - """ - Gateway creation date. - """ - - updated_at: Optional[datetime] - """ - Gateway last modification date. - """ - tags: List[str] """ Tags associated with the gateway. @@ -289,21 +279,6 @@ class Gateway: Defines whether SSH bastion is enabled on the gateway. """ - ipv4: Optional[IP] - """ - Public IPv4 address of the gateway. - """ - - version: Optional[str] - """ - Version of the running gateway software. - """ - - can_upgrade_to: Optional[str] - """ - Newly available gateway software version that can be updated to. - """ - bastion_port: int """ Port of the SSH bastion. @@ -329,6 +304,31 @@ class Gateway: Zone of the gateway. """ + created_at: Optional[datetime] = None + """ + Gateway creation date. + """ + + updated_at: Optional[datetime] = None + """ + Gateway last modification date. + """ + + ipv4: Optional[IP] = None + """ + Public IPv4 address of the gateway. + """ + + version: Optional[str] = None + """ + Version of the running gateway software. + """ + + can_upgrade_to: Optional[str] = None + """ + Newly available gateway software version that can be updated to. + """ + @dataclass class PatRule: @@ -367,12 +367,12 @@ class PatRule: Zone of the PAT rule. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ PAT rule creation date. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ PAT rule last modification date. """ @@ -413,7 +413,7 @@ class AddBastionAllowedIPsRequest: IP range allowed to connect to the SSH bastion. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -449,12 +449,12 @@ class CreateGatewayNetworkRequest: Enabling the default route also enables masquerading. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ipam_ip_id: Optional[str] + ipam_ip_id: Optional[str] = None """ Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. """ @@ -477,32 +477,32 @@ class CreateGatewayRequest: Defines whether SSH bastion should be enabled the gateway. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Scaleway Project to create the gateway in. """ - name: Optional[str] + name: Optional[str] = None """ Name for the gateway. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the gateway. """ - ip_id: Optional[str] + ip_id: Optional[str] = None """ Existing IP address to attach to the gateway. """ - bastion_port: Optional[int] + bastion_port: Optional[int] = 0 """ Port of the SSH bastion. """ @@ -510,17 +510,17 @@ class CreateGatewayRequest: @dataclass class CreateIPRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project to create the IP address in. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to give to the IP address. """ @@ -548,12 +548,12 @@ class CreatePatRuleRequest: Private port to translate to. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - protocol: Optional[PatRuleProtocol] + protocol: Optional[PatRuleProtocol] = PatRuleProtocol.UNKNOWN_PROTOCOL """ Protocol the rule should apply to. """ @@ -571,7 +571,7 @@ class DeleteBastionAllowedIPsRequest: IP range to delete from SSH bastion's list of allowed IPs. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -584,7 +584,7 @@ class DeleteGatewayNetworkRequest: ID of the GatewayNetwork to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -602,7 +602,7 @@ class DeleteGatewayRequest: Defines whether the PGW's IP should be deleted. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -615,7 +615,7 @@ class DeleteIPRequest: ID of the IP address to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -628,7 +628,7 @@ class DeletePatRuleRequest: ID of the PAT rule to delete. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -641,7 +641,7 @@ class GetGatewayNetworkRequest: ID of the GatewayNetwork to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -654,7 +654,7 @@ class GetGatewayRequest: ID of the gateway to fetch. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -667,7 +667,7 @@ class GetIPRequest: ID of the IP address to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -680,7 +680,7 @@ class GetPatRuleRequest: ID of the PAT rule to get. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -688,42 +688,44 @@ class GetPatRuleRequest: @dataclass class ListGatewayNetworksRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListGatewayNetworksRequestOrderBy] + order_by: Optional[ListGatewayNetworksRequestOrderBy] = ( + ListGatewayNetworksRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ GatewayNetworks per page. """ - status: Optional[List[GatewayNetworkStatus]] + status: Optional[List[GatewayNetworkStatus]] = field(default_factory=list) """ Filter for GatewayNetworks with these status. Use `unknown` to include all statuses. """ - gateway_ids: Optional[List[str]] + gateway_ids: Optional[List[str]] = field(default_factory=list) """ Filter for GatewayNetworks connected to these gateways. """ - private_network_ids: Optional[List[str]] + private_network_ids: Optional[List[str]] = field(default_factory=list) """ Filter for GatewayNetworks connected to these Private Networks. """ - masquerade_enabled: Optional[bool] + masquerade_enabled: Optional[bool] = False """ Filter for GatewayNetworks with this `enable_masquerade` setting. """ @@ -744,7 +746,7 @@ class ListGatewayNetworksResponse: @dataclass class ListGatewayTypesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -760,62 +762,64 @@ class ListGatewayTypesResponse: @dataclass class ListGatewaysRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListGatewaysRequestOrderBy] + order_by: Optional[ListGatewaysRequestOrderBy] = ( + ListGatewaysRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Gateways per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Include only gateways in this Organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Include only gateways in this Project. """ - name: Optional[str] + name: Optional[str] = None """ Filter for gateways which have this search term in their name. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter for gateways with these tags. """ - types: Optional[List[str]] + types: Optional[List[str]] = field(default_factory=list) """ Filter for gateways of these types. """ - status: Optional[List[GatewayStatus]] + status: Optional[List[GatewayStatus]] = field(default_factory=list) """ Filter for gateways with these status. Use `unknown` to include all statuses. """ - private_network_ids: Optional[List[str]] + private_network_ids: Optional[List[str]] = field(default_factory=list) """ Filter for gateways attached to these Private Networks. """ - include_legacy: Optional[bool] + include_legacy: Optional[bool] = False """ Include also legacy gateways. """ @@ -836,47 +840,47 @@ class ListGatewaysResponse: @dataclass class ListIPsRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListIPsRequestOrderBy] + order_by: Optional[ListIPsRequestOrderBy] = ListIPsRequestOrderBy.CREATED_AT_ASC """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ IP addresses per page. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Include only gateways in this Organization. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Filter for IP addresses in this Project. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Filter for IP addresses with these tags. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Filter for IP addresses that have a reverse containing this string. """ - is_free: Optional[bool] + is_free: Optional[bool] = False """ Filter based on whether the IP is attached to a gateway or not. """ @@ -897,37 +901,39 @@ class ListIPsResponse: @dataclass class ListPatRulesRequest: - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - order_by: Optional[ListPatRulesRequestOrderBy] + order_by: Optional[ListPatRulesRequestOrderBy] = ( + ListPatRulesRequestOrderBy.CREATED_AT_ASC + ) """ Order in which to return results. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number. """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ PAT rules per page. """ - gateway_ids: Optional[List[str]] + gateway_ids: Optional[List[str]] = field(default_factory=list) """ Filter for PAT rules on these gateways. """ - private_ips: Optional[List[str]] + private_ips: Optional[List[str]] = field(default_factory=list) """ Filter for PAT rules targeting these private ips. """ - protocol: Optional[PatRuleProtocol] + protocol: Optional[PatRuleProtocol] = PatRuleProtocol.UNKNOWN_PROTOCOL """ Filter for PAT rules with this protocol. """ @@ -953,7 +959,7 @@ class RefreshSSHKeysRequest: ID of the gateway to refresh SSH keys on. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -966,12 +972,12 @@ class SetBastionAllowedIPsRequest: ID of the gateway on which to set the allowed IP range. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - ip_ranges: Optional[List[str]] + ip_ranges: Optional[List[str]] = field(default_factory=list) """ New list of IP ranges (each range in CIDR notation) allowed to connect to the SSH bastion. """ @@ -997,7 +1003,7 @@ class SetPatRulesRequest: New list of PAT rules. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ @@ -1018,22 +1024,22 @@ class UpdateGatewayNetworkRequest: ID of the GatewayNetwork to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - enable_masquerade: Optional[bool] + enable_masquerade: Optional[bool] = False """ Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork. """ - push_default_route: Optional[bool] + push_default_route: Optional[bool] = False """ Enabling the default route also enables masquerading. """ - ipam_ip_id: Optional[str] + ipam_ip_id: Optional[str] = None """ Use this IPAM-booked IP ID as the Gateway's IP in this Private Network. """ @@ -1046,32 +1052,32 @@ class UpdateGatewayRequest: ID of the gateway to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - name: Optional[str] + name: Optional[str] = None """ Name for the gateway. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags for the gateway. """ - enable_bastion: Optional[bool] + enable_bastion: Optional[bool] = False """ Defines whether SSH bastion should be enabled the gateway. """ - bastion_port: Optional[int] + bastion_port: Optional[int] = 0 """ Port of the SSH bastion. """ - enable_smtp: Optional[bool] + enable_smtp: Optional[bool] = False """ Defines whether SMTP traffic should be allowed to pass through the gateway. """ @@ -1084,22 +1090,22 @@ class UpdateIPRequest: ID of the IP address to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to give to the IP address. """ - reverse: Optional[str] + reverse: Optional[str] = None """ Reverse to set on the address. Empty string to unset. """ - gateway_id: Optional[str] + gateway_id: Optional[str] = None """ Gateway to attach the IP address to. Empty string to detach. """ @@ -1112,27 +1118,27 @@ class UpdatePatRuleRequest: ID of the PAT rule to update. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - public_port: Optional[int] + public_port: Optional[int] = 0 """ Public port to listen on. """ - private_ip: Optional[str] + private_ip: Optional[str] = None """ Private IP to forward data to. """ - private_port: Optional[int] + private_port: Optional[int] = 0 """ Private port to translate to. """ - protocol: Optional[PatRuleProtocol] + protocol: Optional[PatRuleProtocol] = PatRuleProtocol.UNKNOWN_PROTOCOL """ Protocol the rule should apply to. """ @@ -1145,12 +1151,12 @@ class UpgradeGatewayRequest: ID of the gateway to upgrade. """ - zone: Optional[ScwZone] + zone: Optional[ScwZone] = None """ Zone to target. If none is passed will use default zone from the config. """ - type_: Optional[str] + type_: Optional[str] = None """ Gateway type (commercial offer). """ diff --git a/scaleway/scaleway/webhosting/v1/__init__.py b/scaleway/scaleway/webhosting/v1/__init__.py index 325d01061..93b525663 100644 --- a/scaleway/scaleway/webhosting/v1/__init__.py +++ b/scaleway/scaleway/webhosting/v1/__init__.py @@ -1,5 +1,8 @@ # This file was automatically generated. DO NOT EDIT. # If you have any remark or suggestion do not hesitate to open an issue. +from .types import BackupItemType +from .types import BackupStatus +from .content import BACKUP_TRANSIENT_STATUSES from .types import DnsRecordStatus from .types import DnsRecordType from .types import DnsRecordsStatus @@ -13,6 +16,7 @@ from .types import DomainZoneOwner from .types import HostingStatus from .content import HOSTING_TRANSIENT_STATUSES +from .types import ListBackupsRequestOrderBy from .types import ListDatabaseUsersRequestOrderBy from .types import ListDatabasesRequestOrderBy from .types import ListFtpAccountsRequestOrderBy @@ -29,6 +33,7 @@ from .types import HostingDomainCustomDomain from .types import OfferOption from .types import PlatformControlPanel +from .types import BackupItem from .types import HostingDomain from .types import CreateDatabaseRequestUser from .types import CreateHostingRequestDomainConfiguration @@ -39,6 +44,8 @@ from .types import HostingUser from .types import Offer from .types import Platform +from .types import BackupItemGroup +from .types import Backup from .types import ControlPanel from .types import DatabaseUser from .types import Database @@ -47,6 +54,11 @@ from .types import MailAccount from .types import Website from .types import DomainAvailability +from .types import BackupApiGetBackupRequest +from .types import BackupApiListBackupItemsRequest +from .types import BackupApiListBackupsRequest +from .types import BackupApiRestoreBackupItemsRequest +from .types import BackupApiRestoreBackupRequest from .types import CheckUserOwnsDomainResponse from .types import ControlPanelApiListControlPanelsRequest from .types import DatabaseApiAssignDatabaseUserRequest @@ -80,6 +92,8 @@ from .types import HostingApiListHostingsRequest from .types import HostingApiResetHostingPasswordRequest from .types import HostingApiUpdateHostingRequest +from .types import ListBackupItemsResponse +from .types import ListBackupsResponse from .types import ListControlPanelsResponse from .types import ListDatabaseUsersResponse from .types import ListDatabasesResponse @@ -95,9 +109,12 @@ from .types import OfferApiListOffersRequest from .types import ResetHostingPasswordResponse from .types import ResourceSummary +from .types import RestoreBackupItemsResponse +from .types import RestoreBackupResponse from .types import SearchDomainsResponse from .types import Session from .types import WebsiteApiListWebsitesRequest +from .api import WebhostingV1BackupAPI from .api import WebhostingV1ControlPanelAPI from .api import WebhostingV1DatabaseAPI from .api import WebhostingV1DnsAPI @@ -108,6 +125,9 @@ from .api import WebhostingV1WebsiteAPI __all__ = [ + "BackupItemType", + "BackupStatus", + "BACKUP_TRANSIENT_STATUSES", "DnsRecordStatus", "DnsRecordType", "DnsRecordsStatus", @@ -121,6 +141,7 @@ "DomainZoneOwner", "HostingStatus", "HOSTING_TRANSIENT_STATUSES", + "ListBackupsRequestOrderBy", "ListDatabaseUsersRequestOrderBy", "ListDatabasesRequestOrderBy", "ListFtpAccountsRequestOrderBy", @@ -137,6 +158,7 @@ "HostingDomainCustomDomain", "OfferOption", "PlatformControlPanel", + "BackupItem", "HostingDomain", "CreateDatabaseRequestUser", "CreateHostingRequestDomainConfiguration", @@ -147,6 +169,8 @@ "HostingUser", "Offer", "Platform", + "BackupItemGroup", + "Backup", "ControlPanel", "DatabaseUser", "Database", @@ -155,6 +179,11 @@ "MailAccount", "Website", "DomainAvailability", + "BackupApiGetBackupRequest", + "BackupApiListBackupItemsRequest", + "BackupApiListBackupsRequest", + "BackupApiRestoreBackupItemsRequest", + "BackupApiRestoreBackupRequest", "CheckUserOwnsDomainResponse", "ControlPanelApiListControlPanelsRequest", "DatabaseApiAssignDatabaseUserRequest", @@ -188,6 +217,8 @@ "HostingApiListHostingsRequest", "HostingApiResetHostingPasswordRequest", "HostingApiUpdateHostingRequest", + "ListBackupItemsResponse", + "ListBackupsResponse", "ListControlPanelsResponse", "ListDatabaseUsersResponse", "ListDatabasesResponse", @@ -203,9 +234,12 @@ "OfferApiListOffersRequest", "ResetHostingPasswordResponse", "ResourceSummary", + "RestoreBackupItemsResponse", + "RestoreBackupResponse", "SearchDomainsResponse", "Session", "WebsiteApiListWebsitesRequest", + "WebhostingV1BackupAPI", "WebhostingV1ControlPanelAPI", "WebhostingV1DatabaseAPI", "WebhostingV1DnsAPI", diff --git a/scaleway/scaleway/webhosting/v1/api.py b/scaleway/scaleway/webhosting/v1/api.py index 8a6214acf..aee6521ae 100644 --- a/scaleway/scaleway/webhosting/v1/api.py +++ b/scaleway/scaleway/webhosting/v1/api.py @@ -15,6 +15,7 @@ ) from .types import ( HostingStatus, + ListBackupsRequestOrderBy, ListDatabaseUsersRequestOrderBy, ListDatabasesRequestOrderBy, ListFtpAccountsRequestOrderBy, @@ -23,6 +24,8 @@ ListOffersRequestOrderBy, ListWebsitesRequestOrderBy, AutoConfigDomainDns, + Backup, + BackupApiRestoreBackupItemsRequest, CheckUserOwnsDomainResponse, ControlPanel, CreateDatabaseRequestUser, @@ -45,6 +48,8 @@ HostingApiCreateHostingRequest, HostingApiUpdateHostingRequest, HostingSummary, + ListBackupItemsResponse, + ListBackupsResponse, ListControlPanelsResponse, ListDatabaseUsersResponse, ListDatabasesResponse, @@ -61,16 +66,20 @@ OfferOptionRequest, ResetHostingPasswordResponse, ResourceSummary, + RestoreBackupItemsResponse, + RestoreBackupResponse, SearchDomainsResponse, Session, SyncDomainDnsRecordsRequestRecord, Website, ) from .content import ( + BACKUP_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES, HOSTING_TRANSIENT_STATUSES, ) from .marshalling import ( + unmarshal_Backup, unmarshal_DatabaseUser, unmarshal_Database, unmarshal_FtpAccount, @@ -79,6 +88,8 @@ unmarshal_DnsRecords, unmarshal_Domain, unmarshal_Hosting, + unmarshal_ListBackupItemsResponse, + unmarshal_ListBackupsResponse, unmarshal_ListControlPanelsResponse, unmarshal_ListDatabaseUsersResponse, unmarshal_ListDatabasesResponse, @@ -89,8 +100,11 @@ unmarshal_ListWebsitesResponse, unmarshal_ResetHostingPasswordResponse, unmarshal_ResourceSummary, + unmarshal_RestoreBackupItemsResponse, + unmarshal_RestoreBackupResponse, unmarshal_SearchDomainsResponse, unmarshal_Session, + marshal_BackupApiRestoreBackupItemsRequest, marshal_DatabaseApiAssignDatabaseUserRequest, marshal_DatabaseApiChangeDatabaseUserPasswordRequest, marshal_DatabaseApiCreateDatabaseRequest, @@ -111,6 +125,292 @@ ) +class WebhostingV1BackupAPI(API): + """ + This API allows you to list and restore backups for your cPanel and WordPress Web Hosting service. + """ + + def list_backups( + self, + *, + hosting_id: str, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListBackupsRequestOrderBy] = None, + ) -> ListBackupsResponse: + """ + List all available backups for a hosting account. + :param hosting_id: UUID of the hosting account. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Page number to retrieve. + :param page_size: Number of backups to return per page. + :param order_by: Order in which to return the list of backups. + :return: :class:`ListBackupsResponse ` + + Usage: + :: + + result = api.list_backups( + hosting_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( + "GET", + f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/backups", + params={ + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListBackupsResponse(res.json()) + + def list_backups_all( + self, + *, + hosting_id: str, + region: Optional[ScwRegion] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + order_by: Optional[ListBackupsRequestOrderBy] = None, + ) -> List[Backup]: + """ + List all available backups for a hosting account. + :param hosting_id: UUID of the hosting account. + :param region: Region to target. If none is passed will use default region from the config. + :param page: Page number to retrieve. + :param page_size: Number of backups to return per page. + :param order_by: Order in which to return the list of backups. + :return: :class:`List[Backup] ` + + Usage: + :: + + result = api.list_backups_all( + hosting_id="example", + ) + """ + + return fetch_all_pages( + type=ListBackupsResponse, + key="backups", + fetcher=self.list_backups, + args={ + "hosting_id": hosting_id, + "region": region, + "page": page, + "page_size": page_size, + "order_by": order_by, + }, + ) + + def get_backup( + self, + *, + hosting_id: str, + backup_id: str, + region: Optional[ScwRegion] = None, + ) -> Backup: + """ + Get info about a backup specified by the backup ID. + :param hosting_id: UUID of the hosting account. + :param backup_id: ID of the backup to retrieve. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`Backup ` + + Usage: + :: + + result = api.get_backup( + hosting_id="example", + backup_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_hosting_id = validate_path_param("hosting_id", hosting_id) + param_backup_id = validate_path_param("backup_id", backup_id) + + res = self._request( + "GET", + f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/backups/{param_backup_id}", + ) + + self._throw_on_error(res) + return unmarshal_Backup(res.json()) + + def wait_for_backup( + self, + *, + hosting_id: str, + backup_id: str, + region: Optional[ScwRegion] = None, + options: Optional[WaitForOptions[Backup, bool]] = None, + ) -> Backup: + """ + Get info about a backup specified by the backup ID. + :param hosting_id: UUID of the hosting account. + :param backup_id: ID of the backup to retrieve. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`Backup ` + + Usage: + :: + + result = api.get_backup( + hosting_id="example", + backup_id="example", + ) + """ + + if not options: + options = WaitForOptions() + + if not options.stop: + options.stop = lambda res: res.status not in BACKUP_TRANSIENT_STATUSES + + return wait_for_resource( + fetcher=self.get_backup, + options=options, + args={ + "hosting_id": hosting_id, + "backup_id": backup_id, + "region": region, + }, + ) + + def restore_backup( + self, + *, + hosting_id: str, + backup_id: str, + region: Optional[ScwRegion] = None, + ) -> RestoreBackupResponse: + """ + Restore an entire backup to your hosting environment. + :param hosting_id: UUID of the hosting account. + :param backup_id: ID of the backup to fully restore. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`RestoreBackupResponse ` + + Usage: + :: + + result = api.restore_backup( + hosting_id="example", + backup_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_hosting_id = validate_path_param("hosting_id", hosting_id) + param_backup_id = validate_path_param("backup_id", backup_id) + + res = self._request( + "POST", + f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/backups/{param_backup_id}/restore", + body={}, + ) + + self._throw_on_error(res) + return unmarshal_RestoreBackupResponse(res.json()) + + def list_backup_items( + self, + *, + hosting_id: str, + backup_id: str, + region: Optional[ScwRegion] = None, + ) -> ListBackupItemsResponse: + """ + List items within a specific backup, grouped by type. + :param hosting_id: UUID of the hosting account. + :param backup_id: ID of the backup to list items from. + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`ListBackupItemsResponse ` + + Usage: + :: + + result = api.list_backup_items( + hosting_id="example", + backup_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( + "GET", + f"/webhosting/v1/regions/{param_region}/hostings/{param_hosting_id}/backup-items", + params={ + "backup_id": backup_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListBackupItemsResponse(res.json()) + + def restore_backup_items( + self, + *, + hosting_id: str, + region: Optional[ScwRegion] = None, + item_ids: Optional[List[str]] = None, + ) -> RestoreBackupItemsResponse: + """ + Restore specific items from a backup (e.g., a database or mailbox). + :param hosting_id: UUID of the hosting account. + :param region: Region to target. If none is passed will use default region from the config. + :param item_ids: List of backup item IDs to restore individually. + :return: :class:`RestoreBackupItemsResponse ` + + Usage: + :: + + result = api.restore_backup_items( + hosting_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}/restore-backup-items", + body=marshal_BackupApiRestoreBackupItemsRequest( + BackupApiRestoreBackupItemsRequest( + hosting_id=hosting_id, + region=region, + item_ids=item_ids, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_RestoreBackupItemsResponse(res.json()) + + class WebhostingV1ControlPanelAPI(API): """ This API allows you to manage your Web Hosting services. diff --git a/scaleway/scaleway/webhosting/v1/content.py b/scaleway/scaleway/webhosting/v1/content.py index 895da5659..e77f5228b 100644 --- a/scaleway/scaleway/webhosting/v1/content.py +++ b/scaleway/scaleway/webhosting/v1/content.py @@ -3,11 +3,18 @@ from typing import List from .types import ( + BackupStatus, DomainAvailabilityStatus, DomainStatus, HostingStatus, ) +BACKUP_TRANSIENT_STATUSES: List[BackupStatus] = [ + BackupStatus.RESTORING, +] +""" +Lists transient statutes of the enum :class:`BackupStatus `. +""" DOMAIN_AVAILABILITY_TRANSIENT_STATUSES: List[DomainAvailabilityStatus] = [ DomainAvailabilityStatus.VALIDATING, ] diff --git a/scaleway/scaleway/webhosting/v1/marshalling.py b/scaleway/scaleway/webhosting/v1/marshalling.py index 3825815ee..de30cfcc7 100644 --- a/scaleway/scaleway/webhosting/v1/marshalling.py +++ b/scaleway/scaleway/webhosting/v1/marshalling.py @@ -13,9 +13,23 @@ resolve_one_of, ) from .types import ( + BackupItemType, + BackupStatus, + DnsRecordStatus, + DnsRecordType, + DnsRecordsStatus, DomainAction, DomainAvailabilityAction, + DomainAvailabilityStatus, DomainDnsAction, + DomainStatus, + DomainZoneOwner, + HostingStatus, + NameserverStatus, + OfferOptionName, + OfferOptionWarning, + PlatformPlatformGroup, + Backup, DatabaseUser, Database, FtpAccount, @@ -35,6 +49,10 @@ Offer, Platform, Hosting, + BackupItem, + BackupItemGroup, + ListBackupItemsResponse, + ListBackupsResponse, ControlPanel, ListControlPanelsResponse, ListDatabaseUsersResponse, @@ -48,9 +66,12 @@ ListWebsitesResponse, ResetHostingPasswordResponse, ResourceSummary, + RestoreBackupItemsResponse, + RestoreBackupResponse, DomainAvailability, SearchDomainsResponse, Session, + BackupApiRestoreBackupItemsRequest, DatabaseApiAssignDatabaseUserRequest, DatabaseApiChangeDatabaseUserPasswordRequest, CreateDatabaseRequestUser, @@ -75,6 +96,47 @@ ) +def unmarshal_Backup(data: Any) -> Backup: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Backup' 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("size", None) + if field is not None: + args["size"] = field + else: + args["size"] = 0 + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = BackupStatus.UNKNOWN_BACKUP_STATUS + + field = data.get("total_items", None) + if field is not None: + args["total_items"] = field + else: + args["total_items"] = 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 + + return Backup(**args) + + def unmarshal_DatabaseUser(data: Any) -> DatabaseUser: if not isinstance(data, dict): raise TypeError( @@ -86,10 +148,14 @@ def unmarshal_DatabaseUser(data: Any) -> DatabaseUser: field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("databases", None) if field is not None: args["databases"] = field + else: + args["databases"] = field(default_factory=list) return DatabaseUser(**args) @@ -105,10 +171,14 @@ def unmarshal_Database(data: Any) -> Database: field = data.get("database_name", None) if field is not None: args["database_name"] = field + else: + args["database_name"] = None field = data.get("users", None) if field is not None: args["users"] = field + else: + args["users"] = field(default_factory=list) return Database(**args) @@ -124,10 +194,14 @@ def unmarshal_FtpAccount(data: Any) -> FtpAccount: field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None return FtpAccount(**args) @@ -143,10 +217,14 @@ def unmarshal_MailAccount(data: Any) -> MailAccount: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None return MailAccount(**args) @@ -162,6 +240,8 @@ def unmarshal_CheckUserOwnsDomainResponse(data: Any) -> CheckUserOwnsDomainRespo field = data.get("owns_domain", None) if field is not None: args["owns_domain"] = field + else: + args["owns_domain"] = False return CheckUserOwnsDomainResponse(**args) @@ -177,22 +257,32 @@ def unmarshal_AutoConfigDomainDns(data: Any) -> AutoConfigDomainDns: field = data.get("nameservers", None) if field is not None: args["nameservers"] = field + else: + args["nameservers"] = False field = data.get("web_records", None) if field is not None: args["web_records"] = field + else: + args["web_records"] = False field = data.get("mail_records", None) if field is not None: args["mail_records"] = field + else: + args["mail_records"] = False field = data.get("all_records", None) if field is not None: args["all_records"] = field + else: + args["all_records"] = False field = data.get("none", None) if field is not None: args["none"] = field + else: + args["none"] = False return AutoConfigDomainDns(**args) @@ -208,32 +298,44 @@ def unmarshal_DnsRecord(data: Any) -> DnsRecord: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("type", None) if field is not None: args["type_"] = field + else: + args["type_"] = DnsRecordType.UNKNOWN_TYPE field = data.get("ttl", None) if field is not None: args["ttl"] = field + else: + args["ttl"] = 0 field = data.get("value", None) if field is not None: args["value"] = field + else: + args["value"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DnsRecordStatus.UNKNOWN_STATUS field = data.get("raw_data", None) if field is not None: args["raw_data"] = field + else: + args["raw_data"] = None field = data.get("priority", None) if field is not None: args["priority"] = field else: - args["priority"] = None + args["priority"] = 0 return DnsRecord(**args) @@ -249,14 +351,20 @@ def unmarshal_Nameserver(data: Any) -> Nameserver: field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = NameserverStatus.UNKNOWN_STATUS field = data.get("is_default", None) if field is not None: args["is_default"] = field + else: + args["is_default"] = False return Nameserver(**args) @@ -274,16 +382,22 @@ def unmarshal_DnsRecords(data: Any) -> DnsRecords: args["records"] = ( [unmarshal_DnsRecord(v) for v in field] if field is not None else None ) + else: + args["records"] = field(default_factory=list) field = data.get("name_servers", None) if field is not None: args["name_servers"] = ( [unmarshal_Nameserver(v) for v in field] if field is not None else None ) + else: + args["name_servers"] = field(default_factory=list) field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DnsRecordsStatus.UNKNOWN_STATUS field = data.get("dns_config", None) if field is not None: @@ -291,7 +405,7 @@ def unmarshal_DnsRecords(data: Any) -> DnsRecords: [DomainDnsAction(v) for v in field] if field is not None else None ) else: - args["dns_config"] = None + args["dns_config"] = field(default_factory=list) field = data.get("auto_config_domain_dns", None) if field is not None: @@ -313,24 +427,34 @@ def unmarshal_Domain(data: Any) -> Domain: 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"] = DomainStatus.UNKNOWN_STATUS field = data.get("owner", None) if field is not None: args["owner"] = field + else: + args["owner"] = DomainZoneOwner.UNKNOWN_ZONE_OWNER field = data.get("zone_domain_name", None) if field is not None: args["zone_domain_name"] = field + else: + args["zone_domain_name"] = None field = data.get("available_actions", None) if field is not None: args["available_actions"] = ( [DomainAction(v) for v in field] if field is not None else None ) + else: + args["available_actions"] = field(default_factory=list) field = data.get("available_dns_actions", None) if field is not None: @@ -338,7 +462,7 @@ def unmarshal_Domain(data: Any) -> Domain: [DomainDnsAction(v) for v in field] if field is not None else None ) else: - args["available_dns_actions"] = None + args["available_dns_actions"] = field(default_factory=list) field = data.get("auto_config_domain_dns", None) if field is not None: @@ -360,10 +484,14 @@ def unmarshal_PlatformControlPanelUrls(data: Any) -> PlatformControlPanelUrls: field = data.get("dashboard", None) if field is not None: args["dashboard"] = field + else: + args["dashboard"] = None field = data.get("webmail", None) if field is not None: args["webmail"] = field + else: + args["webmail"] = None return PlatformControlPanelUrls(**args) @@ -379,14 +507,20 @@ def unmarshal_HostingDomainCustomDomain(data: Any) -> HostingDomainCustomDomain: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("domain_status", None) if field is not None: args["domain_status"] = field + else: + args["domain_status"] = DomainStatus.UNKNOWN_STATUS field = data.get("dns_status", None) if field is not None: args["dns_status"] = field + else: + args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS field = data.get("auto_config_domain_dns", None) if field is not None: @@ -408,30 +542,44 @@ def unmarshal_OfferOption(data: Any) -> OfferOption: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = OfferOptionName.UNKNOWN_NAME field = data.get("billing_operation_path", None) if field is not None: args["billing_operation_path"] = field + else: + args["billing_operation_path"] = None field = data.get("min_value", None) if field is not None: args["min_value"] = field + else: + args["min_value"] = 0 field = data.get("current_value", None) if field is not None: args["current_value"] = field + else: + args["current_value"] = 0 field = data.get("max_value", None) if field is not None: args["max_value"] = field + else: + args["max_value"] = 0 field = data.get("quota_warning", None) if field is not None: args["quota_warning"] = field + else: + args["quota_warning"] = OfferOptionWarning.UNKNOWN_WARNING field = data.get("price", None) if field is not None: @@ -453,6 +601,8 @@ def unmarshal_PlatformControlPanel(data: Any) -> PlatformControlPanel: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("urls", None) if field is not None: @@ -474,6 +624,8 @@ def unmarshal_HostingDomain(data: Any) -> HostingDomain: field = data.get("subdomain", None) if field is not None: args["subdomain"] = field + else: + args["subdomain"] = None field = data.get("custom_domain", None) if field is not None: @@ -495,10 +647,14 @@ def unmarshal_HostingUser(data: Any) -> HostingUser: field = data.get("username", None) if field is not None: args["username"] = field + else: + args["username"] = None field = data.get("contact_email", None) if field is not None: args["contact_email"] = field + else: + args["contact_email"] = None field = data.get("one_time_password", None) if field is not None: @@ -526,36 +682,52 @@ def unmarshal_Offer(data: Any) -> Offer: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("billing_operation_path", None) if field is not None: args["billing_operation_path"] = field + else: + args["billing_operation_path"] = None field = data.get("options", None) if field is not None: args["options"] = ( [unmarshal_OfferOption(v) for v in field] if field is not None else None ) + else: + args["options"] = field(default_factory=list) field = data.get("available", None) if field is not None: args["available"] = field + else: + args["available"] = False field = data.get("control_panel_name", None) if field is not None: args["control_panel_name"] = field + else: + args["control_panel_name"] = None field = data.get("end_of_life", None) if field is not None: args["end_of_life"] = field + else: + args["end_of_life"] = False field = data.get("quota_warning", None) if field is not None: args["quota_warning"] = field + else: + args["quota_warning"] = OfferOptionWarning.UNKNOWN_WARNING field = data.get("price", None) if field is not None: @@ -577,22 +749,32 @@ def unmarshal_Platform(data: Any) -> Platform: field = data.get("hostname", None) if field is not None: args["hostname"] = field + else: + args["hostname"] = None field = data.get("number", None) if field is not None: args["number"] = field + else: + args["number"] = 0 field = data.get("group_name", None) if field is not None: args["group_name"] = field + else: + args["group_name"] = PlatformPlatformGroup.UNKNOWN_GROUP field = data.get("ipv4", None) if field is not None: args["ipv4"] = field + else: + args["ipv4"] = None field = data.get("ipv6", None) if field is not None: args["ipv6"] = field + else: + args["ipv6"] = None field = data.get("control_panel", None) if field is not None: @@ -614,14 +796,20 @@ def unmarshal_Hosting(data: Any) -> Hosting: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = HostingStatus.UNKNOWN_STATUS field = data.get("updated_at", None) if field is not None: @@ -656,24 +844,32 @@ def unmarshal_Hosting(data: Any) -> Hosting: field = data.get("tags", None) if field is not None: args["tags"] = field + else: + args["tags"] = field(default_factory=list) field = data.get("ipv4", None) if field is not None: args["ipv4"] = field + else: + args["ipv4"] = None field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("dns_status", None) if field is not None: args["dns_status"] = field else: - args["dns_status"] = None + args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS field = data.get("user", None) if field is not None: @@ -685,7 +881,7 @@ def unmarshal_Hosting(data: Any) -> Hosting: if field is not None: args["domain_status"] = field else: - args["domain_status"] = None + args["domain_status"] = DomainStatus.UNKNOWN_STATUS field = data.get("domain_info", None) if field is not None: @@ -696,6 +892,128 @@ def unmarshal_Hosting(data: Any) -> Hosting: return Hosting(**args) +def unmarshal_BackupItem(data: Any) -> BackupItem: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'BackupItem' 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("name", None) + if field is not None: + args["name"] = field + else: + args["name"] = None + + field = data.get("type", None) + if field is not None: + args["type_"] = field + else: + args["type_"] = BackupItemType.UNKNOWN_BACKUP_ITEM_TYPE + + field = data.get("size", None) + if field is not None: + args["size"] = field + else: + args["size"] = 0 + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = BackupStatus.UNKNOWN_BACKUP_STATUS + + 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 + + return BackupItem(**args) + + +def unmarshal_BackupItemGroup(data: Any) -> BackupItemGroup: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'BackupItemGroup' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("type", None) + if field is not None: + args["type_"] = field + else: + args["type_"] = BackupItemType.UNKNOWN_BACKUP_ITEM_TYPE + + field = data.get("items", None) + if field is not None: + args["items"] = ( + [unmarshal_BackupItem(v) for v in field] if field is not None else None + ) + else: + args["items"] = field(default_factory=list) + + return BackupItemGroup(**args) + + +def unmarshal_ListBackupItemsResponse(data: Any) -> ListBackupItemsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListBackupItemsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = 0 + + field = data.get("groups", None) + if field is not None: + args["groups"] = ( + [unmarshal_BackupItemGroup(v) for v in field] if field is not None else None + ) + else: + args["groups"] = field(default_factory=list) + + return ListBackupItemsResponse(**args) + + +def unmarshal_ListBackupsResponse(data: Any) -> ListBackupsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListBackupsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = 0 + + field = data.get("backups", None) + if field is not None: + args["backups"] = ( + [unmarshal_Backup(v) for v in field] if field is not None else None + ) + else: + args["backups"] = field(default_factory=list) + + return ListBackupsResponse(**args) + + def unmarshal_ControlPanel(data: Any) -> ControlPanel: if not isinstance(data, dict): raise TypeError( @@ -707,20 +1025,28 @@ def unmarshal_ControlPanel(data: Any) -> ControlPanel: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("available", None) if field is not None: args["available"] = field + else: + args["available"] = False field = data.get("logo_url", None) if field is not None: args["logo_url"] = field + else: + args["logo_url"] = None field = data.get("available_languages", None) if field is not None: args["available_languages"] = ( [StdLanguageCode(v) for v in field] if field is not None else None ) + else: + args["available_languages"] = field(default_factory=list) return ControlPanel(**args) @@ -736,12 +1062,16 @@ def unmarshal_ListControlPanelsResponse(data: Any) -> ListControlPanelsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("control_panels", None) if field is not None: args["control_panels"] = ( [unmarshal_ControlPanel(v) for v in field] if field is not None else None ) + else: + args["control_panels"] = field(default_factory=list) return ListControlPanelsResponse(**args) @@ -757,12 +1087,16 @@ def unmarshal_ListDatabaseUsersResponse(data: Any) -> ListDatabaseUsersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("users", None) if field is not None: args["users"] = ( [unmarshal_DatabaseUser(v) for v in field] if field is not None else None ) + else: + args["users"] = field(default_factory=list) return ListDatabaseUsersResponse(**args) @@ -778,12 +1112,16 @@ def unmarshal_ListDatabasesResponse(data: Any) -> ListDatabasesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("databases", None) if field is not None: args["databases"] = ( [unmarshal_Database(v) for v in field] if field is not None else None ) + else: + args["databases"] = field(default_factory=list) return ListDatabasesResponse(**args) @@ -799,12 +1137,16 @@ def unmarshal_ListFtpAccountsResponse(data: Any) -> ListFtpAccountsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("ftp_accounts", None) if field is not None: args["ftp_accounts"] = ( [unmarshal_FtpAccount(v) for v in field] if field is not None else None ) + else: + args["ftp_accounts"] = field(default_factory=list) return ListFtpAccountsResponse(**args) @@ -820,26 +1162,38 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: field = data.get("id", None) if field is not None: args["id"] = field + else: + args["id"] = None field = data.get("project_id", None) if field is not None: args["project_id"] = field + else: + args["project_id"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = HostingStatus.UNKNOWN_STATUS field = data.get("protected", None) if field is not None: args["protected"] = field + else: + args["protected"] = False field = data.get("offer_name", None) if field is not None: args["offer_name"] = field + else: + args["offer_name"] = None field = data.get("region", None) if field is not None: args["region"] = field + else: + args["region"] = None field = data.get("created_at", None) if field is not None: @@ -863,13 +1217,13 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary: if field is not None: args["dns_status"] = field else: - args["dns_status"] = None + args["dns_status"] = DnsRecordsStatus.UNKNOWN_STATUS field = data.get("domain_status", None) if field is not None: args["domain_status"] = field else: - args["domain_status"] = None + args["domain_status"] = DomainStatus.UNKNOWN_STATUS field = data.get("domain_info", None) if field is not None: @@ -891,12 +1245,16 @@ def unmarshal_ListHostingsResponse(data: Any) -> ListHostingsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("hostings", None) if field is not None: args["hostings"] = ( [unmarshal_HostingSummary(v) for v in field] if field is not None else None ) + else: + args["hostings"] = field(default_factory=list) return ListHostingsResponse(**args) @@ -912,12 +1270,16 @@ def unmarshal_ListMailAccountsResponse(data: Any) -> ListMailAccountsResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("mail_accounts", None) if field is not None: args["mail_accounts"] = ( [unmarshal_MailAccount(v) for v in field] if field is not None else None ) + else: + args["mail_accounts"] = field(default_factory=list) return ListMailAccountsResponse(**args) @@ -933,12 +1295,16 @@ def unmarshal_ListOffersResponse(data: Any) -> ListOffersResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("offers", None) if field is not None: args["offers"] = ( [unmarshal_Offer(v) for v in field] if field is not None else None ) + else: + args["offers"] = field(default_factory=list) return ListOffersResponse(**args) @@ -954,14 +1320,20 @@ def unmarshal_Website(data: Any) -> Website: field = data.get("domain", None) if field is not None: args["domain"] = field + else: + args["domain"] = None field = data.get("path", None) if field is not None: args["path"] = field + else: + args["path"] = None field = data.get("ssl_status", None) if field is not None: args["ssl_status"] = field + else: + args["ssl_status"] = False return Website(**args) @@ -977,12 +1349,16 @@ def unmarshal_ListWebsitesResponse(data: Any) -> ListWebsitesResponse: field = data.get("total_count", None) if field is not None: args["total_count"] = field + else: + args["total_count"] = 0 field = data.get("websites", None) if field is not None: args["websites"] = ( [unmarshal_Website(v) for v in field] if field is not None else None ) + else: + args["websites"] = field(default_factory=list) return ListWebsitesResponse(**args) @@ -998,6 +1374,8 @@ def unmarshal_ResetHostingPasswordResponse(data: Any) -> ResetHostingPasswordRes field = data.get("one_time_password_b64", None) if field is not None: args["one_time_password_b64"] = field + else: + args["one_time_password_b64"] = None field = data.get("one_time_password", None) if field is not None: @@ -1019,22 +1397,52 @@ def unmarshal_ResourceSummary(data: Any) -> ResourceSummary: field = data.get("databases_count", None) if field is not None: args["databases_count"] = field + else: + args["databases_count"] = 0 field = data.get("mail_accounts_count", None) if field is not None: args["mail_accounts_count"] = field + else: + args["mail_accounts_count"] = 0 field = data.get("ftp_accounts_count", None) if field is not None: args["ftp_accounts_count"] = field + else: + args["ftp_accounts_count"] = 0 field = data.get("websites_count", None) if field is not None: args["websites_count"] = field + else: + args["websites_count"] = 0 return ResourceSummary(**args) +def unmarshal_RestoreBackupItemsResponse(data: Any) -> RestoreBackupItemsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'RestoreBackupItemsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + return RestoreBackupItemsResponse(**args) + + +def unmarshal_RestoreBackupResponse(data: Any) -> RestoreBackupResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'RestoreBackupResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + return RestoreBackupResponse(**args) + + def unmarshal_DomainAvailability(data: Any) -> DomainAvailability: if not isinstance(data, dict): raise TypeError( @@ -1046,24 +1454,34 @@ def unmarshal_DomainAvailability(data: Any) -> DomainAvailability: field = data.get("name", None) if field is not None: args["name"] = field + else: + args["name"] = None field = data.get("zone_name", None) if field is not None: args["zone_name"] = field + else: + args["zone_name"] = None field = data.get("status", None) if field is not None: args["status"] = field + else: + args["status"] = DomainAvailabilityStatus.UNKNOWN_STATUS field = data.get("available_actions", None) if field is not None: args["available_actions"] = ( [DomainAvailabilityAction(v) for v in field] if field is not None else None ) + else: + args["available_actions"] = field(default_factory=list) field = data.get("can_create_hosting", None) if field is not None: args["can_create_hosting"] = field + else: + args["can_create_hosting"] = False field = data.get("price", None) if field is not None: @@ -1089,6 +1507,8 @@ def unmarshal_SearchDomainsResponse(data: Any) -> SearchDomainsResponse: if field is not None else None ) + else: + args["domains_available"] = field(default_factory=list) return SearchDomainsResponse(**args) @@ -1104,10 +1524,24 @@ def unmarshal_Session(data: Any) -> Session: field = data.get("url", None) if field is not None: args["url"] = field + else: + args["url"] = None return Session(**args) +def marshal_BackupApiRestoreBackupItemsRequest( + request: BackupApiRestoreBackupItemsRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.item_ids is not None: + output["item_ids"] = request.item_ids + + return output + + def marshal_DatabaseApiAssignDatabaseUserRequest( request: DatabaseApiAssignDatabaseUserRequest, defaults: ProfileDefaults, @@ -1209,7 +1643,9 @@ def marshal_DnsApiCheckUserOwnsDomainRequest( output: Dict[str, Any] = {} if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id return output @@ -1248,7 +1684,7 @@ def marshal_SyncDomainDnsRecordsRequestRecord( output["name"] = request.name if request.type_ is not None: - output["type"] = str(request.type_) + output["type"] = request.type_ return output @@ -1367,7 +1803,9 @@ def marshal_HostingApiCreateHostingRequest( output["domain"] = request.domain if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id + output["project_id"] = request.project_id + else: + output["project_id"] = defaults.default_project_id if request.tags is not None: output["tags"] = request.tags @@ -1381,7 +1819,7 @@ def marshal_HostingApiCreateHostingRequest( ] if request.language is not None: - output["language"] = str(request.language) + output["language"] = request.language if request.domain_configuration is not None: output["domain_configuration"] = ( diff --git a/scaleway/scaleway/webhosting/v1/types.py b/scaleway/scaleway/webhosting/v1/types.py index 13e8ef91e..ce0bda760 100644 --- a/scaleway/scaleway/webhosting/v1/types.py +++ b/scaleway/scaleway/webhosting/v1/types.py @@ -2,7 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import List, Optional @@ -20,6 +20,34 @@ ) +class BackupItemType(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_BACKUP_ITEM_TYPE = "unknown_backup_item_type" + FULL = "full" + WEB = "web" + MAIL = "mail" + DB = "db" + DB_USER = "db_user" + FTP_USER = "ftp_user" + DNS_ZONE = "dns_zone" + CRON_JOB = "cron_job" + SSL_CERTIFICATE = "ssl_certificate" + + def __str__(self) -> str: + return str(self.value) + + +class BackupStatus(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_BACKUP_STATUS = "unknown_backup_status" + ACTIVE = "active" + LOCKED = "locked" + DISABLED = "disabled" + DAMAGED = "damaged" + RESTORING = "restoring" + + def __str__(self) -> str: + return str(self.value) + + class DnsRecordStatus(str, Enum, metaclass=StrEnumMeta): UNKNOWN_STATUS = "unknown_status" VALID = "valid" @@ -131,6 +159,14 @@ def __str__(self) -> str: return str(self.value) +class ListBackupsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_DESC = "created_at_desc" + CREATED_AT_ASC = "created_at_asc" + + def __str__(self) -> str: + return str(self.value) + + class ListDatabaseUsersRequestOrderBy(str, Enum, metaclass=StrEnumMeta): USERNAME_ASC = "username_asc" USERNAME_DESC = "username_desc" @@ -290,7 +326,7 @@ class HostingDomainCustomDomain: Status of the DNS configuration for the custom domain. """ - auto_config_domain_dns: Optional[AutoConfigDomainDns] + auto_config_domain_dns: Optional[AutoConfigDomainDns] = None """ Indicates whether to auto-configure DNS for this domain. """ @@ -333,7 +369,7 @@ class OfferOption: Defines a warning if the maximum value for the option has been reached. """ - price: Optional[Money] + price: Optional[Money] = None """ Price of the option for 1 value. """ @@ -346,12 +382,45 @@ class PlatformControlPanel: Name of the control panel. """ - urls: Optional[PlatformControlPanelUrls] + urls: Optional[PlatformControlPanelUrls] = None """ URL to connect to control panel dashboard and to Webmail interface. """ +@dataclass +class BackupItem: + id: str + """ + ID of the item. + """ + + name: str + """ + Name of the item (e.g., `database name`, `email address`). + """ + + type_: BackupItemType + """ + Type of the item (e.g., email, database, FTP). + """ + + size: int + """ + Size of the item in bytes. + """ + + status: BackupStatus + """ + Status of the item. Available values are `active`, `damaged`, and `restoring`. + """ + + created_at: Optional[datetime] = None + """ + Date and time at which this item was backed up. + """ + + @dataclass class HostingDomain: subdomain: str @@ -359,7 +428,7 @@ class HostingDomain: Optional free subdomain linked to the Web Hosting plan. """ - custom_domain: Optional[HostingDomainCustomDomain] + custom_domain: Optional[HostingDomainCustomDomain] = None """ Optional custom domain linked to the Web Hosting plan. """ @@ -368,18 +437,14 @@ class HostingDomain: @dataclass class CreateDatabaseRequestUser: username: str - password: str @dataclass class CreateHostingRequestDomainConfiguration: update_nameservers: bool - update_web_record: bool - update_mail_record: bool - update_all_records: bool @@ -399,7 +464,6 @@ class OfferOptionRequest: @dataclass class SyncDomainDnsRecordsRequestRecord: name: str - type_: DnsRecordType @@ -435,7 +499,7 @@ class DnsRecord: Record representation as it appears in the zone file or DNS management system. """ - priority: Optional[int] + priority: Optional[int] = 0 """ Record priority level. """ @@ -471,12 +535,12 @@ class HostingUser: Contact email used for the hosting. """ - one_time_password: Optional[str] + one_time_password: Optional[str] = None """ One-time-password used for the first login to the control panel, cleared after first use (deprecated, use password_b64 instead). """ - one_time_password_b64: Optional[str] + one_time_password_b64: Optional[str] = None """ One-time-password used for the first login to the control panel, cleared after first use, encoded in base64. """ @@ -524,7 +588,7 @@ class Offer: Defines a warning if the maximum value for an option in the offer is exceeded. """ - price: Optional[Money] + price: Optional[Money] = None """ Price of the offer. """ @@ -557,12 +621,53 @@ class Platform: IPv6 address of the hosting's host platform. """ - control_panel: Optional[PlatformControlPanel] + control_panel: Optional[PlatformControlPanel] = None """ Details of the platform control panel. """ +@dataclass +class BackupItemGroup: + type_: BackupItemType + """ + Type of items (e.g., email, database, FTP). + """ + + items: List[BackupItem] + """ + List of individual backup items of this type. + """ + + +@dataclass +class Backup: + id: str + """ + ID of the backup. + """ + + size: int + """ + Total size of the backup in bytes. + """ + + status: BackupStatus + """ + Status of the backup. Available values are `active`, `locked`, and `restoring`. + """ + + total_items: int + """ + Total number of restorable items in the backup. + """ + + created_at: Optional[datetime] = None + """ + Creation date of the backup. + """ + + @dataclass class ControlPanel: name: str @@ -657,32 +762,32 @@ class HostingSummary: Region where the Web Hosting plan is hosted. """ - created_at: Optional[datetime] + created_at: Optional[datetime] = None """ Date on which the Web Hosting plan was created. """ - updated_at: Optional[datetime] + updated_at: Optional[datetime] = None """ Date on which the Web Hosting plan was last updated. """ - domain: Optional[str] + domain: Optional[str] = None """ Main domain associated with the Web Hosting plan (deprecated, use domain_info). """ - dns_status: Optional[DnsRecordsStatus] + dns_status: Optional[DnsRecordsStatus] = DnsRecordsStatus.UNKNOWN_STATUS """ DNS status of the Web Hosting plan. """ - domain_status: Optional[DomainStatus] + domain_status: Optional[DomainStatus] = DomainStatus.UNKNOWN_STATUS """ Main domain status of the Web Hosting plan. """ - domain_info: Optional[HostingDomain] + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). """ @@ -746,12 +851,114 @@ class DomainAvailability: Whether a hosting can be created for this domain. """ - price: Optional[Money] + price: Optional[Money] = None """ Price for registering the domain. """ +@dataclass +class BackupApiGetBackupRequest: + hosting_id: str + """ + UUID of the hosting account. + """ + + backup_id: str + """ + ID of the backup to retrieve. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + +@dataclass +class BackupApiListBackupItemsRequest: + hosting_id: str + """ + UUID of the hosting account. + """ + + backup_id: str + """ + ID of the backup to list items from. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + +@dataclass +class BackupApiListBackupsRequest: + hosting_id: str + """ + UUID of the hosting account. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + page: Optional[int] = 0 + """ + Page number to retrieve. + """ + + page_size: Optional[int] = 0 + """ + Number of backups to return per page. + """ + + order_by: Optional[ListBackupsRequestOrderBy] = ( + ListBackupsRequestOrderBy.CREATED_AT_DESC + ) + """ + Order in which to return the list of backups. + """ + + +@dataclass +class BackupApiRestoreBackupItemsRequest: + hosting_id: str + """ + UUID of the hosting account. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + item_ids: Optional[List[str]] = field(default_factory=list) + """ + List of backup item IDs to restore individually. + """ + + +@dataclass +class BackupApiRestoreBackupRequest: + hosting_id: str + """ + UUID of the hosting account. + """ + + backup_id: str + """ + ID of the backup to fully restore. + """ + + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class CheckUserOwnsDomainResponse: owns_domain: bool @@ -762,17 +969,17 @@ class CheckUserOwnsDomainResponse: @dataclass class ControlPanelApiListControlPanelsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of control panels to return (must be a positive integer lower or equal to 100). """ @@ -795,7 +1002,7 @@ class DatabaseApiAssignDatabaseUserRequest: Name of the database to be assigned. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -818,7 +1025,7 @@ class DatabaseApiChangeDatabaseUserPasswordRequest: New password. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -836,14 +1043,14 @@ class DatabaseApiCreateDatabaseRequest: Name of the database to be created. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - new_user: Optional[CreateDatabaseRequestUser] + new_user: Optional[CreateDatabaseRequestUser] = None - existing_username: Optional[str] + existing_username: Optional[str] = None @dataclass @@ -863,7 +1070,7 @@ class DatabaseApiCreateDatabaseUserRequest: Password of the user to create. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -881,7 +1088,7 @@ class DatabaseApiDeleteDatabaseRequest: Name of the database to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -899,7 +1106,7 @@ class DatabaseApiDeleteDatabaseUserRequest: Name of the database user to delete. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -917,7 +1124,7 @@ class DatabaseApiGetDatabaseRequest: Name of the database. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -935,7 +1142,7 @@ class DatabaseApiGetDatabaseUserRequest: Name of the database user to retrieve details. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -948,22 +1155,24 @@ class DatabaseApiListDatabaseUsersRequest: UUID of the hosting plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of database users to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListDatabaseUsersRequestOrderBy] + order_by: Optional[ListDatabaseUsersRequestOrderBy] = ( + ListDatabaseUsersRequestOrderBy.USERNAME_ASC + ) """ Sort order of database users in the response. """ @@ -976,22 +1185,24 @@ class DatabaseApiListDatabasesRequest: UUID of the hosting plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of databases to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListDatabasesRequestOrderBy] + order_by: Optional[ListDatabasesRequestOrderBy] = ( + ListDatabasesRequestOrderBy.DATABASE_NAME_ASC + ) """ Sort order of databases in the response. """ @@ -1014,7 +1225,7 @@ class DatabaseApiUnassignDatabaseUserRequest: Name of the database to be unassigned. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1027,12 +1238,12 @@ class DnsApiCheckUserOwnsDomainRequest: Domain for which ownership is to be verified. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the project currently in use. """ @@ -1045,7 +1256,7 @@ class DnsApiGetDomainDnsRecordsRequest: Domain associated with the DNS records. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1058,12 +1269,12 @@ class DnsApiGetDomainRequest: Domain name to get. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Scaleway Project in which to get the domain to create the Web Hosting plan. """ @@ -1076,12 +1287,12 @@ class DnsApiSearchDomainsRequest: Domain name to search. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Scaleway Project in which to search the domain to create the Web Hosting plan. """ @@ -1094,37 +1305,39 @@ class DnsApiSyncDomainDnsRecordsRequest: Domain for which the DNS records will be synchronized. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - update_web_records: Optional[bool] + update_web_records: Optional[bool] = False """ Whether or not to synchronize the web records (deprecated, use auto_config_domain_dns). """ - update_mail_records: Optional[bool] + update_mail_records: Optional[bool] = False """ Whether or not to synchronize the mail records (deprecated, use auto_config_domain_dns). """ - update_all_records: Optional[bool] + update_all_records: Optional[bool] = False """ Whether or not to synchronize all types of records. This one has priority (deprecated, use auto_config_domain_dns). """ - update_nameservers: Optional[bool] + update_nameservers: Optional[bool] = False """ Whether or not to synchronize domain nameservers (deprecated, use auto_config_domain_dns). """ - custom_records: Optional[List[SyncDomainDnsRecordsRequestRecord]] + custom_records: Optional[List[SyncDomainDnsRecordsRequestRecord]] = field( + default_factory=list + ) """ Custom records to synchronize. """ - auto_config_domain_dns: Optional[AutoConfigDomainDns] + auto_config_domain_dns: Optional[AutoConfigDomainDns] = None """ Whether or not to synchronize each types of records. """ @@ -1147,12 +1360,12 @@ class DnsRecords: Status of the records. """ - dns_config: Optional[List[DomainDnsAction]] + dns_config: Optional[List[DomainDnsAction]] = field(default_factory=list) """ Records dns auto configuration settings (deprecated, use auto_config_domain_dns). """ - auto_config_domain_dns: Optional[AutoConfigDomainDns] + auto_config_domain_dns: Optional[AutoConfigDomainDns] = None """ Whether or not to synchronize each types of records. """ @@ -1185,12 +1398,12 @@ class Domain: A list of actions that can be performed on the domain. """ - available_dns_actions: Optional[List[DomainDnsAction]] + available_dns_actions: Optional[List[DomainDnsAction]] = field(default_factory=list) """ A list of DNS-related actions that can be auto configured for the domain (deprecated, use auto_config_domain_dns instead). """ - auto_config_domain_dns: Optional[AutoConfigDomainDns] + auto_config_domain_dns: Optional[AutoConfigDomainDns] = None """ Whether or not to synchronize each type of record. """ @@ -1213,7 +1426,7 @@ class FtpAccountApiChangeFtpAccountPasswordRequest: New password for the FTP account. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1241,7 +1454,7 @@ class FtpAccountApiCreateFtpAccountRequest: Password for the new FTP account. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1254,27 +1467,29 @@ class FtpAccountApiListFtpAccountsRequest: UUID of the hosting plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of FTP accounts to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListFtpAccountsRequestOrderBy] + order_by: Optional[ListFtpAccountsRequestOrderBy] = ( + ListFtpAccountsRequestOrderBy.USERNAME_ASC + ) """ Sort order of FTP accounts in the response. """ - domain: Optional[str] + domain: Optional[str] = None """ Domain to filter the FTP accounts. """ @@ -1292,7 +1507,7 @@ class FtpAccountApiRemoveFtpAccountRequest: Username of the FTP account to be deleted. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1315,67 +1530,67 @@ class Hosting: Status of the Web Hosting plan. """ - updated_at: Optional[datetime] + tags: List[str] """ - Date on which the Web Hosting plan was last updated. + List of tags associated with the Web Hosting plan. """ - created_at: Optional[datetime] + ipv4: str """ - Date on which the Web Hosting plan was created. + Current IPv4 address of the hosting. """ - domain: Optional[str] + protected: bool """ - Main domain associated with the Web Hosting plan (deprecated, use domain_info). + Whether the hosting is protected or not. """ - offer: Optional[Offer] + region: ScwRegion """ - Details of the Web Hosting plan offer and options. + Region where the Web Hosting plan is hosted. """ - platform: Optional[Platform] + updated_at: Optional[datetime] = None """ - Details of the hosting platform. + Date on which the Web Hosting plan was last updated. """ - tags: List[str] + created_at: Optional[datetime] = None """ - List of tags associated with the Web Hosting plan. + Date on which the Web Hosting plan was created. """ - ipv4: str + domain: Optional[str] = None """ - Current IPv4 address of the hosting. + Main domain associated with the Web Hosting plan (deprecated, use domain_info). """ - protected: bool + offer: Optional[Offer] = None """ - Whether the hosting is protected or not. + Details of the Web Hosting plan offer and options. """ - region: ScwRegion + platform: Optional[Platform] = None """ - Region where the Web Hosting plan is hosted. + Details of the hosting platform. """ - dns_status: Optional[DnsRecordsStatus] + dns_status: Optional[DnsRecordsStatus] = DnsRecordsStatus.UNKNOWN_STATUS """ DNS status of the Web Hosting plan (deprecated, use domain_info). """ - user: Optional[HostingUser] + user: Optional[HostingUser] = None """ Details of the hosting user. """ - domain_status: Optional[DomainStatus] + domain_status: Optional[DomainStatus] = DomainStatus.UNKNOWN_STATUS """ Main domain status of the Web Hosting plan (deprecated, use domain_info). """ - domain_info: Optional[HostingDomain] + domain_info: Optional[HostingDomain] = None """ Domain configuration block (subdomain, optional custom domain, and DNS settings). """ @@ -1398,47 +1613,47 @@ class HostingApiCreateHostingRequest: Domain name to link to the Web Hosting plan. You must already own this domain name, and have completed the DNS validation process beforehand. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - project_id: Optional[str] + project_id: Optional[str] = None """ ID of the Scaleway Project in which to create the Web Hosting plan. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ List of tags for the Web Hosting plan. """ - subdomain: Optional[str] + subdomain: Optional[str] = None """ The name prefix to use as a free subdomain (for example, `mysite`) assigned to the Web Hosting plan. The full domain will be automatically created by adding it to the fixed base domain (e.g. `mysite.scw.site`). You do not need to include the base domain yourself. """ - offer_options: Optional[List[OfferOptionRequest]] + offer_options: Optional[List[OfferOptionRequest]] = field(default_factory=list) """ List of the Web Hosting plan options IDs with their quantities. """ - language: Optional[StdLanguageCode] + language: Optional[StdLanguageCode] = StdLanguageCode.UNKNOWN_LANGUAGE_CODE """ Default language for the control panel interface. """ - domain_configuration: Optional[CreateHostingRequestDomainConfiguration] + domain_configuration: Optional[CreateHostingRequestDomainConfiguration] = None """ Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_config_domain_dns instead). """ - skip_welcome_email: Optional[bool] + skip_welcome_email: Optional[bool] = False """ Indicates whether to skip a welcome email to the contact email containing hosting info. """ - auto_config_domain_dns: Optional[AutoConfigDomainDns] + auto_config_domain_dns: Optional[AutoConfigDomainDns] = None """ Indicates whether to update hosting domain name servers and DNS records for domains managed by Scaleway Elements (deprecated, use auto_update_* fields instead). """ @@ -1451,7 +1666,7 @@ class HostingApiCreateSessionRequest: Hosting ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1464,7 +1679,7 @@ class HostingApiDeleteHostingRequest: Hosting ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1477,7 +1692,7 @@ class HostingApiGetHostingRequest: Hosting ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1490,7 +1705,7 @@ class HostingApiGetResourceSummaryRequest: Hosting ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1498,57 +1713,59 @@ class HostingApiGetResourceSummaryRequest: @dataclass class HostingApiListHostingsRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number to return, from the paginated results (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of Web Hosting plans to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListHostingsRequestOrderBy] + order_by: Optional[ListHostingsRequestOrderBy] = ( + ListHostingsRequestOrderBy.CREATED_AT_ASC + ) """ Sort order for Web Hosting plans in the response. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ Tags to filter for, only Web Hosting plans with matching tags will be returned. """ - statuses: Optional[List[HostingStatus]] + statuses: Optional[List[HostingStatus]] = field(default_factory=list) """ Statuses to filter for, only Web Hosting plans with matching statuses will be returned. """ - domain: Optional[str] + domain: Optional[str] = None """ Domain to filter for, only Web Hosting plans associated with this domain will be returned. """ - project_id: Optional[str] + project_id: Optional[str] = None """ Project ID to filter for, only Web Hosting plans from this Project will be returned. """ - organization_id: Optional[str] + organization_id: Optional[str] = None """ Organization ID to filter for, only Web Hosting plans from this Organization will be returned. """ - control_panels: Optional[List[str]] + control_panels: Optional[List[str]] = field(default_factory=list) """ Name of the control panel to filter for, only Web Hosting plans from this control panel will be returned. """ - subdomain: Optional[str] + subdomain: Optional[str] = None """ Optional free subdomain linked to the Web Hosting plan. """ @@ -1561,7 +1778,7 @@ class HostingApiResetHostingPasswordRequest: UUID of the hosting. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1574,37 +1791,63 @@ class HostingApiUpdateHostingRequest: Hosting ID. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - email: Optional[str] + email: Optional[str] = None """ New contact email for the Web Hosting plan. """ - tags: Optional[List[str]] + tags: Optional[List[str]] = field(default_factory=list) """ New tags for the Web Hosting plan. """ - offer_options: Optional[List[OfferOptionRequest]] + offer_options: Optional[List[OfferOptionRequest]] = field(default_factory=list) """ List of the Web Hosting plan options IDs with their quantities. """ - offer_id: Optional[str] + offer_id: Optional[str] = None """ ID of the new offer for the Web Hosting plan. """ - protected: Optional[bool] + protected: Optional[bool] = False """ Whether the hosting is protected or not. """ +@dataclass +class ListBackupItemsResponse: + total_count: int + """ + Total number of backup item groups. + """ + + groups: List[BackupItemGroup] + """ + List of backup item groups categorized by type. + """ + + +@dataclass +class ListBackupsResponse: + total_count: int + """ + Total number of available backups. + """ + + backups: List[Backup] + """ + List of available backups. + """ + + @dataclass class ListControlPanelsResponse: total_count: int @@ -1731,7 +1974,7 @@ class MailAccountApiChangeMailAccountPasswordRequest: New password for the mail account. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1759,7 +2002,7 @@ class MailAccountApiCreateMailAccountRequest: Password for the new mail account. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1772,27 +2015,29 @@ class MailAccountApiListMailAccountsRequest: UUID of the hosting plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of mail accounts to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListMailAccountsRequestOrderBy] + order_by: Optional[ListMailAccountsRequestOrderBy] = ( + ListMailAccountsRequestOrderBy.USERNAME_ASC + ) """ Sort order of mail accounts in the response. """ - domain: Optional[str] + domain: Optional[str] = None """ Domain to filter the mail accounts. """ @@ -1815,7 +2060,7 @@ class MailAccountApiRemoveMailAccountRequest: Username part of the mail account address. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ @@ -1823,32 +2068,32 @@ class MailAccountApiRemoveMailAccountRequest: @dataclass class OfferApiListOffersRequest: - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of websites to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListOffersRequestOrderBy] + order_by: Optional[ListOffersRequestOrderBy] = ListOffersRequestOrderBy.PRICE_ASC """ Sort order for Web Hosting offers in the response. """ - hosting_id: Optional[str] + hosting_id: Optional[str] = None """ UUID of the hosting plan. """ - control_panels: Optional[List[str]] + control_panels: Optional[List[str]] = field(default_factory=list) """ Name of the control panel(s) to filter for. """ @@ -1861,7 +2106,7 @@ class ResetHostingPasswordResponse: New temporary password, encoded in base64. """ - one_time_password: Optional[str] + one_time_password: Optional[str] = None """ New temporary password (deprecated, use password_b64 instead). """ @@ -1890,6 +2135,16 @@ class ResourceSummary: """ +@dataclass +class RestoreBackupItemsResponse: + pass + + +@dataclass +class RestoreBackupResponse: + pass + + @dataclass class SearchDomainsResponse: domains_available: List[DomainAvailability] @@ -1913,22 +2168,24 @@ class WebsiteApiListWebsitesRequest: UUID of the hosting plan. """ - region: Optional[ScwRegion] + region: Optional[ScwRegion] = None """ Region to target. If none is passed will use default region from the config. """ - page: Optional[int] + page: Optional[int] = 0 """ Page number (must be a positive integer). """ - page_size: Optional[int] + page_size: Optional[int] = 0 """ Number of websites to return (must be a positive integer lower or equal to 100). """ - order_by: Optional[ListWebsitesRequestOrderBy] + order_by: Optional[ListWebsitesRequestOrderBy] = ( + ListWebsitesRequestOrderBy.DOMAIN_ASC + ) """ Sort order for Web Hosting websites in the response. """