hostinger-api 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hostinger_api/__init__.py +105 -0
- hostinger_api/api/__init__.py +21 -0
- hostinger_api/api/billing_catalog_api.py +282 -0
- hostinger_api/api/billing_orders_api.py +313 -0
- hostinger_api/api/billing_payment_methods_api.py +819 -0
- hostinger_api/api/billing_subscriptions_api.py +584 -0
- hostinger_api/api/domains_portfolio_api.py +282 -0
- hostinger_api/api/vps_actions_api.py +599 -0
- hostinger_api/api/vps_backups_api.py +882 -0
- hostinger_api/api/vps_data_centers_api.py +282 -0
- hostinger_api/api/vps_firewall_api.py +2872 -0
- hostinger_api/api/vps_malware_scanner_api.py +842 -0
- hostinger_api/api/vps_post_install_scripts_api.py +1419 -0
- hostinger_api/api/vps_public_keys_api.py +1154 -0
- hostinger_api/api/vps_recovery_api.py +597 -0
- hostinger_api/api/vps_snapshots_api.py +1100 -0
- hostinger_api/api/vps_virtual_machine_api.py +3714 -0
- hostinger_api/api/vpsos_templates_api.py +551 -0
- hostinger_api/api/vpsptr_records_api.py +565 -0
- hostinger_api/api_client.py +795 -0
- hostinger_api/api_response.py +21 -0
- hostinger_api/configuration.py +579 -0
- hostinger_api/exceptions.py +214 -0
- hostinger_api/models/__init__.py +72 -0
- hostinger_api/models/billing_v1_catalog_catalog_item_price_resource.py +107 -0
- hostinger_api/models/billing_v1_catalog_catalog_item_resource.py +99 -0
- hostinger_api/models/billing_v1_order_order_billing_address_resource.py +145 -0
- hostinger_api/models/billing_v1_order_order_resource.py +116 -0
- hostinger_api/models/billing_v1_order_store_request.py +97 -0
- hostinger_api/models/billing_v1_order_store_request_items_inner.py +87 -0
- hostinger_api/models/billing_v1_payment_method_payment_method_resource.py +102 -0
- hostinger_api/models/billing_v1_subscription_cancel_request.py +117 -0
- hostinger_api/models/billing_v1_subscription_subscription_resource.py +130 -0
- hostinger_api/models/common_schema_error_response_schema.py +87 -0
- hostinger_api/models/common_schema_pagination_meta_schema.py +89 -0
- hostinger_api/models/common_schema_unauthorized_response_schema.py +87 -0
- hostinger_api/models/common_schema_unprocessable_content_response_schema.py +93 -0
- hostinger_api/models/common_schema_unprocessable_content_response_schema_errors.py +87 -0
- hostinger_api/models/common_success_empty_resource.py +85 -0
- hostinger_api/models/domains_v1_domain_domain_resource.py +126 -0
- hostinger_api/models/vps_get_action_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_backup_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_firewall_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_post_install_script_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_public_key_list_v1200_response.py +99 -0
- hostinger_api/models/vpsv1_action_action_resource.py +104 -0
- hostinger_api/models/vpsv1_backup_backup_resource.py +90 -0
- hostinger_api/models/vpsv1_data_center_data_center_resource.py +113 -0
- hostinger_api/models/vpsv1_firewall_firewall_resource.py +104 -0
- hostinger_api/models/vpsv1_firewall_firewall_rule_resource.py +115 -0
- hostinger_api/models/vpsv1_firewall_rules_store_request.py +105 -0
- hostinger_api/models/vpsv1_firewall_store_request.py +85 -0
- hostinger_api/models/vpsv1_ip_address_ip_address_resource.py +94 -0
- hostinger_api/models/vpsv1_malware_metrics_resource.py +101 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection.py +149 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_cpu_usage.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_disk_space.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_incoming_traffic.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_outgoing_traffic.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_ram_usage.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_uptime.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_resource.py +87 -0
- hostinger_api/models/vpsv1_post_install_script_post_install_script_resource.py +94 -0
- hostinger_api/models/vpsv1_post_install_script_store_request.py +87 -0
- hostinger_api/models/vpsv1_public_key_attach_request.py +85 -0
- hostinger_api/models/vpsv1_public_key_public_key_resource.py +89 -0
- hostinger_api/models/vpsv1_public_key_store_request.py +87 -0
- hostinger_api/models/vpsv1_snapshot_snapshot_resource.py +90 -0
- hostinger_api/models/vpsv1_template_template_resource.py +96 -0
- hostinger_api/models/vpsv1_virtual_machine_hostname_update_request.py +85 -0
- hostinger_api/models/vpsv1_virtual_machine_metric_get_request.py +88 -0
- hostinger_api/models/vpsv1_virtual_machine_nameservers_update_request.py +87 -0
- hostinger_api/models/vpsv1_virtual_machine_panel_password_update_request.py +86 -0
- hostinger_api/models/vpsv1_virtual_machine_recovery_start_request.py +85 -0
- hostinger_api/models/vpsv1_virtual_machine_recreate_request.py +90 -0
- hostinger_api/models/vpsv1_virtual_machine_root_password_update_request.py +86 -0
- hostinger_api/models/vpsv1_virtual_machine_setup_request.py +108 -0
- hostinger_api/models/vpsv1_virtual_machine_setup_request_public_key.py +87 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource.py +190 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_ipv4.py +131 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_ipv6.py +131 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_template.py +127 -0
- hostinger_api/py.typed +0 -0
- hostinger_api/rest.py +256 -0
- hostinger_api-1.0.0.dist-info/METADATA +26 -0
- hostinger_api-1.0.0.dist-info/RECORD +88 -0
- hostinger_api-1.0.0.dist-info/WHEEL +5 -0
- hostinger_api-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hostinger API Python SDK
|
|
5
|
+
|
|
6
|
+
API Version: 0.0.1-beta
|
|
7
|
+
|
|
8
|
+
NOTE: This file is auto-generated, DO NOT EDIT THIS FILE MANUALLY!
|
|
9
|
+
If you want to contribute or request a new feature, please create an issue or pull request on https://github.com/hostinger/api
|
|
10
|
+
""" # noqa: E501
|
|
11
|
+
|
|
12
|
+
import warnings
|
|
13
|
+
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
|
14
|
+
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
15
|
+
from typing_extensions import Annotated
|
|
16
|
+
|
|
17
|
+
from pydantic import Field, StrictInt
|
|
18
|
+
from typing_extensions import Annotated
|
|
19
|
+
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
|
|
20
|
+
from hostinger_api.models.vpsv1_virtual_machine_recovery_start_request import VPSV1VirtualMachineRecoveryStartRequest
|
|
21
|
+
|
|
22
|
+
from hostinger_api.api_client import ApiClient, RequestSerialized
|
|
23
|
+
from hostinger_api.api_response import ApiResponse
|
|
24
|
+
from hostinger_api.rest import RESTResponseType
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class VPSRecoveryApi:
|
|
28
|
+
|
|
29
|
+
def __init__(self, api_client=None) -> None:
|
|
30
|
+
if api_client is None:
|
|
31
|
+
api_client = ApiClient.get_default()
|
|
32
|
+
self.api_client = api_client
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@validate_call
|
|
36
|
+
def start_recovery_mode_v1(
|
|
37
|
+
self,
|
|
38
|
+
virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
|
|
39
|
+
vpsv1_virtual_machine_recovery_start_request: VPSV1VirtualMachineRecoveryStartRequest,
|
|
40
|
+
_request_timeout: Union[
|
|
41
|
+
None,
|
|
42
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
43
|
+
Tuple[
|
|
44
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
45
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
46
|
+
]
|
|
47
|
+
] = None,
|
|
48
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
49
|
+
_content_type: Optional[StrictStr] = None,
|
|
50
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
51
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
52
|
+
) -> VPSV1ActionActionResource:
|
|
53
|
+
"""Start recovery mode
|
|
54
|
+
|
|
55
|
+
This endpoint initiates the recovery mode for a specified virtual machine. Recovery mode is a special state that allows users to perform system rescue operations, such as repairing file systems, recovering data, or troubleshooting issues that prevent the virtual machine from booting normally. Virtual machine will boot recovery disk image and original disk image will be mounted in `/mnt` directory.
|
|
56
|
+
|
|
57
|
+
:param virtual_machine_id: Virtual Machine ID (required)
|
|
58
|
+
:type virtual_machine_id: int
|
|
59
|
+
:param vpsv1_virtual_machine_recovery_start_request: (required)
|
|
60
|
+
:type vpsv1_virtual_machine_recovery_start_request: VPSV1VirtualMachineRecoveryStartRequest
|
|
61
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
62
|
+
number provided, it will be total request
|
|
63
|
+
timeout. It can also be a pair (tuple) of
|
|
64
|
+
(connection, read) timeouts.
|
|
65
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
66
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
67
|
+
request; this effectively ignores the
|
|
68
|
+
authentication in the spec for a single request.
|
|
69
|
+
:type _request_auth: dict, optional
|
|
70
|
+
:param _content_type: force content-type for the request.
|
|
71
|
+
:type _content_type: str, Optional
|
|
72
|
+
:param _headers: set to override the headers for a single
|
|
73
|
+
request; this effectively ignores the headers
|
|
74
|
+
in the spec for a single request.
|
|
75
|
+
:type _headers: dict, optional
|
|
76
|
+
:param _host_index: set to override the host_index for a single
|
|
77
|
+
request; this effectively ignores the host_index
|
|
78
|
+
in the spec for a single request.
|
|
79
|
+
:type _host_index: int, optional
|
|
80
|
+
:return: Returns the result object.
|
|
81
|
+
""" # noqa: E501
|
|
82
|
+
|
|
83
|
+
_param = self._start_recovery_mode_v1_serialize(
|
|
84
|
+
virtual_machine_id=virtual_machine_id,
|
|
85
|
+
vpsv1_virtual_machine_recovery_start_request=vpsv1_virtual_machine_recovery_start_request,
|
|
86
|
+
_request_auth=_request_auth,
|
|
87
|
+
_content_type=_content_type,
|
|
88
|
+
_headers=_headers,
|
|
89
|
+
_host_index=_host_index
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
93
|
+
'200': "VPSV1ActionActionResource",
|
|
94
|
+
'422': "CommonSchemaUnprocessableContentResponseSchema",
|
|
95
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
96
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
97
|
+
}
|
|
98
|
+
response_data = self.api_client.call_api(
|
|
99
|
+
*_param,
|
|
100
|
+
_request_timeout=_request_timeout
|
|
101
|
+
)
|
|
102
|
+
response_data.read()
|
|
103
|
+
return self.api_client.response_deserialize(
|
|
104
|
+
response_data=response_data,
|
|
105
|
+
response_types_map=_response_types_map,
|
|
106
|
+
).data
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@validate_call
|
|
110
|
+
def start_recovery_mode_v1_with_http_info(
|
|
111
|
+
self,
|
|
112
|
+
virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
|
|
113
|
+
vpsv1_virtual_machine_recovery_start_request: VPSV1VirtualMachineRecoveryStartRequest,
|
|
114
|
+
_request_timeout: Union[
|
|
115
|
+
None,
|
|
116
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
117
|
+
Tuple[
|
|
118
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
119
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
120
|
+
]
|
|
121
|
+
] = None,
|
|
122
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
123
|
+
_content_type: Optional[StrictStr] = None,
|
|
124
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
125
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
126
|
+
) -> ApiResponse[VPSV1ActionActionResource]:
|
|
127
|
+
"""Start recovery mode
|
|
128
|
+
|
|
129
|
+
This endpoint initiates the recovery mode for a specified virtual machine. Recovery mode is a special state that allows users to perform system rescue operations, such as repairing file systems, recovering data, or troubleshooting issues that prevent the virtual machine from booting normally. Virtual machine will boot recovery disk image and original disk image will be mounted in `/mnt` directory.
|
|
130
|
+
|
|
131
|
+
:param virtual_machine_id: Virtual Machine ID (required)
|
|
132
|
+
:type virtual_machine_id: int
|
|
133
|
+
:param vpsv1_virtual_machine_recovery_start_request: (required)
|
|
134
|
+
:type vpsv1_virtual_machine_recovery_start_request: VPSV1VirtualMachineRecoveryStartRequest
|
|
135
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
136
|
+
number provided, it will be total request
|
|
137
|
+
timeout. It can also be a pair (tuple) of
|
|
138
|
+
(connection, read) timeouts.
|
|
139
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
140
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
141
|
+
request; this effectively ignores the
|
|
142
|
+
authentication in the spec for a single request.
|
|
143
|
+
:type _request_auth: dict, optional
|
|
144
|
+
:param _content_type: force content-type for the request.
|
|
145
|
+
:type _content_type: str, Optional
|
|
146
|
+
:param _headers: set to override the headers for a single
|
|
147
|
+
request; this effectively ignores the headers
|
|
148
|
+
in the spec for a single request.
|
|
149
|
+
:type _headers: dict, optional
|
|
150
|
+
:param _host_index: set to override the host_index for a single
|
|
151
|
+
request; this effectively ignores the host_index
|
|
152
|
+
in the spec for a single request.
|
|
153
|
+
:type _host_index: int, optional
|
|
154
|
+
:return: Returns the result object.
|
|
155
|
+
""" # noqa: E501
|
|
156
|
+
|
|
157
|
+
_param = self._start_recovery_mode_v1_serialize(
|
|
158
|
+
virtual_machine_id=virtual_machine_id,
|
|
159
|
+
vpsv1_virtual_machine_recovery_start_request=vpsv1_virtual_machine_recovery_start_request,
|
|
160
|
+
_request_auth=_request_auth,
|
|
161
|
+
_content_type=_content_type,
|
|
162
|
+
_headers=_headers,
|
|
163
|
+
_host_index=_host_index
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
167
|
+
'200': "VPSV1ActionActionResource",
|
|
168
|
+
'422': "CommonSchemaUnprocessableContentResponseSchema",
|
|
169
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
170
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
171
|
+
}
|
|
172
|
+
response_data = self.api_client.call_api(
|
|
173
|
+
*_param,
|
|
174
|
+
_request_timeout=_request_timeout
|
|
175
|
+
)
|
|
176
|
+
response_data.read()
|
|
177
|
+
return self.api_client.response_deserialize(
|
|
178
|
+
response_data=response_data,
|
|
179
|
+
response_types_map=_response_types_map,
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@validate_call
|
|
184
|
+
def start_recovery_mode_v1_without_preload_content(
|
|
185
|
+
self,
|
|
186
|
+
virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
|
|
187
|
+
vpsv1_virtual_machine_recovery_start_request: VPSV1VirtualMachineRecoveryStartRequest,
|
|
188
|
+
_request_timeout: Union[
|
|
189
|
+
None,
|
|
190
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
191
|
+
Tuple[
|
|
192
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
193
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
194
|
+
]
|
|
195
|
+
] = None,
|
|
196
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
197
|
+
_content_type: Optional[StrictStr] = None,
|
|
198
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
199
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
200
|
+
) -> RESTResponseType:
|
|
201
|
+
"""Start recovery mode
|
|
202
|
+
|
|
203
|
+
This endpoint initiates the recovery mode for a specified virtual machine. Recovery mode is a special state that allows users to perform system rescue operations, such as repairing file systems, recovering data, or troubleshooting issues that prevent the virtual machine from booting normally. Virtual machine will boot recovery disk image and original disk image will be mounted in `/mnt` directory.
|
|
204
|
+
|
|
205
|
+
:param virtual_machine_id: Virtual Machine ID (required)
|
|
206
|
+
:type virtual_machine_id: int
|
|
207
|
+
:param vpsv1_virtual_machine_recovery_start_request: (required)
|
|
208
|
+
:type vpsv1_virtual_machine_recovery_start_request: VPSV1VirtualMachineRecoveryStartRequest
|
|
209
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
210
|
+
number provided, it will be total request
|
|
211
|
+
timeout. It can also be a pair (tuple) of
|
|
212
|
+
(connection, read) timeouts.
|
|
213
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
214
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
215
|
+
request; this effectively ignores the
|
|
216
|
+
authentication in the spec for a single request.
|
|
217
|
+
:type _request_auth: dict, optional
|
|
218
|
+
:param _content_type: force content-type for the request.
|
|
219
|
+
:type _content_type: str, Optional
|
|
220
|
+
:param _headers: set to override the headers for a single
|
|
221
|
+
request; this effectively ignores the headers
|
|
222
|
+
in the spec for a single request.
|
|
223
|
+
:type _headers: dict, optional
|
|
224
|
+
:param _host_index: set to override the host_index for a single
|
|
225
|
+
request; this effectively ignores the host_index
|
|
226
|
+
in the spec for a single request.
|
|
227
|
+
:type _host_index: int, optional
|
|
228
|
+
:return: Returns the result object.
|
|
229
|
+
""" # noqa: E501
|
|
230
|
+
|
|
231
|
+
_param = self._start_recovery_mode_v1_serialize(
|
|
232
|
+
virtual_machine_id=virtual_machine_id,
|
|
233
|
+
vpsv1_virtual_machine_recovery_start_request=vpsv1_virtual_machine_recovery_start_request,
|
|
234
|
+
_request_auth=_request_auth,
|
|
235
|
+
_content_type=_content_type,
|
|
236
|
+
_headers=_headers,
|
|
237
|
+
_host_index=_host_index
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
241
|
+
'200': "VPSV1ActionActionResource",
|
|
242
|
+
'422': "CommonSchemaUnprocessableContentResponseSchema",
|
|
243
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
244
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
245
|
+
}
|
|
246
|
+
response_data = self.api_client.call_api(
|
|
247
|
+
*_param,
|
|
248
|
+
_request_timeout=_request_timeout
|
|
249
|
+
)
|
|
250
|
+
return response_data.response
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def _start_recovery_mode_v1_serialize(
|
|
254
|
+
self,
|
|
255
|
+
virtual_machine_id,
|
|
256
|
+
vpsv1_virtual_machine_recovery_start_request,
|
|
257
|
+
_request_auth,
|
|
258
|
+
_content_type,
|
|
259
|
+
_headers,
|
|
260
|
+
_host_index,
|
|
261
|
+
) -> RequestSerialized:
|
|
262
|
+
|
|
263
|
+
_host = None
|
|
264
|
+
|
|
265
|
+
_collection_formats: Dict[str, str] = {
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
_path_params: Dict[str, str] = {}
|
|
269
|
+
_query_params: List[Tuple[str, str]] = []
|
|
270
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
271
|
+
_form_params: List[Tuple[str, str]] = []
|
|
272
|
+
_files: Dict[
|
|
273
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
274
|
+
] = {}
|
|
275
|
+
_body_params: Optional[bytes] = None
|
|
276
|
+
|
|
277
|
+
# process the path parameters
|
|
278
|
+
if virtual_machine_id is not None:
|
|
279
|
+
_path_params['virtualMachineId'] = virtual_machine_id
|
|
280
|
+
# process the query parameters
|
|
281
|
+
# process the header parameters
|
|
282
|
+
# process the form parameters
|
|
283
|
+
# process the body parameter
|
|
284
|
+
if vpsv1_virtual_machine_recovery_start_request is not None:
|
|
285
|
+
_body_params = vpsv1_virtual_machine_recovery_start_request
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
# set the HTTP header `Accept`
|
|
289
|
+
if 'Accept' not in _header_params:
|
|
290
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
291
|
+
[
|
|
292
|
+
'application/json'
|
|
293
|
+
]
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
# set the HTTP header `Content-Type`
|
|
297
|
+
if _content_type:
|
|
298
|
+
_header_params['Content-Type'] = _content_type
|
|
299
|
+
else:
|
|
300
|
+
_default_content_type = (
|
|
301
|
+
self.api_client.select_header_content_type(
|
|
302
|
+
[
|
|
303
|
+
'application/json'
|
|
304
|
+
]
|
|
305
|
+
)
|
|
306
|
+
)
|
|
307
|
+
if _default_content_type is not None:
|
|
308
|
+
_header_params['Content-Type'] = _default_content_type
|
|
309
|
+
|
|
310
|
+
# authentication setting
|
|
311
|
+
_auth_settings: List[str] = [
|
|
312
|
+
'apiToken'
|
|
313
|
+
]
|
|
314
|
+
|
|
315
|
+
return self.api_client.param_serialize(
|
|
316
|
+
method='POST',
|
|
317
|
+
resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/recovery',
|
|
318
|
+
path_params=_path_params,
|
|
319
|
+
query_params=_query_params,
|
|
320
|
+
header_params=_header_params,
|
|
321
|
+
body=_body_params,
|
|
322
|
+
post_params=_form_params,
|
|
323
|
+
files=_files,
|
|
324
|
+
auth_settings=_auth_settings,
|
|
325
|
+
collection_formats=_collection_formats,
|
|
326
|
+
_host=_host,
|
|
327
|
+
_request_auth=_request_auth
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
@validate_call
|
|
334
|
+
def stop_recovery_mode_v1(
|
|
335
|
+
self,
|
|
336
|
+
virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
|
|
337
|
+
_request_timeout: Union[
|
|
338
|
+
None,
|
|
339
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
340
|
+
Tuple[
|
|
341
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
342
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
343
|
+
]
|
|
344
|
+
] = None,
|
|
345
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
346
|
+
_content_type: Optional[StrictStr] = None,
|
|
347
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
348
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
349
|
+
) -> VPSV1ActionActionResource:
|
|
350
|
+
"""Stop recovery mode
|
|
351
|
+
|
|
352
|
+
This endpoint stops the recovery mode for a specified virtual machine. If virtual machine is not in recovery mode, this operation will fail.
|
|
353
|
+
|
|
354
|
+
:param virtual_machine_id: Virtual Machine ID (required)
|
|
355
|
+
:type virtual_machine_id: int
|
|
356
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
357
|
+
number provided, it will be total request
|
|
358
|
+
timeout. It can also be a pair (tuple) of
|
|
359
|
+
(connection, read) timeouts.
|
|
360
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
361
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
362
|
+
request; this effectively ignores the
|
|
363
|
+
authentication in the spec for a single request.
|
|
364
|
+
:type _request_auth: dict, optional
|
|
365
|
+
:param _content_type: force content-type for the request.
|
|
366
|
+
:type _content_type: str, Optional
|
|
367
|
+
:param _headers: set to override the headers for a single
|
|
368
|
+
request; this effectively ignores the headers
|
|
369
|
+
in the spec for a single request.
|
|
370
|
+
:type _headers: dict, optional
|
|
371
|
+
:param _host_index: set to override the host_index for a single
|
|
372
|
+
request; this effectively ignores the host_index
|
|
373
|
+
in the spec for a single request.
|
|
374
|
+
:type _host_index: int, optional
|
|
375
|
+
:return: Returns the result object.
|
|
376
|
+
""" # noqa: E501
|
|
377
|
+
|
|
378
|
+
_param = self._stop_recovery_mode_v1_serialize(
|
|
379
|
+
virtual_machine_id=virtual_machine_id,
|
|
380
|
+
_request_auth=_request_auth,
|
|
381
|
+
_content_type=_content_type,
|
|
382
|
+
_headers=_headers,
|
|
383
|
+
_host_index=_host_index
|
|
384
|
+
)
|
|
385
|
+
|
|
386
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
387
|
+
'200': "VPSV1ActionActionResource",
|
|
388
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
389
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
390
|
+
}
|
|
391
|
+
response_data = self.api_client.call_api(
|
|
392
|
+
*_param,
|
|
393
|
+
_request_timeout=_request_timeout
|
|
394
|
+
)
|
|
395
|
+
response_data.read()
|
|
396
|
+
return self.api_client.response_deserialize(
|
|
397
|
+
response_data=response_data,
|
|
398
|
+
response_types_map=_response_types_map,
|
|
399
|
+
).data
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
@validate_call
|
|
403
|
+
def stop_recovery_mode_v1_with_http_info(
|
|
404
|
+
self,
|
|
405
|
+
virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
|
|
406
|
+
_request_timeout: Union[
|
|
407
|
+
None,
|
|
408
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
409
|
+
Tuple[
|
|
410
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
411
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
412
|
+
]
|
|
413
|
+
] = None,
|
|
414
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
415
|
+
_content_type: Optional[StrictStr] = None,
|
|
416
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
417
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
418
|
+
) -> ApiResponse[VPSV1ActionActionResource]:
|
|
419
|
+
"""Stop recovery mode
|
|
420
|
+
|
|
421
|
+
This endpoint stops the recovery mode for a specified virtual machine. If virtual machine is not in recovery mode, this operation will fail.
|
|
422
|
+
|
|
423
|
+
:param virtual_machine_id: Virtual Machine ID (required)
|
|
424
|
+
:type virtual_machine_id: int
|
|
425
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
426
|
+
number provided, it will be total request
|
|
427
|
+
timeout. It can also be a pair (tuple) of
|
|
428
|
+
(connection, read) timeouts.
|
|
429
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
430
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
431
|
+
request; this effectively ignores the
|
|
432
|
+
authentication in the spec for a single request.
|
|
433
|
+
:type _request_auth: dict, optional
|
|
434
|
+
:param _content_type: force content-type for the request.
|
|
435
|
+
:type _content_type: str, Optional
|
|
436
|
+
:param _headers: set to override the headers for a single
|
|
437
|
+
request; this effectively ignores the headers
|
|
438
|
+
in the spec for a single request.
|
|
439
|
+
:type _headers: dict, optional
|
|
440
|
+
:param _host_index: set to override the host_index for a single
|
|
441
|
+
request; this effectively ignores the host_index
|
|
442
|
+
in the spec for a single request.
|
|
443
|
+
:type _host_index: int, optional
|
|
444
|
+
:return: Returns the result object.
|
|
445
|
+
""" # noqa: E501
|
|
446
|
+
|
|
447
|
+
_param = self._stop_recovery_mode_v1_serialize(
|
|
448
|
+
virtual_machine_id=virtual_machine_id,
|
|
449
|
+
_request_auth=_request_auth,
|
|
450
|
+
_content_type=_content_type,
|
|
451
|
+
_headers=_headers,
|
|
452
|
+
_host_index=_host_index
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
456
|
+
'200': "VPSV1ActionActionResource",
|
|
457
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
458
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
459
|
+
}
|
|
460
|
+
response_data = self.api_client.call_api(
|
|
461
|
+
*_param,
|
|
462
|
+
_request_timeout=_request_timeout
|
|
463
|
+
)
|
|
464
|
+
response_data.read()
|
|
465
|
+
return self.api_client.response_deserialize(
|
|
466
|
+
response_data=response_data,
|
|
467
|
+
response_types_map=_response_types_map,
|
|
468
|
+
)
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
@validate_call
|
|
472
|
+
def stop_recovery_mode_v1_without_preload_content(
|
|
473
|
+
self,
|
|
474
|
+
virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
|
|
475
|
+
_request_timeout: Union[
|
|
476
|
+
None,
|
|
477
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
478
|
+
Tuple[
|
|
479
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
480
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
481
|
+
]
|
|
482
|
+
] = None,
|
|
483
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
484
|
+
_content_type: Optional[StrictStr] = None,
|
|
485
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
486
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
487
|
+
) -> RESTResponseType:
|
|
488
|
+
"""Stop recovery mode
|
|
489
|
+
|
|
490
|
+
This endpoint stops the recovery mode for a specified virtual machine. If virtual machine is not in recovery mode, this operation will fail.
|
|
491
|
+
|
|
492
|
+
:param virtual_machine_id: Virtual Machine ID (required)
|
|
493
|
+
:type virtual_machine_id: int
|
|
494
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
495
|
+
number provided, it will be total request
|
|
496
|
+
timeout. It can also be a pair (tuple) of
|
|
497
|
+
(connection, read) timeouts.
|
|
498
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
499
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
500
|
+
request; this effectively ignores the
|
|
501
|
+
authentication in the spec for a single request.
|
|
502
|
+
:type _request_auth: dict, optional
|
|
503
|
+
:param _content_type: force content-type for the request.
|
|
504
|
+
:type _content_type: str, Optional
|
|
505
|
+
:param _headers: set to override the headers for a single
|
|
506
|
+
request; this effectively ignores the headers
|
|
507
|
+
in the spec for a single request.
|
|
508
|
+
:type _headers: dict, optional
|
|
509
|
+
:param _host_index: set to override the host_index for a single
|
|
510
|
+
request; this effectively ignores the host_index
|
|
511
|
+
in the spec for a single request.
|
|
512
|
+
:type _host_index: int, optional
|
|
513
|
+
:return: Returns the result object.
|
|
514
|
+
""" # noqa: E501
|
|
515
|
+
|
|
516
|
+
_param = self._stop_recovery_mode_v1_serialize(
|
|
517
|
+
virtual_machine_id=virtual_machine_id,
|
|
518
|
+
_request_auth=_request_auth,
|
|
519
|
+
_content_type=_content_type,
|
|
520
|
+
_headers=_headers,
|
|
521
|
+
_host_index=_host_index
|
|
522
|
+
)
|
|
523
|
+
|
|
524
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
525
|
+
'200': "VPSV1ActionActionResource",
|
|
526
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
527
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
528
|
+
}
|
|
529
|
+
response_data = self.api_client.call_api(
|
|
530
|
+
*_param,
|
|
531
|
+
_request_timeout=_request_timeout
|
|
532
|
+
)
|
|
533
|
+
return response_data.response
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
def _stop_recovery_mode_v1_serialize(
|
|
537
|
+
self,
|
|
538
|
+
virtual_machine_id,
|
|
539
|
+
_request_auth,
|
|
540
|
+
_content_type,
|
|
541
|
+
_headers,
|
|
542
|
+
_host_index,
|
|
543
|
+
) -> RequestSerialized:
|
|
544
|
+
|
|
545
|
+
_host = None
|
|
546
|
+
|
|
547
|
+
_collection_formats: Dict[str, str] = {
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
_path_params: Dict[str, str] = {}
|
|
551
|
+
_query_params: List[Tuple[str, str]] = []
|
|
552
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
553
|
+
_form_params: List[Tuple[str, str]] = []
|
|
554
|
+
_files: Dict[
|
|
555
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
556
|
+
] = {}
|
|
557
|
+
_body_params: Optional[bytes] = None
|
|
558
|
+
|
|
559
|
+
# process the path parameters
|
|
560
|
+
if virtual_machine_id is not None:
|
|
561
|
+
_path_params['virtualMachineId'] = virtual_machine_id
|
|
562
|
+
# process the query parameters
|
|
563
|
+
# process the header parameters
|
|
564
|
+
# process the form parameters
|
|
565
|
+
# process the body parameter
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
# set the HTTP header `Accept`
|
|
569
|
+
if 'Accept' not in _header_params:
|
|
570
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
571
|
+
[
|
|
572
|
+
'application/json'
|
|
573
|
+
]
|
|
574
|
+
)
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
# authentication setting
|
|
578
|
+
_auth_settings: List[str] = [
|
|
579
|
+
'apiToken'
|
|
580
|
+
]
|
|
581
|
+
|
|
582
|
+
return self.api_client.param_serialize(
|
|
583
|
+
method='DELETE',
|
|
584
|
+
resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/recovery',
|
|
585
|
+
path_params=_path_params,
|
|
586
|
+
query_params=_query_params,
|
|
587
|
+
header_params=_header_params,
|
|
588
|
+
body=_body_params,
|
|
589
|
+
post_params=_form_params,
|
|
590
|
+
files=_files,
|
|
591
|
+
auth_settings=_auth_settings,
|
|
592
|
+
collection_formats=_collection_formats,
|
|
593
|
+
_host=_host,
|
|
594
|
+
_request_auth=_request_auth
|
|
595
|
+
)
|
|
596
|
+
|
|
597
|
+
|