From d1f98a84df56c5fead5cd02408e1c8fce918d668 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Mon, 13 Jul 2026 13:11:19 +0000 Subject: [PATCH] Generate edge --- services/edge/oas_commit | 2 +- services/edge/src/stackit/edge/__init__.py | 4 + services/edge/src/stackit/edge/exceptions.py | 8 +- .../edge/src/stackit/edge/models/__init__.py | 2 + services/edge/src/stackit/edge/models/acl.py | 99 +++++++++++++ .../edge/src/stackit/edge/models/instance.py | 8 + .../edge/models/ip_allow_list_entry.py | 138 ++++++++++++++++++ 7 files changed, 256 insertions(+), 5 deletions(-) create mode 100644 services/edge/src/stackit/edge/models/acl.py create mode 100644 services/edge/src/stackit/edge/models/ip_allow_list_entry.py diff --git a/services/edge/oas_commit b/services/edge/oas_commit index 92110ac5e..375e3bee8 100644 --- a/services/edge/oas_commit +++ b/services/edge/oas_commit @@ -1 +1 @@ -dced41b14515398157ee7204ef11256b9e3fcbdc +f03aa0907e74e8b2a68149937622d809c7c4aef5 diff --git a/services/edge/src/stackit/edge/__init__.py b/services/edge/src/stackit/edge/__init__.py index 93d93f2ad..6fef11d32 100644 --- a/services/edge/src/stackit/edge/__init__.py +++ b/services/edge/src/stackit/edge/__init__.py @@ -28,10 +28,12 @@ "ApiKeyError", "ApiAttributeError", "ApiException", + "Acl", "BadRequest", "CreateInstancePayload", "Instance", "InstanceList", + "IpAllowListEntry", "Kubeconfig", "KubernetesReleaseList", "Plan", @@ -58,12 +60,14 @@ from stackit.edge.exceptions import OpenApiException as OpenApiException # import models into sdk package +from stackit.edge.models.acl import Acl as Acl from stackit.edge.models.bad_request import BadRequest as BadRequest from stackit.edge.models.create_instance_payload import ( CreateInstancePayload as CreateInstancePayload, ) from stackit.edge.models.instance import Instance as Instance from stackit.edge.models.instance_list import InstanceList as InstanceList +from stackit.edge.models.ip_allow_list_entry import IpAllowListEntry as IpAllowListEntry from stackit.edge.models.kubeconfig import Kubeconfig as Kubeconfig from stackit.edge.models.kubernetes_release_list import ( KubernetesReleaseList as KubernetesReleaseList, diff --git a/services/edge/src/stackit/edge/exceptions.py b/services/edge/src/stackit/edge/exceptions.py index 0089ededb..e9f0c8988 100644 --- a/services/edge/src/stackit/edge/exceptions.py +++ b/services/edge/src/stackit/edge/exceptions.py @@ -45,7 +45,7 @@ def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiTypeError, self).__init__(full_msg) + super(ApiTypeError, self).__init__(full_msg, path_to_item, valid_classes, key_type) class ApiValueError(OpenApiException, ValueError): @@ -63,7 +63,7 @@ def __init__(self, msg, path_to_item=None) -> None: full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiValueError, self).__init__(full_msg) + super(ApiValueError, self).__init__(full_msg, path_to_item) class ApiAttributeError(OpenApiException, AttributeError): @@ -82,7 +82,7 @@ def __init__(self, msg, path_to_item=None) -> None: full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiAttributeError, self).__init__(full_msg) + super(ApiAttributeError, self).__init__(full_msg, path_to_item) class ApiKeyError(OpenApiException, KeyError): @@ -99,7 +99,7 @@ def __init__(self, msg, path_to_item=None) -> None: full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiKeyError, self).__init__(full_msg) + super(ApiKeyError, self).__init__(full_msg, path_to_item) class ApiException(OpenApiException): diff --git a/services/edge/src/stackit/edge/models/__init__.py b/services/edge/src/stackit/edge/models/__init__.py index 44c1552e8..7233fc237 100644 --- a/services/edge/src/stackit/edge/models/__init__.py +++ b/services/edge/src/stackit/edge/models/__init__.py @@ -13,10 +13,12 @@ """ # noqa: E501 # import models into model package +from stackit.edge.models.acl import Acl from stackit.edge.models.bad_request import BadRequest from stackit.edge.models.create_instance_payload import CreateInstancePayload from stackit.edge.models.instance import Instance from stackit.edge.models.instance_list import InstanceList +from stackit.edge.models.ip_allow_list_entry import IpAllowListEntry from stackit.edge.models.kubeconfig import Kubeconfig from stackit.edge.models.kubernetes_release_list import KubernetesReleaseList from stackit.edge.models.plan import Plan diff --git a/services/edge/src/stackit/edge/models/acl.py b/services/edge/src/stackit/edge/models/acl.py new file mode 100644 index 000000000..554e14286 --- /dev/null +++ b/services/edge/src/stackit/edge/models/acl.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + STACKIT Edge Cloud API + + This API provides endpoints for managing STACKIT Edge Cloud instances. + + The version of the OpenAPI document: 1beta1 + 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 pydantic_core import to_jsonable_python +from typing_extensions import Self + +from stackit.edge.models.ip_allow_list_entry import IpAllowListEntry + + +class Acl(BaseModel): + """ + The ACL config for the instances API and all edgecluster proxies. + """ # noqa: E501 + + ip_allow_list: Optional[List[IpAllowListEntry]] = Field(default=None, alias="ipAllowList") + __properties: ClassVar[List[str]] = ["ipAllowList"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=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""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Acl 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, + ) + # override the default output from pydantic by calling `to_dict()` of each item in ip_allow_list (list) + _items = [] + if self.ip_allow_list: + for _item_ip_allow_list in self.ip_allow_list: + if _item_ip_allow_list: + _items.append(_item_ip_allow_list.to_dict()) + _dict["ipAllowList"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Acl from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "ipAllowList": ( + [IpAllowListEntry.from_dict(_item) for _item in obj["ipAllowList"]] + if obj.get("ipAllowList") is not None + else None + ) + } + ) + return _obj diff --git a/services/edge/src/stackit/edge/models/instance.py b/services/edge/src/stackit/edge/models/instance.py index 453c92102..fcbc51072 100644 --- a/services/edge/src/stackit/edge/models/instance.py +++ b/services/edge/src/stackit/edge/models/instance.py @@ -24,12 +24,15 @@ from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self +from stackit.edge.models.acl import Acl + class Instance(BaseModel): """ Instance """ # noqa: E501 + acl: Optional[Acl] = None created: datetime = Field(description="The date and time the creation of the instance was triggered.") description: Optional[Annotated[str, Field(strict=True, max_length=256)]] = Field( default=None, description="A user chosen description to distinguish multiple instances." @@ -44,6 +47,7 @@ class Instance(BaseModel): plan_id: UUID = Field(description="Service Plan configures the size of the Instance.", alias="planId") status: StrictStr = Field(description="The current status of the instance.") __properties: ClassVar[List[str]] = [ + "acl", "created", "description", "displayName", @@ -110,6 +114,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 acl + if self.acl: + _dict["acl"] = self.acl.to_dict() return _dict @classmethod @@ -123,6 +130,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { + "acl": Acl.from_dict(obj["acl"]) if obj.get("acl") is not None else None, "created": obj.get("created"), "description": obj.get("description"), "displayName": obj.get("displayName"), diff --git a/services/edge/src/stackit/edge/models/ip_allow_list_entry.py b/services/edge/src/stackit/edge/models/ip_allow_list_entry.py new file mode 100644 index 000000000..f3de4817a --- /dev/null +++ b/services/edge/src/stackit/edge/models/ip_allow_list_entry.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + STACKIT Edge Cloud API + + This API provides endpoints for managing STACKIT Edge Cloud instances. + + The version of the OpenAPI document: 1beta1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from datetime import datetime +from typing import Any, ClassVar, Dict, List, Optional, Set +from uuid import UUID + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python +from typing_extensions import Annotated, Self + + +class IpAllowListEntry(BaseModel): + """ + IpAllowListEntry + """ # noqa: E501 + + created_at: Optional[datetime] = Field( + default=None, description="ISO-8601 timestamp of when the entry was created.", alias="createdAt" + ) + description: Optional[Annotated[str, Field(strict=True, max_length=256)]] = Field( + default=None, description="Some description of the entry." + ) + ip_range: StrictStr = Field(description="The IP CIDR range for the ACL entry.", alias="ipRange") + updated_at: Optional[datetime] = Field( + default=None, description="ISO-8601 timestamp of when the entry was last updated.", alias="updatedAt" + ) + uuid: UUID = Field( + description="The unique identifier for the ipAllowListEntry entry. This value is immutable, used to identify entries for updates, and cannot be changed after creation." + ) + __properties: ClassVar[List[str]] = ["createdAt", "description", "ipRange", "updatedAt", "uuid"] + + @field_validator("created_at", mode="before") + def created_at_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + + @field_validator("updated_at", mode="before") + def updated_at_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=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""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of IpAllowListEntry 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. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set( + [ + "created_at", + "updated_at", + ] + ) + + _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 IpAllowListEntry from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "createdAt": obj.get("createdAt"), + "description": obj.get("description"), + "ipRange": obj.get("ipRange"), + "updatedAt": obj.get("updatedAt"), + "uuid": obj.get("uuid"), + } + ) + return _obj