Skip to content

Commit 4cf0976

Browse files
Generate serverupdate
1 parent 0f573e1 commit 4cf0976

File tree

4 files changed

+338
-0
lines changed

4 files changed

+338
-0
lines changed

services/serverupdate/src/stackit/serverupdate/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
from stackit.serverupdate.models.get_update_schedules_response import (
5050
GetUpdateSchedulesResponse,
5151
)
52+
from stackit.serverupdate.models.get_update_service_response import (
53+
GetUpdateServiceResponse,
54+
)
5255
from stackit.serverupdate.models.get_updates_list_response import GetUpdatesListResponse
5356
from stackit.serverupdate.models.update import Update
5457
from stackit.serverupdate.models.update_policy import UpdatePolicy

services/serverupdate/src/stackit/serverupdate/api/default_api.py

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
from stackit.serverupdate.models.get_update_schedules_response import (
3636
GetUpdateSchedulesResponse,
3737
)
38+
from stackit.serverupdate.models.get_update_service_response import (
39+
GetUpdateServiceResponse,
40+
)
3841
from stackit.serverupdate.models.get_updates_list_response import GetUpdatesListResponse
3942
from stackit.serverupdate.models.update import Update
4043
from stackit.serverupdate.models.update_schedule import UpdateSchedule
@@ -1879,6 +1882,253 @@ def _enable_service_resource_serialize(
18791882
_request_auth=_request_auth,
18801883
)
18811884

