From 5c6d94bcba943c949762b510668a628d0a74fbac Mon Sep 17 00:00:00 2001 From: Prototool Bot Date: Tue, 26 May 2026 15:12:46 +0000 Subject: [PATCH] feat: update generated APIs --- .../scaleway_async/mongodb/v1/__init__.py | 16 +- .../scaleway_async/mongodb/v1/api.py | 8 +- .../scaleway_async/mongodb/v1/marshalling.py | 284 +++++++++--------- .../scaleway_async/mongodb/v1/types.py | 152 +++++----- scaleway/scaleway/mongodb/v1/__init__.py | 16 +- scaleway/scaleway/mongodb/v1/api.py | 8 +- scaleway/scaleway/mongodb/v1/marshalling.py | 284 +++++++++--------- scaleway/scaleway/mongodb/v1/types.py | 152 +++++----- 8 files changed, 484 insertions(+), 436 deletions(-) diff --git a/scaleway-async/scaleway_async/mongodb/v1/__init__.py b/scaleway-async/scaleway_async/mongodb/v1/__init__.py index 7737ed739..bfe9c094d 100644 --- a/scaleway-async/scaleway_async/mongodb/v1/__init__.py +++ b/scaleway-async/scaleway_async/mongodb/v1/__init__.py @@ -15,23 +15,23 @@ from .content import SNAPSHOT_TRANSIENT_STATUSES from .types import UserRoleRole from .types import VolumeType -from .types import EndpointPrivateNetworkDetails -from .types import EndpointPublicNetworkDetails from .types import EngineUpgrade from .types import ServiceUpdate +from .types import EndpointPrivateNetworkDetails +from .types import EndpointPublicNetworkDetails +from .types import Workflow from .types import EndpointSpecPrivateNetworkDetails from .types import EndpointSpecPublicNetworkDetails from .types import Endpoint from .types import InstanceSetting from .types import InstanceSnapshotSchedule +from .types import Maintenance from .types import Volume -from .types import Workflow from .types import NodeTypeVolumeType from .types import UserRole from .types import EndpointSpec from .types import Database from .types import Instance -from .types import Maintenance from .types import NodeType from .types import Snapshot from .types import User @@ -87,23 +87,23 @@ "SNAPSHOT_TRANSIENT_STATUSES", "UserRoleRole", "VolumeType", - "EndpointPrivateNetworkDetails", - "EndpointPublicNetworkDetails", "EngineUpgrade", "ServiceUpdate", + "EndpointPrivateNetworkDetails", + "EndpointPublicNetworkDetails", + "Workflow", "EndpointSpecPrivateNetworkDetails", "EndpointSpecPublicNetworkDetails", "Endpoint", "InstanceSetting", "InstanceSnapshotSchedule", + "Maintenance", "Volume", - "Workflow", "NodeTypeVolumeType", "UserRole", "EndpointSpec", "Database", "Instance", - "Maintenance", "NodeType", "Snapshot", "User", diff --git a/scaleway-async/scaleway_async/mongodb/v1/api.py b/scaleway-async/scaleway_async/mongodb/v1/api.py index ac6fd8439..8dcbcf3c2 100644 --- a/scaleway-async/scaleway_async/mongodb/v1/api.py +++ b/scaleway-async/scaleway_async/mongodb/v1/api.py @@ -60,8 +60,8 @@ ) from .marshalling import ( unmarshal_Endpoint, - unmarshal_Instance, unmarshal_Maintenance, + unmarshal_Instance, unmarshal_Snapshot, unmarshal_User, unmarshal_ListDatabasesResponse, @@ -244,6 +244,7 @@ async def list_instances( order_by: Optional[ListInstancesRequestOrderBy] = None, organization_id: Optional[str] = None, project_id: Optional[str] = None, + has_maintenance: Optional[bool] = None, page: Optional[int] = None, page_size: Optional[int] = None, ) -> ListInstancesResponse: @@ -256,6 +257,7 @@ async def list_instances( :param order_by: Criteria to use when ordering Database Instance listings. :param organization_id: Organization ID of the Database Instance. :param project_id: Project ID to list the instances of. + :param has_maintenance: Retrieve pending maintenances for the database instances if given. :param page: :param page_size: :return: :class:`ListInstancesResponse ` @@ -274,6 +276,7 @@ async def list_instances( "GET", f"/mongodb/v1/regions/{param_region}/instances", params={ + "has_maintenance": has_maintenance, "name": name, "order_by": order_by, "organization_id": organization_id @@ -297,6 +300,7 @@ async def list_instances_all( order_by: Optional[ListInstancesRequestOrderBy] = None, organization_id: Optional[str] = None, project_id: Optional[str] = None, + has_maintenance: Optional[bool] = None, page: Optional[int] = None, page_size: Optional[int] = None, ) -> list[Instance]: @@ -309,6 +313,7 @@ async def list_instances_all( :param order_by: Criteria to use when ordering Database Instance listings. :param organization_id: Organization ID of the Database Instance. :param project_id: Project ID to list the instances of. + :param has_maintenance: Retrieve pending maintenances for the database instances if given. :param page: :param page_size: :return: :class:`list[Instance] ` @@ -330,6 +335,7 @@ async def list_instances_all( "order_by": order_by, "organization_id": organization_id, "project_id": project_id, + "has_maintenance": has_maintenance, "page": page, "page_size": page_size, }, diff --git a/scaleway-async/scaleway_async/mongodb/v1/marshalling.py b/scaleway-async/scaleway_async/mongodb/v1/marshalling.py index 3ef783357..7fdfa37d9 100644 --- a/scaleway-async/scaleway_async/mongodb/v1/marshalling.py +++ b/scaleway-async/scaleway_async/mongodb/v1/marshalling.py @@ -20,14 +20,14 @@ EndpointPrivateNetworkDetails, EndpointPublicNetworkDetails, Endpoint, - InstanceSetting, - InstanceSnapshotSchedule, - Volume, - Instance, EngineUpgrade, ServiceUpdate, Workflow, Maintenance, + InstanceSetting, + InstanceSnapshotSchedule, + Volume, + Instance, Snapshot, UserRole, User, @@ -127,6 +127,140 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: return Endpoint(**args) +def unmarshal_EngineUpgrade(data: Any) -> EngineUpgrade: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'EngineUpgrade' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("new_version_id", None) + if field is not None: + args["new_version_id"] = field + else: + args["new_version_id"] = None + + return EngineUpgrade(**args) + + +def unmarshal_ServiceUpdate(data: Any) -> ServiceUpdate: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ServiceUpdate' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("service_name", None) + if field is not None: + args["service_name"] = field + else: + args["service_name"] = None + + return ServiceUpdate(**args) + + +def unmarshal_Workflow(data: Any) -> Workflow: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Workflow' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("engine_upgrade", None) + if field is not None: + args["engine_upgrade"] = unmarshal_EngineUpgrade(field) + else: + args["engine_upgrade"] = None + + field = data.get("service_update", None) + if field is not None: + args["service_update"] = unmarshal_ServiceUpdate(field) + else: + args["service_update"] = None + + return Workflow(**args) + + +def unmarshal_Maintenance(data: Any) -> Maintenance: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Maintenance' 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("instance_id", None) + if field is not None: + args["instance_id"] = field + else: + args["instance_id"] = None + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = MaintenanceStatus.UNKNOWN_STATUS + + field = data.get("applied_by", None) + if field is not None: + args["applied_by"] = field + else: + args["applied_by"] = MaintenanceAppliedBy.UNKNOWN_APPLIED_BY + + field = data.get("reason", None) + if field is not None: + args["reason"] = field + else: + args["reason"] = 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("starts_at", None) + if field is not None: + args["starts_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["starts_at"] = None + + field = data.get("stops_at", None) + if field is not None: + args["stops_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["stops_at"] = None + + field = data.get("forced_at", None) + if field is not None: + args["forced_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["forced_at"] = None + + field = data.get("applied_at", None) + if field is not None: + args["applied_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["applied_at"] = None + + field = data.get("workflow", None) + if field is not None: + args["workflow"] = unmarshal_Workflow(field) + else: + args["workflow"] = None + + return Maintenance(**args) + + def unmarshal_InstanceSetting(data: Any) -> InstanceSetting: if not isinstance(data, dict): raise TypeError( @@ -300,6 +434,14 @@ def unmarshal_Instance(data: Any) -> Instance: else: args["settings"] = [] + 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 = data.get("volume", None) if field is not None: args["volume"] = unmarshal_Volume(field) @@ -321,140 +463,6 @@ def unmarshal_Instance(data: Any) -> Instance: return Instance(**args) -def unmarshal_EngineUpgrade(data: Any) -> EngineUpgrade: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'EngineUpgrade' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("new_version_id", None) - if field is not None: - args["new_version_id"] = field - else: - args["new_version_id"] = None - - return EngineUpgrade(**args) - - -def unmarshal_ServiceUpdate(data: Any) -> ServiceUpdate: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ServiceUpdate' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("service_name", None) - if field is not None: - args["service_name"] = field - else: - args["service_name"] = None - - return ServiceUpdate(**args) - - -def unmarshal_Workflow(data: Any) -> Workflow: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Workflow' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("engine_upgrade", None) - if field is not None: - args["engine_upgrade"] = unmarshal_EngineUpgrade(field) - else: - args["engine_upgrade"] = None - - field = data.get("service_update", None) - if field is not None: - args["service_update"] = unmarshal_ServiceUpdate(field) - else: - args["service_update"] = None - - return Workflow(**args) - - -def unmarshal_Maintenance(data: Any) -> Maintenance: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Maintenance' 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("instance_id", None) - if field is not None: - args["instance_id"] = field - else: - args["instance_id"] = None - - field = data.get("status", None) - if field is not None: - args["status"] = field - else: - args["status"] = MaintenanceStatus.UNKNOWN_STATUS - - field = data.get("applied_by", None) - if field is not None: - args["applied_by"] = field - else: - args["applied_by"] = MaintenanceAppliedBy.UNKNOWN_APPLIED_BY - - field = data.get("reason", None) - if field is not None: - args["reason"] = field - else: - args["reason"] = 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("starts_at", None) - if field is not None: - args["starts_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["starts_at"] = None - - field = data.get("stops_at", None) - if field is not None: - args["stops_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["stops_at"] = None - - field = data.get("forced_at", None) - if field is not None: - args["forced_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["forced_at"] = None - - field = data.get("applied_at", None) - if field is not None: - args["applied_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["applied_at"] = None - - field = data.get("workflow", None) - if field is not None: - args["workflow"] = unmarshal_Workflow(field) - else: - args["workflow"] = None - - return Maintenance(**args) - - def unmarshal_Snapshot(data: Any) -> Snapshot: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway-async/scaleway_async/mongodb/v1/types.py b/scaleway-async/scaleway_async/mongodb/v1/types.py index fc88cb76a..930dc8623 100644 --- a/scaleway-async/scaleway_async/mongodb/v1/types.py +++ b/scaleway-async/scaleway_async/mongodb/v1/types.py @@ -145,6 +145,16 @@ def __str__(self) -> str: return str(self.value) +@dataclass +class EngineUpgrade: + new_version_id: str + + +@dataclass +class ServiceUpdate: + service_name: str + + @dataclass class EndpointPrivateNetworkDetails: """ @@ -167,13 +177,10 @@ class EndpointPublicNetworkDetails: @dataclass -class EngineUpgrade: - new_version_id: str - +class Workflow: + engine_upgrade: Optional[EngineUpgrade] = None -@dataclass -class ServiceUpdate: - service_name: str + service_update: Optional[ServiceUpdate] = None @dataclass @@ -226,6 +233,64 @@ class InstanceSnapshotSchedule: last_run: Optional[datetime] = None +@dataclass +class Maintenance: + id: str + """ + ID of the maintenance. + """ + + instance_id: str + """ + ID of the instance on which the maintenance is applied. + """ + + status: MaintenanceStatus + """ + Current status of the maintenance. + """ + + applied_by: MaintenanceAppliedBy + """ + Usertype who launched the maintenance. + """ + + reason: str + """ + Reason of the maintenance. + """ + + created_at: Optional[datetime] = None + """ + Creation date of the maintenance. + """ + + starts_at: Optional[datetime] = None + """ + Start date of the maintenance. + """ + + stops_at: Optional[datetime] = None + """ + Stop date of the maintenance. + """ + + forced_at: Optional[datetime] = None + """ + Forced application date of the maintenance. + """ + + applied_at: Optional[datetime] = None + """ + Application date of the maintenance. + """ + + workflow: Optional[Workflow] = None + """ + Workflow to be applied during maintenance. + """ + + @dataclass class Volume: type_: VolumeType @@ -239,13 +304,6 @@ class Volume: """ -@dataclass -class Workflow: - engine_upgrade: Optional[EngineUpgrade] = None - - service_update: Optional[ServiceUpdate] = None - - @dataclass class NodeTypeVolumeType: type_: VolumeType @@ -360,6 +418,11 @@ class Instance: List of settings applied to the Database Instance. """ + maintenances: list[Maintenance] + """ + List of pending maintenances applicable to the Database Instance. + """ + volume: Optional[Volume] = None """ Volumes of the Database Instance. @@ -376,64 +439,6 @@ class Instance: """ -@dataclass -class Maintenance: - id: str - """ - ID of the maintenance. - """ - - instance_id: str - """ - ID of the instance on which the maintenance is applied. - """ - - status: MaintenanceStatus - """ - Current status of the maintenance. - """ - - applied_by: MaintenanceAppliedBy - """ - Usertype who launched the maintenance. - """ - - reason: str - """ - Reason of the maintenance. - """ - - created_at: Optional[datetime] = None - """ - Creation date of the maintenance. - """ - - starts_at: Optional[datetime] = None - """ - Start date of the maintenance. - """ - - stops_at: Optional[datetime] = None - """ - Stop date of the maintenance. - """ - - forced_at: Optional[datetime] = None - """ - Forced application date of the maintenance. - """ - - applied_at: Optional[datetime] = None - """ - Application date of the maintenance. - """ - - workflow: Optional[Workflow] = None - """ - Workflow to be applied during maintenance. - """ - - @dataclass class NodeType: name: str @@ -881,6 +886,11 @@ class ListInstancesRequest: Project ID to list the instances of. """ + has_maintenance: Optional[bool] = False + """ + Retrieve pending maintenances for the database instances if given. + """ + page: Optional[int] = 0 page_size: Optional[int] = 0 diff --git a/scaleway/scaleway/mongodb/v1/__init__.py b/scaleway/scaleway/mongodb/v1/__init__.py index 7737ed739..bfe9c094d 100644 --- a/scaleway/scaleway/mongodb/v1/__init__.py +++ b/scaleway/scaleway/mongodb/v1/__init__.py @@ -15,23 +15,23 @@ from .content import SNAPSHOT_TRANSIENT_STATUSES from .types import UserRoleRole from .types import VolumeType -from .types import EndpointPrivateNetworkDetails -from .types import EndpointPublicNetworkDetails from .types import EngineUpgrade from .types import ServiceUpdate +from .types import EndpointPrivateNetworkDetails +from .types import EndpointPublicNetworkDetails +from .types import Workflow from .types import EndpointSpecPrivateNetworkDetails from .types import EndpointSpecPublicNetworkDetails from .types import Endpoint from .types import InstanceSetting from .types import InstanceSnapshotSchedule +from .types import Maintenance from .types import Volume -from .types import Workflow from .types import NodeTypeVolumeType from .types import UserRole from .types import EndpointSpec from .types import Database from .types import Instance -from .types import Maintenance from .types import NodeType from .types import Snapshot from .types import User @@ -87,23 +87,23 @@ "SNAPSHOT_TRANSIENT_STATUSES", "UserRoleRole", "VolumeType", - "EndpointPrivateNetworkDetails", - "EndpointPublicNetworkDetails", "EngineUpgrade", "ServiceUpdate", + "EndpointPrivateNetworkDetails", + "EndpointPublicNetworkDetails", + "Workflow", "EndpointSpecPrivateNetworkDetails", "EndpointSpecPublicNetworkDetails", "Endpoint", "InstanceSetting", "InstanceSnapshotSchedule", + "Maintenance", "Volume", - "Workflow", "NodeTypeVolumeType", "UserRole", "EndpointSpec", "Database", "Instance", - "Maintenance", "NodeType", "Snapshot", "User", diff --git a/scaleway/scaleway/mongodb/v1/api.py b/scaleway/scaleway/mongodb/v1/api.py index 261f077c0..585b18d78 100644 --- a/scaleway/scaleway/mongodb/v1/api.py +++ b/scaleway/scaleway/mongodb/v1/api.py @@ -60,8 +60,8 @@ ) from .marshalling import ( unmarshal_Endpoint, - unmarshal_Instance, unmarshal_Maintenance, + unmarshal_Instance, unmarshal_Snapshot, unmarshal_User, unmarshal_ListDatabasesResponse, @@ -244,6 +244,7 @@ def list_instances( order_by: Optional[ListInstancesRequestOrderBy] = None, organization_id: Optional[str] = None, project_id: Optional[str] = None, + has_maintenance: Optional[bool] = None, page: Optional[int] = None, page_size: Optional[int] = None, ) -> ListInstancesResponse: @@ -256,6 +257,7 @@ def list_instances( :param order_by: Criteria to use when ordering Database Instance listings. :param organization_id: Organization ID of the Database Instance. :param project_id: Project ID to list the instances of. + :param has_maintenance: Retrieve pending maintenances for the database instances if given. :param page: :param page_size: :return: :class:`ListInstancesResponse ` @@ -274,6 +276,7 @@ def list_instances( "GET", f"/mongodb/v1/regions/{param_region}/instances", params={ + "has_maintenance": has_maintenance, "name": name, "order_by": order_by, "organization_id": organization_id @@ -297,6 +300,7 @@ def list_instances_all( order_by: Optional[ListInstancesRequestOrderBy] = None, organization_id: Optional[str] = None, project_id: Optional[str] = None, + has_maintenance: Optional[bool] = None, page: Optional[int] = None, page_size: Optional[int] = None, ) -> list[Instance]: @@ -309,6 +313,7 @@ def list_instances_all( :param order_by: Criteria to use when ordering Database Instance listings. :param organization_id: Organization ID of the Database Instance. :param project_id: Project ID to list the instances of. + :param has_maintenance: Retrieve pending maintenances for the database instances if given. :param page: :param page_size: :return: :class:`list[Instance] ` @@ -330,6 +335,7 @@ def list_instances_all( "order_by": order_by, "organization_id": organization_id, "project_id": project_id, + "has_maintenance": has_maintenance, "page": page, "page_size": page_size, }, diff --git a/scaleway/scaleway/mongodb/v1/marshalling.py b/scaleway/scaleway/mongodb/v1/marshalling.py index 3ef783357..7fdfa37d9 100644 --- a/scaleway/scaleway/mongodb/v1/marshalling.py +++ b/scaleway/scaleway/mongodb/v1/marshalling.py @@ -20,14 +20,14 @@ EndpointPrivateNetworkDetails, EndpointPublicNetworkDetails, Endpoint, - InstanceSetting, - InstanceSnapshotSchedule, - Volume, - Instance, EngineUpgrade, ServiceUpdate, Workflow, Maintenance, + InstanceSetting, + InstanceSnapshotSchedule, + Volume, + Instance, Snapshot, UserRole, User, @@ -127,6 +127,140 @@ def unmarshal_Endpoint(data: Any) -> Endpoint: return Endpoint(**args) +def unmarshal_EngineUpgrade(data: Any) -> EngineUpgrade: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'EngineUpgrade' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("new_version_id", None) + if field is not None: + args["new_version_id"] = field + else: + args["new_version_id"] = None + + return EngineUpgrade(**args) + + +def unmarshal_ServiceUpdate(data: Any) -> ServiceUpdate: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ServiceUpdate' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("service_name", None) + if field is not None: + args["service_name"] = field + else: + args["service_name"] = None + + return ServiceUpdate(**args) + + +def unmarshal_Workflow(data: Any) -> Workflow: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Workflow' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("engine_upgrade", None) + if field is not None: + args["engine_upgrade"] = unmarshal_EngineUpgrade(field) + else: + args["engine_upgrade"] = None + + field = data.get("service_update", None) + if field is not None: + args["service_update"] = unmarshal_ServiceUpdate(field) + else: + args["service_update"] = None + + return Workflow(**args) + + +def unmarshal_Maintenance(data: Any) -> Maintenance: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'Maintenance' 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("instance_id", None) + if field is not None: + args["instance_id"] = field + else: + args["instance_id"] = None + + field = data.get("status", None) + if field is not None: + args["status"] = field + else: + args["status"] = MaintenanceStatus.UNKNOWN_STATUS + + field = data.get("applied_by", None) + if field is not None: + args["applied_by"] = field + else: + args["applied_by"] = MaintenanceAppliedBy.UNKNOWN_APPLIED_BY + + field = data.get("reason", None) + if field is not None: + args["reason"] = field + else: + args["reason"] = 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("starts_at", None) + if field is not None: + args["starts_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["starts_at"] = None + + field = data.get("stops_at", None) + if field is not None: + args["stops_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["stops_at"] = None + + field = data.get("forced_at", None) + if field is not None: + args["forced_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["forced_at"] = None + + field = data.get("applied_at", None) + if field is not None: + args["applied_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["applied_at"] = None + + field = data.get("workflow", None) + if field is not None: + args["workflow"] = unmarshal_Workflow(field) + else: + args["workflow"] = None + + return Maintenance(**args) + + def unmarshal_InstanceSetting(data: Any) -> InstanceSetting: if not isinstance(data, dict): raise TypeError( @@ -300,6 +434,14 @@ def unmarshal_Instance(data: Any) -> Instance: else: args["settings"] = [] + 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 = data.get("volume", None) if field is not None: args["volume"] = unmarshal_Volume(field) @@ -321,140 +463,6 @@ def unmarshal_Instance(data: Any) -> Instance: return Instance(**args) -def unmarshal_EngineUpgrade(data: Any) -> EngineUpgrade: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'EngineUpgrade' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("new_version_id", None) - if field is not None: - args["new_version_id"] = field - else: - args["new_version_id"] = None - - return EngineUpgrade(**args) - - -def unmarshal_ServiceUpdate(data: Any) -> ServiceUpdate: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ServiceUpdate' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("service_name", None) - if field is not None: - args["service_name"] = field - else: - args["service_name"] = None - - return ServiceUpdate(**args) - - -def unmarshal_Workflow(data: Any) -> Workflow: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Workflow' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("engine_upgrade", None) - if field is not None: - args["engine_upgrade"] = unmarshal_EngineUpgrade(field) - else: - args["engine_upgrade"] = None - - field = data.get("service_update", None) - if field is not None: - args["service_update"] = unmarshal_ServiceUpdate(field) - else: - args["service_update"] = None - - return Workflow(**args) - - -def unmarshal_Maintenance(data: Any) -> Maintenance: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Maintenance' 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("instance_id", None) - if field is not None: - args["instance_id"] = field - else: - args["instance_id"] = None - - field = data.get("status", None) - if field is not None: - args["status"] = field - else: - args["status"] = MaintenanceStatus.UNKNOWN_STATUS - - field = data.get("applied_by", None) - if field is not None: - args["applied_by"] = field - else: - args["applied_by"] = MaintenanceAppliedBy.UNKNOWN_APPLIED_BY - - field = data.get("reason", None) - if field is not None: - args["reason"] = field - else: - args["reason"] = 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("starts_at", None) - if field is not None: - args["starts_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["starts_at"] = None - - field = data.get("stops_at", None) - if field is not None: - args["stops_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["stops_at"] = None - - field = data.get("forced_at", None) - if field is not None: - args["forced_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["forced_at"] = None - - field = data.get("applied_at", None) - if field is not None: - args["applied_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["applied_at"] = None - - field = data.get("workflow", None) - if field is not None: - args["workflow"] = unmarshal_Workflow(field) - else: - args["workflow"] = None - - return Maintenance(**args) - - def unmarshal_Snapshot(data: Any) -> Snapshot: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway/scaleway/mongodb/v1/types.py b/scaleway/scaleway/mongodb/v1/types.py index fc88cb76a..930dc8623 100644 --- a/scaleway/scaleway/mongodb/v1/types.py +++ b/scaleway/scaleway/mongodb/v1/types.py @@ -145,6 +145,16 @@ def __str__(self) -> str: return str(self.value) +@dataclass +class EngineUpgrade: + new_version_id: str + + +@dataclass +class ServiceUpdate: + service_name: str + + @dataclass class EndpointPrivateNetworkDetails: """ @@ -167,13 +177,10 @@ class EndpointPublicNetworkDetails: @dataclass -class EngineUpgrade: - new_version_id: str - +class Workflow: + engine_upgrade: Optional[EngineUpgrade] = None -@dataclass -class ServiceUpdate: - service_name: str + service_update: Optional[ServiceUpdate] = None @dataclass @@ -226,6 +233,64 @@ class InstanceSnapshotSchedule: last_run: Optional[datetime] = None +@dataclass +class Maintenance: + id: str + """ + ID of the maintenance. + """ + + instance_id: str + """ + ID of the instance on which the maintenance is applied. + """ + + status: MaintenanceStatus + """ + Current status of the maintenance. + """ + + applied_by: MaintenanceAppliedBy + """ + Usertype who launched the maintenance. + """ + + reason: str + """ + Reason of the maintenance. + """ + + created_at: Optional[datetime] = None + """ + Creation date of the maintenance. + """ + + starts_at: Optional[datetime] = None + """ + Start date of the maintenance. + """ + + stops_at: Optional[datetime] = None + """ + Stop date of the maintenance. + """ + + forced_at: Optional[datetime] = None + """ + Forced application date of the maintenance. + """ + + applied_at: Optional[datetime] = None + """ + Application date of the maintenance. + """ + + workflow: Optional[Workflow] = None + """ + Workflow to be applied during maintenance. + """ + + @dataclass class Volume: type_: VolumeType @@ -239,13 +304,6 @@ class Volume: """ -@dataclass -class Workflow: - engine_upgrade: Optional[EngineUpgrade] = None - - service_update: Optional[ServiceUpdate] = None - - @dataclass class NodeTypeVolumeType: type_: VolumeType @@ -360,6 +418,11 @@ class Instance: List of settings applied to the Database Instance. """ + maintenances: list[Maintenance] + """ + List of pending maintenances applicable to the Database Instance. + """ + volume: Optional[Volume] = None """ Volumes of the Database Instance. @@ -376,64 +439,6 @@ class Instance: """ -@dataclass -class Maintenance: - id: str - """ - ID of the maintenance. - """ - - instance_id: str - """ - ID of the instance on which the maintenance is applied. - """ - - status: MaintenanceStatus - """ - Current status of the maintenance. - """ - - applied_by: MaintenanceAppliedBy - """ - Usertype who launched the maintenance. - """ - - reason: str - """ - Reason of the maintenance. - """ - - created_at: Optional[datetime] = None - """ - Creation date of the maintenance. - """ - - starts_at: Optional[datetime] = None - """ - Start date of the maintenance. - """ - - stops_at: Optional[datetime] = None - """ - Stop date of the maintenance. - """ - - forced_at: Optional[datetime] = None - """ - Forced application date of the maintenance. - """ - - applied_at: Optional[datetime] = None - """ - Application date of the maintenance. - """ - - workflow: Optional[Workflow] = None - """ - Workflow to be applied during maintenance. - """ - - @dataclass class NodeType: name: str @@ -881,6 +886,11 @@ class ListInstancesRequest: Project ID to list the instances of. """ + has_maintenance: Optional[bool] = False + """ + Retrieve pending maintenances for the database instances if given. + """ + page: Optional[int] = 0 page_size: Optional[int] = 0