Skip to content

Commit 5e8e1dc

Browse files
Generate ske
1 parent fe1b6ed commit 5e8e1dc

File tree

9 files changed

+149
-9
lines changed

9 files changed

+149
-9
lines changed

services/ske/oas_commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6b73e912b755cbed7e05695d6464c54d81125f27

services/ske/src/stackit/ske/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"ApiAttributeError",
3030
"ApiException",
3131
"ACL",
32+
"AccessScope",
3233
"AvailabilityZone",
3334
"CRI",
3435
"Cluster",
@@ -64,6 +65,7 @@
6465
"RuntimeError",
6566
"Taint",
6667
"TimeWindow",
68+
"V2ControlPlaneNetwork",
6769
"Volume",
6870
"VolumeType",
6971
]
@@ -81,6 +83,7 @@
8183
from stackit.ske.exceptions import ApiTypeError as ApiTypeError
8284
from stackit.ske.exceptions import ApiValueError as ApiValueError
8385
from stackit.ske.exceptions import OpenApiException as OpenApiException
86+
from stackit.ske.models.access_scope import AccessScope as AccessScope
8487

8588
# import models into sdk package
8689
from stackit.ske.models.acl import ACL as ACL
@@ -139,5 +142,8 @@
139142
from stackit.ske.models.runtime_error import RuntimeError as RuntimeError
140143
from stackit.ske.models.taint import Taint as Taint
141144
from stackit.ske.models.time_window import TimeWindow as TimeWindow
145+
from stackit.ske.models.v2_control_plane_network import (
146+
V2ControlPlaneNetwork as V2ControlPlaneNetwork,
147+
)
142148
from stackit.ske.models.volume import Volume as Volume
143149
from stackit.ske.models.volume_type import VolumeType as VolumeType

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
""" # noqa: E501
1414

1515

16+
from stackit.ske.models.access_scope import AccessScope
17+
1618
# import models into model package
1719
from stackit.ske.models.acl import ACL
1820
from stackit.ske.models.availability_zone import AvailabilityZone
@@ -54,5 +56,6 @@
5456
from stackit.ske.models.runtime_error import RuntimeError
5557
from stackit.ske.models.taint import Taint
5658
from stackit.ske.models.time_window import TimeWindow
59+
from stackit.ske.models.v2_control_plane_network import V2ControlPlaneNetwork
5760
from stackit.ske.models.volume import Volume
5861
from stackit.ske.models.volume_type import VolumeType
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# coding: utf-8
2+
3+
"""
4+
STACKIT Kubernetes Engine API
5+
6+
The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks.
7+
8+
The version of the OpenAPI document: 2.0
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
from __future__ import annotations
15+
16+
import json
17+
from enum import Enum
18+
19+
from typing_extensions import Self
20+
21+
22+
class AccessScope(str, Enum):
23+
"""
24+
The access scope of the Control Plane. It defines if the Kubernetes control plane is public or only available inside a STACKIT Network Area. ⚠️ Note: This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected.
25+
"""
26+
27+
"""
28+
allowed enum values
29+
"""
30+
PUBLIC = "PUBLIC"
31+
SNA = "SNA"
32+
33+
@classmethod
34+
def from_json(cls, json_str: str) -> Self:
35+
"""Create an instance of AccessScope from a JSON string"""
36+
return cls(json.loads(json_str))