1885+
@validate_call
1886+
def get_service_resource(
1887+
self,
1888+
project_id: Annotated[StrictStr, Field(description="project id")],
1889+
server_id: Annotated[StrictStr, Field(description="server id")],
1890+
_request_timeout: Union[
1891+
None,
1892+
Annotated[StrictFloat, Field(gt=0)],
1893+
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1894+
] = None,
1895+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
1896+
_content_type: Optional[StrictStr] = None,
1897+
_headers: Optional[Dict[StrictStr, Any]] = None,
1898+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1899+
) -> GetUpdateServiceResponse:
1900+
"""get update service details
1901+
1902+
1903+
:param project_id: project id (required)
1904+
:type project_id: str
1905+
:param server_id: server id (required)
1906+
:type server_id: str
1907+
:param _request_timeout: timeout setting for this request. If one
1908+
number provided, it will be total request
1909+
timeout. It can also be a pair (tuple) of
1910+
(connection, read) timeouts.
1911+
:type _request_timeout: int, tuple(int, int), optional
1912+
:param _request_auth: set to override the auth_settings for an a single
1913+
request; this effectively ignores the
1914+
authentication in the spec for a single request.
1915+
:type _request_auth: dict, optional
1916+
:param _content_type: force content-type for the request.
1917+
:type _content_type: str, Optional
1918+
:param _headers: set to override the headers for a single
1919+
request; this effectively ignores the headers
1920+
in the spec for a single request.
1921+
:type _headers: dict, optional
1922+
:param _host_index: set to override the host_index for a single
1923+
request; this effectively ignores the host_index
1924+
in the spec for a single request.
1925+
:type _host_index: int, optional
1926+
:return: Returns the result object.
1927+
""" # noqa: E501 docstring might be too long
1928+
1929+
_param = self._get_service_resource_serialize(
1930+
project_id=project_id,
1931+
server_id=server_id,
1932+
_request_auth=_request_auth,
1933+
_content_type=_content_type,
1934+
_headers=_headers,
1935+
_host_index=_host_index,
1936+
)
1937+
1938+
_response_types_map: Dict[str, Optional[str]] = {
1939+
"200": "GetUpdateServiceResponse",
1940+
"400": None,
1941+
"401": None,
1942+
"404": None,
1943+
}
1944+
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1945+
response_data.read()
1946+
return self.api_client.response_deserialize(
1947+
response_data=response_data,
1948+
response_types_map=_response_types_map,
1949+
).data
1950+
1951+
@validate_call
1952+
def get_service_resource_with_http_info(
1953+
self,
1954+
project_id: Annotated[StrictStr, Field(description="project id")],
1955+
server_id: Annotated[StrictStr, Field(description="server id")],
1956+
_request_timeout: Union[
1957+
None,
1958+
Annotated[StrictFloat, Field(gt=0)],
1959+
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1960+
] = None,
1961+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
1962+
_content_type: Optional[StrictStr] = None,
1963+
_headers: Optional[Dict[StrictStr, Any]] = None,
1964+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1965+
) -> ApiResponse[GetUpdateServiceResponse]:
1966+
"""get update service details
1967+
1968+
1969+
:param project_id: project id (required)
1970+
:type project_id: str
1971+
:param server_id: server id (required)
1972+
:type server_id: str
1973+
:param _request_timeout: timeout setting for this request. If one
1974+
number provided, it will be total request
1975+
timeout. It can also be a pair (tuple) of
1976+
(connection, read) timeouts.
1977+
:type _request_timeout: int, tuple(int, int), optional
1978+
:param _request_auth: set to override the auth_settings for an a single
1979+
request; this effectively ignores the
1980+
authentication in the spec for a single request.
1981+
:type _request_auth: dict, optional
1982+
:param _content_type: force content-type for the request.
1983+
:type _content_type: str, Optional
1984+
:param _headers: set to override the headers for a single
1985+
request; this effectively ignores the headers
1986+
in the spec for a single request.
1987+
:type _headers: dict, optional
1988+
:param _host_index: set to override the host_index for a single
1989+
request; this effectively ignores the host_index
1990+
in the spec for a single request.
1991+
:type _host_index: int, optional
1992+
:return: Returns the result object.
1993+
""" # noqa: E501 docstring might be too long
1994+
1995+
_param = self._get_service_resource_serialize(
1996+
project_id=project_id,
1997+
server_id=server_id,
1998+
_request_auth=_request_auth,
1999+
_content_type=_content_type,
2000+
_headers=_headers,
2001+
_host_index=_host_index,
2002+
)
2003+
2004+
_response_types_map: Dict[str, Optional[str]] = {
2005+
"200": "GetUpdateServiceResponse",
2006+
"400": None,
2007+
"401": None,
2008+
"404": None,
2009+
}
2010+
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2011+
response_data.read()
2012+
return self.api_client.response_deserialize(
2013+
response_data=response_data,
2014+
response_types_map=_response_types_map,
2015+
)
2016+
2017+
@validate_call
2018+
def get_service_resource_without_preload_content(
2019+
self,
2020+
project_id: Annotated[StrictStr, Field(description="project id")],
2021+
server_id: Annotated[StrictStr, Field(description="server id")],
2022+
_request_timeout: Union[
2023+
None,
2024+
Annotated[StrictFloat, Field(gt=0)],
2025+
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2026+
] = None,
2027+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
2028+
_content_type: Optional[StrictStr] = None,
2029+
_headers: Optional[Dict[StrictStr, Any]] = None,
2030+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2031+
) -> RESTResponseType:
2032+
"""get update service details
2033+
2034+
2035+
:param project_id: project id (required)
2036+
:type project_id: str
2037+
:param server_id: server id (required)
2038+
:type server_id: str
2039+
:param _request_timeout: timeout setting for this request. If one
2040+
number provided, it will be total request
2041+
timeout. It can also be a pair (tuple) of
2042+
(connection, read) timeouts.
2043+
:type _request_timeout: int, tuple(int, int), optional
2044+
:param _request_auth: set to override the auth_settings for an a single
2045+
request; this effectively ignores the
2046+
authentication in the spec for a single request.
2047+
:type _request_auth: dict, optional
2048+
:param _content_type: force content-type for the request.
2049+
:type _content_type: str, Optional
2050+
:param _headers: set to override the headers for a single
2051+
request; this effectively ignores the headers
2052+
in the spec for a single request.
2053+
:type _headers: dict, optional
2054+
:param _host_index: set to override the host_index for a single
2055+
request; this effectively ignores the host_index
2056+
in the spec for a single request.
2057+
:type _host_index: int, optional
2058+
:return: Returns the result object.
2059+
""" # noqa: E501 docstring might be too long
2060+
2061+
_param = self._get_service_resource_serialize(
2062+
project_id=project_id,
2063+
server_id=server_id,
2064+
_request_auth=_request_auth,
2065+
_content_type=_content_type,
2066+
_headers=_headers,
2067+
_host_index=_host_index,
2068+
)
2069+
2070+
_response_types_map: Dict[str, Optional[str]] = {
2071+
"200": "GetUpdateServiceResponse",
2072+
"400": None,
2073+
"401": None,
2074+
"404": None,
2075+
}
2076+
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2077+
return response_data.response
2078+
2079+
def _get_service_resource_serialize(
2080+
self,
2081+
project_id,
2082+
server_id,
2083+
_request_auth,
2084+
_content_type,
2085+
_headers,
2086+
_host_index,
2087+
) -> RequestSerialized:
2088+
2089+
_host = None
2090+
2091+
_collection_formats: Dict[str, str] = {}
2092+
2093+
_path_params: Dict[str, str] = {}
2094+
_query_params: List[Tuple[str, str]] = []
2095+
_header_params: Dict[str, Optional[str]] = _headers or {}
2096+
_form_params: List[Tuple[str, str]] = []
2097+
_files: Dict[str, Union[str, bytes]] = {}
2098+
_body_params: Optional[bytes] = None
2099+
2100+
# process the path parameters
2101+
if project_id is not None:
2102+
_path_params["projectId"] = project_id
2103+
if server_id is not None:
2104+
_path_params["serverId"] = server_id
2105+
# process the query parameters
2106+
# process the header parameters
2107+
# process the form parameters
2108+
# process the body parameter
2109+
2110+
# set the HTTP header `Accept`
2111+
if "Accept" not in _header_params:
2112+
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
2113+
2114+
# authentication setting
2115+
_auth_settings: List[str] = []
2116+
2117+
return self.api_client.param_serialize(
2118+
method="GET",
2119+
resource_path="/v1/projects/{projectId}/servers/{serverId}/service",
2120+
path_params=_path_params,
2121+
query_params=_query_params,
2122+
header_params=_header_params,
2123+
body=_body_params,
2124+
post_params=_form_params,
2125+
files=_files,
2126+
auth_settings=_auth_settings,
2127+
collection_formats=_collection_formats,
2128+
_host=_host,
2129+
_request_auth=_request_auth,
2130+
)
2131+
18822132
@validate_call
18832133
def get_update(
18842134
self,

services/serverupdate/src/stackit/serverupdate/models/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
from stackit.serverupdate.models.get_update_schedules_response import (
3131
GetUpdateSchedulesResponse,
3232
)
33+
from stackit.serverupdate.models.get_update_service_response import (
34+
GetUpdateServiceResponse,
35+
)
3336
from stackit.serverupdate.models.get_updates_list_response import GetUpdatesListResponse
3437
from stackit.serverupdate.models.update import Update
3538
from stackit.serverupdate.models.update_policy import UpdatePolicy
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# coding: utf-8
2+
3+
"""
4+
STACKIT Server Update Management API
5+
6+
API endpoints for Server Update Operations on STACKIT Servers.
7+
8+
The version of the OpenAPI document: 1.0
9+
Contact: support@stackit.de
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
14+
15+
from __future__ import annotations
16+
17+
import json
18+
import pprint
19+
from typing import Any, ClassVar, Dict, List, Optional, Set
20+
21+
from pydantic import BaseModel, ConfigDict, StrictBool
22+
from typing_extensions import Self
23+
24+
25+
class GetUpdateServiceResponse(BaseModel):
26+
"""
27+
GetUpdateServiceResponse
28+
"""
29+
30+
enabled: Optional[StrictBool] = None
31+
__properties: ClassVar[List[str]] = ["enabled"]
32+
33+
model_config = ConfigDict(
34+
populate_by_name=True,
35+
validate_assignment=True,
36+
protected_namespaces=(),
37+
)
38+
39+
def to_str(self) -> str:
40+
"""Returns the string representation of the model using alias"""
41+
return pprint.pformat(self.model_dump(by_alias=True))
42+
43+
def to_json(self) -> str:
44+
"""Returns the JSON representation of the model using alias"""
45+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46+
return json.dumps(self.to_dict())
47+
48+
@classmethod
49+
def from_json(cls, json_str: str) -> Optional[Self]:
50+
"""Create an instance of GetUpdateServiceResponse from a JSON string"""
51+
return cls.from_dict(json.loads(json_str))
52+
53+
def to_dict(self) -> Dict[str, Any]:
54+
"""Return the dictionary representation of the model using alias.
55+
56+
This has the following differences from calling pydantic's
57+
`self.model_dump(by_alias=True)`:
58+
59+
* `None` is only added to the output dict for nullable fields that
60+
were set at model initialization. Other fields with value `None`
61+
are ignored.
62+
"""
63+
excluded_fields: Set[str] = set([])
64+
65+
_dict = self.model_dump(
66+
by_alias=True,
67+
exclude=excluded_fields,
68+
exclude_none=True,
69+
)
70+
return _dict
71+
72+
@classmethod
73+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
74+
"""Create an instance of GetUpdateServiceResponse from a dict"""
75+
if obj is None:
76+
return None
77+
78+
if not isinstance(obj, dict):
79+
return cls.model_validate(obj)
80+
81+
_obj = cls.model_validate({"enabled": obj.get("enabled")})
82+
return _obj

0 commit comments

Comments
 (0)