Skip to content

Commit 09abee6

Browse files
committed
feat(qaas): update platform client
1 parent ecdc102 commit 09abee6

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
SHELL := /bin/bash
2+
3+
CLIENT_FOLDER=scaleway_qaas_client
4+
OPENAPI_FOLDER=openapi
5+
6+
V1_ALPHA1=v1alpha1
7+
V1_BETA1=v1beta1
8+
9+
define generate_client # 1: api_version
10+
mkdir -p ${CLIENT_FOLDER}/$(1)
11+
openapi-python-client generate \
12+
--path ${OPENAPI_FOLDER}/scaleway.qaas.$(1).Api.yml \
13+
--output-path ${CLIENT_FOLDER}/$(1)
14+
--overwrite
15+
endef
16+
17+
define clean_client # api_version
18+
black ${CLIENT_FOLDER}/$(1)
19+
endef
20+
21+
.PHONY: install
22+
install:
23+
pip3 install --upgrade pip
24+
pip3 install openapi-python-client
25+
pip3 install black
26+
27+
.PHONY: install-test
28+
install-test:
29+
pip3 install --upgrade pip
30+
pip3 install -r tests/requirements.txt
31+
32+
.PHONY: v1alpha1
33+
v1alpha1:
34+
$(call generate_client,${V1_ALPHA1})
35+
36+
.PHONY: test
37+
test:
38+
pytest -s --showprogress -vv tests/
39+
40+
.PHONY: clean
41+
clean:

scaleway_qaas_client/v1alpha1/client.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,13 @@
110110
ScalewayQaasV1Alpha1Session,
111111
ScalewayQaasV1Alpha1SessionAccess,
112112
TerminateSessionBody,
113+
ListPlatformsPlatformType,
114+
ListPlatformsPlatformTechnology,
115+
)
116+
from scaleway_qaas_client.v1alpha1.quantum_as_a_service_api_client.types import (
117+
Response,
118+
UNSET,
113119
)
114-
from scaleway_qaas_client.v1alpha1.quantum_as_a_service_api_client.types import Response
115120

116121
_DEFAULT_URL = "https://api.scaleway.com"
117122

@@ -180,6 +185,8 @@ def list_platforms(
180185
name: Optional[str] = None,
181186
backend_name: Optional[str] = None,
182187
provider_name: Optional[str] = None,
188+
platform_type: Optional[str] = None,
189+
platform_technology: Optional[str] = None,
183190
) -> List[ScalewayQaasV1Alpha1Platform]:
184191
"""List all available platforms
185192
@@ -189,6 +196,8 @@ def list_platforms(
189196
provider_name (Union[Unset, str]): List platforms with this provider name.
190197
backend_name (Union[Unset, str]): List platforms with this backend name.
191198
name (Union[Unset, str]): List platforms with this name.
199+
platform_type (Union[Unset, ListPlatformsPlatformType]): List platforms with this type.
200+
platform_technology (Union[Unset, ListPlatformsPlatformTechnology]): List platforms with this technology.
192201
193202
Raises:
194203
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -198,11 +207,23 @@ def list_platforms(
198207
List[ScalewayQaasV1Alpha1ListPlatforms]
199208
"""
200209

210+
if isinstance(platform_technology, str):
211+
platform_technology = ListPlatformsPlatformTechnology[platform_technology]
212+
elif not platform_technology:
213+
platform_technology = UNSET
214+
215+
if isinstance(platform_type, str):
216+
platform_type = ListPlatformsPlatformType[platform_type]
217+
elif not platform_type:
218+
platform_type = UNSET
219+
201220
response = _list_platforms_sync(
202221
client=self.__client,
203222
name=name,
204223
provider_name=provider_name,
205224
backend_name=backend_name,
225+
platform_type=platform_type,
226+
platform_technology=platform_technology,
206227
)
207228

208229
_raise_on_error(response)

0 commit comments

Comments
 (0)