Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions services/ske/oas_commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6b73e912b755cbed7e05695d6464c54d81125f27
6 changes: 6 additions & 0 deletions services/ske/src/stackit/ske/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"ApiAttributeError",
"ApiException",
"ACL",
"AccessScope",
"AvailabilityZone",
"CRI",
"Cluster",
Expand Down Expand Up @@ -64,6 +65,7 @@
"RuntimeError",
"Taint",
"TimeWindow",
"V2ControlPlaneNetwork",
"Volume",
"VolumeType",
]
Expand All @@ -81,6 +83,7 @@
from stackit.ske.exceptions import ApiTypeError as ApiTypeError
from stackit.ske.exceptions import ApiValueError as ApiValueError
from stackit.ske.exceptions import OpenApiException as OpenApiException
from stackit.ske.models.access_scope import AccessScope as AccessScope

# import models into sdk package
from stackit.ske.models.acl import ACL as ACL
Expand Down Expand Up @@ -139,5 +142,8 @@
from stackit.ske.models.runtime_error import RuntimeError as RuntimeError
from stackit.ske.models.taint import Taint as Taint
from stackit.ske.models.time_window import TimeWindow as TimeWindow
from stackit.ske.models.v2_control_plane_network import (
V2ControlPlaneNetwork as V2ControlPlaneNetwork,
)
from stackit.ske.models.volume import Volume as Volume
from stackit.ske.models.volume_type import VolumeType as VolumeType
3 changes: 3 additions & 0 deletions services/ske/src/stackit/ske/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
""" # noqa: E501


from stackit.ske.models.access_scope import AccessScope

# import models into model package
from stackit.ske.models.acl import ACL
from stackit.ske.models.availability_zone import AvailabilityZone
Expand Down Expand Up @@ -54,5 +56,6 @@
from stackit.ske.models.runtime_error import RuntimeError
from stackit.ske.models.taint import Taint
from stackit.ske.models.time_window import TimeWindow
from stackit.ske.models.v2_control_plane_network import V2ControlPlaneNetwork
from stackit.ske.models.volume import Volume
from stackit.ske.models.volume_type import VolumeType
36 changes: 36 additions & 0 deletions services/ske/src/stackit/ske/models/access_scope.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# coding: utf-8

"""
STACKIT Kubernetes Engine API

The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks.

The version of the OpenAPI document: 2.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501

from __future__ import annotations

import json
from enum import Enum

from typing_extensions import Self


class AccessScope(str, Enum):
"""
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.
"""

"""
allowed enum values
"""
PUBLIC = "PUBLIC"
SNA = "SNA"

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of AccessScope from a JSON string"""
return cls(json.loads(json_str))
6 changes: 2 additions & 4 deletions services/ske/src/stackit/ske/models/cluster_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ClusterStatus(BaseModel):
ClusterStatus
""" # noqa: E501

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

_obj = cls.model_validate(
{
"aggregated": (
obj.get("aggregated") if obj.get("aggregated") is not None else ClusterStatusState.STATE_UNSPECIFIED
),
"aggregated": obj.get("aggregated"),
"creationTime": obj.get("creationTime"),
"credentialsRotation": (
CredentialsRotationState.from_dict(obj["credentialsRotation"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class ClusterStatusState(str, Enum):
"""
allowed enum values
"""
STATE_UNSPECIFIED = "STATE_UNSPECIFIED"
STATE_HEALTHY = "STATE_HEALTHY"
STATE_CREATING = "STATE_CREATING"
STATE_DELETING = "STATE_DELETING"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class GetProviderOptionsRequestVersionState(str, Enum):
"""
allowed enum values
"""
UNSPECIFIED = "UNSPECIFIED"
SUPPORTED = "SUPPORTED"

@classmethod
Expand Down
21 changes: 18 additions & 3 deletions services/ske/src/stackit/ske/models/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@
import pprint
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, StrictStr
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing_extensions import Self

from stackit.ske.models.v2_control_plane_network import V2ControlPlaneNetwork


class Network(BaseModel):
"""
Network
""" # noqa: E501

control_plane: Optional[V2ControlPlaneNetwork] = Field(default=None, alias="controlPlane")
id: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["id"]
__properties: ClassVar[List[str]] = ["controlPlane", "id"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -66,6 +69,9 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of control_plane
if self.control_plane:
_dict["controlPlane"] = self.control_plane.to_dict()
return _dict

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

_obj = cls.model_validate({"id": obj.get("id")})
_obj = cls.model_validate(
{
"controlPlane": (
V2ControlPlaneNetwork.from_dict(obj["controlPlane"])
if obj.get("controlPlane") is not None
else None
),
"id": obj.get("id"),
}
)
return _obj
83 changes: 83 additions & 0 deletions services/ske/src/stackit/ske/models/v2_control_plane_network.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# coding: utf-8

"""
STACKIT Kubernetes Engine API

The SKE API provides endpoints to create, update or delete clusters within STACKIT projects and to trigger further cluster management tasks.

The version of the OpenAPI document: 2.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501

from __future__ import annotations

import json
import pprint
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field
from typing_extensions import Self

from stackit.ske.models.access_scope import AccessScope


class V2ControlPlaneNetwork(BaseModel):
"""
V2ControlPlaneNetwork
""" # noqa: E501

access_scope: Optional[AccessScope] = Field(default=None, alias="accessScope")
__properties: ClassVar[List[str]] = ["accessScope"]

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of V2ControlPlaneNetwork from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:

* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([])

_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of V2ControlPlaneNetwork from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({"accessScope": obj.get("accessScope")})
return _obj
Loading