Skip to content

Commit 989a260

Browse files
authored
feat(marketplace): add type field to LocalImage (#236)
1 parent e0d72a5 commit 989a260

File tree

8 files changed

+56
-0
lines changed

8 files changed

+56
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .types import ListImagesRequestOrderBy
44
from .types import ListLocalImagesRequestOrderBy
55
from .types import ListVersionsRequestOrderBy
6+
from .types import LocalImageType
67
from .types import Category
78
from .types import Image
89
from .types import ListCategoriesResponse
@@ -17,6 +18,7 @@
1718
"ListImagesRequestOrderBy",
1819
"ListLocalImagesRequestOrderBy",
1920
"ListVersionsRequestOrderBy",
21+
"LocalImageType",
2022
"Category",
2123
"Image",
2224
"ListCategoriesResponse",

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
ListImagesRequestOrderBy,
1818
ListLocalImagesRequestOrderBy,
1919
ListVersionsRequestOrderBy,
20+
LocalImageType,
2021
Category,
2122
Image,
2223
ListCategoriesResponse,
@@ -265,6 +266,7 @@ async def list_local_images(
265266
order_by: ListLocalImagesRequestOrderBy = ListLocalImagesRequestOrderBy.CREATED_AT_ASC,
266267
image_label: Optional[str] = None,
267268
zone: Optional[Zone] = None,
269+
type_: LocalImageType = LocalImageType.UNKNOWN_TYPE,
268270
) -> ListLocalImagesResponse:
269271
"""
270272
List local images from a specific image or version.
@@ -276,6 +278,7 @@ async def list_local_images(
276278
:param order_by:
277279
:param image_label: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
278280
:param zone:
281+
:param type_:
279282
:return: :class:`ListLocalImagesResponse <ListLocalImagesResponse>`
280283
281284
Usage:
@@ -291,6 +294,7 @@ async def list_local_images(
291294
"order_by": order_by,
292295
"page": page,
293296
"page_size": page_size or self.client.default_page_size,
297+
"type": type_,
294298
"zone": zone or self.client.default_zone,
295299
**resolve_one_of(
296300
[
@@ -315,6 +319,7 @@ async def list_local_images_all(
315319
order_by: Optional[ListLocalImagesRequestOrderBy] = None,
316320
image_label: Optional[str] = None,
317321
zone: Optional[Zone] = None,
322+
type_: Optional[LocalImageType] = None,
318323
) -> List[LocalImage]:
319324
"""
320325
List local images from a specific image or version.
@@ -326,6 +331,7 @@ async def list_local_images_all(
326331
:param order_by:
327332
:param image_label: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
328333
:param zone:
334+
:param type_:
329335
:return: :class:`List[ListLocalImagesResponse] <List[ListLocalImagesResponse]>`
330336
331337
Usage:
@@ -346,6 +352,7 @@ async def list_local_images_all(
346352
"order_by": order_by,
347353
"image_label": image_label,
348354
"zone": zone,
355+
"type_": type_,
349356
},
350357
)
351358

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ def unmarshal_LocalImage(data: Any) -> LocalImage:
9494
field = data.get("label", None)
9595
args["label"] = field
9696

97+
field = data.get("type", None)
98+
args["type_"] = field
99+
97100
field = data.get("zone", None)
98101
args["zone"] = field
99102

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ def __str__(self) -> str:
4040
return str(self.value)
4141

4242

43+
class LocalImageType(str, Enum):
44+
UNKNOWN_TYPE = "unknown_type"
45+
INSTANCE_LOCAL = "instance_local"
46+
INSTANCE_SBS = "instance_sbs"
47+
48+
def __str__(self) -> str:
49+
return str(self.value)
50+
51+
4352
@dataclass
4453
class Category:
4554
id: str
@@ -162,6 +171,11 @@ class LocalImage:
162171
Image label this image belongs to.
163172
"""
164173

174+
type_: LocalImageType
175+
"""
176+
Type of this local image.
177+
"""
178+
165179

166180
@dataclass
167181
class Version:
@@ -277,6 +291,8 @@ class ListLocalImagesRequest:
277291

278292
zone: Optional[Zone]
279293

294+
type_: Optional[LocalImageType]
295+
280296

281297
@dataclass
282298
class GetLocalImageRequest:

scaleway/scaleway/marketplace/v2/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .types import ListImagesRequestOrderBy
44
from .types import ListLocalImagesRequestOrderBy
55
from .types import ListVersionsRequestOrderBy
6+
from .types import LocalImageType
67
from .types import Category
78
from .types import Image
89
from .types import ListCategoriesResponse
@@ -17,6 +18,7 @@
1718
"ListImagesRequestOrderBy",
1819
"ListLocalImagesRequestOrderBy",
1920
"ListVersionsRequestOrderBy",
21+
"LocalImageType",
2022
"Category",
2123
"Image",
2224
"ListCategoriesResponse",

scaleway/scaleway/marketplace/v2/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
ListImagesRequestOrderBy,
1818
ListLocalImagesRequestOrderBy,
1919
ListVersionsRequestOrderBy,
20+
LocalImageType,
2021
Category,
2122
Image,
2223
ListCategoriesResponse,
@@ -265,6 +266,7 @@ def list_local_images(
265266
order_by: ListLocalImagesRequestOrderBy = ListLocalImagesRequestOrderBy.CREATED_AT_ASC,
266267
image_label: Optional[str] = None,
267268
zone: Optional[Zone] = None,
269+
type_: LocalImageType = LocalImageType.UNKNOWN_TYPE,
268270
) -> ListLocalImagesResponse:
269271
"""
270272
List local images from a specific image or version.
@@ -276,6 +278,7 @@ def list_local_images(
276278
:param order_by:
277279
:param image_label: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
278280
:param zone:
281+
:param type_:
279282
:return: :class:`ListLocalImagesResponse <ListLocalImagesResponse>`
280283
281284
Usage:
@@ -291,6 +294,7 @@ def list_local_images(
291294
"order_by": order_by,
292295
"page": page,
293296
"page_size": page_size or self.client.default_page_size,
297+
"type": type_,
294298
"zone": zone or self.client.default_zone,
295299
**resolve_one_of(
296300
[
@@ -315,6 +319,7 @@ def list_local_images_all(
315319
order_by: Optional[ListLocalImagesRequestOrderBy] = None,
316320
image_label: Optional[str] = None,
317321
zone: Optional[Zone] = None,
322+
type_: Optional[LocalImageType] = None,
318323
) -> List[LocalImage]:
319324
"""
320325
List local images from a specific image or version.
@@ -326,6 +331,7 @@ def list_local_images_all(
326331
:param order_by:
327332
:param image_label: One-of ('scope'): at most one of 'image_id', 'version_id', 'image_label' could be set.
328333
:param zone:
334+
:param type_:
329335
:return: :class:`List[ListLocalImagesResponse] <List[ListLocalImagesResponse]>`
330336
331337
Usage:
@@ -346,6 +352,7 @@ def list_local_images_all(
346352
"order_by": order_by,
347353
"image_label": image_label,
348354
"zone": zone,
355+
"type_": type_,
349356
},
350357
)
351358

scaleway/scaleway/marketplace/v2/marshalling.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ def unmarshal_LocalImage(data: Any) -> LocalImage:
9494
field = data.get("label", None)
9595
args["label"] = field
9696

97+
field = data.get("type", None)
98+
args["type_"] = field
99+
97100
field = data.get("zone", None)
98101
args["zone"] = field
99102

scaleway/scaleway/marketplace/v2/types.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ def __str__(self) -> str:
4040
return str(self.value)
4141

4242

43+
class LocalImageType(str, Enum):
44+
UNKNOWN_TYPE = "unknown_type"
45+
INSTANCE_LOCAL = "instance_local"
46+
INSTANCE_SBS = "instance_sbs"
47+
48+
def __str__(self) -> str:
49+
return str(self.value)
50+
51+
4352
@dataclass
4453
class Category:
4554
id: str
@@ -162,6 +171,11 @@ class LocalImage:
162171
Image label this image belongs to.
163172
"""
164173

174+
type_: LocalImageType
175+
"""
176+
Type of this local image.
177+
"""
178+
165179

166180
@dataclass
167181
class Version:
@@ -277,6 +291,8 @@ class ListLocalImagesRequest:
277291

278292
zone: Optional[Zone]
279293

294+
type_: Optional[LocalImageType]
295+
280296

281297
@dataclass
282298
class GetLocalImageRequest:

0 commit comments

Comments
 (0)