Skip to content

Commit 3d802f1

Browse files
Generate serverbackup
1 parent 0f573e1 commit 3d802f1

File tree

4 files changed

+335
-0
lines changed

4 files changed

+335
-0
lines changed

services/serverbackup/src/stackit/serverbackup/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
from stackit.serverbackup.models.get_backup_schedules_response import (
6060
GetBackupSchedulesResponse,
6161
)
62+
from stackit.serverbackup.models.get_backup_service_response import (
63+
GetBackupServiceResponse,
64+
)
6265
from stackit.serverbackup.models.get_backups_list_response import GetBackupsListResponse
6366
from stackit.serverbackup.models.restore_backup_payload import RestoreBackupPayload
6467
from stackit.serverbackup.models.restore_volume_backup_payload import (

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

+247
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
from stackit.serverbackup.models.get_backup_schedules_response import (
3939
GetBackupSchedulesResponse,
4040
)
41+
from stackit.serverbackup.models.get_backup_service_response import (
42+
GetBackupServiceResponse,
43+
)
4144
from stackit.serverbackup.models.get_backups_list_response import GetBackupsListResponse
4245
from stackit.serverbackup.models.restore_backup_payload import RestoreBackupPayload
4346
from stackit.serverbackup.models.restore_volume_backup_payload import (
@@ -2891,6 +2894,250 @@ def _get_backup_schedule_serialize(
28912894
_request_auth=_request_auth,
28922895
)
28932896

2897+
@validate_call
2898+
def get_service_resource(
2899+
self,
2900+
project_id: Annotated[StrictStr, Field(description="project id")],
2901+
server_id: Annotated[StrictStr, Field(description="server id")],
2902+
_request_timeout: Union[
2903+
None,
2904+
Annotated[StrictFloat, Field(gt=0)],
2905+
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2906+
] = None,
2907+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
2908+
_content_type: Optional[StrictStr] = None,
2909+
_headers: Optional[Dict[StrictStr, Any]] = None,
2910+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2911+
) -> GetBackupServiceResponse:
2912+
"""get backup service details
2913+
2914+
2915+
:param project_id: project id (required)
2916+
:type project_id: str
2917+
:param server_id: server id (required)
2918+
:type server_id: str
2919+
:param _request_timeout: timeout setting for this request. If one
2920+
number provided, it will be total request
2921+
timeout. It can also be a pair (tuple) of
2922+
(connection, read) timeouts.
2923+
:type _request_timeout: int, tuple(int, int), optional
2924+
:param _request_auth: set to override the auth_settings for an a single
2925+
request; this effectively ignores the
2926+
authentication in the spec for a single request.
2927+
:type _request_auth: dict, optional
2928+
:param _content_type: force content-type for the request.
2929+
:type _content_type: str, Optional
2930+
:param _headers: set to override the headers for a single
2931+
request; this effectively ignores the headers
2932+
in the spec for a single request.
2933+
:type _headers: dict, optional
2934+
:param _host_index: set to override the host_index for a single
2935+
request; this effectively ignores the host_index
2936+
in the spec for a single request.
2937+
:type _host_index: int, optional
2938+
:return: Returns the result object.
2939+
""" # noqa: E501 docstring might be too long
2940+
2941+
_param = self._get_service_resource_serialize(
2942+
project_id=project_id,
2943+
server_id=server_id,
2944+
_request_auth=_request_auth,
2945+
_content_type=_content_type,
2946+
_headers=_headers,
2947+
_host_index=_host_index,
2948+
)
2949+
2950+
_response_types_map: Dict[str, Optional[str]] = {
2951+
"200": "GetBackupServiceResponse",
2952+
"400": None,
2953+
"404": None,
2954+
}
2955+
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2956+
response_data.read()
2957+
return self.api_client.response_deserialize(
2958+
response_data=response_data,
2959+
response_types_map=_response_types_map,
2960+
).data
2961+
2962+
@validate_call
2963+
def get_service_resource_with_http_info(
2964+
self,
2965+
project_id: Annotated[StrictStr, Field(description="project id")],
2966+
server_id: Annotated[StrictStr, Field(description="server id")],
2967+
_request_timeout: Union[
2968+
None,
2969+
Annotated[StrictFloat, Field(gt=0)],
2970+
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2971+
] = None,
2972+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
2973+
_content_type: Optional[StrictStr] = None,
2974+
_headers: Optional[Dict[StrictStr, Any]] = None,
2975+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2976+
) -> ApiResponse[GetBackupServiceResponse]:
2977+
"""get backup service details
2978+
2979+
2980+
:param project_id: project id (required)
2981+
:type project_id: str
2982+
:param server_id: server id (required)
2983+
:type server_id: str
2984+
:param _request_timeout: timeout setting for this request. If one
2985+
number provided, it will be total request
2986+
timeout. It can also be a pair (tuple) of
2987+
(connection, read) timeouts.
2988+
:type _request_timeout: int, tuple(int, int), optional
2989+
:param _request_auth: set to override the auth_settings for an a single
2990+
request; this effectively ignores the
2991+
authentication in the spec for a single request.
2992+
:type _request_auth: dict, optional
2993+
:param _content_type: force content-type for the request.
2994+
:type _content_type: str, Optional
2995+
:param _headers: set to override the headers for a single
2996+
request; this effectively ignores the headers
2997+
in the spec for a single request.
2998+
:type _headers: dict, optional
2999+
:param _host_index: set to override the host_index for a single
3000+
request; this effectively ignores the host_index
3001+
in the spec for a single request.
3002+
:type _host_index: int, optional
3003+
:return: Returns the result object.
3004+
""" # noqa: E501 docstring might be too long
3005+
3006+
_param = self._get_service_resource_serialize(
3007+
project_id=project_id,
3008+
server_id=server_id,
3009+
_request_auth=_request_auth,
3010+
_content_type=_content_type,
3011+
_headers=_headers,
3012+
_host_index=_host_index,
3013+
)
3014+
3015+
_response_types_map: Dict[str, Optional[str]] = {
3016+
"200": "GetBackupServiceResponse",
3017+
"400": None,
3018+
"404": None,
3019+
}
3020+
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3021+
response_data.read()
3022+
return self.api_client.response_deserialize(
3023+
response_data=response_data,
3024+
response_types_map=_response_types_map,
3025+
)
3026+
3027+
@validate_call
3028+
def get_service_resource_without_preload_content(
3029+
self,
3030+
project_id: Annotated[StrictStr, Field(description="project id")],
3031+
server_id: Annotated[StrictStr, Field(description="server id")],
3032+
_request_timeout: Union[
3033+
None,
3034+
Annotated[StrictFloat, Field(gt=0)],
3035+
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
3036+
] = None,
3037+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
3038+
_content_type: Optional[StrictStr] = None,
3039+
_headers: Optional[Dict[StrictStr, Any]] = None,
3040+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3041+
) -> RESTResponseType:
3042+
"""get backup service details
3043+
3044+
3045+
:param project_id: project id (required)
3046+
:type project_id: str
3047+
:param server_id: server id (required)
3048+
:type server_id: str
3049+
:param _request_timeout: timeout setting for this request. If one
3050+
number provided, it will be total request
3051+
timeout. It can also be a pair (tuple) of
3052+
(connection, read) timeouts.
3053+
:type _request_timeout: int, tuple(int, int), optional
3054+
:param _request_auth: set to override the auth_settings for an a single
3055+
request; this effectively ignores the
3056+
authentication in the spec for a single request.
3057+
:type _request_auth: dict, optional
3058+
:param _content_type: force content-type for the request.
3059+
:type _content_type: str, Optional
3060+
:param _headers: set to override the headers for a single
3061+
request; this effectively ignores the headers
3062+
in the spec for a single request.
3063+
:type _headers: dict, optional
3064+
:param _host_index: set to override the host_index for a single
3065+
request; this effectively ignores the host_index
3066+
in the spec for a single request.
3067+
:type _host_index: int, optional
3068+
:return: Returns the result object.
3069+
""" # noqa: E501 docstring might be too long
3070+
3071+
_param = self._get_service_resource_serialize(
3072+
project_id=project_id,
3073+
server_id=server_id,
3074+
_request_auth=_request_auth,
3075+
_content_type=_content_type,
3076+
_headers=_headers,
3077+
_host_index=_host_index,
3078+
)
3079+
3080+
_response_types_map: Dict[str, Optional[str]] = {
3081+
"200": "GetBackupServiceResponse",
3082+
"400": None,
3083+
"404": None,
3084+
}
3085+
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3086+
return response_data.response
3087+
3088+
def _get_service_resource_serialize(
3089+
self,
3090+
project_id,
3091+
server_id,
3092+
_request_auth,
3093+
_content_type,
3094+
_headers,
3095+
_host_index,
3096+
) -> RequestSerialized:
3097+
3098+
_host = None
3099+
3100+
_collection_formats: Dict[str, str] = {}
3101+
3102+
_path_params: Dict[str, str] = {}
3103+
_query_params: List[Tuple[str, str]] = []
3104+
_header_params: Dict[str, Optional[str]] = _headers or {}
3105+
_form_params: List[Tuple[str, str]] = []
3106+
_files: Dict[str, Union[str, bytes]] = {}
3107+
_body_params: Optional[bytes] = None
3108+
3109+
# process the path parameters
3110+
if project_id is not None:
3111+
_path_params["projectId"] = project_id
3112+
if server_id is not None:
3113+
_path_params["serverId"] = server_id
3114+
# process the query parameters
3115+
# process the header parameters
3116+
# process the form parameters
3117+
# process the body parameter
3118+
3119+
# set the HTTP header `Accept`
3120+
if "Accept" not in _header_params:
3121+
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
3122+
3123+
# authentication setting
3124+
_auth_settings: List[str] = []
3125+
3126+
return self.api_client.param_serialize(
3127+
method="GET",
3128+
resource_path="/v1/projects/{projectId}/servers/{serverId}/service",
3129+
path_params=_path_params,
3130+
query_params=_query_params,
3131+
header_params=_header_params,
3132+
body=_body_params,
3133+
post_params=_form_params,
3134+
files=_files,
3135+
auth_settings=_auth_settings,
3136+
collection_formats=_collection_formats,
3137+
_host=_host,
3138+
_request_auth=_request_auth,
3139+
)
3140+
28943141
@validate_call
28953142
def list_backup_policies(
28963143
self,

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

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
from stackit.serverbackup.models.get_backup_schedules_response import (
4141
GetBackupSchedulesResponse,
4242
)
43+
from stackit.serverbackup.models.get_backup_service_response import (
44+
GetBackupServiceResponse,
45+
)
4346
from stackit.serverbackup.models.get_backups_list_response import GetBackupsListResponse
4447
from stackit.serverbackup.models.restore_backup_payload import RestoreBackupPayload
4548
from stackit.serverbackup.models.restore_volume_backup_payload import (
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# coding: utf-8
2+
3+
"""
4+
STACKIT Server Backup Management API
5+
6+
API endpoints for Server Backup Operations on STACKIT Servers.
7+
8+
The version of the OpenAPI document: 1.0
9+
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 GetBackupServiceResponse(BaseModel):
26+
"""
27+
GetBackupServiceResponse
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 GetBackupServiceResponse 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 GetBackupServiceResponse 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)