diff --git a/services/ske/oas_commit b/services/ske/oas_commit new file mode 100644 index 00000000..ae7c3d54 --- /dev/null +++ b/services/ske/oas_commit @@ -0,0 +1 @@ +0619a6334d42bdfbb838fb10d2f57f7de3d7777d diff --git a/services/ske/src/stackit/ske/__init__.py b/services/ske/src/stackit/ske/__init__.py index c5dd04cd..9e61c70e 100644 --- a/services/ske/src/stackit/ske/__init__.py +++ b/services/ske/src/stackit/ske/__init__.py @@ -29,6 +29,7 @@ "ApiAttributeError", "ApiException", "ACL", + "AccessScope", "AvailabilityZone", "CRI", "Cluster", @@ -64,6 +65,7 @@ "RuntimeError", "Taint", "TimeWindow", + "V2ControlPlaneNetwork", "Volume", "VolumeType", ] @@ -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 @@ -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 diff --git a/services/ske/src/stackit/ske/models/__init__.py b/services/ske/src/stackit/ske/models/__init__.py index b752aa4a..93fd8b4f 100644 --- a/services/ske/src/stackit/ske/models/__init__.py +++ b/services/ske/src/stackit/ske/models/__init__.py @@ -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 @@ -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 diff --git a/services/ske/src/stackit/ske/models/access_scope.py b/services/ske/src/stackit/ske/models/access_scope.py new file mode 100644 index 00000000..eb18ac96 --- /dev/null +++ b/services/ske/src/stackit/ske/models/access_scope.py @@ -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)) diff --git a/services/ske/src/stackit/ske/models/cluster_status.py b/services/ske/src/stackit/ske/models/cluster_status.py index dbe4f453..08dd58ad 100644 --- a/services/ske/src/stackit/ske/models/cluster_status.py +++ b/services/ske/src/stackit/ske/models/cluster_status.py @@ -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" ) @@ -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"]) diff --git a/services/ske/src/stackit/ske/models/cluster_status_state.py b/services/ske/src/stackit/ske/models/cluster_status_state.py index 19811a25..82eab633 100644 --- a/services/ske/src/stackit/ske/models/cluster_status_state.py +++ b/services/ske/src/stackit/ske/models/cluster_status_state.py @@ -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" diff --git a/services/ske/src/stackit/ske/models/get_provider_options_request_version_state.py b/services/ske/src/stackit/ske/models/get_provider_options_request_version_state.py index 4de0a812..c92dcdb4 100644 --- a/services/ske/src/stackit/ske/models/get_provider_options_request_version_state.py +++ b/services/ske/src/stackit/ske/models/get_provider_options_request_version_state.py @@ -27,7 +27,6 @@ class GetProviderOptionsRequestVersionState(str, Enum): """ allowed enum values """ - UNSPECIFIED = "UNSPECIFIED" SUPPORTED = "SUPPORTED" @classmethod diff --git a/services/ske/src/stackit/ske/models/network.py b/services/ske/src/stackit/ske/models/network.py index dc1a7f26..3a1915e1 100644 --- a/services/ske/src/stackit/ske/models/network.py +++ b/services/ske/src/stackit/ske/models/network.py @@ -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, @@ -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 @@ -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 diff --git a/services/ske/src/stackit/ske/models/v2_control_plane_network.py b/services/ske/src/stackit/ske/models/v2_control_plane_network.py new file mode 100644 index 00000000..d36932b1 --- /dev/null +++ b/services/ske/src/stackit/ske/models/v2_control_plane_network.py @@ -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