Skip to content

Commit fd451ef

Browse files
feat(file): add attachments zone (scaleway#957)
Co-authored-by: Jonathan R. <[email protected]>
1 parent 443ad36 commit fd451ef

File tree

6 files changed

+48
-0
lines changed

6 files changed

+48
-0
lines changed

scaleway-async/scaleway_async/file/v1alpha1/api.py

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from scaleway_core.api import API
77
from scaleway_core.bridge import (
88
Region as ScwRegion,
9+
Zone as ScwZone,
910
)
1011
from scaleway_core.utils import (
1112
WaitForOptions,
@@ -215,6 +216,7 @@ async def list_attachments(
215216
filesystem_id: Optional[str] = None,
216217
resource_id: Optional[str] = None,
217218
resource_type: Optional[AttachmentResourceType] = None,
219+
zone: Optional[ScwZone] = None,
218220
page: Optional[int] = None,
219221
page_size: Optional[int] = None,
220222
) -> ListAttachmentsResponse:
@@ -227,6 +229,7 @@ async def list_attachments(
227229
:param filesystem_id: UUID of the File Storage volume.
228230
:param resource_id: Filter by resource ID.
229231
:param resource_type: Filter by resource type.
232+
:param zone: Filter by resource zone.
230233
:param page: Page number (starting at 1).
231234
:param page_size: Number of entries per page (default: 20, max: 100).
232235
:return: :class:`ListAttachmentsResponse <ListAttachmentsResponse>`
@@ -250,6 +253,7 @@ async def list_attachments(
250253
"page_size": page_size or self.client.default_page_size,
251254
"resource_id": resource_id,
252255
"resource_type": resource_type,
256+
"zone": zone or self.client.default_zone,
253257
},
254258
)
255259

@@ -263,6 +267,7 @@ async def list_attachments_all(
263267
filesystem_id: Optional[str] = None,
264268
resource_id: Optional[str] = None,
265269
resource_type: Optional[AttachmentResourceType] = None,
270+
zone: Optional[ScwZone] = None,
266271
page: Optional[int] = None,
267272
page_size: Optional[int] = None,
268273
) -> List[Attachment]:
@@ -275,6 +280,7 @@ async def list_attachments_all(
275280
:param filesystem_id: UUID of the File Storage volume.
276281
:param resource_id: Filter by resource ID.
277282
:param resource_type: Filter by resource type.
283+
:param zone: Filter by resource zone.
278284
:param page: Page number (starting at 1).
279285
:param page_size: Number of entries per page (default: 20, max: 100).
280286
:return: :class:`List[Attachment] <List[Attachment]>`
@@ -294,6 +300,7 @@ async def list_attachments_all(
294300
"filesystem_id": filesystem_id,
295301
"resource_id": resource_id,
296302
"resource_type": resource_type,
303+
"zone": zone,
297304
"page": page,
298305
"page_size": page_size,
299306
},

scaleway-async/scaleway_async/file/v1alpha1/marshalling.py

+6
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ def unmarshal_Attachment(data: Any) -> Attachment:
9898
if field is not None:
9999
args["resource_type"] = field
100100

101+
field = data.get("zone", None)
102+
if field is not None:
103+
args["zone"] = field
104+
else:
105+
args["zone"] = None
106+
101107
return Attachment(**args)
102108

103109

scaleway-async/scaleway_async/file/v1alpha1/types.py

+11
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from scaleway_core.bridge import (
1111
Region as ScwRegion,
12+
Zone as ScwZone,
1213
)
1314
from scaleway_core.utils import (
1415
StrEnumMeta,
@@ -70,6 +71,11 @@ class Attachment:
7071
The type of the attached resource.
7172
"""
7273

74+
zone: Optional[ScwZone]
75+
"""
76+
The zone where the resource is located.
77+
"""
78+
7379

7480
@dataclass
7581
class FileSystem:
@@ -225,6 +231,11 @@ class ListAttachmentsRequest:
225231
Filter by resource type.
226232
"""
227233

234+
zone: Optional[ScwZone]
235+
"""
236+
Filter by resource zone.
237+
"""
238+
228239
page: Optional[int]
229240
"""
230241
Page number (starting at 1).

scaleway/scaleway/file/v1alpha1/api.py

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from scaleway_core.api import API
77
from scaleway_core.bridge import (
88
Region as ScwRegion,
9+
Zone as ScwZone,
910
)
1011
from scaleway_core.utils import (
1112
WaitForOptions,
@@ -213,6 +214,7 @@ def list_attachments(
213214
filesystem_id: Optional[str] = None,
214215
resource_id: Optional[str] = None,
215216
resource_type: Optional[AttachmentResourceType] = None,
217+
zone: Optional[ScwZone] = None,
216218
page: Optional[int] = None,
217219
page_size: Optional[int] = None,
218220
) -> ListAttachmentsResponse:
@@ -225,6 +227,7 @@ def list_attachments(
225227
:param filesystem_id: UUID of the File Storage volume.
226228
:param resource_id: Filter by resource ID.
227229
:param resource_type: Filter by resource type.
230+
:param zone: Filter by resource zone.
228231
:param page: Page number (starting at 1).
229232
:param page_size: Number of entries per page (default: 20, max: 100).
230233
:return: :class:`ListAttachmentsResponse <ListAttachmentsResponse>`
@@ -248,6 +251,7 @@ def list_attachments(
248251
"page_size": page_size or self.client.default_page_size,
249252
"resource_id": resource_id,
250253
"resource_type": resource_type,
254+
"zone": zone or self.client.default_zone,
251255
},
252256
)
253257

@@ -261,6 +265,7 @@ def list_attachments_all(
261265
filesystem_id: Optional[str] = None,
262266
resource_id: Optional[str] = None,
263267
resource_type: Optional[AttachmentResourceType] = None,
268+
zone: Optional[ScwZone] = None,
264269
page: Optional[int] = None,
265270
page_size: Optional[int] = None,
266271
) -> List[Attachment]:
@@ -273,6 +278,7 @@ def list_attachments_all(
273278
:param filesystem_id: UUID of the File Storage volume.
274279
:param resource_id: Filter by resource ID.
275280
:param resource_type: Filter by resource type.
281+
:param zone: Filter by resource zone.
276282
:param page: Page number (starting at 1).
277283
:param page_size: Number of entries per page (default: 20, max: 100).
278284
:return: :class:`List[Attachment] <List[Attachment]>`
@@ -292,6 +298,7 @@ def list_attachments_all(
292298
"filesystem_id": filesystem_id,
293299
"resource_id": resource_id,
294300
"resource_type": resource_type,
301+
"zone": zone,
295302
"page": page,
296303
"page_size": page_size,
297304
},

scaleway/scaleway/file/v1alpha1/marshalling.py

+6
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ def unmarshal_Attachment(data: Any) -> Attachment:
9898
if field is not None:
9999
args["resource_type"] = field
100100

101+
field = data.get("zone", None)
102+
if field is not None:
103+
args["zone"] = field
104+
else:
105+
args["zone"] = None
106+
101107
return Attachment(**args)
102108

103109

scaleway/scaleway/file/v1alpha1/types.py

+11
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from scaleway_core.bridge import (
1111
Region as ScwRegion,
12+
Zone as ScwZone,
1213
)
1314
from scaleway_core.utils import (
1415
StrEnumMeta,
@@ -70,6 +71,11 @@ class Attachment:
7071
The type of the attached resource.
7172
"""
7273

74+
zone: Optional[ScwZone]
75+
"""
76+
The zone where the resource is located.
77+
"""
78+
7379

7480
@dataclass
7581
class FileSystem:
@@ -225,6 +231,11 @@ class ListAttachmentsRequest:
225231
Filter by resource type.
226232
"""
227233

234+
zone: Optional[ScwZone]
235+
"""
236+
Filter by resource zone.
237+
"""
238+
228239
page: Optional[int]
229240
"""
230241
Page number (starting at 1).

0 commit comments

Comments
 (0)