Skip to content

Commit 3232342

Browse files
feat(marketplace/v2): add image_label (#20)
Co-authored-by: Nathanael Demacon <[email protected]>
1 parent be5d628 commit 3232342

File tree

6 files changed

+72
-12
lines changed

6 files changed

+72
-12
lines changed

scaleway-async/scaleway_async/marketplace/v2/api.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
from typing import List, Optional
55

66
from scaleway_core.api import API
7+
from scaleway_core.bridge import (
8+
Zone,
9+
)
710
from scaleway_core.utils import (
811
OneOfPossibility,
912
fetch_all_pages_async,
@@ -238,14 +241,18 @@ async def list_local_images(
238241
page_size: Optional[int] = None,
239242
page: Optional[int] = None,
240243
order_by: ListLocalImagesRequestOrderBy = ListLocalImagesRequestOrderBy.CREATED_AT_ASC,
244+
image_label: Optional[str] = None,
245+
zone: Optional[Zone] = None,
241246
) -> ListLocalImagesResponse:
242247
"""
243248
List local images from a specific image or version
244-
:param image_id: One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
245-
:param version_id: One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
249+
:param image_id: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
250+
:param version_id: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
246251
:param page_size:
247252
:param page:
248253
:param order_by:
254+
:param image_label: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
255+
:param zone:
249256
:return: :class:`ListLocalImagesResponse <ListLocalImagesResponse>`
250257
251258
Usage:
@@ -261,10 +268,12 @@ async def list_local_images(
261268
"order_by": order_by,
262269
"page": page,
263270
"page_size": page_size or self.client.default_page_size,
271+
"zone": zone or self.client.default_zone,
264272
**resolve_one_of(
265273
[
266274
OneOfPossibility("image_id", image_id),
267275
OneOfPossibility("version_id", version_id),
276+
OneOfPossibility("image_label", image_label),
268277
]
269278
),
270279
},
@@ -281,14 +290,18 @@ async def list_local_images_all(
281290
page_size: Optional[int] = None,
282291
page: Optional[int] = None,
283292
order_by: Optional[ListLocalImagesRequestOrderBy] = None,
293+
image_label: Optional[str] = None,
294+
zone: Optional[Zone] = None,
284295
) -> List[LocalImage]:
285296
"""
286297
List local images from a specific image or version
287-
:param image_id: One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
288-
:param version_id: One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
298+
:param image_id: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
299+
:param version_id: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
289300
:param page_size:
290301
:param page:
291302
:param order_by:
303+
:param image_label: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
304+
:param zone:
292305
:return: :class:`List[ListLocalImagesResponse] <List[ListLocalImagesResponse]>`
293306
294307
Usage:
@@ -307,6 +320,8 @@ async def list_local_images_all(
307320
"page_size": page_size,
308321
"page": page,
309322
"order_by": order_by,
323+
"image_label": image_label,
324+
"zone": zone,
310325
},
311326
)
312327

scaleway-async/scaleway_async/marketplace/v2/marshalling.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def unmarshal_LocalImage(data: Any) -> LocalImage:
9191
field = data.get("id")
9292
args["id"] = field
9393

94+
field = data.get("label")
95+
args["label"] = field
96+
9497
field = data.get("zone")
9598
args["zone"] = field
9699

scaleway-async/scaleway_async/marketplace/v2/types.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ class LocalImage:
157157
Availability Zone where this local image is available
158158
"""
159159

160+
label: str
161+
"""
162+
Image label this image belongs to
163+
"""
164+
160165

161166
@dataclass
162167
class Version:
@@ -251,12 +256,12 @@ class GetVersionRequest:
251256
class ListLocalImagesRequest:
252257
image_id: Optional[str]
253258
"""
254-
One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
259+
One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
255260
"""
256261

257262
version_id: Optional[str]
258263
"""
259-
One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
264+
One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
260265
"""
261266

262267
page_size: Optional[int]
@@ -265,6 +270,13 @@ class ListLocalImagesRequest:
265270

266271
order_by: Optional[ListLocalImagesRequestOrderBy]
267272

273+
image_label: Optional[str]
274+
"""
275+
One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
276+
"""
277+
278+
zone: Optional[Zone]
279+
268280

269281
@dataclass
270282
class GetLocalImageRequest:

scaleway/scaleway/marketplace/v2/api.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
from typing import List, Optional
55

66
from scaleway_core.api import API
7+
from scaleway_core.bridge import (
8+
Zone,
9+
)
710
from scaleway_core.utils import (
811
OneOfPossibility,
912
fetch_all_pages,
@@ -238,14 +241,18 @@ def list_local_images(
238241
page_size: Optional[int] = None,
239242
page: Optional[int] = None,
240243
order_by: ListLocalImagesRequestOrderBy = ListLocalImagesRequestOrderBy.CREATED_AT_ASC,
244+
image_label: Optional[str] = None,
245+
zone: Optional[Zone] = None,
241246
) -> ListLocalImagesResponse:
242247
"""
243248
List local images from a specific image or version
244-
:param image_id: One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
245-
:param version_id: One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
249+
:param image_id: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
250+
:param version_id: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
246251
:param page_size:
247252
:param page:
248253
:param order_by:
254+
:param image_label: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
255+
:param zone:
249256
:return: :class:`ListLocalImagesResponse <ListLocalImagesResponse>`
250257
251258
Usage:
@@ -261,10 +268,12 @@ def list_local_images(
261268
"order_by": order_by,
262269
"page": page,
263270
"page_size": page_size or self.client.default_page_size,
271+
"zone": zone or self.client.default_zone,
264272
**resolve_one_of(
265273
[
266274
OneOfPossibility("image_id", image_id),
267275
OneOfPossibility("version_id", version_id),
276+
OneOfPossibility("image_label", image_label),
268277
]
269278
),
270279
},
@@ -281,14 +290,18 @@ def list_local_images_all(
281290
page_size: Optional[int] = None,
282291
page: Optional[int] = None,
283292
order_by: Optional[ListLocalImagesRequestOrderBy] = None,
293+
image_label: Optional[str] = None,
294+
zone: Optional[Zone] = None,
284295
) -> List[LocalImage]:
285296
"""
286297
List local images from a specific image or version
287-
:param image_id: One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
288-
:param version_id: One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
298+
:param image_id: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
299+
:param version_id: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
289300
:param page_size:
290301
:param page:
291302
:param order_by:
303+
:param image_label: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
304+
:param zone:
292305
:return: :class:`List[ListLocalImagesResponse] <List[ListLocalImagesResponse]>`
293306
294307
Usage:
@@ -307,6 +320,8 @@ def list_local_images_all(
307320
"page_size": page_size,
308321
"page": page,
309322
"order_by": order_by,
323+
"image_label": image_label,
324+
"zone": zone,
310325
},
311326
)
312327

scaleway/scaleway/marketplace/v2/marshalling.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def unmarshal_LocalImage(data: Any) -> LocalImage:
9191
field = data.get("id")
9292
args["id"] = field
9393

94+
field = data.get("label")
95+
args["label"] = field
96+
9497
field = data.get("zone")
9598
args["zone"] = field
9699

scaleway/scaleway/marketplace/v2/types.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ class LocalImage:
157157
Availability Zone where this local image is available
158158
"""
159159

160+
label: str
161+
"""
162+
Image label this image belongs to
163+
"""
164+
160165

161166
@dataclass
162167
class Version:
@@ -251,12 +256,12 @@ class GetVersionRequest:
251256
class ListLocalImagesRequest:
252257
image_id: Optional[str]
253258
"""
254-
One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
259+
One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
255260
"""
256261

257262
version_id: Optional[str]
258263
"""
259-
One-of ('scope'): at most one of 'image_id', 'version_id' could be set.
264+
One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
260265
"""
261266

262267
page_size: Optional[int]
@@ -265,6 +270,13 @@ class ListLocalImagesRequest:
265270

266271
order_by: Optional[ListLocalImagesRequestOrderBy]
267272

273+
image_label: Optional[str]
274+
"""
275+
One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
276+
"""
277+
278+
zone: Optional[Zone]
279+
268280

269281
@dataclass
270282
class GetLocalImageRequest:

0 commit comments

Comments
 (0)