Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scaleway-async/scaleway_async/mongodb/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from .types import InstanceSetting
from .types import InstanceSnapshotSchedule
from .types import Maintenance
from .types import Version
from .types import Volume
from .types import NodeTypeVolumeType
from .types import UserRole
Expand All @@ -35,7 +36,6 @@
from .types import NodeType
from .types import Snapshot
from .types import User
from .types import Version
from .types import ApplyMaintenanceRequest
from .types import CreateEndpointRequest
from .types import CreateInstanceRequest
Expand Down Expand Up @@ -98,6 +98,7 @@
"InstanceSetting",
"InstanceSnapshotSchedule",
"Maintenance",
"Version",
"Volume",
"NodeTypeVolumeType",
"UserRole",
Expand All @@ -107,7 +108,6 @@
"NodeType",
"Snapshot",
"User",
"Version",
"ApplyMaintenanceRequest",
"CreateEndpointRequest",
"CreateInstanceRequest",
Expand Down
10 changes: 5 additions & 5 deletions scaleway-async/scaleway_async/mongodb/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,17 +581,17 @@ async def upgrade_instance(
instance_id: str,
region: Optional[ScwRegion] = None,
volume_size_bytes: Optional[int] = None,
version_id: Optional[str] = None,
version: Optional[str] = None,
) -> Instance:
"""
Upgrade a Database Instance.
Upgrade your current Database Instance specifications like volume size.
:param instance_id: UUID of the Database Instance you want to upgrade.
:param region: Region to target. If none is passed will use default region from the config.
:param volume_size_bytes: Increase your Block Storage volume size.
One-Of ('upgrade_target'): at most one of 'volume_size_bytes', 'version_id' could be set.
:param version_id:
One-Of ('upgrade_target'): at most one of 'volume_size_bytes', 'version_id' could be set.
One-Of ('upgrade_target'): at most one of 'volume_size_bytes', 'version' could be set.
:param version: MongoDB version to upgrade to (e.g., `8.0`, `7.0`, `8.2`).
One-Of ('upgrade_target'): at most one of 'volume_size_bytes', 'version' could be set.
:return: :class:`Instance <Instance>`

Usage:
Expand All @@ -615,7 +615,7 @@ async def upgrade_instance(
instance_id=instance_id,
region=region,
volume_size_bytes=volume_size_bytes,
version_id=version_id,
version=version,
),
self.client,
),
Expand Down
78 changes: 43 additions & 35 deletions scaleway-async/scaleway_async/mongodb/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
Maintenance,
InstanceSetting,
InstanceSnapshotSchedule,
Version,
Volume,
Instance,
Snapshot,
Expand All @@ -40,7 +41,6 @@
ListNodeTypesResponse,
ListSnapshotsResponse,
ListUsersResponse,
Version,
ListVersionsResponse,
EndpointSpecPrivateNetworkDetails,
EndpointSpecPublicNetworkDetails,
Expand Down Expand Up @@ -327,6 +327,39 @@ def unmarshal_InstanceSnapshotSchedule(data: Any) -> InstanceSnapshotSchedule:
return InstanceSnapshotSchedule(**args)


def unmarshal_Version(data: Any) -> Version:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'Version' failed as data isn't a dictionary."
)

args: dict[str, Any] = {}

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:
args["end_of_life_at"] = (
parser.isoparse(field) if isinstance(field, str) else field
)
else:
args["end_of_life_at"] = None

field = data.get("released_at", None)
if field is not None:
args["released_at"] = (
parser.isoparse(field) if isinstance(field, str) else field
)
else:
args["released_at"] = None

return Version(**args)


def unmarshal_Volume(data: Any) -> Volume:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -442,6 +475,14 @@ def unmarshal_Instance(data: Any) -> Instance:
else:
args["maintenances"] = []

field = data.get("upgradable_versions", None)
if field is not None:
args["upgradable_versions"] = (
[unmarshal_Version(v) for v in field] if field is not None else None
)
else:
args["upgradable_versions"] = []

field = data.get("volume", None)
if field is not None:
args["volume"] = unmarshal_Volume(field)
Expand Down Expand Up @@ -877,39 +918,6 @@ def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse:
return ListUsersResponse(**args)


def unmarshal_Version(data: Any) -> Version:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'Version' failed as data isn't a dictionary."
)

args: dict[str, Any] = {}

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:
args["end_of_life_at"] = (
parser.isoparse(field) if isinstance(field, str) else field
)
else:
args["end_of_life_at"] = None

field = data.get("released_at", None)
if field is not None:
args["released_at"] = (
parser.isoparse(field) if isinstance(field, str) else field
)
else:
args["released_at"] = None

return Version(**args)


def unmarshal_ListVersionsResponse(data: Any) -> ListVersionsResponse:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -1218,7 +1226,7 @@ def marshal_UpgradeInstanceRequest(
marshal_func=None,
),
OneOfPossibility(
param="version_id", value=request.version_id, marshal_func=None
param="version", value=request.version, marshal_func=None
),
]
),
Expand Down
43 changes: 24 additions & 19 deletions scaleway-async/scaleway_async/mongodb/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,24 @@ class Maintenance:
"""


