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,1419 @@
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 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_post_install_script_list_v1200_response import VPSGetPostInstallScriptListV1200Response
22
+ from hostinger_api.models.vpsv1_post_install_script_post_install_script_resource import VPSV1PostInstallScriptPostInstallScriptResource
23
+ from hostinger_api.models.vpsv1_post_install_script_store_request import VPSV1PostInstallScriptStoreRequest
24
+
25
+ from hostinger_api.api_client import ApiClient, RequestSerialized
26
+ from hostinger_api.api_response import ApiResponse
27
+ from hostinger_api.rest import RESTResponseType
28
+
29
+
30
+ class VPSPostInstallScriptsApi:
31
+
32
+ def __init__(self, api_client=None) -> None:
33
+ if api_client is None:
34
+ api_client = ApiClient.get_default()
35
+ self.api_client = api_client
36
+
37
+
38
+ @validate_call
39
+ def create_post_install_script_v1(
40
+ self,
41
+ vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest,
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
+ ) -> VPSV1PostInstallScriptPostInstallScriptResource:
55
+ """Create post-install script
56
+
57
+ This endpoint allows you to add a new post-install script to your account, which can then be used run after the installation of a virtual machine instance. The script contents will be saved to the file `/post_install` with executable attribute set and will be executed once virtual machine is installed. The output of the script will be redirected to `/post_install.log`. Maximum script size is 48KB.
58
+
59
+ :param vpsv1_post_install_script_store_request: (required)
60
+ :type vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest
61
+ :param _request_timeout: timeout setting for this request. If one
62
+ number provided, it will be total request
63
+ timeout. It can also be a pair (tuple) of
64
+ (connection, read) timeouts.
65
+ :type _request_timeout: int, tuple(int, int), optional
66
+ :param _request_auth: set to override the auth_settings for an a single
67
+ request; this effectively ignores the
68
+ authentication in the spec for a single request.
69
+ :type _request_auth: dict, optional
70
+ :param _content_type: force content-type for the request.
71
+ :type _content_type: str, Optional
72
+ :param _headers: set to override the headers for a single
73
+ request; this effectively ignores the headers
74
+ in the spec for a single request.
75
+ :type _headers: dict, optional
76
+ :param _host_index: set to override the host_index for a single
77
+ request; this effectively ignores the host_index
78
+ in the spec for a single request.
79
+ :type _host_index: int, optional
80
+ :return: Returns the result object.
81
+ """ # noqa: E501
82
+
83
+ _param = self._create_post_install_script_v1_serialize(
84
+ vpsv1_post_install_script_store_request=vpsv1_post_install_script_store_request,
85
+ _request_auth=_request_auth,
86
+ _content_type=_content_type,
87
+ _headers=_headers,
88
+ _host_index=_host_index
89
+ )
90
+
91
+ _response_types_map: Dict[str, Optional[str]] = {
92
+ '200': "VPSV1PostInstallScriptPostInstallScriptResource",
93
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
94
+ '401': "CommonSchemaUnauthorizedResponseSchema",
95
+ '500': "CommonSchemaErrorResponseSchema",
96
+ }
97
+ response_data = self.api_client.call_api(
98
+ *_param,
99
+ _request_timeout=_request_timeout
100
+ )
101
+ response_data.read()
102
+ return self.api_client.response_deserialize(
103
+ response_data=response_data,
104
+ response_types_map=_response_types_map,
105
+ ).data
106
+
107
+
108
+ @validate_call
109
+ def create_post_install_script_v1_with_http_info(
110
+ self,
111
+ vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest,
112
+ _request_timeout: Union[
113
+ None,
114
+ Annotated[StrictFloat, Field(gt=0)],
115
+ Tuple[
116
+ Annotated[StrictFloat, Field(gt=0)],
117
+ Annotated[StrictFloat, Field(gt=0)]
118
+ ]
119
+ ] = None,
120
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
121
+ _content_type: Optional[StrictStr] = None,
122
+ _headers: Optional[Dict[StrictStr, Any]] = None,
123
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
124
+ ) -> ApiResponse[VPSV1PostInstallScriptPostInstallScriptResource]:
125
+ """Create post-install script
126
+
127
+ This endpoint allows you to add a new post-install script to your account, which can then be used run after the installation of a virtual machine instance. The script contents will be saved to the file `/post_install` with executable attribute set and will be executed once virtual machine is installed. The output of the script will be redirected to `/post_install.log`. Maximum script size is 48KB.
128
+
129
+ :param vpsv1_post_install_script_store_request: (required)
130
+ :type vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest
131
+ :param _request_timeout: timeout setting for this request. If one
132
+ number provided, it will be total request
133
+ timeout. It can also be a pair (tuple) of
134
+ (connection, read) timeouts.
135
+ :type _request_timeout: int, tuple(int, int), optional
136
+ :param _request_auth: set to override the auth_settings for an a single
137
+ request; this effectively ignores the
138
+ authentication in the spec for a single request.
139
+ :type _request_auth: dict, optional
140
+ :param _content_type: force content-type for the request.
141
+ :type _content_type: str, Optional
142
+ :param _headers: set to override the headers for a single
143
+ request; this effectively ignores the headers
144
+ in the spec for a single request.
145
+ :type _headers: dict, optional
146
+ :param _host_index: set to override the host_index for a single
147
+ request; this effectively ignores the host_index
148
+ in the spec for a single request.
149
+ :type _host_index: int, optional
150
+ :return: Returns the result object.
151
+ """ # noqa: E501
152
+
153
+ _param = self._create_post_install_script_v1_serialize(
154
+ vpsv1_post_install_script_store_request=vpsv1_post_install_script_store_request,
155
+ _request_auth=_request_auth,
156
+ _content_type=_content_type,
157
+ _headers=_headers,
158
+ _host_index=_host_index
159
+ )
160
+
161
+ _response_types_map: Dict[str, Optional[str]] = {
162
+ '200': "VPSV1PostInstallScriptPostInstallScriptResource",
163
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
164
+ '401': "CommonSchemaUnauthorizedResponseSchema",
165
+ '500': "CommonSchemaErrorResponseSchema",
166
+ }
167
+ response_data = self.api_client.call_api(
168
+ *_param,
169
+ _request_timeout=_request_timeout
170
+ )
171
+ response_data.read()
172
+ return self.api_client.response_deserialize(
173
+ response_data=response_data,
174
+ response_types_map=_response_types_map,
175
+ )
176
+
177
+
178
+ @validate_call
179
+ def create_post_install_script_v1_without_preload_content(
180
+ self,
181
+ vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest,
182
+ _request_timeout: Union[
183
+ None,
184
+ Annotated[StrictFloat, Field(gt=0)],
185
+ Tuple[
186
+ Annotated[StrictFloat, Field(gt=0)],
187
+ Annotated[StrictFloat, Field(gt=0)]
188
+ ]
189
+ ] = None,
190
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
191
+ _content_type: Optional[StrictStr] = None,
192
+ _headers: Optional[Dict[StrictStr, Any]] = None,
193
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
194
+ ) -> RESTResponseType:
195
+ """Create post-install script
196
+
197
+ This endpoint allows you to add a new post-install script to your account, which can then be used run after the installation of a virtual machine instance. The script contents will be saved to the file `/post_install` with executable attribute set and will be executed once virtual machine is installed. The output of the script will be redirected to `/post_install.log`. Maximum script size is 48KB.
198
+
199
+ :param vpsv1_post_install_script_store_request: (required)
200
+ :type vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest
201
+ :param _request_timeout: timeout setting for this request. If one
202
+ number provided, it will be total request
203
+ timeout. It can also be a pair (tuple) of
204
+ (connection, read) timeouts.
205
+ :type _request_timeout: int, tuple(int, int), optional
206
+ :param _request_auth: set to override the auth_settings for an a single
207
+ request; this effectively ignores the
208
+ authentication in the spec for a single request.
209
+ :type _request_auth: dict, optional
210
+ :param _content_type: force content-type for the request.
211
+ :type _content_type: str, Optional
212
+ :param _headers: set to override the headers for a single
213
+ request; this effectively ignores the headers
214
+ in the spec for a single request.
215
+ :type _headers: dict, optional
216
+ :param _host_index: set to override the host_index for a single
217
+ request; this effectively ignores the host_index
218
+ in the spec for a single request.
219
+ :type _host_index: int, optional
220
+ :return: Returns the result object.
221
+ """ # noqa: E501
222
+
223
+ _param = self._create_post_install_script_v1_serialize(
224
+ vpsv1_post_install_script_store_request=vpsv1_post_install_script_store_request,
225
+ _request_auth=_request_auth,
226
+ _content_type=_content_type,
227
+ _headers=_headers,
228
+ _host_index=_host_index
229
+ )
230
+
231
+ _response_types_map: Dict[str, Optional[str]] = {
232
+ '200': "VPSV1PostInstallScriptPostInstallScriptResource",
233
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
234
+ '401': "CommonSchemaUnauthorizedResponseSchema",
235
+ '500': "CommonSchemaErrorResponseSchema",
236
+ }
237
+ response_data = self.api_client.call_api(
238
+ *_param,
239
+ _request_timeout=_request_timeout
240
+ )
241
+ return response_data.response
242
+
243
+
244
+ def _create_post_install_script_v1_serialize(
245
+ self,
246
+ vpsv1_post_install_script_store_request,
247
+ _request_auth,
248
+ _content_type,
249
+ _headers,
250
+ _host_index,
251
+ ) -> RequestSerialized:
252
+
253
+ _host = None
254
+
255
+ _collection_formats: Dict[str, str] = {
256
+ }
257
+
258
+ _path_params: Dict[str, str] = {}
259
+ _query_params: List[Tuple[str, str]] = []
260
+ _header_params: Dict[str, Optional[str]] = _headers or {}
261
+ _form_params: List[Tuple[str, str]] = []
262
+ _files: Dict[
263
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
264
+ ] = {}
265
+ _body_params: Optional[bytes] = None
266
+
267
+ # process the path parameters
268
+ # process the query parameters
269
+ # process the header parameters
270
+ # process the form parameters
271
+ # process the body parameter
272
+ if vpsv1_post_install_script_store_request is not None:
273
+ _body_params = vpsv1_post_install_script_store_request
274
+
275
+
276
+ # set the HTTP header `Accept`
277
+ if 'Accept' not in _header_params:
278
+ _header_params['Accept'] = self.api_client.select_header_accept(
279
+ [
280
+ 'application/json'
281
+ ]
282
+ )
283
+
284
+ # set the HTTP header `Content-Type`
285
+ if _content_type:
286
+ _header_params['Content-Type'] = _content_type
287
+ else:
288
+ _default_content_type = (
289
+ self.api_client.select_header_content_type(
290
+ [
291
+ 'application/json'
292
+ ]
293
+ )
294
+ )
295
+ if _default_content_type is not None:
296
+ _header_params['Content-Type'] = _default_content_type
297
+
298
+ # authentication setting
299
+ _auth_settings: List[str] = [
300
+ 'apiToken'
301
+ ]
302
+
303
+ return self.api_client.param_serialize(
304
+ method='POST',
305
+ resource_path='/api/vps/v1/post-install-scripts',
306
+ path_params=_path_params,
307
+ query_params=_query_params,
308
+ header_params=_header_params,
309
+ body=_body_params,
310
+ post_params=_form_params,
311
+ files=_files,
312
+ auth_settings=_auth_settings,
313
+ collection_formats=_collection_formats,
314
+ _host=_host,
315
+ _request_auth=_request_auth
316
+ )
317
+
318
+
319
+
320
+
321
+ @validate_call
322
+ def delete_a_post_install_script_v1(
323
+ self,
324
+ post_install_script_id: Annotated[StrictInt, Field(description="Post-install script ID")],
325
+ _request_timeout: Union[
326
+ None,
327
+ Annotated[StrictFloat, Field(gt=0)],
328
+ Tuple[
329
+ Annotated[StrictFloat, Field(gt=0)],
330
+ Annotated[StrictFloat, Field(gt=0)]
331
+ ]
332
+ ] = None,
333
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
334
+ _content_type: Optional[StrictStr] = None,
335
+ _headers: Optional[Dict[StrictStr, Any]] = None,
336
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
337
+ ) -> CommonSuccessEmptyResource:
338
+ """Delete a post-install script
339
+
340
+ This endpoint deletes a post-install script from your account.
341
+
342
+ :param post_install_script_id: Post-install script ID (required)
343
+ :type post_install_script_id: int
344
+ :param _request_timeout: timeout setting for this request. If one
345
+ number provided, it will be total request
346
+ timeout. It can also be a pair (tuple) of
347
+ (connection, read) timeouts.
348
+ :type _request_timeout: int, tuple(int, int), optional
349
+ :param _request_auth: set to override the auth_settings for an a single
350
+ request; this effectively ignores the
351
+ authentication in the spec for a single request.
352
+ :type _request_auth: dict, optional
353
+ :param _content_type: force content-type for the request.
354
+ :type _content_type: str, Optional
355
+ :param _headers: set to override the headers for a single
356
+ request; this effectively ignores the headers
357
+ in the spec for a single request.
358
+ :type _headers: dict, optional
359
+ :param _host_index: set to override the host_index for a single
360
+ request; this effectively ignores the host_index
361
+ in the spec for a single request.
362
+ :type _host_index: int, optional
363
+ :return: Returns the result object.
364
+ """ # noqa: E501
365
+
366
+ _param = self._delete_a_post_install_script_v1_serialize(
367
+ post_install_script_id=post_install_script_id,
368
+ _request_auth=_request_auth,
369
+ _content_type=_content_type,
370
+ _headers=_headers,
371
+ _host_index=_host_index
372
+ )
373
+
374
+ _response_types_map: Dict[str, Optional[str]] = {
375
+ '200': "CommonSuccessEmptyResource",
376
+ '401': "CommonSchemaUnauthorizedResponseSchema",
377
+ '500': "CommonSchemaErrorResponseSchema",
378
+ }
379
+ response_data = self.api_client.call_api(
380
+ *_param,
381
+ _request_timeout=_request_timeout
382
+ )
383
+ response_data.read()
384
+ return self.api_client.response_deserialize(
385
+ response_data=response_data,
386
+ response_types_map=_response_types_map,
387
+ ).data
388
+
389
+
390
+ @validate_call
391
+ def delete_a_post_install_script_v1_with_http_info(
392
+ self,
393
+ post_install_script_id: Annotated[StrictInt, Field(description="Post-install script ID")],
394
+ _request_timeout: Union[
395
+ None,
396
+ Annotated[StrictFloat, Field(gt=0)],
397
+ Tuple[
398
+ Annotated[StrictFloat, Field(gt=0)],
399
+ Annotated[StrictFloat, Field(gt=0)]
400
+ ]
401
+ ] = None,
402
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
403
+ _content_type: Optional[StrictStr] = None,
404
+ _headers: Optional[Dict[StrictStr, Any]] = None,
405
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
406
+ ) -> ApiResponse[CommonSuccessEmptyResource]:
407
+ """Delete a post-install script
408
+
409
+ This endpoint deletes a post-install script from your account.
410
+
411
+ :param post_install_script_id: Post-install script ID (required)
412
+ :type post_install_script_id: int
413
+ :param _request_timeout: timeout setting for this request. If one
414
+ number provided, it will be total request
415
+ timeout. It can also be a pair (tuple) of
416
+ (connection, read) timeouts.
417
+ :type _request_timeout: int, tuple(int, int), optional
418
+ :param _request_auth: set to override the auth_settings for an a single
419
+ request; this effectively ignores the
420
+ authentication in the spec for a single request.
421
+ :type _request_auth: dict, optional
422
+ :param _content_type: force content-type for the request.
423
+ :type _content_type: str, Optional
424
+ :param _headers: set to override the headers for a single
425
+ request; this effectively ignores the headers
426
+ in the spec for a single request.
427
+ :type _headers: dict, optional
428
+ :param _host_index: set to override the host_index for a single
429
+ request; this effectively ignores the host_index
430
+ in the spec for a single request.
431
+ :type _host_index: int, optional
432
+ :return: Returns the result object.
433
+ """ # noqa: E501
434
+
435
+ _param = self._delete_a_post_install_script_v1_serialize(
436
+ post_install_script_id=post_install_script_id,
437
+ _request_auth=_request_auth,
438
+ _content_type=_content_type,
439
+ _headers=_headers,
440
+ _host_index=_host_index
441
+ )
442
+
443
+ _response_types_map: Dict[str, Optional[str]] = {
444
+ '200': "CommonSuccessEmptyResource",
445
+ '401': "CommonSchemaUnauthorizedResponseSchema",
446
+ '500': "CommonSchemaErrorResponseSchema",
447
+ }
448
+ response_data = self.api_client.call_api(
449
+ *_param,
450
+ _request_timeout=_request_timeout
451
+ )
452
+ response_data.read()
453
+ return self.api_client.response_deserialize(
454
+ response_data=response_data,
455
+ response_types_map=_response_types_map,
456
+ )
457
+
458
+
459
+ @validate_call
460
+ def delete_a_post_install_script_v1_without_preload_content(
461
+ self,
462
+ post_install_script_id: Annotated[StrictInt, Field(description="Post-install script ID")],
463
+ _request_timeout: Union[
464
+ None,
465
+ Annotated[StrictFloat, Field(gt=0)],
466
+ Tuple[
467
+ Annotated[StrictFloat, Field(gt=0)],
468
+ Annotated[StrictFloat, Field(gt=0)]
469
+ ]
470
+ ] = None,
471
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
472
+ _content_type: Optional[StrictStr] = None,
473
+ _headers: Optional[Dict[StrictStr, Any]] = None,
474
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
475
+ ) -> RESTResponseType:
476
+ """Delete a post-install script
477
+
478
+ This endpoint deletes a post-install script from your account.
479
+
480
+ :param post_install_script_id: Post-install script ID (required)
481
+ :type post_install_script_id: int
482
+ :param _request_timeout: timeout setting for this request. If one
483
+ number provided, it will be total request
484
+ timeout. It can also be a pair (tuple) of
485
+ (connection, read) timeouts.
486
+ :type _request_timeout: int, tuple(int, int), optional
487
+ :param _request_auth: set to override the auth_settings for an a single
488
+ request; this effectively ignores the
489
+ authentication in the spec for a single request.
490
+ :type _request_auth: dict, optional
491
+ :param _content_type: force content-type for the request.
492
+ :type _content_type: str, Optional
493
+ :param _headers: set to override the headers for a single
494
+ request; this effectively ignores the headers
495
+ in the spec for a single request.
496
+ :type _headers: dict, optional
497
+ :param _host_index: set to override the host_index for a single
498
+ request; this effectively ignores the host_index
499
+ in the spec for a single request.
500
+ :type _host_index: int, optional
501
+ :return: Returns the result object.
502
+ """ # noqa: E501
503
+
504
+ _param = self._delete_a_post_install_script_v1_serialize(
505
+ post_install_script_id=post_install_script_id,
506
+ _request_auth=_request_auth,
507
+ _content_type=_content_type,
508
+ _headers=_headers,
509
+ _host_index=_host_index
510
+ )
511
+
512
+ _response_types_map: Dict[str, Optional[str]] = {
513
+ '200': "CommonSuccessEmptyResource",
514
+ '401': "CommonSchemaUnauthorizedResponseSchema",
515
+ '500': "CommonSchemaErrorResponseSchema",
516
+ }
517
+ response_data = self.api_client.call_api(
518
+ *_param,
519
+ _request_timeout=_request_timeout
520
+ )
521
+ return response_data.response
522
+
523
+
524
+ def _delete_a_post_install_script_v1_serialize(
525
+ self,
526
+ post_install_script_id,
527
+ _request_auth,
528
+ _content_type,
529
+ _headers,
530
+ _host_index,
531
+ ) -> RequestSerialized:
532
+
533
+ _host = None
534
+
535
+ _collection_formats: Dict[str, str] = {
536
+ }
537
+
538
+ _path_params: Dict[str, str] = {}
539
+ _query_params: List[Tuple[str, str]] = []
540
+ _header_params: Dict[str, Optional[str]] = _headers or {}
541
+ _form_params: List[Tuple[str, str]] = []
542
+ _files: Dict[
543
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
544
+ ] = {}
545
+ _body_params: Optional[bytes] = None
546
+
547
+ # process the path parameters
548
+ if post_install_script_id is not None:
549
+ _path_params['postInstallScriptId'] = post_install_script_id
550
+ # process the query parameters
551
+ # process the header parameters
552
+ # process the form parameters
553
+ # process the body parameter
554
+
555
+
556
+ # set the HTTP header `Accept`
557
+ if 'Accept' not in _header_params:
558
+ _header_params['Accept'] = self.api_client.select_header_accept(
559
+ [
560
+ 'application/json'
561
+ ]
562
+ )
563
+
564
+
565
+ # authentication setting
566
+ _auth_settings: List[str] = [
567
+ 'apiToken'
568
+ ]
569
+
570
+ return self.api_client.param_serialize(
571
+ method='DELETE',
572
+ resource_path='/api/vps/v1/post-install-scripts/{postInstallScriptId}',
573
+ path_params=_path_params,
574
+ query_params=_query_params,
575
+ header_params=_header_params,
576
+ body=_body_params,
577
+ post_params=_form_params,
578
+ files=_files,
579
+ auth_settings=_auth_settings,
580
+ collection_formats=_collection_formats,
581
+ _host=_host,
582
+ _request_auth=_request_auth
583
+ )
584
+
585
+
586
+
587
+
588
+ @validate_call
589
+ def get_post_install_script_list_v1(
590
+ self,
591
+ page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
592
+ _request_timeout: Union[
593
+ None,
594
+ Annotated[StrictFloat, Field(gt=0)],
595
+ Tuple[
596
+ Annotated[StrictFloat, Field(gt=0)],
597
+ Annotated[StrictFloat, Field(gt=0)]
598
+ ]
599
+ ] = None,
600
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
601
+ _content_type: Optional[StrictStr] = None,
602
+ _headers: Optional[Dict[StrictStr, Any]] = None,
603
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
604
+ ) -> VPSGetPostInstallScriptListV1200Response:
605
+ """Get post-install script list
606
+
607
+ This endpoint retrieves a list of post-install scripts associated with your account.
608
+
609
+ :param page: Page number
610
+ :type page: int
611
+ :param _request_timeout: timeout setting for this request. If one
612
+ number provided, it will be total request
613
+ timeout. It can also be a pair (tuple) of
614
+ (connection, read) timeouts.
615
+ :type _request_timeout: int, tuple(int, int), optional
616
+ :param _request_auth: set to override the auth_settings for an a single
617
+ request; this effectively ignores the
618
+ authentication in the spec for a single request.
619
+ :type _request_auth: dict, optional
620
+ :param _content_type: force content-type for the request.
621
+ :type _content_type: str, Optional
622
+ :param _headers: set to override the headers for a single
623
+ request; this effectively ignores the headers
624
+ in the spec for a single request.
625
+ :type _headers: dict, optional
626
+ :param _host_index: set to override the host_index for a single
627
+ request; this effectively ignores the host_index
628
+ in the spec for a single request.
629
+ :type _host_index: int, optional
630
+ :return: Returns the result object.
631
+ """ # noqa: E501
632
+
633
+ _param = self._get_post_install_script_list_v1_serialize(
634
+ page=page,
635
+ _request_auth=_request_auth,
636
+ _content_type=_content_type,
637
+ _headers=_headers,
638
+ _host_index=_host_index
639
+ )
640
+
641
+ _response_types_map: Dict[str, Optional[str]] = {
642
+ '200': "VPSGetPostInstallScriptListV1200Response",
643
+ '401': "CommonSchemaUnauthorizedResponseSchema",
644
+ '500': "CommonSchemaErrorResponseSchema",
645
+ }
646
+ response_data = self.api_client.call_api(
647
+ *_param,
648
+ _request_timeout=_request_timeout
649
+ )
650
+ response_data.read()
651
+ return self.api_client.response_deserialize(
652
+ response_data=response_data,
653
+ response_types_map=_response_types_map,
654
+ ).data
655
+
656
+
657
+ @validate_call
658
+ def get_post_install_script_list_v1_with_http_info(
659
+ self,
660
+ page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
661
+ _request_timeout: Union[
662
+ None,
663
+ Annotated[StrictFloat, Field(gt=0)],
664
+ Tuple[
665
+ Annotated[StrictFloat, Field(gt=0)],
666
+ Annotated[StrictFloat, Field(gt=0)]
667
+ ]
668
+ ] = None,
669
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
670
+ _content_type: Optional[StrictStr] = None,
671
+ _headers: Optional[Dict[StrictStr, Any]] = None,
672
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
673
+ ) -> ApiResponse[VPSGetPostInstallScriptListV1200Response]:
674
+ """Get post-install script list
675
+
676
+ This endpoint retrieves a list of post-install scripts associated with your account.
677
+
678
+ :param page: Page number
679
+ :type page: int
680
+ :param _request_timeout: timeout setting for this request. If one
681
+ number provided, it will be total request
682
+ timeout. It can also be a pair (tuple) of
683
+ (connection, read) timeouts.
684
+ :type _request_timeout: int, tuple(int, int), optional
685
+ :param _request_auth: set to override the auth_settings for an a single
686
+ request; this effectively ignores the
687
+ authentication in the spec for a single request.
688
+ :type _request_auth: dict, optional
689
+ :param _content_type: force content-type for the request.
690
+ :type _content_type: str, Optional
691
+ :param _headers: set to override the headers for a single
692
+ request; this effectively ignores the headers
693
+ in the spec for a single request.
694
+ :type _headers: dict, optional
695
+ :param _host_index: set to override the host_index for a single
696
+ request; this effectively ignores the host_index
697
+ in the spec for a single request.
698
+ :type _host_index: int, optional
699
+ :return: Returns the result object.
700
+ """ # noqa: E501
701
+
702
+ _param = self._get_post_install_script_list_v1_serialize(
703
+ page=page,
704
+ _request_auth=_request_auth,
705
+ _content_type=_content_type,
706
+ _headers=_headers,
707
+ _host_index=_host_index
708
+ )
709
+
710
+ _response_types_map: Dict[str, Optional[str]] = {
711
+ '200': "VPSGetPostInstallScriptListV1200Response",
712
+ '401': "CommonSchemaUnauthorizedResponseSchema",
713
+ '500': "CommonSchemaErrorResponseSchema",
714
+ }
715
+ response_data = self.api_client.call_api(
716
+ *_param,
717
+ _request_timeout=_request_timeout
718
+ )
719
+ response_data.read()
720
+ return self.api_client.response_deserialize(
721
+ response_data=response_data,
722
+ response_types_map=_response_types_map,
723
+ )
724
+
725
+
726
+ @validate_call
727
+ def get_post_install_script_list_v1_without_preload_content(
728
+ self,
729
+ page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
730
+ _request_timeout: Union[
731
+ None,
732
+ Annotated[StrictFloat, Field(gt=0)],
733
+ Tuple[
734
+ Annotated[StrictFloat, Field(gt=0)],
735
+ Annotated[StrictFloat, Field(gt=0)]
736
+ ]
737
+ ] = None,
738
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
739
+ _content_type: Optional[StrictStr] = None,
740
+ _headers: Optional[Dict[StrictStr, Any]] = None,
741
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
742
+ ) -> RESTResponseType:
743
+ """Get post-install script list
744
+
745
+ This endpoint retrieves a list of post-install scripts associated with your account.
746
+
747
+ :param page: Page number
748
+ :type page: int
749
+ :param _request_timeout: timeout setting for this request. If one
750
+ number provided, it will be total request
751
+ timeout. It can also be a pair (tuple) of
752
+ (connection, read) timeouts.
753
+ :type _request_timeout: int, tuple(int, int), optional
754
+ :param _request_auth: set to override the auth_settings for an a single
755
+ request; this effectively ignores the
756
+ authentication in the spec for a single request.
757
+ :type _request_auth: dict, optional
758
+ :param _content_type: force content-type for the request.
759
+ :type _content_type: str, Optional
760
+ :param _headers: set to override the headers for a single
761
+ request; this effectively ignores the headers
762
+ in the spec for a single request.
763
+ :type _headers: dict, optional
764
+ :param _host_index: set to override the host_index for a single
765
+ request; this effectively ignores the host_index
766
+ in the spec for a single request.
767
+ :type _host_index: int, optional
768
+ :return: Returns the result object.
769
+ """ # noqa: E501
770
+
771
+ _param = self._get_post_install_script_list_v1_serialize(
772
+ page=page,
773
+ _request_auth=_request_auth,
774
+ _content_type=_content_type,
775
+ _headers=_headers,
776
+ _host_index=_host_index
777
+ )
778
+
779
+ _response_types_map: Dict[str, Optional[str]] = {
780
+ '200': "VPSGetPostInstallScriptListV1200Response",
781
+ '401': "CommonSchemaUnauthorizedResponseSchema",
782
+ '500': "CommonSchemaErrorResponseSchema",
783
+ }
784
+ response_data = self.api_client.call_api(
785
+ *_param,
786
+ _request_timeout=_request_timeout
787
+ )
788
+ return response_data.response
789
+
790
+
791
+ def _get_post_install_script_list_v1_serialize(
792
+ self,
793
+ page,
794
+ _request_auth,
795
+ _content_type,
796
+ _headers,
797
+ _host_index,
798
+ ) -> RequestSerialized:
799
+
800
+ _host = None
801
+
802
+ _collection_formats: Dict[str, str] = {
803
+ }
804
+
805
+ _path_params: Dict[str, str] = {}
806
+ _query_params: List[Tuple[str, str]] = []
807
+ _header_params: Dict[str, Optional[str]] = _headers or {}
808
+ _form_params: List[Tuple[str, str]] = []
809
+ _files: Dict[
810
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
811
+ ] = {}
812
+ _body_params: Optional[bytes] = None
813
+
814
+ # process the path parameters
815
+ # process the query parameters
816
+ if page is not None:
817
+
818
+ _query_params.append(('page', page))
819
+
820
+ # process the header parameters
821
+ # process the form parameters
822
+ # process the body parameter
823
+
824
+
825
+ # set the HTTP header `Accept`
826
+ if 'Accept' not in _header_params:
827
+ _header_params['Accept'] = self.api_client.select_header_accept(
828
+ [
829
+ 'application/json'
830
+ ]
831
+ )
832
+
833
+
834
+ # authentication setting
835
+ _auth_settings: List[str] = [
836
+ 'apiToken'
837
+ ]
838
+
839
+ return self.api_client.param_serialize(
840
+ method='GET',
841
+ resource_path='/api/vps/v1/post-install-scripts',
842
+ path_params=_path_params,
843
+ query_params=_query_params,
844
+ header_params=_header_params,
845
+ body=_body_params,
846
+ post_params=_form_params,
847
+ files=_files,
848
+ auth_settings=_auth_settings,
849
+ collection_formats=_collection_formats,
850
+ _host=_host,
851
+ _request_auth=_request_auth
852
+ )
853
+
854
+
855
+
856
+
857
+ @validate_call
858
+ def get_post_install_script_v1(
859
+ self,
860
+ post_install_script_id: Annotated[StrictInt, Field(description="Post-install script ID")],
861
+ _request_timeout: Union[
862
+ None,
863
+ Annotated[StrictFloat, Field(gt=0)],
864
+ Tuple[
865
+ Annotated[StrictFloat, Field(gt=0)],
866
+ Annotated[StrictFloat, Field(gt=0)]
867
+ ]
868
+ ] = None,
869
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
870
+ _content_type: Optional[StrictStr] = None,
871
+ _headers: Optional[Dict[StrictStr, Any]] = None,
872
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
873
+ ) -> VPSV1PostInstallScriptPostInstallScriptResource:
874
+ """Get post-install script
875
+
876
+ This endpoint retrieves post-install script by its ID.
877
+
878
+ :param post_install_script_id: Post-install script ID (required)
879
+ :type post_install_script_id: int
880
+ :param _request_timeout: timeout setting for this request. If one
881
+ number provided, it will be total request
882
+ timeout. It can also be a pair (tuple) of
883
+ (connection, read) timeouts.
884
+ :type _request_timeout: int, tuple(int, int), optional
885
+ :param _request_auth: set to override the auth_settings for an a single
886
+ request; this effectively ignores the
887
+ authentication in the spec for a single request.
888
+ :type _request_auth: dict, optional
889
+ :param _content_type: force content-type for the request.
890
+ :type _content_type: str, Optional
891
+ :param _headers: set to override the headers for a single
892
+ request; this effectively ignores the headers
893
+ in the spec for a single request.
894
+ :type _headers: dict, optional
895
+ :param _host_index: set to override the host_index for a single
896
+ request; this effectively ignores the host_index
897
+ in the spec for a single request.
898
+ :type _host_index: int, optional
899
+ :return: Returns the result object.
900
+ """ # noqa: E501
901
+
902
+ _param = self._get_post_install_script_v1_serialize(
903
+ post_install_script_id=post_install_script_id,
904
+ _request_auth=_request_auth,
905
+ _content_type=_content_type,
906
+ _headers=_headers,
907
+ _host_index=_host_index
908
+ )
909
+
910
+ _response_types_map: Dict[str, Optional[str]] = {
911
+ '200': "VPSV1PostInstallScriptPostInstallScriptResource",
912
+ '401': "CommonSchemaUnauthorizedResponseSchema",
913
+ '500': "CommonSchemaErrorResponseSchema",
914
+ }
915
+ response_data = self.api_client.call_api(
916
+ *_param,
917
+ _request_timeout=_request_timeout
918
+ )
919
+ response_data.read()
920
+ return self.api_client.response_deserialize(
921
+ response_data=response_data,
922
+ response_types_map=_response_types_map,
923
+ ).data
924
+
925
+
926
+ @validate_call
927
+ def get_post_install_script_v1_with_http_info(
928
+ self,
929
+ post_install_script_id: Annotated[StrictInt, Field(description="Post-install script ID")],
930
+ _request_timeout: Union[
931
+ None,
932
+ Annotated[StrictFloat, Field(gt=0)],
933
+ Tuple[
934
+ Annotated[StrictFloat, Field(gt=0)],
935
+ Annotated[StrictFloat, Field(gt=0)]
936
+ ]
937
+ ] = None,
938
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
939
+ _content_type: Optional[StrictStr] = None,
940
+ _headers: Optional[Dict[StrictStr, Any]] = None,
941
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
942
+ ) -> ApiResponse[VPSV1PostInstallScriptPostInstallScriptResource]:
943
+ """Get post-install script
944
+
945
+ This endpoint retrieves post-install script by its ID.
946
+
947
+ :param post_install_script_id: Post-install script ID (required)
948
+ :type post_install_script_id: int
949
+ :param _request_timeout: timeout setting for this request. If one
950
+ number provided, it will be total request
951
+ timeout. It can also be a pair (tuple) of
952
+ (connection, read) timeouts.
953
+ :type _request_timeout: int, tuple(int, int), optional
954
+ :param _request_auth: set to override the auth_settings for an a single
955
+ request; this effectively ignores the
956
+ authentication in the spec for a single request.
957
+ :type _request_auth: dict, optional
958
+ :param _content_type: force content-type for the request.
959
+ :type _content_type: str, Optional
960
+ :param _headers: set to override the headers for a single
961
+ request; this effectively ignores the headers
962
+ in the spec for a single request.
963
+ :type _headers: dict, optional
964
+ :param _host_index: set to override the host_index for a single
965
+ request; this effectively ignores the host_index
966
+ in the spec for a single request.
967
+ :type _host_index: int, optional
968
+ :return: Returns the result object.
969
+ """ # noqa: E501
970
+
971
+ _param = self._get_post_install_script_v1_serialize(
972
+ post_install_script_id=post_install_script_id,
973
+ _request_auth=_request_auth,
974
+ _content_type=_content_type,
975
+ _headers=_headers,
976
+ _host_index=_host_index
977
+ )
978
+
979
+ _response_types_map: Dict[str, Optional[str]] = {
980
+ '200': "VPSV1PostInstallScriptPostInstallScriptResource",
981
+ '401': "CommonSchemaUnauthorizedResponseSchema",
982
+ '500': "CommonSchemaErrorResponseSchema",
983
+ }
984
+ response_data = self.api_client.call_api(
985
+ *_param,
986
+ _request_timeout=_request_timeout
987
+ )
988
+ response_data.read()
989
+ return self.api_client.response_deserialize(
990
+ response_data=response_data,
991
+ response_types_map=_response_types_map,
992
+ )
993
+
994
+
995
+ @validate_call
996
+ def get_post_install_script_v1_without_preload_content(
997
+ self,
998
+ post_install_script_id: Annotated[StrictInt, Field(description="Post-install script ID")],
999
+ _request_timeout: Union[
1000
+ None,
1001
+ Annotated[StrictFloat, Field(gt=0)],
1002
+ Tuple[
1003
+ Annotated[StrictFloat, Field(gt=0)],
1004
+ Annotated[StrictFloat, Field(gt=0)]
1005
+ ]
1006
+ ] = None,
1007
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1008
+ _content_type: Optional[StrictStr] = None,
1009
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1010
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1011
+ ) -> RESTResponseType:
1012
+ """Get post-install script
1013
+
1014
+ This endpoint retrieves post-install script by its ID.
1015
+
1016
+ :param post_install_script_id: Post-install script ID (required)
1017
+ :type post_install_script_id: int
1018
+ :param _request_timeout: timeout setting for this request. If one
1019
+ number provided, it will be total request
1020
+ timeout. It can also be a pair (tuple) of
1021
+ (connection, read) timeouts.
1022
+ :type _request_timeout: int, tuple(int, int), optional
1023
+ :param _request_auth: set to override the auth_settings for an a single
1024
+ request; this effectively ignores the
1025
+ authentication in the spec for a single request.
1026
+ :type _request_auth: dict, optional
1027
+ :param _content_type: force content-type for the request.
1028
+ :type _content_type: str, Optional
1029
+ :param _headers: set to override the headers for a single
1030
+ request; this effectively ignores the headers
1031
+ in the spec for a single request.
1032
+ :type _headers: dict, optional
1033
+ :param _host_index: set to override the host_index for a single
1034
+ request; this effectively ignores the host_index
1035
+ in the spec for a single request.
1036
+ :type _host_index: int, optional
1037
+ :return: Returns the result object.
1038
+ """ # noqa: E501
1039
+
1040
+ _param = self._get_post_install_script_v1_serialize(
1041
+ post_install_script_id=post_install_script_id,
1042
+ _request_auth=_request_auth,
1043
+ _content_type=_content_type,
1044
+ _headers=_headers,
1045
+ _host_index=_host_index
1046
+ )
1047
+
1048
+ _response_types_map: Dict[str, Optional[str]] = {
1049
+ '200': "VPSV1PostInstallScriptPostInstallScriptResource",
1050
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1051
+ '500': "CommonSchemaErrorResponseSchema",
1052
+ }
1053
+ response_data = self.api_client.call_api(
1054
+ *_param,
1055
+ _request_timeout=_request_timeout
1056
+ )
1057
+ return response_data.response
1058
+
1059
+
1060
+ def _get_post_install_script_v1_serialize(
1061
+ self,
1062
+ post_install_script_id,
1063
+ _request_auth,
1064
+ _content_type,
1065
+ _headers,
1066
+ _host_index,
1067
+ ) -> RequestSerialized:
1068
+
1069
+ _host = None
1070
+
1071
+ _collection_formats: Dict[str, str] = {
1072
+ }
1073
+
1074
+ _path_params: Dict[str, str] = {}
1075
+ _query_params: List[Tuple[str, str]] = []
1076
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1077
+ _form_params: List[Tuple[str, str]] = []
1078
+ _files: Dict[
1079
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1080
+ ] = {}
1081
+ _body_params: Optional[bytes] = None
1082
+
1083
+ # process the path parameters
1084
+ if post_install_script_id is not None:
1085
+ _path_params['postInstallScriptId'] = post_install_script_id
1086
+ # process the query parameters
1087
+ # process the header parameters
1088
+ # process the form parameters
1089
+ # process the body parameter
1090
+
1091
+
1092
+ # set the HTTP header `Accept`
1093
+ if 'Accept' not in _header_params:
1094
+ _header_params['Accept'] = self.api_client.select_header_accept(
1095
+ [
1096
+ 'application/json'
1097
+ ]
1098
+ )
1099
+
1100
+
1101
+ # authentication setting
1102
+ _auth_settings: List[str] = [
1103
+ 'apiToken'
1104
+ ]
1105
+
1106
+ return self.api_client.param_serialize(
1107
+ method='GET',
1108
+ resource_path='/api/vps/v1/post-install-scripts/{postInstallScriptId}',
1109
+ path_params=_path_params,
1110
+ query_params=_query_params,
1111
+ header_params=_header_params,
1112
+ body=_body_params,
1113
+ post_params=_form_params,
1114
+ files=_files,
1115
+ auth_settings=_auth_settings,
1116
+ collection_formats=_collection_formats,
1117
+ _host=_host,
1118
+ _request_auth=_request_auth
1119
+ )
1120
+
1121
+
1122
+
1123
+
1124
+ @validate_call
1125
+ def update_post_install_script_v1(
1126
+ self,
1127
+ post_install_script_id: Annotated[StrictInt, Field(description="Post-install script ID")],
1128
+ vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest,
1129
+ _request_timeout: Union[
1130
+ None,
1131
+ Annotated[StrictFloat, Field(gt=0)],
1132
+ Tuple[
1133
+ Annotated[StrictFloat, Field(gt=0)],
1134
+ Annotated[StrictFloat, Field(gt=0)]
1135
+ ]
1136
+ ] = None,
1137
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1138
+ _content_type: Optional[StrictStr] = None,
1139
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1140
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1141
+ ) -> VPSV1PostInstallScriptPostInstallScriptResource:
1142
+ """Update post-install script
1143
+
1144
+ This endpoint updates a specific post-install script.
1145
+
1146
+ :param post_install_script_id: Post-install script ID (required)
1147
+ :type post_install_script_id: int
1148
+ :param vpsv1_post_install_script_store_request: (required)
1149
+ :type vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest
1150
+ :param _request_timeout: timeout setting for this request. If one
1151
+ number provided, it will be total request
1152
+ timeout. It can also be a pair (tuple) of
1153
+ (connection, read) timeouts.
1154
+ :type _request_timeout: int, tuple(int, int), optional
1155
+ :param _request_auth: set to override the auth_settings for an a single
1156
+ request; this effectively ignores the
1157
+ authentication in the spec for a single request.
1158
+ :type _request_auth: dict, optional
1159
+ :param _content_type: force content-type for the request.
1160
+ :type _content_type: str, Optional
1161
+ :param _headers: set to override the headers for a single
1162
+ request; this effectively ignores the headers
1163
+ in the spec for a single request.
1164
+ :type _headers: dict, optional
1165
+ :param _host_index: set to override the host_index for a single
1166
+ request; this effectively ignores the host_index
1167
+ in the spec for a single request.
1168
+ :type _host_index: int, optional
1169
+ :return: Returns the result object.
1170
+ """ # noqa: E501
1171
+
1172
+ _param = self._update_post_install_script_v1_serialize(
1173
+ post_install_script_id=post_install_script_id,
1174
+ vpsv1_post_install_script_store_request=vpsv1_post_install_script_store_request,
1175
+ _request_auth=_request_auth,
1176
+ _content_type=_content_type,
1177
+ _headers=_headers,
1178
+ _host_index=_host_index
1179
+ )
1180
+
1181
+ _response_types_map: Dict[str, Optional[str]] = {
1182
+ '200': "VPSV1PostInstallScriptPostInstallScriptResource",
1183
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
1184
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1185
+ '500': "CommonSchemaErrorResponseSchema",
1186
+ }
1187
+ response_data = self.api_client.call_api(
1188
+ *_param,
1189
+ _request_timeout=_request_timeout
1190
+ )
1191
+ response_data.read()
1192
+ return self.api_client.response_deserialize(
1193
+ response_data=response_data,
1194
+ response_types_map=_response_types_map,
1195
+ ).data
1196
+
1197
+
1198
+ @validate_call
1199
+ def update_post_install_script_v1_with_http_info(
1200
+ self,
1201
+ post_install_script_id: Annotated[StrictInt, Field(description="Post-install script ID")],
1202
+ vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest,
1203
+ _request_timeout: Union[
1204
+ None,
1205
+ Annotated[StrictFloat, Field(gt=0)],
1206
+ Tuple[
1207
+ Annotated[StrictFloat, Field(gt=0)],
1208
+ Annotated[StrictFloat, Field(gt=0)]
1209
+ ]
1210
+ ] = None,
1211
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1212
+ _content_type: Optional[StrictStr] = None,
1213
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1214
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1215
+ ) -> ApiResponse[VPSV1PostInstallScriptPostInstallScriptResource]:
1216
+ """Update post-install script
1217
+
1218
+ This endpoint updates a specific post-install script.
1219
+
1220
+ :param post_install_script_id: Post-install script ID (required)
1221
+ :type post_install_script_id: int
1222
+ :param vpsv1_post_install_script_store_request: (required)
1223
+ :type vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest
1224
+ :param _request_timeout: timeout setting for this request. If one
1225
+ number provided, it will be total request
1226
+ timeout. It can also be a pair (tuple) of
1227
+ (connection, read) timeouts.
1228
+ :type _request_timeout: int, tuple(int, int), optional
1229
+ :param _request_auth: set to override the auth_settings for an a single
1230
+ request; this effectively ignores the
1231
+ authentication in the spec for a single request.
1232
+ :type _request_auth: dict, optional
1233
+ :param _content_type: force content-type for the request.
1234
+ :type _content_type: str, Optional
1235
+ :param _headers: set to override the headers for a single
1236
+ request; this effectively ignores the headers
1237
+ in the spec for a single request.
1238
+ :type _headers: dict, optional
1239
+ :param _host_index: set to override the host_index for a single
1240
+ request; this effectively ignores the host_index
1241
+ in the spec for a single request.
1242
+ :type _host_index: int, optional
1243
+ :return: Returns the result object.
1244
+ """ # noqa: E501
1245
+
1246
+ _param = self._update_post_install_script_v1_serialize(
1247
+ post_install_script_id=post_install_script_id,
1248
+ vpsv1_post_install_script_store_request=vpsv1_post_install_script_store_request,
1249
+ _request_auth=_request_auth,
1250
+ _content_type=_content_type,
1251
+ _headers=_headers,
1252
+ _host_index=_host_index
1253
+ )
1254
+
1255
+ _response_types_map: Dict[str, Optional[str]] = {
1256
+ '200': "VPSV1PostInstallScriptPostInstallScriptResource",
1257
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
1258
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1259
+ '500': "CommonSchemaErrorResponseSchema",
1260
+ }
1261
+ response_data = self.api_client.call_api(
1262
+ *_param,
1263
+ _request_timeout=_request_timeout
1264
+ )
1265
+ response_data.read()
1266
+ return self.api_client.response_deserialize(
1267
+ response_data=response_data,
1268
+ response_types_map=_response_types_map,
1269
+ )
1270
+
1271
+
1272
+ @validate_call
1273
+ def update_post_install_script_v1_without_preload_content(
1274
+ self,
1275
+ post_install_script_id: Annotated[StrictInt, Field(description="Post-install script ID")],
1276
+ vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest,
1277
+ _request_timeout: Union[
1278
+ None,
1279
+ Annotated[StrictFloat, Field(gt=0)],
1280
+ Tuple[
1281
+ Annotated[StrictFloat, Field(gt=0)],
1282
+ Annotated[StrictFloat, Field(gt=0)]
1283
+ ]
1284
+ ] = None,
1285
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1286
+ _content_type: Optional[StrictStr] = None,
1287
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1288
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1289
+ ) -> RESTResponseType:
1290
+ """Update post-install script
1291
+
1292
+ This endpoint updates a specific post-install script.
1293
+
1294
+ :param post_install_script_id: Post-install script ID (required)
1295
+ :type post_install_script_id: int
1296
+ :param vpsv1_post_install_script_store_request: (required)
1297
+ :type vpsv1_post_install_script_store_request: VPSV1PostInstallScriptStoreRequest
1298
+ :param _request_timeout: timeout setting for this request. If one
1299
+ number provided, it will be total request
1300
+ timeout. It can also be a pair (tuple) of
1301
+ (connection, read) timeouts.
1302
+ :type _request_timeout: int, tuple(int, int), optional
1303
+ :param _request_auth: set to override the auth_settings for an a single
1304
+ request; this effectively ignores the
1305
+ authentication in the spec for a single request.
1306
+ :type _request_auth: dict, optional
1307
+ :param _content_type: force content-type for the request.
1308
+ :type _content_type: str, Optional
1309
+ :param _headers: set to override the headers for a single
1310
+ request; this effectively ignores the headers
1311
+ in the spec for a single request.
1312
+ :type _headers: dict, optional
1313
+ :param _host_index: set to override the host_index for a single
1314
+ request; this effectively ignores the host_index
1315
+ in the spec for a single request.
1316
+ :type _host_index: int, optional
1317
+ :return: Returns the result object.
1318
+ """ # noqa: E501
1319
+
1320
+ _param = self._update_post_install_script_v1_serialize(
1321
+ post_install_script_id=post_install_script_id,
1322
+ vpsv1_post_install_script_store_request=vpsv1_post_install_script_store_request,
1323
+ _request_auth=_request_auth,
1324
+ _content_type=_content_type,
1325
+ _headers=_headers,
1326
+ _host_index=_host_index
1327
+ )
1328
+
1329
+ _response_types_map: Dict[str, Optional[str]] = {
1330
+ '200': "VPSV1PostInstallScriptPostInstallScriptResource",
1331
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
1332
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1333
+ '500': "CommonSchemaErrorResponseSchema",
1334
+ }
1335
+ response_data = self.api_client.call_api(
1336
+ *_param,
1337
+ _request_timeout=_request_timeout
1338
+ )
1339
+ return response_data.response
1340
+
1341
+
1342
+ def _update_post_install_script_v1_serialize(
1343
+ self,
1344
+ post_install_script_id,
1345
+ vpsv1_post_install_script_store_request,
1346
+ _request_auth,
1347
+ _content_type,
1348
+ _headers,
1349
+ _host_index,
1350
+ ) -> RequestSerialized:
1351
+
1352
+ _host = None
1353
+
1354
+ _collection_formats: Dict[str, str] = {
1355
+ }
1356
+
1357
+ _path_params: Dict[str, str] = {}
1358
+ _query_params: List[Tuple[str, str]] = []
1359
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1360
+ _form_params: List[Tuple[str, str]] = []
1361
+ _files: Dict[
1362
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1363
+ ] = {}
1364
+ _body_params: Optional[bytes] = None
1365
+
1366
+ # process the path parameters
1367
+ if post_install_script_id is not None:
1368
+ _path_params['postInstallScriptId'] = post_install_script_id
1369
+ # process the query parameters
1370
+ # process the header parameters
1371
+ # process the form parameters
1372
+ # process the body parameter
1373
+ if vpsv1_post_install_script_store_request is not None:
1374
+ _body_params = vpsv1_post_install_script_store_request
1375
+
1376
+
1377
+ # set the HTTP header `Accept`
1378
+ if 'Accept' not in _header_params:
1379
+ _header_params['Accept'] = self.api_client.select_header_accept(
1380
+ [
1381
+ 'application/json'
1382
+ ]
1383
+ )
1384
+
1385
+ # set the HTTP header `Content-Type`
1386
+ if _content_type:
1387
+ _header_params['Content-Type'] = _content_type
1388
+ else:
1389
+ _default_content_type = (
1390
+ self.api_client.select_header_content_type(
1391
+ [
1392
+ 'application/json'
1393
+ ]
1394
+ )
1395
+ )
1396
+ if _default_content_type is not None:
1397
+ _header_params['Content-Type'] = _default_content_type
1398
+
1399
+ # authentication setting
1400
+ _auth_settings: List[str] = [
1401
+ 'apiToken'
1402
+ ]
1403
+
1404
+ return self.api_client.param_serialize(
1405
+ method='PUT',
1406
+ resource_path='/api/vps/v1/post-install-scripts/{postInstallScriptId}',
1407
+ path_params=_path_params,
1408
+ query_params=_query_params,
1409
+ header_params=_header_params,
1410
+ body=_body_params,
1411
+ post_params=_form_params,
1412
+ files=_files,
1413
+ auth_settings=_auth_settings,
1414
+ collection_formats=_collection_formats,
1415
+ _host=_host,
1416
+ _request_auth=_request_auth
1417
+ )
1418
+
1419
+