Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(block): add tags filter in list snapshots #865

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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