Skip to content

Commit d5afbe6

Browse files
authored
feat(rdb): add has_maintenances filter to ListInstances endpoint and... (#1035)
1 parent c9b7720 commit d5afbe6

File tree

6 files changed

+40
-0
lines changed

6 files changed

+40
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ async def list_instances(
803803
order_by: Optional[ListInstancesRequestOrderBy] = None,
804804
organization_id: Optional[str] = None,
805805
project_id: Optional[str] = None,
806+
has_maintenances: Optional[bool] = None,
806807
page: Optional[int] = None,
807808
page_size: Optional[int] = None,
808809
) -> ListInstancesResponse:
@@ -815,6 +816,7 @@ async def list_instances(
815816
:param order_by: Criteria to use when ordering Database Instance listings.
816817
:param organization_id: Please use project_id instead.
817818
:param project_id: Project ID to list the Database Instance of.
819+
:param has_maintenances: Filter to only list instances with a scheduled maintenance.
818820
:param page:
819821
:param page_size:
820822
:return: :class:`ListInstancesResponse <ListInstancesResponse>`
@@ -833,6 +835,7 @@ async def list_instances(
833835
"GET",
834836
f"/rdb/v1/regions/{param_region}/instances",
835837
params={
838+
"has_maintenances": has_maintenances,
836839
"name": name,
837840
"order_by": order_by,
838841
"organization_id": organization_id
@@ -856,6 +859,7 @@ async def list_instances_all(
856859
order_by: Optional[ListInstancesRequestOrderBy] = None,
857860
organization_id: Optional[str] = None,
858861
project_id: Optional[str] = None,
862+
has_maintenances: Optional[bool] = None,
859863
page: Optional[int] = None,
860864
page_size: Optional[int] = None,
861865
) -> List[Instance]:
@@ -868,6 +872,7 @@ async def list_instances_all(
868872
:param order_by: Criteria to use when ordering Database Instance listings.
869873
:param organization_id: Please use project_id instead.
870874
:param project_id: Project ID to list the Database Instance of.
875+
:param has_maintenances: Filter to only list instances with a scheduled maintenance.
871876
:param page:
872877
:param page_size:
873878
:return: :class:`List[Instance] <List[Instance]>`
@@ -889,6 +894,7 @@ async def list_instances_all(
889894
"order_by": order_by,
890895
"organization_id": organization_id,
891896
"project_id": project_id,
897+
"has_maintenances": has_maintenances,
892898
"page": page,
893899
"page_size": page_size,
894900
},

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ def unmarshal_Maintenance(data: Any) -> Maintenance:
219219
if field is not None:
220220
args["status"] = field
221221

222+
field = data.get("is_applicable", None)
223+
if field is not None:
224+
args["is_applicable"] = field
225+
222226
field = data.get("starts_at", None)
223227
if field is not None:
224228
args["starts_at"] = parser.isoparse(field) if isinstance(field, str) else field

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,11 @@ class Maintenance:
528528
Status of the maintenance.
529529
"""
530530

531+
is_applicable: bool
532+
"""
533+
Indicate if the maintenance can be applied by the user.
534+
"""
535+
531536
starts_at: Optional[datetime]
532537
"""
533538
Start date of the maintenance window.
@@ -2044,6 +2049,11 @@ class ListInstancesRequest:
20442049
Project ID to list the Database Instance of.
20452050
"""
20462051

2052+
has_maintenances: Optional[bool]
2053+
"""
2054+
Filter to only list instances with a scheduled maintenance.
2055+
"""
2056+
20472057
page: Optional[int]
20482058

20492059
page_size: Optional[int]

scaleway/scaleway/rdb/v1/api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ def list_instances(
801801
order_by: Optional[ListInstancesRequestOrderBy] = None,
802802
organization_id: Optional[str] = None,
803803
project_id: Optional[str] = None,
804+
has_maintenances: Optional[bool] = None,
804805
page: Optional[int] = None,
805806
page_size: Optional[int] = None,
806807
) -> ListInstancesResponse:
@@ -813,6 +814,7 @@ def list_instances(
813814
:param order_by: Criteria to use when ordering Database Instance listings.
814815
:param organization_id: Please use project_id instead.
815816
:param project_id: Project ID to list the Database Instance of.
817+
:param has_maintenances: Filter to only list instances with a scheduled maintenance.
816818
:param page:
817819
:param page_size:
818820
:return: :class:`ListInstancesResponse <ListInstancesResponse>`
@@ -831,6 +833,7 @@ def list_instances(
831833
"GET",
832834
f"/rdb/v1/regions/{param_region}/instances",
833835
params={
836+
"has_maintenances": has_maintenances,
834837
"name": name,
835838
"order_by": order_by,
836839
"organization_id": organization_id
@@ -854,6 +857,7 @@ def list_instances_all(
854857
order_by: Optional[ListInstancesRequestOrderBy] = None,
855858
organization_id: Optional[str] = None,
856859
project_id: Optional[str] = None,
860+
has_maintenances: Optional[bool] = None,
857861
page: Optional[int] = None,
858862
page_size: Optional[int] = None,
859863
) -> List[Instance]:
@@ -866,6 +870,7 @@ def list_instances_all(
866870
:param order_by: Criteria to use when ordering Database Instance listings.
867871
:param organization_id: Please use project_id instead.
868872
:param project_id: Project ID to list the Database Instance of.
873+
:param has_maintenances: Filter to only list instances with a scheduled maintenance.
869874
:param page:
870875
:param page_size:
871876
:return: :class:`List[Instance] <List[Instance]>`
@@ -887,6 +892,7 @@ def list_instances_all(
887892
"order_by": order_by,
888893
"organization_id": organization_id,
889894
"project_id": project_id,
895+
"has_maintenances": has_maintenances,
890896
"page": page,
891897
"page_size": page_size,
892898
},

scaleway/scaleway/rdb/v1/marshalling.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ def unmarshal_Maintenance(data: Any) -> Maintenance:
219219
if field is not None:
220220
args["status"] = field
221221

222+
field = data.get("is_applicable", None)
223+
if field is not None:
224+
args["is_applicable"] = field
225+
222226
field = data.get("starts_at", None)
223227
if field is not None:
224228
args["starts_at"] = parser.isoparse(field) if isinstance(field, str) else field

scaleway/scaleway/rdb/v1/types.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,11 @@ class Maintenance:
528528
Status of the maintenance.
529529
"""
530530

531+
is_applicable: bool
532+
"""
533+
Indicate if the maintenance can be applied by the user.
534+
"""
535+
531536
starts_at: Optional[datetime]
532537
"""
533538
Start date of the maintenance window.
@@ -2044,6 +2049,11 @@ class ListInstancesRequest:
20442049
Project ID to list the Database Instance of.
20452050
"""
20462051

2052+
has_maintenances: Optional[bool]
2053+
"""
2054+
Filter to only list instances with a scheduled maintenance.
2055+
"""
2056+
20472057
page: Optional[int]
20482058

20492059
page_size: Optional[int]

0 commit comments

Comments
 (0)