Skip to content

Commit 555e797

Browse files
Generate iaas
1 parent 2b94af1 commit 555e797

8 files changed

Lines changed: 161 additions & 11 deletions

File tree

‎services/iaas/oas_commit‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b155367fdf354045bbd1d2403a19bf4e363e76a3
1+
7c9ee6e47bfd11f1578a4636f428b3deaaca318e

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"CreateVolumePayload",
7373
"DestinationCIDRv4",
7474
"DestinationCIDRv6",
75+
"DestinationPrefixList",
7576
"Error",
7677
"GetServerLog200Response",
7778
"ICMPParameters",
@@ -305,6 +306,9 @@
305306
from stackit.iaas.models.destination_cidrv6 import (
306307
DestinationCIDRv6 as DestinationCIDRv6,
307308
)
309+
from stackit.iaas.models.destination_prefix_list import (
310+
DestinationPrefixList as DestinationPrefixList,
311+
)
308312
from stackit.iaas.models.error import Error as Error
309313
from stackit.iaas.models.get_server_log200_response import (
310314
GetServerLog200Response as GetServerLog200Response,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
from stackit.iaas.models.create_volume_payload import CreateVolumePayload
8989
from stackit.iaas.models.destination_cidrv4 import DestinationCIDRv4
9090
from stackit.iaas.models.destination_cidrv6 import DestinationCIDRv6
91+
from stackit.iaas.models.destination_prefix_list import DestinationPrefixList
9192
from stackit.iaas.models.error import Error
9293
from stackit.iaas.models.get_server_log200_response import GetServerLog200Response
9394
from stackit.iaas.models.icmp_parameters import ICMPParameters

‎services/iaas/src/stackit/iaas/models/create_snapshot_payload.py‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@
2121
from typing import Any, ClassVar, Dict, List, Optional, Set
2222
from uuid import UUID
2323

24-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
24+
from pydantic import (
25+
BaseModel,
26+
ConfigDict,
27+
Field,
28+
StrictBool,
29+
StrictInt,
30+
StrictStr,
31+
field_validator,
32+
)
2533
from pydantic_core import to_jsonable_python
2634
from typing_extensions import Annotated, Self
2735

@@ -40,6 +48,7 @@ class CreateSnapshotPayload(BaseModel):
4048
description: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(
4149
default=None, description="Description Object. Allows string up to 255 Characters."
4250
)
51+
encrypted: Optional[StrictBool] = Field(default=None, description="Indicates if a volume is encrypted.")
4352
id: Optional[UUID] = Field(default=None, description="Universally Unique Identifier (UUID).")
4453
labels: Optional[Dict[str, Any]] = Field(
4554
default=None,
@@ -61,6 +70,7 @@ class CreateSnapshotPayload(BaseModel):
6170
"availabilityZone",
6271
"createdAt",
6372
"description",
73+
"encrypted",
6474
"id",
6575
"labels",
6676
"name",
@@ -171,11 +181,13 @@ def to_dict(self) -> Dict[str, Any]:
171181
* OpenAPI `readOnly` fields are excluded.
172182
* OpenAPI `readOnly` fields are excluded.
173183
* OpenAPI `readOnly` fields are excluded.
184+
* OpenAPI `readOnly` fields are excluded.
174185
"""
175186
excluded_fields: Set[str] = set(
176187
[
177188
"availability_zone",
178189
"created_at",
190+
"encrypted",
179191
"id",
180192
"size",
181193
"status",
@@ -204,6 +216,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
204216
"availabilityZone": obj.get("availabilityZone"),
205217
"createdAt": obj.get("createdAt"),
206218
"description": obj.get("description"),
219+
"encrypted": obj.get("encrypted"),
207220
"id": obj.get("id"),
208221
"labels": obj.get("labels"),
209222
"name": obj.get("name"),
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# coding: utf-8
2+
3+
"""
4+
STACKIT IaaS API
5+
6+
This API allows you to create and modify IaaS resources.
7+
8+
The version of the OpenAPI document: 2
9+
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
from __future__ import annotations
16+
17+
import json
18+
import pprint
19+
import re # noqa: F401
20+
from typing import Any, ClassVar, Dict, List, Optional, Set
21+
from uuid import UUID
22+
23+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
24+
from pydantic_core import to_jsonable_python
25+
from typing_extensions import Self
26+
27+
28+
class DestinationPrefixList(BaseModel):
29+
"""
30+
Prefix List destination reference object.
31+
""" # noqa: E501
32+
33+
type: StrictStr
34+
value: UUID = Field(description="Universally Unique Identifier (UUID).")
35+
__properties: ClassVar[List[str]] = ["type", "value"]
36+
37+
@field_validator("type")
38+
def type_validate_enum(cls, value):
39+
"""Validates the enum"""
40+
if value not in set(["prefixlist"]):
41+
raise ValueError("must be one of enum values ('prefixlist')")
42+
return value
43+
44+
@field_validator("value")
45+
def value_validate_regular_expression(cls, value):
46+
"""Validates the regular expression"""
47+
if not isinstance(value, str):
48+
value = str(value)
49+
50+
if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", value):
51+
raise ValueError(
52+
r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/"
53+
)
54+
return value
55+
56+
model_config = ConfigDict(
57+
validate_by_name=True,
58+
validate_by_alias=True,
59+
validate_assignment=True,
60+
protected_namespaces=(),
61+
)
62+
63+
def to_str(self) -> str:
64+
"""Returns the string representation of the model using alias"""
65+
return pprint.pformat(self.model_dump(by_alias=True))
66+
67+
def to_json(self) -> str:
68+
"""Returns the JSON representation of the model using alias"""
69+
return json.dumps(to_jsonable_python(self.to_dict()))
70+
71+
@classmethod
72+
def from_json(cls, json_str: str) -> Optional[Self]:
73+
"""Create an instance of DestinationPrefixList from a JSON string"""
74+
return cls.from_dict(json.loads(json_str))
75+
76+
def to_dict(self) -> Dict[str, Any]:
77+
"""Return the dictionary representation of the model using alias.
78+
79+
This has the following differences from calling pydantic's
80+
`self.model_dump(by_alias=True)`:
81+
82+
* `None` is only added to the output dict for nullable fields that
83+
were set at model initialization. Other fields with value `None`
84+
are ignored.
85+
"""
86+
excluded_fields: Set[str] = set([])
87+
88+
_dict = self.model_dump(
89+
by_alias=True,
90+
exclude=excluded_fields,
91+
exclude_none=True,
92+
)
93+
return _dict
94+
95+
@classmethod
96+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97+
"""Create an instance of DestinationPrefixList from a dict"""
98+
if obj is None:
99+
return None
100+
101+
if not isinstance(obj, dict):
102+
return cls.model_validate(obj)
103+
104+
_obj = cls.model_validate({"type": obj.get("type"), "value": obj.get("value")})
105+
return _obj

‎services/iaas/src/stackit/iaas/models/image_from_volume_payload.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ImageFromVolumePayload(BaseModel):
4040
description="Object that represents a disk format. Possible values: `raw`, `qcow2`, `iso`.", alias="diskFormat"
4141
)
4242
force: Optional[StrictBool] = Field(
43-
default=False, description="When true the image is force created from a volume is currently being used."
43+
default=False, description="When true the image is force created from a volume that is currently being used."
4444
)
4545
name: Annotated[str, Field(strict=True, max_length=127)] = Field(
4646
description="The name for a General Object. Matches Names and also UUIDs."

‎services/iaas/src/stackit/iaas/models/route_destination.py‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828

2929
from stackit.iaas.models.destination_cidrv4 import DestinationCIDRv4
3030
from stackit.iaas.models.destination_cidrv6 import DestinationCIDRv6
31+
from stackit.iaas.models.destination_prefix_list import DestinationPrefixList
3132

32-
ROUTEDESTINATION_ONE_OF_SCHEMAS = ["DestinationCIDRv4", "DestinationCIDRv6"]
33+
ROUTEDESTINATION_ONE_OF_SCHEMAS = ["DestinationCIDRv4", "DestinationCIDRv6", "DestinationPrefixList"]
3334

3435

3536
class RouteDestination(BaseModel):
@@ -41,8 +42,10 @@ class RouteDestination(BaseModel):
4142
oneof_schema_1_validator: Optional[DestinationCIDRv4] = None
4243
# data type: DestinationCIDRv6
4344
oneof_schema_2_validator: Optional[DestinationCIDRv6] = None
44-
actual_instance: Optional[Union[DestinationCIDRv4, DestinationCIDRv6]] = None
45-
one_of_schemas: Set[str] = {"DestinationCIDRv4", "DestinationCIDRv6"}
45+
# data type: DestinationPrefixList
46+
oneof_schema_3_validator: Optional[DestinationPrefixList] = None
47+
actual_instance: Optional[Union[DestinationCIDRv4, DestinationCIDRv6, DestinationPrefixList]] = None
48+
one_of_schemas: Set[str] = {"DestinationCIDRv4", "DestinationCIDRv6", "DestinationPrefixList"}
4649

4750
model_config = ConfigDict(
4851
validate_assignment=True,
@@ -76,10 +79,15 @@ def actual_instance_must_validate_oneof(cls, v):
7679
error_messages.append(f"Error! Input type `{type(v)}` is not `DestinationCIDRv6`")
7780
else:
7881
match += 1
82+
# validate data type: DestinationPrefixList
83+
if not isinstance(v, DestinationPrefixList):
84+
error_messages.append(f"Error! Input type `{type(v)}` is not `DestinationPrefixList`")
85+
else:
86+
match += 1
7987
if match == 0:
8088
# no match
8189
raise ValueError(
82-
"No match found when setting `actual_instance` in RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6. Details: "
90+
"No match found when setting `actual_instance` in RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6, DestinationPrefixList. Details: "
8391
+ ", ".join(error_messages)
8492
)
8593
else:
@@ -108,17 +116,23 @@ def from_json(cls, json_str: str) -> Self:
108116
match += 1
109117
except (ValidationError, ValueError) as e:
110118
error_messages.append(str(e))
119+
# deserialize data into DestinationPrefixList
120+
try:
121+
instance.actual_instance = DestinationPrefixList.from_json(json_str)
122+
match += 1
123+
except (ValidationError, ValueError) as e:
124+
error_messages.append(str(e))
111125

112126
if match > 1:
113127
# more than 1 match
114128
raise ValueError(
115-
"Multiple matches found when deserializing the JSON string into RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6. Details: "
129+
"Multiple matches found when deserializing the JSON string into RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6, DestinationPrefixList. Details: "
116130
+ ", ".join(error_messages)
117131
)
118132
elif match == 0:
119133
# no match
120134
raise ValueError(
121-
"No match found when deserializing the JSON string into RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6. Details: "
135+
"No match found when deserializing the JSON string into RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6, DestinationPrefixList. Details: "
122136
+ ", ".join(error_messages)
123137
)
124138
else:
@@ -134,7 +148,7 @@ def to_json(self) -> str:
134148
else:
135149
return json.dumps(self.actual_instance)
136150

137-
def to_dict(self) -> Optional[Union[Dict[str, Any], DestinationCIDRv4, DestinationCIDRv6]]:
151+
def to_dict(self) -> Optional[Union[Dict[str, Any], DestinationCIDRv4, DestinationCIDRv6, DestinationPrefixList]]:
138152
"""Returns the dict representation of the actual instance"""
139153
if self.actual_instance is None:
140154
return None

‎services/iaas/src/stackit/iaas/models/snapshot.py‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@
2121
from typing import Any, ClassVar, Dict, List, Optional, Set
2222
from uuid import UUID
2323

24-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
24+
from pydantic import (
25+
BaseModel,
26+
ConfigDict,
27+
Field,
28+
StrictBool,
29+
StrictInt,
30+
StrictStr,
31+
field_validator,
32+
)
2533
from pydantic_core import to_jsonable_python
2634
from typing_extensions import Annotated, Self
2735

@@ -40,6 +48,7 @@ class Snapshot(BaseModel):
4048
description: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(
4149
default=None, description="Description Object. Allows string up to 255 Characters."
4250
)
51+
encrypted: Optional[StrictBool] = Field(default=None, description="Indicates if a volume is encrypted.")
4352
id: Optional[UUID] = Field(default=None, description="Universally Unique Identifier (UUID).")
4453
labels: Optional[Dict[str, Any]] = Field(
4554
default=None,
@@ -61,6 +70,7 @@ class Snapshot(BaseModel):
6170
"availabilityZone",
6271
"createdAt",
6372
"description",
73+
"encrypted",
6474
"id",
6575
"labels",
6676
"name",
@@ -171,11 +181,13 @@ def to_dict(self) -> Dict[str, Any]:
171181
* OpenAPI `readOnly` fields are excluded.
172182
* OpenAPI `readOnly` fields are excluded.
173183
* OpenAPI `readOnly` fields are excluded.
184+
* OpenAPI `readOnly` fields are excluded.
174185
"""
175186
excluded_fields: Set[str] = set(
176187
[
177188
"availability_zone",
178189
"created_at",
190+
"encrypted",
179191
"id",
180192
"size",
181193
"status",
@@ -204,6 +216,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
204216
"availabilityZone": obj.get("availabilityZone"),
205217
"createdAt": obj.get("createdAt"),
206218
"description": obj.get("description"),
219+
"encrypted": obj.get("encrypted"),
207220
"id": obj.get("id"),
208221
"labels": obj.get("labels"),
209222
"name": obj.get("name"),

0 commit comments

Comments
 (0)