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.
Files changed (88) hide show
  1. hostinger_api/__init__.py +105 -0
  2. hostinger_api/api/__init__.py +21 -0
  3. hostinger_api/api/billing_catalog_api.py +282 -0
  4. hostinger_api/api/billing_orders_api.py +313 -0
  5. hostinger_api/api/billing_payment_methods_api.py +819 -0
  6. hostinger_api/api/billing_subscriptions_api.py +584 -0
  7. hostinger_api/api/domains_portfolio_api.py +282 -0
  8. hostinger_api/api/vps_actions_api.py +599 -0
  9. hostinger_api/api/vps_backups_api.py +882 -0
  10. hostinger_api/api/vps_data_centers_api.py +282 -0
  11. hostinger_api/api/vps_firewall_api.py +2872 -0
  12. hostinger_api/api/vps_malware_scanner_api.py +842 -0
  13. hostinger_api/api/vps_post_install_scripts_api.py +1419 -0
  14. hostinger_api/api/vps_public_keys_api.py +1154 -0
  15. hostinger_api/api/vps_recovery_api.py +597 -0
  16. hostinger_api/api/vps_snapshots_api.py +1100 -0
  17. hostinger_api/api/vps_virtual_machine_api.py +3714 -0
  18. hostinger_api/api/vpsos_templates_api.py +551 -0
  19. hostinger_api/api/vpsptr_records_api.py +565 -0
  20. hostinger_api/api_client.py +795 -0
  21. hostinger_api/api_response.py +21 -0
  22. hostinger_api/configuration.py +579 -0
  23. hostinger_api/exceptions.py +214 -0
  24. hostinger_api/models/__init__.py +72 -0
  25. hostinger_api/models/billing_v1_catalog_catalog_item_price_resource.py +107 -0
  26. hostinger_api/models/billing_v1_catalog_catalog_item_resource.py +99 -0
  27. hostinger_api/models/billing_v1_order_order_billing_address_resource.py +145 -0
  28. hostinger_api/models/billing_v1_order_order_resource.py +116 -0
  29. hostinger_api/models/billing_v1_order_store_request.py +97 -0
  30. hostinger_api/models/billing_v1_order_store_request_items_inner.py +87 -0
  31. hostinger_api/models/billing_v1_payment_method_payment_method_resource.py +102 -0
  32. hostinger_api/models/billing_v1_subscription_cancel_request.py +117 -0
  33. hostinger_api/models/billing_v1_subscription_subscription_resource.py +130 -0
  34. hostinger_api/models/common_schema_error_response_schema.py +87 -0
  35. hostinger_api/models/common_schema_pagination_meta_schema.py +89 -0
  36. hostinger_api/models/common_schema_unauthorized_response_schema.py +87 -0
  37. hostinger_api/models/common_schema_unprocessable_content_response_schema.py +93 -0
  38. hostinger_api/models/common_schema_unprocessable_content_response_schema_errors.py +87 -0
  39. hostinger_api/models/common_success_empty_resource.py +85 -0
  40. hostinger_api/models/domains_v1_domain_domain_resource.py +126 -0
  41. hostinger_api/models/vps_get_action_list_v1200_response.py +99 -0
  42. hostinger_api/models/vps_get_backup_list_v1200_response.py +99 -0
  43. hostinger_api/models/vps_get_firewall_list_v1200_response.py +99 -0
  44. hostinger_api/models/vps_get_post_install_script_list_v1200_response.py +99 -0
  45. hostinger_api/models/vps_get_public_key_list_v1200_response.py +99 -0
  46. hostinger_api/models/vpsv1_action_action_resource.py +104 -0
  47. hostinger_api/models/vpsv1_backup_backup_resource.py +90 -0
  48. hostinger_api/models/vpsv1_data_center_data_center_resource.py +113 -0
  49. hostinger_api/models/vpsv1_firewall_firewall_resource.py +104 -0
  50. hostinger_api/models/vpsv1_firewall_firewall_rule_resource.py +115 -0
  51. hostinger_api/models/vpsv1_firewall_rules_store_request.py +105 -0
  52. hostinger_api/models/vpsv1_firewall_store_request.py +85 -0
  53. hostinger_api/models/vpsv1_ip_address_ip_address_resource.py +94 -0
  54. hostinger_api/models/vpsv1_malware_metrics_resource.py +101 -0
  55. hostinger_api/models/vpsv1_metrics_metrics_collection.py +149 -0
  56. hostinger_api/models/vpsv1_metrics_metrics_collection_cpu_usage.py +127 -0
  57. hostinger_api/models/vpsv1_metrics_metrics_collection_disk_space.py +127 -0
  58. hostinger_api/models/vpsv1_metrics_metrics_collection_incoming_traffic.py +127 -0
  59. hostinger_api/models/vpsv1_metrics_metrics_collection_outgoing_traffic.py +127 -0
  60. hostinger_api/models/vpsv1_metrics_metrics_collection_ram_usage.py +127 -0
  61. hostinger_api/models/vpsv1_metrics_metrics_collection_uptime.py +127 -0
  62. hostinger_api/models/vpsv1_metrics_metrics_resource.py +87 -0
  63. hostinger_api/models/vpsv1_post_install_script_post_install_script_resource.py +94 -0
  64. hostinger_api/models/vpsv1_post_install_script_store_request.py +87 -0
  65. hostinger_api/models/vpsv1_public_key_attach_request.py +85 -0
  66. hostinger_api/models/vpsv1_public_key_public_key_resource.py +89 -0
  67. hostinger_api/models/vpsv1_public_key_store_request.py +87 -0
  68. hostinger_api/models/vpsv1_snapshot_snapshot_resource.py +90 -0
  69. hostinger_api/models/vpsv1_template_template_resource.py +96 -0
  70. hostinger_api/models/vpsv1_virtual_machine_hostname_update_request.py +85 -0
  71. hostinger_api/models/vpsv1_virtual_machine_metric_get_request.py +88 -0
  72. hostinger_api/models/vpsv1_virtual_machine_nameservers_update_request.py +87 -0
  73. hostinger_api/models/vpsv1_virtual_machine_panel_password_update_request.py +86 -0
  74. hostinger_api/models/vpsv1_virtual_machine_recovery_start_request.py +85 -0
  75. hostinger_api/models/vpsv1_virtual_machine_recreate_request.py +90 -0
  76. hostinger_api/models/vpsv1_virtual_machine_root_password_update_request.py +86 -0
  77. hostinger_api/models/vpsv1_virtual_machine_setup_request.py +108 -0
  78. hostinger_api/models/vpsv1_virtual_machine_setup_request_public_key.py +87 -0
  79. hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource.py +190 -0
  80. hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_ipv4.py +131 -0
  81. hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_ipv6.py +131 -0
  82. hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_template.py +127 -0
  83. hostinger_api/py.typed +0 -0
  84. hostinger_api/rest.py +256 -0
  85. hostinger_api-1.0.0.dist-info/METADATA +26 -0
  86. hostinger_api-1.0.0.dist-info/RECORD +88 -0
  87. hostinger_api-1.0.0.dist-info/WHEEL +5 -0
  88. hostinger_api-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,3714 @@
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 import List
19
+ from typing_extensions import Annotated
20
+ from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
21
+ from hostinger_api.models.vpsv1_metrics_metrics_collection import VPSV1MetricsMetricsCollection
22
+ from hostinger_api.models.vpsv1_virtual_machine_hostname_update_request import VPSV1VirtualMachineHostnameUpdateRequest
23
+ from hostinger_api.models.vpsv1_virtual_machine_metric_get_request import VPSV1VirtualMachineMetricGetRequest
24
+ from hostinger_api.models.vpsv1_virtual_machine_nameservers_update_request import VPSV1VirtualMachineNameserversUpdateRequest
25
+ from hostinger_api.models.vpsv1_virtual_machine_panel_password_update_request import VPSV1VirtualMachinePanelPasswordUpdateRequest
26
+ from hostinger_api.models.vpsv1_virtual_machine_recreate_request import VPSV1VirtualMachineRecreateRequest
27
+ from hostinger_api.models.vpsv1_virtual_machine_root_password_update_request import VPSV1VirtualMachineRootPasswordUpdateRequest
28
+ from hostinger_api.models.vpsv1_virtual_machine_setup_request import VPSV1VirtualMachineSetupRequest
29
+ from hostinger_api.models.vpsv1_virtual_machine_virtual_machine_resource import VPSV1VirtualMachineVirtualMachineResource
30
+
31
+ from hostinger_api.api_client import ApiClient, RequestSerialized
32
+ from hostinger_api.api_response import ApiResponse
33
+ from hostinger_api.rest import RESTResponseType
34
+
35
+
36
+ class VPSVirtualMachineApi:
37
+
38
+ def __init__(self, api_client=None) -> None:
39
+ if api_client is None:
40
+ api_client = ApiClient.get_default()
41
+ self.api_client = api_client
42
+
43
+
44
+ @validate_call
45
+ def get_metrics_v1(
46
+ self,
47
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
48
+ vpsv1_virtual_machine_metric_get_request: VPSV1VirtualMachineMetricGetRequest,
49
+ _request_timeout: Union[
50
+ None,
51
+ Annotated[StrictFloat, Field(gt=0)],
52
+ Tuple[
53
+ Annotated[StrictFloat, Field(gt=0)],
54
+ Annotated[StrictFloat, Field(gt=0)]
55
+ ]
56
+ ] = None,
57
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
58
+ _content_type: Optional[StrictStr] = None,
59
+ _headers: Optional[Dict[StrictStr, Any]] = None,
60
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
61
+ ) -> VPSV1MetricsMetricsCollection:
62
+ """Get metrics
63
+
64
+ This endpoint retrieves the historical metrics for a specified virtual machine. It includes the following metrics: - CPU usage - Memory usage - Disk usage - Network usage - Uptime
65
+
66
+ :param virtual_machine_id: Virtual Machine ID (required)
67
+ :type virtual_machine_id: int
68
+ :param vpsv1_virtual_machine_metric_get_request: (required)
69
+ :type vpsv1_virtual_machine_metric_get_request: VPSV1VirtualMachineMetricGetRequest
70
+ :param _request_timeout: timeout setting for this request. If one
71
+ number provided, it will be total request
72
+ timeout. It can also be a pair (tuple) of
73
+ (connection, read) timeouts.
74
+ :type _request_timeout: int, tuple(int, int), optional
75
+ :param _request_auth: set to override the auth_settings for an a single
76
+ request; this effectively ignores the
77
+ authentication in the spec for a single request.
78
+ :type _request_auth: dict, optional
79
+ :param _content_type: force content-type for the request.
80
+ :type _content_type: str, Optional
81
+ :param _headers: set to override the headers for a single
82
+ request; this effectively ignores the headers
83
+ in the spec for a single request.
84
+ :type _headers: dict, optional
85
+ :param _host_index: set to override the host_index for a single
86
+ request; this effectively ignores the host_index
87
+ in the spec for a single request.
88
+ :type _host_index: int, optional
89
+ :return: Returns the result object.
90
+ """ # noqa: E501
91
+
92
+ _param = self._get_metrics_v1_serialize(
93
+ virtual_machine_id=virtual_machine_id,
94
+ vpsv1_virtual_machine_metric_get_request=vpsv1_virtual_machine_metric_get_request,
95
+ _request_auth=_request_auth,
96
+ _content_type=_content_type,
97
+ _headers=_headers,
98
+ _host_index=_host_index
99
+ )
100
+
101
+ _response_types_map: Dict[str, Optional[str]] = {
102
+ '200': "VPSV1MetricsMetricsCollection",
103
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
104
+ '401': "CommonSchemaUnauthorizedResponseSchema",
105
+ '500': "CommonSchemaErrorResponseSchema",
106
+ }
107
+ response_data = self.api_client.call_api(
108
+ *_param,
109
+ _request_timeout=_request_timeout
110
+ )
111
+ response_data.read()
112
+ return self.api_client.response_deserialize(
113
+ response_data=response_data,
114
+ response_types_map=_response_types_map,
115
+ ).data
116
+
117
+
118
+ @validate_call
119
+ def get_metrics_v1_with_http_info(
120
+ self,
121
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
122
+ vpsv1_virtual_machine_metric_get_request: VPSV1VirtualMachineMetricGetRequest,
123
+ _request_timeout: Union[
124
+ None,
125
+ Annotated[StrictFloat, Field(gt=0)],
126
+ Tuple[
127
+ Annotated[StrictFloat, Field(gt=0)],
128
+ Annotated[StrictFloat, Field(gt=0)]
129
+ ]
130
+ ] = None,
131
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
132
+ _content_type: Optional[StrictStr] = None,
133
+ _headers: Optional[Dict[StrictStr, Any]] = None,
134
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
135
+ ) -> ApiResponse[VPSV1MetricsMetricsCollection]:
136
+ """Get metrics
137
+
138
+ This endpoint retrieves the historical metrics for a specified virtual machine. It includes the following metrics: - CPU usage - Memory usage - Disk usage - Network usage - Uptime
139
+
140
+ :param virtual_machine_id: Virtual Machine ID (required)
141
+ :type virtual_machine_id: int
142
+ :param vpsv1_virtual_machine_metric_get_request: (required)
143
+ :type vpsv1_virtual_machine_metric_get_request: VPSV1VirtualMachineMetricGetRequest
144
+ :param _request_timeout: timeout setting for this request. If one
145
+ number provided, it will be total request
146
+ timeout. It can also be a pair (tuple) of
147
+ (connection, read) timeouts.
148
+ :type _request_timeout: int, tuple(int, int), optional
149
+ :param _request_auth: set to override the auth_settings for an a single
150
+ request; this effectively ignores the
151
+ authentication in the spec for a single request.
152
+ :type _request_auth: dict, optional
153
+ :param _content_type: force content-type for the request.
154
+ :type _content_type: str, Optional
155
+ :param _headers: set to override the headers for a single
156
+ request; this effectively ignores the headers
157
+ in the spec for a single request.
158
+ :type _headers: dict, optional
159
+ :param _host_index: set to override the host_index for a single
160
+ request; this effectively ignores the host_index
161
+ in the spec for a single request.
162
+ :type _host_index: int, optional
163
+ :return: Returns the result object.
164
+ """ # noqa: E501
165
+
166
+ _param = self._get_metrics_v1_serialize(
167
+ virtual_machine_id=virtual_machine_id,
168
+ vpsv1_virtual_machine_metric_get_request=vpsv1_virtual_machine_metric_get_request,
169
+ _request_auth=_request_auth,
170
+ _content_type=_content_type,
171
+ _headers=_headers,
172
+ _host_index=_host_index
173
+ )
174
+
175
+ _response_types_map: Dict[str, Optional[str]] = {
176
+ '200': "VPSV1MetricsMetricsCollection",
177
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
178
+ '401': "CommonSchemaUnauthorizedResponseSchema",
179
+ '500': "CommonSchemaErrorResponseSchema",
180
+ }
181
+ response_data = self.api_client.call_api(
182
+ *_param,
183
+ _request_timeout=_request_timeout
184
+ )
185
+ response_data.read()
186
+ return self.api_client.response_deserialize(
187
+ response_data=response_data,
188
+ response_types_map=_response_types_map,
189
+ )
190
+
191
+
192
+ @validate_call
193
+ def get_metrics_v1_without_preload_content(
194
+ self,
195
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
196
+ vpsv1_virtual_machine_metric_get_request: VPSV1VirtualMachineMetricGetRequest,
197
+ _request_timeout: Union[
198
+ None,
199
+ Annotated[StrictFloat, Field(gt=0)],
200
+ Tuple[
201
+ Annotated[StrictFloat, Field(gt=0)],
202
+ Annotated[StrictFloat, Field(gt=0)]
203
+ ]
204
+ ] = None,
205
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
206
+ _content_type: Optional[StrictStr] = None,
207
+ _headers: Optional[Dict[StrictStr, Any]] = None,
208
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
209
+ ) -> RESTResponseType:
210
+ """Get metrics
211
+
212
+ This endpoint retrieves the historical metrics for a specified virtual machine. It includes the following metrics: - CPU usage - Memory usage - Disk usage - Network usage - Uptime
213
+
214
+ :param virtual_machine_id: Virtual Machine ID (required)
215
+ :type virtual_machine_id: int
216
+ :param vpsv1_virtual_machine_metric_get_request: (required)
217
+ :type vpsv1_virtual_machine_metric_get_request: VPSV1VirtualMachineMetricGetRequest
218
+ :param _request_timeout: timeout setting for this request. If one
219
+ number provided, it will be total request
220
+ timeout. It can also be a pair (tuple) of
221
+ (connection, read) timeouts.
222
+ :type _request_timeout: int, tuple(int, int), optional
223
+ :param _request_auth: set to override the auth_settings for an a single
224
+ request; this effectively ignores the
225
+ authentication in the spec for a single request.
226
+ :type _request_auth: dict, optional
227
+ :param _content_type: force content-type for the request.
228
+ :type _content_type: str, Optional
229
+ :param _headers: set to override the headers for a single
230
+ request; this effectively ignores the headers
231
+ in the spec for a single request.
232
+ :type _headers: dict, optional
233
+ :param _host_index: set to override the host_index for a single
234
+ request; this effectively ignores the host_index
235
+ in the spec for a single request.
236
+ :type _host_index: int, optional
237
+ :return: Returns the result object.
238
+ """ # noqa: E501
239
+
240
+ _param = self._get_metrics_v1_serialize(
241
+ virtual_machine_id=virtual_machine_id,
242
+ vpsv1_virtual_machine_metric_get_request=vpsv1_virtual_machine_metric_get_request,
243
+ _request_auth=_request_auth,
244
+ _content_type=_content_type,
245
+ _headers=_headers,
246
+ _host_index=_host_index
247
+ )
248
+
249
+ _response_types_map: Dict[str, Optional[str]] = {
250
+ '200': "VPSV1MetricsMetricsCollection",
251
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
252
+ '401': "CommonSchemaUnauthorizedResponseSchema",
253
+ '500': "CommonSchemaErrorResponseSchema",
254
+ }
255
+ response_data = self.api_client.call_api(
256
+ *_param,
257
+ _request_timeout=_request_timeout
258
+ )
259
+ return response_data.response
260
+
261
+
262
+ def _get_metrics_v1_serialize(
263
+ self,
264
+ virtual_machine_id,
265
+ vpsv1_virtual_machine_metric_get_request,
266
+ _request_auth,
267
+ _content_type,
268
+ _headers,
269
+ _host_index,
270
+ ) -> RequestSerialized:
271
+
272
+ _host = None
273
+
274
+ _collection_formats: Dict[str, str] = {
275
+ }
276
+
277
+ _path_params: Dict[str, str] = {}
278
+ _query_params: List[Tuple[str, str]] = []
279
+ _header_params: Dict[str, Optional[str]] = _headers or {}
280
+ _form_params: List[Tuple[str, str]] = []
281
+ _files: Dict[
282
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
283
+ ] = {}
284
+ _body_params: Optional[bytes] = None
285
+
286
+ # process the path parameters
287
+ if virtual_machine_id is not None:
288
+ _path_params['virtualMachineId'] = virtual_machine_id
289
+ # process the query parameters
290
+ # process the header parameters
291
+ # process the form parameters
292
+ # process the body parameter
293
+ if vpsv1_virtual_machine_metric_get_request is not None:
294
+ _body_params = vpsv1_virtual_machine_metric_get_request
295
+
296
+
297
+ # set the HTTP header `Accept`
298
+ if 'Accept' not in _header_params:
299
+ _header_params['Accept'] = self.api_client.select_header_accept(
300
+ [
301
+ 'application/json'
302
+ ]
303
+ )
304
+
305
+ # set the HTTP header `Content-Type`
306
+ if _content_type:
307
+ _header_params['Content-Type'] = _content_type
308
+ else:
309
+ _default_content_type = (
310
+ self.api_client.select_header_content_type(
311
+ [
312
+ 'application/json'
313
+ ]
314
+ )
315
+ )
316
+ if _default_content_type is not None:
317
+ _header_params['Content-Type'] = _default_content_type
318
+
319
+ # authentication setting
320
+ _auth_settings: List[str] = [
321
+ 'apiToken'
322
+ ]
323
+
324
+ return self.api_client.param_serialize(
325
+ method='GET',
326
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/metrics',
327
+ path_params=_path_params,
328
+ query_params=_query_params,
329
+ header_params=_header_params,
330
+ body=_body_params,
331
+ post_params=_form_params,
332
+ files=_files,
333
+ auth_settings=_auth_settings,
334
+ collection_formats=_collection_formats,
335
+ _host=_host,
336
+ _request_auth=_request_auth
337
+ )
338
+
339
+
340
+
341
+
342
+ @validate_call
343
+ def get_virtual_machine_list_v1(
344
+ self,
345
+ _request_timeout: Union[
346
+ None,
347
+ Annotated[StrictFloat, Field(gt=0)],
348
+ Tuple[
349
+ Annotated[StrictFloat, Field(gt=0)],
350
+ Annotated[StrictFloat, Field(gt=0)]
351
+ ]
352
+ ] = None,
353
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
354
+ _content_type: Optional[StrictStr] = None,
355
+ _headers: Optional[Dict[StrictStr, Any]] = None,
356
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
357
+ ) -> List[VPSV1VirtualMachineVirtualMachineResource]:
358
+ """Get virtual machine list
359
+
360
+ This endpoint retrieves a list of all available virtual machines.
361
+
362
+ :param _request_timeout: timeout setting for this request. If one
363
+ number provided, it will be total request
364
+ timeout. It can also be a pair (tuple) of
365
+ (connection, read) timeouts.
366
+ :type _request_timeout: int, tuple(int, int), optional
367
+ :param _request_auth: set to override the auth_settings for an a single
368
+ request; this effectively ignores the
369
+ authentication in the spec for a single request.
370
+ :type _request_auth: dict, optional
371
+ :param _content_type: force content-type for the request.
372
+ :type _content_type: str, Optional
373
+ :param _headers: set to override the headers for a single
374
+ request; this effectively ignores the headers
375
+ in the spec for a single request.
376
+ :type _headers: dict, optional
377
+ :param _host_index: set to override the host_index for a single
378
+ request; this effectively ignores the host_index
379
+ in the spec for a single request.
380
+ :type _host_index: int, optional
381
+ :return: Returns the result object.
382
+ """ # noqa: E501
383
+
384
+ _param = self._get_virtual_machine_list_v1_serialize(
385
+ _request_auth=_request_auth,
386
+ _content_type=_content_type,
387
+ _headers=_headers,
388
+ _host_index=_host_index
389
+ )
390
+
391
+ _response_types_map: Dict[str, Optional[str]] = {
392
+ '200': "List[VPSV1VirtualMachineVirtualMachineResource]",
393
+ '401': "CommonSchemaUnauthorizedResponseSchema",
394
+ '500': "CommonSchemaErrorResponseSchema",
395
+ }
396
+ response_data = self.api_client.call_api(
397
+ *_param,
398
+ _request_timeout=_request_timeout
399
+ )
400
+ response_data.read()
401
+ return self.api_client.response_deserialize(
402
+ response_data=response_data,
403
+ response_types_map=_response_types_map,
404
+ ).data
405
+
406
+
407
+ @validate_call
408
+ def get_virtual_machine_list_v1_with_http_info(
409
+ self,
410
+ _request_timeout: Union[
411
+ None,
412
+ Annotated[StrictFloat, Field(gt=0)],
413
+ Tuple[
414
+ Annotated[StrictFloat, Field(gt=0)],
415
+ Annotated[StrictFloat, Field(gt=0)]
416
+ ]
417
+ ] = None,
418
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
419
+ _content_type: Optional[StrictStr] = None,
420
+ _headers: Optional[Dict[StrictStr, Any]] = None,
421
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
422
+ ) -> ApiResponse[List[VPSV1VirtualMachineVirtualMachineResource]]:
423
+ """Get virtual machine list
424
+
425
+ This endpoint retrieves a list of all available virtual machines.
426
+
427
+ :param _request_timeout: timeout setting for this request. If one
428
+ number provided, it will be total request
429
+ timeout. It can also be a pair (tuple) of
430
+ (connection, read) timeouts.
431
+ :type _request_timeout: int, tuple(int, int), optional
432
+ :param _request_auth: set to override the auth_settings for an a single
433
+ request; this effectively ignores the
434
+ authentication in the spec for a single request.
435
+ :type _request_auth: dict, optional
436
+ :param _content_type: force content-type for the request.
437
+ :type _content_type: str, Optional
438
+ :param _headers: set to override the headers for a single
439
+ request; this effectively ignores the headers
440
+ in the spec for a single request.
441
+ :type _headers: dict, optional
442
+ :param _host_index: set to override the host_index for a single
443
+ request; this effectively ignores the host_index
444
+ in the spec for a single request.
445
+ :type _host_index: int, optional
446
+ :return: Returns the result object.
447
+ """ # noqa: E501
448
+
449
+ _param = self._get_virtual_machine_list_v1_serialize(
450
+ _request_auth=_request_auth,
451
+ _content_type=_content_type,
452
+ _headers=_headers,
453
+ _host_index=_host_index
454
+ )
455
+
456
+ _response_types_map: Dict[str, Optional[str]] = {
457
+ '200': "List[VPSV1VirtualMachineVirtualMachineResource]",
458
+ '401': "CommonSchemaUnauthorizedResponseSchema",
459
+ '500': "CommonSchemaErrorResponseSchema",
460
+ }
461
+ response_data = self.api_client.call_api(
462
+ *_param,
463
+ _request_timeout=_request_timeout
464
+ )
465
+ response_data.read()
466
+ return self.api_client.response_deserialize(
467
+ response_data=response_data,
468
+ response_types_map=_response_types_map,
469
+ )
470
+
471
+
472
+ @validate_call
473
+ def get_virtual_machine_list_v1_without_preload_content(
474
+ self,
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
+ """Get virtual machine list
489
+
490
+ This endpoint retrieves a list of all available virtual machines.
491
+
492
+ :param _request_timeout: timeout setting for this request. If one
493
+ number provided, it will be total request
494
+ timeout. It can also be a pair (tuple) of
495
+ (connection, read) timeouts.
496
+ :type _request_timeout: int, tuple(int, int), optional
497
+ :param _request_auth: set to override the auth_settings for an a single
498
+ request; this effectively ignores the
499
+ authentication in the spec for a single request.
500
+ :type _request_auth: dict, optional
501
+ :param _content_type: force content-type for the request.
502
+ :type _content_type: str, Optional
503
+ :param _headers: set to override the headers for a single
504
+ request; this effectively ignores the headers
505
+ in the spec for a single request.
506
+ :type _headers: dict, optional
507
+ :param _host_index: set to override the host_index for a single
508
+ request; this effectively ignores the host_index
509
+ in the spec for a single request.
510
+ :type _host_index: int, optional
511
+ :return: Returns the result object.
512
+ """ # noqa: E501
513
+
514
+ _param = self._get_virtual_machine_list_v1_serialize(
515
+ _request_auth=_request_auth,
516
+ _content_type=_content_type,
517
+ _headers=_headers,
518
+ _host_index=_host_index
519
+ )
520
+
521
+ _response_types_map: Dict[str, Optional[str]] = {
522
+ '200': "List[VPSV1VirtualMachineVirtualMachineResource]",
523
+ '401': "CommonSchemaUnauthorizedResponseSchema",
524
+ '500': "CommonSchemaErrorResponseSchema",
525
+ }
526
+ response_data = self.api_client.call_api(
527
+ *_param,
528
+ _request_timeout=_request_timeout
529
+ )
530
+ return response_data.response
531
+
532
+
533
+ def _get_virtual_machine_list_v1_serialize(
534
+ self,
535
+ _request_auth,
536
+ _content_type,
537
+ _headers,
538
+ _host_index,
539
+ ) -> RequestSerialized:
540
+
541
+ _host = None
542
+
543
+ _collection_formats: Dict[str, str] = {
544
+ }
545
+
546
+ _path_params: Dict[str, str] = {}
547
+ _query_params: List[Tuple[str, str]] = []
548
+ _header_params: Dict[str, Optional[str]] = _headers or {}
549
+ _form_params: List[Tuple[str, str]] = []
550
+ _files: Dict[
551
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
552
+ ] = {}
553
+ _body_params: Optional[bytes] = None
554
+
555
+ # process the path parameters
556
+ # process the query parameters
557
+ # process the header parameters
558
+ # process the form parameters
559
+ # process the body parameter
560
+
561
+
562
+ # set the HTTP header `Accept`
563
+ if 'Accept' not in _header_params:
564
+ _header_params['Accept'] = self.api_client.select_header_accept(
565
+ [
566
+ 'application/json'
567
+ ]
568
+ )
569
+
570
+
571
+ # authentication setting
572
+ _auth_settings: List[str] = [
573
+ 'apiToken'
574
+ ]
575
+
576
+ return self.api_client.param_serialize(
577
+ method='GET',
578
+ resource_path='/api/vps/v1/virtual-machines',
579
+ path_params=_path_params,
580
+ query_params=_query_params,
581
+ header_params=_header_params,
582
+ body=_body_params,
583
+ post_params=_form_params,
584
+ files=_files,
585
+ auth_settings=_auth_settings,
586
+ collection_formats=_collection_formats,
587
+ _host=_host,
588
+ _request_auth=_request_auth
589
+ )
590
+
591
+
592
+
593
+
594
+ @validate_call
595
+ def get_virtual_machine_v1(
596
+ self,
597
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
598
+ _request_timeout: Union[
599
+ None,
600
+ Annotated[StrictFloat, Field(gt=0)],
601
+ Tuple[
602
+ Annotated[StrictFloat, Field(gt=0)],
603
+ Annotated[StrictFloat, Field(gt=0)]
604
+ ]
605
+ ] = None,
606
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
607
+ _content_type: Optional[StrictStr] = None,
608
+ _headers: Optional[Dict[StrictStr, Any]] = None,
609
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
610
+ ) -> VPSV1VirtualMachineVirtualMachineResource:
611
+ """Get virtual machine
612
+
613
+ This endpoint retrieves detailed information about a specified virtual machine.
614
+
615
+ :param virtual_machine_id: Virtual Machine ID (required)
616
+ :type virtual_machine_id: int
617
+ :param _request_timeout: timeout setting for this request. If one
618
+ number provided, it will be total request
619
+ timeout. It can also be a pair (tuple) of
620
+ (connection, read) timeouts.
621
+ :type _request_timeout: int, tuple(int, int), optional
622
+ :param _request_auth: set to override the auth_settings for an a single
623
+ request; this effectively ignores the
624
+ authentication in the spec for a single request.
625
+ :type _request_auth: dict, optional
626
+ :param _content_type: force content-type for the request.
627
+ :type _content_type: str, Optional
628
+ :param _headers: set to override the headers for a single
629
+ request; this effectively ignores the headers
630
+ in the spec for a single request.
631
+ :type _headers: dict, optional
632
+ :param _host_index: set to override the host_index for a single
633
+ request; this effectively ignores the host_index
634
+ in the spec for a single request.
635
+ :type _host_index: int, optional
636
+ :return: Returns the result object.
637
+ """ # noqa: E501
638
+
639
+ _param = self._get_virtual_machine_v1_serialize(
640
+ virtual_machine_id=virtual_machine_id,
641
+ _request_auth=_request_auth,
642
+ _content_type=_content_type,
643
+ _headers=_headers,
644
+ _host_index=_host_index
645
+ )
646
+
647
+ _response_types_map: Dict[str, Optional[str]] = {
648
+ '200': "VPSV1VirtualMachineVirtualMachineResource",
649
+ '401': "CommonSchemaUnauthorizedResponseSchema",
650
+ '500': "CommonSchemaErrorResponseSchema",
651
+ }
652
+ response_data = self.api_client.call_api(
653
+ *_param,
654
+ _request_timeout=_request_timeout
655
+ )
656
+ response_data.read()
657
+ return self.api_client.response_deserialize(
658
+ response_data=response_data,
659
+ response_types_map=_response_types_map,
660
+ ).data
661
+
662
+
663
+ @validate_call
664
+ def get_virtual_machine_v1_with_http_info(
665
+ self,
666
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
667
+ _request_timeout: Union[
668
+ None,
669
+ Annotated[StrictFloat, Field(gt=0)],
670
+ Tuple[
671
+ Annotated[StrictFloat, Field(gt=0)],
672
+ Annotated[StrictFloat, Field(gt=0)]
673
+ ]
674
+ ] = None,
675
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
676
+ _content_type: Optional[StrictStr] = None,
677
+ _headers: Optional[Dict[StrictStr, Any]] = None,
678
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
679
+ ) -> ApiResponse[VPSV1VirtualMachineVirtualMachineResource]:
680
+ """Get virtual machine
681
+
682
+ This endpoint retrieves detailed information about a specified virtual machine.
683
+
684
+ :param virtual_machine_id: Virtual Machine ID (required)
685
+ :type virtual_machine_id: int
686
+ :param _request_timeout: timeout setting for this request. If one
687
+ number provided, it will be total request
688
+ timeout. It can also be a pair (tuple) of
689
+ (connection, read) timeouts.
690
+ :type _request_timeout: int, tuple(int, int), optional
691
+ :param _request_auth: set to override the auth_settings for an a single
692
+ request; this effectively ignores the
693
+ authentication in the spec for a single request.
694
+ :type _request_auth: dict, optional
695
+ :param _content_type: force content-type for the request.
696
+ :type _content_type: str, Optional
697
+ :param _headers: set to override the headers for a single
698
+ request; this effectively ignores the headers
699
+ in the spec for a single request.
700
+ :type _headers: dict, optional
701
+ :param _host_index: set to override the host_index for a single
702
+ request; this effectively ignores the host_index
703
+ in the spec for a single request.
704
+ :type _host_index: int, optional
705
+ :return: Returns the result object.
706
+ """ # noqa: E501
707
+
708
+ _param = self._get_virtual_machine_v1_serialize(
709
+ virtual_machine_id=virtual_machine_id,
710
+ _request_auth=_request_auth,
711
+ _content_type=_content_type,
712
+ _headers=_headers,
713
+ _host_index=_host_index
714
+ )
715
+
716
+ _response_types_map: Dict[str, Optional[str]] = {
717
+ '200': "VPSV1VirtualMachineVirtualMachineResource",
718
+ '401': "CommonSchemaUnauthorizedResponseSchema",
719
+ '500': "CommonSchemaErrorResponseSchema",
720
+ }
721
+ response_data = self.api_client.call_api(
722
+ *_param,
723
+ _request_timeout=_request_timeout
724
+ )
725
+ response_data.read()
726
+ return self.api_client.response_deserialize(
727
+ response_data=response_data,
728
+ response_types_map=_response_types_map,
729
+ )
730
+
731
+
732
+ @validate_call
733
+ def get_virtual_machine_v1_without_preload_content(
734
+ self,
735
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
736
+ _request_timeout: Union[
737
+ None,
738
+ Annotated[StrictFloat, Field(gt=0)],
739
+ Tuple[
740
+ Annotated[StrictFloat, Field(gt=0)],
741
+ Annotated[StrictFloat, Field(gt=0)]
742
+ ]
743
+ ] = None,
744
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
745
+ _content_type: Optional[StrictStr] = None,
746
+ _headers: Optional[Dict[StrictStr, Any]] = None,
747
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
748
+ ) -> RESTResponseType:
749
+ """Get virtual machine
750
+
751
+ This endpoint retrieves detailed information about a specified virtual machine.
752
+
753
+ :param virtual_machine_id: Virtual Machine ID (required)
754
+ :type virtual_machine_id: int
755
+ :param _request_timeout: timeout setting for this request. If one
756
+ number provided, it will be total request
757
+ timeout. It can also be a pair (tuple) of
758
+ (connection, read) timeouts.
759
+ :type _request_timeout: int, tuple(int, int), optional
760
+ :param _request_auth: set to override the auth_settings for an a single
761
+ request; this effectively ignores the
762
+ authentication in the spec for a single request.
763
+ :type _request_auth: dict, optional
764
+ :param _content_type: force content-type for the request.
765
+ :type _content_type: str, Optional
766
+ :param _headers: set to override the headers for a single
767
+ request; this effectively ignores the headers
768
+ in the spec for a single request.
769
+ :type _headers: dict, optional
770
+ :param _host_index: set to override the host_index for a single
771
+ request; this effectively ignores the host_index
772
+ in the spec for a single request.
773
+ :type _host_index: int, optional
774
+ :return: Returns the result object.
775
+ """ # noqa: E501
776
+
777
+ _param = self._get_virtual_machine_v1_serialize(
778
+ virtual_machine_id=virtual_machine_id,
779
+ _request_auth=_request_auth,
780
+ _content_type=_content_type,
781
+ _headers=_headers,
782
+ _host_index=_host_index
783
+ )
784
+
785
+ _response_types_map: Dict[str, Optional[str]] = {
786
+ '200': "VPSV1VirtualMachineVirtualMachineResource",
787
+ '401': "CommonSchemaUnauthorizedResponseSchema",
788
+ '500': "CommonSchemaErrorResponseSchema",
789
+ }
790
+ response_data = self.api_client.call_api(
791
+ *_param,
792
+ _request_timeout=_request_timeout
793
+ )
794
+ return response_data.response
795
+
796
+
797
+ def _get_virtual_machine_v1_serialize(
798
+ self,
799
+ virtual_machine_id,
800
+ _request_auth,
801
+ _content_type,
802
+ _headers,
803
+ _host_index,
804
+ ) -> RequestSerialized:
805
+
806
+ _host = None
807
+
808
+ _collection_formats: Dict[str, str] = {
809
+ }
810
+
811
+ _path_params: Dict[str, str] = {}
812
+ _query_params: List[Tuple[str, str]] = []
813
+ _header_params: Dict[str, Optional[str]] = _headers or {}
814
+ _form_params: List[Tuple[str, str]] = []
815
+ _files: Dict[
816
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
817
+ ] = {}
818
+ _body_params: Optional[bytes] = None
819
+
820
+ # process the path parameters
821
+ if virtual_machine_id is not None:
822
+ _path_params['virtualMachineId'] = virtual_machine_id
823
+ # process the query parameters
824
+ # process the header parameters
825
+ # process the form parameters
826
+ # process the body parameter
827
+
828
+
829
+ # set the HTTP header `Accept`
830
+ if 'Accept' not in _header_params:
831
+ _header_params['Accept'] = self.api_client.select_header_accept(
832
+ [
833
+ 'application/json'
834
+ ]
835
+ )
836
+
837
+
838
+ # authentication setting
839
+ _auth_settings: List[str] = [
840
+ 'apiToken'
841
+ ]
842
+
843
+ return self.api_client.param_serialize(
844
+ method='GET',
845
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}',
846
+ path_params=_path_params,
847
+ query_params=_query_params,
848
+ header_params=_header_params,
849
+ body=_body_params,
850
+ post_params=_form_params,
851
+ files=_files,
852
+ auth_settings=_auth_settings,
853
+ collection_formats=_collection_formats,
854
+ _host=_host,
855
+ _request_auth=_request_auth
856
+ )
857
+
858
+
859
+
860
+
861
+ @validate_call
862
+ def recreate_virtual_machine_v1(
863
+ self,
864
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
865
+ vpsv1_virtual_machine_recreate_request: VPSV1VirtualMachineRecreateRequest,
866
+ _request_timeout: Union[
867
+ None,
868
+ Annotated[StrictFloat, Field(gt=0)],
869
+ Tuple[
870
+ Annotated[StrictFloat, Field(gt=0)],
871
+ Annotated[StrictFloat, Field(gt=0)]
872
+ ]
873
+ ] = None,
874
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
875
+ _content_type: Optional[StrictStr] = None,
876
+ _headers: Optional[Dict[StrictStr, Any]] = None,
877
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
878
+ ) -> VPSV1ActionActionResource:
879
+ """Recreate virtual machine
880
+
881
+ This endpoint will recreate a virtual machine from scratch. The recreation process involves reinstalling the operating system and resetting the virtual machine to its initial state. Snapshots, if there are any, will be deleted. ## Password Requirements Password will be checked against leaked password databases. Requirements for the password are: - At least 8 characters long - At least one uppercase letter - At least one lowercase letter - At least one number - Is not leaked publicly **This operation is irreversible and will result in the loss of all data stored on the virtual machine!**
882
+
883
+ :param virtual_machine_id: Virtual Machine ID (required)
884
+ :type virtual_machine_id: int
885
+ :param vpsv1_virtual_machine_recreate_request: (required)
886
+ :type vpsv1_virtual_machine_recreate_request: VPSV1VirtualMachineRecreateRequest
887
+ :param _request_timeout: timeout setting for this request. If one
888
+ number provided, it will be total request
889
+ timeout. It can also be a pair (tuple) of
890
+ (connection, read) timeouts.
891
+ :type _request_timeout: int, tuple(int, int), optional
892
+ :param _request_auth: set to override the auth_settings for an a single
893
+ request; this effectively ignores the
894
+ authentication in the spec for a single request.
895
+ :type _request_auth: dict, optional
896
+ :param _content_type: force content-type for the request.
897
+ :type _content_type: str, Optional
898
+ :param _headers: set to override the headers for a single
899
+ request; this effectively ignores the headers
900
+ in the spec for a single request.
901
+ :type _headers: dict, optional
902
+ :param _host_index: set to override the host_index for a single
903
+ request; this effectively ignores the host_index
904
+ in the spec for a single request.
905
+ :type _host_index: int, optional
906
+ :return: Returns the result object.
907
+ """ # noqa: E501
908
+
909
+ _param = self._recreate_virtual_machine_v1_serialize(
910
+ virtual_machine_id=virtual_machine_id,
911
+ vpsv1_virtual_machine_recreate_request=vpsv1_virtual_machine_recreate_request,
912
+ _request_auth=_request_auth,
913
+ _content_type=_content_type,
914
+ _headers=_headers,
915
+ _host_index=_host_index
916
+ )
917
+
918
+ _response_types_map: Dict[str, Optional[str]] = {
919
+ '200': "VPSV1ActionActionResource",
920
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
921
+ '401': "CommonSchemaUnauthorizedResponseSchema",
922
+ '500': "CommonSchemaErrorResponseSchema",
923
+ }
924
+ response_data = self.api_client.call_api(
925
+ *_param,
926
+ _request_timeout=_request_timeout
927
+ )
928
+ response_data.read()
929
+ return self.api_client.response_deserialize(
930
+ response_data=response_data,
931
+ response_types_map=_response_types_map,
932
+ ).data
933
+
934
+
935
+ @validate_call
936
+ def recreate_virtual_machine_v1_with_http_info(
937
+ self,
938
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
939
+ vpsv1_virtual_machine_recreate_request: VPSV1VirtualMachineRecreateRequest,
940
+ _request_timeout: Union[
941
+ None,
942
+ Annotated[StrictFloat, Field(gt=0)],
943
+ Tuple[
944
+ Annotated[StrictFloat, Field(gt=0)],
945
+ Annotated[StrictFloat, Field(gt=0)]
946
+ ]
947
+ ] = None,
948
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
949
+ _content_type: Optional[StrictStr] = None,
950
+ _headers: Optional[Dict[StrictStr, Any]] = None,
951
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
952
+ ) -> ApiResponse[VPSV1ActionActionResource]:
953
+ """Recreate virtual machine
954
+
955
+ This endpoint will recreate a virtual machine from scratch. The recreation process involves reinstalling the operating system and resetting the virtual machine to its initial state. Snapshots, if there are any, will be deleted. ## Password Requirements Password will be checked against leaked password databases. Requirements for the password are: - At least 8 characters long - At least one uppercase letter - At least one lowercase letter - At least one number - Is not leaked publicly **This operation is irreversible and will result in the loss of all data stored on the virtual machine!**
956
+
957
+ :param virtual_machine_id: Virtual Machine ID (required)
958
+ :type virtual_machine_id: int
959
+ :param vpsv1_virtual_machine_recreate_request: (required)
960
+ :type vpsv1_virtual_machine_recreate_request: VPSV1VirtualMachineRecreateRequest
961
+ :param _request_timeout: timeout setting for this request. If one
962
+ number provided, it will be total request
963
+ timeout. It can also be a pair (tuple) of
964
+ (connection, read) timeouts.
965
+ :type _request_timeout: int, tuple(int, int), optional
966
+ :param _request_auth: set to override the auth_settings for an a single
967
+ request; this effectively ignores the
968
+ authentication in the spec for a single request.
969
+ :type _request_auth: dict, optional
970
+ :param _content_type: force content-type for the request.
971
+ :type _content_type: str, Optional
972
+ :param _headers: set to override the headers for a single
973
+ request; this effectively ignores the headers
974
+ in the spec for a single request.
975
+ :type _headers: dict, optional
976
+ :param _host_index: set to override the host_index for a single
977
+ request; this effectively ignores the host_index
978
+ in the spec for a single request.
979
+ :type _host_index: int, optional
980
+ :return: Returns the result object.
981
+ """ # noqa: E501
982
+
983
+ _param = self._recreate_virtual_machine_v1_serialize(
984
+ virtual_machine_id=virtual_machine_id,
985
+ vpsv1_virtual_machine_recreate_request=vpsv1_virtual_machine_recreate_request,
986
+ _request_auth=_request_auth,
987
+ _content_type=_content_type,
988
+ _headers=_headers,
989
+ _host_index=_host_index
990
+ )
991
+
992
+ _response_types_map: Dict[str, Optional[str]] = {
993
+ '200': "VPSV1ActionActionResource",
994
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
995
+ '401': "CommonSchemaUnauthorizedResponseSchema",
996
+ '500': "CommonSchemaErrorResponseSchema",
997
+ }
998
+ response_data = self.api_client.call_api(
999
+ *_param,
1000
+ _request_timeout=_request_timeout
1001
+ )
1002
+ response_data.read()
1003
+ return self.api_client.response_deserialize(
1004
+ response_data=response_data,
1005
+ response_types_map=_response_types_map,
1006
+ )
1007
+
1008
+
1009
+ @validate_call
1010
+ def recreate_virtual_machine_v1_without_preload_content(
1011
+ self,
1012
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1013
+ vpsv1_virtual_machine_recreate_request: VPSV1VirtualMachineRecreateRequest,
1014
+ _request_timeout: Union[
1015
+ None,
1016
+ Annotated[StrictFloat, Field(gt=0)],
1017
+ Tuple[
1018
+ Annotated[StrictFloat, Field(gt=0)],
1019
+ Annotated[StrictFloat, Field(gt=0)]
1020
+ ]
1021
+ ] = None,
1022
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1023
+ _content_type: Optional[StrictStr] = None,
1024
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1025
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1026
+ ) -> RESTResponseType:
1027
+ """Recreate virtual machine
1028
+
1029
+ This endpoint will recreate a virtual machine from scratch. The recreation process involves reinstalling the operating system and resetting the virtual machine to its initial state. Snapshots, if there are any, will be deleted. ## Password Requirements Password will be checked against leaked password databases. Requirements for the password are: - At least 8 characters long - At least one uppercase letter - At least one lowercase letter - At least one number - Is not leaked publicly **This operation is irreversible and will result in the loss of all data stored on the virtual machine!**
1030
+
1031
+ :param virtual_machine_id: Virtual Machine ID (required)
1032
+ :type virtual_machine_id: int
1033
+ :param vpsv1_virtual_machine_recreate_request: (required)
1034
+ :type vpsv1_virtual_machine_recreate_request: VPSV1VirtualMachineRecreateRequest
1035
+ :param _request_timeout: timeout setting for this request. If one
1036
+ number provided, it will be total request
1037
+ timeout. It can also be a pair (tuple) of
1038
+ (connection, read) timeouts.
1039
+ :type _request_timeout: int, tuple(int, int), optional
1040
+ :param _request_auth: set to override the auth_settings for an a single
1041
+ request; this effectively ignores the
1042
+ authentication in the spec for a single request.
1043
+ :type _request_auth: dict, optional
1044
+ :param _content_type: force content-type for the request.
1045
+ :type _content_type: str, Optional
1046
+ :param _headers: set to override the headers for a single
1047
+ request; this effectively ignores the headers
1048
+ in the spec for a single request.
1049
+ :type _headers: dict, optional
1050
+ :param _host_index: set to override the host_index for a single
1051
+ request; this effectively ignores the host_index
1052
+ in the spec for a single request.
1053
+ :type _host_index: int, optional
1054
+ :return: Returns the result object.
1055
+ """ # noqa: E501
1056
+
1057
+ _param = self._recreate_virtual_machine_v1_serialize(
1058
+ virtual_machine_id=virtual_machine_id,
1059
+ vpsv1_virtual_machine_recreate_request=vpsv1_virtual_machine_recreate_request,
1060
+ _request_auth=_request_auth,
1061
+ _content_type=_content_type,
1062
+ _headers=_headers,
1063
+ _host_index=_host_index
1064
+ )
1065
+
1066
+ _response_types_map: Dict[str, Optional[str]] = {
1067
+ '200': "VPSV1ActionActionResource",
1068
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
1069
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1070
+ '500': "CommonSchemaErrorResponseSchema",
1071
+ }
1072
+ response_data = self.api_client.call_api(
1073
+ *_param,
1074
+ _request_timeout=_request_timeout
1075
+ )
1076
+ return response_data.response
1077
+
1078
+
1079
+ def _recreate_virtual_machine_v1_serialize(
1080
+ self,
1081
+ virtual_machine_id,
1082
+ vpsv1_virtual_machine_recreate_request,
1083
+ _request_auth,
1084
+ _content_type,
1085
+ _headers,
1086
+ _host_index,
1087
+ ) -> RequestSerialized:
1088
+
1089
+ _host = None
1090
+
1091
+ _collection_formats: Dict[str, str] = {
1092
+ }
1093
+
1094
+ _path_params: Dict[str, str] = {}
1095
+ _query_params: List[Tuple[str, str]] = []
1096
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1097
+ _form_params: List[Tuple[str, str]] = []
1098
+ _files: Dict[
1099
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1100
+ ] = {}
1101
+ _body_params: Optional[bytes] = None
1102
+
1103
+ # process the path parameters
1104
+ if virtual_machine_id is not None:
1105
+ _path_params['virtualMachineId'] = virtual_machine_id
1106
+ # process the query parameters
1107
+ # process the header parameters
1108
+ # process the form parameters
1109
+ # process the body parameter
1110
+ if vpsv1_virtual_machine_recreate_request is not None:
1111
+ _body_params = vpsv1_virtual_machine_recreate_request
1112
+
1113
+
1114
+ # set the HTTP header `Accept`
1115
+ if 'Accept' not in _header_params:
1116
+ _header_params['Accept'] = self.api_client.select_header_accept(
1117
+ [
1118
+ 'application/json'
1119
+ ]
1120
+ )
1121
+
1122
+ # set the HTTP header `Content-Type`
1123
+ if _content_type:
1124
+ _header_params['Content-Type'] = _content_type
1125
+ else:
1126
+ _default_content_type = (
1127
+ self.api_client.select_header_content_type(
1128
+ [
1129
+ 'application/json'
1130
+ ]
1131
+ )
1132
+ )
1133
+ if _default_content_type is not None:
1134
+ _header_params['Content-Type'] = _default_content_type
1135
+
1136
+ # authentication setting
1137
+ _auth_settings: List[str] = [
1138
+ 'apiToken'
1139
+ ]
1140
+
1141
+ return self.api_client.param_serialize(
1142
+ method='POST',
1143
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/recreate',
1144
+ path_params=_path_params,
1145
+ query_params=_query_params,
1146
+ header_params=_header_params,
1147
+ body=_body_params,
1148
+ post_params=_form_params,
1149
+ files=_files,
1150
+ auth_settings=_auth_settings,
1151
+ collection_formats=_collection_formats,
1152
+ _host=_host,
1153
+ _request_auth=_request_auth
1154
+ )
1155
+
1156
+
1157
+
1158
+
1159
+ @validate_call
1160
+ def reset_hostname_v1(
1161
+ self,
1162
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1163
+ _request_timeout: Union[
1164
+ None,
1165
+ Annotated[StrictFloat, Field(gt=0)],
1166
+ Tuple[
1167
+ Annotated[StrictFloat, Field(gt=0)],
1168
+ Annotated[StrictFloat, Field(gt=0)]
1169
+ ]
1170
+ ] = None,
1171
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1172
+ _content_type: Optional[StrictStr] = None,
1173
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1174
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1175
+ ) -> VPSV1ActionActionResource:
1176
+ """Reset hostname
1177
+
1178
+ This endpoint resets the hostname and PTR record of a specified virtual machine to the default value.
1179
+
1180
+ :param virtual_machine_id: Virtual Machine ID (required)
1181
+ :type virtual_machine_id: int
1182
+ :param _request_timeout: timeout setting for this request. If one
1183
+ number provided, it will be total request
1184
+ timeout. It can also be a pair (tuple) of
1185
+ (connection, read) timeouts.
1186
+ :type _request_timeout: int, tuple(int, int), optional
1187
+ :param _request_auth: set to override the auth_settings for an a single
1188
+ request; this effectively ignores the
1189
+ authentication in the spec for a single request.
1190
+ :type _request_auth: dict, optional
1191
+ :param _content_type: force content-type for the request.
1192
+ :type _content_type: str, Optional
1193
+ :param _headers: set to override the headers for a single
1194
+ request; this effectively ignores the headers
1195
+ in the spec for a single request.
1196
+ :type _headers: dict, optional
1197
+ :param _host_index: set to override the host_index for a single
1198
+ request; this effectively ignores the host_index
1199
+ in the spec for a single request.
1200
+ :type _host_index: int, optional
1201
+ :return: Returns the result object.
1202
+ """ # noqa: E501
1203
+
1204
+ _param = self._reset_hostname_v1_serialize(
1205
+ virtual_machine_id=virtual_machine_id,
1206
+ _request_auth=_request_auth,
1207
+ _content_type=_content_type,
1208
+ _headers=_headers,
1209
+ _host_index=_host_index
1210
+ )
1211
+
1212
+ _response_types_map: Dict[str, Optional[str]] = {
1213
+ '200': "VPSV1ActionActionResource",
1214
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1215
+ '500': "CommonSchemaErrorResponseSchema",
1216
+ }
1217
+ response_data = self.api_client.call_api(
1218
+ *_param,
1219
+ _request_timeout=_request_timeout
1220
+ )
1221
+ response_data.read()
1222
+ return self.api_client.response_deserialize(
1223
+ response_data=response_data,
1224
+ response_types_map=_response_types_map,
1225
+ ).data
1226
+
1227
+
1228
+ @validate_call
1229
+ def reset_hostname_v1_with_http_info(
1230
+ self,
1231
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1232
+ _request_timeout: Union[
1233
+ None,
1234
+ Annotated[StrictFloat, Field(gt=0)],
1235
+ Tuple[
1236
+ Annotated[StrictFloat, Field(gt=0)],
1237
+ Annotated[StrictFloat, Field(gt=0)]
1238
+ ]
1239
+ ] = None,
1240
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1241
+ _content_type: Optional[StrictStr] = None,
1242
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1243
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1244
+ ) -> ApiResponse[VPSV1ActionActionResource]:
1245
+ """Reset hostname
1246
+
1247
+ This endpoint resets the hostname and PTR record of a specified virtual machine to the default value.
1248
+
1249
+ :param virtual_machine_id: Virtual Machine ID (required)
1250
+ :type virtual_machine_id: int
1251
+ :param _request_timeout: timeout setting for this request. If one
1252
+ number provided, it will be total request
1253
+ timeout. It can also be a pair (tuple) of
1254
+ (connection, read) timeouts.
1255
+ :type _request_timeout: int, tuple(int, int), optional
1256
+ :param _request_auth: set to override the auth_settings for an a single
1257
+ request; this effectively ignores the
1258
+ authentication in the spec for a single request.
1259
+ :type _request_auth: dict, optional
1260
+ :param _content_type: force content-type for the request.
1261
+ :type _content_type: str, Optional
1262
+ :param _headers: set to override the headers for a single
1263
+ request; this effectively ignores the headers
1264
+ in the spec for a single request.
1265
+ :type _headers: dict, optional
1266
+ :param _host_index: set to override the host_index for a single
1267
+ request; this effectively ignores the host_index
1268
+ in the spec for a single request.
1269
+ :type _host_index: int, optional
1270
+ :return: Returns the result object.
1271
+ """ # noqa: E501
1272
+
1273
+ _param = self._reset_hostname_v1_serialize(
1274
+ virtual_machine_id=virtual_machine_id,
1275
+ _request_auth=_request_auth,
1276
+ _content_type=_content_type,
1277
+ _headers=_headers,
1278
+ _host_index=_host_index
1279
+ )
1280
+
1281
+ _response_types_map: Dict[str, Optional[str]] = {
1282
+ '200': "VPSV1ActionActionResource",
1283
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1284
+ '500': "CommonSchemaErrorResponseSchema",
1285
+ }
1286
+ response_data = self.api_client.call_api(
1287
+ *_param,
1288
+ _request_timeout=_request_timeout
1289
+ )
1290
+ response_data.read()
1291
+ return self.api_client.response_deserialize(
1292
+ response_data=response_data,
1293
+ response_types_map=_response_types_map,
1294
+ )
1295
+
1296
+
1297
+ @validate_call
1298
+ def reset_hostname_v1_without_preload_content(
1299
+ self,
1300
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1301
+ _request_timeout: Union[
1302
+ None,
1303
+ Annotated[StrictFloat, Field(gt=0)],
1304
+ Tuple[
1305
+ Annotated[StrictFloat, Field(gt=0)],
1306
+ Annotated[StrictFloat, Field(gt=0)]
1307
+ ]
1308
+ ] = None,
1309
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1310
+ _content_type: Optional[StrictStr] = None,
1311
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1312
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1313
+ ) -> RESTResponseType:
1314
+ """Reset hostname
1315
+
1316
+ This endpoint resets the hostname and PTR record of a specified virtual machine to the default value.
1317
+
1318
+ :param virtual_machine_id: Virtual Machine ID (required)
1319
+ :type virtual_machine_id: int
1320
+ :param _request_timeout: timeout setting for this request. If one
1321
+ number provided, it will be total request
1322
+ timeout. It can also be a pair (tuple) of
1323
+ (connection, read) timeouts.
1324
+ :type _request_timeout: int, tuple(int, int), optional
1325
+ :param _request_auth: set to override the auth_settings for an a single
1326
+ request; this effectively ignores the
1327
+ authentication in the spec for a single request.
1328
+ :type _request_auth: dict, optional
1329
+ :param _content_type: force content-type for the request.
1330
+ :type _content_type: str, Optional
1331
+ :param _headers: set to override the headers for a single
1332
+ request; this effectively ignores the headers
1333
+ in the spec for a single request.
1334
+ :type _headers: dict, optional
1335
+ :param _host_index: set to override the host_index for a single
1336
+ request; this effectively ignores the host_index
1337
+ in the spec for a single request.
1338
+ :type _host_index: int, optional
1339
+ :return: Returns the result object.
1340
+ """ # noqa: E501
1341
+
1342
+ _param = self._reset_hostname_v1_serialize(
1343
+ virtual_machine_id=virtual_machine_id,
1344
+ _request_auth=_request_auth,
1345
+ _content_type=_content_type,
1346
+ _headers=_headers,
1347
+ _host_index=_host_index
1348
+ )
1349
+
1350
+ _response_types_map: Dict[str, Optional[str]] = {
1351
+ '200': "VPSV1ActionActionResource",
1352
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1353
+ '500': "CommonSchemaErrorResponseSchema",
1354
+ }
1355
+ response_data = self.api_client.call_api(
1356
+ *_param,
1357
+ _request_timeout=_request_timeout
1358
+ )
1359
+ return response_data.response
1360
+
1361
+
1362
+ def _reset_hostname_v1_serialize(
1363
+ self,
1364
+ virtual_machine_id,
1365
+ _request_auth,
1366
+ _content_type,
1367
+ _headers,
1368
+ _host_index,
1369
+ ) -> RequestSerialized:
1370
+
1371
+ _host = None
1372
+
1373
+ _collection_formats: Dict[str, str] = {
1374
+ }
1375
+
1376
+ _path_params: Dict[str, str] = {}
1377
+ _query_params: List[Tuple[str, str]] = []
1378
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1379
+ _form_params: List[Tuple[str, str]] = []
1380
+ _files: Dict[
1381
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1382
+ ] = {}
1383
+ _body_params: Optional[bytes] = None
1384
+
1385
+ # process the path parameters
1386
+ if virtual_machine_id is not None:
1387
+ _path_params['virtualMachineId'] = virtual_machine_id
1388
+ # process the query parameters
1389
+ # process the header parameters
1390
+ # process the form parameters
1391
+ # process the body parameter
1392
+
1393
+
1394
+ # set the HTTP header `Accept`
1395
+ if 'Accept' not in _header_params:
1396
+ _header_params['Accept'] = self.api_client.select_header_accept(
1397
+ [
1398
+ 'application/json'
1399
+ ]
1400
+ )
1401
+
1402
+
1403
+ # authentication setting
1404
+ _auth_settings: List[str] = [
1405
+ 'apiToken'
1406
+ ]
1407
+
1408
+ return self.api_client.param_serialize(
1409
+ method='DELETE',
1410
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/hostname',
1411
+ path_params=_path_params,
1412
+ query_params=_query_params,
1413
+ header_params=_header_params,
1414
+ body=_body_params,
1415
+ post_params=_form_params,
1416
+ files=_files,
1417
+ auth_settings=_auth_settings,
1418
+ collection_formats=_collection_formats,
1419
+ _host=_host,
1420
+ _request_auth=_request_auth
1421
+ )
1422
+
1423
+
1424
+
1425
+
1426
+ @validate_call
1427
+ def restart_virtual_machine_v1(
1428
+ self,
1429
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1430
+ _request_timeout: Union[
1431
+ None,
1432
+ Annotated[StrictFloat, Field(gt=0)],
1433
+ Tuple[
1434
+ Annotated[StrictFloat, Field(gt=0)],
1435
+ Annotated[StrictFloat, Field(gt=0)]
1436
+ ]
1437
+ ] = None,
1438
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1439
+ _content_type: Optional[StrictStr] = None,
1440
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1441
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1442
+ ) -> VPSV1ActionActionResource:
1443
+ """Restart virtual machine
1444
+
1445
+ This endpoint restarts a specified virtual machine. This is equivalent to fully stopping and starting the virtual machine. If the virtual machine was stopped, it will be started.
1446
+
1447
+ :param virtual_machine_id: Virtual Machine ID (required)
1448
+ :type virtual_machine_id: int
1449
+ :param _request_timeout: timeout setting for this request. If one
1450
+ number provided, it will be total request
1451
+ timeout. It can also be a pair (tuple) of
1452
+ (connection, read) timeouts.
1453
+ :type _request_timeout: int, tuple(int, int), optional
1454
+ :param _request_auth: set to override the auth_settings for an a single
1455
+ request; this effectively ignores the
1456
+ authentication in the spec for a single request.
1457
+ :type _request_auth: dict, optional
1458
+ :param _content_type: force content-type for the request.
1459
+ :type _content_type: str, Optional
1460
+ :param _headers: set to override the headers for a single
1461
+ request; this effectively ignores the headers
1462
+ in the spec for a single request.
1463
+ :type _headers: dict, optional
1464
+ :param _host_index: set to override the host_index for a single
1465
+ request; this effectively ignores the host_index
1466
+ in the spec for a single request.
1467
+ :type _host_index: int, optional
1468
+ :return: Returns the result object.
1469
+ """ # noqa: E501
1470
+
1471
+ _param = self._restart_virtual_machine_v1_serialize(
1472
+ virtual_machine_id=virtual_machine_id,
1473
+ _request_auth=_request_auth,
1474
+ _content_type=_content_type,
1475
+ _headers=_headers,
1476
+ _host_index=_host_index
1477
+ )
1478
+
1479
+ _response_types_map: Dict[str, Optional[str]] = {
1480
+ '200': "VPSV1ActionActionResource",
1481
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1482
+ '500': "CommonSchemaErrorResponseSchema",
1483
+ }
1484
+ response_data = self.api_client.call_api(
1485
+ *_param,
1486
+ _request_timeout=_request_timeout
1487
+ )
1488
+ response_data.read()
1489
+ return self.api_client.response_deserialize(
1490
+ response_data=response_data,
1491
+ response_types_map=_response_types_map,
1492
+ ).data
1493
+
1494
+
1495
+ @validate_call
1496
+ def restart_virtual_machine_v1_with_http_info(
1497
+ self,
1498
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1499
+ _request_timeout: Union[
1500
+ None,
1501
+ Annotated[StrictFloat, Field(gt=0)],
1502
+ Tuple[
1503
+ Annotated[StrictFloat, Field(gt=0)],
1504
+ Annotated[StrictFloat, Field(gt=0)]
1505
+ ]
1506
+ ] = None,
1507
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1508
+ _content_type: Optional[StrictStr] = None,
1509
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1510
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1511
+ ) -> ApiResponse[VPSV1ActionActionResource]:
1512
+ """Restart virtual machine
1513
+
1514
+ This endpoint restarts a specified virtual machine. This is equivalent to fully stopping and starting the virtual machine. If the virtual machine was stopped, it will be started.
1515
+
1516
+ :param virtual_machine_id: Virtual Machine ID (required)
1517
+ :type virtual_machine_id: int
1518
+ :param _request_timeout: timeout setting for this request. If one
1519
+ number provided, it will be total request
1520
+ timeout. It can also be a pair (tuple) of
1521
+ (connection, read) timeouts.
1522
+ :type _request_timeout: int, tuple(int, int), optional
1523
+ :param _request_auth: set to override the auth_settings for an a single
1524
+ request; this effectively ignores the
1525
+ authentication in the spec for a single request.
1526
+ :type _request_auth: dict, optional
1527
+ :param _content_type: force content-type for the request.
1528
+ :type _content_type: str, Optional
1529
+ :param _headers: set to override the headers for a single
1530
+ request; this effectively ignores the headers
1531
+ in the spec for a single request.
1532
+ :type _headers: dict, optional
1533
+ :param _host_index: set to override the host_index for a single
1534
+ request; this effectively ignores the host_index
1535
+ in the spec for a single request.
1536
+ :type _host_index: int, optional
1537
+ :return: Returns the result object.
1538
+ """ # noqa: E501
1539
+
1540
+ _param = self._restart_virtual_machine_v1_serialize(
1541
+ virtual_machine_id=virtual_machine_id,
1542
+ _request_auth=_request_auth,
1543
+ _content_type=_content_type,
1544
+ _headers=_headers,
1545
+ _host_index=_host_index
1546
+ )
1547
+
1548
+ _response_types_map: Dict[str, Optional[str]] = {
1549
+ '200': "VPSV1ActionActionResource",
1550
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1551
+ '500': "CommonSchemaErrorResponseSchema",
1552
+ }
1553
+ response_data = self.api_client.call_api(
1554
+ *_param,
1555
+ _request_timeout=_request_timeout
1556
+ )
1557
+ response_data.read()
1558
+ return self.api_client.response_deserialize(
1559
+ response_data=response_data,
1560
+ response_types_map=_response_types_map,
1561
+ )
1562
+
1563
+
1564
+ @validate_call
1565
+ def restart_virtual_machine_v1_without_preload_content(
1566
+ self,
1567
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1568
+ _request_timeout: Union[
1569
+ None,
1570
+ Annotated[StrictFloat, Field(gt=0)],
1571
+ Tuple[
1572
+ Annotated[StrictFloat, Field(gt=0)],
1573
+ Annotated[StrictFloat, Field(gt=0)]
1574
+ ]
1575
+ ] = None,
1576
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1577
+ _content_type: Optional[StrictStr] = None,
1578
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1579
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1580
+ ) -> RESTResponseType:
1581
+ """Restart virtual machine
1582
+
1583
+ This endpoint restarts a specified virtual machine. This is equivalent to fully stopping and starting the virtual machine. If the virtual machine was stopped, it will be started.
1584
+
1585
+ :param virtual_machine_id: Virtual Machine ID (required)
1586
+ :type virtual_machine_id: int
1587
+ :param _request_timeout: timeout setting for this request. If one
1588
+ number provided, it will be total request
1589
+ timeout. It can also be a pair (tuple) of
1590
+ (connection, read) timeouts.
1591
+ :type _request_timeout: int, tuple(int, int), optional
1592
+ :param _request_auth: set to override the auth_settings for an a single
1593
+ request; this effectively ignores the
1594
+ authentication in the spec for a single request.
1595
+ :type _request_auth: dict, optional
1596
+ :param _content_type: force content-type for the request.
1597
+ :type _content_type: str, Optional
1598
+ :param _headers: set to override the headers for a single
1599
+ request; this effectively ignores the headers
1600
+ in the spec for a single request.
1601
+ :type _headers: dict, optional
1602
+ :param _host_index: set to override the host_index for a single
1603
+ request; this effectively ignores the host_index
1604
+ in the spec for a single request.
1605
+ :type _host_index: int, optional
1606
+ :return: Returns the result object.
1607
+ """ # noqa: E501
1608
+
1609
+ _param = self._restart_virtual_machine_v1_serialize(
1610
+ virtual_machine_id=virtual_machine_id,
1611
+ _request_auth=_request_auth,
1612
+ _content_type=_content_type,
1613
+ _headers=_headers,
1614
+ _host_index=_host_index
1615
+ )
1616
+
1617
+ _response_types_map: Dict[str, Optional[str]] = {
1618
+ '200': "VPSV1ActionActionResource",
1619
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1620
+ '500': "CommonSchemaErrorResponseSchema",
1621
+ }
1622
+ response_data = self.api_client.call_api(
1623
+ *_param,
1624
+ _request_timeout=_request_timeout
1625
+ )
1626
+ return response_data.response
1627
+
1628
+
1629
+ def _restart_virtual_machine_v1_serialize(
1630
+ self,
1631
+ virtual_machine_id,
1632
+ _request_auth,
1633
+ _content_type,
1634
+ _headers,
1635
+ _host_index,
1636
+ ) -> RequestSerialized:
1637
+
1638
+ _host = None
1639
+
1640
+ _collection_formats: Dict[str, str] = {
1641
+ }
1642
+
1643
+ _path_params: Dict[str, str] = {}
1644
+ _query_params: List[Tuple[str, str]] = []
1645
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1646
+ _form_params: List[Tuple[str, str]] = []
1647
+ _files: Dict[
1648
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1649
+ ] = {}
1650
+ _body_params: Optional[bytes] = None
1651
+
1652
+ # process the path parameters
1653
+ if virtual_machine_id is not None:
1654
+ _path_params['virtualMachineId'] = virtual_machine_id
1655
+ # process the query parameters
1656
+ # process the header parameters
1657
+ # process the form parameters
1658
+ # process the body parameter
1659
+
1660
+
1661
+ # set the HTTP header `Accept`
1662
+ if 'Accept' not in _header_params:
1663
+ _header_params['Accept'] = self.api_client.select_header_accept(
1664
+ [
1665
+ 'application/json'
1666
+ ]
1667
+ )
1668
+
1669
+
1670
+ # authentication setting
1671
+ _auth_settings: List[str] = [
1672
+ 'apiToken'
1673
+ ]
1674
+
1675
+ return self.api_client.param_serialize(
1676
+ method='POST',
1677
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/restart',
1678
+ path_params=_path_params,
1679
+ query_params=_query_params,
1680
+ header_params=_header_params,
1681
+ body=_body_params,
1682
+ post_params=_form_params,
1683
+ files=_files,
1684
+ auth_settings=_auth_settings,
1685
+ collection_formats=_collection_formats,
1686
+ _host=_host,
1687
+ _request_auth=_request_auth
1688
+ )
1689
+
1690
+
1691
+
1692
+
1693
+ @validate_call
1694
+ def set_hostname_v1(
1695
+ self,
1696
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1697
+ vpsv1_virtual_machine_hostname_update_request: VPSV1VirtualMachineHostnameUpdateRequest,
1698
+ _request_timeout: Union[
1699
+ None,
1700
+ Annotated[StrictFloat, Field(gt=0)],
1701
+ Tuple[
1702
+ Annotated[StrictFloat, Field(gt=0)],
1703
+ Annotated[StrictFloat, Field(gt=0)]
1704
+ ]
1705
+ ] = None,
1706
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1707
+ _content_type: Optional[StrictStr] = None,
1708
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1709
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1710
+ ) -> VPSV1ActionActionResource:
1711
+ """Set hostname
1712
+
1713
+ This endpoint sets the hostname for a specified virtual machine. Changing hostname does not update PTR record automatically. If you want your virtual machine to be reachable by a hostname, you need to point your domain A/AAAA records to virtual machine IP as well.
1714
+
1715
+ :param virtual_machine_id: Virtual Machine ID (required)
1716
+ :type virtual_machine_id: int
1717
+ :param vpsv1_virtual_machine_hostname_update_request: (required)
1718
+ :type vpsv1_virtual_machine_hostname_update_request: VPSV1VirtualMachineHostnameUpdateRequest
1719
+ :param _request_timeout: timeout setting for this request. If one
1720
+ number provided, it will be total request
1721
+ timeout. It can also be a pair (tuple) of
1722
+ (connection, read) timeouts.
1723
+ :type _request_timeout: int, tuple(int, int), optional
1724
+ :param _request_auth: set to override the auth_settings for an a single
1725
+ request; this effectively ignores the
1726
+ authentication in the spec for a single request.
1727
+ :type _request_auth: dict, optional
1728
+ :param _content_type: force content-type for the request.
1729
+ :type _content_type: str, Optional
1730
+ :param _headers: set to override the headers for a single
1731
+ request; this effectively ignores the headers
1732
+ in the spec for a single request.
1733
+ :type _headers: dict, optional
1734
+ :param _host_index: set to override the host_index for a single
1735
+ request; this effectively ignores the host_index
1736
+ in the spec for a single request.
1737
+ :type _host_index: int, optional
1738
+ :return: Returns the result object.
1739
+ """ # noqa: E501
1740
+
1741
+ _param = self._set_hostname_v1_serialize(
1742
+ virtual_machine_id=virtual_machine_id,
1743
+ vpsv1_virtual_machine_hostname_update_request=vpsv1_virtual_machine_hostname_update_request,
1744
+ _request_auth=_request_auth,
1745
+ _content_type=_content_type,
1746
+ _headers=_headers,
1747
+ _host_index=_host_index
1748
+ )
1749
+
1750
+ _response_types_map: Dict[str, Optional[str]] = {
1751
+ '200': "VPSV1ActionActionResource",
1752
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
1753
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1754
+ '500': "CommonSchemaErrorResponseSchema",
1755
+ }
1756
+ response_data = self.api_client.call_api(
1757
+ *_param,
1758
+ _request_timeout=_request_timeout
1759
+ )
1760
+ response_data.read()
1761
+ return self.api_client.response_deserialize(
1762
+ response_data=response_data,
1763
+ response_types_map=_response_types_map,
1764
+ ).data
1765
+
1766
+
1767
+ @validate_call
1768
+ def set_hostname_v1_with_http_info(
1769
+ self,
1770
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1771
+ vpsv1_virtual_machine_hostname_update_request: VPSV1VirtualMachineHostnameUpdateRequest,
1772
+ _request_timeout: Union[
1773
+ None,
1774
+ Annotated[StrictFloat, Field(gt=0)],
1775
+ Tuple[
1776
+ Annotated[StrictFloat, Field(gt=0)],
1777
+ Annotated[StrictFloat, Field(gt=0)]
1778
+ ]
1779
+ ] = None,
1780
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1781
+ _content_type: Optional[StrictStr] = None,
1782
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1783
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1784
+ ) -> ApiResponse[VPSV1ActionActionResource]:
1785
+ """Set hostname
1786
+
1787
+ This endpoint sets the hostname for a specified virtual machine. Changing hostname does not update PTR record automatically. If you want your virtual machine to be reachable by a hostname, you need to point your domain A/AAAA records to virtual machine IP as well.
1788
+
1789
+ :param virtual_machine_id: Virtual Machine ID (required)
1790
+ :type virtual_machine_id: int
1791
+ :param vpsv1_virtual_machine_hostname_update_request: (required)
1792
+ :type vpsv1_virtual_machine_hostname_update_request: VPSV1VirtualMachineHostnameUpdateRequest
1793
+ :param _request_timeout: timeout setting for this request. If one
1794
+ number provided, it will be total request
1795
+ timeout. It can also be a pair (tuple) of
1796
+ (connection, read) timeouts.
1797
+ :type _request_timeout: int, tuple(int, int), optional
1798
+ :param _request_auth: set to override the auth_settings for an a single
1799
+ request; this effectively ignores the
1800
+ authentication in the spec for a single request.
1801
+ :type _request_auth: dict, optional
1802
+ :param _content_type: force content-type for the request.
1803
+ :type _content_type: str, Optional
1804
+ :param _headers: set to override the headers for a single
1805
+ request; this effectively ignores the headers
1806
+ in the spec for a single request.
1807
+ :type _headers: dict, optional
1808
+ :param _host_index: set to override the host_index for a single
1809
+ request; this effectively ignores the host_index
1810
+ in the spec for a single request.
1811
+ :type _host_index: int, optional
1812
+ :return: Returns the result object.
1813
+ """ # noqa: E501
1814
+
1815
+ _param = self._set_hostname_v1_serialize(
1816
+ virtual_machine_id=virtual_machine_id,
1817
+ vpsv1_virtual_machine_hostname_update_request=vpsv1_virtual_machine_hostname_update_request,
1818
+ _request_auth=_request_auth,
1819
+ _content_type=_content_type,
1820
+ _headers=_headers,
1821
+ _host_index=_host_index
1822
+ )
1823
+
1824
+ _response_types_map: Dict[str, Optional[str]] = {
1825
+ '200': "VPSV1ActionActionResource",
1826
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
1827
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1828
+ '500': "CommonSchemaErrorResponseSchema",
1829
+ }
1830
+ response_data = self.api_client.call_api(
1831
+ *_param,
1832
+ _request_timeout=_request_timeout
1833
+ )
1834
+ response_data.read()
1835
+ return self.api_client.response_deserialize(
1836
+ response_data=response_data,
1837
+ response_types_map=_response_types_map,
1838
+ )
1839
+
1840
+
1841
+ @validate_call
1842
+ def set_hostname_v1_without_preload_content(
1843
+ self,
1844
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1845
+ vpsv1_virtual_machine_hostname_update_request: VPSV1VirtualMachineHostnameUpdateRequest,
1846
+ _request_timeout: Union[
1847
+ None,
1848
+ Annotated[StrictFloat, Field(gt=0)],
1849
+ Tuple[
1850
+ Annotated[StrictFloat, Field(gt=0)],
1851
+ Annotated[StrictFloat, Field(gt=0)]
1852
+ ]
1853
+ ] = None,
1854
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1855
+ _content_type: Optional[StrictStr] = None,
1856
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1857
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1858
+ ) -> RESTResponseType:
1859
+ """Set hostname
1860
+
1861
+ This endpoint sets the hostname for a specified virtual machine. Changing hostname does not update PTR record automatically. If you want your virtual machine to be reachable by a hostname, you need to point your domain A/AAAA records to virtual machine IP as well.
1862
+
1863
+ :param virtual_machine_id: Virtual Machine ID (required)
1864
+ :type virtual_machine_id: int
1865
+ :param vpsv1_virtual_machine_hostname_update_request: (required)
1866
+ :type vpsv1_virtual_machine_hostname_update_request: VPSV1VirtualMachineHostnameUpdateRequest
1867
+ :param _request_timeout: timeout setting for this request. If one
1868
+ number provided, it will be total request
1869
+ timeout. It can also be a pair (tuple) of
1870
+ (connection, read) timeouts.
1871
+ :type _request_timeout: int, tuple(int, int), optional
1872
+ :param _request_auth: set to override the auth_settings for an a single
1873
+ request; this effectively ignores the
1874
+ authentication in the spec for a single request.
1875
+ :type _request_auth: dict, optional
1876
+ :param _content_type: force content-type for the request.
1877
+ :type _content_type: str, Optional
1878
+ :param _headers: set to override the headers for a single
1879
+ request; this effectively ignores the headers
1880
+ in the spec for a single request.
1881
+ :type _headers: dict, optional
1882
+ :param _host_index: set to override the host_index for a single
1883
+ request; this effectively ignores the host_index
1884
+ in the spec for a single request.
1885
+ :type _host_index: int, optional
1886
+ :return: Returns the result object.
1887
+ """ # noqa: E501
1888
+
1889
+ _param = self._set_hostname_v1_serialize(
1890
+ virtual_machine_id=virtual_machine_id,
1891
+ vpsv1_virtual_machine_hostname_update_request=vpsv1_virtual_machine_hostname_update_request,
1892
+ _request_auth=_request_auth,
1893
+ _content_type=_content_type,
1894
+ _headers=_headers,
1895
+ _host_index=_host_index
1896
+ )
1897
+
1898
+ _response_types_map: Dict[str, Optional[str]] = {
1899
+ '200': "VPSV1ActionActionResource",
1900
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
1901
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1902
+ '500': "CommonSchemaErrorResponseSchema",
1903
+ }
1904
+ response_data = self.api_client.call_api(
1905
+ *_param,
1906
+ _request_timeout=_request_timeout
1907
+ )
1908
+ return response_data.response
1909
+
1910
+
1911
+ def _set_hostname_v1_serialize(
1912
+ self,
1913
+ virtual_machine_id,
1914
+ vpsv1_virtual_machine_hostname_update_request,
1915
+ _request_auth,
1916
+ _content_type,
1917
+ _headers,
1918
+ _host_index,
1919
+ ) -> RequestSerialized:
1920
+
1921
+ _host = None
1922
+
1923
+ _collection_formats: Dict[str, str] = {
1924
+ }
1925
+
1926
+ _path_params: Dict[str, str] = {}
1927
+ _query_params: List[Tuple[str, str]] = []
1928
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1929
+ _form_params: List[Tuple[str, str]] = []
1930
+ _files: Dict[
1931
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1932
+ ] = {}
1933
+ _body_params: Optional[bytes] = None
1934
+
1935
+ # process the path parameters
1936
+ if virtual_machine_id is not None:
1937
+ _path_params['virtualMachineId'] = virtual_machine_id
1938
+ # process the query parameters
1939
+ # process the header parameters
1940
+ # process the form parameters
1941
+ # process the body parameter
1942
+ if vpsv1_virtual_machine_hostname_update_request is not None:
1943
+ _body_params = vpsv1_virtual_machine_hostname_update_request
1944
+
1945
+
1946
+ # set the HTTP header `Accept`
1947
+ if 'Accept' not in _header_params:
1948
+ _header_params['Accept'] = self.api_client.select_header_accept(
1949
+ [
1950
+ 'application/json'
1951
+ ]
1952
+ )
1953
+
1954
+ # set the HTTP header `Content-Type`
1955
+ if _content_type:
1956
+ _header_params['Content-Type'] = _content_type
1957
+ else:
1958
+ _default_content_type = (
1959
+ self.api_client.select_header_content_type(
1960
+ [
1961
+ 'application/json'
1962
+ ]
1963
+ )
1964
+ )
1965
+ if _default_content_type is not None:
1966
+ _header_params['Content-Type'] = _default_content_type
1967
+
1968
+ # authentication setting
1969
+ _auth_settings: List[str] = [
1970
+ 'apiToken'
1971
+ ]
1972
+
1973
+ return self.api_client.param_serialize(
1974
+ method='PUT',
1975
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/hostname',
1976
+ path_params=_path_params,
1977
+ query_params=_query_params,
1978
+ header_params=_header_params,
1979
+ body=_body_params,
1980
+ post_params=_form_params,
1981
+ files=_files,
1982
+ auth_settings=_auth_settings,
1983
+ collection_formats=_collection_formats,
1984
+ _host=_host,
1985
+ _request_auth=_request_auth
1986
+ )
1987
+
1988
+
1989
+
1990
+
1991
+ @validate_call
1992
+ def set_nameservers_v1(
1993
+ self,
1994
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1995
+ vpsv1_virtual_machine_nameservers_update_request: VPSV1VirtualMachineNameserversUpdateRequest,
1996
+ _request_timeout: Union[
1997
+ None,
1998
+ Annotated[StrictFloat, Field(gt=0)],
1999
+ Tuple[
2000
+ Annotated[StrictFloat, Field(gt=0)],
2001
+ Annotated[StrictFloat, Field(gt=0)]
2002
+ ]
2003
+ ] = None,
2004
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2005
+ _content_type: Optional[StrictStr] = None,
2006
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2007
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2008
+ ) -> VPSV1ActionActionResource:
2009
+ """Set nameservers
2010
+
2011
+ This endpoint sets the nameservers for a specified virtual machine. Be aware, that improper nameserver configuration can lead to the virtual machine being unable to resolve domain names.
2012
+
2013
+ :param virtual_machine_id: Virtual Machine ID (required)
2014
+ :type virtual_machine_id: int
2015
+ :param vpsv1_virtual_machine_nameservers_update_request: (required)
2016
+ :type vpsv1_virtual_machine_nameservers_update_request: VPSV1VirtualMachineNameserversUpdateRequest
2017
+ :param _request_timeout: timeout setting for this request. If one
2018
+ number provided, it will be total request
2019
+ timeout. It can also be a pair (tuple) of
2020
+ (connection, read) timeouts.
2021
+ :type _request_timeout: int, tuple(int, int), optional
2022
+ :param _request_auth: set to override the auth_settings for an a single
2023
+ request; this effectively ignores the
2024
+ authentication in the spec for a single request.
2025
+ :type _request_auth: dict, optional
2026
+ :param _content_type: force content-type for the request.
2027
+ :type _content_type: str, Optional
2028
+ :param _headers: set to override the headers for a single
2029
+ request; this effectively ignores the headers
2030
+ in the spec for a single request.
2031
+ :type _headers: dict, optional
2032
+ :param _host_index: set to override the host_index for a single
2033
+ request; this effectively ignores the host_index
2034
+ in the spec for a single request.
2035
+ :type _host_index: int, optional
2036
+ :return: Returns the result object.
2037
+ """ # noqa: E501
2038
+
2039
+ _param = self._set_nameservers_v1_serialize(
2040
+ virtual_machine_id=virtual_machine_id,
2041
+ vpsv1_virtual_machine_nameservers_update_request=vpsv1_virtual_machine_nameservers_update_request,
2042
+ _request_auth=_request_auth,
2043
+ _content_type=_content_type,
2044
+ _headers=_headers,
2045
+ _host_index=_host_index
2046
+ )
2047
+
2048
+ _response_types_map: Dict[str, Optional[str]] = {
2049
+ '200': "VPSV1ActionActionResource",
2050
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2051
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2052
+ '500': "CommonSchemaErrorResponseSchema",
2053
+ }
2054
+ response_data = self.api_client.call_api(
2055
+ *_param,
2056
+ _request_timeout=_request_timeout
2057
+ )
2058
+ response_data.read()
2059
+ return self.api_client.response_deserialize(
2060
+ response_data=response_data,
2061
+ response_types_map=_response_types_map,
2062
+ ).data
2063
+
2064
+
2065
+ @validate_call
2066
+ def set_nameservers_v1_with_http_info(
2067
+ self,
2068
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2069
+ vpsv1_virtual_machine_nameservers_update_request: VPSV1VirtualMachineNameserversUpdateRequest,
2070
+ _request_timeout: Union[
2071
+ None,
2072
+ Annotated[StrictFloat, Field(gt=0)],
2073
+ Tuple[
2074
+ Annotated[StrictFloat, Field(gt=0)],
2075
+ Annotated[StrictFloat, Field(gt=0)]
2076
+ ]
2077
+ ] = None,
2078
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2079
+ _content_type: Optional[StrictStr] = None,
2080
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2081
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2082
+ ) -> ApiResponse[VPSV1ActionActionResource]:
2083
+ """Set nameservers
2084
+
2085
+ This endpoint sets the nameservers for a specified virtual machine. Be aware, that improper nameserver configuration can lead to the virtual machine being unable to resolve domain names.
2086
+
2087
+ :param virtual_machine_id: Virtual Machine ID (required)
2088
+ :type virtual_machine_id: int
2089
+ :param vpsv1_virtual_machine_nameservers_update_request: (required)
2090
+ :type vpsv1_virtual_machine_nameservers_update_request: VPSV1VirtualMachineNameserversUpdateRequest
2091
+ :param _request_timeout: timeout setting for this request. If one
2092
+ number provided, it will be total request
2093
+ timeout. It can also be a pair (tuple) of
2094
+ (connection, read) timeouts.
2095
+ :type _request_timeout: int, tuple(int, int), optional
2096
+ :param _request_auth: set to override the auth_settings for an a single
2097
+ request; this effectively ignores the
2098
+ authentication in the spec for a single request.
2099
+ :type _request_auth: dict, optional
2100
+ :param _content_type: force content-type for the request.
2101
+ :type _content_type: str, Optional
2102
+ :param _headers: set to override the headers for a single
2103
+ request; this effectively ignores the headers
2104
+ in the spec for a single request.
2105
+ :type _headers: dict, optional
2106
+ :param _host_index: set to override the host_index for a single
2107
+ request; this effectively ignores the host_index
2108
+ in the spec for a single request.
2109
+ :type _host_index: int, optional
2110
+ :return: Returns the result object.
2111
+ """ # noqa: E501
2112
+
2113
+ _param = self._set_nameservers_v1_serialize(
2114
+ virtual_machine_id=virtual_machine_id,
2115
+ vpsv1_virtual_machine_nameservers_update_request=vpsv1_virtual_machine_nameservers_update_request,
2116
+ _request_auth=_request_auth,
2117
+ _content_type=_content_type,
2118
+ _headers=_headers,
2119
+ _host_index=_host_index
2120
+ )
2121
+
2122
+ _response_types_map: Dict[str, Optional[str]] = {
2123
+ '200': "VPSV1ActionActionResource",
2124
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2125
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2126
+ '500': "CommonSchemaErrorResponseSchema",
2127
+ }
2128
+ response_data = self.api_client.call_api(
2129
+ *_param,
2130
+ _request_timeout=_request_timeout
2131
+ )
2132
+ response_data.read()
2133
+ return self.api_client.response_deserialize(
2134
+ response_data=response_data,
2135
+ response_types_map=_response_types_map,
2136
+ )
2137
+
2138
+
2139
+ @validate_call
2140
+ def set_nameservers_v1_without_preload_content(
2141
+ self,
2142
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2143
+ vpsv1_virtual_machine_nameservers_update_request: VPSV1VirtualMachineNameserversUpdateRequest,
2144
+ _request_timeout: Union[
2145
+ None,
2146
+ Annotated[StrictFloat, Field(gt=0)],
2147
+ Tuple[
2148
+ Annotated[StrictFloat, Field(gt=0)],
2149
+ Annotated[StrictFloat, Field(gt=0)]
2150
+ ]
2151
+ ] = None,
2152
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2153
+ _content_type: Optional[StrictStr] = None,
2154
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2155
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2156
+ ) -> RESTResponseType:
2157
+ """Set nameservers
2158
+
2159
+ This endpoint sets the nameservers for a specified virtual machine. Be aware, that improper nameserver configuration can lead to the virtual machine being unable to resolve domain names.
2160
+
2161
+ :param virtual_machine_id: Virtual Machine ID (required)
2162
+ :type virtual_machine_id: int
2163
+ :param vpsv1_virtual_machine_nameservers_update_request: (required)
2164
+ :type vpsv1_virtual_machine_nameservers_update_request: VPSV1VirtualMachineNameserversUpdateRequest
2165
+ :param _request_timeout: timeout setting for this request. If one
2166
+ number provided, it will be total request
2167
+ timeout. It can also be a pair (tuple) of
2168
+ (connection, read) timeouts.
2169
+ :type _request_timeout: int, tuple(int, int), optional
2170
+ :param _request_auth: set to override the auth_settings for an a single
2171
+ request; this effectively ignores the
2172
+ authentication in the spec for a single request.
2173
+ :type _request_auth: dict, optional
2174
+ :param _content_type: force content-type for the request.
2175
+ :type _content_type: str, Optional
2176
+ :param _headers: set to override the headers for a single
2177
+ request; this effectively ignores the headers
2178
+ in the spec for a single request.
2179
+ :type _headers: dict, optional
2180
+ :param _host_index: set to override the host_index for a single
2181
+ request; this effectively ignores the host_index
2182
+ in the spec for a single request.
2183
+ :type _host_index: int, optional
2184
+ :return: Returns the result object.
2185
+ """ # noqa: E501
2186
+
2187
+ _param = self._set_nameservers_v1_serialize(
2188
+ virtual_machine_id=virtual_machine_id,
2189
+ vpsv1_virtual_machine_nameservers_update_request=vpsv1_virtual_machine_nameservers_update_request,
2190
+ _request_auth=_request_auth,
2191
+ _content_type=_content_type,
2192
+ _headers=_headers,
2193
+ _host_index=_host_index
2194
+ )
2195
+
2196
+ _response_types_map: Dict[str, Optional[str]] = {
2197
+ '200': "VPSV1ActionActionResource",
2198
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2199
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2200
+ '500': "CommonSchemaErrorResponseSchema",
2201
+ }
2202
+ response_data = self.api_client.call_api(
2203
+ *_param,
2204
+ _request_timeout=_request_timeout
2205
+ )
2206
+ return response_data.response
2207
+
2208
+
2209
+ def _set_nameservers_v1_serialize(
2210
+ self,
2211
+ virtual_machine_id,
2212
+ vpsv1_virtual_machine_nameservers_update_request,
2213
+ _request_auth,
2214
+ _content_type,
2215
+ _headers,
2216
+ _host_index,
2217
+ ) -> RequestSerialized:
2218
+
2219
+ _host = None
2220
+
2221
+ _collection_formats: Dict[str, str] = {
2222
+ }
2223
+
2224
+ _path_params: Dict[str, str] = {}
2225
+ _query_params: List[Tuple[str, str]] = []
2226
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2227
+ _form_params: List[Tuple[str, str]] = []
2228
+ _files: Dict[
2229
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2230
+ ] = {}
2231
+ _body_params: Optional[bytes] = None
2232
+
2233
+ # process the path parameters
2234
+ if virtual_machine_id is not None:
2235
+ _path_params['virtualMachineId'] = virtual_machine_id
2236
+ # process the query parameters
2237
+ # process the header parameters
2238
+ # process the form parameters
2239
+ # process the body parameter
2240
+ if vpsv1_virtual_machine_nameservers_update_request is not None:
2241
+ _body_params = vpsv1_virtual_machine_nameservers_update_request
2242
+
2243
+
2244
+ # set the HTTP header `Accept`
2245
+ if 'Accept' not in _header_params:
2246
+ _header_params['Accept'] = self.api_client.select_header_accept(
2247
+ [
2248
+ 'application/json'
2249
+ ]
2250
+ )
2251
+
2252
+ # set the HTTP header `Content-Type`
2253
+ if _content_type:
2254
+ _header_params['Content-Type'] = _content_type
2255
+ else:
2256
+ _default_content_type = (
2257
+ self.api_client.select_header_content_type(
2258
+ [
2259
+ 'application/json'
2260
+ ]
2261
+ )
2262
+ )
2263
+ if _default_content_type is not None:
2264
+ _header_params['Content-Type'] = _default_content_type
2265
+
2266
+ # authentication setting
2267
+ _auth_settings: List[str] = [
2268
+ 'apiToken'
2269
+ ]
2270
+
2271
+ return self.api_client.param_serialize(
2272
+ method='PUT',
2273
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/nameservers',
2274
+ path_params=_path_params,
2275
+ query_params=_query_params,
2276
+ header_params=_header_params,
2277
+ body=_body_params,
2278
+ post_params=_form_params,
2279
+ files=_files,
2280
+ auth_settings=_auth_settings,
2281
+ collection_formats=_collection_formats,
2282
+ _host=_host,
2283
+ _request_auth=_request_auth
2284
+ )
2285
+
2286
+
2287
+
2288
+
2289
+ @validate_call
2290
+ def set_panel_password_v1(
2291
+ self,
2292
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2293
+ vpsv1_virtual_machine_panel_password_update_request: VPSV1VirtualMachinePanelPasswordUpdateRequest,
2294
+ _request_timeout: Union[
2295
+ None,
2296
+ Annotated[StrictFloat, Field(gt=0)],
2297
+ Tuple[
2298
+ Annotated[StrictFloat, Field(gt=0)],
2299
+ Annotated[StrictFloat, Field(gt=0)]
2300
+ ]
2301
+ ] = None,
2302
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2303
+ _content_type: Optional[StrictStr] = None,
2304
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2305
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2306
+ ) -> VPSV1ActionActionResource:
2307
+ """Set panel password
2308
+
2309
+ This endpoint sets the panel password for a specified virtual machine. If virtual machine does not use panel OS, the request will still be processed without any effect. Requirements for the password is the same as in the [recreate virtual machine endpoint](/#tag/vps-virtual-machine/POST/api/vps/v1/virtual-machines/{virtualMachineId}/recreate).
2310
+
2311
+ :param virtual_machine_id: Virtual Machine ID (required)
2312
+ :type virtual_machine_id: int
2313
+ :param vpsv1_virtual_machine_panel_password_update_request: (required)
2314
+ :type vpsv1_virtual_machine_panel_password_update_request: VPSV1VirtualMachinePanelPasswordUpdateRequest
2315
+ :param _request_timeout: timeout setting for this request. If one
2316
+ number provided, it will be total request
2317
+ timeout. It can also be a pair (tuple) of
2318
+ (connection, read) timeouts.
2319
+ :type _request_timeout: int, tuple(int, int), optional
2320
+ :param _request_auth: set to override the auth_settings for an a single
2321
+ request; this effectively ignores the
2322
+ authentication in the spec for a single request.
2323
+ :type _request_auth: dict, optional
2324
+ :param _content_type: force content-type for the request.
2325
+ :type _content_type: str, Optional
2326
+ :param _headers: set to override the headers for a single
2327
+ request; this effectively ignores the headers
2328
+ in the spec for a single request.
2329
+ :type _headers: dict, optional
2330
+ :param _host_index: set to override the host_index for a single
2331
+ request; this effectively ignores the host_index
2332
+ in the spec for a single request.
2333
+ :type _host_index: int, optional
2334
+ :return: Returns the result object.
2335
+ """ # noqa: E501
2336
+
2337
+ _param = self._set_panel_password_v1_serialize(
2338
+ virtual_machine_id=virtual_machine_id,
2339
+ vpsv1_virtual_machine_panel_password_update_request=vpsv1_virtual_machine_panel_password_update_request,
2340
+ _request_auth=_request_auth,
2341
+ _content_type=_content_type,
2342
+ _headers=_headers,
2343
+ _host_index=_host_index
2344
+ )
2345
+
2346
+ _response_types_map: Dict[str, Optional[str]] = {
2347
+ '200': "VPSV1ActionActionResource",
2348
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2349
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2350
+ '500': "CommonSchemaErrorResponseSchema",
2351
+ }
2352
+ response_data = self.api_client.call_api(
2353
+ *_param,
2354
+ _request_timeout=_request_timeout
2355
+ )
2356
+ response_data.read()
2357
+ return self.api_client.response_deserialize(
2358
+ response_data=response_data,
2359
+ response_types_map=_response_types_map,
2360
+ ).data
2361
+
2362
+
2363
+ @validate_call
2364
+ def set_panel_password_v1_with_http_info(
2365
+ self,
2366
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2367
+ vpsv1_virtual_machine_panel_password_update_request: VPSV1VirtualMachinePanelPasswordUpdateRequest,
2368
+ _request_timeout: Union[
2369
+ None,
2370
+ Annotated[StrictFloat, Field(gt=0)],
2371
+ Tuple[
2372
+ Annotated[StrictFloat, Field(gt=0)],
2373
+ Annotated[StrictFloat, Field(gt=0)]
2374
+ ]
2375
+ ] = None,
2376
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2377
+ _content_type: Optional[StrictStr] = None,
2378
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2379
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2380
+ ) -> ApiResponse[VPSV1ActionActionResource]:
2381
+ """Set panel password
2382
+
2383
+ This endpoint sets the panel password for a specified virtual machine. If virtual machine does not use panel OS, the request will still be processed without any effect. Requirements for the password is the same as in the [recreate virtual machine endpoint](/#tag/vps-virtual-machine/POST/api/vps/v1/virtual-machines/{virtualMachineId}/recreate).
2384
+
2385
+ :param virtual_machine_id: Virtual Machine ID (required)
2386
+ :type virtual_machine_id: int
2387
+ :param vpsv1_virtual_machine_panel_password_update_request: (required)
2388
+ :type vpsv1_virtual_machine_panel_password_update_request: VPSV1VirtualMachinePanelPasswordUpdateRequest
2389
+ :param _request_timeout: timeout setting for this request. If one
2390
+ number provided, it will be total request
2391
+ timeout. It can also be a pair (tuple) of
2392
+ (connection, read) timeouts.
2393
+ :type _request_timeout: int, tuple(int, int), optional
2394
+ :param _request_auth: set to override the auth_settings for an a single
2395
+ request; this effectively ignores the
2396
+ authentication in the spec for a single request.
2397
+ :type _request_auth: dict, optional
2398
+ :param _content_type: force content-type for the request.
2399
+ :type _content_type: str, Optional
2400
+ :param _headers: set to override the headers for a single
2401
+ request; this effectively ignores the headers
2402
+ in the spec for a single request.
2403
+ :type _headers: dict, optional
2404
+ :param _host_index: set to override the host_index for a single
2405
+ request; this effectively ignores the host_index
2406
+ in the spec for a single request.
2407
+ :type _host_index: int, optional
2408
+ :return: Returns the result object.
2409
+ """ # noqa: E501
2410
+
2411
+ _param = self._set_panel_password_v1_serialize(
2412
+ virtual_machine_id=virtual_machine_id,
2413
+ vpsv1_virtual_machine_panel_password_update_request=vpsv1_virtual_machine_panel_password_update_request,
2414
+ _request_auth=_request_auth,
2415
+ _content_type=_content_type,
2416
+ _headers=_headers,
2417
+ _host_index=_host_index
2418
+ )
2419
+
2420
+ _response_types_map: Dict[str, Optional[str]] = {
2421
+ '200': "VPSV1ActionActionResource",
2422
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2423
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2424
+ '500': "CommonSchemaErrorResponseSchema",
2425
+ }
2426
+ response_data = self.api_client.call_api(
2427
+ *_param,
2428
+ _request_timeout=_request_timeout
2429
+ )
2430
+ response_data.read()
2431
+ return self.api_client.response_deserialize(
2432
+ response_data=response_data,
2433
+ response_types_map=_response_types_map,
2434
+ )
2435
+
2436
+
2437
+ @validate_call
2438
+ def set_panel_password_v1_without_preload_content(
2439
+ self,
2440
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2441
+ vpsv1_virtual_machine_panel_password_update_request: VPSV1VirtualMachinePanelPasswordUpdateRequest,
2442
+ _request_timeout: Union[
2443
+ None,
2444
+ Annotated[StrictFloat, Field(gt=0)],
2445
+ Tuple[
2446
+ Annotated[StrictFloat, Field(gt=0)],
2447
+ Annotated[StrictFloat, Field(gt=0)]
2448
+ ]
2449
+ ] = None,
2450
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2451
+ _content_type: Optional[StrictStr] = None,
2452
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2453
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2454
+ ) -> RESTResponseType:
2455
+ """Set panel password
2456
+
2457
+ This endpoint sets the panel password for a specified virtual machine. If virtual machine does not use panel OS, the request will still be processed without any effect. Requirements for the password is the same as in the [recreate virtual machine endpoint](/#tag/vps-virtual-machine/POST/api/vps/v1/virtual-machines/{virtualMachineId}/recreate).
2458
+
2459
+ :param virtual_machine_id: Virtual Machine ID (required)
2460
+ :type virtual_machine_id: int
2461
+ :param vpsv1_virtual_machine_panel_password_update_request: (required)
2462
+ :type vpsv1_virtual_machine_panel_password_update_request: VPSV1VirtualMachinePanelPasswordUpdateRequest
2463
+ :param _request_timeout: timeout setting for this request. If one
2464
+ number provided, it will be total request
2465
+ timeout. It can also be a pair (tuple) of
2466
+ (connection, read) timeouts.
2467
+ :type _request_timeout: int, tuple(int, int), optional
2468
+ :param _request_auth: set to override the auth_settings for an a single
2469
+ request; this effectively ignores the
2470
+ authentication in the spec for a single request.
2471
+ :type _request_auth: dict, optional
2472
+ :param _content_type: force content-type for the request.
2473
+ :type _content_type: str, Optional
2474
+ :param _headers: set to override the headers for a single
2475
+ request; this effectively ignores the headers
2476
+ in the spec for a single request.
2477
+ :type _headers: dict, optional
2478
+ :param _host_index: set to override the host_index for a single
2479
+ request; this effectively ignores the host_index
2480
+ in the spec for a single request.
2481
+ :type _host_index: int, optional
2482
+ :return: Returns the result object.
2483
+ """ # noqa: E501
2484
+
2485
+ _param = self._set_panel_password_v1_serialize(
2486
+ virtual_machine_id=virtual_machine_id,
2487
+ vpsv1_virtual_machine_panel_password_update_request=vpsv1_virtual_machine_panel_password_update_request,
2488
+ _request_auth=_request_auth,
2489
+ _content_type=_content_type,
2490
+ _headers=_headers,
2491
+ _host_index=_host_index
2492
+ )
2493
+
2494
+ _response_types_map: Dict[str, Optional[str]] = {
2495
+ '200': "VPSV1ActionActionResource",
2496
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2497
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2498
+ '500': "CommonSchemaErrorResponseSchema",
2499
+ }
2500
+ response_data = self.api_client.call_api(
2501
+ *_param,
2502
+ _request_timeout=_request_timeout
2503
+ )
2504
+ return response_data.response
2505
+
2506
+
2507
+ def _set_panel_password_v1_serialize(
2508
+ self,
2509
+ virtual_machine_id,
2510
+ vpsv1_virtual_machine_panel_password_update_request,
2511
+ _request_auth,
2512
+ _content_type,
2513
+ _headers,
2514
+ _host_index,
2515
+ ) -> RequestSerialized:
2516
+
2517
+ _host = None
2518
+
2519
+ _collection_formats: Dict[str, str] = {
2520
+ }
2521
+
2522
+ _path_params: Dict[str, str] = {}
2523
+ _query_params: List[Tuple[str, str]] = []
2524
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2525
+ _form_params: List[Tuple[str, str]] = []
2526
+ _files: Dict[
2527
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2528
+ ] = {}
2529
+ _body_params: Optional[bytes] = None
2530
+
2531
+ # process the path parameters
2532
+ if virtual_machine_id is not None:
2533
+ _path_params['virtualMachineId'] = virtual_machine_id
2534
+ # process the query parameters
2535
+ # process the header parameters
2536
+ # process the form parameters
2537
+ # process the body parameter
2538
+ if vpsv1_virtual_machine_panel_password_update_request is not None:
2539
+ _body_params = vpsv1_virtual_machine_panel_password_update_request
2540
+
2541
+
2542
+ # set the HTTP header `Accept`
2543
+ if 'Accept' not in _header_params:
2544
+ _header_params['Accept'] = self.api_client.select_header_accept(
2545
+ [
2546
+ 'application/json'
2547
+ ]
2548
+ )
2549
+
2550
+ # set the HTTP header `Content-Type`
2551
+ if _content_type:
2552
+ _header_params['Content-Type'] = _content_type
2553
+ else:
2554
+ _default_content_type = (
2555
+ self.api_client.select_header_content_type(
2556
+ [
2557
+ 'application/json'
2558
+ ]
2559
+ )
2560
+ )
2561
+ if _default_content_type is not None:
2562
+ _header_params['Content-Type'] = _default_content_type
2563
+
2564
+ # authentication setting
2565
+ _auth_settings: List[str] = [
2566
+ 'apiToken'
2567
+ ]
2568
+
2569
+ return self.api_client.param_serialize(
2570
+ method='PUT',
2571
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/panel-password',
2572
+ path_params=_path_params,
2573
+ query_params=_query_params,
2574
+ header_params=_header_params,
2575
+ body=_body_params,
2576
+ post_params=_form_params,
2577
+ files=_files,
2578
+ auth_settings=_auth_settings,
2579
+ collection_formats=_collection_formats,
2580
+ _host=_host,
2581
+ _request_auth=_request_auth
2582
+ )
2583
+
2584
+
2585
+
2586
+
2587
+ @validate_call
2588
+ def set_root_password_v1(
2589
+ self,
2590
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2591
+ vpsv1_virtual_machine_root_password_update_request: VPSV1VirtualMachineRootPasswordUpdateRequest,
2592
+ _request_timeout: Union[
2593
+ None,
2594
+ Annotated[StrictFloat, Field(gt=0)],
2595
+ Tuple[
2596
+ Annotated[StrictFloat, Field(gt=0)],
2597
+ Annotated[StrictFloat, Field(gt=0)]
2598
+ ]
2599
+ ] = None,
2600
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2601
+ _content_type: Optional[StrictStr] = None,
2602
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2603
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2604
+ ) -> VPSV1ActionActionResource:
2605
+ """Set root password
2606
+
2607
+ This endpoint sets the root password for a specified virtual machine. Requirements for the password is the same as in the [recreate virtual machine endpoint](/#tag/vps-virtual-machine/POST/api/vps/v1/virtual-machines/{virtualMachineId}/recreate).
2608
+
2609
+ :param virtual_machine_id: Virtual Machine ID (required)
2610
+ :type virtual_machine_id: int
2611
+ :param vpsv1_virtual_machine_root_password_update_request: (required)
2612
+ :type vpsv1_virtual_machine_root_password_update_request: VPSV1VirtualMachineRootPasswordUpdateRequest
2613
+ :param _request_timeout: timeout setting for this request. If one
2614
+ number provided, it will be total request
2615
+ timeout. It can also be a pair (tuple) of
2616
+ (connection, read) timeouts.
2617
+ :type _request_timeout: int, tuple(int, int), optional
2618
+ :param _request_auth: set to override the auth_settings for an a single
2619
+ request; this effectively ignores the
2620
+ authentication in the spec for a single request.
2621
+ :type _request_auth: dict, optional
2622
+ :param _content_type: force content-type for the request.
2623
+ :type _content_type: str, Optional
2624
+ :param _headers: set to override the headers for a single
2625
+ request; this effectively ignores the headers
2626
+ in the spec for a single request.
2627
+ :type _headers: dict, optional
2628
+ :param _host_index: set to override the host_index for a single
2629
+ request; this effectively ignores the host_index
2630
+ in the spec for a single request.
2631
+ :type _host_index: int, optional
2632
+ :return: Returns the result object.
2633
+ """ # noqa: E501
2634
+
2635
+ _param = self._set_root_password_v1_serialize(
2636
+ virtual_machine_id=virtual_machine_id,
2637
+ vpsv1_virtual_machine_root_password_update_request=vpsv1_virtual_machine_root_password_update_request,
2638
+ _request_auth=_request_auth,
2639
+ _content_type=_content_type,
2640
+ _headers=_headers,
2641
+ _host_index=_host_index
2642
+ )
2643
+
2644
+ _response_types_map: Dict[str, Optional[str]] = {
2645
+ '200': "VPSV1ActionActionResource",
2646
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2647
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2648
+ '500': "CommonSchemaErrorResponseSchema",
2649
+ }
2650
+ response_data = self.api_client.call_api(
2651
+ *_param,
2652
+ _request_timeout=_request_timeout
2653
+ )
2654
+ response_data.read()
2655
+ return self.api_client.response_deserialize(
2656
+ response_data=response_data,
2657
+ response_types_map=_response_types_map,
2658
+ ).data
2659
+
2660
+
2661
+ @validate_call
2662
+ def set_root_password_v1_with_http_info(
2663
+ self,
2664
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2665
+ vpsv1_virtual_machine_root_password_update_request: VPSV1VirtualMachineRootPasswordUpdateRequest,
2666
+ _request_timeout: Union[
2667
+ None,
2668
+ Annotated[StrictFloat, Field(gt=0)],
2669
+ Tuple[
2670
+ Annotated[StrictFloat, Field(gt=0)],
2671
+ Annotated[StrictFloat, Field(gt=0)]
2672
+ ]
2673
+ ] = None,
2674
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2675
+ _content_type: Optional[StrictStr] = None,
2676
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2677
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2678
+ ) -> ApiResponse[VPSV1ActionActionResource]:
2679
+ """Set root password
2680
+
2681
+ This endpoint sets the root password for a specified virtual machine. Requirements for the password is the same as in the [recreate virtual machine endpoint](/#tag/vps-virtual-machine/POST/api/vps/v1/virtual-machines/{virtualMachineId}/recreate).
2682
+
2683
+ :param virtual_machine_id: Virtual Machine ID (required)
2684
+ :type virtual_machine_id: int
2685
+ :param vpsv1_virtual_machine_root_password_update_request: (required)
2686
+ :type vpsv1_virtual_machine_root_password_update_request: VPSV1VirtualMachineRootPasswordUpdateRequest
2687
+ :param _request_timeout: timeout setting for this request. If one
2688
+ number provided, it will be total request
2689
+ timeout. It can also be a pair (tuple) of
2690
+ (connection, read) timeouts.
2691
+ :type _request_timeout: int, tuple(int, int), optional
2692
+ :param _request_auth: set to override the auth_settings for an a single
2693
+ request; this effectively ignores the
2694
+ authentication in the spec for a single request.
2695
+ :type _request_auth: dict, optional
2696
+ :param _content_type: force content-type for the request.
2697
+ :type _content_type: str, Optional
2698
+ :param _headers: set to override the headers for a single
2699
+ request; this effectively ignores the headers
2700
+ in the spec for a single request.
2701
+ :type _headers: dict, optional
2702
+ :param _host_index: set to override the host_index for a single
2703
+ request; this effectively ignores the host_index
2704
+ in the spec for a single request.
2705
+ :type _host_index: int, optional
2706
+ :return: Returns the result object.
2707
+ """ # noqa: E501
2708
+
2709
+ _param = self._set_root_password_v1_serialize(
2710
+ virtual_machine_id=virtual_machine_id,
2711
+ vpsv1_virtual_machine_root_password_update_request=vpsv1_virtual_machine_root_password_update_request,
2712
+ _request_auth=_request_auth,
2713
+ _content_type=_content_type,
2714
+ _headers=_headers,
2715
+ _host_index=_host_index
2716
+ )
2717
+
2718
+ _response_types_map: Dict[str, Optional[str]] = {
2719
+ '200': "VPSV1ActionActionResource",
2720
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2721
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2722
+ '500': "CommonSchemaErrorResponseSchema",
2723
+ }
2724
+ response_data = self.api_client.call_api(
2725
+ *_param,
2726
+ _request_timeout=_request_timeout
2727
+ )
2728
+ response_data.read()
2729
+ return self.api_client.response_deserialize(
2730
+ response_data=response_data,
2731
+ response_types_map=_response_types_map,
2732
+ )
2733
+
2734
+
2735
+ @validate_call
2736
+ def set_root_password_v1_without_preload_content(
2737
+ self,
2738
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2739
+ vpsv1_virtual_machine_root_password_update_request: VPSV1VirtualMachineRootPasswordUpdateRequest,
2740
+ _request_timeout: Union[
2741
+ None,
2742
+ Annotated[StrictFloat, Field(gt=0)],
2743
+ Tuple[
2744
+ Annotated[StrictFloat, Field(gt=0)],
2745
+ Annotated[StrictFloat, Field(gt=0)]
2746
+ ]
2747
+ ] = None,
2748
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2749
+ _content_type: Optional[StrictStr] = None,
2750
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2751
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2752
+ ) -> RESTResponseType:
2753
+ """Set root password
2754
+
2755
+ This endpoint sets the root password for a specified virtual machine. Requirements for the password is the same as in the [recreate virtual machine endpoint](/#tag/vps-virtual-machine/POST/api/vps/v1/virtual-machines/{virtualMachineId}/recreate).
2756
+
2757
+ :param virtual_machine_id: Virtual Machine ID (required)
2758
+ :type virtual_machine_id: int
2759
+ :param vpsv1_virtual_machine_root_password_update_request: (required)
2760
+ :type vpsv1_virtual_machine_root_password_update_request: VPSV1VirtualMachineRootPasswordUpdateRequest
2761
+ :param _request_timeout: timeout setting for this request. If one
2762
+ number provided, it will be total request
2763
+ timeout. It can also be a pair (tuple) of
2764
+ (connection, read) timeouts.
2765
+ :type _request_timeout: int, tuple(int, int), optional
2766
+ :param _request_auth: set to override the auth_settings for an a single
2767
+ request; this effectively ignores the
2768
+ authentication in the spec for a single request.
2769
+ :type _request_auth: dict, optional
2770
+ :param _content_type: force content-type for the request.
2771
+ :type _content_type: str, Optional
2772
+ :param _headers: set to override the headers for a single
2773
+ request; this effectively ignores the headers
2774
+ in the spec for a single request.
2775
+ :type _headers: dict, optional
2776
+ :param _host_index: set to override the host_index for a single
2777
+ request; this effectively ignores the host_index
2778
+ in the spec for a single request.
2779
+ :type _host_index: int, optional
2780
+ :return: Returns the result object.
2781
+ """ # noqa: E501
2782
+
2783
+ _param = self._set_root_password_v1_serialize(
2784
+ virtual_machine_id=virtual_machine_id,
2785
+ vpsv1_virtual_machine_root_password_update_request=vpsv1_virtual_machine_root_password_update_request,
2786
+ _request_auth=_request_auth,
2787
+ _content_type=_content_type,
2788
+ _headers=_headers,
2789
+ _host_index=_host_index
2790
+ )
2791
+
2792
+ _response_types_map: Dict[str, Optional[str]] = {
2793
+ '200': "VPSV1ActionActionResource",
2794
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2795
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2796
+ '500': "CommonSchemaErrorResponseSchema",
2797
+ }
2798
+ response_data = self.api_client.call_api(
2799
+ *_param,
2800
+ _request_timeout=_request_timeout
2801
+ )
2802
+ return response_data.response
2803
+
2804
+
2805
+ def _set_root_password_v1_serialize(
2806
+ self,
2807
+ virtual_machine_id,
2808
+ vpsv1_virtual_machine_root_password_update_request,
2809
+ _request_auth,
2810
+ _content_type,
2811
+ _headers,
2812
+ _host_index,
2813
+ ) -> RequestSerialized:
2814
+
2815
+ _host = None
2816
+
2817
+ _collection_formats: Dict[str, str] = {
2818
+ }
2819
+
2820
+ _path_params: Dict[str, str] = {}
2821
+ _query_params: List[Tuple[str, str]] = []
2822
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2823
+ _form_params: List[Tuple[str, str]] = []
2824
+ _files: Dict[
2825
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2826
+ ] = {}
2827
+ _body_params: Optional[bytes] = None
2828
+
2829
+ # process the path parameters
2830
+ if virtual_machine_id is not None:
2831
+ _path_params['virtualMachineId'] = virtual_machine_id
2832
+ # process the query parameters
2833
+ # process the header parameters
2834
+ # process the form parameters
2835
+ # process the body parameter
2836
+ if vpsv1_virtual_machine_root_password_update_request is not None:
2837
+ _body_params = vpsv1_virtual_machine_root_password_update_request
2838
+
2839
+
2840
+ # set the HTTP header `Accept`
2841
+ if 'Accept' not in _header_params:
2842
+ _header_params['Accept'] = self.api_client.select_header_accept(
2843
+ [
2844
+ 'application/json'
2845
+ ]
2846
+ )
2847
+
2848
+ # set the HTTP header `Content-Type`
2849
+ if _content_type:
2850
+ _header_params['Content-Type'] = _content_type
2851
+ else:
2852
+ _default_content_type = (
2853
+ self.api_client.select_header_content_type(
2854
+ [
2855
+ 'application/json'
2856
+ ]
2857
+ )
2858
+ )
2859
+ if _default_content_type is not None:
2860
+ _header_params['Content-Type'] = _default_content_type
2861
+
2862
+ # authentication setting
2863
+ _auth_settings: List[str] = [
2864
+ 'apiToken'
2865
+ ]
2866
+
2867
+ return self.api_client.param_serialize(
2868
+ method='PUT',
2869
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/root-password',
2870
+ path_params=_path_params,
2871
+ query_params=_query_params,
2872
+ header_params=_header_params,
2873
+ body=_body_params,
2874
+ post_params=_form_params,
2875
+ files=_files,
2876
+ auth_settings=_auth_settings,
2877
+ collection_formats=_collection_formats,
2878
+ _host=_host,
2879
+ _request_auth=_request_auth
2880
+ )
2881
+
2882
+
2883
+
2884
+
2885
+ @validate_call
2886
+ def setup_new_virtual_machine_v1(
2887
+ self,
2888
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2889
+ vpsv1_virtual_machine_setup_request: VPSV1VirtualMachineSetupRequest,
2890
+ _request_timeout: Union[
2891
+ None,
2892
+ Annotated[StrictFloat, Field(gt=0)],
2893
+ Tuple[
2894
+ Annotated[StrictFloat, Field(gt=0)],
2895
+ Annotated[StrictFloat, Field(gt=0)]
2896
+ ]
2897
+ ] = None,
2898
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2899
+ _content_type: Optional[StrictStr] = None,
2900
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2901
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2902
+ ) -> VPSV1VirtualMachineVirtualMachineResource:
2903
+ """Setup new virtual machine
2904
+
2905
+ This endpoint will setup newly purchased virtual machine. Such virtual machines has `initial` state. New virtual machine can be purchased using [`/api/billing/v1/orders`](/#tag/billing-orders/POST/api/billing/v1/orders) endpoint.
2906
+
2907
+ :param virtual_machine_id: Virtual Machine ID (required)
2908
+ :type virtual_machine_id: int
2909
+ :param vpsv1_virtual_machine_setup_request: (required)
2910
+ :type vpsv1_virtual_machine_setup_request: VPSV1VirtualMachineSetupRequest
2911
+ :param _request_timeout: timeout setting for this request. If one
2912
+ number provided, it will be total request
2913
+ timeout. It can also be a pair (tuple) of
2914
+ (connection, read) timeouts.
2915
+ :type _request_timeout: int, tuple(int, int), optional
2916
+ :param _request_auth: set to override the auth_settings for an a single
2917
+ request; this effectively ignores the
2918
+ authentication in the spec for a single request.
2919
+ :type _request_auth: dict, optional
2920
+ :param _content_type: force content-type for the request.
2921
+ :type _content_type: str, Optional
2922
+ :param _headers: set to override the headers for a single
2923
+ request; this effectively ignores the headers
2924
+ in the spec for a single request.
2925
+ :type _headers: dict, optional
2926
+ :param _host_index: set to override the host_index for a single
2927
+ request; this effectively ignores the host_index
2928
+ in the spec for a single request.
2929
+ :type _host_index: int, optional
2930
+ :return: Returns the result object.
2931
+ """ # noqa: E501
2932
+
2933
+ _param = self._setup_new_virtual_machine_v1_serialize(
2934
+ virtual_machine_id=virtual_machine_id,
2935
+ vpsv1_virtual_machine_setup_request=vpsv1_virtual_machine_setup_request,
2936
+ _request_auth=_request_auth,
2937
+ _content_type=_content_type,
2938
+ _headers=_headers,
2939
+ _host_index=_host_index
2940
+ )
2941
+
2942
+ _response_types_map: Dict[str, Optional[str]] = {
2943
+ '200': "VPSV1VirtualMachineVirtualMachineResource",
2944
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2945
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2946
+ '500': "CommonSchemaErrorResponseSchema",
2947
+ }
2948
+ response_data = self.api_client.call_api(
2949
+ *_param,
2950
+ _request_timeout=_request_timeout
2951
+ )
2952
+ response_data.read()
2953
+ return self.api_client.response_deserialize(
2954
+ response_data=response_data,
2955
+ response_types_map=_response_types_map,
2956
+ ).data
2957
+
2958
+
2959
+ @validate_call
2960
+ def setup_new_virtual_machine_v1_with_http_info(
2961
+ self,
2962
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2963
+ vpsv1_virtual_machine_setup_request: VPSV1VirtualMachineSetupRequest,
2964
+ _request_timeout: Union[
2965
+ None,
2966
+ Annotated[StrictFloat, Field(gt=0)],
2967
+ Tuple[
2968
+ Annotated[StrictFloat, Field(gt=0)],
2969
+ Annotated[StrictFloat, Field(gt=0)]
2970
+ ]
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[VPSV1VirtualMachineVirtualMachineResource]:
2977
+ """Setup new virtual machine
2978
+
2979
+ This endpoint will setup newly purchased virtual machine. Such virtual machines has `initial` state. New virtual machine can be purchased using [`/api/billing/v1/orders`](/#tag/billing-orders/POST/api/billing/v1/orders) endpoint.
2980
+
2981
+ :param virtual_machine_id: Virtual Machine ID (required)
2982
+ :type virtual_machine_id: int
2983
+ :param vpsv1_virtual_machine_setup_request: (required)
2984
+ :type vpsv1_virtual_machine_setup_request: VPSV1VirtualMachineSetupRequest
2985
+ :param _request_timeout: timeout setting for this request. If one
2986
+ number provided, it will be total request
2987
+ timeout. It can also be a pair (tuple) of
2988
+ (connection, read) timeouts.
2989
+ :type _request_timeout: int, tuple(int, int), optional
2990
+ :param _request_auth: set to override the auth_settings for an a single
2991
+ request; this effectively ignores the
2992
+ authentication in the spec for a single request.
2993
+ :type _request_auth: dict, optional
2994
+ :param _content_type: force content-type for the request.
2995
+ :type _content_type: str, Optional
2996
+ :param _headers: set to override the headers for a single
2997
+ request; this effectively ignores the headers
2998
+ in the spec for a single request.
2999
+ :type _headers: dict, optional
3000
+ :param _host_index: set to override the host_index for a single
3001
+ request; this effectively ignores the host_index
3002
+ in the spec for a single request.
3003
+ :type _host_index: int, optional
3004
+ :return: Returns the result object.
3005
+ """ # noqa: E501
3006
+
3007
+ _param = self._setup_new_virtual_machine_v1_serialize(
3008
+ virtual_machine_id=virtual_machine_id,
3009
+ vpsv1_virtual_machine_setup_request=vpsv1_virtual_machine_setup_request,
3010
+ _request_auth=_request_auth,
3011
+ _content_type=_content_type,
3012
+ _headers=_headers,
3013
+ _host_index=_host_index
3014
+ )
3015
+
3016
+ _response_types_map: Dict[str, Optional[str]] = {
3017
+ '200': "VPSV1VirtualMachineVirtualMachineResource",
3018
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
3019
+ '401': "CommonSchemaUnauthorizedResponseSchema",
3020
+ '500': "CommonSchemaErrorResponseSchema",
3021
+ }
3022
+ response_data = self.api_client.call_api(
3023
+ *_param,
3024
+ _request_timeout=_request_timeout
3025
+ )
3026
+ response_data.read()
3027
+ return self.api_client.response_deserialize(
3028
+ response_data=response_data,
3029
+ response_types_map=_response_types_map,
3030
+ )
3031
+
3032
+
3033
+ @validate_call
3034
+ def setup_new_virtual_machine_v1_without_preload_content(
3035
+ self,
3036
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
3037
+ vpsv1_virtual_machine_setup_request: VPSV1VirtualMachineSetupRequest,
3038
+ _request_timeout: Union[
3039
+ None,
3040
+ Annotated[StrictFloat, Field(gt=0)],
3041
+ Tuple[
3042
+ Annotated[StrictFloat, Field(gt=0)],
3043
+ Annotated[StrictFloat, Field(gt=0)]
3044
+ ]
3045
+ ] = None,
3046
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3047
+ _content_type: Optional[StrictStr] = None,
3048
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3049
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3050
+ ) -> RESTResponseType:
3051
+ """Setup new virtual machine
3052
+
3053
+ This endpoint will setup newly purchased virtual machine. Such virtual machines has `initial` state. New virtual machine can be purchased using [`/api/billing/v1/orders`](/#tag/billing-orders/POST/api/billing/v1/orders) endpoint.
3054
+
3055
+ :param virtual_machine_id: Virtual Machine ID (required)
3056
+ :type virtual_machine_id: int
3057
+ :param vpsv1_virtual_machine_setup_request: (required)
3058
+ :type vpsv1_virtual_machine_setup_request: VPSV1VirtualMachineSetupRequest
3059
+ :param _request_timeout: timeout setting for this request. If one
3060
+ number provided, it will be total request
3061
+ timeout. It can also be a pair (tuple) of
3062
+ (connection, read) timeouts.
3063
+ :type _request_timeout: int, tuple(int, int), optional
3064
+ :param _request_auth: set to override the auth_settings for an a single
3065
+ request; this effectively ignores the
3066
+ authentication in the spec for a single request.
3067
+ :type _request_auth: dict, optional
3068
+ :param _content_type: force content-type for the request.
3069
+ :type _content_type: str, Optional
3070
+ :param _headers: set to override the headers for a single
3071
+ request; this effectively ignores the headers
3072
+ in the spec for a single request.
3073
+ :type _headers: dict, optional
3074
+ :param _host_index: set to override the host_index for a single
3075
+ request; this effectively ignores the host_index
3076
+ in the spec for a single request.
3077
+ :type _host_index: int, optional
3078
+ :return: Returns the result object.
3079
+ """ # noqa: E501
3080
+
3081
+ _param = self._setup_new_virtual_machine_v1_serialize(
3082
+ virtual_machine_id=virtual_machine_id,
3083
+ vpsv1_virtual_machine_setup_request=vpsv1_virtual_machine_setup_request,
3084
+ _request_auth=_request_auth,
3085
+ _content_type=_content_type,
3086
+ _headers=_headers,
3087
+ _host_index=_host_index
3088
+ )
3089
+
3090
+ _response_types_map: Dict[str, Optional[str]] = {
3091
+ '200': "VPSV1VirtualMachineVirtualMachineResource",
3092
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
3093
+ '401': "CommonSchemaUnauthorizedResponseSchema",
3094
+ '500': "CommonSchemaErrorResponseSchema",
3095
+ }
3096
+ response_data = self.api_client.call_api(
3097
+ *_param,
3098
+ _request_timeout=_request_timeout
3099
+ )
3100
+ return response_data.response
3101
+
3102
+
3103
+ def _setup_new_virtual_machine_v1_serialize(
3104
+ self,
3105
+ virtual_machine_id,
3106
+ vpsv1_virtual_machine_setup_request,
3107
+ _request_auth,
3108
+ _content_type,
3109
+ _headers,
3110
+ _host_index,
3111
+ ) -> RequestSerialized:
3112
+
3113
+ _host = None
3114
+
3115
+ _collection_formats: Dict[str, str] = {
3116
+ }
3117
+
3118
+ _path_params: Dict[str, str] = {}
3119
+ _query_params: List[Tuple[str, str]] = []
3120
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3121
+ _form_params: List[Tuple[str, str]] = []
3122
+ _files: Dict[
3123
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3124
+ ] = {}
3125
+ _body_params: Optional[bytes] = None
3126
+
3127
+ # process the path parameters
3128
+ if virtual_machine_id is not None:
3129
+ _path_params['virtualMachineId'] = virtual_machine_id
3130
+ # process the query parameters
3131
+ # process the header parameters
3132
+ # process the form parameters
3133
+ # process the body parameter
3134
+ if vpsv1_virtual_machine_setup_request is not None:
3135
+ _body_params = vpsv1_virtual_machine_setup_request
3136
+
3137
+
3138
+ # set the HTTP header `Accept`
3139
+ if 'Accept' not in _header_params:
3140
+ _header_params['Accept'] = self.api_client.select_header_accept(
3141
+ [
3142
+ 'application/json'
3143
+ ]
3144
+ )
3145
+
3146
+ # set the HTTP header `Content-Type`
3147
+ if _content_type:
3148
+ _header_params['Content-Type'] = _content_type
3149
+ else:
3150
+ _default_content_type = (
3151
+ self.api_client.select_header_content_type(
3152
+ [
3153
+ 'application/json'
3154
+ ]
3155
+ )
3156
+ )
3157
+ if _default_content_type is not None:
3158
+ _header_params['Content-Type'] = _default_content_type
3159
+
3160
+ # authentication setting
3161
+ _auth_settings: List[str] = [
3162
+ 'apiToken'
3163
+ ]
3164
+
3165
+ return self.api_client.param_serialize(
3166
+ method='POST',
3167
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/setup',
3168
+ path_params=_path_params,
3169
+ query_params=_query_params,
3170
+ header_params=_header_params,
3171
+ body=_body_params,
3172
+ post_params=_form_params,
3173
+ files=_files,
3174
+ auth_settings=_auth_settings,
3175
+ collection_formats=_collection_formats,
3176
+ _host=_host,
3177
+ _request_auth=_request_auth
3178
+ )
3179
+
3180
+
3181
+
3182
+
3183
+ @validate_call
3184
+ def start_virtual_machine_v1(
3185
+ self,
3186
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
3187
+ _request_timeout: Union[
3188
+ None,
3189
+ Annotated[StrictFloat, Field(gt=0)],
3190
+ Tuple[
3191
+ Annotated[StrictFloat, Field(gt=0)],
3192
+ Annotated[StrictFloat, Field(gt=0)]
3193
+ ]
3194
+ ] = None,
3195
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3196
+ _content_type: Optional[StrictStr] = None,
3197
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3198
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3199
+ ) -> VPSV1ActionActionResource:
3200
+ """Start virtual machine
3201
+
3202
+ This endpoint starts a specified virtual machine. If the virtual machine is already running, the request will still be processed without any effect.
3203
+
3204
+ :param virtual_machine_id: Virtual Machine ID (required)
3205
+ :type virtual_machine_id: int
3206
+ :param _request_timeout: timeout setting for this request. If one
3207
+ number provided, it will be total request
3208
+ timeout. It can also be a pair (tuple) of
3209
+ (connection, read) timeouts.
3210
+ :type _request_timeout: int, tuple(int, int), optional
3211
+ :param _request_auth: set to override the auth_settings for an a single
3212
+ request; this effectively ignores the
3213
+ authentication in the spec for a single request.
3214
+ :type _request_auth: dict, optional
3215
+ :param _content_type: force content-type for the request.
3216
+ :type _content_type: str, Optional
3217
+ :param _headers: set to override the headers for a single
3218
+ request; this effectively ignores the headers
3219
+ in the spec for a single request.
3220
+ :type _headers: dict, optional
3221
+ :param _host_index: set to override the host_index for a single
3222
+ request; this effectively ignores the host_index
3223
+ in the spec for a single request.
3224
+ :type _host_index: int, optional
3225
+ :return: Returns the result object.
3226
+ """ # noqa: E501
3227
+
3228
+ _param = self._start_virtual_machine_v1_serialize(
3229
+ virtual_machine_id=virtual_machine_id,
3230
+ _request_auth=_request_auth,
3231
+ _content_type=_content_type,
3232
+ _headers=_headers,
3233
+ _host_index=_host_index
3234
+ )
3235
+
3236
+ _response_types_map: Dict[str, Optional[str]] = {
3237
+ '200': "VPSV1ActionActionResource",
3238
+ '401': "CommonSchemaUnauthorizedResponseSchema",
3239
+ '500': "CommonSchemaErrorResponseSchema",
3240
+ }
3241
+ response_data = self.api_client.call_api(
3242
+ *_param,
3243
+ _request_timeout=_request_timeout
3244
+ )
3245
+ response_data.read()
3246
+ return self.api_client.response_deserialize(
3247
+ response_data=response_data,
3248
+ response_types_map=_response_types_map,
3249
+ ).data
3250
+
3251
+
3252
+ @validate_call
3253
+ def start_virtual_machine_v1_with_http_info(
3254
+ self,
3255
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
3256
+ _request_timeout: Union[
3257
+ None,
3258
+ Annotated[StrictFloat, Field(gt=0)],
3259
+ Tuple[
3260
+ Annotated[StrictFloat, Field(gt=0)],
3261
+ Annotated[StrictFloat, Field(gt=0)]
3262
+ ]
3263
+ ] = None,
3264
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3265
+ _content_type: Optional[StrictStr] = None,
3266
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3267
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3268
+ ) -> ApiResponse[VPSV1ActionActionResource]:
3269
+ """Start virtual machine
3270
+
3271
+ This endpoint starts a specified virtual machine. If the virtual machine is already running, the request will still be processed without any effect.
3272
+
3273
+ :param virtual_machine_id: Virtual Machine ID (required)
3274
+ :type virtual_machine_id: int
3275
+ :param _request_timeout: timeout setting for this request. If one
3276
+ number provided, it will be total request
3277
+ timeout. It can also be a pair (tuple) of
3278
+ (connection, read) timeouts.
3279
+ :type _request_timeout: int, tuple(int, int), optional
3280
+ :param _request_auth: set to override the auth_settings for an a single
3281
+ request; this effectively ignores the
3282
+ authentication in the spec for a single request.
3283
+ :type _request_auth: dict, optional
3284
+ :param _content_type: force content-type for the request.
3285
+ :type _content_type: str, Optional
3286
+ :param _headers: set to override the headers for a single
3287
+ request; this effectively ignores the headers
3288
+ in the spec for a single request.
3289
+ :type _headers: dict, optional
3290
+ :param _host_index: set to override the host_index for a single
3291
+ request; this effectively ignores the host_index
3292
+ in the spec for a single request.
3293
+ :type _host_index: int, optional
3294
+ :return: Returns the result object.
3295
+ """ # noqa: E501
3296
+
3297
+ _param = self._start_virtual_machine_v1_serialize(
3298
+ virtual_machine_id=virtual_machine_id,
3299
+ _request_auth=_request_auth,
3300
+ _content_type=_content_type,
3301
+ _headers=_headers,
3302
+ _host_index=_host_index
3303
+ )
3304
+
3305
+ _response_types_map: Dict[str, Optional[str]] = {
3306
+ '200': "VPSV1ActionActionResource",
3307
+ '401': "CommonSchemaUnauthorizedResponseSchema",
3308
+ '500': "CommonSchemaErrorResponseSchema",
3309
+ }
3310
+ response_data = self.api_client.call_api(
3311
+ *_param,
3312
+ _request_timeout=_request_timeout
3313
+ )
3314
+ response_data.read()
3315
+ return self.api_client.response_deserialize(
3316
+ response_data=response_data,
3317
+ response_types_map=_response_types_map,
3318
+ )
3319
+
3320
+
3321
+ @validate_call
3322
+ def start_virtual_machine_v1_without_preload_content(
3323
+ self,
3324
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
3325
+ _request_timeout: Union[
3326
+ None,
3327
+ Annotated[StrictFloat, Field(gt=0)],
3328
+ Tuple[
3329
+ Annotated[StrictFloat, Field(gt=0)],
3330
+ Annotated[StrictFloat, Field(gt=0)]
3331
+ ]
3332
+ ] = None,
3333
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3334
+ _content_type: Optional[StrictStr] = None,
3335
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3336
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3337
+ ) -> RESTResponseType:
3338
+ """Start virtual machine
3339
+
3340
+ This endpoint starts a specified virtual machine. If the virtual machine is already running, the request will still be processed without any effect.
3341
+
3342
+ :param virtual_machine_id: Virtual Machine ID (required)
3343
+ :type virtual_machine_id: int
3344
+ :param _request_timeout: timeout setting for this request. If one
3345
+ number provided, it will be total request
3346
+ timeout. It can also be a pair (tuple) of
3347
+ (connection, read) timeouts.
3348
+ :type _request_timeout: int, tuple(int, int), optional
3349
+ :param _request_auth: set to override the auth_settings for an a single
3350
+ request; this effectively ignores the
3351
+ authentication in the spec for a single request.
3352
+ :type _request_auth: dict, optional
3353
+ :param _content_type: force content-type for the request.
3354
+ :type _content_type: str, Optional
3355
+ :param _headers: set to override the headers for a single
3356
+ request; this effectively ignores the headers
3357
+ in the spec for a single request.
3358
+ :type _headers: dict, optional
3359
+ :param _host_index: set to override the host_index for a single
3360
+ request; this effectively ignores the host_index
3361
+ in the spec for a single request.
3362
+ :type _host_index: int, optional
3363
+ :return: Returns the result object.
3364
+ """ # noqa: E501
3365
+
3366
+ _param = self._start_virtual_machine_v1_serialize(
3367
+ virtual_machine_id=virtual_machine_id,
3368
+ _request_auth=_request_auth,
3369
+ _content_type=_content_type,
3370
+ _headers=_headers,
3371
+ _host_index=_host_index
3372
+ )
3373
+
3374
+ _response_types_map: Dict[str, Optional[str]] = {
3375
+ '200': "VPSV1ActionActionResource",
3376
+ '401': "CommonSchemaUnauthorizedResponseSchema",
3377
+ '500': "CommonSchemaErrorResponseSchema",
3378
+ }
3379
+ response_data = self.api_client.call_api(
3380
+ *_param,
3381
+ _request_timeout=_request_timeout
3382
+ )
3383
+ return response_data.response
3384
+
3385
+
3386
+ def _start_virtual_machine_v1_serialize(
3387
+ self,
3388
+ virtual_machine_id,
3389
+ _request_auth,
3390
+ _content_type,
3391
+ _headers,
3392
+ _host_index,
3393
+ ) -> RequestSerialized:
3394
+
3395
+ _host = None
3396
+
3397
+ _collection_formats: Dict[str, str] = {
3398
+ }
3399
+
3400
+ _path_params: Dict[str, str] = {}
3401
+ _query_params: List[Tuple[str, str]] = []
3402
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3403
+ _form_params: List[Tuple[str, str]] = []
3404
+ _files: Dict[
3405
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3406
+ ] = {}
3407
+ _body_params: Optional[bytes] = None
3408
+
3409
+ # process the path parameters
3410
+ if virtual_machine_id is not None:
3411
+ _path_params['virtualMachineId'] = virtual_machine_id
3412
+ # process the query parameters
3413
+ # process the header parameters
3414
+ # process the form parameters
3415
+ # process the body parameter
3416
+
3417
+
3418
+ # set the HTTP header `Accept`
3419
+ if 'Accept' not in _header_params:
3420
+ _header_params['Accept'] = self.api_client.select_header_accept(
3421
+ [
3422
+ 'application/json'
3423
+ ]
3424
+ )
3425
+
3426
+
3427
+ # authentication setting
3428
+ _auth_settings: List[str] = [
3429
+ 'apiToken'
3430
+ ]
3431
+
3432
+ return self.api_client.param_serialize(
3433
+ method='POST',
3434
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/start',
3435
+ path_params=_path_params,
3436
+ query_params=_query_params,
3437
+ header_params=_header_params,
3438
+ body=_body_params,
3439
+ post_params=_form_params,
3440
+ files=_files,
3441
+ auth_settings=_auth_settings,
3442
+ collection_formats=_collection_formats,
3443
+ _host=_host,
3444
+ _request_auth=_request_auth
3445
+ )
3446
+
3447
+
3448
+
3449
+
3450
+ @validate_call
3451
+ def stop_virtual_machine_v1(
3452
+ self,
3453
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
3454
+ _request_timeout: Union[
3455
+ None,
3456
+ Annotated[StrictFloat, Field(gt=0)],
3457
+ Tuple[
3458
+ Annotated[StrictFloat, Field(gt=0)],
3459
+ Annotated[StrictFloat, Field(gt=0)]
3460
+ ]
3461
+ ] = None,
3462
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3463
+ _content_type: Optional[StrictStr] = None,
3464
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3465
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3466
+ ) -> VPSV1ActionActionResource:
3467
+ """Stop virtual machine
3468
+
3469
+ This endpoint stops a specified virtual machine. If the virtual machine is already stopped, the request will still be processed without any effect.
3470
+
3471
+ :param virtual_machine_id: Virtual Machine ID (required)
3472
+ :type virtual_machine_id: int
3473
+ :param _request_timeout: timeout setting for this request. If one
3474
+ number provided, it will be total request
3475
+ timeout. It can also be a pair (tuple) of
3476
+ (connection, read) timeouts.
3477
+ :type _request_timeout: int, tuple(int, int), optional
3478
+ :param _request_auth: set to override the auth_settings for an a single
3479
+ request; this effectively ignores the
3480
+ authentication in the spec for a single request.
3481
+ :type _request_auth: dict, optional
3482
+ :param _content_type: force content-type for the request.
3483
+ :type _content_type: str, Optional
3484
+ :param _headers: set to override the headers for a single
3485
+ request; this effectively ignores the headers
3486
+ in the spec for a single request.
3487
+ :type _headers: dict, optional
3488
+ :param _host_index: set to override the host_index for a single
3489
+ request; this effectively ignores the host_index
3490
+ in the spec for a single request.
3491
+ :type _host_index: int, optional
3492
+ :return: Returns the result object.
3493
+ """ # noqa: E501
3494
+
3495
+ _param = self._stop_virtual_machine_v1_serialize(
3496
+ virtual_machine_id=virtual_machine_id,
3497
+ _request_auth=_request_auth,
3498
+ _content_type=_content_type,
3499
+ _headers=_headers,
3500
+ _host_index=_host_index
3501
+ )
3502
+
3503
+ _response_types_map: Dict[str, Optional[str]] = {
3504
+ '200': "VPSV1ActionActionResource",
3505
+ '401': "CommonSchemaUnauthorizedResponseSchema",
3506
+ '500': "CommonSchemaErrorResponseSchema",
3507
+ }
3508
+ response_data = self.api_client.call_api(
3509
+ *_param,
3510
+ _request_timeout=_request_timeout
3511
+ )
3512
+ response_data.read()
3513
+ return self.api_client.response_deserialize(
3514
+ response_data=response_data,
3515
+ response_types_map=_response_types_map,
3516
+ ).data
3517
+
3518
+
3519
+ @validate_call
3520
+ def stop_virtual_machine_v1_with_http_info(
3521
+ self,
3522
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
3523
+ _request_timeout: Union[
3524
+ None,
3525
+ Annotated[StrictFloat, Field(gt=0)],
3526
+ Tuple[
3527
+ Annotated[StrictFloat, Field(gt=0)],
3528
+ Annotated[StrictFloat, Field(gt=0)]
3529
+ ]
3530
+ ] = None,
3531
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3532
+ _content_type: Optional[StrictStr] = None,
3533
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3534
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3535
+ ) -> ApiResponse[VPSV1ActionActionResource]:
3536
+ """Stop virtual machine
3537
+
3538
+ This endpoint stops a specified virtual machine. If the virtual machine is already stopped, the request will still be processed without any effect.
3539
+
3540
+ :param virtual_machine_id: Virtual Machine ID (required)
3541
+ :type virtual_machine_id: int
3542
+ :param _request_timeout: timeout setting for this request. If one
3543
+ number provided, it will be total request
3544
+ timeout. It can also be a pair (tuple) of
3545
+ (connection, read) timeouts.
3546
+ :type _request_timeout: int, tuple(int, int), optional
3547
+ :param _request_auth: set to override the auth_settings for an a single
3548
+ request; this effectively ignores the
3549
+ authentication in the spec for a single request.
3550
+ :type _request_auth: dict, optional
3551
+ :param _content_type: force content-type for the request.
3552
+ :type _content_type: str, Optional
3553
+ :param _headers: set to override the headers for a single
3554
+ request; this effectively ignores the headers
3555
+ in the spec for a single request.
3556
+ :type _headers: dict, optional
3557
+ :param _host_index: set to override the host_index for a single
3558
+ request; this effectively ignores the host_index
3559
+ in the spec for a single request.
3560
+ :type _host_index: int, optional
3561
+ :return: Returns the result object.
3562
+ """ # noqa: E501
3563
+
3564
+ _param = self._stop_virtual_machine_v1_serialize(
3565
+ virtual_machine_id=virtual_machine_id,
3566
+ _request_auth=_request_auth,
3567
+ _content_type=_content_type,
3568
+ _headers=_headers,
3569
+ _host_index=_host_index
3570
+ )
3571
+
3572
+ _response_types_map: Dict[str, Optional[str]] = {
3573
+ '200': "VPSV1ActionActionResource",
3574
+ '401': "CommonSchemaUnauthorizedResponseSchema",
3575
+ '500': "CommonSchemaErrorResponseSchema",
3576
+ }
3577
+ response_data = self.api_client.call_api(
3578
+ *_param,
3579
+ _request_timeout=_request_timeout
3580
+ )
3581
+ response_data.read()
3582
+ return self.api_client.response_deserialize(
3583
+ response_data=response_data,
3584
+ response_types_map=_response_types_map,
3585
+ )
3586
+
3587
+
3588
+ @validate_call
3589
+ def stop_virtual_machine_v1_without_preload_content(
3590
+ self,
3591
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
3592
+ _request_timeout: Union[
3593
+ None,
3594
+ Annotated[StrictFloat, Field(gt=0)],
3595
+ Tuple[
3596
+ Annotated[StrictFloat, Field(gt=0)],
3597
+ Annotated[StrictFloat, Field(gt=0)]
3598
+ ]
3599
+ ] = None,
3600
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3601
+ _content_type: Optional[StrictStr] = None,
3602
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3603
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3604
+ ) -> RESTResponseType:
3605
+ """Stop virtual machine
3606
+
3607
+ This endpoint stops a specified virtual machine. If the virtual machine is already stopped, the request will still be processed without any effect.
3608
+
3609
+ :param virtual_machine_id: Virtual Machine ID (required)
3610
+ :type virtual_machine_id: int
3611
+ :param _request_timeout: timeout setting for this request. If one
3612
+ number provided, it will be total request
3613
+ timeout. It can also be a pair (tuple) of
3614
+ (connection, read) timeouts.
3615
+ :type _request_timeout: int, tuple(int, int), optional
3616
+ :param _request_auth: set to override the auth_settings for an a single
3617
+ request; this effectively ignores the
3618
+ authentication in the spec for a single request.
3619
+ :type _request_auth: dict, optional
3620
+ :param _content_type: force content-type for the request.
3621
+ :type _content_type: str, Optional
3622
+ :param _headers: set to override the headers for a single
3623
+ request; this effectively ignores the headers
3624
+ in the spec for a single request.
3625
+ :type _headers: dict, optional
3626
+ :param _host_index: set to override the host_index for a single
3627
+ request; this effectively ignores the host_index
3628
+ in the spec for a single request.
3629
+ :type _host_index: int, optional
3630
+ :return: Returns the result object.
3631
+ """ # noqa: E501
3632
+
3633
+ _param = self._stop_virtual_machine_v1_serialize(
3634
+ virtual_machine_id=virtual_machine_id,
3635
+ _request_auth=_request_auth,
3636
+ _content_type=_content_type,
3637
+ _headers=_headers,
3638
+ _host_index=_host_index
3639
+ )
3640
+
3641
+ _response_types_map: Dict[str, Optional[str]] = {
3642
+ '200': "VPSV1ActionActionResource",
3643
+ '401': "CommonSchemaUnauthorizedResponseSchema",
3644
+ '500': "CommonSchemaErrorResponseSchema",
3645
+ }
3646
+ response_data = self.api_client.call_api(
3647
+ *_param,
3648
+ _request_timeout=_request_timeout
3649
+ )
3650
+ return response_data.response
3651
+
3652
+
3653
+ def _stop_virtual_machine_v1_serialize(
3654
+ self,
3655
+ virtual_machine_id,
3656
+ _request_auth,
3657
+ _content_type,
3658
+ _headers,
3659
+ _host_index,
3660
+ ) -> RequestSerialized:
3661
+
3662
+ _host = None
3663
+
3664
+ _collection_formats: Dict[str, str] = {
3665
+ }
3666
+
3667
+ _path_params: Dict[str, str] = {}
3668
+ _query_params: List[Tuple[str, str]] = []
3669
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3670
+ _form_params: List[Tuple[str, str]] = []
3671
+ _files: Dict[
3672
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3673
+ ] = {}
3674
+ _body_params: Optional[bytes] = None
3675
+
3676
+ # process the path parameters
3677
+ if virtual_machine_id is not None:
3678
+ _path_params['virtualMachineId'] = virtual_machine_id
3679
+ # process the query parameters
3680
+ # process the header parameters
3681
+ # process the form parameters
3682
+ # process the body parameter
3683
+
3684
+
3685
+ # set the HTTP header `Accept`
3686
+ if 'Accept' not in _header_params:
3687
+ _header_params['Accept'] = self.api_client.select_header_accept(
3688
+ [
3689
+ 'application/json'
3690
+ ]
3691
+ )
3692
+
3693
+
3694
+ # authentication setting
3695
+ _auth_settings: List[str] = [
3696
+ 'apiToken'
3697
+ ]
3698
+
3699
+ return self.api_client.param_serialize(
3700
+ method='POST',
3701
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/stop',
3702
+ path_params=_path_params,
3703
+ query_params=_query_params,
3704
+ header_params=_header_params,
3705
+ body=_body_params,
3706
+ post_params=_form_params,
3707
+ files=_files,
3708
+ auth_settings=_auth_settings,
3709
+ collection_formats=_collection_formats,
3710
+ _host=_host,
3711
+ _request_auth=_request_auth
3712
+ )
3713
+
3714
+