From 7dbc90b4a410b9588f5d98b3c07d1d27af13d6ee Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 4 Feb 2025 12:09:44 +0000 Subject: [PATCH 1/2] Generate ske --- services/ske/src/stackit/ske/__init__.py | 3 - .../ske/src/stackit/ske/api/default_api.py | 1288 +---------------- .../ske/src/stackit/ske/models/__init__.py | 3 - .../src/stackit/ske/models/cluster_status.py | 18 +- .../ske/src/stackit/ske/models/credentials.py | 91 -- .../ske/models/credentials_rotation_state.py | 7 +- .../ske/models/hibernation_schedule.py | 8 +- .../ske/src/stackit/ske/models/kubeconfig.py | 3 +- .../stackit/ske/models/kubernetes_version.py | 3 +- .../ske/models/machine_image_version.py | 3 +- .../stackit/ske/models/project_response.py | 89 -- .../src/stackit/ske/models/project_state.py | 39 - .../ske/src/stackit/ske/models/time_window.py | 7 +- 13 files changed, 71 insertions(+), 1491 deletions(-) delete mode 100644 services/ske/src/stackit/ske/models/credentials.py delete mode 100644 services/ske/src/stackit/ske/models/project_response.py delete mode 100644 services/ske/src/stackit/ske/models/project_state.py diff --git a/services/ske/src/stackit/ske/__init__.py b/services/ske/src/stackit/ske/__init__.py index a538cdce..5c6cea22 100644 --- a/services/ske/src/stackit/ske/__init__.py +++ b/services/ske/src/stackit/ske/__init__.py @@ -43,7 +43,6 @@ from stackit.ske.models.create_or_update_cluster_payload import ( CreateOrUpdateClusterPayload, ) -from stackit.ske.models.credentials import Credentials from stackit.ske.models.credentials_rotation_state import CredentialsRotationState from stackit.ske.models.cri import CRI from stackit.ske.models.dns import DNS @@ -64,8 +63,6 @@ from stackit.ske.models.maintenance_auto_update import MaintenanceAutoUpdate from stackit.ske.models.network import Network from stackit.ske.models.nodepool import Nodepool -from stackit.ske.models.project_response import ProjectResponse -from stackit.ske.models.project_state import ProjectState from stackit.ske.models.provider_options import ProviderOptions from stackit.ske.models.runtime_error import RuntimeError from stackit.ske.models.taint import Taint diff --git a/services/ske/src/stackit/ske/api/default_api.py b/services/ske/src/stackit/ske/api/default_api.py index 594ab966..d9a364e0 100644 --- a/services/ske/src/stackit/ske/api/default_api.py +++ b/services/ske/src/stackit/ske/api/default_api.py @@ -11,7 +11,6 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long -import warnings from typing import Any, Dict, List, Optional, Tuple, Union from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call @@ -25,11 +24,9 @@ from stackit.ske.models.create_or_update_cluster_payload import ( CreateOrUpdateClusterPayload, ) -from stackit.ske.models.credentials import Credentials from stackit.ske.models.kubeconfig import Kubeconfig from stackit.ske.models.list_clusters_response import ListClustersResponse from stackit.ske.models.login_kubeconfig import LoginKubeconfig -from stackit.ske.models.project_response import ProjectResponse from stackit.ske.models.provider_options import ProviderOptions from stackit.ske.rest import RESTResponseType @@ -1079,715 +1076,7 @@ def _delete_cluster_serialize( ) @validate_call - def disable_service( - self, - project_id: StrictStr, - _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, - ) -> object: - """(Deprecated) Delete a project - - This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. Deletes the SKE project specified by `projectId`. Deleting a project deletes all corresponding shoots. - - :param project_id: (required) - :type project_id: 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 docstring might be too long - warnings.warn("DELETE /v1/projects/{projectId} is deprecated.", DeprecationWarning) - - _param = self._disable_service_serialize( - project_id=project_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "object", - "202": "object", - "400": "object", - } - 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 disable_service_with_http_info( - self, - project_id: StrictStr, - _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[object]: - """(Deprecated) Delete a project - - This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. Deletes the SKE project specified by `projectId`. Deleting a project deletes all corresponding shoots. - - :param project_id: (required) - :type project_id: 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 docstring might be too long - warnings.warn("DELETE /v1/projects/{projectId} is deprecated.", DeprecationWarning) - - _param = self._disable_service_serialize( - project_id=project_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "object", - "202": "object", - "400": "object", - } - 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 disable_service_without_preload_content( - self, - project_id: StrictStr, - _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: - """(Deprecated) Delete a project - - This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. Deletes the SKE project specified by `projectId`. Deleting a project deletes all corresponding shoots. - - :param project_id: (required) - :type project_id: 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 docstring might be too long - warnings.warn("DELETE /v1/projects/{projectId} is deprecated.", DeprecationWarning) - - _param = self._disable_service_serialize( - project_id=project_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "object", - "202": "object", - "400": "object", - } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) - return response_data.response - - def _disable_service_serialize( - self, - project_id, - _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]] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if project_id is not None: - _path_params["projectId"] = project_id - # process the query parameters - # 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="DELETE", - resource_path="/v1/projects/{projectId}", - 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 enable_service( - self, - project_id: StrictStr, - _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, - ) -> ProjectResponse: - """(Deprecated) Create a Project - - This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. Returns creation state of Project specified by `projectId`. - - :param project_id: (required) - :type project_id: 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 docstring might be too long - warnings.warn("PUT /v1/projects/{projectId} is deprecated.", DeprecationWarning) - - _param = self._enable_service_serialize( - project_id=project_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "ProjectResponse", - "400": "object", - } - 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 enable_service_with_http_info( - self, - project_id: StrictStr, - _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[ProjectResponse]: - """(Deprecated) Create a Project - - This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. Returns creation state of Project specified by `projectId`. - - :param project_id: (required) - :type project_id: 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 docstring might be too long - warnings.warn("PUT /v1/projects/{projectId} is deprecated.", DeprecationWarning) - - _param = self._enable_service_serialize( - project_id=project_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "ProjectResponse", - "400": "object", - } - 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 enable_service_without_preload_content( - self, - project_id: StrictStr, - _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: - """(Deprecated) Create a Project - - This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. Returns creation state of Project specified by `projectId`. - - :param project_id: (required) - :type project_id: 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 docstring might be too long - warnings.warn("PUT /v1/projects/{projectId} is deprecated.", DeprecationWarning) - - _param = self._enable_service_serialize( - project_id=project_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "ProjectResponse", - "400": "object", - } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) - return response_data.response - - def _enable_service_serialize( - self, - project_id, - _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]] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if project_id is not None: - _path_params["projectId"] = project_id - # process the query parameters - # 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="PUT", - resource_path="/v1/projects/{projectId}", - 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 get_cluster( - self, - project_id: StrictStr, - cluster_name: StrictStr, - _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, - ) -> Cluster: - """Get a cluster - - Get Kubernetes cluster for the specified identifier, belonging to the project specified by `projectId`. - - :param project_id: (required) - :type project_id: str - :param cluster_name: (required) - :type cluster_name: 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 docstring might be too long - - _param = self._get_cluster_serialize( - project_id=project_id, - cluster_name=cluster_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "Cluster", - } - 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 get_cluster_with_http_info( - self, - project_id: StrictStr, - cluster_name: StrictStr, - _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[Cluster]: - """Get a cluster - - Get Kubernetes cluster for the specified identifier, belonging to the project specified by `projectId`. - - :param project_id: (required) - :type project_id: str - :param cluster_name: (required) - :type cluster_name: 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 docstring might be too long - - _param = self._get_cluster_serialize( - project_id=project_id, - cluster_name=cluster_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "Cluster", - } - 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 get_cluster_without_preload_content( - self, - project_id: StrictStr, - cluster_name: StrictStr, - _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: - """Get a cluster - - Get Kubernetes cluster for the specified identifier, belonging to the project specified by `projectId`. - - :param project_id: (required) - :type project_id: str - :param cluster_name: (required) - :type cluster_name: 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 docstring might be too long - - _param = self._get_cluster_serialize( - project_id=project_id, - cluster_name=cluster_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "Cluster", - } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) - return response_data.response - - def _get_cluster_serialize( - self, - project_id, - cluster_name, - _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]] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if project_id is not None: - _path_params["projectId"] = project_id - if cluster_name is not None: - _path_params["clusterName"] = cluster_name - # process the query parameters - # 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="/v1/projects/{projectId}/clusters/{clusterName}", - 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 get_credentials( + def get_cluster( self, project_id: StrictStr, cluster_name: StrictStr, @@ -1800,10 +1089,10 @@ def get_credentials( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> Credentials: - """(Deprecated) Get credentials for a cluster + ) -> Cluster: + """Get a cluster - This endpoint is deprecated since 2024-01-26. It will not work for clusters with Kubernetes v1.27+, or if the new endpoints for kubeconfig or credentials rotation have already been used. Use [kubeconfig](#tag/Credentials/operation/SkeService_CreateKubeconfig) instead to obtain a kubeconfig. For more information, see [How to rotate SKE credentials](https://docs.stackit.cloud/display/STACKIT/How+to+rotate+SKE+credentials). Get credentials for the cluster specified by `clusterName`, belonging to the project specified by `projectId`. + Get Kubernetes cluster for the specified identifier, belonging to the project specified by `projectId`. :param project_id: (required) :type project_id: str @@ -1830,11 +1119,8 @@ def get_credentials( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 docstring might be too long - warnings.warn( - "GET /v1/projects/{projectId}/clusters/{clusterName}/credentials is deprecated.", DeprecationWarning - ) - _param = self._get_credentials_serialize( + _param = self._get_cluster_serialize( project_id=project_id, cluster_name=cluster_name, _request_auth=_request_auth, @@ -1844,9 +1130,7 @@ def get_credentials( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "Credentials", - "400": "object", - "404": "object", + "200": "Cluster", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -1856,7 +1140,7 @@ def get_credentials( ).data @validate_call - def get_credentials_with_http_info( + def get_cluster_with_http_info( self, project_id: StrictStr, cluster_name: StrictStr, @@ -1869,10 +1153,10 @@ def get_credentials_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Credentials]: - """(Deprecated) Get credentials for a cluster + ) -> ApiResponse[Cluster]: + """Get a cluster - This endpoint is deprecated since 2024-01-26. It will not work for clusters with Kubernetes v1.27+, or if the new endpoints for kubeconfig or credentials rotation have already been used. Use [kubeconfig](#tag/Credentials/operation/SkeService_CreateKubeconfig) instead to obtain a kubeconfig. For more information, see [How to rotate SKE credentials](https://docs.stackit.cloud/display/STACKIT/How+to+rotate+SKE+credentials). Get credentials for the cluster specified by `clusterName`, belonging to the project specified by `projectId`. + Get Kubernetes cluster for the specified identifier, belonging to the project specified by `projectId`. :param project_id: (required) :type project_id: str @@ -1899,11 +1183,8 @@ def get_credentials_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 docstring might be too long - warnings.warn( - "GET /v1/projects/{projectId}/clusters/{clusterName}/credentials is deprecated.", DeprecationWarning - ) - _param = self._get_credentials_serialize( + _param = self._get_cluster_serialize( project_id=project_id, cluster_name=cluster_name, _request_auth=_request_auth, @@ -1913,9 +1194,7 @@ def get_credentials_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "Credentials", - "400": "object", - "404": "object", + "200": "Cluster", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -1925,7 +1204,7 @@ def get_credentials_with_http_info( ) @validate_call - def get_credentials_without_preload_content( + def get_cluster_without_preload_content( self, project_id: StrictStr, cluster_name: StrictStr, @@ -1939,9 +1218,9 @@ def get_credentials_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """(Deprecated) Get credentials for a cluster + """Get a cluster - This endpoint is deprecated since 2024-01-26. It will not work for clusters with Kubernetes v1.27+, or if the new endpoints for kubeconfig or credentials rotation have already been used. Use [kubeconfig](#tag/Credentials/operation/SkeService_CreateKubeconfig) instead to obtain a kubeconfig. For more information, see [How to rotate SKE credentials](https://docs.stackit.cloud/display/STACKIT/How+to+rotate+SKE+credentials). Get credentials for the cluster specified by `clusterName`, belonging to the project specified by `projectId`. + Get Kubernetes cluster for the specified identifier, belonging to the project specified by `projectId`. :param project_id: (required) :type project_id: str @@ -1968,11 +1247,8 @@ def get_credentials_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 docstring might be too long - warnings.warn( - "GET /v1/projects/{projectId}/clusters/{clusterName}/credentials is deprecated.", DeprecationWarning - ) - _param = self._get_credentials_serialize( + _param = self._get_cluster_serialize( project_id=project_id, cluster_name=cluster_name, _request_auth=_request_auth, @@ -1982,14 +1258,12 @@ def get_credentials_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "Credentials", - "400": "object", - "404": "object", + "200": "Cluster", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _get_credentials_serialize( + def _get_cluster_serialize( self, project_id, cluster_name, @@ -2029,7 +1303,7 @@ def _get_credentials_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1/projects/{projectId}/clusters/{clusterName}/credentials", + resource_path="/v1/projects/{projectId}/clusters/{clusterName}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2128,243 +1402,7 @@ def get_login_kubeconfig_with_http_info( :param project_id: (required) :type project_id: str :param cluster_name: (required) - :type cluster_name: 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 docstring might be too long - - _param = self._get_login_kubeconfig_serialize( - project_id=project_id, - cluster_name=cluster_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "LoginKubeconfig", - } - 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 get_login_kubeconfig_without_preload_content( - self, - project_id: StrictStr, - cluster_name: StrictStr, - _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: - """Get a kubeconfig for use with the STACKIT CLI - - A kubeconfig retrieved using this endpoint does not contain any credentials and instead obtains valid credentials via the STACKIT CLI. - - :param project_id: (required) - :type project_id: str - :param cluster_name: (required) - :type cluster_name: 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 docstring might be too long - - _param = self._get_login_kubeconfig_serialize( - project_id=project_id, - cluster_name=cluster_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "LoginKubeconfig", - } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) - return response_data.response - - def _get_login_kubeconfig_serialize( - self, - project_id, - cluster_name, - _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]] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if project_id is not None: - _path_params["projectId"] = project_id - if cluster_name is not None: - _path_params["clusterName"] = cluster_name - # process the query parameters - # 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="/v1/projects/{projectId}/clusters/{clusterName}/kubeconfig/login", - 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 get_service_status( - self, - project_id: StrictStr, - _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, - ) -> ProjectResponse: - """(Deprecated) Get a Project - - This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. Get a Project specified by `projectId`. - - :param project_id: (required) - :type project_id: 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 docstring might be too long - warnings.warn("GET /v1/projects/{projectId} is deprecated.", DeprecationWarning) - - _param = self._get_service_status_serialize( - project_id=project_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "ProjectResponse", - "404": "object", - } - 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 get_service_status_with_http_info( - self, - project_id: StrictStr, - _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[ProjectResponse]: - """(Deprecated) Get a Project - - This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. Get a Project specified by `projectId`. - - :param project_id: (required) - :type project_id: str + :type cluster_name: 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 @@ -2386,10 +1424,10 @@ def get_service_status_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 docstring might be too long - warnings.warn("GET /v1/projects/{projectId} is deprecated.", DeprecationWarning) - _param = self._get_service_status_serialize( + _param = self._get_login_kubeconfig_serialize( project_id=project_id, + cluster_name=cluster_name, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2397,8 +1435,7 @@ def get_service_status_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ProjectResponse", - "404": "object", + "200": "LoginKubeconfig", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -2408,9 +1445,10 @@ def get_service_status_with_http_info( ) @validate_call - def get_service_status_without_preload_content( + def get_login_kubeconfig_without_preload_content( self, project_id: StrictStr, + cluster_name: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2421,12 +1459,14 @@ def get_service_status_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """(Deprecated) Get a Project + """Get a kubeconfig for use with the STACKIT CLI - This endpoint is deprecated since 2024-04-11. Use the service-enablement API instead. Get a Project specified by `projectId`. + A kubeconfig retrieved using this endpoint does not contain any credentials and instead obtains valid credentials via the STACKIT CLI. :param project_id: (required) :type project_id: str + :param cluster_name: (required) + :type cluster_name: 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 @@ -2448,10 +1488,10 @@ def get_service_status_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 docstring might be too long - warnings.warn("GET /v1/projects/{projectId} is deprecated.", DeprecationWarning) - _param = self._get_service_status_serialize( + _param = self._get_login_kubeconfig_serialize( project_id=project_id, + cluster_name=cluster_name, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2459,15 +1499,15 @@ def get_service_status_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ProjectResponse", - "404": "object", + "200": "LoginKubeconfig", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _get_service_status_serialize( + def _get_login_kubeconfig_serialize( self, project_id, + cluster_name, _request_auth, _content_type, _headers, @@ -2488,6 +1528,8 @@ def _get_service_status_serialize( # process the path parameters if project_id is not None: _path_params["projectId"] = project_id + if cluster_name is not None: + _path_params["clusterName"] = cluster_name # process the query parameters # process the header parameters # process the form parameters @@ -2502,7 +1544,7 @@ def _get_service_status_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1/projects/{projectId}", + resource_path="/v1/projects/{projectId}/clusters/{clusterName}/kubeconfig/login", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3939,259 +2981,3 @@ def _trigger_reconcile_serialize( _host=_host, _request_auth=_request_auth, ) - - @validate_call - def trigger_rotate_credentials( - self, - project_id: StrictStr, - cluster_name: StrictStr, - _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, - ) -> object: - """(Deprecated) Rotate cluster credentials - - This endpoint is deprecated since 2024-01-26. It will not work for clusters with Kubernetes v1.27+, or if the new endpoints for kubeconfig or credentials rotation have already been used. Use [start-credentials-rotation](#tag/Credentials/operation/SkeService_StartClusterCredentialsRotation) instead to rotate all cluster credentials. For more information, see [How to rotate SKE credentials](https://docs.stackit.cloud/display/STACKIT/How+to+rotate+SKE+credentials). Trigger credential rotation. The old credentials (kubeconfig) will be invalid after the operation. - - :param project_id: (required) - :type project_id: str - :param cluster_name: (required) - :type cluster_name: 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 docstring might be too long - warnings.warn( - "POST /v1/projects/{projectId}/clusters/{clusterName}/rotate-credentials is deprecated.", DeprecationWarning - ) - - _param = self._trigger_rotate_credentials_serialize( - project_id=project_id, - cluster_name=cluster_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "object", - "202": "object", - "404": "object", - } - 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 trigger_rotate_credentials_with_http_info( - self, - project_id: StrictStr, - cluster_name: StrictStr, - _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[object]: - """(Deprecated) Rotate cluster credentials - - This endpoint is deprecated since 2024-01-26. It will not work for clusters with Kubernetes v1.27+, or if the new endpoints for kubeconfig or credentials rotation have already been used. Use [start-credentials-rotation](#tag/Credentials/operation/SkeService_StartClusterCredentialsRotation) instead to rotate all cluster credentials. For more information, see [How to rotate SKE credentials](https://docs.stackit.cloud/display/STACKIT/How+to+rotate+SKE+credentials). Trigger credential rotation. The old credentials (kubeconfig) will be invalid after the operation. - - :param project_id: (required) - :type project_id: str - :param cluster_name: (required) - :type cluster_name: 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 docstring might be too long - warnings.warn( - "POST /v1/projects/{projectId}/clusters/{clusterName}/rotate-credentials is deprecated.", DeprecationWarning - ) - - _param = self._trigger_rotate_credentials_serialize( - project_id=project_id, - cluster_name=cluster_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "object", - "202": "object", - "404": "object", - } - 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 trigger_rotate_credentials_without_preload_content( - self, - project_id: StrictStr, - cluster_name: StrictStr, - _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: - """(Deprecated) Rotate cluster credentials - - This endpoint is deprecated since 2024-01-26. It will not work for clusters with Kubernetes v1.27+, or if the new endpoints for kubeconfig or credentials rotation have already been used. Use [start-credentials-rotation](#tag/Credentials/operation/SkeService_StartClusterCredentialsRotation) instead to rotate all cluster credentials. For more information, see [How to rotate SKE credentials](https://docs.stackit.cloud/display/STACKIT/How+to+rotate+SKE+credentials). Trigger credential rotation. The old credentials (kubeconfig) will be invalid after the operation. - - :param project_id: (required) - :type project_id: str - :param cluster_name: (required) - :type cluster_name: 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 docstring might be too long - warnings.warn( - "POST /v1/projects/{projectId}/clusters/{clusterName}/rotate-credentials is deprecated.", DeprecationWarning - ) - - _param = self._trigger_rotate_credentials_serialize( - project_id=project_id, - cluster_name=cluster_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "object", - "202": "object", - "404": "object", - } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) - return response_data.response - - def _trigger_rotate_credentials_serialize( - self, - project_id, - cluster_name, - _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]] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if project_id is not None: - _path_params["projectId"] = project_id - if cluster_name is not None: - _path_params["clusterName"] = cluster_name - # process the query parameters - # 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="POST", - resource_path="/v1/projects/{projectId}/clusters/{clusterName}/rotate-credentials", - 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, - ) diff --git a/services/ske/src/stackit/ske/models/__init__.py b/services/ske/src/stackit/ske/models/__init__.py index 868b18ef..2844c2d1 100644 --- a/services/ske/src/stackit/ske/models/__init__.py +++ b/services/ske/src/stackit/ske/models/__init__.py @@ -24,7 +24,6 @@ from stackit.ske.models.create_or_update_cluster_payload import ( CreateOrUpdateClusterPayload, ) -from stackit.ske.models.credentials import Credentials from stackit.ske.models.credentials_rotation_state import CredentialsRotationState from stackit.ske.models.cri import CRI from stackit.ske.models.dns import DNS @@ -45,8 +44,6 @@ from stackit.ske.models.maintenance_auto_update import MaintenanceAutoUpdate from stackit.ske.models.network import Network from stackit.ske.models.nodepool import Nodepool -from stackit.ske.models.project_response import ProjectResponse -from stackit.ske.models.project_state import ProjectState from stackit.ske.models.provider_options import ProviderOptions from stackit.ske.models.runtime_error import RuntimeError from stackit.ske.models.taint import Taint diff --git a/services/ske/src/stackit/ske/models/cluster_status.py b/services/ske/src/stackit/ske/models/cluster_status.py index 5c1cc4af..b9eed0e8 100644 --- a/services/ske/src/stackit/ske/models/cluster_status.py +++ b/services/ske/src/stackit/ske/models/cluster_status.py @@ -15,6 +15,7 @@ import json import pprint +from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr @@ -31,13 +32,25 @@ class ClusterStatus(BaseModel): """ aggregated: Optional[ClusterStatusState] = ClusterStatusState.STATE_UNSPECIFIED - creation_time: Optional[StrictStr] = Field( + creation_time: Optional[datetime] = Field( default=None, description="Format: `2024-02-15T11:06:29Z`", alias="creationTime" ) credentials_rotation: Optional[CredentialsRotationState] = Field(default=None, alias="credentialsRotation") + egress_address_ranges: Optional[List[StrictStr]] = Field( + default=None, + description="The outgoing network ranges (in CIDR notation) of traffic originating from workload on the cluster.", + alias="egressAddressRanges", + ) error: Optional[RuntimeError] = None hibernated: Optional[StrictBool] = None - __properties: ClassVar[List[str]] = ["aggregated", "creationTime", "credentialsRotation", "error", "hibernated"] + __properties: ClassVar[List[str]] = [ + "aggregated", + "creationTime", + "credentialsRotation", + "egressAddressRanges", + "error", + "hibernated", + ] model_config = ConfigDict( populate_by_name=True, @@ -104,6 +117,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if obj.get("credentialsRotation") is not None else None ), + "egressAddressRanges": obj.get("egressAddressRanges"), "error": RuntimeError.from_dict(obj["error"]) if obj.get("error") is not None else None, "hibernated": obj.get("hibernated"), } diff --git a/services/ske/src/stackit/ske/models/credentials.py b/services/ske/src/stackit/ske/models/credentials.py deleted file mode 100644 index abe81c0c..00000000 --- a/services/ske/src/stackit/ske/models/credentials.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding: utf-8 - -""" - SKE-API - - The SKE API provides endpoints to create, update, delete clusters within STACKIT portal projects and to trigger further cluster management tasks. - - The version of the OpenAPI document: 1.1 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 docstring might be too long - -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 Credentials(BaseModel): - """ - Credentials - """ - - certificate_authority_data: Optional[StrictStr] = Field(default=None, alias="certificateAuthorityData") - kubeconfig: Optional[StrictStr] = Field(default=None, description="This string contains the kubeconfig as yaml.") - server: Optional[StrictStr] = None - token: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["certificateAuthorityData", "kubeconfig", "server", "token"] - - 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 Credentials 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 Credentials from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "certificateAuthorityData": obj.get("certificateAuthorityData"), - "kubeconfig": obj.get("kubeconfig"), - "server": obj.get("server"), - "token": obj.get("token"), - } - ) - return _obj diff --git a/services/ske/src/stackit/ske/models/credentials_rotation_state.py b/services/ske/src/stackit/ske/models/credentials_rotation_state.py index f447bce2..31369153 100644 --- a/services/ske/src/stackit/ske/models/credentials_rotation_state.py +++ b/services/ske/src/stackit/ske/models/credentials_rotation_state.py @@ -15,6 +15,7 @@ import json import pprint +from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator @@ -26,15 +27,15 @@ class CredentialsRotationState(BaseModel): CredentialsRotationState """ - last_completion_time: Optional[StrictStr] = Field( + last_completion_time: Optional[datetime] = Field( default=None, description="Format: `2024-02-15T11:06:29Z`", alias="lastCompletionTime" ) - last_initiation_time: Optional[StrictStr] = Field( + last_initiation_time: Optional[datetime] = Field( default=None, description="Format: `2024-02-15T11:06:29Z`", alias="lastInitiationTime" ) phase: Optional[StrictStr] = Field( default=None, - description="Phase of the credentials rotation. `NEVER` indicates that no credentials rotation has been performed using the new credentials rotation endpoints yet. Using the deprecated [rotate-credentials](#tag/Credentials/operation/SkeService_GetClusterCredentials) endpoint will not update this status field.", + description="Phase of the credentials rotation. `NEVER` indicates that no credentials rotation has been performed using the new credentials rotation endpoints yet.", ) __properties: ClassVar[List[str]] = ["lastCompletionTime", "lastInitiationTime", "phase"] diff --git a/services/ske/src/stackit/ske/models/hibernation_schedule.py b/services/ske/src/stackit/ske/models/hibernation_schedule.py index 4b2c6815..61634af8 100644 --- a/services/ske/src/stackit/ske/models/hibernation_schedule.py +++ b/services/ske/src/stackit/ske/models/hibernation_schedule.py @@ -36,11 +36,11 @@ class HibernationSchedule(BaseModel): def end_validate_regular_expression(cls, value): """Validates the regular expression""" if not re.match( - r"(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})", + r"(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\\d+(ns|us|µs|ms|s|m|h))+)|((((\\d+,)+\\d+|(\\d+(\\/|-)\\d+)|\\d+|\\*) ?){5,7})", value, ): raise ValueError( - r"must validate the regular expression /(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})/" + r"must validate the regular expression /(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\\d+(ns|us|µs|ms|s|m|h))+)|((((\\d+,)+\\d+|(\\d+(\\/|-)\\d+)|\\d+|\\*) ?){5,7})/" ) return value @@ -48,11 +48,11 @@ def end_validate_regular_expression(cls, value): def start_validate_regular_expression(cls, value): """Validates the regular expression""" if not re.match( - r"(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})", + r"(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\\d+(ns|us|µs|ms|s|m|h))+)|((((\\d+,)+\\d+|(\\d+(\\/|-)\\d+)|\\d+|\\*) ?){5,7})", value, ): raise ValueError( - r"must validate the regular expression /(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})/" + r"must validate the regular expression /(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\\d+(ns|us|µs|ms|s|m|h))+)|((((\\d+,)+\\d+|(\\d+(\\/|-)\\d+)|\\d+|\\*) ?){5,7})/" ) return value diff --git a/services/ske/src/stackit/ske/models/kubeconfig.py b/services/ske/src/stackit/ske/models/kubeconfig.py index 5ccd58af..e4595746 100644 --- a/services/ske/src/stackit/ske/models/kubeconfig.py +++ b/services/ske/src/stackit/ske/models/kubeconfig.py @@ -15,6 +15,7 @@ import json import pprint +from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr @@ -26,7 +27,7 @@ class Kubeconfig(BaseModel): Kubeconfig """ - expiration_timestamp: Optional[StrictStr] = Field(default=None, alias="expirationTimestamp") + expiration_timestamp: Optional[datetime] = Field(default=None, alias="expirationTimestamp") kubeconfig: Optional[StrictStr] = None __properties: ClassVar[List[str]] = ["expirationTimestamp", "kubeconfig"] diff --git a/services/ske/src/stackit/ske/models/kubernetes_version.py b/services/ske/src/stackit/ske/models/kubernetes_version.py index 3a81d233..516fdfe0 100644 --- a/services/ske/src/stackit/ske/models/kubernetes_version.py +++ b/services/ske/src/stackit/ske/models/kubernetes_version.py @@ -16,6 +16,7 @@ import json import pprint import re +from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator @@ -27,7 +28,7 @@ class KubernetesVersion(BaseModel): KubernetesVersion """ - expiration_date: Optional[StrictStr] = Field(default=None, alias="expirationDate") + expiration_date: Optional[datetime] = Field(default=None, alias="expirationDate") feature_gates: Optional[Dict[str, StrictStr]] = Field(default=None, alias="featureGates") state: Optional[StrictStr] = None version: Optional[Annotated[str, Field(strict=True)]] = None diff --git a/services/ske/src/stackit/ske/models/machine_image_version.py b/services/ske/src/stackit/ske/models/machine_image_version.py index 3813cf30..641e8404 100644 --- a/services/ske/src/stackit/ske/models/machine_image_version.py +++ b/services/ske/src/stackit/ske/models/machine_image_version.py @@ -16,6 +16,7 @@ import json import pprint import re +from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator @@ -30,7 +31,7 @@ class MachineImageVersion(BaseModel): """ cri: Optional[List[CRI]] = None - expiration_date: Optional[StrictStr] = Field(default=None, alias="expirationDate") + expiration_date: Optional[datetime] = Field(default=None, alias="expirationDate") state: Optional[StrictStr] = None version: Optional[Annotated[str, Field(strict=True)]] = None __properties: ClassVar[List[str]] = ["cri", "expirationDate", "state", "version"] diff --git a/services/ske/src/stackit/ske/models/project_response.py b/services/ske/src/stackit/ske/models/project_response.py deleted file mode 100644 index 7549d3da..00000000 --- a/services/ske/src/stackit/ske/models/project_response.py +++ /dev/null @@ -1,89 +0,0 @@ -# coding: utf-8 - -""" - SKE-API - - The SKE API provides endpoints to create, update, delete clusters within STACKIT portal projects and to trigger further cluster management tasks. - - The version of the OpenAPI document: 1.1 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 docstring might be too long - -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 - -from stackit.ske.models.project_state import ProjectState - - -class ProjectResponse(BaseModel): - """ - ProjectResponse - """ - - project_id: Optional[StrictStr] = Field(default=None, alias="projectId") - state: Optional[ProjectState] = ProjectState.STATE_UNSPECIFIED - __properties: ClassVar[List[str]] = ["projectId", "state"] - - 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 ProjectResponse 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 ProjectResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "projectId": obj.get("projectId"), - "state": obj.get("state") if obj.get("state") is not None else ProjectState.STATE_UNSPECIFIED, - } - ) - return _obj diff --git a/services/ske/src/stackit/ske/models/project_state.py b/services/ske/src/stackit/ske/models/project_state.py deleted file mode 100644 index a758e6f0..00000000 --- a/services/ske/src/stackit/ske/models/project_state.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding: utf-8 - -""" - SKE-API - - The SKE API provides endpoints to create, update, delete clusters within STACKIT portal projects and to trigger further cluster management tasks. - - The version of the OpenAPI document: 1.1 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 docstring might be too long - -from __future__ import annotations - -import json -from enum import Enum - -from typing_extensions import Self - - -class ProjectState(str, Enum): - """ - ProjectState - """ - - """ - allowed enum values - """ - STATE_UNSPECIFIED = "STATE_UNSPECIFIED" - STATE_CREATING = "STATE_CREATING" - STATE_CREATED = "STATE_CREATED" - STATE_DELETING = "STATE_DELETING" - STATE_FAILED = "STATE_FAILED" - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of ProjectState from a JSON string""" - return cls(json.loads(json_str)) diff --git a/services/ske/src/stackit/ske/models/time_window.py b/services/ske/src/stackit/ske/models/time_window.py index 9c1de685..0bbdbe72 100644 --- a/services/ske/src/stackit/ske/models/time_window.py +++ b/services/ske/src/stackit/ske/models/time_window.py @@ -15,9 +15,10 @@ import json import pprint +from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict from typing_extensions import Self @@ -26,8 +27,8 @@ class TimeWindow(BaseModel): TimeWindow """ - end: StrictStr - start: StrictStr + end: datetime + start: datetime __properties: ClassVar[List[str]] = ["end", "start"] model_config = ConfigDict( From 750fd5f3c814da25e2ee5c5e94136a4eabe2b337 Mon Sep 17 00:00:00 2001 From: Alexander Dahmen Date: Thu, 6 Feb 2025 12:17:21 +0100 Subject: [PATCH 2/2] Add changelog Signed-off-by: Alexander Dahmen --- CHANGELOG.md | 5 +++++ services/ske/CHANGELOG.md | 7 +++++++ services/ske/pyproject.toml | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d807b17..6a8efc95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## Release (2025-XX-XX) +- `ske`: [v0.3.0](services/ske/CHANGELOG.md#v030-2025-02-06) + - **Removal:** The following methods were removed after deprecation (2024-04-16) and [`serviceenablement` SDK](https://github.com/stackitcloud/stackit-sdk-python/tree/main/services/serviceenablement) must be used instead. + - `DisableService` + - `EnableService` + - `GetServiceStatus` - `logme`: [v0.3.0](services/logme/CHANGELOG.md#v030-2025-02-05) - **Breaking Change:** Remove mistakenly implemented `syslog-use-udp`. Does not exist. - `serverupdate`: [v0.3.0](services/serverupdate/CHANGELOG.md#v030-2025-02-06) diff --git a/services/ske/CHANGELOG.md b/services/ske/CHANGELOG.md index 064df343..638cc8d9 100644 --- a/services/ske/CHANGELOG.md +++ b/services/ske/CHANGELOG.md @@ -1,3 +1,10 @@ +## v0.3.0 (2025-02-06) + +- **Removal:** The following methods were removed after deprecation (2024-04-16) and [`serviceenablement` SDK](https://github.com/stackitcloud/stackit-sdk-python/tree/main/services/serviceenablement) must be used instead. + - `DisableService` + - `EnableService` + - `GetServiceStatus` + ## v0.2.0 (2025-01-13) - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. diff --git a/services/ske/pyproject.toml b/services/ske/pyproject.toml index 64d413bb..871ec5e0 100644 --- a/services/ske/pyproject.toml +++ b/services/ske/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-ske" [tool.poetry] name = "stackit-ske" -version = "v0.2.0" +version = "v0.3.0" authors = [ "STACKIT Developer Tools ", ]