Skip to content

Commit 08ba006

Browse files
Generate ske
1 parent 1866b21 commit 08ba006

File tree

4 files changed

+109
-0
lines changed

4 files changed

+109
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"MaintenanceAutoUpdate",
5757
"Network",
5858
"Nodepool",
59+
"NodepoolKubernetes",
5960
"Observability",
6061
"ProviderOptions",
6162
"RuntimeError",
@@ -124,6 +125,9 @@
124125
)
125126
from stackit.ske.models.network import Network as Network
126127
from stackit.ske.models.nodepool import Nodepool as Nodepool
128+
from stackit.ske.models.nodepool_kubernetes import (
129+
NodepoolKubernetes as NodepoolKubernetes,
130+
)
127131
from stackit.ske.models.observability import Observability as Observability
128132
from stackit.ske.models.provider_options import ProviderOptions as ProviderOptions
129133
from stackit.ske.models.runtime_error import RuntimeError as RuntimeError

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from stackit.ske.models.maintenance_auto_update import MaintenanceAutoUpdate
4545
from stackit.ske.models.network import Network
4646
from stackit.ske.models.nodepool import Nodepool
47+
from stackit.ske.models.nodepool_kubernetes import NodepoolKubernetes
4748
from stackit.ske.models.observability import Observability
4849
from stackit.ske.models.provider_options import ProviderOptions
4950
from stackit.ske.models.runtime_error import RuntimeError

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
from stackit.ske.models.cri import CRI
2424
from stackit.ske.models.machine import Machine
25+
from stackit.ske.models.nodepool_kubernetes import NodepoolKubernetes
2526
from stackit.ske.models.taint import Taint
2627
from stackit.ske.models.volume import Volume
2728

@@ -36,6 +37,7 @@ class Nodepool(BaseModel):
3637
)
3738
availability_zones: List[StrictStr] = Field(alias="availabilityZones")
3839
cri: Optional[CRI] = None
40+
kubernetes: Optional[NodepoolKubernetes] = None
3941
labels: Optional[Dict[str, StrictStr]] = None
4042
machine: Machine
4143
max_surge: Optional[StrictInt] = Field(default=None, alias="maxSurge")
@@ -53,6 +55,7 @@ class Nodepool(BaseModel):
5355
"allowSystemComponents",
5456
"availabilityZones",
5557
"cri",
58+
"kubernetes",
5659
"labels",
5760
"machine",
5861
"maxSurge",
@@ -104,6 +107,9 @@ def to_dict(self) -> Dict[str, Any]:
104107
# override the default output from pydantic by calling `to_dict()` of cri
105108
if self.cri:
106109
_dict["cri"] = self.cri.to_dict()
110+
# override the default output from pydantic by calling `to_dict()` of kubernetes
111+
if self.kubernetes:
112+
_dict["kubernetes"] = self.kubernetes.to_dict()
107113
# override the default output from pydantic by calling `to_dict()` of machine
108114
if self.machine:
109115
_dict["machine"] = self.machine.to_dict()
@@ -133,6 +139,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
133139
"allowSystemComponents": obj.get("allowSystemComponents"),
134140
"availabilityZones": obj.get("availabilityZones"),
135141
"cri": CRI.from_dict(obj["cri"]) if obj.get("cri") is not None else None,
142+
"kubernetes": (
143+
NodepoolKubernetes.from_dict(obj["kubernetes"]) if obj.get("kubernetes") is not None else None
144+
),
136145
"labels": obj.get("labels"),
137146
"machine": Machine.from_dict(obj["machine"]) if obj.get("machine") is not None else None,
138147
"maxSurge": obj.get("maxSurge"),
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# coding: utf-8
2+
3+
"""
4+
SKE-API
5+
6+
The SKE API provides endpoints to create, update, delete clusters within STACKIT portal 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+
import re # noqa: F401
19+
from typing import Any, ClassVar, Dict, List, Optional, Set
20+
21+
from pydantic import BaseModel, ConfigDict, Field, field_validator
22+
from typing_extensions import Annotated, Self
23+
24+
25+
class NodepoolKubernetes(BaseModel):
26+
"""
27+
NodepoolKubernetes
28+
""" # noqa: E501
29+
30+
version: Optional[Annotated[str, Field(strict=True)]] = Field(
31+
default=None,
32+
description="Override the Kubernetes version for the Kubelet of this Nodepool. Version must be equal or lower than the version of the cluster. Only one minor version difference to the version of the cluster is allowed. Downgrade of existing Nodepools is prohibited.",
33+
)
34+
__properties: ClassVar[List[str]] = ["version"]
35+
36+
@field_validator("version")
37+
def version_validate_regular_expression(cls, value):
38+
"""Validates the regular expression"""
39+
if value is None:
40+
return value
41+
42+
if not re.match(r"^\d+\.\d+\.\d+$", value):
43+
raise ValueError(r"must validate the regular expression /^\d+\.\d+\.\d+$/")
44+
return value
45+
46+
model_config = ConfigDict(
47+
populate_by_name=True,
48+
validate_assignment=True,
49+
protected_namespaces=(),
50+
)
51+
52+
def to_str(self) -> str:
53+
"""Returns the string representation of the model using alias"""
54+
return pprint.pformat(self.model_dump(by_alias=True))
55+
56+
def to_json(self) -> str:
57+
"""Returns the JSON representation of the model using alias"""
58+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59+
return json.dumps(self.to_dict())
60+
61+
@classmethod
62+
def from_json(cls, json_str: str) -> Optional[Self]:
63+
"""Create an instance of NodepoolKubernetes from a JSON string"""
64+
return cls.from_dict(json.loads(json_str))
65+
66+
def to_dict(self) -> Dict[str, Any]:
67+
"""Return the dictionary representation of the model using alias.
68+
69+
This has the following differences from calling pydantic's
70+
`self.model_dump(by_alias=True)`:
71+
72+
* `None` is only added to the output dict for nullable fields that
73+
were set at model initialization. Other fields with value `None`
74+
are ignored.
75+
"""
76+
excluded_fields: Set[str] = set([])
77+
78+
_dict = self.model_dump(
79+
by_alias=True,
80+
exclude=excluded_fields,
81+
exclude_none=True,
82+
)
83+
return _dict
84+
85+
@classmethod
86+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87+
"""Create an instance of NodepoolKubernetes from a dict"""
88+
if obj is None:
89+
return None
90+
91+
if not isinstance(obj, dict):
92+
return cls.model_validate(obj)
93+
94+
_obj = cls.model_validate({"version": obj.get("version")})
95+
return _obj

0 commit comments

Comments
 (0)