hostinger-api 0.0.1__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-0.0.1.dist-info/METADATA +29 -0
  86. hostinger_api-0.0.1.dist-info/RECORD +88 -0
  87. hostinger_api-0.0.1.dist-info/WHEEL +5 -0
  88. hostinger_api-0.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,882 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hostinger API Python SDK
5
+
6
+ API Version: 0.0.4
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 Optional
19
+ from typing_extensions import Annotated
20
+ from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource
21
+ from hostinger_api.models.vps_get_backup_list_v1200_response import VPSGetBackupListV1200Response
22
+ from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
23
+
24
+ from hostinger_api.api_client import ApiClient, RequestSerialized
25
+ from hostinger_api.api_response import ApiResponse
26
+ from hostinger_api.rest import RESTResponseType
27
+
28
+
29
+ class VPSBackupsApi:
30
+
31
+ def __init__(self, api_client=None) -> None:
32
+ if api_client is None:
33
+ api_client = ApiClient.get_default()
34
+ self.api_client = api_client
35
+
36
+
37
+ @validate_call
38
+ def delete_backup_v1(
39
+ self,
40
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
41
+ backup_id: Annotated[StrictInt, Field(description="Backup ID")],
42
+ _request_timeout: Union[
43
+ None,
44
+ Annotated[StrictFloat, Field(gt=0)],
45
+ Tuple[
46
+ Annotated[StrictFloat, Field(gt=0)],
47
+ Annotated[StrictFloat, Field(gt=0)]
48
+ ]
49
+ ] = None,
50
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
51
+ _content_type: Optional[StrictStr] = None,
52
+ _headers: Optional[Dict[StrictStr, Any]] = None,
53
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
54
+ ) -> CommonSuccessEmptyResource:
55
+ """Delete backup
56
+
57
+ This endpoint deletes a specified backup for a virtual machine.
58
+
59
+ :param virtual_machine_id: Virtual Machine ID (required)
60
+ :type virtual_machine_id: int
61
+ :param backup_id: Backup ID (required)
62
+ :type backup_id: int
63
+ :param _request_timeout: timeout setting for this request. If one
64
+ number provided, it will be total request
65
+ timeout. It can also be a pair (tuple) of
66
+ (connection, read) timeouts.
67
+ :type _request_timeout: int, tuple(int, int), optional
68
+ :param _request_auth: set to override the auth_settings for an a single
69
+ request; this effectively ignores the
70
+ authentication in the spec for a single request.
71
+ :type _request_auth: dict, optional
72
+ :param _content_type: force content-type for the request.
73
+ :type _content_type: str, Optional
74
+ :param _headers: set to override the headers for a single
75
+ request; this effectively ignores the headers
76
+ in the spec for a single request.
77
+ :type _headers: dict, optional
78
+ :param _host_index: set to override the host_index for a single
79
+ request; this effectively ignores the host_index
80
+ in the spec for a single request.
81
+ :type _host_index: int, optional
82
+ :return: Returns the result object.
83
+ """ # noqa: E501
84
+
85
+ _param = self._delete_backup_v1_serialize(
86
+ virtual_machine_id=virtual_machine_id,
87
+ backup_id=backup_id,
88
+ _request_auth=_request_auth,
89
+ _content_type=_content_type,
90
+ _headers=_headers,
91
+ _host_index=_host_index
92
+ )
93
+
94
+ _response_types_map: Dict[str, Optional[str]] = {
95
+ '200': "CommonSuccessEmptyResource",
96
+ '401': "CommonSchemaUnauthorizedResponseSchema",
97
+ '500': "CommonSchemaErrorResponseSchema",
98
+ }
99
+ response_data = self.api_client.call_api(
100
+ *_param,
101
+ _request_timeout=_request_timeout
102
+ )
103
+ response_data.read()
104
+ return self.api_client.response_deserialize(
105
+ response_data=response_data,
106
+ response_types_map=_response_types_map,
107
+ ).data
108
+
109
+
110
+ @validate_call
111
+ def delete_backup_v1_with_http_info(
112
+ self,
113
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
114
+ backup_id: Annotated[StrictInt, Field(description="Backup ID")],
115
+ _request_timeout: Union[
116
+ None,
117
+ Annotated[StrictFloat, Field(gt=0)],
118
+ Tuple[
119
+ Annotated[StrictFloat, Field(gt=0)],
120
+ Annotated[StrictFloat, Field(gt=0)]
121
+ ]
122
+ ] = None,
123
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
124
+ _content_type: Optional[StrictStr] = None,
125
+ _headers: Optional[Dict[StrictStr, Any]] = None,
126
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
127
+ ) -> ApiResponse[CommonSuccessEmptyResource]:
128
+ """Delete backup
129
+
130
+ This endpoint deletes a specified backup for a virtual machine.
131
+
132
+ :param virtual_machine_id: Virtual Machine ID (required)
133
+ :type virtual_machine_id: int
134
+ :param backup_id: Backup ID (required)
135
+ :type backup_id: int
136
+ :param _request_timeout: timeout setting for this request. If one
137
+ number provided, it will be total request
138
+ timeout. It can also be a pair (tuple) of
139
+ (connection, read) timeouts.
140
+ :type _request_timeout: int, tuple(int, int), optional
141
+ :param _request_auth: set to override the auth_settings for an a single
142
+ request; this effectively ignores the
143
+ authentication in the spec for a single request.
144
+ :type _request_auth: dict, optional
145
+ :param _content_type: force content-type for the request.
146
+ :type _content_type: str, Optional
147
+ :param _headers: set to override the headers for a single
148
+ request; this effectively ignores the headers
149
+ in the spec for a single request.
150
+ :type _headers: dict, optional
151
+ :param _host_index: set to override the host_index for a single
152
+ request; this effectively ignores the host_index
153
+ in the spec for a single request.
154
+ :type _host_index: int, optional
155
+ :return: Returns the result object.
156
+ """ # noqa: E501
157
+
158
+ _param = self._delete_backup_v1_serialize(
159
+ virtual_machine_id=virtual_machine_id,
160
+ backup_id=backup_id,
161
+ _request_auth=_request_auth,
162
+ _content_type=_content_type,
163
+ _headers=_headers,
164
+ _host_index=_host_index
165
+ )
166
+
167
+ _response_types_map: Dict[str, Optional[str]] = {
168
+ '200': "CommonSuccessEmptyResource",
169
+ '401': "CommonSchemaUnauthorizedResponseSchema",
170
+ '500': "CommonSchemaErrorResponseSchema",
171
+ }
172
+ response_data = self.api_client.call_api(
173
+ *_param,
174
+ _request_timeout=_request_timeout
175
+ )
176
+ response_data.read()
177
+ return self.api_client.response_deserialize(
178
+ response_data=response_data,
179
+ response_types_map=_response_types_map,
180
+ )
181
+
182
+
183
+ @validate_call
184
+ def delete_backup_v1_without_preload_content(
185
+ self,
186
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
187
+ backup_id: Annotated[StrictInt, Field(description="Backup ID")],
188
+ _request_timeout: Union[
189
+ None,
190
+ Annotated[StrictFloat, Field(gt=0)],
191
+ Tuple[
192
+ Annotated[StrictFloat, Field(gt=0)],
193
+ Annotated[StrictFloat, Field(gt=0)]
194
+ ]
195
+ ] = None,
196
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
197
+ _content_type: Optional[StrictStr] = None,
198
+ _headers: Optional[Dict[StrictStr, Any]] = None,
199
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
200
+ ) -> RESTResponseType:
201
+ """Delete backup
202
+
203
+ This endpoint deletes a specified backup for a virtual machine.
204
+
205
+ :param virtual_machine_id: Virtual Machine ID (required)
206
+ :type virtual_machine_id: int
207
+ :param backup_id: Backup ID (required)
208
+ :type backup_id: int
209
+ :param _request_timeout: timeout setting for this request. If one
210
+ number provided, it will be total request
211
+ timeout. It can also be a pair (tuple) of
212
+ (connection, read) timeouts.
213
+ :type _request_timeout: int, tuple(int, int), optional
214
+ :param _request_auth: set to override the auth_settings for an a single
215
+ request; this effectively ignores the
216
+ authentication in the spec for a single request.
217
+ :type _request_auth: dict, optional
218
+ :param _content_type: force content-type for the request.
219
+ :type _content_type: str, Optional
220
+ :param _headers: set to override the headers for a single
221
+ request; this effectively ignores the headers
222
+ in the spec for a single request.
223
+ :type _headers: dict, optional
224
+ :param _host_index: set to override the host_index for a single
225
+ request; this effectively ignores the host_index
226
+ in the spec for a single request.
227
+ :type _host_index: int, optional
228
+ :return: Returns the result object.
229
+ """ # noqa: E501
230
+
231
+ _param = self._delete_backup_v1_serialize(
232
+ virtual_machine_id=virtual_machine_id,
233
+ backup_id=backup_id,
234
+ _request_auth=_request_auth,
235
+ _content_type=_content_type,
236
+ _headers=_headers,
237
+ _host_index=_host_index
238
+ )
239
+
240
+ _response_types_map: Dict[str, Optional[str]] = {
241
+ '200': "CommonSuccessEmptyResource",
242
+ '401': "CommonSchemaUnauthorizedResponseSchema",
243
+ '500': "CommonSchemaErrorResponseSchema",
244
+ }
245
+ response_data = self.api_client.call_api(
246
+ *_param,
247
+ _request_timeout=_request_timeout
248
+ )
249
+ return response_data.response
250
+
251
+
252
+ def _delete_backup_v1_serialize(
253
+ self,
254
+ virtual_machine_id,
255
+ backup_id,
256
+ _request_auth,
257
+ _content_type,
258
+ _headers,
259
+ _host_index,
260
+ ) -> RequestSerialized:
261
+
262
+ _host = None
263
+
264
+ _collection_formats: Dict[str, str] = {
265
+ }
266
+
267
+ _path_params: Dict[str, str] = {}
268
+ _query_params: List[Tuple[str, str]] = []
269
+ _header_params: Dict[str, Optional[str]] = _headers or {}
270
+ _form_params: List[Tuple[str, str]] = []
271
+ _files: Dict[
272
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
273
+ ] = {}
274
+ _body_params: Optional[bytes] = None
275
+
276
+ # process the path parameters
277
+ if virtual_machine_id is not None:
278
+ _path_params['virtualMachineId'] = virtual_machine_id
279
+ if backup_id is not None:
280
+ _path_params['backupId'] = backup_id
281
+ # process the query parameters
282
+ # process the header parameters
283
+ # process the form parameters
284
+ # process the body parameter
285
+
286
+
287
+ # set the HTTP header `Accept`
288
+ if 'Accept' not in _header_params:
289
+ _header_params['Accept'] = self.api_client.select_header_accept(
290
+ [
291
+ 'application/json'
292
+ ]
293
+ )
294
+
295
+
296
+ # authentication setting
297
+ _auth_settings: List[str] = [
298
+ 'apiToken'
299
+ ]
300
+
301
+ return self.api_client.param_serialize(
302
+ method='DELETE',
303
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/backups/{backupId}',
304
+ path_params=_path_params,
305
+ query_params=_query_params,
306
+ header_params=_header_params,
307
+ body=_body_params,
308
+ post_params=_form_params,
309
+ files=_files,
310
+ auth_settings=_auth_settings,
311
+ collection_formats=_collection_formats,
312
+ _host=_host,
313
+ _request_auth=_request_auth
314
+ )
315
+
316
+
317
+
318
+
319
+ @validate_call
320
+ def get_backup_list_v1(
321
+ self,
322
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
323
+ page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
324
+ _request_timeout: Union[
325
+ None,
326
+ Annotated[StrictFloat, Field(gt=0)],
327
+ Tuple[
328
+ Annotated[StrictFloat, Field(gt=0)],
329
+ Annotated[StrictFloat, Field(gt=0)]
330
+ ]
331
+ ] = None,
332
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
333
+ _content_type: Optional[StrictStr] = None,
334
+ _headers: Optional[Dict[StrictStr, Any]] = None,
335
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
336
+ ) -> VPSGetBackupListV1200Response:
337
+ """Get backup list
338
+
339
+ This endpoint retrieves a list of backups for a specified virtual machine.
340
+
341
+ :param virtual_machine_id: Virtual Machine ID (required)
342
+ :type virtual_machine_id: int
343
+ :param page: Page number
344
+ :type page: int
345
+ :param _request_timeout: timeout setting for this request. If one
346
+ number provided, it will be total request
347
+ timeout. It can also be a pair (tuple) of
348
+ (connection, read) timeouts.
349
+ :type _request_timeout: int, tuple(int, int), optional
350
+ :param _request_auth: set to override the auth_settings for an a single
351
+ request; this effectively ignores the
352
+ authentication in the spec for a single request.
353
+ :type _request_auth: dict, optional
354
+ :param _content_type: force content-type for the request.
355
+ :type _content_type: str, Optional
356
+ :param _headers: set to override the headers for a single
357
+ request; this effectively ignores the headers
358
+ in the spec for a single request.
359
+ :type _headers: dict, optional
360
+ :param _host_index: set to override the host_index for a single
361
+ request; this effectively ignores the host_index
362
+ in the spec for a single request.
363
+ :type _host_index: int, optional
364
+ :return: Returns the result object.
365
+ """ # noqa: E501
366
+
367
+ _param = self._get_backup_list_v1_serialize(
368
+ virtual_machine_id=virtual_machine_id,
369
+ page=page,
370
+ _request_auth=_request_auth,
371
+ _content_type=_content_type,
372
+ _headers=_headers,
373
+ _host_index=_host_index
374
+ )
375
+
376
+ _response_types_map: Dict[str, Optional[str]] = {
377
+ '200': "VPSGetBackupListV1200Response",
378
+ '401': "CommonSchemaUnauthorizedResponseSchema",
379
+ '500': "CommonSchemaErrorResponseSchema",
380
+ }
381
+ response_data = self.api_client.call_api(
382
+ *_param,
383
+ _request_timeout=_request_timeout
384
+ )
385
+ response_data.read()
386
+ return self.api_client.response_deserialize(
387
+ response_data=response_data,
388
+ response_types_map=_response_types_map,
389
+ ).data
390
+
391
+
392
+ @validate_call
393
+ def get_backup_list_v1_with_http_info(
394
+ self,
395
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
396
+ page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
397
+ _request_timeout: Union[
398
+ None,
399
+ Annotated[StrictFloat, Field(gt=0)],
400
+ Tuple[
401
+ Annotated[StrictFloat, Field(gt=0)],
402
+ Annotated[StrictFloat, Field(gt=0)]
403
+ ]
404
+ ] = None,
405
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
406
+ _content_type: Optional[StrictStr] = None,
407
+ _headers: Optional[Dict[StrictStr, Any]] = None,
408
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
409
+ ) -> ApiResponse[VPSGetBackupListV1200Response]:
410
+ """Get backup list
411
+
412
+ This endpoint retrieves a list of backups for a specified virtual machine.
413
+
414
+ :param virtual_machine_id: Virtual Machine ID (required)
415
+ :type virtual_machine_id: int
416
+ :param page: Page number
417
+ :type page: int
418
+ :param _request_timeout: timeout setting for this request. If one
419
+ number provided, it will be total request
420
+ timeout. It can also be a pair (tuple) of
421
+ (connection, read) timeouts.
422
+ :type _request_timeout: int, tuple(int, int), optional
423
+ :param _request_auth: set to override the auth_settings for an a single
424
+ request; this effectively ignores the
425
+ authentication in the spec for a single request.
426
+ :type _request_auth: dict, optional
427
+ :param _content_type: force content-type for the request.
428
+ :type _content_type: str, Optional
429
+ :param _headers: set to override the headers for a single
430
+ request; this effectively ignores the headers
431
+ in the spec for a single request.
432
+ :type _headers: dict, optional
433
+ :param _host_index: set to override the host_index for a single
434
+ request; this effectively ignores the host_index
435
+ in the spec for a single request.
436
+ :type _host_index: int, optional
437
+ :return: Returns the result object.
438
+ """ # noqa: E501
439
+
440
+ _param = self._get_backup_list_v1_serialize(
441
+ virtual_machine_id=virtual_machine_id,
442
+ page=page,
443
+ _request_auth=_request_auth,
444
+ _content_type=_content_type,
445
+ _headers=_headers,
446
+ _host_index=_host_index
447
+ )
448
+
449
+ _response_types_map: Dict[str, Optional[str]] = {
450
+ '200': "VPSGetBackupListV1200Response",
451
+ '401': "CommonSchemaUnauthorizedResponseSchema",
452
+ '500': "CommonSchemaErrorResponseSchema",
453
+ }
454
+ response_data = self.api_client.call_api(
455
+ *_param,
456
+ _request_timeout=_request_timeout
457
+ )
458
+ response_data.read()
459
+ return self.api_client.response_deserialize(
460
+ response_data=response_data,
461
+ response_types_map=_response_types_map,
462
+ )
463
+
464
+
465
+ @validate_call
466
+ def get_backup_list_v1_without_preload_content(
467
+ self,
468
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
469
+ page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
470
+ _request_timeout: Union[
471
+ None,
472
+ Annotated[StrictFloat, Field(gt=0)],
473
+ Tuple[
474
+ Annotated[StrictFloat, Field(gt=0)],
475
+ Annotated[StrictFloat, Field(gt=0)]
476
+ ]
477
+ ] = None,
478
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
479
+ _content_type: Optional[StrictStr] = None,
480
+ _headers: Optional[Dict[StrictStr, Any]] = None,
481
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
482
+ ) -> RESTResponseType:
483
+ """Get backup list
484
+
485
+ This endpoint retrieves a list of backups for a specified virtual machine.
486
+
487
+ :param virtual_machine_id: Virtual Machine ID (required)
488
+ :type virtual_machine_id: int
489
+ :param page: Page number
490
+ :type page: int
491
+ :param _request_timeout: timeout setting for this request. If one
492
+ number provided, it will be total request
493
+ timeout. It can also be a pair (tuple) of
494
+ (connection, read) timeouts.
495
+ :type _request_timeout: int, tuple(int, int), optional
496
+ :param _request_auth: set to override the auth_settings for an a single
497
+ request; this effectively ignores the
498
+ authentication in the spec for a single request.
499
+ :type _request_auth: dict, optional
500
+ :param _content_type: force content-type for the request.
501
+ :type _content_type: str, Optional
502
+ :param _headers: set to override the headers for a single
503
+ request; this effectively ignores the headers
504
+ in the spec for a single request.
505
+ :type _headers: dict, optional
506
+ :param _host_index: set to override the host_index for a single
507
+ request; this effectively ignores the host_index
508
+ in the spec for a single request.
509
+ :type _host_index: int, optional
510
+ :return: Returns the result object.
511
+ """ # noqa: E501
512
+
513
+ _param = self._get_backup_list_v1_serialize(
514
+ virtual_machine_id=virtual_machine_id,
515
+ page=page,
516
+ _request_auth=_request_auth,
517
+ _content_type=_content_type,
518
+ _headers=_headers,
519
+ _host_index=_host_index
520
+ )
521
+
522
+ _response_types_map: Dict[str, Optional[str]] = {
523
+ '200': "VPSGetBackupListV1200Response",
524
+ '401': "CommonSchemaUnauthorizedResponseSchema",
525
+ '500': "CommonSchemaErrorResponseSchema",
526
+ }
527
+ response_data = self.api_client.call_api(
528
+ *_param,
529
+ _request_timeout=_request_timeout
530
+ )
531
+ return response_data.response
532
+
533
+
534
+ def _get_backup_list_v1_serialize(
535
+ self,
536
+ virtual_machine_id,
537
+ page,
538
+ _request_auth,
539
+ _content_type,
540
+ _headers,
541
+ _host_index,
542
+ ) -> RequestSerialized:
543
+
544
+ _host = None
545
+
546
+ _collection_formats: Dict[str, str] = {
547
+ }
548
+
549
+ _path_params: Dict[str, str] = {}
550
+ _query_params: List[Tuple[str, str]] = []
551
+ _header_params: Dict[str, Optional[str]] = _headers or {}
552
+ _form_params: List[Tuple[str, str]] = []
553
+ _files: Dict[
554
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
555
+ ] = {}
556
+ _body_params: Optional[bytes] = None
557
+
558
+ # process the path parameters
559
+ if virtual_machine_id is not None:
560
+ _path_params['virtualMachineId'] = virtual_machine_id
561
+ # process the query parameters
562
+ if page is not None:
563
+
564
+ _query_params.append(('page', page))
565
+
566
+ # process the header parameters
567
+ # process the form parameters
568
+ # process the body parameter
569
+
570
+
571
+ # set the HTTP header `Accept`
572
+ if 'Accept' not in _header_params:
573
+ _header_params['Accept'] = self.api_client.select_header_accept(
574
+ [
575
+ 'application/json'
576
+ ]
577
+ )
578
+
579
+
580
+ # authentication setting
581
+ _auth_settings: List[str] = [
582
+ 'apiToken'
583
+ ]
584
+
585
+ return self.api_client.param_serialize(
586
+ method='GET',
587
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/backups',
588
+ path_params=_path_params,
589
+ query_params=_query_params,
590
+ header_params=_header_params,
591
+ body=_body_params,
592
+ post_params=_form_params,
593
+ files=_files,
594
+ auth_settings=_auth_settings,
595
+ collection_formats=_collection_formats,
596
+ _host=_host,
597
+ _request_auth=_request_auth
598
+ )
599
+
600
+
601
+
602
+
603
+ @validate_call
604
+ def restore_backup_v1(
605
+ self,
606
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
607
+ backup_id: Annotated[StrictInt, Field(description="Backup ID")],
608
+ _request_timeout: Union[
609
+ None,
610
+ Annotated[StrictFloat, Field(gt=0)],
611
+ Tuple[
612
+ Annotated[StrictFloat, Field(gt=0)],
613
+ Annotated[StrictFloat, Field(gt=0)]
614
+ ]
615
+ ] = None,
616
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
617
+ _content_type: Optional[StrictStr] = None,
618
+ _headers: Optional[Dict[StrictStr, Any]] = None,
619
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
620
+ ) -> VPSV1ActionActionResource:
621
+ """Restore backup
622
+
623
+ This endpoint restores a backup for a specified virtual machine. The system will then initiate the restore process, which may take some time depending on the size of the backup. **All data on the virtual machine will be overwritten with the data from the backup.**
624
+
625
+ :param virtual_machine_id: Virtual Machine ID (required)
626
+ :type virtual_machine_id: int
627
+ :param backup_id: Backup ID (required)
628
+ :type backup_id: int
629
+ :param _request_timeout: timeout setting for this request. If one
630
+ number provided, it will be total request
631
+ timeout. It can also be a pair (tuple) of
632
+ (connection, read) timeouts.
633
+ :type _request_timeout: int, tuple(int, int), optional
634
+ :param _request_auth: set to override the auth_settings for an a single
635
+ request; this effectively ignores the
636
+ authentication in the spec for a single request.
637
+ :type _request_auth: dict, optional
638
+ :param _content_type: force content-type for the request.
639
+ :type _content_type: str, Optional
640
+ :param _headers: set to override the headers for a single
641
+ request; this effectively ignores the headers
642
+ in the spec for a single request.
643
+ :type _headers: dict, optional
644
+ :param _host_index: set to override the host_index for a single
645
+ request; this effectively ignores the host_index
646
+ in the spec for a single request.
647
+ :type _host_index: int, optional
648
+ :return: Returns the result object.
649
+ """ # noqa: E501
650
+
651
+ _param = self._restore_backup_v1_serialize(
652
+ virtual_machine_id=virtual_machine_id,
653
+ backup_id=backup_id,
654
+ _request_auth=_request_auth,
655
+ _content_type=_content_type,
656
+ _headers=_headers,
657
+ _host_index=_host_index
658
+ )
659
+
660
+ _response_types_map: Dict[str, Optional[str]] = {
661
+ '200': "VPSV1ActionActionResource",
662
+ '401': "CommonSchemaUnauthorizedResponseSchema",
663
+ '500': "CommonSchemaErrorResponseSchema",
664
+ }
665
+ response_data = self.api_client.call_api(
666
+ *_param,
667
+ _request_timeout=_request_timeout
668
+ )
669
+ response_data.read()
670
+ return self.api_client.response_deserialize(
671
+ response_data=response_data,
672
+ response_types_map=_response_types_map,
673
+ ).data
674
+
675
+
676
+ @validate_call
677
+ def restore_backup_v1_with_http_info(
678
+ self,
679
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
680
+ backup_id: Annotated[StrictInt, Field(description="Backup ID")],
681
+ _request_timeout: Union[
682
+ None,
683
+ Annotated[StrictFloat, Field(gt=0)],
684
+ Tuple[
685
+ Annotated[StrictFloat, Field(gt=0)],
686
+ Annotated[StrictFloat, Field(gt=0)]
687
+ ]
688
+ ] = None,
689
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
690
+ _content_type: Optional[StrictStr] = None,
691
+ _headers: Optional[Dict[StrictStr, Any]] = None,
692
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
693
+ ) -> ApiResponse[VPSV1ActionActionResource]:
694
+ """Restore backup
695
+
696
+ This endpoint restores a backup for a specified virtual machine. The system will then initiate the restore process, which may take some time depending on the size of the backup. **All data on the virtual machine will be overwritten with the data from the backup.**
697
+
698
+ :param virtual_machine_id: Virtual Machine ID (required)
699
+ :type virtual_machine_id: int
700
+ :param backup_id: Backup ID (required)
701
+ :type backup_id: int
702
+ :param _request_timeout: timeout setting for this request. If one
703
+ number provided, it will be total request
704
+ timeout. It can also be a pair (tuple) of
705
+ (connection, read) timeouts.
706
+ :type _request_timeout: int, tuple(int, int), optional
707
+ :param _request_auth: set to override the auth_settings for an a single
708
+ request; this effectively ignores the
709
+ authentication in the spec for a single request.
710
+ :type _request_auth: dict, optional
711
+ :param _content_type: force content-type for the request.
712
+ :type _content_type: str, Optional
713
+ :param _headers: set to override the headers for a single
714
+ request; this effectively ignores the headers
715
+ in the spec for a single request.
716
+ :type _headers: dict, optional
717
+ :param _host_index: set to override the host_index for a single
718
+ request; this effectively ignores the host_index
719
+ in the spec for a single request.
720
+ :type _host_index: int, optional
721
+ :return: Returns the result object.
722
+ """ # noqa: E501
723
+
724
+ _param = self._restore_backup_v1_serialize(
725
+ virtual_machine_id=virtual_machine_id,
726
+ backup_id=backup_id,
727
+ _request_auth=_request_auth,
728
+ _content_type=_content_type,
729
+ _headers=_headers,
730
+ _host_index=_host_index
731
+ )
732
+
733
+ _response_types_map: Dict[str, Optional[str]] = {
734
+ '200': "VPSV1ActionActionResource",
735
+ '401': "CommonSchemaUnauthorizedResponseSchema",
736
+ '500': "CommonSchemaErrorResponseSchema",
737
+ }
738
+ response_data = self.api_client.call_api(
739
+ *_param,
740
+ _request_timeout=_request_timeout
741
+ )
742
+ response_data.read()
743
+ return self.api_client.response_deserialize(
744
+ response_data=response_data,
745
+ response_types_map=_response_types_map,
746
+ )
747
+
748
+
749
+ @validate_call
750
+ def restore_backup_v1_without_preload_content(
751
+ self,
752
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
753
+ backup_id: Annotated[StrictInt, Field(description="Backup ID")],
754
+ _request_timeout: Union[
755
+ None,
756
+ Annotated[StrictFloat, Field(gt=0)],
757
+ Tuple[
758
+ Annotated[StrictFloat, Field(gt=0)],
759
+ Annotated[StrictFloat, Field(gt=0)]
760
+ ]
761
+ ] = None,
762
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
763
+ _content_type: Optional[StrictStr] = None,
764
+ _headers: Optional[Dict[StrictStr, Any]] = None,
765
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
766
+ ) -> RESTResponseType:
767
+ """Restore backup
768
+
769
+ This endpoint restores a backup for a specified virtual machine. The system will then initiate the restore process, which may take some time depending on the size of the backup. **All data on the virtual machine will be overwritten with the data from the backup.**
770
+
771
+ :param virtual_machine_id: Virtual Machine ID (required)
772
+ :type virtual_machine_id: int
773
+ :param backup_id: Backup ID (required)
774
+ :type backup_id: int
775
+ :param _request_timeout: timeout setting for this request. If one
776
+ number provided, it will be total request
777
+ timeout. It can also be a pair (tuple) of
778
+ (connection, read) timeouts.
779
+ :type _request_timeout: int, tuple(int, int), optional
780
+ :param _request_auth: set to override the auth_settings for an a single
781
+ request; this effectively ignores the
782
+ authentication in the spec for a single request.
783
+ :type _request_auth: dict, optional
784
+ :param _content_type: force content-type for the request.
785
+ :type _content_type: str, Optional
786
+ :param _headers: set to override the headers for a single
787
+ request; this effectively ignores the headers
788
+ in the spec for a single request.
789
+ :type _headers: dict, optional
790
+ :param _host_index: set to override the host_index for a single
791
+ request; this effectively ignores the host_index
792
+ in the spec for a single request.
793
+ :type _host_index: int, optional
794
+ :return: Returns the result object.
795
+ """ # noqa: E501
796
+
797
+ _param = self._restore_backup_v1_serialize(
798
+ virtual_machine_id=virtual_machine_id,
799
+ backup_id=backup_id,
800
+ _request_auth=_request_auth,
801
+ _content_type=_content_type,
802
+ _headers=_headers,
803
+ _host_index=_host_index
804
+ )
805
+
806
+ _response_types_map: Dict[str, Optional[str]] = {
807
+ '200': "VPSV1ActionActionResource",
808
+ '401': "CommonSchemaUnauthorizedResponseSchema",
809
+ '500': "CommonSchemaErrorResponseSchema",
810
+ }
811
+ response_data = self.api_client.call_api(
812
+ *_param,
813
+ _request_timeout=_request_timeout
814
+ )
815
+ return response_data.response
816
+
817
+
818
+ def _restore_backup_v1_serialize(
819
+ self,
820
+ virtual_machine_id,
821
+ backup_id,
822
+ _request_auth,
823
+ _content_type,
824
+ _headers,
825
+ _host_index,
826
+ ) -> RequestSerialized:
827
+
828
+ _host = None
829
+
830
+ _collection_formats: Dict[str, str] = {
831
+ }
832
+
833
+ _path_params: Dict[str, str] = {}
834
+ _query_params: List[Tuple[str, str]] = []
835
+ _header_params: Dict[str, Optional[str]] = _headers or {}
836
+ _form_params: List[Tuple[str, str]] = []
837
+ _files: Dict[
838
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
839
+ ] = {}
840
+ _body_params: Optional[bytes] = None
841
+
842
+ # process the path parameters
843
+ if virtual_machine_id is not None:
844
+ _path_params['virtualMachineId'] = virtual_machine_id
845
+ if backup_id is not None:
846
+ _path_params['backupId'] = backup_id
847
+ # process the query parameters
848
+ # process the header parameters
849
+ # process the form parameters
850
+ # process the body parameter
851
+
852
+
853
+ # set the HTTP header `Accept`
854
+ if 'Accept' not in _header_params:
855
+ _header_params['Accept'] = self.api_client.select_header_accept(
856
+ [
857
+ 'application/json'
858
+ ]
859
+ )
860
+
861
+
862
+ # authentication setting
863
+ _auth_settings: List[str] = [
864
+ 'apiToken'
865
+ ]
866
+
867
+ return self.api_client.param_serialize(
868
+ method='POST',
869
+ resource_path='/api/vps/v1/virtual-machines/{virtualMachineId}/backups/{backupId}/restore',
870
+ path_params=_path_params,
871
+ query_params=_query_params,
872
+ header_params=_header_params,
873
+ body=_body_params,
874
+ post_params=_form_params,
875
+ files=_files,
876
+ auth_settings=_auth_settings,
877
+ collection_formats=_collection_formats,
878
+ _host=_host,
879
+ _request_auth=_request_auth
880
+ )
881
+
882
+