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,551 @@
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_template_template_resource import VPSV1TemplateTemplateResource
21
+
22
+ from hostinger_api.api_client import ApiClient, RequestSerialized
23
+ from hostinger_api.api_response import ApiResponse
24
+ from hostinger_api.rest import RESTResponseType
25
+
26
+
27
+ class VPSOSTemplatesApi:
28
+
29
+ def __init__(self, api_client=None) -> None:
30
+ if api_client is None:
31
+ api_client = ApiClient.get_default()
32
+ self.api_client = api_client
33
+
34
+
35
+ @validate_call
36
+ def get_template_list_v1(
37
+ self,
38
+ _request_timeout: Union[
39
+ None,
40
+ Annotated[StrictFloat, Field(gt=0)],
41
+ Tuple[
42
+ Annotated[StrictFloat, Field(gt=0)],
43
+ Annotated[StrictFloat, Field(gt=0)]
44
+ ]
45
+ ] = None,
46
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
47
+ _content_type: Optional[StrictStr] = None,
48
+ _headers: Optional[Dict[StrictStr, Any]] = None,
49
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
50
+ ) -> List[VPSV1TemplateTemplateResource]:
51
+ """Get template list
52
+
53
+ This endpoint retrieves a list of available OS templates for virtual machines.
54
+
55
+ :param _request_timeout: timeout setting for this request. If one
56
+ number provided, it will be total request
57
+ timeout. It can also be a pair (tuple) of
58
+ (connection, read) timeouts.
59
+ :type _request_timeout: int, tuple(int, int), optional
60
+ :param _request_auth: set to override the auth_settings for an a single
61
+ request; this effectively ignores the
62
+ authentication in the spec for a single request.
63
+ :type _request_auth: dict, optional
64
+ :param _content_type: force content-type for the request.
65
+ :type _content_type: str, Optional
66
+ :param _headers: set to override the headers for a single
67
+ request; this effectively ignores the headers
68
+ in the spec for a single request.
69
+ :type _headers: dict, optional
70
+ :param _host_index: set to override the host_index for a single
71
+ request; this effectively ignores the host_index
72
+ in the spec for a single request.
73
+ :type _host_index: int, optional
74
+ :return: Returns the result object.
75
+ """ # noqa: E501
76
+
77
+ _param = self._get_template_list_v1_serialize(
78
+ _request_auth=_request_auth,
79
+ _content_type=_content_type,
80
+ _headers=_headers,
81
+ _host_index=_host_index
82
+ )
83
+
84
+ _response_types_map: Dict[str, Optional[str]] = {
85
+ '200': "List[VPSV1TemplateTemplateResource]",
86
+ '401': "CommonSchemaUnauthorizedResponseSchema",
87
+ '500': "CommonSchemaErrorResponseSchema",
88
+ }
89
+ response_data = self.api_client.call_api(
90
+ *_param,
91
+ _request_timeout=_request_timeout
92
+ )
93
+ response_data.read()
94
+ return self.api_client.response_deserialize(
95
+ response_data=response_data,
96
+ response_types_map=_response_types_map,
97
+ ).data
98
+
99
+
100
+ @validate_call
101
+ def get_template_list_v1_with_http_info(
102
+ self,
103
+ _request_timeout: Union[
104
+ None,
105
+ Annotated[StrictFloat, Field(gt=0)],
106
+ Tuple[
107
+ Annotated[StrictFloat, Field(gt=0)],
108
+ Annotated[StrictFloat, Field(gt=0)]
109
+ ]
110
+ ] = None,
111
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
112
+ _content_type: Optional[StrictStr] = None,
113
+ _headers: Optional[Dict[StrictStr, Any]] = None,
114
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
115
+ ) -> ApiResponse[List[VPSV1TemplateTemplateResource]]:
116
+ """Get template list
117
+
118
+ This endpoint retrieves a list of available OS templates for virtual machines.
119
+
120
+ :param _request_timeout: timeout setting for this request. If one
121
+ number provided, it will be total request
122
+ timeout. It can also be a pair (tuple) of
123
+ (connection, read) timeouts.
124
+ :type _request_timeout: int, tuple(int, int), optional
125
+ :param _request_auth: set to override the auth_settings for an a single
126
+ request; this effectively ignores the
127
+ authentication in the spec for a single request.
128
+ :type _request_auth: dict, optional
129
+ :param _content_type: force content-type for the request.
130
+ :type _content_type: str, Optional
131
+ :param _headers: set to override the headers for a single
132
+ request; this effectively ignores the headers
133
+ in the spec for a single request.
134
+ :type _headers: dict, optional
135
+ :param _host_index: set to override the host_index for a single
136
+ request; this effectively ignores the host_index
137
+ in the spec for a single request.
138
+ :type _host_index: int, optional
139
+ :return: Returns the result object.
140
+ """ # noqa: E501
141
+
142
+ _param = self._get_template_list_v1_serialize(
143
+ _request_auth=_request_auth,
144
+ _content_type=_content_type,
145
+ _headers=_headers,
146
+ _host_index=_host_index
147
+ )
148
+
149
+ _response_types_map: Dict[str, Optional[str]] = {
150
+ '200': "List[VPSV1TemplateTemplateResource]",
151
+ '401': "CommonSchemaUnauthorizedResponseSchema",
152
+ '500': "CommonSchemaErrorResponseSchema",
153
+ }
154
+ response_data = self.api_client.call_api(
155
+ *_param,
156
+ _request_timeout=_request_timeout
157
+ )
158
+ response_data.read()
159
+ return self.api_client.response_deserialize(
160
+ response_data=response_data,
161
+ response_types_map=_response_types_map,
162
+ )
163
+
164
+
165
+ @validate_call
166
+ def get_template_list_v1_without_preload_content(
167
+ self,
168
+ _request_timeout: Union[
169
+ None,
170
+ Annotated[StrictFloat, Field(gt=0)],
171
+ Tuple[
172
+ Annotated[StrictFloat, Field(gt=0)],
173
+ Annotated[StrictFloat, Field(gt=0)]
174
+ ]
175
+ ] = None,
176
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
177
+ _content_type: Optional[StrictStr] = None,
178
+ _headers: Optional[Dict[StrictStr, Any]] = None,
179
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
180
+ ) -> RESTResponseType:
181
+ """Get template list
182
+
183
+ This endpoint retrieves a list of available OS templates for virtual machines.
184
+
185
+ :param _request_timeout: timeout setting for this request. If one
186
+ number provided, it will be total request
187
+ timeout. It can also be a pair (tuple) of
188
+ (connection, read) timeouts.
189
+ :type _request_timeout: int, tuple(int, int), optional
190
+ :param _request_auth: set to override the auth_settings for an a single
191
+ request; this effectively ignores the
192
+ authentication in the spec for a single request.
193
+ :type _request_auth: dict, optional
194
+ :param _content_type: force content-type for the request.
195
+ :type _content_type: str, Optional
196
+ :param _headers: set to override the headers for a single
197
+ request; this effectively ignores the headers
198
+ in the spec for a single request.
199
+ :type _headers: dict, optional
200
+ :param _host_index: set to override the host_index for a single
201
+ request; this effectively ignores the host_index
202
+ in the spec for a single request.
203
+ :type _host_index: int, optional
204
+ :return: Returns the result object.
205
+ """ # noqa: E501
206
+
207
+ _param = self._get_template_list_v1_serialize(
208
+ _request_auth=_request_auth,
209
+ _content_type=_content_type,
210
+ _headers=_headers,
211
+ _host_index=_host_index
212
+ )
213
+
214
+ _response_types_map: Dict[str, Optional[str]] = {
215
+ '200': "List[VPSV1TemplateTemplateResource]",
216
+ '401': "CommonSchemaUnauthorizedResponseSchema",
217
+ '500': "CommonSchemaErrorResponseSchema",
218
+ }
219
+ response_data = self.api_client.call_api(
220
+ *_param,
221
+ _request_timeout=_request_timeout
222
+ )
223
+ return response_data.response
224
+
225
+
226
+ def _get_template_list_v1_serialize(
227
+ self,
228
+ _request_auth,
229
+ _content_type,
230
+ _headers,
231
+ _host_index,
232
+ ) -> RequestSerialized:
233
+
234
+ _host = None
235
+
236
+ _collection_formats: Dict[str, str] = {
237
+ }
238
+
239
+ _path_params: Dict[str, str] = {}
240
+ _query_params: List[Tuple[str, str]] = []
241
+ _header_params: Dict[str, Optional[str]] = _headers or {}
242
+ _form_params: List[Tuple[str, str]] = []
243
+ _files: Dict[
244
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
245
+ ] = {}
246
+ _body_params: Optional[bytes] = None
247
+
248
+ # process the path parameters
249
+ # process the query parameters
250
+ # process the header parameters
251
+ # process the form parameters
252
+ # process the body parameter
253
+
254
+
255
+ # set the HTTP header `Accept`
256
+ if 'Accept' not in _header_params:
257
+ _header_params['Accept'] = self.api_client.select_header_accept(
258
+ [
259
+ 'application/json'
260
+ ]
261
+ )
262
+
263
+
264
+ # authentication setting
265
+ _auth_settings: List[str] = [
266
+ 'apiToken'
267
+ ]
268
+
269
+ return self.api_client.param_serialize(
270
+ method='GET',
271
+ resource_path='/api/vps/v1/templates',
272
+ path_params=_path_params,
273
+ query_params=_query_params,
274
+ header_params=_header_params,
275
+ body=_body_params,
276
+ post_params=_form_params,
277
+ files=_files,
278
+ auth_settings=_auth_settings,
279
+ collection_formats=_collection_formats,
280
+ _host=_host,
281
+ _request_auth=_request_auth
282
+ )
283
+
284
+
285
+
286
+
287
+ @validate_call
288
+ def get_template_v1(
289
+ self,
290
+ template_id: Annotated[StrictInt, Field(description="Template ID")],
291
+ _request_timeout: Union[
292
+ None,
293
+ Annotated[StrictFloat, Field(gt=0)],
294
+ Tuple[
295
+ Annotated[StrictFloat, Field(gt=0)],
296
+ Annotated[StrictFloat, Field(gt=0)]
297
+ ]
298
+ ] = None,
299
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
300
+ _content_type: Optional[StrictStr] = None,
301
+ _headers: Optional[Dict[StrictStr, Any]] = None,
302
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
303
+ ) -> VPSV1TemplateTemplateResource:
304
+ """Get template
305
+
306
+ This endpoint retrieves details of a specific OS template for virtual machines.
307
+
308
+ :param template_id: Template ID (required)
309
+ :type template_id: int
310
+ :param _request_timeout: timeout setting for this request. If one
311
+ number provided, it will be total request
312
+ timeout. It can also be a pair (tuple) of
313
+ (connection, read) timeouts.
314
+ :type _request_timeout: int, tuple(int, int), optional
315
+ :param _request_auth: set to override the auth_settings for an a single
316
+ request; this effectively ignores the
317
+ authentication in the spec for a single request.
318
+ :type _request_auth: dict, optional
319
+ :param _content_type: force content-type for the request.
320
+ :type _content_type: str, Optional
321
+ :param _headers: set to override the headers for a single
322
+ request; this effectively ignores the headers
323
+ in the spec for a single request.
324
+ :type _headers: dict, optional
325
+ :param _host_index: set to override the host_index for a single
326
+ request; this effectively ignores the host_index
327
+ in the spec for a single request.
328
+ :type _host_index: int, optional
329
+ :return: Returns the result object.
330
+ """ # noqa: E501
331
+
332
+ _param = self._get_template_v1_serialize(
333
+ template_id=template_id,
334
+ _request_auth=_request_auth,
335
+ _content_type=_content_type,
336
+ _headers=_headers,
337
+ _host_index=_host_index
338
+ )
339
+
340
+ _response_types_map: Dict[str, Optional[str]] = {
341
+ '200': "VPSV1TemplateTemplateResource",
342
+ '401': "CommonSchemaUnauthorizedResponseSchema",
343
+ '500': "CommonSchemaErrorResponseSchema",
344
+ }
345
+ response_data = self.api_client.call_api(
346
+ *_param,
347
+ _request_timeout=_request_timeout
348
+ )
349
+ response_data.read()
350
+ return self.api_client.response_deserialize(
351
+ response_data=response_data,
352
+ response_types_map=_response_types_map,
353
+ ).data
354
+
355
+
356
+ @validate_call
357
+ def get_template_v1_with_http_info(
358
+ self,
359
+ template_id: Annotated[StrictInt, Field(description="Template ID")],
360
+ _request_timeout: Union[
361
+ None,
362
+ Annotated[StrictFloat, Field(gt=0)],
363
+ Tuple[
364
+ Annotated[StrictFloat, Field(gt=0)],
365
+ Annotated[StrictFloat, Field(gt=0)]
366
+ ]
367
+ ] = None,
368
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
369
+ _content_type: Optional[StrictStr] = None,
370
+ _headers: Optional[Dict[StrictStr, Any]] = None,
371
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
372
+ ) -> ApiResponse[VPSV1TemplateTemplateResource]:
373
+ """Get template
374
+
375
+ This endpoint retrieves details of a specific OS template for virtual machines.
376
+
377
+ :param template_id: Template ID (required)
378
+ :type template_id: int
379
+ :param _request_timeout: timeout setting for this request. If one
380
+ number provided, it will be total request
381
+ timeout. It can also be a pair (tuple) of
382
+ (connection, read) timeouts.
383
+ :type _request_timeout: int, tuple(int, int), optional
384
+ :param _request_auth: set to override the auth_settings for an a single
385
+ request; this effectively ignores the
386
+ authentication in the spec for a single request.
387
+ :type _request_auth: dict, optional
388
+ :param _content_type: force content-type for the request.
389
+ :type _content_type: str, Optional
390
+ :param _headers: set to override the headers for a single
391
+ request; this effectively ignores the headers
392
+ in the spec for a single request.
393
+ :type _headers: dict, optional
394
+ :param _host_index: set to override the host_index for a single
395
+ request; this effectively ignores the host_index
396
+ in the spec for a single request.
397
+ :type _host_index: int, optional
398
+ :return: Returns the result object.
399
+ """ # noqa: E501
400
+
401
+ _param = self._get_template_v1_serialize(
402
+ template_id=template_id,
403
+ _request_auth=_request_auth,
404
+ _content_type=_content_type,
405
+ _headers=_headers,
406
+ _host_index=_host_index
407
+ )
408
+
409
+ _response_types_map: Dict[str, Optional[str]] = {
410
+ '200': "VPSV1TemplateTemplateResource",
411
+ '401': "CommonSchemaUnauthorizedResponseSchema",
412
+ '500': "CommonSchemaErrorResponseSchema",
413
+ }
414
+ response_data = self.api_client.call_api(
415
+ *_param,
416
+ _request_timeout=_request_timeout
417
+ )
418
+ response_data.read()
419
+ return self.api_client.response_deserialize(
420
+ response_data=response_data,
421
+ response_types_map=_response_types_map,
422
+ )
423
+
424
+
425
+ @validate_call
426
+ def get_template_v1_without_preload_content(
427
+ self,
428
+ template_id: Annotated[StrictInt, Field(description="Template ID")],
429
+ _request_timeout: Union[
430
+ None,
431
+ Annotated[StrictFloat, Field(gt=0)],
432
+ Tuple[
433
+ Annotated[StrictFloat, Field(gt=0)],
434
+ Annotated[StrictFloat, Field(gt=0)]
435
+ ]
436
+ ] = None,
437
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
438
+ _content_type: Optional[StrictStr] = None,
439
+ _headers: Optional[Dict[StrictStr, Any]] = None,
440
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
441
+ ) -> RESTResponseType:
442
+ """Get template
443
+
444
+ This endpoint retrieves details of a specific OS template for virtual machines.
445
+
446
+ :param template_id: Template ID (required)
447
+ :type template_id: int
448
+ :param _request_timeout: timeout setting for this request. If one
449
+ number provided, it will be total request
450
+ timeout. It can also be a pair (tuple) of
451
+ (connection, read) timeouts.
452
+ :type _request_timeout: int, tuple(int, int), optional
453
+ :param _request_auth: set to override the auth_settings for an a single
454
+ request; this effectively ignores the
455
+ authentication in the spec for a single request.
456
+ :type _request_auth: dict, optional
457
+ :param _content_type: force content-type for the request.
458
+ :type _content_type: str, Optional
459
+ :param _headers: set to override the headers for a single
460
+ request; this effectively ignores the headers
461
+ in the spec for a single request.
462
+ :type _headers: dict, optional
463
+ :param _host_index: set to override the host_index for a single
464
+ request; this effectively ignores the host_index
465
+ in the spec for a single request.
466
+ :type _host_index: int, optional
467
+ :return: Returns the result object.
468
+ """ # noqa: E501
469
+
470
+ _param = self._get_template_v1_serialize(
471
+ template_id=template_id,
472
+ _request_auth=_request_auth,
473
+ _content_type=_content_type,
474
+ _headers=_headers,
475
+ _host_index=_host_index
476
+ )
477
+
478
+ _response_types_map: Dict[str, Optional[str]] = {
479
+ '200': "VPSV1TemplateTemplateResource",
480
+ '401': "CommonSchemaUnauthorizedResponseSchema",
481
+ '500': "CommonSchemaErrorResponseSchema",
482
+ }
483
+ response_data = self.api_client.call_api(
484
+ *_param,
485
+ _request_timeout=_request_timeout
486
+ )
487
+ return response_data.response
488
+
489
+
490
+ def _get_template_v1_serialize(
491
+ self,
492
+ template_id,
493
+ _request_auth,
494
+ _content_type,
495
+ _headers,
496
+ _host_index,
497
+ ) -> RequestSerialized:
498
+
499
+ _host = None
500
+
501
+ _collection_formats: Dict[str, str] = {
502
+ }
503
+
504
+ _path_params: Dict[str, str] = {}
505
+ _query_params: List[Tuple[str, str]] = []
506
+ _header_params: Dict[str, Optional[str]] = _headers or {}
507
+ _form_params: List[Tuple[str, str]] = []
508
+ _files: Dict[
509
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
510
+ ] = {}
511
+ _body_params: Optional[bytes] = None
512
+
513
+ # process the path parameters
514
+ if template_id is not None:
515
+ _path_params['templateId'] = template_id
516
+ # process the query parameters
517
+ # process the header parameters
518
+ # process the form parameters
519
+ # process the body parameter
520
+
521
+
522
+ # set the HTTP header `Accept`
523
+ if 'Accept' not in _header_params:
524
+ _header_params['Accept'] = self.api_client.select_header_accept(
525
+ [
526
+ 'application/json'
527
+ ]
528
+ )
529
+
530
+
531
+ # authentication setting
532
+ _auth_settings: List[str] = [
533
+ 'apiToken'
534
+ ]
535
+
536
+ return self.api_client.param_serialize(
537
+ method='GET',
538
+ resource_path='/api/vps/v1/templates/{templateId}',
539
+ path_params=_path_params,
540
+ query_params=_query_params,
541
+ header_params=_header_params,
542
+ body=_body_params,
543
+ post_params=_form_params,
544
+ files=_files,
545
+ auth_settings=_auth_settings,
546
+ collection_formats=_collection_formats,
547
+ _host=_host,
548
+ _request_auth=_request_auth
549
+ )
550
+
551
+