Skip to content

Commit d13d295

Browse files
Generate serverupdate
1 parent f519deb commit d13d295

File tree

5 files changed

+443
-0
lines changed

5 files changed

+443
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,15 @@
4343
from stackit.serverupdate.models.enable_service_resource_payload import (
4444
EnableServiceResourcePayload,
4545
)
46+
from stackit.serverupdate.models.get_update_policies_response import (
47+
GetUpdatePoliciesResponse,
48+
)
4649
from stackit.serverupdate.models.get_update_schedules_response import (
4750
GetUpdateSchedulesResponse,
4851
)
4952
from stackit.serverupdate.models.get_updates_list_response import GetUpdatesListResponse
5053
from stackit.serverupdate.models.update import Update
54+
from stackit.serverupdate.models.update_policy import UpdatePolicy
5155
from stackit.serverupdate.models.update_schedule import UpdateSchedule
5256
from stackit.serverupdate.models.update_update_schedule_payload import (
5357
UpdateUpdateSchedulePayload,

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

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
from stackit.serverupdate.models.enable_service_resource_payload import (
3030
EnableServiceResourcePayload,
3131
)
32+
from stackit.serverupdate.models.get_update_policies_response import (
33+
GetUpdatePoliciesResponse,
34+
)
3235
from stackit.serverupdate.models.get_update_schedules_response import (
3336
GetUpdateSchedulesResponse,
3437
)
@@ -2420,6 +2423,235 @@ def _get_update_schedule_serialize(
24202423
_request_auth=_request_auth,
24212424
)
24222425

2426+
@validate_call
2427+
def list_update_policies(
2428+
self,
2429+
project_id: Annotated[StrictStr, Field(description="project id")],
2430+
_request_timeout: Union[
2431+
None,
2432+
Annotated[StrictFloat, Field(gt=0)],
2433+
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2434+
] = None,
2435+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
2436+
_content_type: Optional[StrictStr] = None,
2437+
_headers: Optional[Dict[StrictStr, Any]] = None,
2438+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2439+
) -> GetUpdatePoliciesResponse:
2440+
"""get list of update policies
2441+
2442+
2443+
:param project_id: project id (required)
2444+
:type project_id: str
2445+
:param _request_timeout: timeout setting for this request. If one
2446+
number provided, it will be total request
2447+
timeout. It can also be a pair (tuple) of
2448+
(connection, read) timeouts.
2449+
:type _request_timeout: int, tuple(int, int), optional
2450+
:param _request_auth: set to override the auth_settings for an a single
2451+
request; this effectively ignores the
2452+
authentication in the spec for a single request.
2453+
:type _request_auth: dict, optional
2454+
:param _content_type: force content-type for the request.
2455+
:type _content_type: str, Optional
2456+
:param _headers: set to override the headers for a single
2457+
request; this effectively ignores the headers
2458+
in the spec for a single request.
2459+
:type _headers: dict, optional
2460+
:param _host_index: set to override the host_index for a single
2461+
request; this effectively ignores the host_index
2462+
in the spec for a single request.
2463+
:type _host_index: int, optional
2464+
:return: Returns the result object.
2465+
""" # noqa: E501 docstring might be too long
2466+
2467+
_param = self._list_update_policies_serialize(
2468+
project_id=project_id,
2469+
_request_auth=_request_auth,
2470+
_content_type=_content_type,
2471+
_headers=_headers,
2472+
_host_index=_host_index,
2473+
)
2474+
2475+
_response_types_map: Dict[str, Optional[str]] = {
2476+
"200": "GetUpdatePoliciesResponse",
2477+
"400": None,
2478+
"404": None,
2479+
}
2480+
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2481+
response_data.read()
2482+
return self.api_client.response_deserialize(
2483+
response_data=response_data,
2484+
response_types_map=_response_types_map,
2485+
).data
2486+
2487+
@validate_call
2488+
def list_update_policies_with_http_info(
2489+
self,
2490+
project_id: Annotated[StrictStr, Field(description="project id")],
2491+
_request_timeout: Union[
2492+
None,
2493+
Annotated[StrictFloat, Field(gt=0)],
2494+
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2495+
] = None,
2496+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
2497+
_content_type: Optional[StrictStr] = None,
2498+
_headers: Optional[Dict[StrictStr, Any]] = None,
2499+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2500+
) -> ApiResponse[GetUpdatePoliciesResponse]:
2501+
"""get list of update policies
2502+
2503+
2504+
:param project_id: project id (required)
2505+
:type project_id: str
2506+
:param _request_timeout: timeout setting for this request. If one
2507+
number provided, it will be total request
2508+
timeout. It can also be a pair (tuple) of
2509+
(connection, read) timeouts.
2510+
:type _request_timeout: int, tuple(int, int), optional
2511+
:param _request_auth: set to override the auth_settings for an a single
2512+
request; this effectively ignores the
2513+
authentication in the spec for a single request.
2514+
:type _request_auth: dict, optional
2515+
:param _content_type: force content-type for the request.
2516+
:type _content_type: str, Optional
2517+
:param _headers: set to override the headers for a single
2518+
request; this effectively ignores the headers
2519+
in the spec for a single request.
2520+
:type _headers: dict, optional
2521+
:param _host_index: set to override the host_index for a single
2522+
request; this effectively ignores the host_index
2523+
in the spec for a single request.
2524+
:type _host_index: int, optional
2525+
:return: Returns the result object.
2526+
""" # noqa: E501 docstring might be too long
2527+
2528+
_param = self._list_update_policies_serialize(
2529+
project_id=project_id,
2530+
_request_auth=_request_auth,
2531+
_content_type=_content_type,
2532+
_headers=_headers,
2533+
_host_index=_host_index,
2534+
)
2535+
2536+
_response_types_map: Dict[str, Optional[str]] = {
2537+
"200": "GetUpdatePoliciesResponse",
2538+
"400": None,
2539+
"404": None,
2540+
}
2541+
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2542+
response_data.read()
2543+
return self.api_client.response_deserialize(
2544+
response_data=response_data,
2545+
response_types_map=_response_types_map,
2546+
)
2547+
2548+
@validate_call
2549+
def list_update_policies_without_preload_content(
2550+
self,
2551+
project_id: Annotated[StrictStr, Field(description="project id")],
2552+
_request_timeout: Union[
2553+
None,
2554+
Annotated[StrictFloat, Field(gt=0)],
2555+
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2556+
] = None,
2557+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
2558+
_content_type: Optional[StrictStr] = None,
2559+
_headers: Optional[Dict[StrictStr, Any]] = None,
2560+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2561+
) -> RESTResponseType:
2562+
"""get list of update policies
2563+
2564+
2565+
:param project_id: project id (required)
2566+
:type project_id: str
2567+
:param _request_timeout: timeout setting for this request. If one
2568+
number provided, it will be total request
2569+
timeout. It can also be a pair (tuple) of
2570+
(connection, read) timeouts.
2571+
:type _request_timeout: int, tuple(int, int), optional
2572+
:param _request_auth: set to override the auth_settings for an a single
2573+
request; this effectively ignores the
2574+
authentication in the spec for a single request.
2575+
:type _request_auth: dict, optional
2576+
:param _content_type: force content-type for the request.
2577+
:type _content_type: str, Optional
2578+
:param _headers: set to override the headers for a single
2579+
request; this effectively ignores the headers
2580+
in the spec for a single request.
2581+
:type _headers: dict, optional
2582+
:param _host_index: set to override the host_index for a single
2583+
request; this effectively ignores the host_index
2584+
in the spec for a single request.
2585+
:type _host_index: int, optional
2586+
:return: Returns the result object.
2587+
""" # noqa: E501 docstring might be too long
2588+
2589+
_param = self._list_update_policies_serialize(
2590+
project_id=project_id,
2591+
_request_auth=_request_auth,
2592+
_content_type=_content_type,
2593+
_headers=_headers,
2594+
_host_index=_host_index,
2595+
)
2596+
2597+
_response_types_map: Dict[str, Optional[str]] = {
2598+
"200": "GetUpdatePoliciesResponse",
2599+
"400": None,
2600+
"404": None,
2601+
}
2602+
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2603+
return response_data.response
2604+
2605+
def _list_update_policies_serialize(
2606+
self,
2607+
project_id,
2608+
_request_auth,
2609+
_content_type,
2610+
_headers,
2611+
_host_index,
2612+
) -> RequestSerialized:
2613+
2614+
_host = None
2615+
2616+
_collection_formats: Dict[str, str] = {}
2617+
2618+
_path_params: Dict[str, str] = {}
2619+
_query_params: List[Tuple[str, str]] = []
2620+
_header_params: Dict[str, Optional[str]] = _headers or {}
2621+
_form_params: List[Tuple[str, str]] = []
2622+
_files: Dict[str, Union[str, bytes]] = {}
2623+
_body_params: Optional[bytes] = None
2624+
2625+
# process the path parameters
2626+
if project_id is not None:
2627+
_path_params["projectId"] = project_id
2628+
# process the query parameters
2629+
# process the header parameters
2630+
# process the form parameters
2631+
# process the body parameter
2632+
2633+
# set the HTTP header `Accept`
2634+
if "Accept" not in _header_params:
2635+
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
2636+
2637+
# authentication setting
2638+
_auth_settings: List[str] = []
2639+
2640+
return self.api_client.param_serialize(
2641+
method="GET",
2642+
resource_path="/v1/projects/{projectId}/update-policies",
2643+
path_params=_path_params,
2644+
query_params=_query_params,
2645+
header_params=_header_params,
2646+
body=_body_params,
2647+
post_params=_form_params,
2648+
files=_files,
2649+
auth_settings=_auth_settings,
2650+
collection_formats=_collection_formats,
2651+
_host=_host,
2652+
_request_auth=_request_auth,
2653+
)
2654+
24232655
@validate_call
24242656
def list_update_schedules(
24252657
self,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@
2424
from stackit.serverupdate.models.enable_service_resource_payload import (
2525
EnableServiceResourcePayload,
2626
)
27+
from stackit.serverupdate.models.get_update_policies_response import (
28+
GetUpdatePoliciesResponse,
29+
)
2730
from stackit.serverupdate.models.get_update_schedules_response import (
2831
GetUpdateSchedulesResponse,
2932
)
3033
from stackit.serverupdate.models.get_updates_list_response import GetUpdatesListResponse
3134
from stackit.serverupdate.models.update import Update
35+
from stackit.serverupdate.models.update_policy import UpdatePolicy
3236
from stackit.serverupdate.models.update_schedule import UpdateSchedule
3337
from stackit.serverupdate.models.update_update_schedule_payload import (
3438
UpdateUpdateSchedulePayload,
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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
22+
from typing_extensions import Self
23+
24+
from stackit.serverupdate.models.update_policy import UpdatePolicy
25+
26+
27+
class GetUpdatePoliciesResponse(BaseModel):
28+
"""
29+
GetUpdatePoliciesResponse
30+
"""
31+
32+
items: Optional[List[UpdatePolicy]] = None
33+
__properties: ClassVar[List[str]] = ["items"]
34+
35+
model_config = ConfigDict(
36+
populate_by_name=True,
37+
validate_assignment=True,
38+
protected_namespaces=(),
39+
)
40+
41+
def to_str(self) -> str:
42+
"""Returns the string representation of the model using alias"""
43+
return pprint.pformat(self.model_dump(by_alias=True))
44+
45+
def to_json(self) -> str:
46+
"""Returns the JSON representation of the model using alias"""
47+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48+
return json.dumps(self.to_dict())
49+
50+
@classmethod
51+
def from_json(cls, json_str: str) -> Optional[Self]:
52+
"""Create an instance of GetUpdatePoliciesResponse from a JSON string"""
53+
return cls.from_dict(json.loads(json_str))
54+
55+
def to_dict(self) -> Dict[str, Any]:
56+
"""Return the dictionary representation of the model using alias.
57+
58+
This has the following differences from calling pydantic's
59+
`self.model_dump(by_alias=True)`:
60+
61+
* `None` is only added to the output dict for nullable fields that
62+
were set at model initialization. Other fields with value `None`
63+
are ignored.
64+
"""
65+
excluded_fields: Set[str] = set([])
66+
67+
_dict = self.model_dump(
68+
by_alias=True,
69+
exclude=excluded_fields,
70+
exclude_none=True,
71+
)
72+
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
73+
_items = []
74+
if self.items:
75+
for _item in self.items:
76+
if _item:
77+
_items.append(_item.to_dict())
78+
_dict["items"] = _items
79+
return _dict
80+
81+
@classmethod
82+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83+
"""Create an instance of GetUpdatePoliciesResponse from a dict"""
84+
if obj is None:
85+
return None
86+
87+
if not isinstance(obj, dict):
88+
return cls.model_validate(obj)
89+
90+
_obj = cls.model_validate(
91+
{
92+
"items": (
93+
[UpdatePolicy.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None
94+
)
95+
}
96+
)
97+
return _obj

0 commit comments

Comments
 (0)