Skip to content

Commit 6db6603

Browse files
authored
feat(product_catalog): filter by locality (#1039)
1 parent 1e450a0 commit 6db6603

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed

scaleway-async/scaleway_async/product_catalog/v2alpha1/api.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
from typing import List, Optional
55

66
from scaleway_core.api import API
7+
from scaleway_core.bridge import (
8+
Region as ScwRegion,
9+
Zone as ScwZone,
10+
)
711
from scaleway_core.utils import (
12+
OneOfPossibility,
13+
resolve_one_of,
814
fetch_all_pages_async,
915
)
1016
from .types import (
@@ -28,13 +34,25 @@ async def list_public_catalog_products(
2834
product_types: Optional[
2935
List[ListPublicCatalogProductsRequestProductType]
3036
] = None,
37+
global_: Optional[bool] = None,
38+
region: Optional[ScwRegion] = None,
39+
zone: Optional[ScwZone] = None,
40+
datacenter: Optional[str] = None,
3141
) -> ListPublicCatalogProductsResponse:
3242
"""
3343
List all available products.
3444
List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request.
3545
:param page: Number of the page. Value must be greater or equal to 1.
3646
:param page_size: The number of products per page. Value must be greater or equal to 1.
3747
:param product_types: The list of filtered product categories.
48+
:param global_: Filter global products.
49+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
50+
:param region: Filter products by region.
51+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
52+
:param zone: Filter products by zone.
53+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
54+
:param datacenter: Filter products by datacenter.
55+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
3856
:return: :class:`ListPublicCatalogProductsResponse <ListPublicCatalogProductsResponse>`
3957
4058
Usage:
@@ -50,6 +68,14 @@ async def list_public_catalog_products(
5068
"page": page,
5169
"page_size": page_size or self.client.default_page_size,
5270
"product_types": product_types,
71+
**resolve_one_of(
72+
[
73+
OneOfPossibility("datacenter", datacenter),
74+
OneOfPossibility("global_", global_),
75+
OneOfPossibility("region", region),
76+
OneOfPossibility("zone", zone),
77+
]
78+
),
5379
},
5480
)
5581

@@ -64,13 +90,25 @@ async def list_public_catalog_products_all(
6490
product_types: Optional[
6591
List[ListPublicCatalogProductsRequestProductType]
6692
] = None,
93+
global_: Optional[bool] = None,
94+
region: Optional[ScwRegion] = None,
95+
zone: Optional[ScwZone] = None,
96+
datacenter: Optional[str] = None,
6797
) -> List[PublicCatalogProduct]:
6898
"""
6999
List all available products.
70100
List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request.
71101
:param page: Number of the page. Value must be greater or equal to 1.
72102
:param page_size: The number of products per page. Value must be greater or equal to 1.
73103
:param product_types: The list of filtered product categories.
104+
:param global_: Filter global products.
105+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
106+
:param region: Filter products by region.
107+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
108+
:param zone: Filter products by zone.
109+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
110+
:param datacenter: Filter products by datacenter.
111+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
74112
:return: :class:`List[PublicCatalogProduct] <List[PublicCatalogProduct]>`
75113
76114
Usage:
@@ -87,5 +125,9 @@ async def list_public_catalog_products_all(
87125
"page": page,
88126
"page_size": page_size,
89127
"product_types": product_types,
128+
"global_": global_,
129+
"region": region,
130+
"zone": zone,
131+
"datacenter": datacenter,
90132
},
91133
)

scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,3 +432,11 @@ class PublicCatalogApiListPublicCatalogProductsRequest:
432432
"""
433433
The list of filtered product categories.
434434
"""
435+
436+
global_: Optional[bool]
437+
438+
region: Optional[ScwRegion]
439+
440+
zone: Optional[ScwZone]
441+
442+
datacenter: Optional[str]

scaleway/scaleway/product_catalog/v2alpha1/api.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
from typing import List, Optional
55

66
from scaleway_core.api import API
7+
from scaleway_core.bridge import (
8+
Region as ScwRegion,
9+
Zone as ScwZone,
10+
)
711
from scaleway_core.utils import (
12+
OneOfPossibility,
13+
resolve_one_of,
814
fetch_all_pages,
915
)
1016
from .types import (
@@ -28,13 +34,25 @@ def list_public_catalog_products(
2834
product_types: Optional[
2935
List[ListPublicCatalogProductsRequestProductType]
3036
] = None,
37+
global_: Optional[bool] = None,
38+
region: Optional[ScwRegion] = None,
39+
zone: Optional[ScwZone] = None,
40+
datacenter: Optional[str] = None,
3141
) -> ListPublicCatalogProductsResponse:
3242
"""
3343
List all available products.
3444
List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request.
3545
:param page: Number of the page. Value must be greater or equal to 1.
3646
:param page_size: The number of products per page. Value must be greater or equal to 1.
3747
:param product_types: The list of filtered product categories.
48+
:param global_: Filter global products.
49+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
50+
:param region: Filter products by region.
51+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
52+
:param zone: Filter products by zone.
53+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
54+
:param datacenter: Filter products by datacenter.
55+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
3856
:return: :class:`ListPublicCatalogProductsResponse <ListPublicCatalogProductsResponse>`
3957
4058
Usage:
@@ -50,6 +68,14 @@ def list_public_catalog_products(
5068
"page": page,
5169
"page_size": page_size or self.client.default_page_size,
5270
"product_types": product_types,
71+
**resolve_one_of(
72+
[
73+
OneOfPossibility("datacenter", datacenter),
74+
OneOfPossibility("global_", global_),
75+
OneOfPossibility("region", region),
76+
OneOfPossibility("zone", zone),
77+
]
78+
),
5379
},
5480
)
5581

@@ -64,13 +90,25 @@ def list_public_catalog_products_all(
6490
product_types: Optional[
6591
List[ListPublicCatalogProductsRequestProductType]
6692
] = None,
93+
global_: Optional[bool] = None,
94+
region: Optional[ScwRegion] = None,
95+
zone: Optional[ScwZone] = None,
96+
datacenter: Optional[str] = None,
6797
) -> List[PublicCatalogProduct]:
6898
"""
6999
List all available products.
70100
List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request.
71101
:param page: Number of the page. Value must be greater or equal to 1.
72102
:param page_size: The number of products per page. Value must be greater or equal to 1.
73103
:param product_types: The list of filtered product categories.
104+
:param global_: Filter global products.
105+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
106+
:param region: Filter products by region.
107+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
108+
:param zone: Filter products by zone.
109+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
110+
:param datacenter: Filter products by datacenter.
111+
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
74112
:return: :class:`List[PublicCatalogProduct] <List[PublicCatalogProduct]>`
75113
76114
Usage:
@@ -87,5 +125,9 @@ def list_public_catalog_products_all(
87125
"page": page,
88126
"page_size": page_size,
89127
"product_types": product_types,
128+
"global_": global_,
129+
"region": region,
130+
"zone": zone,
131+
"datacenter": datacenter,
90132
},
91133
)

scaleway/scaleway/product_catalog/v2alpha1/types.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,3 +432,11 @@ class PublicCatalogApiListPublicCatalogProductsRequest:
432432
"""
433433
The list of filtered product categories.
434434
"""
435+
436+
global_: Optional[bool]
437+
438+
region: Optional[ScwRegion]
439+
440+
zone: Optional[ScwZone]
441+
442+
datacenter: Optional[str]

0 commit comments

Comments
 (0)