Skip to content

Commit 21227fe

Browse files
stackit-pipelinerubenhoenle
authored andcommitted
Generate iaasalpha
1 parent fbdd357 commit 21227fe

File tree

138 files changed

+2655
-47324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+2655
-47324
lines changed

services/iaasalpha/src/stackit/iaasalpha/__init__.py

Lines changed: 128 additions & 198 deletions
Large diffs are not rendered by default.

services/iaasalpha/src/stackit/iaasalpha/api/default_api.py

Lines changed: 1517 additions & 33412 deletions
Large diffs are not rendered by default.

services/iaasalpha/src/stackit/iaasalpha/api_client.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
66
This API allows you to create and modify IaaS resources.
77
8-
The version of the OpenAPI document: 1alpha1
8+
The version of the OpenAPI document: 2alpha1
99
1010
Generated by OpenAPI Generator (https://openapi-generator.tech)
1111
1212
Do not edit the class manually.
13-
""" # noqa: E501 docstring might be too long
13+
""" # noqa: E501
1414

1515
import datetime
1616
import json
@@ -332,6 +332,10 @@ def sanitize_for_serialization(self, obj):
332332
else:
333333
obj_dict = obj.__dict__
334334

335+
if isinstance(obj_dict, list):
336+
# here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() # noqa: E501
337+
return self.sanitize_for_serialization(obj_dict)
338+
335339
return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()}
336340

337341
def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
@@ -351,12 +355,12 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti
351355
data = json.loads(response_text)
352356
except ValueError:
353357
data = response_text
354-
elif content_type.startswith("application/json"):
358+
elif re.match(r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE):
355359
if response_text == "":
356360
data = ""
357361
else:
358362
data = json.loads(response_text)
359-
elif content_type.startswith("text/plain"):
363+
elif re.match(r"^text\/[a-z.+-]+\s*(;|$)", content_type, re.IGNORECASE):
360364
data = response_text
361365
else:
362366
raise ApiException(status=0, reason="Unsupported content type: {0}".format(content_type))
@@ -458,7 +462,7 @@ def parameters_to_url_query(self, params, collection_formats):
458462
if k in collection_formats:
459463
collection_format = collection_formats[k]
460464
if collection_format == "multi":
461-
new_params.extend((k, str(value)) for value in v)
465+
new_params.extend((k, quote(str(value))) for value in v)
462466
else:
463467
if collection_format == "ssv":
464468
delimiter = " "
@@ -474,7 +478,10 @@ def parameters_to_url_query(self, params, collection_formats):
474478

475479
return "&".join(["=".join(map(str, item)) for item in new_params])
476480

