Skip to content

Commit

Permalink
feat(block): add tags filter in list snapshots (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Feb 25, 2025
1 parent c49ff44 commit 4f19fec
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scaleway-async/scaleway_async/block/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ async def list_snapshots(
page_size: Optional[int] = None,
volume_id: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[List[str]] = None,
) -> ListSnapshotsResponse:
"""
List all snapshots.
Expand All @@ -459,6 +460,7 @@ async def list_snapshots(
:param page_size: Page size, defines how many entries are returned in one page, must be lower or equal to 100.
:param volume_id: Filter snapshots by the ID of the original volume.
:param name: Filter snapshots by their names.
:param tags: Filter by tags. Only snapshots with one or more matching tags will be returned.
:return: :class:`ListSnapshotsResponse <ListSnapshotsResponse>`
Usage:
Expand All @@ -480,6 +482,7 @@ async def list_snapshots(
"page": page,
"page_size": page_size or self.client.default_page_size,
"project_id": project_id or self.client.default_project_id,
"tags": tags,
"volume_id": volume_id,
},
)
Expand All @@ -498,6 +501,7 @@ async def list_snapshots_all(
page_size: Optional[int] = None,
volume_id: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[List[str]] = None,
) -> List[Snapshot]:
"""
List all snapshots.
Expand All @@ -510,6 +514,7 @@ async def list_snapshots_all(
:param page_size: Page size, defines how many entries are returned in one page, must be lower or equal to 100.
:param volume_id: Filter snapshots by the ID of the original volume.
:param name: Filter snapshots by their names.
:param tags: Filter by tags. Only snapshots with one or more matching tags will be returned.
:return: :class:`List[Snapshot] <List[Snapshot]>`
Usage:
Expand All @@ -531,6 +536,7 @@ async def list_snapshots_all(
"page_size": page_size,
"volume_id": volume_id,
"name": name,
"tags": tags,
},
)

Expand Down
5 changes: 5 additions & 0 deletions scaleway-async/scaleway_async/block/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ class ListSnapshotsRequest:
Filter snapshots by their names.
"""

tags: Optional[List[str]]
"""
Filter by tags. Only snapshots with one or more matching tags will be returned.
"""


@dataclass
class ListSnapshotsResponse:
Expand Down
6 changes: 6 additions & 0 deletions scaleway/scaleway/block/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ def list_snapshots(
page_size: Optional[int] = None,
volume_id: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[List[str]] = None,
) -> ListSnapshotsResponse:
"""
List all snapshots.
Expand All @@ -459,6 +460,7 @@ def list_snapshots(
:param page_size: Page size, defines how many entries are returned in one page, must be lower or equal to 100.
:param volume_id: Filter snapshots by the ID of the original volume.
:param name: Filter snapshots by their names.
:param tags: Filter by tags. Only snapshots with one or more matching tags will be returned.
:return: :class:`ListSnapshotsResponse <ListSnapshotsResponse>`
Usage:
Expand All @@ -480,6 +482,7 @@ def list_snapshots(
"page": page,
"page_size": page_size or self.client.default_page_size,
"project_id": project_id or self.client.default_project_id,
"tags": tags,
"volume_id": volume_id,
},
)
Expand All @@ -498,6 +501,7 @@ def list_snapshots_all(
page_size: Optional[int] = None,
volume_id: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[List[str]] = None,
) -> List[Snapshot]:
"""
List all snapshots.
Expand All @@ -510,6 +514,7 @@ def list_snapshots_all(
:param page_size: Page size, defines how many entries are returned in one page, must be lower or equal to 100.
:param volume_id: Filter snapshots by the ID of the original volume.
:param name: Filter snapshots by their names.
:param tags: Filter by tags. Only snapshots with one or more matching tags will be returned.
:return: :class:`List[Snapshot] <List[Snapshot]>`
Usage:
Expand All @@ -531,6 +536,7 @@ def list_snapshots_all(
"page_size": page_size,
"volume_id": volume_id,
"name": name,
"tags": tags,
},
)

Expand Down
5 changes: 5 additions & 0 deletions scaleway/scaleway/block/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ class ListSnapshotsRequest:
Filter snapshots by their names.
"""

tags: Optional[List[str]]
"""
Filter by tags. Only snapshots with one or more matching tags will be returned.
"""


@dataclass
class ListSnapshotsResponse:
Expand Down

0 comments on commit 4f19fec

Please sign in to comment.