Skip to content

feat(product_catalog): filter by locality #1039

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

Merged
merged 1 commit into from
Jun 20, 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
42 changes: 42 additions & 0 deletions scaleway-async/scaleway_async/product_catalog/v2alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
from typing import List, Optional

from scaleway_core.api import API
from scaleway_core.bridge import (
Region as ScwRegion,
Zone as ScwZone,
)
from scaleway_core.utils import (
OneOfPossibility,
resolve_one_of,
fetch_all_pages_async,
)
from .types import (
Expand All @@ -28,13 +34,25 @@ async def list_public_catalog_products(
product_types: Optional[
List[ListPublicCatalogProductsRequestProductType]
] = None,
global_: Optional[bool] = None,
region: Optional[ScwRegion] = None,
zone: Optional[ScwZone] = None,
datacenter: Optional[str] = None,
) -> ListPublicCatalogProductsResponse:
"""
List all available products.
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.
:param page: Number of the page. Value must be greater or equal to 1.
:param page_size: The number of products per page. Value must be greater or equal to 1.
:param product_types: The list of filtered product categories.
:param global_: Filter global products.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param region: Filter products by region.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param zone: Filter products by zone.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param datacenter: Filter products by datacenter.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:return: :class:`ListPublicCatalogProductsResponse <ListPublicCatalogProductsResponse>`

Usage:
Expand All @@ -50,6 +68,14 @@ async def list_public_catalog_products(
"page": page,
"page_size": page_size or self.client.default_page_size,
"product_types": product_types,
**resolve_one_of(
[
OneOfPossibility("datacenter", datacenter),
OneOfPossibility("global_", global_),
OneOfPossibility("region", region),
OneOfPossibility("zone", zone),
]
),
},
)

Expand All @@ -64,13 +90,25 @@ async def list_public_catalog_products_all(
product_types: Optional[
List[ListPublicCatalogProductsRequestProductType]
] = None,
global_: Optional[bool] = None,
region: Optional[ScwRegion] = None,
zone: Optional[ScwZone] = None,
datacenter: Optional[str] = None,
) -> List[PublicCatalogProduct]:
"""
List all available products.
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.
:param page: Number of the page. Value must be greater or equal to 1.
:param page_size: The number of products per page. Value must be greater or equal to 1.
:param product_types: The list of filtered product categories.
:param global_: Filter global products.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param region: Filter products by region.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param zone: Filter products by zone.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param datacenter: Filter products by datacenter.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:return: :class:`List[PublicCatalogProduct] <List[PublicCatalogProduct]>`

Usage:
Expand All @@ -87,5 +125,9 @@ async def list_public_catalog_products_all(
"page": page,
"page_size": page_size,
"product_types": product_types,
"global_": global_,
"region": region,
"zone": zone,
"datacenter": datacenter,
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,11 @@ class PublicCatalogApiListPublicCatalogProductsRequest:
"""
The list of filtered product categories.
"""

global_: Optional[bool]

region: Optional[ScwRegion]

zone: Optional[ScwZone]

datacenter: Optional[str]
42 changes: 42 additions & 0 deletions scaleway/scaleway/product_catalog/v2alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
from typing import List, Optional

from scaleway_core.api import API
from scaleway_core.bridge import (
Region as ScwRegion,
Zone as ScwZone,
)
from scaleway_core.utils import (
OneOfPossibility,
resolve_one_of,
fetch_all_pages,
)
from .types import (
Expand All @@ -28,13 +34,25 @@ def list_public_catalog_products(
product_types: Optional[
List[ListPublicCatalogProductsRequestProductType]
] = None,
global_: Optional[bool] = None,
region: Optional[ScwRegion] = None,
zone: Optional[ScwZone] = None,
datacenter: Optional[str] = None,
) -> ListPublicCatalogProductsResponse:
"""
List all available products.
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.
:param page: Number of the page. Value must be greater or equal to 1.
:param page_size: The number of products per page. Value must be greater or equal to 1.
:param product_types: The list of filtered product categories.
:param global_: Filter global products.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param region: Filter products by region.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param zone: Filter products by zone.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param datacenter: Filter products by datacenter.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:return: :class:`ListPublicCatalogProductsResponse <ListPublicCatalogProductsResponse>`

Usage:
Expand All @@ -50,6 +68,14 @@ def list_public_catalog_products(
"page": page,
"page_size": page_size or self.client.default_page_size,
"product_types": product_types,
**resolve_one_of(
[
OneOfPossibility("datacenter", datacenter),
OneOfPossibility("global_", global_),
OneOfPossibility("region", region),
OneOfPossibility("zone", zone),
]
),
},
)

Expand All @@ -64,13 +90,25 @@ def list_public_catalog_products_all(
product_types: Optional[
List[ListPublicCatalogProductsRequestProductType]
] = None,
global_: Optional[bool] = None,
region: Optional[ScwRegion] = None,
zone: Optional[ScwZone] = None,
datacenter: Optional[str] = None,
) -> List[PublicCatalogProduct]:
"""
List all available products.
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.
:param page: Number of the page. Value must be greater or equal to 1.
:param page_size: The number of products per page. Value must be greater or equal to 1.
:param product_types: The list of filtered product categories.
:param global_: Filter global products.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param region: Filter products by region.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param zone: Filter products by zone.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:param datacenter: Filter products by datacenter.
One-Of ('locality'): at most one of 'global_', 'region', 'zone', 'datacenter' could be set.
:return: :class:`List[PublicCatalogProduct] <List[PublicCatalogProduct]>`

Usage:
Expand All @@ -87,5 +125,9 @@ def list_public_catalog_products_all(
"page": page,
"page_size": page_size,
"product_types": product_types,
"global_": global_,
"region": region,
"zone": zone,
"datacenter": datacenter,
},
)
8 changes: 8 additions & 0 deletions scaleway/scaleway/product_catalog/v2alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,11 @@ class PublicCatalogApiListPublicCatalogProductsRequest:
"""
The list of filtered product categories.
"""

global_: Optional[bool]

region: Optional[ScwRegion]

zone: Optional[ScwZone]

datacenter: Optional[str]