Skip to content

Commit

Permalink
feat(rdb): add possibility to update BackupSchedule next update (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Jun 30, 2023
1 parent 94752f3 commit ef6a521
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scaleway-async/scaleway_async/rdb/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,7 @@ async def update_instance(
tags: Optional[List[str]] = None,
logs_policy: Optional[LogsPolicy] = None,
backup_same_region: Optional[bool] = None,
backup_schedule_start_hour: Optional[int] = None,
) -> Instance:
"""
Update a Database Instance.
Expand All @@ -1059,6 +1060,7 @@ async def update_instance(
:param tags: Tags of a Database Instance.
:param logs_policy: Logs policy of the Database Instance.
:param backup_same_region: Store logical backups in the same region as the Database Instance.
:param backup_schedule_start_hour: Defines the start time of the autobackup.
:return: :class:`Instance <Instance>`
Usage:
Expand Down Expand Up @@ -1086,6 +1088,7 @@ async def update_instance(
tags=tags,
logs_policy=logs_policy,
backup_same_region=backup_same_region,
backup_schedule_start_hour=backup_schedule_start_hour,
),
self.client,
),
Expand Down
4 changes: 4 additions & 0 deletions scaleway-async/scaleway_async/rdb/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ def unmarshal_BackupSchedule(data: Any) -> BackupSchedule:
field = data.get("frequency", None)
args["frequency"] = field

field = data.get("next_run_at", None)
args["next_run_at"] = parser.isoparse(field) if type(field) is str else field

field = data.get("retention", None)
args["retention"] = field

Expand Down Expand Up @@ -1620,6 +1623,7 @@ def marshal_UpdateInstanceRequest(
"backup_same_region": request.backup_same_region,
"backup_schedule_frequency": request.backup_schedule_frequency,
"backup_schedule_retention": request.backup_schedule_retention,
"backup_schedule_start_hour": request.backup_schedule_start_hour,
"is_backup_schedule_disabled": request.is_backup_schedule_disabled,
"logs_policy": marshal_LogsPolicy(request.logs_policy, defaults)
if request.logs_policy is not None
Expand Down
23 changes: 23 additions & 0 deletions scaleway-async/scaleway_async/rdb/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,29 @@ class AddInstanceSettingsResponse:

@dataclass
class BackupSchedule:
"""
Backup schedule.
"""

frequency: int
"""
Frequency of the backup schedule (in hours).
"""

retention: int
"""
Default retention period of backups (in days).
"""

disabled: bool
"""
Defines whether the backup schedule feature is disabled.
"""

next_run_at: Optional[datetime]
"""
Next run of the backup schedule (accurate to 10 minutes).
"""


@dataclass
Expand Down Expand Up @@ -1911,6 +1929,11 @@ class UpdateInstanceRequest:
Store logical backups in the same region as the Database Instance.
"""

backup_schedule_start_hour: Optional[int]
"""
Defines the start time of the autobackup.
"""


@dataclass
class DeleteInstanceRequest:
Expand Down
3 changes: 3 additions & 0 deletions scaleway/scaleway/rdb/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ def update_instance(
tags: Optional[List[str]] = None,
logs_policy: Optional[LogsPolicy] = None,
backup_same_region: Optional[bool] = None,
backup_schedule_start_hour: Optional[int] = None,
) -> Instance:
"""
Update a Database Instance.
Expand All @@ -1055,6 +1056,7 @@ def update_instance(
:param tags: Tags of a Database Instance.
:param logs_policy: Logs policy of the Database Instance.
:param backup_same_region: Store logical backups in the same region as the Database Instance.
:param backup_schedule_start_hour: Defines the start time of the autobackup.
:return: :class:`Instance <Instance>`
Usage:
Expand Down Expand Up @@ -1082,6 +1084,7 @@ def update_instance(
tags=tags,
logs_policy=logs_policy,
backup_same_region=backup_same_region,
backup_schedule_start_hour=backup_schedule_start_hour,
),
self.client,
),
Expand Down
4 changes: 4 additions & 0 deletions scaleway/scaleway/rdb/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ def unmarshal_BackupSchedule(data: Any) -> BackupSchedule:
field = data.get("frequency", None)
args["frequency"] = field

field = data.get("next_run_at", None)
args["next_run_at"] = parser.isoparse(field) if type(field) is str else field

field = data.get("retention", None)
args["retention"] = field

Expand Down Expand Up @@ -1620,6 +1623,7 @@ def marshal_UpdateInstanceRequest(
"backup_same_region": request.backup_same_region,
"backup_schedule_frequency": request.backup_schedule_frequency,
"backup_schedule_retention": request.backup_schedule_retention,
"backup_schedule_start_hour": request.backup_schedule_start_hour,
"is_backup_schedule_disabled": request.is_backup_schedule_disabled,
"logs_policy": marshal_LogsPolicy(request.logs_policy, defaults)
if request.logs_policy is not None
Expand Down
23 changes: 23 additions & 0 deletions scaleway/scaleway/rdb/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,29 @@ class AddInstanceSettingsResponse:

@dataclass
class BackupSchedule:
"""
Backup schedule.
"""

frequency: int
"""
Frequency of the backup schedule (in hours).
"""

retention: int
"""
Default retention period of backups (in days).
"""

disabled: bool
"""
Defines whether the backup schedule feature is disabled.
"""

next_run_at: Optional[datetime]
"""
Next run of the backup schedule (accurate to 10 minutes).
"""


@dataclass
Expand Down Expand Up @@ -1911,6 +1929,11 @@ class UpdateInstanceRequest:
Store logical backups in the same region as the Database Instance.
"""

backup_schedule_start_hour: Optional[int]
"""
Defines the start time of the autobackup.
"""


@dataclass
class DeleteInstanceRequest:
Expand Down

0 comments on commit ef6a521

Please sign in to comment.