Skip to content

Commit 1a81bc4

Browse files
authored
feat(rdb): add skip_size_retrieval option to ListDatabases endpoint (#1291)
1 parent e267840 commit 1a81bc4

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,6 +2450,7 @@ async def list_databases(
24502450
self,
24512451
*,
24522452
instance_id: str,
2453+
skip_size_retrieval: bool,
24532454
region: Optional[ScwRegion] = None,
24542455
name: Optional[str] = None,
24552456
managed: Optional[bool] = None,
@@ -2462,6 +2463,7 @@ async def list_databases(
24622463
List databases in a Database Instance.
24632464
List all databases of a given Database Instance. By default, the databases returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `name`, `managed` and `owner`.
24642465
:param instance_id: UUID of the Database Instance to list the databases of.
2466+
:param skip_size_retrieval: Whether to skip the retrieval of each database size. If true, the size of each returned database will be set to 0.
24652467
:param region: Region to target. If none is passed will use default region from the config.
24662468
:param name: Name of the database.
24672469
:param managed: Defines whether or not the database is managed.
@@ -2476,6 +2478,7 @@ async def list_databases(
24762478
24772479
result = await api.list_databases(
24782480
instance_id="example",
2481+
skip_size_retrieval=False,
24792482
)
24802483
"""
24812484

@@ -2494,6 +2497,7 @@ async def list_databases(
24942497
"owner": owner,
24952498
"page": page,
24962499
"page_size": page_size or self.client.default_page_size,
2500+
"skip_size_retrieval": skip_size_retrieval,
24972501
},
24982502
)
24992503

@@ -2504,6 +2508,7 @@ async def list_databases_all(
25042508
self,
25052509
*,
25062510
instance_id: str,
2511+
skip_size_retrieval: bool,
25072512
region: Optional[ScwRegion] = None,
25082513
name: Optional[str] = None,
25092514
managed: Optional[bool] = None,
@@ -2516,6 +2521,7 @@ async def list_databases_all(
25162521
List databases in a Database Instance.
25172522
List all databases of a given Database Instance. By default, the databases returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `name`, `managed` and `owner`.
25182523
:param instance_id: UUID of the Database Instance to list the databases of.
2524+
:param skip_size_retrieval: Whether to skip the retrieval of each database size. If true, the size of each returned database will be set to 0.
25192525
:param region: Region to target. If none is passed will use default region from the config.
25202526
:param name: Name of the database.
25212527
:param managed: Defines whether or not the database is managed.
@@ -2530,6 +2536,7 @@ async def list_databases_all(
25302536
25312537
result = await api.list_databases_all(
25322538
instance_id="example",
2539+
skip_size_retrieval=False,
25332540
)
25342541
"""
25352542

@@ -2539,6 +2546,7 @@ async def list_databases_all(
25392546
fetcher=self.list_databases,
25402547
args={
25412548
"instance_id": instance_id,
2549+
"skip_size_retrieval": skip_size_retrieval,
25422550
"region": region,
25432551
"name": name,
25442552
"managed": managed,

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ class Database:
798798

799799
size: int
800800
"""
801-
Size of the database.
801+
Size of the database. Set to 0 if the size retrieval is too time-consuming or `skip_size_retrieval` is set to true.
802802
"""
803803

804804

@@ -1883,6 +1883,11 @@ class ListDatabasesRequest:
18831883
UUID of the Database Instance to list the databases of.
18841884
"""
18851885

1886+
skip_size_retrieval: bool
1887+
"""
1888+
Whether to skip the retrieval of each database size. If true, the size of each returned database will be set to 0.
1889+
"""
1890+
18861891
region: Optional[ScwRegion] = None
18871892
"""
18881893
Region to target. If none is passed will use default region from the config.

scaleway/scaleway/rdb/v1/api.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,6 +2442,7 @@ def list_databases(
24422442
self,
24432443
*,
24442444
instance_id: str,
2445+
skip_size_retrieval: bool,
24452446
region: Optional[ScwRegion] = None,
24462447
name: Optional[str] = None,
24472448
managed: Optional[bool] = None,
@@ -2454,6 +2455,7 @@ def list_databases(
24542455
List databases in a Database Instance.
24552456
List all databases of a given Database Instance. By default, the databases returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `name`, `managed` and `owner`.
24562457
:param instance_id: UUID of the Database Instance to list the databases of.
2458+
:param skip_size_retrieval: Whether to skip the retrieval of each database size. If true, the size of each returned database will be set to 0.
24572459
:param region: Region to target. If none is passed will use default region from the config.
24582460
:param name: Name of the database.
24592461
:param managed: Defines whether or not the database is managed.
@@ -2468,6 +2470,7 @@ def list_databases(
24682470
24692471
result = api.list_databases(
24702472
instance_id="example",
2473+
skip_size_retrieval=False,
24712474
)
24722475
"""
24732476

@@ -2486,6 +2489,7 @@ def list_databases(
24862489
"owner": owner,
24872490
"page": page,
24882491
"page_size": page_size or self.client.default_page_size,
2492+
"skip_size_retrieval": skip_size_retrieval,
24892493
},
24902494
)
24912495

@@ -2496,6 +2500,7 @@ def list_databases_all(
24962500
self,
24972501
*,
24982502
instance_id: str,
2503+
skip_size_retrieval: bool,
24992504
region: Optional[ScwRegion] = None,
25002505
name: Optional[str] = None,
25012506
managed: Optional[bool] = None,
@@ -2508,6 +2513,7 @@ def list_databases_all(
25082513
List databases in a Database Instance.
25092514
List all databases of a given Database Instance. By default, the databases returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `name`, `managed` and `owner`.
25102515
:param instance_id: UUID of the Database Instance to list the databases of.
2516+
:param skip_size_retrieval: Whether to skip the retrieval of each database size. If true, the size of each returned database will be set to 0.
25112517
:param region: Region to target. If none is passed will use default region from the config.
25122518
:param name: Name of the database.
25132519
:param managed: Defines whether or not the database is managed.
@@ -2522,6 +2528,7 @@ def list_databases_all(
25222528
25232529
result = api.list_databases_all(
25242530
instance_id="example",
2531+
skip_size_retrieval=False,
25252532
)
25262533
"""
25272534

@@ -2531,6 +2538,7 @@ def list_databases_all(
25312538
fetcher=self.list_databases,
25322539
args={
25332540
"instance_id": instance_id,
2541+
"skip_size_retrieval": skip_size_retrieval,
25342542
"region": region,
25352543
"name": name,
25362544
"managed": managed,

scaleway/scaleway/rdb/v1/types.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ class Database:
798798

799799
size: int
800800
"""
801-
Size of the database.
801+
Size of the database. Set to 0 if the size retrieval is too time-consuming or `skip_size_retrieval` is set to true.
802802
"""
803803

804804

@@ -1883,6 +1883,11 @@ class ListDatabasesRequest:
18831883
UUID of the Database Instance to list the databases of.
18841884
"""
18851885

1886+
skip_size_retrieval: bool
1887+
"""
1888+
Whether to skip the retrieval of each database size. If true, the size of each returned database will be set to 0.
1889+
"""
1890+
18861891
region: Optional[ScwRegion] = None
18871892
"""
18881893
Region to target. If none is passed will use default region from the config.

0 commit comments

Comments
 (0)