diff --git a/services/edge/oas_commit b/services/edge/oas_commit index cca6a5e9a..7d5fc0bc0 100644 --- a/services/edge/oas_commit +++ b/services/edge/oas_commit @@ -1 +1 @@ -95de5cba3201a683657cb472d5fa30aa768f19cc +a896a71ffc1c1152f63b40a0194ac461ce179d6c diff --git a/services/edge/src/stackit/edge/__init__.py b/services/edge/src/stackit/edge/__init__.py index 267315f0b..93d93f2ad 100644 --- a/services/edge/src/stackit/edge/__init__.py +++ b/services/edge/src/stackit/edge/__init__.py @@ -33,6 +33,7 @@ "Instance", "InstanceList", "Kubeconfig", + "KubernetesReleaseList", "Plan", "PlanList", "Token", @@ -64,6 +65,9 @@ from stackit.edge.models.instance import Instance as Instance from stackit.edge.models.instance_list import InstanceList as InstanceList from stackit.edge.models.kubeconfig import Kubeconfig as Kubeconfig +from stackit.edge.models.kubernetes_release_list import ( + KubernetesReleaseList as KubernetesReleaseList, +) from stackit.edge.models.plan import Plan as Plan from stackit.edge.models.plan_list import PlanList as PlanList from stackit.edge.models.token import Token as Token diff --git a/services/edge/src/stackit/edge/api/default_api.py b/services/edge/src/stackit/edge/api/default_api.py index 665ce3fde..ab1c8cc18 100644 --- a/services/edge/src/stackit/edge/api/default_api.py +++ b/services/edge/src/stackit/edge/api/default_api.py @@ -30,6 +30,7 @@ from stackit.edge.models.instance import Instance from stackit.edge.models.instance_list import InstanceList from stackit.edge.models.kubeconfig import Kubeconfig +from stackit.edge.models.kubernetes_release_list import KubernetesReleaseList from stackit.edge.models.plan_list import PlanList from stackit.edge.models.token import Token from stackit.edge.models.update_instance_by_name_payload import ( @@ -2627,6 +2628,240 @@ def _get_token_by_instance_name_serialize( _request_auth=_request_auth, ) + @validate_call + def list_compatible_kubernetes_releases( + self, + talos_version: Annotated[StrictStr, Field(description="The name of the Talos release.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> KubernetesReleaseList: + """list_compatible_kubernetes_releases + + + :param talos_version: The name of the Talos release. (required) + :type talos_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_compatible_kubernetes_releases_serialize( + talos_version=talos_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "KubernetesReleaseList", + "400": "BadRequest", + "404": None, + "500": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def list_compatible_kubernetes_releases_with_http_info( + self, + talos_version: Annotated[StrictStr, Field(description="The name of the Talos release.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[KubernetesReleaseList]: + """list_compatible_kubernetes_releases + + + :param talos_version: The name of the Talos release. (required) + :type talos_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_compatible_kubernetes_releases_serialize( + talos_version=talos_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "KubernetesReleaseList", + "400": "BadRequest", + "404": None, + "500": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def list_compatible_kubernetes_releases_without_preload_content( + self, + talos_version: Annotated[StrictStr, Field(description="The name of the Talos release.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """list_compatible_kubernetes_releases + + + :param talos_version: The name of the Talos release. (required) + :type talos_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_compatible_kubernetes_releases_serialize( + talos_version=talos_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "KubernetesReleaseList", + "400": "BadRequest", + "404": None, + "500": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _list_compatible_kubernetes_releases_serialize( + self, + talos_version, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if talos_version is not None: + + _query_params.append(("talosVersion", talos_version)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1beta1/listcompatiblekubernetesreleases", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + @validate_call def list_instances( self, diff --git a/services/edge/src/stackit/edge/models/__init__.py b/services/edge/src/stackit/edge/models/__init__.py index ae6007c0b..44c1552e8 100644 --- a/services/edge/src/stackit/edge/models/__init__.py +++ b/services/edge/src/stackit/edge/models/__init__.py @@ -18,6 +18,7 @@ from stackit.edge.models.instance import Instance from stackit.edge.models.instance_list import InstanceList from stackit.edge.models.kubeconfig import Kubeconfig +from stackit.edge.models.kubernetes_release_list import KubernetesReleaseList from stackit.edge.models.plan import Plan from stackit.edge.models.plan_list import PlanList from stackit.edge.models.token import Token diff --git a/services/edge/src/stackit/edge/models/kubernetes_release_list.py b/services/edge/src/stackit/edge/models/kubernetes_release_list.py new file mode 100644 index 000000000..5972f58de --- /dev/null +++ b/services/edge/src/stackit/edge/models/kubernetes_release_list.py @@ -0,0 +1,81 @@ +# 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, StrictStr +from typing_extensions import Self + + +class KubernetesReleaseList(BaseModel): + """ + A list of compatible Kubernetes releases. + """ # noqa: E501 + + k8s_releases: List[StrictStr] = Field(description="Array of Kubernetes version strings.") + __properties: ClassVar[List[str]] = ["k8s_releases"] + + 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 KubernetesReleaseList 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 KubernetesReleaseList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"k8s_releases": obj.get("k8s_releases")}) + return _obj