Skip to content

Commit ef6a521

Browse files
authored
feat(rdb): add possibility to update BackupSchedule next update (#240)
1 parent 94752f3 commit ef6a521

File tree

6 files changed

+60
-0
lines changed

6 files changed

+60
-0
lines changed

scaleway-async/scaleway_async/rdb/v1/api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,7 @@ async def update_instance(
10461046
tags: Optional[List[str]] = None,
10471047
logs_policy: Optional[LogsPolicy] = None,
10481048
backup_same_region: Optional[bool] = None,
1049+
backup_schedule_start_hour: Optional[int] = None,
10491050
) -> Instance:
10501051
"""
10511052
Update a Database Instance.
@@ -1059,6 +1060,7 @@ async def update_instance(
10591060
:param tags: Tags of a Database Instance.
10601061
:param logs_policy: Logs policy of the Database Instance.
10611062
:param backup_same_region: Store logical backups in the same region as the Database Instance.
1063+
:param backup_schedule_start_hour: Defines the start time of the autobackup.
10621064
:return: :class:`Instance <Instance>`
10631065
10641066
Usage:
@@ -1086,6 +1088,7 @@ async def update_instance(
10861088
tags=tags,
10871089
logs_policy=logs_policy,
10881090
backup_same_region=backup_same_region,
1091+
backup_schedule_start_hour=backup_schedule_start_hour,
10891092
),
10901093
self.client,
10911094
),

scaleway-async/scaleway_async/rdb/v1/marshalling.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ def unmarshal_BackupSchedule(data: Any) -> BackupSchedule:
239239
field = data.get("frequency", None)
240240
args["frequency"] = field
241241

242+
field = data.get("next_run_at", None)
243+
args["next_run_at"] = parser.isoparse(field) if type(field) is str else field
244+
242245
field = data.get("retention", None)
243246
args["retention"] = field
244247

@@ -1620,6 +1623,7 @@ def marshal_UpdateInstanceRequest(
16201623
"backup_same_region": request.backup_same_region,
16211624
"backup_schedule_frequency": request.backup_schedule_frequency,
16221625
"backup_schedule_retention": request.backup_schedule_retention,
1626+
"backup_schedule_start_hour": request.backup_schedule_start_hour,
16231627
"is_backup_schedule_disabled": request.is_backup_schedule_disabled,
16241628
"logs_policy": marshal_LogsPolicy(request.logs_policy, defaults)
16251629
if request.logs_policy is not None

scaleway-async/scaleway_async/rdb/v1/types.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,29 @@ class AddInstanceSettingsResponse:
297297

298298
@dataclass
299299
class BackupSchedule:
300+
"""
301+
Backup schedule.
302+
"""
303+
300304
frequency: int
305+
"""
306+
Frequency of the backup schedule (in hours).
307+
"""
301308

302309
retention: int
310+
"""
311+
Default retention period of backups (in days).
312+
"""
303313

304314
disabled: bool
315+
"""
316+
Defines whether the backup schedule feature is disabled.
317+
"""
318+
319+
next_run_at: Optional[datetime]
320+
"""
321+
Next run of the backup schedule (accurate to 10 minutes).
322+
"""
305323

306324

307325
@dataclass
@@ -1911,6 +1929,11 @@ class UpdateInstanceRequest:
19111929
Store logical backups in the same region as the Database Instance.
19121930
"""
19131931

1932+
backup_schedule_start_hour: Optional[int]
1933+
"""
1934+
Defines the start time of the autobackup.
1935+
"""
1936+
19141937

19151938
@dataclass
19161939
class DeleteInstanceRequest:

scaleway/scaleway/rdb/v1/api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,7 @@ def update_instance(
10421042
tags: Optional[List[str]] = None,
10431043
logs_policy: Optional[LogsPolicy] = None,
10441044
backup_same_region: Optional[bool] = None,
1045+
backup_schedule_start_hour: Optional[int] = None,
10451046
) -> Instance:
10461047
"""
10471048
Update a Database Instance.
@@ -1055,6 +1056,7 @@ def update_instance(
10551056
:param tags: Tags of a Database Instance.
10561057
:param logs_policy: Logs policy of the Database Instance.
10571058
:param backup_same_region: Store logical backups in the same region as the Database Instance.
1059+
:param backup_schedule_start_hour: Defines the start time of the autobackup.
10581060
:return: :class:`Instance <Instance>`
10591061
10601062
Usage:
@@ -1082,6 +1084,7 @@ def update_instance(
10821084
tags=tags,
10831085
logs_policy=logs_policy,
10841086
backup_same_region=backup_same_region,
1087+
backup_schedule_start_hour=backup_schedule_start_hour,
10851088
),
10861089
self.client,
10871090
),

scaleway/scaleway/rdb/v1/marshalling.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ def unmarshal_BackupSchedule(data: Any) -> BackupSchedule:
239239
field = data.get("frequency", None)
240240
args["frequency"] = field
241241

242+
field = data.get("next_run_at", None)
243+
args["next_run_at"] = parser.isoparse(field) if type(field) is str else field
244+
242245
field = data.get("retention", None)
243246
args["retention"] = field
244247

@@ -1620,6 +1623,7 @@ def marshal_UpdateInstanceRequest(
16201623
"backup_same_region": request.backup_same_region,
16211624
"backup_schedule_frequency": request.backup_schedule_frequency,
16221625
"backup_schedule_retention": request.backup_schedule_retention,
1626+
"backup_schedule_start_hour": request.backup_schedule_start_hour,
16231627
"is_backup_schedule_disabled": request.is_backup_schedule_disabled,
16241628
"logs_policy": marshal_LogsPolicy(request.logs_policy, defaults)
16251629
if request.logs_policy is not None

scaleway/scaleway/rdb/v1/types.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,29 @@ class AddInstanceSettingsResponse:
297297

298298
@dataclass
299299
class BackupSchedule:
300+
"""
301+
Backup schedule.
302+
"""
303+
300304
frequency: int
305+
"""
306+
Frequency of the backup schedule (in hours).
307+
"""
301308

302309
retention: int
310+
"""
311+
Default retention period of backups (in days).
312+
"""
303313

304314
disabled: bool
315+
"""
316+
Defines whether the backup schedule feature is disabled.
317+
"""
318+
319+
next_run_at: Optional[datetime]
320+
"""
321+
Next run of the backup schedule (accurate to 10 minutes).
322+
"""
305323

306324

307325
@dataclass
@@ -1911,6 +1929,11 @@ class UpdateInstanceRequest:
19111929
Store logical backups in the same region as the Database Instance.
19121930
"""
19131931

1932+
backup_schedule_start_hour: Optional[int]
1933+
"""
1934+
Defines the start time of the autobackup.
1935+
"""
1936+
19141937

19151938
@dataclass
19161939
class DeleteInstanceRequest:

0 commit comments

Comments
 (0)