@dataclass
class Version:
version: str
"""
MongoDB® major engine version.
"""

end_of_life_at: Optional[datetime] = None
"""
Date of End of Life.
"""

released_at: Optional[datetime] = None
"""
Date of Release.
"""


@dataclass
class Volume:
type_: VolumeType
Expand Down Expand Up @@ -423,6 +441,11 @@ class Instance:
List of pending maintenances applicable to the Database Instance.
"""

upgradable_versions: list[Version]
"""
List of MongoDB® versions the Database Instance can be upgraded to.
"""

volume: Optional[Volume] = None
"""
Volumes of the Database Instance.
Expand Down Expand Up @@ -563,24 +586,6 @@ class User:
"""


@dataclass
class Version:
version: str
"""
MongoDB® major engine version.
"""

end_of_life_at: Optional[datetime] = None
"""
Date of End of Life.
"""

released_at: Optional[datetime] = None
"""
Date of Release.
"""


@dataclass
class ApplyMaintenanceRequest:
maintenance_id: str
Expand Down Expand Up @@ -1247,4 +1252,4 @@ class UpgradeInstanceRequest:

volume_size_bytes: Optional[int] = 0

version_id: Optional[str] = None
version: Optional[str] = None
4 changes: 2 additions & 2 deletions scaleway/scaleway/mongodb/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from .types import InstanceSetting
from .types import InstanceSnapshotSchedule
from .types import Maintenance
from .types import Version
from .types import Volume
from .types import NodeTypeVolumeType
from .types import UserRole
Expand All @@ -35,7 +36,6 @@
from .types import NodeType
from .types import Snapshot
from .types import User
from .types import Version
from .types import ApplyMaintenanceRequest
from .types import CreateEndpointRequest
from .types import CreateInstanceRequest
Expand Down Expand Up @@ -98,6 +98,7 @@
"InstanceSetting",
"InstanceSnapshotSchedule",
"Maintenance",
"Version",
"Volume",
"NodeTypeVolumeType",
"UserRole",
Expand All @@ -107,7 +108,6 @@
"NodeType",
"Snapshot",
"User",
"Version",
"ApplyMaintenanceRequest",
"CreateEndpointRequest",
"CreateInstanceRequest",
Expand Down
10 changes: 5 additions & 5 deletions scaleway/scaleway/mongodb/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,17 +579,17 @@ def upgrade_instance(
instance_id: str,
region: Optional[ScwRegion] = None,
volume_size_bytes: Optional[int] = None,
version_id: Optional[str] = None,
version: Optional[str] = None,
) -> Instance:
"""
Upgrade a Database Instance.
Upgrade your current Database Instance specifications like volume size.
:param instance_id: UUID of the Database Instance you want to upgrade.
:param region: Region to target. If none is passed will use default region from the config.
:param volume_size_bytes: Increase your Block Storage volume size.
One-Of ('upgrade_target'): at most one of 'volume_size_bytes', 'version_id' could be set.
:param version_id:
One-Of ('upgrade_target'): at most one of 'volume_size_bytes', 'version_id' could be set.
One-Of ('upgrade_target'): at most one of 'volume_size_bytes', 'version' could be set.
:param version: MongoDB version to upgrade to (e.g., `8.0`, `7.0`, `8.2`).
One-Of ('upgrade_target'): at most one of 'volume_size_bytes', 'version' could be set.
:return: :class:`Instance <Instance>`

Usage:
Expand All @@ -613,7 +613,7 @@ def upgrade_instance(
instance_id=instance_id,
region=region,
volume_size_bytes=volume_size_bytes,
version_id=version_id,
version=version,
),
self.client,
),
Expand Down
Loading
Loading