services/ske/src/stackit/ske/models/cluster_status.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ClusterStatus(BaseModel):
4040
ClusterStatus
4141
""" # noqa: E501
4242

43-
aggregated: Optional[ClusterStatusState] = ClusterStatusState.STATE_UNSPECIFIED
43+
aggregated: Optional[ClusterStatusState] = None
4444
creation_time: Optional[datetime] = Field(
4545
default=None, description="Format: `2024-02-15T11:06:29Z`", alias="creationTime"
4646
)
@@ -147,9 +147,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
147147

148148
_obj = cls.model_validate(
149149
{
150-
"aggregated": (
151-
obj.get("aggregated") if obj.get("aggregated") is not None else ClusterStatusState.STATE_UNSPECIFIED
152-
),
150+
"aggregated": obj.get("aggregated"),
153151
"creationTime": obj.get("creationTime"),
154152
"credentialsRotation": (
155153
CredentialsRotationState.from_dict(obj["credentialsRotation"])

services/ske/src/stackit/ske/models/cluster_status_state.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class ClusterStatusState(str, Enum):
2727
"""
2828
allowed enum values
2929
"""
30-
STATE_UNSPECIFIED = "STATE_UNSPECIFIED"
3130
STATE_HEALTHY = "STATE_HEALTHY"
3231
STATE_CREATING = "STATE_CREATING"
3332
STATE_DELETING = "STATE_DELETING"

services/ske/src/stackit/ske/models/get_provider_options_request_version_state.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class GetProviderOptionsRequestVersionState(str, Enum):
2727
"""
2828
allowed enum values
2929
"""
30-
UNSPECIFIED = "UNSPECIFIED"
3130
SUPPORTED = "SUPPORTED"
3231

3332
@classmethod

services/ske/src/stackit/ske/models/network.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,20 @@
1717
import pprint
1818
from typing import Any, ClassVar, Dict, List, Optional, Set
1919

20-
from pydantic import BaseModel, ConfigDict, StrictStr
20+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
2121
from typing_extensions import Self
2222

23+
from stackit.ske.models.v2_control_plane_network import V2ControlPlaneNetwork
24+
2325

2426
class Network(BaseModel):
2527
"""
2628
Network
2729
""" # noqa: E501
2830

31+
control_plane: Optional[V2ControlPlaneNetwork] = Field(default=None, alias="controlPlane")
2932
id: Optional[StrictStr] = None
30-
__properties: ClassVar[List[str]] = ["id"]
33+
__properties: ClassVar[List[str]] = ["controlPlane", "id"]
3134

3235
model_config = ConfigDict(
3336
populate_by_name=True,
@@ -66,6 +69,9 @@ def to_dict(self) -> Dict[str, Any]:
6669
exclude=excluded_fields,
6770
exclude_none=True,
6871
)
72+
# override the default output from pydantic by calling `to_dict()` of control_plane
73+
if self.control_plane:
74+
_dict["controlPlane"] = self.control_plane.to_dict()
6975
return _dict
7076

7177
@classmethod
@@ -77,5 +83,14 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
7783
if not isinstance(obj, dict):
7884
return cls.model_validate(obj)
7985

80-
_obj = cls.model_validate({"id": obj.get("id")})
86+
_obj = cls.model_validate(
87+
{
88+
"controlPlane": (
89+
V2ControlPlaneNetwork.from_dict(obj["controlPlane"])
90+
if obj.get("controlPlane") is not None
91+
else None
92+
),
93+
"id": obj.get("id"),
94+
}
95+
)
8196
return _obj
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# coding: utf-8
2+
3+
"""
4+
STACKIT Kubernetes Engine API
5+
6+
The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks.
7+
8+
The version of the OpenAPI document: 2.0
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
from __future__ import annotations
15+
16+
import json
17+
import pprint
18+
from typing import Any, ClassVar, Dict, List, Optional, Set
19+
20+
from pydantic import BaseModel, ConfigDict, Field
21+
from typing_extensions import Self
22+
23+
from stackit.ske.models.access_scope import AccessScope
24+
25+
26+
class V2ControlPlaneNetwork(BaseModel):
27+
"""
28+
V2ControlPlaneNetwork
29+
""" # noqa: E501
30+
31+
access_scope: Optional[AccessScope] = Field(default=None, alias="accessScope")
32+
__properties: ClassVar[List[str]] = ["accessScope"]
33+
34+
model_config = ConfigDict(
35+
populate_by_name=True,
36+
validate_assignment=True,
37+
protected_namespaces=(),
38+
)
39+
40+
def to_str(self) -> str:
41+
"""Returns the string representation of the model using alias"""
42+
return pprint.pformat(self.model_dump(by_alias=True))
43+
44+
def to_json(self) -> str:
45+
"""Returns the JSON representation of the model using alias"""
46+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47+
return json.dumps(self.to_dict())
48+
49+
@classmethod
50+
def from_json(cls, json_str: str) -> Optional[Self]:
51+
"""Create an instance of V2ControlPlaneNetwork from a JSON string"""
52+
return cls.from_dict(json.loads(json_str))
53+
54+
def to_dict(self) -> Dict[str, Any]:
55+
"""Return the dictionary representation of the model using alias.
56+
57+
This has the following differences from calling pydantic's
58+
`self.model_dump(by_alias=True)`:
59+
60+
* `None` is only added to the output dict for nullable fields that
61+
were set at model initialization. Other fields with value `None`
62+
are ignored.
63+
"""
64+
excluded_fields: Set[str] = set([])
65+
66+
_dict = self.model_dump(
67+
by_alias=True,
68+
exclude=excluded_fields,
69+
exclude_none=True,
70+
)
71+
return _dict
72+
73+
@classmethod
74+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75+
"""Create an instance of V2ControlPlaneNetwork from a dict"""
76+
if obj is None:
77+
return None
78+
79+
if not isinstance(obj, dict):
80+
return cls.model_validate(obj)
81+
82+
_obj = cls.model_validate({"accessScope": obj.get("accessScope")})
83+
return _obj

0 commit comments

Comments
 (0)