477-
def files_parameters(self, files: Dict[str, Union[str, bytes]]):
481+
def files_parameters(
482+
self,
483+
files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]],
484+
):
478485
"""Builds form parameters.
479486
480487
:param files: File parameters.
@@ -489,6 +496,12 @@ def files_parameters(self, files: Dict[str, Union[str, bytes]]):
489496
elif isinstance(v, bytes):
490497
filename = k
491498
filedata = v
499+
elif isinstance(v, tuple):
500+
filename, filedata = v
501+
elif isinstance(v, list):
502+
for file_param in v:
503+
params.extend(self.files_parameters({k: file_param}))
504+
continue
492505
else:
493506
raise ValueError("Unsupported file value")
494507
mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream"

services/iaasalpha/src/stackit/iaasalpha/configuration.py

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
11
# coding: utf-8
22

3-
import sys
4-
5-
import os
6-
7-
83
"""
94
IaaS-API
105
116
This API allows you to create and modify IaaS resources.
127
13-
The version of the OpenAPI document: 1alpha1
8+
The version of the OpenAPI document: 2alpha1
149
1510
Generated by OpenAPI Generator (https://openapi-generator.tech)
1611
1712
Do not edit the class manually.
18-
""" # noqa: E501 docstring might be too long
13+
""" # noqa: E501
14+
15+
import sys
16+
from typing import Dict, List, Optional, TypedDict
17+
18+
from typing_extensions import NotRequired
19+
20+
import os
21+
22+
23+
ServerVariablesT = Dict[str, str]
24+
25+
26+
class HostSettingVariable(TypedDict):
27+
description: str
28+
default_value: str
29+
enum_values: List[str]
30+
31+
32+
class HostSetting(TypedDict):
33+
url: str
34+
description: str
35+
variables: NotRequired[Dict[str, HostSettingVariable]]
1936

2037

2138
class HostConfiguration:
@@ -37,7 +54,7 @@ def __init__(
3754
)
3855
"""Constructor
3956
"""
40-
self._base_path = "https://iaas.api.eu01.stackit.cloud"
57+
self._base_path = "https://iaas.api.stackit.cloud"
4158
"""Default Base url
4259
"""
4360
self.server_index = 0 if server_index is None else server_index
@@ -54,26 +71,30 @@ def __init__(
5471
"""Ignore operation servers
5572
"""
5673

57-
def get_host_settings(self):
74+
def get_host_settings(self) -> List[HostSetting]:
5875
"""Gets an array of host settings
5976
6077
:return: An array of host settings
6178
"""
6279
return [
6380
{
64-
"url": "https://iaas.api.{region}stackit.cloud",
81+
"url": "https://iaas.api.stackit.cloud",
6582
"description": "No description provided",
6683
"variables": {
6784
"region": {
6885
"description": "No description provided",
69-
"default_value": "eu01.",
70-
"enum_values": ["eu01."],
86+
"default_value": "global",
7187
}
7288
},
7389
}
7490
]
7591

76-
def get_host_from_settings(self, index, variables=None, servers=None):
92+
def get_host_from_settings(
93+
self,
94+
index: Optional[int],
95+
variables: Optional[ServerVariablesT] = None,
96+
servers: Optional[List[HostSetting]] = None,
97+
) -> str:
7798
"""Gets host URL based on the index and variables
7899
:param index: array index of the host settings
79100
:param variables: hash of variable and the corresponding value
@@ -113,7 +134,7 @@ def get_host_from_settings(self, index, variables=None, servers=None):
113134
and variables.get(variable_name) is not None
114135
):
115136
raise ValueError(
116-
"this API does not support setting a region in the the client configuration, "
137+
"this API does not support setting a region in the client configuration, "
117138
"please check if the region can be specified as a function parameter"
118139
)
119140
used_value = variables.get(variable_name, variable["default_value"])
@@ -132,12 +153,12 @@ def get_host_from_settings(self, index, variables=None, servers=None):
132153
return url
133154

134155
@property
135-
def host(self):
156+
def host(self) -> str:
136157
"""Return generated host."""
137158
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
138159

139160
@host.setter
140-
def host(self, value):
161+
def host(self, value: str) -> None:
141162
"""Fix base path."""
142163
self._base_path = value
143164
self.server_index = None

services/iaasalpha/src/stackit/iaasalpha/exceptions.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
66
This API allows you to create and modify IaaS resources.
77
8-
The version of the OpenAPI document: 1alpha1
8+
The version of the OpenAPI document: 2alpha1
99
1010
Generated by OpenAPI Generator (https://openapi-generator.tech)
1111
1212
Do not edit the class manually.
13-
""" # noqa: E501 docstring might be too long
13+
""" # noqa: E501
1414

1515
from typing import Any, Optional
1616

@@ -152,6 +152,13 @@ def from_response(
152152
if http_resp.status == 404:
153153
raise NotFoundException(http_resp=http_resp, body=body, data=data)
154154

155+
# Added new conditions for 409 and 422
156+
if http_resp.status == 409:
157+
raise ConflictException(http_resp=http_resp, body=body, data=data)
158+
159+
if http_resp.status == 422:
160+
raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
161+
155162
if 500 <= http_resp.status <= 599:
156163
raise ServiceException(http_resp=http_resp, body=body, data=data)
157164
raise ApiException(http_resp=http_resp, body=body, data=data)
@@ -188,6 +195,18 @@ class ServiceException(ApiException):
188195
pass
189196

190197

198+
class ConflictException(ApiException):
199+
"""Exception for HTTP 409 Conflict."""
200+
201+
pass
202+
203+
204+
class UnprocessableEntityException(ApiException):
205+
"""Exception for HTTP 422 Unprocessable Entity."""
206+
207+
pass
208+
209+
191210
def render_path(path_to_item):
192211
"""Returns a string representation of a path"""
193212
result = ""

0 commit comments

Comments
 (0)