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,2872 @@
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_firewall_list_v1200_response import VPSGetFirewallListV1200Response
22
+ from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
23
+ from hostinger_api.models.vpsv1_firewall_firewall_resource import VPSV1FirewallFirewallResource
24
+ from hostinger_api.models.vpsv1_firewall_firewall_rule_resource import VPSV1FirewallFirewallRuleResource
25
+ from hostinger_api.models.vpsv1_firewall_rules_store_request import VPSV1FirewallRulesStoreRequest
26
+ from hostinger_api.models.vpsv1_firewall_store_request import VPSV1FirewallStoreRequest
27
+
28
+ from hostinger_api.api_client import ApiClient, RequestSerialized
29
+ from hostinger_api.api_response import ApiResponse
30
+ from hostinger_api.rest import RESTResponseType
31
+
32
+
33
+ class VPSFirewallApi:
34
+
35
+ def __init__(self, api_client=None) -> None:
36
+ if api_client is None:
37
+ api_client = ApiClient.get_default()
38
+ self.api_client = api_client
39
+
40
+
41
+ @validate_call
42
+ def activate_firewall_v1(
43
+ self,
44
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
45
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
46
+ _request_timeout: Union[
47
+ None,
48
+ Annotated[StrictFloat, Field(gt=0)],
49
+ Tuple[
50
+ Annotated[StrictFloat, Field(gt=0)],
51
+ Annotated[StrictFloat, Field(gt=0)]
52
+ ]
53
+ ] = None,
54
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
55
+ _content_type: Optional[StrictStr] = None,
56
+ _headers: Optional[Dict[StrictStr, Any]] = None,
57
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
58
+ ) -> VPSV1ActionActionResource:
59
+ """Activate firewall
60
+
61
+ This endpoint activates a firewall for a specified virtual machine. Only one firewall can be active for a virtual machine at a time.
62
+
63
+ :param firewall_id: Firewall ID (required)
64
+ :type firewall_id: int
65
+ :param virtual_machine_id: Virtual Machine ID (required)
66
+ :type virtual_machine_id: int
67
+ :param _request_timeout: timeout setting for this request. If one
68
+ number provided, it will be total request
69
+ timeout. It can also be a pair (tuple) of
70
+ (connection, read) timeouts.
71
+ :type _request_timeout: int, tuple(int, int), optional
72
+ :param _request_auth: set to override the auth_settings for an a single
73
+ request; this effectively ignores the
74
+ authentication in the spec for a single request.
75
+ :type _request_auth: dict, optional
76
+ :param _content_type: force content-type for the request.
77
+ :type _content_type: str, Optional
78
+ :param _headers: set to override the headers for a single
79
+ request; this effectively ignores the headers
80
+ in the spec for a single request.
81
+ :type _headers: dict, optional
82
+ :param _host_index: set to override the host_index for a single
83
+ request; this effectively ignores the host_index
84
+ in the spec for a single request.
85
+ :type _host_index: int, optional
86
+ :return: Returns the result object.
87
+ """ # noqa: E501
88
+
89
+ _param = self._activate_firewall_v1_serialize(
90
+ firewall_id=firewall_id,
91
+ virtual_machine_id=virtual_machine_id,
92
+ _request_auth=_request_auth,
93
+ _content_type=_content_type,
94
+ _headers=_headers,
95
+ _host_index=_host_index
96
+ )
97
+
98
+ _response_types_map: Dict[str, Optional[str]] = {
99
+ '200': "VPSV1ActionActionResource",
100
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
101
+ '401': "CommonSchemaUnauthorizedResponseSchema",
102
+ '500': "CommonSchemaErrorResponseSchema",
103
+ }
104
+ response_data = self.api_client.call_api(
105
+ *_param,
106
+ _request_timeout=_request_timeout
107
+ )
108
+ response_data.read()
109
+ return self.api_client.response_deserialize(
110
+ response_data=response_data,
111
+ response_types_map=_response_types_map,
112
+ ).data
113
+
114
+
115
+ @validate_call
116
+ def activate_firewall_v1_with_http_info(
117
+ self,
118
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
119
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
120
+ _request_timeout: Union[
121
+ None,
122
+ Annotated[StrictFloat, Field(gt=0)],
123
+ Tuple[
124
+ Annotated[StrictFloat, Field(gt=0)],
125
+ Annotated[StrictFloat, Field(gt=0)]
126
+ ]
127
+ ] = None,
128
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
129
+ _content_type: Optional[StrictStr] = None,
130
+ _headers: Optional[Dict[StrictStr, Any]] = None,
131
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
132
+ ) -> ApiResponse[VPSV1ActionActionResource]:
133
+ """Activate firewall
134
+
135
+ This endpoint activates a firewall for a specified virtual machine. Only one firewall can be active for a virtual machine at a time.
136
+
137
+ :param firewall_id: Firewall ID (required)
138
+ :type firewall_id: int
139
+ :param virtual_machine_id: Virtual Machine ID (required)
140
+ :type virtual_machine_id: int
141
+ :param _request_timeout: timeout setting for this request. If one
142
+ number provided, it will be total request
143
+ timeout. It can also be a pair (tuple) of
144
+ (connection, read) timeouts.
145
+ :type _request_timeout: int, tuple(int, int), optional
146
+ :param _request_auth: set to override the auth_settings for an a single
147
+ request; this effectively ignores the
148
+ authentication in the spec for a single request.
149
+ :type _request_auth: dict, optional
150
+ :param _content_type: force content-type for the request.
151
+ :type _content_type: str, Optional
152
+ :param _headers: set to override the headers for a single
153
+ request; this effectively ignores the headers
154
+ in the spec for a single request.
155
+ :type _headers: dict, optional
156
+ :param _host_index: set to override the host_index for a single
157
+ request; this effectively ignores the host_index
158
+ in the spec for a single request.
159
+ :type _host_index: int, optional
160
+ :return: Returns the result object.
161
+ """ # noqa: E501
162
+
163
+ _param = self._activate_firewall_v1_serialize(
164
+ firewall_id=firewall_id,
165
+ virtual_machine_id=virtual_machine_id,
166
+ _request_auth=_request_auth,
167
+ _content_type=_content_type,
168
+ _headers=_headers,
169
+ _host_index=_host_index
170
+ )
171
+
172
+ _response_types_map: Dict[str, Optional[str]] = {
173
+ '200': "VPSV1ActionActionResource",
174
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
175
+ '401': "CommonSchemaUnauthorizedResponseSchema",
176
+ '500': "CommonSchemaErrorResponseSchema",
177
+ }
178
+ response_data = self.api_client.call_api(
179
+ *_param,
180
+ _request_timeout=_request_timeout
181
+ )
182
+ response_data.read()
183
+ return self.api_client.response_deserialize(
184
+ response_data=response_data,
185
+ response_types_map=_response_types_map,
186
+ )
187
+
188
+
189
+ @validate_call
190
+ def activate_firewall_v1_without_preload_content(
191
+ self,
192
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
193
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
194
+ _request_timeout: Union[
195
+ None,
196
+ Annotated[StrictFloat, Field(gt=0)],
197
+ Tuple[
198
+ Annotated[StrictFloat, Field(gt=0)],
199
+ Annotated[StrictFloat, Field(gt=0)]
200
+ ]
201
+ ] = None,
202
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
203
+ _content_type: Optional[StrictStr] = None,
204
+ _headers: Optional[Dict[StrictStr, Any]] = None,
205
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
206
+ ) -> RESTResponseType:
207
+ """Activate firewall
208
+
209
+ This endpoint activates a firewall for a specified virtual machine. Only one firewall can be active for a virtual machine at a time.
210
+
211
+ :param firewall_id: Firewall ID (required)
212
+ :type firewall_id: int
213
+ :param virtual_machine_id: Virtual Machine ID (required)
214
+ :type virtual_machine_id: int
215
+ :param _request_timeout: timeout setting for this request. If one
216
+ number provided, it will be total request
217
+ timeout. It can also be a pair (tuple) of
218
+ (connection, read) timeouts.
219
+ :type _request_timeout: int, tuple(int, int), optional
220
+ :param _request_auth: set to override the auth_settings for an a single
221
+ request; this effectively ignores the
222
+ authentication in the spec for a single request.
223
+ :type _request_auth: dict, optional
224
+ :param _content_type: force content-type for the request.
225
+ :type _content_type: str, Optional
226
+ :param _headers: set to override the headers for a single
227
+ request; this effectively ignores the headers
228
+ in the spec for a single request.
229
+ :type _headers: dict, optional
230
+ :param _host_index: set to override the host_index for a single
231
+ request; this effectively ignores the host_index
232
+ in the spec for a single request.
233
+ :type _host_index: int, optional
234
+ :return: Returns the result object.
235
+ """ # noqa: E501
236
+
237
+ _param = self._activate_firewall_v1_serialize(
238
+ firewall_id=firewall_id,
239
+ virtual_machine_id=virtual_machine_id,
240
+ _request_auth=_request_auth,
241
+ _content_type=_content_type,
242
+ _headers=_headers,
243
+ _host_index=_host_index
244
+ )
245
+
246
+ _response_types_map: Dict[str, Optional[str]] = {
247
+ '200': "VPSV1ActionActionResource",
248
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
249
+ '401': "CommonSchemaUnauthorizedResponseSchema",
250
+ '500': "CommonSchemaErrorResponseSchema",
251
+ }
252
+ response_data = self.api_client.call_api(
253
+ *_param,
254
+ _request_timeout=_request_timeout
255
+ )
256
+ return response_data.response
257
+
258
+
259
+ def _activate_firewall_v1_serialize(
260
+ self,
261
+ firewall_id,
262
+ virtual_machine_id,
263
+ _request_auth,
264
+ _content_type,
265
+ _headers,
266
+ _host_index,
267
+ ) -> RequestSerialized:
268
+
269
+ _host = None
270
+
271
+ _collection_formats: Dict[str, str] = {
272
+ }
273
+
274
+ _path_params: Dict[str, str] = {}
275
+ _query_params: List[Tuple[str, str]] = []
276
+ _header_params: Dict[str, Optional[str]] = _headers or {}
277
+ _form_params: List[Tuple[str, str]] = []
278
+ _files: Dict[
279
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
280
+ ] = {}
281
+ _body_params: Optional[bytes] = None
282
+
283
+ # process the path parameters
284
+ if firewall_id is not None:
285
+ _path_params['firewallId'] = firewall_id
286
+ if virtual_machine_id is not None:
287
+ _path_params['virtualMachineId'] = virtual_machine_id
288
+ # process the query parameters
289
+ # process the header parameters
290
+ # process the form parameters
291
+ # process the body parameter
292
+
293
+
294
+ # set the HTTP header `Accept`
295
+ if 'Accept' not in _header_params:
296
+ _header_params['Accept'] = self.api_client.select_header_accept(
297
+ [
298
+ 'application/json'
299
+ ]
300
+ )
301
+
302
+
303
+ # authentication setting
304
+ _auth_settings: List[str] = [
305
+ 'apiToken'
306
+ ]
307
+
308
+ return self.api_client.param_serialize(
309
+ method='POST',
310
+ resource_path='/api/vps/v1/firewall/{firewallId}/activate/{virtualMachineId}',
311
+ path_params=_path_params,
312
+ query_params=_query_params,
313
+ header_params=_header_params,
314
+ body=_body_params,
315
+ post_params=_form_params,
316
+ files=_files,
317
+ auth_settings=_auth_settings,
318
+ collection_formats=_collection_formats,
319
+ _host=_host,
320
+ _request_auth=_request_auth
321
+ )
322
+
323
+
324
+
325
+
326
+ @validate_call
327
+ def create_firewall_rule_v1(
328
+ self,
329
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
330
+ vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest,
331
+ _request_timeout: Union[
332
+ None,
333
+ Annotated[StrictFloat, Field(gt=0)],
334
+ Tuple[
335
+ Annotated[StrictFloat, Field(gt=0)],
336
+ Annotated[StrictFloat, Field(gt=0)]
337
+ ]
338
+ ] = None,
339
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
340
+ _content_type: Optional[StrictStr] = None,
341
+ _headers: Optional[Dict[StrictStr, Any]] = None,
342
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
343
+ ) -> VPSV1FirewallFirewallRuleResource:
344
+ """Create firewall rule
345
+
346
+ This endpoint creates new firewall rule from a specified firewall. By default, the firewall drops all incoming traffic, which means you must add accept rules for all ports you want to use. Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
347
+
348
+ :param firewall_id: Firewall ID (required)
349
+ :type firewall_id: int
350
+ :param vpsv1_firewall_rules_store_request: (required)
351
+ :type vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest
352
+ :param _request_timeout: timeout setting for this request. If one
353
+ number provided, it will be total request
354
+ timeout. It can also be a pair (tuple) of
355
+ (connection, read) timeouts.
356
+ :type _request_timeout: int, tuple(int, int), optional
357
+ :param _request_auth: set to override the auth_settings for an a single
358
+ request; this effectively ignores the
359
+ authentication in the spec for a single request.
360
+ :type _request_auth: dict, optional
361
+ :param _content_type: force content-type for the request.
362
+ :type _content_type: str, Optional
363
+ :param _headers: set to override the headers for a single
364
+ request; this effectively ignores the headers
365
+ in the spec for a single request.
366
+ :type _headers: dict, optional
367
+ :param _host_index: set to override the host_index for a single
368
+ request; this effectively ignores the host_index
369
+ in the spec for a single request.
370
+ :type _host_index: int, optional
371
+ :return: Returns the result object.
372
+ """ # noqa: E501
373
+
374
+ _param = self._create_firewall_rule_v1_serialize(
375
+ firewall_id=firewall_id,
376
+ vpsv1_firewall_rules_store_request=vpsv1_firewall_rules_store_request,
377
+ _request_auth=_request_auth,
378
+ _content_type=_content_type,
379
+ _headers=_headers,
380
+ _host_index=_host_index
381
+ )
382
+
383
+ _response_types_map: Dict[str, Optional[str]] = {
384
+ '200': "VPSV1FirewallFirewallRuleResource",
385
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
386
+ '401': "CommonSchemaUnauthorizedResponseSchema",
387
+ '500': "CommonSchemaErrorResponseSchema",
388
+ }
389
+ response_data = self.api_client.call_api(
390
+ *_param,
391
+ _request_timeout=_request_timeout
392
+ )
393
+ response_data.read()
394
+ return self.api_client.response_deserialize(
395
+ response_data=response_data,
396
+ response_types_map=_response_types_map,
397
+ ).data
398
+
399
+
400
+ @validate_call
401
+ def create_firewall_rule_v1_with_http_info(
402
+ self,
403
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
404
+ vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest,
405
+ _request_timeout: Union[
406
+ None,
407
+ Annotated[StrictFloat, Field(gt=0)],
408
+ Tuple[
409
+ Annotated[StrictFloat, Field(gt=0)],
410
+ Annotated[StrictFloat, Field(gt=0)]
411
+ ]
412
+ ] = None,
413
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
414
+ _content_type: Optional[StrictStr] = None,
415
+ _headers: Optional[Dict[StrictStr, Any]] = None,
416
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
417
+ ) -> ApiResponse[VPSV1FirewallFirewallRuleResource]:
418
+ """Create firewall rule
419
+
420
+ This endpoint creates new firewall rule from a specified firewall. By default, the firewall drops all incoming traffic, which means you must add accept rules for all ports you want to use. Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
421
+
422
+ :param firewall_id: Firewall ID (required)
423
+ :type firewall_id: int
424
+ :param vpsv1_firewall_rules_store_request: (required)
425
+ :type vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest
426
+ :param _request_timeout: timeout setting for this request. If one
427
+ number provided, it will be total request
428
+ timeout. It can also be a pair (tuple) of
429
+ (connection, read) timeouts.
430
+ :type _request_timeout: int, tuple(int, int), optional
431
+ :param _request_auth: set to override the auth_settings for an a single
432
+ request; this effectively ignores the
433
+ authentication in the spec for a single request.
434
+ :type _request_auth: dict, optional
435
+ :param _content_type: force content-type for the request.
436
+ :type _content_type: str, Optional
437
+ :param _headers: set to override the headers for a single
438
+ request; this effectively ignores the headers
439
+ in the spec for a single request.
440
+ :type _headers: dict, optional
441
+ :param _host_index: set to override the host_index for a single
442
+ request; this effectively ignores the host_index
443
+ in the spec for a single request.
444
+ :type _host_index: int, optional
445
+ :return: Returns the result object.
446
+ """ # noqa: E501
447
+
448
+ _param = self._create_firewall_rule_v1_serialize(
449
+ firewall_id=firewall_id,
450
+ vpsv1_firewall_rules_store_request=vpsv1_firewall_rules_store_request,
451
+ _request_auth=_request_auth,
452
+ _content_type=_content_type,
453
+ _headers=_headers,
454
+ _host_index=_host_index
455
+ )
456
+
457
+ _response_types_map: Dict[str, Optional[str]] = {
458
+ '200': "VPSV1FirewallFirewallRuleResource",
459
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
460
+ '401': "CommonSchemaUnauthorizedResponseSchema",
461
+ '500': "CommonSchemaErrorResponseSchema",
462
+ }
463
+ response_data = self.api_client.call_api(
464
+ *_param,
465
+ _request_timeout=_request_timeout
466
+ )
467
+ response_data.read()
468
+ return self.api_client.response_deserialize(
469
+ response_data=response_data,
470
+ response_types_map=_response_types_map,
471
+ )
472
+
473
+
474
+ @validate_call
475
+ def create_firewall_rule_v1_without_preload_content(
476
+ self,
477
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
478
+ vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest,
479
+ _request_timeout: Union[
480
+ None,
481
+ Annotated[StrictFloat, Field(gt=0)],
482
+ Tuple[
483
+ Annotated[StrictFloat, Field(gt=0)],
484
+ Annotated[StrictFloat, Field(gt=0)]
485
+ ]
486
+ ] = None,
487
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
488
+ _content_type: Optional[StrictStr] = None,
489
+ _headers: Optional[Dict[StrictStr, Any]] = None,
490
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
491
+ ) -> RESTResponseType:
492
+ """Create firewall rule
493
+
494
+ This endpoint creates new firewall rule from a specified firewall. By default, the firewall drops all incoming traffic, which means you must add accept rules for all ports you want to use. Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
495
+
496
+ :param firewall_id: Firewall ID (required)
497
+ :type firewall_id: int
498
+ :param vpsv1_firewall_rules_store_request: (required)
499
+ :type vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest
500
+ :param _request_timeout: timeout setting for this request. If one
501
+ number provided, it will be total request
502
+ timeout. It can also be a pair (tuple) of
503
+ (connection, read) timeouts.
504
+ :type _request_timeout: int, tuple(int, int), optional
505
+ :param _request_auth: set to override the auth_settings for an a single
506
+ request; this effectively ignores the
507
+ authentication in the spec for a single request.
508
+ :type _request_auth: dict, optional
509
+ :param _content_type: force content-type for the request.
510
+ :type _content_type: str, Optional
511
+ :param _headers: set to override the headers for a single
512
+ request; this effectively ignores the headers
513
+ in the spec for a single request.
514
+ :type _headers: dict, optional
515
+ :param _host_index: set to override the host_index for a single
516
+ request; this effectively ignores the host_index
517
+ in the spec for a single request.
518
+ :type _host_index: int, optional
519
+ :return: Returns the result object.
520
+ """ # noqa: E501
521
+
522
+ _param = self._create_firewall_rule_v1_serialize(
523
+ firewall_id=firewall_id,
524
+ vpsv1_firewall_rules_store_request=vpsv1_firewall_rules_store_request,
525
+ _request_auth=_request_auth,
526
+ _content_type=_content_type,
527
+ _headers=_headers,
528
+ _host_index=_host_index
529
+ )
530
+
531
+ _response_types_map: Dict[str, Optional[str]] = {
532
+ '200': "VPSV1FirewallFirewallRuleResource",
533
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
534
+ '401': "CommonSchemaUnauthorizedResponseSchema",
535
+ '500': "CommonSchemaErrorResponseSchema",
536
+ }
537
+ response_data = self.api_client.call_api(
538
+ *_param,
539
+ _request_timeout=_request_timeout
540
+ )
541
+ return response_data.response
542
+
543
+
544
+ def _create_firewall_rule_v1_serialize(
545
+ self,
546
+ firewall_id,
547
+ vpsv1_firewall_rules_store_request,
548
+ _request_auth,
549
+ _content_type,
550
+ _headers,
551
+ _host_index,
552
+ ) -> RequestSerialized:
553
+
554
+ _host = None
555
+
556
+ _collection_formats: Dict[str, str] = {
557
+ }
558
+
559
+ _path_params: Dict[str, str] = {}
560
+ _query_params: List[Tuple[str, str]] = []
561
+ _header_params: Dict[str, Optional[str]] = _headers or {}
562
+ _form_params: List[Tuple[str, str]] = []
563
+ _files: Dict[
564
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
565
+ ] = {}
566
+ _body_params: Optional[bytes] = None
567
+
568
+ # process the path parameters
569
+ if firewall_id is not None:
570
+ _path_params['firewallId'] = firewall_id
571
+ # process the query parameters
572
+ # process the header parameters
573
+ # process the form parameters
574
+ # process the body parameter
575
+ if vpsv1_firewall_rules_store_request is not None:
576
+ _body_params = vpsv1_firewall_rules_store_request
577
+
578
+
579
+ # set the HTTP header `Accept`
580
+ if 'Accept' not in _header_params:
581
+ _header_params['Accept'] = self.api_client.select_header_accept(
582
+ [
583
+ 'application/json'
584
+ ]
585
+ )
586
+
587
+ # set the HTTP header `Content-Type`
588
+ if _content_type:
589
+ _header_params['Content-Type'] = _content_type
590
+ else:
591
+ _default_content_type = (
592
+ self.api_client.select_header_content_type(
593
+ [
594
+ 'application/json'
595
+ ]
596
+ )
597
+ )
598
+ if _default_content_type is not None:
599
+ _header_params['Content-Type'] = _default_content_type
600
+
601
+ # authentication setting
602
+ _auth_settings: List[str] = [
603
+ 'apiToken'
604
+ ]
605
+
606
+ return self.api_client.param_serialize(
607
+ method='POST',
608
+ resource_path='/api/vps/v1/firewall/{firewallId}/rules',
609
+ path_params=_path_params,
610
+ query_params=_query_params,
611
+ header_params=_header_params,
612
+ body=_body_params,
613
+ post_params=_form_params,
614
+ files=_files,
615
+ auth_settings=_auth_settings,
616
+ collection_formats=_collection_formats,
617
+ _host=_host,
618
+ _request_auth=_request_auth
619
+ )
620
+
621
+
622
+
623
+
624
+ @validate_call
625
+ def create_new_firewall_v1(
626
+ self,
627
+ vpsv1_firewall_store_request: VPSV1FirewallStoreRequest,
628
+ _request_timeout: Union[
629
+ None,
630
+ Annotated[StrictFloat, Field(gt=0)],
631
+ Tuple[
632
+ Annotated[StrictFloat, Field(gt=0)],
633
+ Annotated[StrictFloat, Field(gt=0)]
634
+ ]
635
+ ] = None,
636
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
637
+ _content_type: Optional[StrictStr] = None,
638
+ _headers: Optional[Dict[StrictStr, Any]] = None,
639
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
640
+ ) -> VPSV1FirewallFirewallResource:
641
+ """Create new firewall
642
+
643
+ This endpoint creates a new firewall.
644
+
645
+ :param vpsv1_firewall_store_request: (required)
646
+ :type vpsv1_firewall_store_request: VPSV1FirewallStoreRequest
647
+ :param _request_timeout: timeout setting for this request. If one
648
+ number provided, it will be total request
649
+ timeout. It can also be a pair (tuple) of
650
+ (connection, read) timeouts.
651
+ :type _request_timeout: int, tuple(int, int), optional
652
+ :param _request_auth: set to override the auth_settings for an a single
653
+ request; this effectively ignores the
654
+ authentication in the spec for a single request.
655
+ :type _request_auth: dict, optional
656
+ :param _content_type: force content-type for the request.
657
+ :type _content_type: str, Optional
658
+ :param _headers: set to override the headers for a single
659
+ request; this effectively ignores the headers
660
+ in the spec for a single request.
661
+ :type _headers: dict, optional
662
+ :param _host_index: set to override the host_index for a single
663
+ request; this effectively ignores the host_index
664
+ in the spec for a single request.
665
+ :type _host_index: int, optional
666
+ :return: Returns the result object.
667
+ """ # noqa: E501
668
+
669
+ _param = self._create_new_firewall_v1_serialize(
670
+ vpsv1_firewall_store_request=vpsv1_firewall_store_request,
671
+ _request_auth=_request_auth,
672
+ _content_type=_content_type,
673
+ _headers=_headers,
674
+ _host_index=_host_index
675
+ )
676
+
677
+ _response_types_map: Dict[str, Optional[str]] = {
678
+ '200': "VPSV1FirewallFirewallResource",
679
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
680
+ '401': "CommonSchemaUnauthorizedResponseSchema",
681
+ '500': "CommonSchemaErrorResponseSchema",
682
+ }
683
+ response_data = self.api_client.call_api(
684
+ *_param,
685
+ _request_timeout=_request_timeout
686
+ )
687
+ response_data.read()
688
+ return self.api_client.response_deserialize(
689
+ response_data=response_data,
690
+ response_types_map=_response_types_map,
691
+ ).data
692
+
693
+
694
+ @validate_call
695
+ def create_new_firewall_v1_with_http_info(
696
+ self,
697
+ vpsv1_firewall_store_request: VPSV1FirewallStoreRequest,
698
+ _request_timeout: Union[
699
+ None,
700
+ Annotated[StrictFloat, Field(gt=0)],
701
+ Tuple[
702
+ Annotated[StrictFloat, Field(gt=0)],
703
+ Annotated[StrictFloat, Field(gt=0)]
704
+ ]
705
+ ] = None,
706
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
707
+ _content_type: Optional[StrictStr] = None,
708
+ _headers: Optional[Dict[StrictStr, Any]] = None,
709
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
710
+ ) -> ApiResponse[VPSV1FirewallFirewallResource]:
711
+ """Create new firewall
712
+
713
+ This endpoint creates a new firewall.
714
+
715
+ :param vpsv1_firewall_store_request: (required)
716
+ :type vpsv1_firewall_store_request: VPSV1FirewallStoreRequest
717
+ :param _request_timeout: timeout setting for this request. If one
718
+ number provided, it will be total request
719
+ timeout. It can also be a pair (tuple) of
720
+ (connection, read) timeouts.
721
+ :type _request_timeout: int, tuple(int, int), optional
722
+ :param _request_auth: set to override the auth_settings for an a single
723
+ request; this effectively ignores the
724
+ authentication in the spec for a single request.
725
+ :type _request_auth: dict, optional
726
+ :param _content_type: force content-type for the request.
727
+ :type _content_type: str, Optional
728
+ :param _headers: set to override the headers for a single
729
+ request; this effectively ignores the headers
730
+ in the spec for a single request.
731
+ :type _headers: dict, optional
732
+ :param _host_index: set to override the host_index for a single
733
+ request; this effectively ignores the host_index
734
+ in the spec for a single request.
735
+ :type _host_index: int, optional
736
+ :return: Returns the result object.
737
+ """ # noqa: E501
738
+
739
+ _param = self._create_new_firewall_v1_serialize(
740
+ vpsv1_firewall_store_request=vpsv1_firewall_store_request,
741
+ _request_auth=_request_auth,
742
+ _content_type=_content_type,
743
+ _headers=_headers,
744
+ _host_index=_host_index
745
+ )
746
+
747
+ _response_types_map: Dict[str, Optional[str]] = {
748
+ '200': "VPSV1FirewallFirewallResource",
749
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
750
+ '401': "CommonSchemaUnauthorizedResponseSchema",
751
+ '500': "CommonSchemaErrorResponseSchema",
752
+ }
753
+ response_data = self.api_client.call_api(
754
+ *_param,
755
+ _request_timeout=_request_timeout
756
+ )
757
+ response_data.read()
758
+ return self.api_client.response_deserialize(
759
+ response_data=response_data,
760
+ response_types_map=_response_types_map,
761
+ )
762
+
763
+
764
+ @validate_call
765
+ def create_new_firewall_v1_without_preload_content(
766
+ self,
767
+ vpsv1_firewall_store_request: VPSV1FirewallStoreRequest,
768
+ _request_timeout: Union[
769
+ None,
770
+ Annotated[StrictFloat, Field(gt=0)],
771
+ Tuple[
772
+ Annotated[StrictFloat, Field(gt=0)],
773
+ Annotated[StrictFloat, Field(gt=0)]
774
+ ]
775
+ ] = None,
776
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
777
+ _content_type: Optional[StrictStr] = None,
778
+ _headers: Optional[Dict[StrictStr, Any]] = None,
779
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
780
+ ) -> RESTResponseType:
781
+ """Create new firewall
782
+
783
+ This endpoint creates a new firewall.
784
+
785
+ :param vpsv1_firewall_store_request: (required)
786
+ :type vpsv1_firewall_store_request: VPSV1FirewallStoreRequest
787
+ :param _request_timeout: timeout setting for this request. If one
788
+ number provided, it will be total request
789
+ timeout. It can also be a pair (tuple) of
790
+ (connection, read) timeouts.
791
+ :type _request_timeout: int, tuple(int, int), optional
792
+ :param _request_auth: set to override the auth_settings for an a single
793
+ request; this effectively ignores the
794
+ authentication in the spec for a single request.
795
+ :type _request_auth: dict, optional
796
+ :param _content_type: force content-type for the request.
797
+ :type _content_type: str, Optional
798
+ :param _headers: set to override the headers for a single
799
+ request; this effectively ignores the headers
800
+ in the spec for a single request.
801
+ :type _headers: dict, optional
802
+ :param _host_index: set to override the host_index for a single
803
+ request; this effectively ignores the host_index
804
+ in the spec for a single request.
805
+ :type _host_index: int, optional
806
+ :return: Returns the result object.
807
+ """ # noqa: E501
808
+
809
+ _param = self._create_new_firewall_v1_serialize(
810
+ vpsv1_firewall_store_request=vpsv1_firewall_store_request,
811
+ _request_auth=_request_auth,
812
+ _content_type=_content_type,
813
+ _headers=_headers,
814
+ _host_index=_host_index
815
+ )
816
+
817
+ _response_types_map: Dict[str, Optional[str]] = {
818
+ '200': "VPSV1FirewallFirewallResource",
819
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
820
+ '401': "CommonSchemaUnauthorizedResponseSchema",
821
+ '500': "CommonSchemaErrorResponseSchema",
822
+ }
823
+ response_data = self.api_client.call_api(
824
+ *_param,
825
+ _request_timeout=_request_timeout
826
+ )
827
+ return response_data.response
828
+
829
+
830
+ def _create_new_firewall_v1_serialize(
831
+ self,
832
+ vpsv1_firewall_store_request,
833
+ _request_auth,
834
+ _content_type,
835
+ _headers,
836
+ _host_index,
837
+ ) -> RequestSerialized:
838
+
839
+ _host = None
840
+
841
+ _collection_formats: Dict[str, str] = {
842
+ }
843
+
844
+ _path_params: Dict[str, str] = {}
845
+ _query_params: List[Tuple[str, str]] = []
846
+ _header_params: Dict[str, Optional[str]] = _headers or {}
847
+ _form_params: List[Tuple[str, str]] = []
848
+ _files: Dict[
849
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
850
+ ] = {}
851
+ _body_params: Optional[bytes] = None
852
+
853
+ # process the path parameters
854
+ # process the query parameters
855
+ # process the header parameters
856
+ # process the form parameters
857
+ # process the body parameter
858
+ if vpsv1_firewall_store_request is not None:
859
+ _body_params = vpsv1_firewall_store_request
860
+
861
+
862
+ # set the HTTP header `Accept`
863
+ if 'Accept' not in _header_params:
864
+ _header_params['Accept'] = self.api_client.select_header_accept(
865
+ [
866
+ 'application/json'
867
+ ]
868
+ )
869
+
870
+ # set the HTTP header `Content-Type`
871
+ if _content_type:
872
+ _header_params['Content-Type'] = _content_type
873
+ else:
874
+ _default_content_type = (
875
+ self.api_client.select_header_content_type(
876
+ [
877
+ 'application/json'
878
+ ]
879
+ )
880
+ )
881
+ if _default_content_type is not None:
882
+ _header_params['Content-Type'] = _default_content_type
883
+
884
+ # authentication setting
885
+ _auth_settings: List[str] = [
886
+ 'apiToken'
887
+ ]
888
+
889
+ return self.api_client.param_serialize(
890
+ method='POST',
891
+ resource_path='/api/vps/v1/firewall',
892
+ path_params=_path_params,
893
+ query_params=_query_params,
894
+ header_params=_header_params,
895
+ body=_body_params,
896
+ post_params=_form_params,
897
+ files=_files,
898
+ auth_settings=_auth_settings,
899
+ collection_formats=_collection_formats,
900
+ _host=_host,
901
+ _request_auth=_request_auth
902
+ )
903
+
904
+
905
+
906
+
907
+ @validate_call
908
+ def deactivate_firewall_v1(
909
+ self,
910
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
911
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
912
+ _request_timeout: Union[
913
+ None,
914
+ Annotated[StrictFloat, Field(gt=0)],
915
+ Tuple[
916
+ Annotated[StrictFloat, Field(gt=0)],
917
+ Annotated[StrictFloat, Field(gt=0)]
918
+ ]
919
+ ] = None,
920
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
921
+ _content_type: Optional[StrictStr] = None,
922
+ _headers: Optional[Dict[StrictStr, Any]] = None,
923
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
924
+ ) -> VPSV1ActionActionResource:
925
+ """Deactivate firewall
926
+
927
+ This endpoint deactivates a firewall for a specified virtual machine.
928
+
929
+ :param firewall_id: Firewall ID (required)
930
+ :type firewall_id: int
931
+ :param virtual_machine_id: Virtual Machine ID (required)
932
+ :type virtual_machine_id: int
933
+ :param _request_timeout: timeout setting for this request. If one
934
+ number provided, it will be total request
935
+ timeout. It can also be a pair (tuple) of
936
+ (connection, read) timeouts.
937
+ :type _request_timeout: int, tuple(int, int), optional
938
+ :param _request_auth: set to override the auth_settings for an a single
939
+ request; this effectively ignores the
940
+ authentication in the spec for a single request.
941
+ :type _request_auth: dict, optional
942
+ :param _content_type: force content-type for the request.
943
+ :type _content_type: str, Optional
944
+ :param _headers: set to override the headers for a single
945
+ request; this effectively ignores the headers
946
+ in the spec for a single request.
947
+ :type _headers: dict, optional
948
+ :param _host_index: set to override the host_index for a single
949
+ request; this effectively ignores the host_index
950
+ in the spec for a single request.
951
+ :type _host_index: int, optional
952
+ :return: Returns the result object.
953
+ """ # noqa: E501
954
+
955
+ _param = self._deactivate_firewall_v1_serialize(
956
+ firewall_id=firewall_id,
957
+ virtual_machine_id=virtual_machine_id,
958
+ _request_auth=_request_auth,
959
+ _content_type=_content_type,
960
+ _headers=_headers,
961
+ _host_index=_host_index
962
+ )
963
+
964
+ _response_types_map: Dict[str, Optional[str]] = {
965
+ '200': "VPSV1ActionActionResource",
966
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
967
+ '401': "CommonSchemaUnauthorizedResponseSchema",
968
+ '500': "CommonSchemaErrorResponseSchema",
969
+ }
970
+ response_data = self.api_client.call_api(
971
+ *_param,
972
+ _request_timeout=_request_timeout
973
+ )
974
+ response_data.read()
975
+ return self.api_client.response_deserialize(
976
+ response_data=response_data,
977
+ response_types_map=_response_types_map,
978
+ ).data
979
+
980
+
981
+ @validate_call
982
+ def deactivate_firewall_v1_with_http_info(
983
+ self,
984
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
985
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
986
+ _request_timeout: Union[
987
+ None,
988
+ Annotated[StrictFloat, Field(gt=0)],
989
+ Tuple[
990
+ Annotated[StrictFloat, Field(gt=0)],
991
+ Annotated[StrictFloat, Field(gt=0)]
992
+ ]
993
+ ] = None,
994
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
995
+ _content_type: Optional[StrictStr] = None,
996
+ _headers: Optional[Dict[StrictStr, Any]] = None,
997
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
998
+ ) -> ApiResponse[VPSV1ActionActionResource]:
999
+ """Deactivate firewall
1000
+
1001
+ This endpoint deactivates a firewall for a specified virtual machine.
1002
+
1003
+ :param firewall_id: Firewall ID (required)
1004
+ :type firewall_id: int
1005
+ :param virtual_machine_id: Virtual Machine ID (required)
1006
+ :type virtual_machine_id: int
1007
+ :param _request_timeout: timeout setting for this request. If one
1008
+ number provided, it will be total request
1009
+ timeout. It can also be a pair (tuple) of
1010
+ (connection, read) timeouts.
1011
+ :type _request_timeout: int, tuple(int, int), optional
1012
+ :param _request_auth: set to override the auth_settings for an a single
1013
+ request; this effectively ignores the
1014
+ authentication in the spec for a single request.
1015
+ :type _request_auth: dict, optional
1016
+ :param _content_type: force content-type for the request.
1017
+ :type _content_type: str, Optional
1018
+ :param _headers: set to override the headers for a single
1019
+ request; this effectively ignores the headers
1020
+ in the spec for a single request.
1021
+ :type _headers: dict, optional
1022
+ :param _host_index: set to override the host_index for a single
1023
+ request; this effectively ignores the host_index
1024
+ in the spec for a single request.
1025
+ :type _host_index: int, optional
1026
+ :return: Returns the result object.
1027
+ """ # noqa: E501
1028
+
1029
+ _param = self._deactivate_firewall_v1_serialize(
1030
+ firewall_id=firewall_id,
1031
+ virtual_machine_id=virtual_machine_id,
1032
+ _request_auth=_request_auth,
1033
+ _content_type=_content_type,
1034
+ _headers=_headers,
1035
+ _host_index=_host_index
1036
+ )
1037
+
1038
+ _response_types_map: Dict[str, Optional[str]] = {
1039
+ '200': "VPSV1ActionActionResource",
1040
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
1041
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1042
+ '500': "CommonSchemaErrorResponseSchema",
1043
+ }
1044
+ response_data = self.api_client.call_api(
1045
+ *_param,
1046
+ _request_timeout=_request_timeout
1047
+ )
1048
+ response_data.read()
1049
+ return self.api_client.response_deserialize(
1050
+ response_data=response_data,
1051
+ response_types_map=_response_types_map,
1052
+ )
1053
+
1054
+
1055
+ @validate_call
1056
+ def deactivate_firewall_v1_without_preload_content(
1057
+ self,
1058
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
1059
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
1060
+ _request_timeout: Union[
1061
+ None,
1062
+ Annotated[StrictFloat, Field(gt=0)],
1063
+ Tuple[
1064
+ Annotated[StrictFloat, Field(gt=0)],
1065
+ Annotated[StrictFloat, Field(gt=0)]
1066
+ ]
1067
+ ] = None,
1068
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1069
+ _content_type: Optional[StrictStr] = None,
1070
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1071
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1072
+ ) -> RESTResponseType:
1073
+ """Deactivate firewall
1074
+
1075
+ This endpoint deactivates a firewall for a specified virtual machine.
1076
+
1077
+ :param firewall_id: Firewall ID (required)
1078
+ :type firewall_id: int
1079
+ :param virtual_machine_id: Virtual Machine ID (required)
1080
+ :type virtual_machine_id: int
1081
+ :param _request_timeout: timeout setting for this request. If one
1082
+ number provided, it will be total request
1083
+ timeout. It can also be a pair (tuple) of
1084
+ (connection, read) timeouts.
1085
+ :type _request_timeout: int, tuple(int, int), optional
1086
+ :param _request_auth: set to override the auth_settings for an a single
1087
+ request; this effectively ignores the
1088
+ authentication in the spec for a single request.
1089
+ :type _request_auth: dict, optional
1090
+ :param _content_type: force content-type for the request.
1091
+ :type _content_type: str, Optional
1092
+ :param _headers: set to override the headers for a single
1093
+ request; this effectively ignores the headers
1094
+ in the spec for a single request.
1095
+ :type _headers: dict, optional
1096
+ :param _host_index: set to override the host_index for a single
1097
+ request; this effectively ignores the host_index
1098
+ in the spec for a single request.
1099
+ :type _host_index: int, optional
1100
+ :return: Returns the result object.
1101
+ """ # noqa: E501
1102
+
1103
+ _param = self._deactivate_firewall_v1_serialize(
1104
+ firewall_id=firewall_id,
1105
+ virtual_machine_id=virtual_machine_id,
1106
+ _request_auth=_request_auth,
1107
+ _content_type=_content_type,
1108
+ _headers=_headers,
1109
+ _host_index=_host_index
1110
+ )
1111
+
1112
+ _response_types_map: Dict[str, Optional[str]] = {
1113
+ '200': "VPSV1ActionActionResource",
1114
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
1115
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1116
+ '500': "CommonSchemaErrorResponseSchema",
1117
+ }
1118
+ response_data = self.api_client.call_api(
1119
+ *_param,
1120
+ _request_timeout=_request_timeout
1121
+ )
1122
+ return response_data.response
1123
+
1124
+
1125
+ def _deactivate_firewall_v1_serialize(
1126
+ self,
1127
+ firewall_id,
1128
+ virtual_machine_id,
1129
+ _request_auth,
1130
+ _content_type,
1131
+ _headers,
1132
+ _host_index,
1133
+ ) -> RequestSerialized:
1134
+
1135
+ _host = None
1136
+
1137
+ _collection_formats: Dict[str, str] = {
1138
+ }
1139
+
1140
+ _path_params: Dict[str, str] = {}
1141
+ _query_params: List[Tuple[str, str]] = []
1142
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1143
+ _form_params: List[Tuple[str, str]] = []
1144
+ _files: Dict[
1145
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1146
+ ] = {}
1147
+ _body_params: Optional[bytes] = None
1148
+
1149
+ # process the path parameters
1150
+ if firewall_id is not None:
1151
+ _path_params['firewallId'] = firewall_id
1152
+ if virtual_machine_id is not None:
1153
+ _path_params['virtualMachineId'] = virtual_machine_id
1154
+ # process the query parameters
1155
+ # process the header parameters
1156
+ # process the form parameters
1157
+ # process the body parameter
1158
+
1159
+
1160
+ # set the HTTP header `Accept`
1161
+ if 'Accept' not in _header_params:
1162
+ _header_params['Accept'] = self.api_client.select_header_accept(
1163
+ [
1164
+ 'application/json'
1165
+ ]
1166
+ )
1167
+
1168
+
1169
+ # authentication setting
1170
+ _auth_settings: List[str] = [
1171
+ 'apiToken'
1172
+ ]
1173
+
1174
+ return self.api_client.param_serialize(
1175
+ method='POST',
1176
+ resource_path='/api/vps/v1/firewall/{firewallId}/deactivate/{virtualMachineId}',
1177
+ path_params=_path_params,
1178
+ query_params=_query_params,
1179
+ header_params=_header_params,
1180
+ body=_body_params,
1181
+ post_params=_form_params,
1182
+ files=_files,
1183
+ auth_settings=_auth_settings,
1184
+ collection_formats=_collection_formats,
1185
+ _host=_host,
1186
+ _request_auth=_request_auth
1187
+ )
1188
+
1189
+
1190
+
1191
+
1192
+ @validate_call
1193
+ def delete_firewall_rule_v1(
1194
+ self,
1195
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
1196
+ rule_id: Annotated[StrictInt, Field(description="Firewall Rule ID")],
1197
+ _request_timeout: Union[
1198
+ None,
1199
+ Annotated[StrictFloat, Field(gt=0)],
1200
+ Tuple[
1201
+ Annotated[StrictFloat, Field(gt=0)],
1202
+ Annotated[StrictFloat, Field(gt=0)]
1203
+ ]
1204
+ ] = None,
1205
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1206
+ _content_type: Optional[StrictStr] = None,
1207
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1208
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1209
+ ) -> CommonSuccessEmptyResource:
1210
+ """Delete firewall rule
1211
+
1212
+ This endpoint deletes a specific firewall rule from a specified firewall. Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
1213
+
1214
+ :param firewall_id: Firewall ID (required)
1215
+ :type firewall_id: int
1216
+ :param rule_id: Firewall Rule ID (required)
1217
+ :type rule_id: int
1218
+ :param _request_timeout: timeout setting for this request. If one
1219
+ number provided, it will be total request
1220
+ timeout. It can also be a pair (tuple) of
1221
+ (connection, read) timeouts.
1222
+ :type _request_timeout: int, tuple(int, int), optional
1223
+ :param _request_auth: set to override the auth_settings for an a single
1224
+ request; this effectively ignores the
1225
+ authentication in the spec for a single request.
1226
+ :type _request_auth: dict, optional
1227
+ :param _content_type: force content-type for the request.
1228
+ :type _content_type: str, Optional
1229
+ :param _headers: set to override the headers for a single
1230
+ request; this effectively ignores the headers
1231
+ in the spec for a single request.
1232
+ :type _headers: dict, optional
1233
+ :param _host_index: set to override the host_index for a single
1234
+ request; this effectively ignores the host_index
1235
+ in the spec for a single request.
1236
+ :type _host_index: int, optional
1237
+ :return: Returns the result object.
1238
+ """ # noqa: E501
1239
+
1240
+ _param = self._delete_firewall_rule_v1_serialize(
1241
+ firewall_id=firewall_id,
1242
+ rule_id=rule_id,
1243
+ _request_auth=_request_auth,
1244
+ _content_type=_content_type,
1245
+ _headers=_headers,
1246
+ _host_index=_host_index
1247
+ )
1248
+
1249
+ _response_types_map: Dict[str, Optional[str]] = {
1250
+ '200': "CommonSuccessEmptyResource",
1251
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1252
+ '500': "CommonSchemaErrorResponseSchema",
1253
+ }
1254
+ response_data = self.api_client.call_api(
1255
+ *_param,
1256
+ _request_timeout=_request_timeout
1257
+ )
1258
+ response_data.read()
1259
+ return self.api_client.response_deserialize(
1260
+ response_data=response_data,
1261
+ response_types_map=_response_types_map,
1262
+ ).data
1263
+
1264
+
1265
+ @validate_call
1266
+ def delete_firewall_rule_v1_with_http_info(
1267
+ self,
1268
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
1269
+ rule_id: Annotated[StrictInt, Field(description="Firewall Rule ID")],
1270
+ _request_timeout: Union[
1271
+ None,
1272
+ Annotated[StrictFloat, Field(gt=0)],
1273
+ Tuple[
1274
+ Annotated[StrictFloat, Field(gt=0)],
1275
+ Annotated[StrictFloat, Field(gt=0)]
1276
+ ]
1277
+ ] = None,
1278
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1279
+ _content_type: Optional[StrictStr] = None,
1280
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1281
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1282
+ ) -> ApiResponse[CommonSuccessEmptyResource]:
1283
+ """Delete firewall rule
1284
+
1285
+ This endpoint deletes a specific firewall rule from a specified firewall. Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
1286
+
1287
+ :param firewall_id: Firewall ID (required)
1288
+ :type firewall_id: int
1289
+ :param rule_id: Firewall Rule ID (required)
1290
+ :type rule_id: int
1291
+ :param _request_timeout: timeout setting for this request. If one
1292
+ number provided, it will be total request
1293
+ timeout. It can also be a pair (tuple) of
1294
+ (connection, read) timeouts.
1295
+ :type _request_timeout: int, tuple(int, int), optional
1296
+ :param _request_auth: set to override the auth_settings for an a single
1297
+ request; this effectively ignores the
1298
+ authentication in the spec for a single request.
1299
+ :type _request_auth: dict, optional
1300
+ :param _content_type: force content-type for the request.
1301
+ :type _content_type: str, Optional
1302
+ :param _headers: set to override the headers for a single
1303
+ request; this effectively ignores the headers
1304
+ in the spec for a single request.
1305
+ :type _headers: dict, optional
1306
+ :param _host_index: set to override the host_index for a single
1307
+ request; this effectively ignores the host_index
1308
+ in the spec for a single request.
1309
+ :type _host_index: int, optional
1310
+ :return: Returns the result object.
1311
+ """ # noqa: E501
1312
+
1313
+ _param = self._delete_firewall_rule_v1_serialize(
1314
+ firewall_id=firewall_id,
1315
+ rule_id=rule_id,
1316
+ _request_auth=_request_auth,
1317
+ _content_type=_content_type,
1318
+ _headers=_headers,
1319
+ _host_index=_host_index
1320
+ )
1321
+
1322
+ _response_types_map: Dict[str, Optional[str]] = {
1323
+ '200': "CommonSuccessEmptyResource",
1324
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1325
+ '500': "CommonSchemaErrorResponseSchema",
1326
+ }
1327
+ response_data = self.api_client.call_api(
1328
+ *_param,
1329
+ _request_timeout=_request_timeout
1330
+ )
1331
+ response_data.read()
1332
+ return self.api_client.response_deserialize(
1333
+ response_data=response_data,
1334
+ response_types_map=_response_types_map,
1335
+ )
1336
+
1337
+
1338
+ @validate_call
1339
+ def delete_firewall_rule_v1_without_preload_content(
1340
+ self,
1341
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
1342
+ rule_id: Annotated[StrictInt, Field(description="Firewall Rule ID")],
1343
+ _request_timeout: Union[
1344
+ None,
1345
+ Annotated[StrictFloat, Field(gt=0)],
1346
+ Tuple[
1347
+ Annotated[StrictFloat, Field(gt=0)],
1348
+ Annotated[StrictFloat, Field(gt=0)]
1349
+ ]
1350
+ ] = None,
1351
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1352
+ _content_type: Optional[StrictStr] = None,
1353
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1354
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1355
+ ) -> RESTResponseType:
1356
+ """Delete firewall rule
1357
+
1358
+ This endpoint deletes a specific firewall rule from a specified firewall. Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
1359
+
1360
+ :param firewall_id: Firewall ID (required)
1361
+ :type firewall_id: int
1362
+ :param rule_id: Firewall Rule ID (required)
1363
+ :type rule_id: int
1364
+ :param _request_timeout: timeout setting for this request. If one
1365
+ number provided, it will be total request
1366
+ timeout. It can also be a pair (tuple) of
1367
+ (connection, read) timeouts.
1368
+ :type _request_timeout: int, tuple(int, int), optional
1369
+ :param _request_auth: set to override the auth_settings for an a single
1370
+ request; this effectively ignores the
1371
+ authentication in the spec for a single request.
1372
+ :type _request_auth: dict, optional
1373
+ :param _content_type: force content-type for the request.
1374
+ :type _content_type: str, Optional
1375
+ :param _headers: set to override the headers for a single
1376
+ request; this effectively ignores the headers
1377
+ in the spec for a single request.
1378
+ :type _headers: dict, optional
1379
+ :param _host_index: set to override the host_index for a single
1380
+ request; this effectively ignores the host_index
1381
+ in the spec for a single request.
1382
+ :type _host_index: int, optional
1383
+ :return: Returns the result object.
1384
+ """ # noqa: E501
1385
+
1386
+ _param = self._delete_firewall_rule_v1_serialize(
1387
+ firewall_id=firewall_id,
1388
+ rule_id=rule_id,
1389
+ _request_auth=_request_auth,
1390
+ _content_type=_content_type,
1391
+ _headers=_headers,
1392
+ _host_index=_host_index
1393
+ )
1394
+
1395
+ _response_types_map: Dict[str, Optional[str]] = {
1396
+ '200': "CommonSuccessEmptyResource",
1397
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1398
+ '500': "CommonSchemaErrorResponseSchema",
1399
+ }
1400
+ response_data = self.api_client.call_api(
1401
+ *_param,
1402
+ _request_timeout=_request_timeout
1403
+ )
1404
+ return response_data.response
1405
+
1406
+
1407
+ def _delete_firewall_rule_v1_serialize(
1408
+ self,
1409
+ firewall_id,
1410
+ rule_id,
1411
+ _request_auth,
1412
+ _content_type,
1413
+ _headers,
1414
+ _host_index,
1415
+ ) -> RequestSerialized:
1416
+
1417
+ _host = None
1418
+
1419
+ _collection_formats: Dict[str, str] = {
1420
+ }
1421
+
1422
+ _path_params: Dict[str, str] = {}
1423
+ _query_params: List[Tuple[str, str]] = []
1424
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1425
+ _form_params: List[Tuple[str, str]] = []
1426
+ _files: Dict[
1427
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1428
+ ] = {}
1429
+ _body_params: Optional[bytes] = None
1430
+
1431
+ # process the path parameters
1432
+ if firewall_id is not None:
1433
+ _path_params['firewallId'] = firewall_id
1434
+ if rule_id is not None:
1435
+ _path_params['ruleId'] = rule_id
1436
+ # process the query parameters
1437
+ # process the header parameters
1438
+ # process the form parameters
1439
+ # process the body parameter
1440
+
1441
+
1442
+ # set the HTTP header `Accept`
1443
+ if 'Accept' not in _header_params:
1444
+ _header_params['Accept'] = self.api_client.select_header_accept(
1445
+ [
1446
+ 'application/json'
1447
+ ]
1448
+ )
1449
+
1450
+
1451
+ # authentication setting
1452
+ _auth_settings: List[str] = [
1453
+ 'apiToken'
1454
+ ]
1455
+
1456
+ return self.api_client.param_serialize(
1457
+ method='DELETE',
1458
+ resource_path='/api/vps/v1/firewall/{firewallId}/rules/{ruleId}',
1459
+ path_params=_path_params,
1460
+ query_params=_query_params,
1461
+ header_params=_header_params,
1462
+ body=_body_params,
1463
+ post_params=_form_params,
1464
+ files=_files,
1465
+ auth_settings=_auth_settings,
1466
+ collection_formats=_collection_formats,
1467
+ _host=_host,
1468
+ _request_auth=_request_auth
1469
+ )
1470
+
1471
+
1472
+
1473
+
1474
+ @validate_call
1475
+ def delete_firewall_v1(
1476
+ self,
1477
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
1478
+ _request_timeout: Union[
1479
+ None,
1480
+ Annotated[StrictFloat, Field(gt=0)],
1481
+ Tuple[
1482
+ Annotated[StrictFloat, Field(gt=0)],
1483
+ Annotated[StrictFloat, Field(gt=0)]
1484
+ ]
1485
+ ] = None,
1486
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1487
+ _content_type: Optional[StrictStr] = None,
1488
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1489
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1490
+ ) -> CommonSuccessEmptyResource:
1491
+ """Delete firewall
1492
+
1493
+ This endpoint deletes a specified firewall. Any virtual machine that has this firewall activated will automatically have it deactivated.
1494
+
1495
+ :param firewall_id: Firewall ID (required)
1496
+ :type firewall_id: int
1497
+ :param _request_timeout: timeout setting for this request. If one
1498
+ number provided, it will be total request
1499
+ timeout. It can also be a pair (tuple) of
1500
+ (connection, read) timeouts.
1501
+ :type _request_timeout: int, tuple(int, int), optional
1502
+ :param _request_auth: set to override the auth_settings for an a single
1503
+ request; this effectively ignores the
1504
+ authentication in the spec for a single request.
1505
+ :type _request_auth: dict, optional
1506
+ :param _content_type: force content-type for the request.
1507
+ :type _content_type: str, Optional
1508
+ :param _headers: set to override the headers for a single
1509
+ request; this effectively ignores the headers
1510
+ in the spec for a single request.
1511
+ :type _headers: dict, optional
1512
+ :param _host_index: set to override the host_index for a single
1513
+ request; this effectively ignores the host_index
1514
+ in the spec for a single request.
1515
+ :type _host_index: int, optional
1516
+ :return: Returns the result object.
1517
+ """ # noqa: E501
1518
+
1519
+ _param = self._delete_firewall_v1_serialize(
1520
+ firewall_id=firewall_id,
1521
+ _request_auth=_request_auth,
1522
+ _content_type=_content_type,
1523
+ _headers=_headers,
1524
+ _host_index=_host_index
1525
+ )
1526
+
1527
+ _response_types_map: Dict[str, Optional[str]] = {
1528
+ '200': "CommonSuccessEmptyResource",
1529
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1530
+ '500': "CommonSchemaErrorResponseSchema",
1531
+ }
1532
+ response_data = self.api_client.call_api(
1533
+ *_param,
1534
+ _request_timeout=_request_timeout
1535
+ )
1536
+ response_data.read()
1537
+ return self.api_client.response_deserialize(
1538
+ response_data=response_data,
1539
+ response_types_map=_response_types_map,
1540
+ ).data
1541
+
1542
+
1543
+ @validate_call
1544
+ def delete_firewall_v1_with_http_info(
1545
+ self,
1546
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
1547
+ _request_timeout: Union[
1548
+ None,
1549
+ Annotated[StrictFloat, Field(gt=0)],
1550
+ Tuple[
1551
+ Annotated[StrictFloat, Field(gt=0)],
1552
+ Annotated[StrictFloat, Field(gt=0)]
1553
+ ]
1554
+ ] = None,
1555
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1556
+ _content_type: Optional[StrictStr] = None,
1557
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1558
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1559
+ ) -> ApiResponse[CommonSuccessEmptyResource]:
1560
+ """Delete firewall
1561
+
1562
+ This endpoint deletes a specified firewall. Any virtual machine that has this firewall activated will automatically have it deactivated.
1563
+
1564
+ :param firewall_id: Firewall ID (required)
1565
+ :type firewall_id: int
1566
+ :param _request_timeout: timeout setting for this request. If one
1567
+ number provided, it will be total request
1568
+ timeout. It can also be a pair (tuple) of
1569
+ (connection, read) timeouts.
1570
+ :type _request_timeout: int, tuple(int, int), optional
1571
+ :param _request_auth: set to override the auth_settings for an a single
1572
+ request; this effectively ignores the
1573
+ authentication in the spec for a single request.
1574
+ :type _request_auth: dict, optional
1575
+ :param _content_type: force content-type for the request.
1576
+ :type _content_type: str, Optional
1577
+ :param _headers: set to override the headers for a single
1578
+ request; this effectively ignores the headers
1579
+ in the spec for a single request.
1580
+ :type _headers: dict, optional
1581
+ :param _host_index: set to override the host_index for a single
1582
+ request; this effectively ignores the host_index
1583
+ in the spec for a single request.
1584
+ :type _host_index: int, optional
1585
+ :return: Returns the result object.
1586
+ """ # noqa: E501
1587
+
1588
+ _param = self._delete_firewall_v1_serialize(
1589
+ firewall_id=firewall_id,
1590
+ _request_auth=_request_auth,
1591
+ _content_type=_content_type,
1592
+ _headers=_headers,
1593
+ _host_index=_host_index
1594
+ )
1595
+
1596
+ _response_types_map: Dict[str, Optional[str]] = {
1597
+ '200': "CommonSuccessEmptyResource",
1598
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1599
+ '500': "CommonSchemaErrorResponseSchema",
1600
+ }
1601
+ response_data = self.api_client.call_api(
1602
+ *_param,
1603
+ _request_timeout=_request_timeout
1604
+ )
1605
+ response_data.read()
1606
+ return self.api_client.response_deserialize(
1607
+ response_data=response_data,
1608
+ response_types_map=_response_types_map,
1609
+ )
1610
+
1611
+
1612
+ @validate_call
1613
+ def delete_firewall_v1_without_preload_content(
1614
+ self,
1615
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
1616
+ _request_timeout: Union[
1617
+ None,
1618
+ Annotated[StrictFloat, Field(gt=0)],
1619
+ Tuple[
1620
+ Annotated[StrictFloat, Field(gt=0)],
1621
+ Annotated[StrictFloat, Field(gt=0)]
1622
+ ]
1623
+ ] = None,
1624
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1625
+ _content_type: Optional[StrictStr] = None,
1626
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1627
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1628
+ ) -> RESTResponseType:
1629
+ """Delete firewall
1630
+
1631
+ This endpoint deletes a specified firewall. Any virtual machine that has this firewall activated will automatically have it deactivated.
1632
+
1633
+ :param firewall_id: Firewall ID (required)
1634
+ :type firewall_id: int
1635
+ :param _request_timeout: timeout setting for this request. If one
1636
+ number provided, it will be total request
1637
+ timeout. It can also be a pair (tuple) of
1638
+ (connection, read) timeouts.
1639
+ :type _request_timeout: int, tuple(int, int), optional
1640
+ :param _request_auth: set to override the auth_settings for an a single
1641
+ request; this effectively ignores the
1642
+ authentication in the spec for a single request.
1643
+ :type _request_auth: dict, optional
1644
+ :param _content_type: force content-type for the request.
1645
+ :type _content_type: str, Optional
1646
+ :param _headers: set to override the headers for a single
1647
+ request; this effectively ignores the headers
1648
+ in the spec for a single request.
1649
+ :type _headers: dict, optional
1650
+ :param _host_index: set to override the host_index for a single
1651
+ request; this effectively ignores the host_index
1652
+ in the spec for a single request.
1653
+ :type _host_index: int, optional
1654
+ :return: Returns the result object.
1655
+ """ # noqa: E501
1656
+
1657
+ _param = self._delete_firewall_v1_serialize(
1658
+ firewall_id=firewall_id,
1659
+ _request_auth=_request_auth,
1660
+ _content_type=_content_type,
1661
+ _headers=_headers,
1662
+ _host_index=_host_index
1663
+ )
1664
+
1665
+ _response_types_map: Dict[str, Optional[str]] = {
1666
+ '200': "CommonSuccessEmptyResource",
1667
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1668
+ '500': "CommonSchemaErrorResponseSchema",
1669
+ }
1670
+ response_data = self.api_client.call_api(
1671
+ *_param,
1672
+ _request_timeout=_request_timeout
1673
+ )
1674
+ return response_data.response
1675
+
1676
+
1677
+ def _delete_firewall_v1_serialize(
1678
+ self,
1679
+ firewall_id,
1680
+ _request_auth,
1681
+ _content_type,
1682
+ _headers,
1683
+ _host_index,
1684
+ ) -> RequestSerialized:
1685
+
1686
+ _host = None
1687
+
1688
+ _collection_formats: Dict[str, str] = {
1689
+ }
1690
+
1691
+ _path_params: Dict[str, str] = {}
1692
+ _query_params: List[Tuple[str, str]] = []
1693
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1694
+ _form_params: List[Tuple[str, str]] = []
1695
+ _files: Dict[
1696
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1697
+ ] = {}
1698
+ _body_params: Optional[bytes] = None
1699
+
1700
+ # process the path parameters
1701
+ if firewall_id is not None:
1702
+ _path_params['firewallId'] = firewall_id
1703
+ # process the query parameters
1704
+ # process the header parameters
1705
+ # process the form parameters
1706
+ # process the body parameter
1707
+
1708
+
1709
+ # set the HTTP header `Accept`
1710
+ if 'Accept' not in _header_params:
1711
+ _header_params['Accept'] = self.api_client.select_header_accept(
1712
+ [
1713
+ 'application/json'
1714
+ ]
1715
+ )
1716
+
1717
+
1718
+ # authentication setting
1719
+ _auth_settings: List[str] = [
1720
+ 'apiToken'
1721
+ ]
1722
+
1723
+ return self.api_client.param_serialize(
1724
+ method='DELETE',
1725
+ resource_path='/api/vps/v1/firewall/{firewallId}',
1726
+ path_params=_path_params,
1727
+ query_params=_query_params,
1728
+ header_params=_header_params,
1729
+ body=_body_params,
1730
+ post_params=_form_params,
1731
+ files=_files,
1732
+ auth_settings=_auth_settings,
1733
+ collection_formats=_collection_formats,
1734
+ _host=_host,
1735
+ _request_auth=_request_auth
1736
+ )
1737
+
1738
+
1739
+
1740
+
1741
+ @validate_call
1742
+ def get_firewall_list_v1(
1743
+ self,
1744
+ page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
1745
+ _request_timeout: Union[
1746
+ None,
1747
+ Annotated[StrictFloat, Field(gt=0)],
1748
+ Tuple[
1749
+ Annotated[StrictFloat, Field(gt=0)],
1750
+ Annotated[StrictFloat, Field(gt=0)]
1751
+ ]
1752
+ ] = None,
1753
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1754
+ _content_type: Optional[StrictStr] = None,
1755
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1756
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1757
+ ) -> VPSGetFirewallListV1200Response:
1758
+ """Get firewall list
1759
+
1760
+ This endpoint retrieves a list of all firewalls available.
1761
+
1762
+ :param page: Page number
1763
+ :type page: int
1764
+ :param _request_timeout: timeout setting for this request. If one
1765
+ number provided, it will be total request
1766
+ timeout. It can also be a pair (tuple) of
1767
+ (connection, read) timeouts.
1768
+ :type _request_timeout: int, tuple(int, int), optional
1769
+ :param _request_auth: set to override the auth_settings for an a single
1770
+ request; this effectively ignores the
1771
+ authentication in the spec for a single request.
1772
+ :type _request_auth: dict, optional
1773
+ :param _content_type: force content-type for the request.
1774
+ :type _content_type: str, Optional
1775
+ :param _headers: set to override the headers for a single
1776
+ request; this effectively ignores the headers
1777
+ in the spec for a single request.
1778
+ :type _headers: dict, optional
1779
+ :param _host_index: set to override the host_index for a single
1780
+ request; this effectively ignores the host_index
1781
+ in the spec for a single request.
1782
+ :type _host_index: int, optional
1783
+ :return: Returns the result object.
1784
+ """ # noqa: E501
1785
+
1786
+ _param = self._get_firewall_list_v1_serialize(
1787
+ page=page,
1788
+ _request_auth=_request_auth,
1789
+ _content_type=_content_type,
1790
+ _headers=_headers,
1791
+ _host_index=_host_index
1792
+ )
1793
+
1794
+ _response_types_map: Dict[str, Optional[str]] = {
1795
+ '200': "VPSGetFirewallListV1200Response",
1796
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1797
+ '500': "CommonSchemaErrorResponseSchema",
1798
+ }
1799
+ response_data = self.api_client.call_api(
1800
+ *_param,
1801
+ _request_timeout=_request_timeout
1802
+ )
1803
+ response_data.read()
1804
+ return self.api_client.response_deserialize(
1805
+ response_data=response_data,
1806
+ response_types_map=_response_types_map,
1807
+ ).data
1808
+
1809
+
1810
+ @validate_call
1811
+ def get_firewall_list_v1_with_http_info(
1812
+ self,
1813
+ page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
1814
+ _request_timeout: Union[
1815
+ None,
1816
+ Annotated[StrictFloat, Field(gt=0)],
1817
+ Tuple[
1818
+ Annotated[StrictFloat, Field(gt=0)],
1819
+ Annotated[StrictFloat, Field(gt=0)]
1820
+ ]
1821
+ ] = None,
1822
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1823
+ _content_type: Optional[StrictStr] = None,
1824
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1825
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1826
+ ) -> ApiResponse[VPSGetFirewallListV1200Response]:
1827
+ """Get firewall list
1828
+
1829
+ This endpoint retrieves a list of all firewalls available.
1830
+
1831
+ :param page: Page number
1832
+ :type page: int
1833
+ :param _request_timeout: timeout setting for this request. If one
1834
+ number provided, it will be total request
1835
+ timeout. It can also be a pair (tuple) of
1836
+ (connection, read) timeouts.
1837
+ :type _request_timeout: int, tuple(int, int), optional
1838
+ :param _request_auth: set to override the auth_settings for an a single
1839
+ request; this effectively ignores the
1840
+ authentication in the spec for a single request.
1841
+ :type _request_auth: dict, optional
1842
+ :param _content_type: force content-type for the request.
1843
+ :type _content_type: str, Optional
1844
+ :param _headers: set to override the headers for a single
1845
+ request; this effectively ignores the headers
1846
+ in the spec for a single request.
1847
+ :type _headers: dict, optional
1848
+ :param _host_index: set to override the host_index for a single
1849
+ request; this effectively ignores the host_index
1850
+ in the spec for a single request.
1851
+ :type _host_index: int, optional
1852
+ :return: Returns the result object.
1853
+ """ # noqa: E501
1854
+
1855
+ _param = self._get_firewall_list_v1_serialize(
1856
+ page=page,
1857
+ _request_auth=_request_auth,
1858
+ _content_type=_content_type,
1859
+ _headers=_headers,
1860
+ _host_index=_host_index
1861
+ )
1862
+
1863
+ _response_types_map: Dict[str, Optional[str]] = {
1864
+ '200': "VPSGetFirewallListV1200Response",
1865
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1866
+ '500': "CommonSchemaErrorResponseSchema",
1867
+ }
1868
+ response_data = self.api_client.call_api(
1869
+ *_param,
1870
+ _request_timeout=_request_timeout
1871
+ )
1872
+ response_data.read()
1873
+ return self.api_client.response_deserialize(
1874
+ response_data=response_data,
1875
+ response_types_map=_response_types_map,
1876
+ )
1877
+
1878
+
1879
+ @validate_call
1880
+ def get_firewall_list_v1_without_preload_content(
1881
+ self,
1882
+ page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
1883
+ _request_timeout: Union[
1884
+ None,
1885
+ Annotated[StrictFloat, Field(gt=0)],
1886
+ Tuple[
1887
+ Annotated[StrictFloat, Field(gt=0)],
1888
+ Annotated[StrictFloat, Field(gt=0)]
1889
+ ]
1890
+ ] = None,
1891
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1892
+ _content_type: Optional[StrictStr] = None,
1893
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1894
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1895
+ ) -> RESTResponseType:
1896
+ """Get firewall list
1897
+
1898
+ This endpoint retrieves a list of all firewalls available.
1899
+
1900
+ :param page: Page number
1901
+ :type page: int
1902
+ :param _request_timeout: timeout setting for this request. If one
1903
+ number provided, it will be total request
1904
+ timeout. It can also be a pair (tuple) of
1905
+ (connection, read) timeouts.
1906
+ :type _request_timeout: int, tuple(int, int), optional
1907
+ :param _request_auth: set to override the auth_settings for an a single
1908
+ request; this effectively ignores the
1909
+ authentication in the spec for a single request.
1910
+ :type _request_auth: dict, optional
1911
+ :param _content_type: force content-type for the request.
1912
+ :type _content_type: str, Optional
1913
+ :param _headers: set to override the headers for a single
1914
+ request; this effectively ignores the headers
1915
+ in the spec for a single request.
1916
+ :type _headers: dict, optional
1917
+ :param _host_index: set to override the host_index for a single
1918
+ request; this effectively ignores the host_index
1919
+ in the spec for a single request.
1920
+ :type _host_index: int, optional
1921
+ :return: Returns the result object.
1922
+ """ # noqa: E501
1923
+
1924
+ _param = self._get_firewall_list_v1_serialize(
1925
+ page=page,
1926
+ _request_auth=_request_auth,
1927
+ _content_type=_content_type,
1928
+ _headers=_headers,
1929
+ _host_index=_host_index
1930
+ )
1931
+
1932
+ _response_types_map: Dict[str, Optional[str]] = {
1933
+ '200': "VPSGetFirewallListV1200Response",
1934
+ '401': "CommonSchemaUnauthorizedResponseSchema",
1935
+ '500': "CommonSchemaErrorResponseSchema",
1936
+ }
1937
+ response_data = self.api_client.call_api(
1938
+ *_param,
1939
+ _request_timeout=_request_timeout
1940
+ )
1941
+ return response_data.response
1942
+
1943
+
1944
+ def _get_firewall_list_v1_serialize(
1945
+ self,
1946
+ page,
1947
+ _request_auth,
1948
+ _content_type,
1949
+ _headers,
1950
+ _host_index,
1951
+ ) -> RequestSerialized:
1952
+
1953
+ _host = None
1954
+
1955
+ _collection_formats: Dict[str, str] = {
1956
+ }
1957
+
1958
+ _path_params: Dict[str, str] = {}
1959
+ _query_params: List[Tuple[str, str]] = []
1960
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1961
+ _form_params: List[Tuple[str, str]] = []
1962
+ _files: Dict[
1963
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1964
+ ] = {}
1965
+ _body_params: Optional[bytes] = None
1966
+
1967
+ # process the path parameters
1968
+ # process the query parameters
1969
+ if page is not None:
1970
+
1971
+ _query_params.append(('page', page))
1972
+
1973
+ # process the header parameters
1974
+ # process the form parameters
1975
+ # process the body parameter
1976
+
1977
+
1978
+ # set the HTTP header `Accept`
1979
+ if 'Accept' not in _header_params:
1980
+ _header_params['Accept'] = self.api_client.select_header_accept(
1981
+ [
1982
+ 'application/json'
1983
+ ]
1984
+ )
1985
+
1986
+
1987
+ # authentication setting
1988
+ _auth_settings: List[str] = [
1989
+ 'apiToken'
1990
+ ]
1991
+
1992
+ return self.api_client.param_serialize(
1993
+ method='GET',
1994
+ resource_path='/api/vps/v1/firewall',
1995
+ path_params=_path_params,
1996
+ query_params=_query_params,
1997
+ header_params=_header_params,
1998
+ body=_body_params,
1999
+ post_params=_form_params,
2000
+ files=_files,
2001
+ auth_settings=_auth_settings,
2002
+ collection_formats=_collection_formats,
2003
+ _host=_host,
2004
+ _request_auth=_request_auth
2005
+ )
2006
+
2007
+
2008
+
2009
+
2010
+ @validate_call
2011
+ def get_firewall_v1(
2012
+ self,
2013
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
2014
+ _request_timeout: Union[
2015
+ None,
2016
+ Annotated[StrictFloat, Field(gt=0)],
2017
+ Tuple[
2018
+ Annotated[StrictFloat, Field(gt=0)],
2019
+ Annotated[StrictFloat, Field(gt=0)]
2020
+ ]
2021
+ ] = None,
2022
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2023
+ _content_type: Optional[StrictStr] = None,
2024
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2025
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2026
+ ) -> VPSV1FirewallFirewallResource:
2027
+ """Get firewall
2028
+
2029
+ This endpoint retrieves firewall by its ID and rules associated with it.
2030
+
2031
+ :param firewall_id: Firewall ID (required)
2032
+ :type firewall_id: int
2033
+ :param _request_timeout: timeout setting for this request. If one
2034
+ number provided, it will be total request
2035
+ timeout. It can also be a pair (tuple) of
2036
+ (connection, read) timeouts.
2037
+ :type _request_timeout: int, tuple(int, int), optional
2038
+ :param _request_auth: set to override the auth_settings for an a single
2039
+ request; this effectively ignores the
2040
+ authentication in the spec for a single request.
2041
+ :type _request_auth: dict, optional
2042
+ :param _content_type: force content-type for the request.
2043
+ :type _content_type: str, Optional
2044
+ :param _headers: set to override the headers for a single
2045
+ request; this effectively ignores the headers
2046
+ in the spec for a single request.
2047
+ :type _headers: dict, optional
2048
+ :param _host_index: set to override the host_index for a single
2049
+ request; this effectively ignores the host_index
2050
+ in the spec for a single request.
2051
+ :type _host_index: int, optional
2052
+ :return: Returns the result object.
2053
+ """ # noqa: E501
2054
+
2055
+ _param = self._get_firewall_v1_serialize(
2056
+ firewall_id=firewall_id,
2057
+ _request_auth=_request_auth,
2058
+ _content_type=_content_type,
2059
+ _headers=_headers,
2060
+ _host_index=_host_index
2061
+ )
2062
+
2063
+ _response_types_map: Dict[str, Optional[str]] = {
2064
+ '200': "VPSV1FirewallFirewallResource",
2065
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2066
+ '500': "CommonSchemaErrorResponseSchema",
2067
+ }
2068
+ response_data = self.api_client.call_api(
2069
+ *_param,
2070
+ _request_timeout=_request_timeout
2071
+ )
2072
+ response_data.read()
2073
+ return self.api_client.response_deserialize(
2074
+ response_data=response_data,
2075
+ response_types_map=_response_types_map,
2076
+ ).data
2077
+
2078
+
2079
+ @validate_call
2080
+ def get_firewall_v1_with_http_info(
2081
+ self,
2082
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
2083
+ _request_timeout: Union[
2084
+ None,
2085
+ Annotated[StrictFloat, Field(gt=0)],
2086
+ Tuple[
2087
+ Annotated[StrictFloat, Field(gt=0)],
2088
+ Annotated[StrictFloat, Field(gt=0)]
2089
+ ]
2090
+ ] = None,
2091
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2092
+ _content_type: Optional[StrictStr] = None,
2093
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2094
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2095
+ ) -> ApiResponse[VPSV1FirewallFirewallResource]:
2096
+ """Get firewall
2097
+
2098
+ This endpoint retrieves firewall by its ID and rules associated with it.
2099
+
2100
+ :param firewall_id: Firewall ID (required)
2101
+ :type firewall_id: int
2102
+ :param _request_timeout: timeout setting for this request. If one
2103
+ number provided, it will be total request
2104
+ timeout. It can also be a pair (tuple) of
2105
+ (connection, read) timeouts.
2106
+ :type _request_timeout: int, tuple(int, int), optional
2107
+ :param _request_auth: set to override the auth_settings for an a single
2108
+ request; this effectively ignores the
2109
+ authentication in the spec for a single request.
2110
+ :type _request_auth: dict, optional
2111
+ :param _content_type: force content-type for the request.
2112
+ :type _content_type: str, Optional
2113
+ :param _headers: set to override the headers for a single
2114
+ request; this effectively ignores the headers
2115
+ in the spec for a single request.
2116
+ :type _headers: dict, optional
2117
+ :param _host_index: set to override the host_index for a single
2118
+ request; this effectively ignores the host_index
2119
+ in the spec for a single request.
2120
+ :type _host_index: int, optional
2121
+ :return: Returns the result object.
2122
+ """ # noqa: E501
2123
+
2124
+ _param = self._get_firewall_v1_serialize(
2125
+ firewall_id=firewall_id,
2126
+ _request_auth=_request_auth,
2127
+ _content_type=_content_type,
2128
+ _headers=_headers,
2129
+ _host_index=_host_index
2130
+ )
2131
+
2132
+ _response_types_map: Dict[str, Optional[str]] = {
2133
+ '200': "VPSV1FirewallFirewallResource",
2134
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2135
+ '500': "CommonSchemaErrorResponseSchema",
2136
+ }
2137
+ response_data = self.api_client.call_api(
2138
+ *_param,
2139
+ _request_timeout=_request_timeout
2140
+ )
2141
+ response_data.read()
2142
+ return self.api_client.response_deserialize(
2143
+ response_data=response_data,
2144
+ response_types_map=_response_types_map,
2145
+ )
2146
+
2147
+
2148
+ @validate_call
2149
+ def get_firewall_v1_without_preload_content(
2150
+ self,
2151
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
2152
+ _request_timeout: Union[
2153
+ None,
2154
+ Annotated[StrictFloat, Field(gt=0)],
2155
+ Tuple[
2156
+ Annotated[StrictFloat, Field(gt=0)],
2157
+ Annotated[StrictFloat, Field(gt=0)]
2158
+ ]
2159
+ ] = None,
2160
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2161
+ _content_type: Optional[StrictStr] = None,
2162
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2163
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2164
+ ) -> RESTResponseType:
2165
+ """Get firewall
2166
+
2167
+ This endpoint retrieves firewall by its ID and rules associated with it.
2168
+
2169
+ :param firewall_id: Firewall ID (required)
2170
+ :type firewall_id: int
2171
+ :param _request_timeout: timeout setting for this request. If one
2172
+ number provided, it will be total request
2173
+ timeout. It can also be a pair (tuple) of
2174
+ (connection, read) timeouts.
2175
+ :type _request_timeout: int, tuple(int, int), optional
2176
+ :param _request_auth: set to override the auth_settings for an a single
2177
+ request; this effectively ignores the
2178
+ authentication in the spec for a single request.
2179
+ :type _request_auth: dict, optional
2180
+ :param _content_type: force content-type for the request.
2181
+ :type _content_type: str, Optional
2182
+ :param _headers: set to override the headers for a single
2183
+ request; this effectively ignores the headers
2184
+ in the spec for a single request.
2185
+ :type _headers: dict, optional
2186
+ :param _host_index: set to override the host_index for a single
2187
+ request; this effectively ignores the host_index
2188
+ in the spec for a single request.
2189
+ :type _host_index: int, optional
2190
+ :return: Returns the result object.
2191
+ """ # noqa: E501
2192
+
2193
+ _param = self._get_firewall_v1_serialize(
2194
+ firewall_id=firewall_id,
2195
+ _request_auth=_request_auth,
2196
+ _content_type=_content_type,
2197
+ _headers=_headers,
2198
+ _host_index=_host_index
2199
+ )
2200
+
2201
+ _response_types_map: Dict[str, Optional[str]] = {
2202
+ '200': "VPSV1FirewallFirewallResource",
2203
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2204
+ '500': "CommonSchemaErrorResponseSchema",
2205
+ }
2206
+ response_data = self.api_client.call_api(
2207
+ *_param,
2208
+ _request_timeout=_request_timeout
2209
+ )
2210
+ return response_data.response
2211
+
2212
+
2213
+ def _get_firewall_v1_serialize(
2214
+ self,
2215
+ firewall_id,
2216
+ _request_auth,
2217
+ _content_type,
2218
+ _headers,
2219
+ _host_index,
2220
+ ) -> RequestSerialized:
2221
+
2222
+ _host = None
2223
+
2224
+ _collection_formats: Dict[str, str] = {
2225
+ }
2226
+
2227
+ _path_params: Dict[str, str] = {}
2228
+ _query_params: List[Tuple[str, str]] = []
2229
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2230
+ _form_params: List[Tuple[str, str]] = []
2231
+ _files: Dict[
2232
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2233
+ ] = {}
2234
+ _body_params: Optional[bytes] = None
2235
+
2236
+ # process the path parameters
2237
+ if firewall_id is not None:
2238
+ _path_params['firewallId'] = firewall_id
2239
+ # process the query parameters
2240
+ # process the header parameters
2241
+ # process the form parameters
2242
+ # process the body parameter
2243
+
2244
+
2245
+ # set the HTTP header `Accept`
2246
+ if 'Accept' not in _header_params:
2247
+ _header_params['Accept'] = self.api_client.select_header_accept(
2248
+ [
2249
+ 'application/json'
2250
+ ]
2251
+ )
2252
+
2253
+
2254
+ # authentication setting
2255
+ _auth_settings: List[str] = [
2256
+ 'apiToken'
2257
+ ]
2258
+
2259
+ return self.api_client.param_serialize(
2260
+ method='GET',
2261
+ resource_path='/api/vps/v1/firewall/{firewallId}',
2262
+ path_params=_path_params,
2263
+ query_params=_query_params,
2264
+ header_params=_header_params,
2265
+ body=_body_params,
2266
+ post_params=_form_params,
2267
+ files=_files,
2268
+ auth_settings=_auth_settings,
2269
+ collection_formats=_collection_formats,
2270
+ _host=_host,
2271
+ _request_auth=_request_auth
2272
+ )
2273
+
2274
+
2275
+
2276
+
2277
+ @validate_call
2278
+ def sync_firewall_v1(
2279
+ self,
2280
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
2281
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2282
+ _request_timeout: Union[
2283
+ None,
2284
+ Annotated[StrictFloat, Field(gt=0)],
2285
+ Tuple[
2286
+ Annotated[StrictFloat, Field(gt=0)],
2287
+ Annotated[StrictFloat, Field(gt=0)]
2288
+ ]
2289
+ ] = None,
2290
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2291
+ _content_type: Optional[StrictStr] = None,
2292
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2293
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2294
+ ) -> VPSV1ActionActionResource:
2295
+ """Sync firewall
2296
+
2297
+ This endpoint syncs a firewall for a specified virtual machine. Firewall can loose sync with virtual machine if the firewall has new rules added, removed or updated.
2298
+
2299
+ :param firewall_id: Firewall ID (required)
2300
+ :type firewall_id: int
2301
+ :param virtual_machine_id: Virtual Machine ID (required)
2302
+ :type virtual_machine_id: int
2303
+ :param _request_timeout: timeout setting for this request. If one
2304
+ number provided, it will be total request
2305
+ timeout. It can also be a pair (tuple) of
2306
+ (connection, read) timeouts.
2307
+ :type _request_timeout: int, tuple(int, int), optional
2308
+ :param _request_auth: set to override the auth_settings for an a single
2309
+ request; this effectively ignores the
2310
+ authentication in the spec for a single request.
2311
+ :type _request_auth: dict, optional
2312
+ :param _content_type: force content-type for the request.
2313
+ :type _content_type: str, Optional
2314
+ :param _headers: set to override the headers for a single
2315
+ request; this effectively ignores the headers
2316
+ in the spec for a single request.
2317
+ :type _headers: dict, optional
2318
+ :param _host_index: set to override the host_index for a single
2319
+ request; this effectively ignores the host_index
2320
+ in the spec for a single request.
2321
+ :type _host_index: int, optional
2322
+ :return: Returns the result object.
2323
+ """ # noqa: E501
2324
+
2325
+ _param = self._sync_firewall_v1_serialize(
2326
+ firewall_id=firewall_id,
2327
+ virtual_machine_id=virtual_machine_id,
2328
+ _request_auth=_request_auth,
2329
+ _content_type=_content_type,
2330
+ _headers=_headers,
2331
+ _host_index=_host_index
2332
+ )
2333
+
2334
+ _response_types_map: Dict[str, Optional[str]] = {
2335
+ '200': "VPSV1ActionActionResource",
2336
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2337
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2338
+ '500': "CommonSchemaErrorResponseSchema",
2339
+ }
2340
+ response_data = self.api_client.call_api(
2341
+ *_param,
2342
+ _request_timeout=_request_timeout
2343
+ )
2344
+ response_data.read()
2345
+ return self.api_client.response_deserialize(
2346
+ response_data=response_data,
2347
+ response_types_map=_response_types_map,
2348
+ ).data
2349
+
2350
+
2351
+ @validate_call
2352
+ def sync_firewall_v1_with_http_info(
2353
+ self,
2354
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
2355
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2356
+ _request_timeout: Union[
2357
+ None,
2358
+ Annotated[StrictFloat, Field(gt=0)],
2359
+ Tuple[
2360
+ Annotated[StrictFloat, Field(gt=0)],
2361
+ Annotated[StrictFloat, Field(gt=0)]
2362
+ ]
2363
+ ] = None,
2364
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2365
+ _content_type: Optional[StrictStr] = None,
2366
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2367
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2368
+ ) -> ApiResponse[VPSV1ActionActionResource]:
2369
+ """Sync firewall
2370
+
2371
+ This endpoint syncs a firewall for a specified virtual machine. Firewall can loose sync with virtual machine if the firewall has new rules added, removed or updated.
2372
+
2373
+ :param firewall_id: Firewall ID (required)
2374
+ :type firewall_id: int
2375
+ :param virtual_machine_id: Virtual Machine ID (required)
2376
+ :type virtual_machine_id: int
2377
+ :param _request_timeout: timeout setting for this request. If one
2378
+ number provided, it will be total request
2379
+ timeout. It can also be a pair (tuple) of
2380
+ (connection, read) timeouts.
2381
+ :type _request_timeout: int, tuple(int, int), optional
2382
+ :param _request_auth: set to override the auth_settings for an a single
2383
+ request; this effectively ignores the
2384
+ authentication in the spec for a single request.
2385
+ :type _request_auth: dict, optional
2386
+ :param _content_type: force content-type for the request.
2387
+ :type _content_type: str, Optional
2388
+ :param _headers: set to override the headers for a single
2389
+ request; this effectively ignores the headers
2390
+ in the spec for a single request.
2391
+ :type _headers: dict, optional
2392
+ :param _host_index: set to override the host_index for a single
2393
+ request; this effectively ignores the host_index
2394
+ in the spec for a single request.
2395
+ :type _host_index: int, optional
2396
+ :return: Returns the result object.
2397
+ """ # noqa: E501
2398
+
2399
+ _param = self._sync_firewall_v1_serialize(
2400
+ firewall_id=firewall_id,
2401
+ virtual_machine_id=virtual_machine_id,
2402
+ _request_auth=_request_auth,
2403
+ _content_type=_content_type,
2404
+ _headers=_headers,
2405
+ _host_index=_host_index
2406
+ )
2407
+
2408
+ _response_types_map: Dict[str, Optional[str]] = {
2409
+ '200': "VPSV1ActionActionResource",
2410
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2411
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2412
+ '500': "CommonSchemaErrorResponseSchema",
2413
+ }
2414
+ response_data = self.api_client.call_api(
2415
+ *_param,
2416
+ _request_timeout=_request_timeout
2417
+ )
2418
+ response_data.read()
2419
+ return self.api_client.response_deserialize(
2420
+ response_data=response_data,
2421
+ response_types_map=_response_types_map,
2422
+ )
2423
+
2424
+
2425
+ @validate_call
2426
+ def sync_firewall_v1_without_preload_content(
2427
+ self,
2428
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
2429
+ virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
2430
+ _request_timeout: Union[
2431
+ None,
2432
+ Annotated[StrictFloat, Field(gt=0)],
2433
+ Tuple[
2434
+ Annotated[StrictFloat, Field(gt=0)],
2435
+ Annotated[StrictFloat, Field(gt=0)]
2436
+ ]
2437
+ ] = None,
2438
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2439
+ _content_type: Optional[StrictStr] = None,
2440
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2441
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2442
+ ) -> RESTResponseType:
2443
+ """Sync firewall
2444
+
2445
+ This endpoint syncs a firewall for a specified virtual machine. Firewall can loose sync with virtual machine if the firewall has new rules added, removed or updated.
2446
+
2447
+ :param firewall_id: Firewall ID (required)
2448
+ :type firewall_id: int
2449
+ :param virtual_machine_id: Virtual Machine ID (required)
2450
+ :type virtual_machine_id: int
2451
+ :param _request_timeout: timeout setting for this request. If one
2452
+ number provided, it will be total request
2453
+ timeout. It can also be a pair (tuple) of
2454
+ (connection, read) timeouts.
2455
+ :type _request_timeout: int, tuple(int, int), optional
2456
+ :param _request_auth: set to override the auth_settings for an a single
2457
+ request; this effectively ignores the
2458
+ authentication in the spec for a single request.
2459
+ :type _request_auth: dict, optional
2460
+ :param _content_type: force content-type for the request.
2461
+ :type _content_type: str, Optional
2462
+ :param _headers: set to override the headers for a single
2463
+ request; this effectively ignores the headers
2464
+ in the spec for a single request.
2465
+ :type _headers: dict, optional
2466
+ :param _host_index: set to override the host_index for a single
2467
+ request; this effectively ignores the host_index
2468
+ in the spec for a single request.
2469
+ :type _host_index: int, optional
2470
+ :return: Returns the result object.
2471
+ """ # noqa: E501
2472
+
2473
+ _param = self._sync_firewall_v1_serialize(
2474
+ firewall_id=firewall_id,
2475
+ virtual_machine_id=virtual_machine_id,
2476
+ _request_auth=_request_auth,
2477
+ _content_type=_content_type,
2478
+ _headers=_headers,
2479
+ _host_index=_host_index
2480
+ )
2481
+
2482
+ _response_types_map: Dict[str, Optional[str]] = {
2483
+ '200': "VPSV1ActionActionResource",
2484
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2485
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2486
+ '500': "CommonSchemaErrorResponseSchema",
2487
+ }
2488
+ response_data = self.api_client.call_api(
2489
+ *_param,
2490
+ _request_timeout=_request_timeout
2491
+ )
2492
+ return response_data.response
2493
+
2494
+
2495
+ def _sync_firewall_v1_serialize(
2496
+ self,
2497
+ firewall_id,
2498
+ virtual_machine_id,
2499
+ _request_auth,
2500
+ _content_type,
2501
+ _headers,
2502
+ _host_index,
2503
+ ) -> RequestSerialized:
2504
+
2505
+ _host = None
2506
+
2507
+ _collection_formats: Dict[str, str] = {
2508
+ }
2509
+
2510
+ _path_params: Dict[str, str] = {}
2511
+ _query_params: List[Tuple[str, str]] = []
2512
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2513
+ _form_params: List[Tuple[str, str]] = []
2514
+ _files: Dict[
2515
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2516
+ ] = {}
2517
+ _body_params: Optional[bytes] = None
2518
+
2519
+ # process the path parameters
2520
+ if firewall_id is not None:
2521
+ _path_params['firewallId'] = firewall_id
2522
+ if virtual_machine_id is not None:
2523
+ _path_params['virtualMachineId'] = virtual_machine_id
2524
+ # process the query parameters
2525
+ # process the header parameters
2526
+ # process the form parameters
2527
+ # process the body parameter
2528
+
2529
+
2530
+ # set the HTTP header `Accept`
2531
+ if 'Accept' not in _header_params:
2532
+ _header_params['Accept'] = self.api_client.select_header_accept(
2533
+ [
2534
+ 'application/json'
2535
+ ]
2536
+ )
2537
+
2538
+
2539
+ # authentication setting
2540
+ _auth_settings: List[str] = [
2541
+ 'apiToken'
2542
+ ]
2543
+
2544
+ return self.api_client.param_serialize(
2545
+ method='POST',
2546
+ resource_path='/api/vps/v1/firewall/{firewallId}/sync/{virtualMachineId}',
2547
+ path_params=_path_params,
2548
+ query_params=_query_params,
2549
+ header_params=_header_params,
2550
+ body=_body_params,
2551
+ post_params=_form_params,
2552
+ files=_files,
2553
+ auth_settings=_auth_settings,
2554
+ collection_formats=_collection_formats,
2555
+ _host=_host,
2556
+ _request_auth=_request_auth
2557
+ )
2558
+
2559
+
2560
+
2561
+
2562
+ @validate_call
2563
+ def update_firewall_rule_v1(
2564
+ self,
2565
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
2566
+ rule_id: Annotated[StrictInt, Field(description="Firewall Rule ID")],
2567
+ vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest,
2568
+ _request_timeout: Union[
2569
+ None,
2570
+ Annotated[StrictFloat, Field(gt=0)],
2571
+ Tuple[
2572
+ Annotated[StrictFloat, Field(gt=0)],
2573
+ Annotated[StrictFloat, Field(gt=0)]
2574
+ ]
2575
+ ] = None,
2576
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2577
+ _content_type: Optional[StrictStr] = None,
2578
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2579
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2580
+ ) -> VPSV1FirewallFirewallRuleResource:
2581
+ """Update firewall rule
2582
+
2583
+ This endpoint updates a specific firewall rule from a specified firewall. Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
2584
+
2585
+ :param firewall_id: Firewall ID (required)
2586
+ :type firewall_id: int
2587
+ :param rule_id: Firewall Rule ID (required)
2588
+ :type rule_id: int
2589
+ :param vpsv1_firewall_rules_store_request: (required)
2590
+ :type vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest
2591
+ :param _request_timeout: timeout setting for this request. If one
2592
+ number provided, it will be total request
2593
+ timeout. It can also be a pair (tuple) of
2594
+ (connection, read) timeouts.
2595
+ :type _request_timeout: int, tuple(int, int), optional
2596
+ :param _request_auth: set to override the auth_settings for an a single
2597
+ request; this effectively ignores the
2598
+ authentication in the spec for a single request.
2599
+ :type _request_auth: dict, optional
2600
+ :param _content_type: force content-type for the request.
2601
+ :type _content_type: str, Optional
2602
+ :param _headers: set to override the headers for a single
2603
+ request; this effectively ignores the headers
2604
+ in the spec for a single request.
2605
+ :type _headers: dict, optional
2606
+ :param _host_index: set to override the host_index for a single
2607
+ request; this effectively ignores the host_index
2608
+ in the spec for a single request.
2609
+ :type _host_index: int, optional
2610
+ :return: Returns the result object.
2611
+ """ # noqa: E501
2612
+
2613
+ _param = self._update_firewall_rule_v1_serialize(
2614
+ firewall_id=firewall_id,
2615
+ rule_id=rule_id,
2616
+ vpsv1_firewall_rules_store_request=vpsv1_firewall_rules_store_request,
2617
+ _request_auth=_request_auth,
2618
+ _content_type=_content_type,
2619
+ _headers=_headers,
2620
+ _host_index=_host_index
2621
+ )
2622
+
2623
+ _response_types_map: Dict[str, Optional[str]] = {
2624
+ '200': "VPSV1FirewallFirewallRuleResource",
2625
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2626
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2627
+ '500': "CommonSchemaErrorResponseSchema",
2628
+ }
2629
+ response_data = self.api_client.call_api(
2630
+ *_param,
2631
+ _request_timeout=_request_timeout
2632
+ )
2633
+ response_data.read()
2634
+ return self.api_client.response_deserialize(
2635
+ response_data=response_data,
2636
+ response_types_map=_response_types_map,
2637
+ ).data
2638
+
2639
+
2640
+ @validate_call
2641
+ def update_firewall_rule_v1_with_http_info(
2642
+ self,
2643
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
2644
+ rule_id: Annotated[StrictInt, Field(description="Firewall Rule ID")],
2645
+ vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest,
2646
+ _request_timeout: Union[
2647
+ None,
2648
+ Annotated[StrictFloat, Field(gt=0)],
2649
+ Tuple[
2650
+ Annotated[StrictFloat, Field(gt=0)],
2651
+ Annotated[StrictFloat, Field(gt=0)]
2652
+ ]
2653
+ ] = None,
2654
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2655
+ _content_type: Optional[StrictStr] = None,
2656
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2657
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2658
+ ) -> ApiResponse[VPSV1FirewallFirewallRuleResource]:
2659
+ """Update firewall rule
2660
+
2661
+ This endpoint updates a specific firewall rule from a specified firewall. Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
2662
+
2663
+ :param firewall_id: Firewall ID (required)
2664
+ :type firewall_id: int
2665
+ :param rule_id: Firewall Rule ID (required)
2666
+ :type rule_id: int
2667
+ :param vpsv1_firewall_rules_store_request: (required)
2668
+ :type vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest
2669
+ :param _request_timeout: timeout setting for this request. If one
2670
+ number provided, it will be total request
2671
+ timeout. It can also be a pair (tuple) of
2672
+ (connection, read) timeouts.
2673
+ :type _request_timeout: int, tuple(int, int), optional
2674
+ :param _request_auth: set to override the auth_settings for an a single
2675
+ request; this effectively ignores the
2676
+ authentication in the spec for a single request.
2677
+ :type _request_auth: dict, optional
2678
+ :param _content_type: force content-type for the request.
2679
+ :type _content_type: str, Optional
2680
+ :param _headers: set to override the headers for a single
2681
+ request; this effectively ignores the headers
2682
+ in the spec for a single request.
2683
+ :type _headers: dict, optional
2684
+ :param _host_index: set to override the host_index for a single
2685
+ request; this effectively ignores the host_index
2686
+ in the spec for a single request.
2687
+ :type _host_index: int, optional
2688
+ :return: Returns the result object.
2689
+ """ # noqa: E501
2690
+
2691
+ _param = self._update_firewall_rule_v1_serialize(
2692
+ firewall_id=firewall_id,
2693
+ rule_id=rule_id,
2694
+ vpsv1_firewall_rules_store_request=vpsv1_firewall_rules_store_request,
2695
+ _request_auth=_request_auth,
2696
+ _content_type=_content_type,
2697
+ _headers=_headers,
2698
+ _host_index=_host_index
2699
+ )
2700
+
2701
+ _response_types_map: Dict[str, Optional[str]] = {
2702
+ '200': "VPSV1FirewallFirewallRuleResource",
2703
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2704
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2705
+ '500': "CommonSchemaErrorResponseSchema",
2706
+ }
2707
+ response_data = self.api_client.call_api(
2708
+ *_param,
2709
+ _request_timeout=_request_timeout
2710
+ )
2711
+ response_data.read()
2712
+ return self.api_client.response_deserialize(
2713
+ response_data=response_data,
2714
+ response_types_map=_response_types_map,
2715
+ )
2716
+
2717
+
2718
+ @validate_call
2719
+ def update_firewall_rule_v1_without_preload_content(
2720
+ self,
2721
+ firewall_id: Annotated[StrictInt, Field(description="Firewall ID")],
2722
+ rule_id: Annotated[StrictInt, Field(description="Firewall Rule ID")],
2723
+ vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest,
2724
+ _request_timeout: Union[
2725
+ None,
2726
+ Annotated[StrictFloat, Field(gt=0)],
2727
+ Tuple[
2728
+ Annotated[StrictFloat, Field(gt=0)],
2729
+ Annotated[StrictFloat, Field(gt=0)]
2730
+ ]
2731
+ ] = None,
2732
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2733
+ _content_type: Optional[StrictStr] = None,
2734
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2735
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2736
+ ) -> RESTResponseType:
2737
+ """Update firewall rule
2738
+
2739
+ This endpoint updates a specific firewall rule from a specified firewall. Any virtual machine that has this firewall activated will loose sync with the firewall and will have to be synced again manually.
2740
+
2741
+ :param firewall_id: Firewall ID (required)
2742
+ :type firewall_id: int
2743
+ :param rule_id: Firewall Rule ID (required)
2744
+ :type rule_id: int
2745
+ :param vpsv1_firewall_rules_store_request: (required)
2746
+ :type vpsv1_firewall_rules_store_request: VPSV1FirewallRulesStoreRequest
2747
+ :param _request_timeout: timeout setting for this request. If one
2748
+ number provided, it will be total request
2749
+ timeout. It can also be a pair (tuple) of
2750
+ (connection, read) timeouts.
2751
+ :type _request_timeout: int, tuple(int, int), optional
2752
+ :param _request_auth: set to override the auth_settings for an a single
2753
+ request; this effectively ignores the
2754
+ authentication in the spec for a single request.
2755
+ :type _request_auth: dict, optional
2756
+ :param _content_type: force content-type for the request.
2757
+ :type _content_type: str, Optional
2758
+ :param _headers: set to override the headers for a single
2759
+ request; this effectively ignores the headers
2760
+ in the spec for a single request.
2761
+ :type _headers: dict, optional
2762
+ :param _host_index: set to override the host_index for a single
2763
+ request; this effectively ignores the host_index
2764
+ in the spec for a single request.
2765
+ :type _host_index: int, optional
2766
+ :return: Returns the result object.
2767
+ """ # noqa: E501
2768
+
2769
+ _param = self._update_firewall_rule_v1_serialize(
2770
+ firewall_id=firewall_id,
2771
+ rule_id=rule_id,
2772
+ vpsv1_firewall_rules_store_request=vpsv1_firewall_rules_store_request,
2773
+ _request_auth=_request_auth,
2774
+ _content_type=_content_type,
2775
+ _headers=_headers,
2776
+ _host_index=_host_index
2777
+ )
2778
+
2779
+ _response_types_map: Dict[str, Optional[str]] = {
2780
+ '200': "VPSV1FirewallFirewallRuleResource",
2781
+ '422': "CommonSchemaUnprocessableContentResponseSchema",
2782
+ '401': "CommonSchemaUnauthorizedResponseSchema",
2783
+ '500': "CommonSchemaErrorResponseSchema",
2784
+ }
2785
+ response_data = self.api_client.call_api(
2786
+ *_param,
2787
+ _request_timeout=_request_timeout
2788
+ )
2789
+ return response_data.response
2790
+
2791
+
2792
+ def _update_firewall_rule_v1_serialize(
2793
+ self,
2794
+ firewall_id,
2795
+ rule_id,
2796
+ vpsv1_firewall_rules_store_request,
2797
+ _request_auth,
2798
+ _content_type,
2799
+ _headers,
2800
+ _host_index,
2801
+ ) -> RequestSerialized:
2802
+
2803
+ _host = None
2804
+
2805
+ _collection_formats: Dict[str, str] = {
2806
+ }
2807
+
2808
+ _path_params: Dict[str, str] = {}
2809
+ _query_params: List[Tuple[str, str]] = []
2810
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2811
+ _form_params: List[Tuple[str, str]] = []
2812
+ _files: Dict[
2813
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2814
+ ] = {}
2815
+ _body_params: Optional[bytes] = None
2816
+
2817
+ # process the path parameters
2818
+ if firewall_id is not None:
2819
+ _path_params['firewallId'] = firewall_id
2820
+ if rule_id is not None:
2821
+ _path_params['ruleId'] = rule_id
2822
+ # process the query parameters
2823
+ # process the header parameters
2824
+ # process the form parameters
2825
+ # process the body parameter
2826
+ if vpsv1_firewall_rules_store_request is not None:
2827
+ _body_params = vpsv1_firewall_rules_store_request
2828
+
2829
+
2830
+ # set the HTTP header `Accept`
2831
+ if 'Accept' not in _header_params:
2832
+ _header_params['Accept'] = self.api_client.select_header_accept(
2833
+ [
2834
+ 'application/json'
2835
+ ]
2836
+ )
2837
+
2838
+ # set the HTTP header `Content-Type`
2839
+ if _content_type:
2840
+ _header_params['Content-Type'] = _content_type
2841
+ else:
2842
+ _default_content_type = (
2843
+ self.api_client.select_header_content_type(
2844
+ [
2845
+ 'application/json'
2846
+ ]
2847
+ )
2848
+ )
2849
+ if _default_content_type is not None:
2850
+ _header_params['Content-Type'] = _default_content_type
2851
+
2852
+ # authentication setting
2853
+ _auth_settings: List[str] = [
2854
+ 'apiToken'
2855
+ ]
2856
+
2857
+ return self.api_client.param_serialize(
2858
+ method='PUT',
2859
+ resource_path='/api/vps/v1/firewall/{firewallId}/rules/{ruleId}',
2860
+ path_params=_path_params,
2861
+ query_params=_query_params,
2862
+ header_params=_header_params,
2863
+ body=_body_params,
2864
+ post_params=_form_params,
2865
+ files=_files,
2866
+ auth_settings=_auth_settings,
2867
+ collection_formats=_collection_formats,
2868
+ _host=_host,
2869
+ _request_auth=_request_auth
2870
+ )
2871
+
2872
+