Skip to content

Commit d909fdf

Browse files
Generator: Update SDK /services/iaas (#3437)
* Generate iaas * chore(iaas) write changelog, bump version --------- Co-authored-by: Carlo Goetz <carlo.goetz@inovex.de>
1 parent 69c9879 commit d909fdf

File tree

88 files changed

+1918
-4869
lines changed

Some content is hidden

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

88 files changed

+1918
-4869
lines changed

CHANGELOG.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@
4040
- **Bugfix:** timeouts now passed to requests library
4141
- [v0.5.0](services/intake/CHANGELOG.md#v050)
4242
- **Breaking Change**: Switch from regional to global API server URL (region can't be set via `Configuration` / env-variable anymore).
43-
- `iaas`: [v1.2.0](services/iaas/CHANGELOG.md#v120)
44-
- **Feature:** Add `description` attribute to ModelClasses:
45-
- `Backup`, `CreateBackupPayload`, `UpdateBackupPayload`
46-
- `Snapshot`, `CreateSnapshotPayload`, `UpdateSnapshotPayload`
47-
- **Bugfix:** Flagged `disk_format` as necessary for `ImageFromVolumePayload`
48-
- **Improvement:** Updated description for labels
43+
- `iaas`:
44+
- [v1.2.1](services/iaas/CHANGELOG.md#v121)
45+
- **Feature:** client now supports UUID and decimal types
46+
- **Bugfix:** timeouts now passed to requests library
47+
- [v1.2.0](services/iaas/CHANGELOG.md#v120)
48+
- **Feature:** Add `description` attribute to ModelClasses:
49+
- `Backup`, `CreateBackupPayload`, `UpdateBackupPayload`
50+
- `Snapshot`, `CreateSnapshotPayload`, `UpdateSnapshotPayload`
51+
- **Bugfix:** Flagged `disk_format` as necessary for `ImageFromVolumePayload`
52+
- **Improvement:** Updated description for labels
4953
- `alb`:
5054
- [v0.9.1](services/alb/CHANGELOG.md#v091)
5155
- **Feature:** client now supports UUID and decimal types

services/iaas/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v1.2.1
2+
- **Feature:** client now supports UUID and decimal types
3+
- **Bugfix:** timeouts now passed to requests library
4+
15
## v1.2.0
26
- **Feature:** Add `description` attribute to ModelClasses:
37
- `Backup`, `CreateBackupPayload`, `UpdateBackupPayload`

services/iaas/oas_commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cb550f3c2129447568c2855337b1874968e033bb
1+
0e64886dd0847341800d7191ed193b75413be998

services/iaas/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "stackit-iaas"
3-
version = "v1.2.0"
3+
version = "v1.2.1"
44
description = "IaaS-API"
55
authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }]
66
requires-python = ">=3.9,<4.0"

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

Lines changed: 1579 additions & 4500 deletions
Large diffs are not rendered by default.

services/iaas/src/stackit/iaas/api_client.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
""" # noqa: E501
1414

1515
import datetime
16+
import decimal
1617
import json
1718
import mimetypes
1819
import os
1920
import re
2021
import tempfile
22+
import uuid
2123
from enum import Enum
2224
from typing import Dict, List, Optional, Tuple, Union
2325
from urllib.parse import quote
@@ -64,8 +66,10 @@ class ApiClient:
6466
"bool": bool,
6567
"date": datetime.date,
6668
"datetime": datetime.datetime,
69+
"decimal": decimal.Decimal,
6770
"object": object,
6871
}
72+
_pool = None
6973

7074
def __init__(self, configuration, header_name=None, header_value=None, cookie=None) -> None:
7175
self.config: Configuration = configuration
@@ -268,7 +272,7 @@ def response_deserialize(
268272
return_data = self.__deserialize_file(response_data)
269273
elif response_type is not None:
270274
match = None
271-
content_type = response_data.getheader("content-type")
275+
content_type = response_data.headers.get("content-type")
272276
if content_type is not None:
273277
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
274278
encoding = match.group(1) if match else "utf-8"
@@ -285,7 +289,7 @@ def response_deserialize(
285289
return ApiResponse(
286290
status_code=response_data.status,
287291
data=return_data,
288-
headers=response_data.getheaders(),
292+
headers=response_data.headers,
289293
raw_data=response_data.data,
290294
)
291295

@@ -297,6 +301,7 @@ def sanitize_for_serialization(self, obj):
297301
If obj is str, int, long, float, bool, return directly.
298302
If obj is datetime.datetime, datetime.date
299303
convert to string in iso8601 format.
304+
If obj is decimal.Decimal return string representation.
300305
If obj is list, sanitize each element in the list.
301306
If obj is dict, return the dict.
302307
If obj is OpenAPI model, return the properties dict.
@@ -312,12 +317,16 @@ def sanitize_for_serialization(self, obj):
312317
return obj.get_secret_value()
313318
elif isinstance(obj, self.PRIMITIVE_TYPES):
314319
return obj
320+
elif isinstance(obj, uuid.UUID):
321+
return str(obj)
315322
elif isinstance(obj, list):
316323
return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj]
317324
elif isinstance(obj, tuple):
318325
return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj)
319326
elif isinstance(obj, (datetime.datetime, datetime.date)):
320327
return obj.isoformat()
328+
elif isinstance(obj, decimal.Decimal):
329+
return str(obj)
321330

322331
elif isinstance(obj, dict):
323332
obj_dict = obj
@@ -327,7 +336,7 @@ def sanitize_for_serialization(self, obj):
327336
# and attributes which value is not None.
328337
# Convert attribute name to json key in
329338
# model definition for request.
330-
if hasattr(obj, "to_dict") and callable(obj.to_dict):
339+
if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009
331340
obj_dict = obj.to_dict()
332341
else:
333342
obj_dict = obj.__dict__
@@ -355,7 +364,7 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti
355364
data = json.loads(response_text)
356365
except ValueError:
357366
data = response_text
358-
elif re.match(r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE):
367+
elif re.match(r"^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE):
359368
if response_text == "":
360369
data = ""
361370
else:
@@ -401,12 +410,14 @@ def __deserialize(self, data, klass):
401410

402411
if klass in self.PRIMITIVE_TYPES:
403412
return self.__deserialize_primitive(data, klass)
404-
elif klass == object:
413+
elif klass is object:
405414
return self.__deserialize_object(data)
406-
elif klass == datetime.date:
415+
elif klass is datetime.date:
407416
return self.__deserialize_date(data)
408-
elif klass == datetime.datetime:
417+
elif klass is datetime.datetime:
409418
return self.__deserialize_datetime(data)
419+
elif klass is decimal.Decimal:
420+
return decimal.Decimal(data)
410421
elif issubclass(klass, Enum):
411422
return self.__deserialize_enum(data, klass)
412423
else:
@@ -554,12 +565,14 @@ def __deserialize_file(self, response):
554565
os.close(fd)
555566
os.remove(path)
556567

557-
content_disposition = response.getheader("Content-Disposition")
568+
content_disposition = response.headers.get("Content-Disposition")
558569
if content_disposition:
559570
m = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition)
560571
if m is None:
561572
raise ValueError("Unexpected 'content-disposition' header value")
562-
filename = m.group(1)
573+
filename = os.path.basename(m.group(1)) # Strip any directory traversal
574+
if filename in ("", ".", ".."): # fall back to tmp filename
575+
filename = os.path.basename(path)
563576
path = os.path.join(os.path.dirname(path), filename)
564577

565578
with open(path, "wb") as f:

services/iaas/src/stackit/iaas/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def __init__(
130130
self.body = http_resp.data.decode("utf-8")
131131
except Exception: # noqa: S110
132132
pass
133-
self.headers = http_resp.getheaders()
133+
self.headers = http_resp.headers
134134

135135
@classmethod
136136
def from_response(

services/iaas/src/stackit/iaas/models/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
Do not edit the class manually.
1414
""" # noqa: E501
1515

16-
1716
# import models into model package
1817
from stackit.iaas.models.add_routes_to_routing_table_payload import (
1918
AddRoutesToRoutingTablePayload,

services/iaas/src/stackit/iaas/models/add_routes_to_routing_table_payload.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ def to_dict(self) -> Dict[str, Any]:
7272
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
7373
_items = []
7474
if self.items:
75-
for _item in self.items:
76-
if _item:
77-
_items.append(_item.to_dict())
75+
for _item_items in self.items:
76+
if _item_items:
77+
_items.append(_item_items.to_dict())
7878
_dict["items"] = _items
7979
return _dict
8080

services/iaas/src/stackit/iaas/models/add_routing_table_to_area_payload.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import re # noqa: F401
2020
from datetime import datetime
2121
from typing import Any, ClassVar, Dict, List, Optional, Set
22+
from uuid import UUID
2223

2324
from pydantic import BaseModel, ConfigDict, Field, StrictBool, field_validator
2425
from typing_extensions import Annotated, Self
@@ -44,9 +45,7 @@ class AddRoutingTableToAreaPayload(BaseModel):
4445
description="A config setting for a routing table which allows propagation of dynamic routes to this routing table.",
4546
alias="dynamicRoutes",
4647
)
47-
id: Optional[Annotated[str, Field(min_length=36, strict=True, max_length=36)]] = Field(
48-
default=None, description="Universally Unique Identifier (UUID)."
49-
)
48+
id: Optional[UUID] = Field(default=None, description="Universally Unique Identifier (UUID).")
5049
labels: Optional[Dict[str, Any]] = Field(
5150
default=None,
5251
description="Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. The `stackit-` prefix is reserved and cannot be used for Keys.",

0 commit comments

Comments
 (0)