Skip to content

Commit db7dead

Browse files
authored
feat(instance): add servers filter in ListServersRequest (#317)
1 parent 2bdf153 commit db7dead

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ async def list_servers(
349349
order: ListServersRequestOrder = ListServersRequestOrder.CREATION_DATE_DESC,
350350
private_networks: Optional[List[str]] = None,
351351
private_nic_mac_address: Optional[str] = None,
352+
servers: Optional[List[str]] = None,
352353
) -> ListServersResponse:
353354
"""
354355
List all Instances.
@@ -368,6 +369,7 @@ async def list_servers(
368369
:param order: Define the order of the returned servers.
369370
:param private_networks: List Instances from the given Private Networks (use commas to separate them).
370371
:param private_nic_mac_address: List Instances associated with the given private NIC MAC address.
372+
:param servers: List Instances from these server ids (use commas to separate them).
371373
:return: :class:`ListServersResponse <ListServersResponse>`
372374
373375
Usage:
@@ -395,6 +397,7 @@ async def list_servers(
395397
else None,
396398
"private_nic_mac_address": private_nic_mac_address,
397399
"project": project or self.client.default_project_id,
400+
"servers": ",".join(servers) if servers and len(servers) > 0 else None,
398401
"state": state,
399402
"tags": ",".join(tags) if tags and len(tags) > 0 else None,
400403
"without_ip": without_ip,
@@ -422,6 +425,7 @@ async def list_servers_all(
422425
order: Optional[ListServersRequestOrder] = None,
423426
private_networks: Optional[List[str]] = None,
424427
private_nic_mac_address: Optional[str] = None,
428+
servers: Optional[List[str]] = None,
425429
) -> List[Server]:
426430
"""
427431
List all Instances.
@@ -441,6 +445,7 @@ async def list_servers_all(
441445
:param order: Define the order of the returned servers.
442446
:param private_networks: List Instances from the given Private Networks (use commas to separate them).
443447
:param private_nic_mac_address: List Instances associated with the given private NIC MAC address.
448+
:param servers: List Instances from these server ids (use commas to separate them).
444449
:return: :class:`List[ListServersResponse] <List[ListServersResponse]>`
445450
446451
Usage:
@@ -469,6 +474,7 @@ async def list_servers_all(
469474
"order": order,
470475
"private_networks": private_networks,
471476
"private_nic_mac_address": private_nic_mac_address,
477+
"servers": servers,
472478
},
473479
)
474480

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,6 +2065,11 @@ class ListServersRequest:
20652065
List Instances associated with the given private NIC MAC address.
20662066
"""
20672067

2068+
servers: Optional[List[str]]
2069+
"""
2070+
List Instances from these server ids (use commas to separate them).
2071+
"""
2072+
20682073

20692074
@dataclass
20702075
class DeleteServerRequest:

scaleway/scaleway/instance/v1/api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ def list_servers(
349349
order: ListServersRequestOrder = ListServersRequestOrder.CREATION_DATE_DESC,
350350
private_networks: Optional[List[str]] = None,
351351
private_nic_mac_address: Optional[str] = None,
352+
servers: Optional[List[str]] = None,
352353
) -> ListServersResponse:
353354
"""
354355
List all Instances.
@@ -368,6 +369,7 @@ def list_servers(
368369
:param order: Define the order of the returned servers.
369370
:param private_networks: List Instances from the given Private Networks (use commas to separate them).
370371
:param private_nic_mac_address: List Instances associated with the given private NIC MAC address.
372+
:param servers: List Instances from these server ids (use commas to separate them).
371373
:return: :class:`ListServersResponse <ListServersResponse>`
372374
373375
Usage:
@@ -395,6 +397,7 @@ def list_servers(
395397
else None,
396398
"private_nic_mac_address": private_nic_mac_address,
397399
"project": project or self.client.default_project_id,
400+
"servers": ",".join(servers) if servers and len(servers) > 0 else None,
398401
"state": state,
399402
"tags": ",".join(tags) if tags and len(tags) > 0 else None,
400403
"without_ip": without_ip,
@@ -422,6 +425,7 @@ def list_servers_all(
422425
order: Optional[ListServersRequestOrder] = None,
423426
private_networks: Optional[List[str]] = None,
424427
private_nic_mac_address: Optional[str] = None,
428+
servers: Optional[List[str]] = None,
425429
) -> List[Server]:
426430
"""
427431
List all Instances.
@@ -441,6 +445,7 @@ def list_servers_all(
441445
:param order: Define the order of the returned servers.
442446
:param private_networks: List Instances from the given Private Networks (use commas to separate them).
443447
:param private_nic_mac_address: List Instances associated with the given private NIC MAC address.
448+
:param servers: List Instances from these server ids (use commas to separate them).
444449
:return: :class:`List[ListServersResponse] <List[ListServersResponse]>`
445450
446451
Usage:
@@ -469,6 +474,7 @@ def list_servers_all(
469474
"order": order,
470475
"private_networks": private_networks,
471476
"private_nic_mac_address": private_nic_mac_address,
477+
"servers": servers,
472478
},
473479
)
474480

scaleway/scaleway/instance/v1/types.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,6 +2065,11 @@ class ListServersRequest:
20652065
List Instances associated with the given private NIC MAC address.
20662066
"""
20672067

2068+
servers: Optional[List[str]]
2069+
"""
2070+
List Instances from these server ids (use commas to separate them).
2071+
"""
2072+
20682073

20692074
@dataclass
20702075
class DeleteServerRequest:

0 commit comments

Comments
 (0)