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
2 changes: 2 additions & 0 deletions scaleway-async/scaleway_async/mongodb/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .types import EndpointSpecPublicDetails
from .types import Endpoint
from .types import InstanceSetting
from .types import InstanceSnapshotSchedule
from .types import Volume
from .types import NodeTypeVolumeType
from .types import SnapshotVolumeType
Expand Down Expand Up @@ -77,6 +78,7 @@
"EndpointSpecPublicDetails",
"Endpoint",
"InstanceSetting",
"InstanceSnapshotSchedule",
"Volume",
"NodeTypeVolumeType",
"SnapshotVolumeType",
Expand Down
44 changes: 44 additions & 0 deletions scaleway-async/scaleway_async/mongodb/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
EndpointPublicDetails,
Endpoint,
InstanceSetting,
InstanceSnapshotSchedule,
Volume,
Instance,
SnapshotVolumeType,
Expand Down Expand Up @@ -131,6 +132,43 @@ def unmarshal_InstanceSetting(data: Any) -> InstanceSetting:
return InstanceSetting(**args)


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

args: Dict[str, Any] = {}

field = data.get("frequency_hours", None)
if field is not None:
args["frequency_hours"] = field

field = data.get("retention_days", None)
if field is not None:
args["retention_days"] = field

field = data.get("enabled", None)
if field is not None:
args["enabled"] = field

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

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

return InstanceSnapshotSchedule(**args)


def unmarshal_Volume(data: Any) -> Volume:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -218,6 +256,12 @@ def unmarshal_Instance(data: Any) -> Instance:
else:
args["created_at"] = None

field = data.get("snapshot_schedule", None)
if field is not None:
args["snapshot_schedule"] = unmarshal_InstanceSnapshotSchedule(field)
else:
args["snapshot_schedule"] = None

return Instance(**args)


Expand Down
18 changes: 18 additions & 0 deletions scaleway-async/scaleway_async/mongodb/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ class InstanceSetting:
"""


@dataclass
class InstanceSnapshotSchedule:
frequency_hours: int

retention_days: int

enabled: bool

next_update: Optional[datetime]

last_run: Optional[datetime]


@dataclass
class Volume:
type_: VolumeType
Expand Down Expand Up @@ -388,6 +401,11 @@ class Instance:
Creation date (must follow the ISO 8601 format).
"""

snapshot_schedule: Optional[InstanceSnapshotSchedule]
"""
Snapshot schedule configuration of the Database Instance.
"""


@dataclass
class NodeType:
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/mongodb/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .types import EndpointSpecPublicDetails
from .types import Endpoint
from .types import InstanceSetting
from .types import InstanceSnapshotSchedule
from .types import Volume
from .types import NodeTypeVolumeType
from .types import SnapshotVolumeType
Expand Down Expand Up @@ -77,6 +78,7 @@
"EndpointSpecPublicDetails",
"Endpoint",
"InstanceSetting",
"InstanceSnapshotSchedule",
"Volume",
"NodeTypeVolumeType",
"SnapshotVolumeType",
Expand Down
44 changes: 44 additions & 0 deletions scaleway/scaleway/mongodb/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
EndpointPublicDetails,
Endpoint,
InstanceSetting,
InstanceSnapshotSchedule,
Volume,
Instance,
SnapshotVolumeType,
Expand Down Expand Up @@ -131,6 +132,43 @@ def unmarshal_InstanceSetting(data: Any) -> InstanceSetting:
return InstanceSetting(**args)


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

args: Dict[str, Any] = {}

field = data.get("frequency_hours", None)
if field is not None:
args["frequency_hours"] = field

field = data.get("retention_days", None)
if field is not None:
args["retention_days"] = field

field = data.get("enabled", None)
if field is not None:
args["enabled"] = field

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

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

return InstanceSnapshotSchedule(**args)


def unmarshal_Volume(data: Any) -> Volume:
if not isinstance(data, dict):
raise TypeError(
Expand Down Expand Up @@ -218,6 +256,12 @@ def unmarshal_Instance(data: Any) -> Instance:
else:
args["created_at"] = None

field = data.get("snapshot_schedule", None)
if field is not None:
args["snapshot_schedule"] = unmarshal_InstanceSnapshotSchedule(field)
else:
args["snapshot_schedule"] = None

return Instance(**args)


Expand Down
18 changes: 18 additions & 0 deletions scaleway/scaleway/mongodb/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ class InstanceSetting:
"""


@dataclass
class InstanceSnapshotSchedule:
frequency_hours: int

retention_days: int

enabled: bool

next_update: Optional[datetime]

last_run: Optional[datetime]


@dataclass
class Volume:
type_: VolumeType
Expand Down Expand Up @@ -388,6 +401,11 @@ class Instance:
Creation date (must follow the ISO 8601 format).
"""

snapshot_schedule: Optional[InstanceSnapshotSchedule]
"""
Snapshot schedule configuration of the Database Instance.
"""


@dataclass
class NodeType:
Expand Down