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.
- hostinger_api/__init__.py +105 -0
- hostinger_api/api/__init__.py +21 -0
- hostinger_api/api/billing_catalog_api.py +282 -0
- hostinger_api/api/billing_orders_api.py +313 -0
- hostinger_api/api/billing_payment_methods_api.py +819 -0
- hostinger_api/api/billing_subscriptions_api.py +584 -0
- hostinger_api/api/domains_portfolio_api.py +282 -0
- hostinger_api/api/vps_actions_api.py +599 -0
- hostinger_api/api/vps_backups_api.py +882 -0
- hostinger_api/api/vps_data_centers_api.py +282 -0
- hostinger_api/api/vps_firewall_api.py +2872 -0
- hostinger_api/api/vps_malware_scanner_api.py +842 -0
- hostinger_api/api/vps_post_install_scripts_api.py +1419 -0
- hostinger_api/api/vps_public_keys_api.py +1154 -0
- hostinger_api/api/vps_recovery_api.py +597 -0
- hostinger_api/api/vps_snapshots_api.py +1100 -0
- hostinger_api/api/vps_virtual_machine_api.py +3714 -0
- hostinger_api/api/vpsos_templates_api.py +551 -0
- hostinger_api/api/vpsptr_records_api.py +565 -0
- hostinger_api/api_client.py +795 -0
- hostinger_api/api_response.py +21 -0
- hostinger_api/configuration.py +579 -0
- hostinger_api/exceptions.py +214 -0
- hostinger_api/models/__init__.py +72 -0
- hostinger_api/models/billing_v1_catalog_catalog_item_price_resource.py +107 -0
- hostinger_api/models/billing_v1_catalog_catalog_item_resource.py +99 -0
- hostinger_api/models/billing_v1_order_order_billing_address_resource.py +145 -0
- hostinger_api/models/billing_v1_order_order_resource.py +116 -0
- hostinger_api/models/billing_v1_order_store_request.py +97 -0
- hostinger_api/models/billing_v1_order_store_request_items_inner.py +87 -0
- hostinger_api/models/billing_v1_payment_method_payment_method_resource.py +102 -0
- hostinger_api/models/billing_v1_subscription_cancel_request.py +117 -0
- hostinger_api/models/billing_v1_subscription_subscription_resource.py +130 -0
- hostinger_api/models/common_schema_error_response_schema.py +87 -0
- hostinger_api/models/common_schema_pagination_meta_schema.py +89 -0
- hostinger_api/models/common_schema_unauthorized_response_schema.py +87 -0
- hostinger_api/models/common_schema_unprocessable_content_response_schema.py +93 -0
- hostinger_api/models/common_schema_unprocessable_content_response_schema_errors.py +87 -0
- hostinger_api/models/common_success_empty_resource.py +85 -0
- hostinger_api/models/domains_v1_domain_domain_resource.py +126 -0
- hostinger_api/models/vps_get_action_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_backup_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_firewall_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_post_install_script_list_v1200_response.py +99 -0
- hostinger_api/models/vps_get_public_key_list_v1200_response.py +99 -0
- hostinger_api/models/vpsv1_action_action_resource.py +104 -0
- hostinger_api/models/vpsv1_backup_backup_resource.py +90 -0
- hostinger_api/models/vpsv1_data_center_data_center_resource.py +113 -0
- hostinger_api/models/vpsv1_firewall_firewall_resource.py +104 -0
- hostinger_api/models/vpsv1_firewall_firewall_rule_resource.py +115 -0
- hostinger_api/models/vpsv1_firewall_rules_store_request.py +105 -0
- hostinger_api/models/vpsv1_firewall_store_request.py +85 -0
- hostinger_api/models/vpsv1_ip_address_ip_address_resource.py +94 -0
- hostinger_api/models/vpsv1_malware_metrics_resource.py +101 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection.py +149 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_cpu_usage.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_disk_space.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_incoming_traffic.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_outgoing_traffic.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_ram_usage.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_collection_uptime.py +127 -0
- hostinger_api/models/vpsv1_metrics_metrics_resource.py +87 -0
- hostinger_api/models/vpsv1_post_install_script_post_install_script_resource.py +94 -0
- hostinger_api/models/vpsv1_post_install_script_store_request.py +87 -0
- hostinger_api/models/vpsv1_public_key_attach_request.py +85 -0
- hostinger_api/models/vpsv1_public_key_public_key_resource.py +89 -0
- hostinger_api/models/vpsv1_public_key_store_request.py +87 -0
- hostinger_api/models/vpsv1_snapshot_snapshot_resource.py +90 -0
- hostinger_api/models/vpsv1_template_template_resource.py +96 -0
- hostinger_api/models/vpsv1_virtual_machine_hostname_update_request.py +85 -0
- hostinger_api/models/vpsv1_virtual_machine_metric_get_request.py +88 -0
- hostinger_api/models/vpsv1_virtual_machine_nameservers_update_request.py +87 -0
- hostinger_api/models/vpsv1_virtual_machine_panel_password_update_request.py +86 -0
- hostinger_api/models/vpsv1_virtual_machine_recovery_start_request.py +85 -0
- hostinger_api/models/vpsv1_virtual_machine_recreate_request.py +90 -0
- hostinger_api/models/vpsv1_virtual_machine_root_password_update_request.py +86 -0
- hostinger_api/models/vpsv1_virtual_machine_setup_request.py +108 -0
- hostinger_api/models/vpsv1_virtual_machine_setup_request_public_key.py +87 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource.py +190 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_ipv4.py +131 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_ipv6.py +131 -0
- hostinger_api/models/vpsv1_virtual_machine_virtual_machine_resource_template.py +127 -0
- hostinger_api/py.typed +0 -0
- hostinger_api/rest.py +256 -0
- hostinger_api-1.0.0.dist-info/METADATA +26 -0
- hostinger_api-1.0.0.dist-info/RECORD +88 -0
- hostinger_api-1.0.0.dist-info/WHEEL +5 -0
- hostinger_api-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1154 @@
|
|
|
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_public_key_list_v1200_response import VPSGetPublicKeyListV1200Response
|
|
22
|
+
from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource
|
|
23
|
+
from hostinger_api.models.vpsv1_public_key_attach_request import VPSV1PublicKeyAttachRequest
|
|
24
|
+
from hostinger_api.models.vpsv1_public_key_public_key_resource import VPSV1PublicKeyPublicKeyResource
|
|
25
|
+
from hostinger_api.models.vpsv1_public_key_store_request import VPSV1PublicKeyStoreRequest
|
|
26
|
+
|
|
27
|
+
from hostinger_api.api_client import ApiClient, RequestSerialized
|
|
28
|
+
from hostinger_api.api_response import ApiResponse
|
|
29
|
+
from hostinger_api.rest import RESTResponseType
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class VPSPublicKeysApi:
|
|
33
|
+
|
|
34
|
+
def __init__(self, api_client=None) -> None:
|
|
35
|
+
if api_client is None:
|
|
36
|
+
api_client = ApiClient.get_default()
|
|
37
|
+
self.api_client = api_client
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@validate_call
|
|
41
|
+
def attach_public_key_v1(
|
|
42
|
+
self,
|
|
43
|
+
virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
|
|
44
|
+
vpsv1_public_key_attach_request: VPSV1PublicKeyAttachRequest,
|
|
45
|
+
_request_timeout: Union[
|
|
46
|
+
None,
|
|
47
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
48
|
+
Tuple[
|
|
49
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
50
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
51
|
+
]
|
|
52
|
+
] = None,
|
|
53
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
54
|
+
_content_type: Optional[StrictStr] = None,
|
|
55
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
56
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
57
|
+
) -> VPSV1ActionActionResource:
|
|
58
|
+
"""Attach public key
|
|
59
|
+
|
|
60
|
+
This endpoint attaches an existing public keys from your account to a specified virtual machine. Multiple keys can be attached to a single virtual machine.
|
|
61
|
+
|
|
62
|
+
:param virtual_machine_id: Virtual Machine ID (required)
|
|
63
|
+
:type virtual_machine_id: int
|
|
64
|
+
:param vpsv1_public_key_attach_request: (required)
|
|
65
|
+
:type vpsv1_public_key_attach_request: VPSV1PublicKeyAttachRequest
|
|
66
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
67
|
+
number provided, it will be total request
|
|
68
|
+
timeout. It can also be a pair (tuple) of
|
|
69
|
+
(connection, read) timeouts.
|
|
70
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
71
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
72
|
+
request; this effectively ignores the
|
|
73
|
+
authentication in the spec for a single request.
|
|
74
|
+
:type _request_auth: dict, optional
|
|
75
|
+
:param _content_type: force content-type for the request.
|
|
76
|
+
:type _content_type: str, Optional
|
|
77
|
+
:param _headers: set to override the headers for a single
|
|
78
|
+
request; this effectively ignores the headers
|
|
79
|
+
in the spec for a single request.
|
|
80
|
+
:type _headers: dict, optional
|
|
81
|
+
:param _host_index: set to override the host_index for a single
|
|
82
|
+
request; this effectively ignores the host_index
|
|
83
|
+
in the spec for a single request.
|
|
84
|
+
:type _host_index: int, optional
|
|
85
|
+
:return: Returns the result object.
|
|
86
|
+
""" # noqa: E501
|
|
87
|
+
|
|
88
|
+
_param = self._attach_public_key_v1_serialize(
|
|
89
|
+
virtual_machine_id=virtual_machine_id,
|
|
90
|
+
vpsv1_public_key_attach_request=vpsv1_public_key_attach_request,
|
|
91
|
+
_request_auth=_request_auth,
|
|
92
|
+
_content_type=_content_type,
|
|
93
|
+
_headers=_headers,
|
|
94
|
+
_host_index=_host_index
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
98
|
+
'200': "VPSV1ActionActionResource",
|
|
99
|
+
'422': "CommonSchemaUnprocessableContentResponseSchema",
|
|
100
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
101
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
102
|
+
}
|
|
103
|
+
response_data = self.api_client.call_api(
|
|
104
|
+
*_param,
|
|
105
|
+
_request_timeout=_request_timeout
|
|
106
|
+
)
|
|
107
|
+
response_data.read()
|
|
108
|
+
return self.api_client.response_deserialize(
|
|
109
|
+
response_data=response_data,
|
|
110
|
+
response_types_map=_response_types_map,
|
|
111
|
+
).data
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@validate_call
|
|
115
|
+
def attach_public_key_v1_with_http_info(
|
|
116
|
+
self,
|
|
117
|
+
virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
|
|
118
|
+
vpsv1_public_key_attach_request: VPSV1PublicKeyAttachRequest,
|
|
119
|
+
_request_timeout: Union[
|
|
120
|
+
None,
|
|
121
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
122
|
+
Tuple[
|
|
123
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
124
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
125
|
+
]
|
|
126
|
+
] = None,
|
|
127
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
128
|
+
_content_type: Optional[StrictStr] = None,
|
|
129
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
130
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
131
|
+
) -> ApiResponse[VPSV1ActionActionResource]:
|
|
132
|
+
"""Attach public key
|
|
133
|
+
|
|
134
|
+
This endpoint attaches an existing public keys from your account to a specified virtual machine. Multiple keys can be attached to a single virtual machine.
|
|
135
|
+
|
|
136
|
+
:param virtual_machine_id: Virtual Machine ID (required)
|
|
137
|
+
:type virtual_machine_id: int
|
|
138
|
+
:param vpsv1_public_key_attach_request: (required)
|
|
139
|
+
:type vpsv1_public_key_attach_request: VPSV1PublicKeyAttachRequest
|
|
140
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
141
|
+
number provided, it will be total request
|
|
142
|
+
timeout. It can also be a pair (tuple) of
|
|
143
|
+
(connection, read) timeouts.
|
|
144
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
145
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
146
|
+
request; this effectively ignores the
|
|
147
|
+
authentication in the spec for a single request.
|
|
148
|
+
:type _request_auth: dict, optional
|
|
149
|
+
:param _content_type: force content-type for the request.
|
|
150
|
+
:type _content_type: str, Optional
|
|
151
|
+
:param _headers: set to override the headers for a single
|
|
152
|
+
request; this effectively ignores the headers
|
|
153
|
+
in the spec for a single request.
|
|
154
|
+
:type _headers: dict, optional
|
|
155
|
+
:param _host_index: set to override the host_index for a single
|
|
156
|
+
request; this effectively ignores the host_index
|
|
157
|
+
in the spec for a single request.
|
|
158
|
+
:type _host_index: int, optional
|
|
159
|
+
:return: Returns the result object.
|
|
160
|
+
""" # noqa: E501
|
|
161
|
+
|
|
162
|
+
_param = self._attach_public_key_v1_serialize(
|
|
163
|
+
virtual_machine_id=virtual_machine_id,
|
|
164
|
+
vpsv1_public_key_attach_request=vpsv1_public_key_attach_request,
|
|
165
|
+
_request_auth=_request_auth,
|
|
166
|
+
_content_type=_content_type,
|
|
167
|
+
_headers=_headers,
|
|
168
|
+
_host_index=_host_index
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
172
|
+
'200': "VPSV1ActionActionResource",
|
|
173
|
+
'422': "CommonSchemaUnprocessableContentResponseSchema",
|
|
174
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
175
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
176
|
+
}
|
|
177
|
+
response_data = self.api_client.call_api(
|
|
178
|
+
*_param,
|
|
179
|
+
_request_timeout=_request_timeout
|
|
180
|
+
)
|
|
181
|
+
response_data.read()
|
|
182
|
+
return self.api_client.response_deserialize(
|
|
183
|
+
response_data=response_data,
|
|
184
|
+
response_types_map=_response_types_map,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
@validate_call
|
|
189
|
+
def attach_public_key_v1_without_preload_content(
|
|
190
|
+
self,
|
|
191
|
+
virtual_machine_id: Annotated[StrictInt, Field(description="Virtual Machine ID")],
|
|
192
|
+
vpsv1_public_key_attach_request: VPSV1PublicKeyAttachRequest,
|
|
193
|
+
_request_timeout: Union[
|
|
194
|
+
None,
|
|
195
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
196
|
+
Tuple[
|
|
197
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
198
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
199
|
+
]
|
|
200
|
+
] = None,
|
|
201
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
202
|
+
_content_type: Optional[StrictStr] = None,
|
|
203
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
204
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
205
|
+
) -> RESTResponseType:
|
|
206
|
+
"""Attach public key
|
|
207
|
+
|
|
208
|
+
This endpoint attaches an existing public keys from your account to a specified virtual machine. Multiple keys can be attached to a single virtual machine.
|
|
209
|
+
|
|
210
|
+
:param virtual_machine_id: Virtual Machine ID (required)
|
|
211
|
+
:type virtual_machine_id: int
|
|
212
|
+
:param vpsv1_public_key_attach_request: (required)
|
|
213
|
+
:type vpsv1_public_key_attach_request: VPSV1PublicKeyAttachRequest
|
|
214
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
215
|
+
number provided, it will be total request
|
|
216
|
+
timeout. It can also be a pair (tuple) of
|
|
217
|
+
(connection, read) timeouts.
|
|
218
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
219
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
220
|
+
request; this effectively ignores the
|
|
221
|
+
authentication in the spec for a single request.
|
|
222
|
+
:type _request_auth: dict, optional
|
|
223
|
+
:param _content_type: force content-type for the request.
|
|
224
|
+
:type _content_type: str, Optional
|
|
225
|
+
:param _headers: set to override the headers for a single
|
|
226
|
+
request; this effectively ignores the headers
|
|
227
|
+
in the spec for a single request.
|
|
228
|
+
:type _headers: dict, optional
|
|
229
|
+
:param _host_index: set to override the host_index for a single
|
|
230
|
+
request; this effectively ignores the host_index
|
|
231
|
+
in the spec for a single request.
|
|
232
|
+
:type _host_index: int, optional
|
|
233
|
+
:return: Returns the result object.
|
|
234
|
+
""" # noqa: E501
|
|
235
|
+
|
|
236
|
+
_param = self._attach_public_key_v1_serialize(
|
|
237
|
+
virtual_machine_id=virtual_machine_id,
|
|
238
|
+
vpsv1_public_key_attach_request=vpsv1_public_key_attach_request,
|
|
239
|
+
_request_auth=_request_auth,
|
|
240
|
+
_content_type=_content_type,
|
|
241
|
+
_headers=_headers,
|
|
242
|
+
_host_index=_host_index
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
246
|
+
'200': "VPSV1ActionActionResource",
|
|
247
|
+
'422': "CommonSchemaUnprocessableContentResponseSchema",
|
|
248
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
249
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
250
|
+
}
|
|
251
|
+
response_data = self.api_client.call_api(
|
|
252
|
+
*_param,
|
|
253
|
+
_request_timeout=_request_timeout
|
|
254
|
+
)
|
|
255
|
+
return response_data.response
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def _attach_public_key_v1_serialize(
|
|
259
|
+
self,
|
|
260
|
+
virtual_machine_id,
|
|
261
|
+
vpsv1_public_key_attach_request,
|
|
262
|
+
_request_auth,
|
|
263
|
+
_content_type,
|
|
264
|
+
_headers,
|
|
265
|
+
_host_index,
|
|
266
|
+
) -> RequestSerialized:
|
|
267
|
+
|
|
268
|
+
_host = None
|
|
269
|
+
|
|
270
|
+
_collection_formats: Dict[str, str] = {
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
_path_params: Dict[str, str] = {}
|
|
274
|
+
_query_params: List[Tuple[str, str]] = []
|
|
275
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
276
|
+
_form_params: List[Tuple[str, str]] = []
|
|
277
|
+
_files: Dict[
|
|
278
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
279
|
+
] = {}
|
|
280
|
+
_body_params: Optional[bytes] = None
|
|
281
|
+
|
|
282
|
+
# process the path parameters
|
|
283
|
+
if virtual_machine_id is not None:
|
|
284
|
+
_path_params['virtualMachineId'] = virtual_machine_id
|
|
285
|
+
# process the query parameters
|
|
286
|
+
# process the header parameters
|
|
287
|
+
# process the form parameters
|
|
288
|
+
# process the body parameter
|
|
289
|
+
if vpsv1_public_key_attach_request is not None:
|
|
290
|
+
_body_params = vpsv1_public_key_attach_request
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
# set the HTTP header `Accept`
|
|
294
|
+
if 'Accept' not in _header_params:
|
|
295
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
296
|
+
[
|
|
297
|
+
'application/json'
|
|
298
|
+
]
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
# set the HTTP header `Content-Type`
|
|
302
|
+
if _content_type:
|
|
303
|
+
_header_params['Content-Type'] = _content_type
|
|
304
|
+
else:
|
|
305
|
+
_default_content_type = (
|
|
306
|
+
self.api_client.select_header_content_type(
|
|
307
|
+
[
|
|
308
|
+
'application/json'
|
|
309
|
+
]
|
|
310
|
+
)
|
|
311
|
+
)
|
|
312
|
+
if _default_content_type is not None:
|
|
313
|
+
_header_params['Content-Type'] = _default_content_type
|
|
314
|
+
|
|
315
|
+
# authentication setting
|
|
316
|
+
_auth_settings: List[str] = [
|
|
317
|
+
'apiToken'
|
|
318
|
+
]
|
|
319
|
+
|
|
320
|
+
return self.api_client.param_serialize(
|
|
321
|
+
method='POST',
|
|
322
|
+
resource_path='/api/vps/v1/public-keys/attach/{virtualMachineId}',
|
|
323
|
+
path_params=_path_params,
|
|
324
|
+
query_params=_query_params,
|
|
325
|
+
header_params=_header_params,
|
|
326
|
+
body=_body_params,
|
|
327
|
+
post_params=_form_params,
|
|
328
|
+
files=_files,
|
|
329
|
+
auth_settings=_auth_settings,
|
|
330
|
+
collection_formats=_collection_formats,
|
|
331
|
+
_host=_host,
|
|
332
|
+
_request_auth=_request_auth
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
@validate_call
|
|
339
|
+
def create_new_public_key_v1(
|
|
340
|
+
self,
|
|
341
|
+
vpsv1_public_key_store_request: VPSV1PublicKeyStoreRequest,
|
|
342
|
+
_request_timeout: Union[
|
|
343
|
+
None,
|
|
344
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
345
|
+
Tuple[
|
|
346
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
347
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
348
|
+
]
|
|
349
|
+
] = None,
|
|
350
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
351
|
+
_content_type: Optional[StrictStr] = None,
|
|
352
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
353
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
354
|
+
) -> VPSV1PublicKeyPublicKeyResource:
|
|
355
|
+
"""Create new public key
|
|
356
|
+
|
|
357
|
+
This endpoint allows you to add a new public key to your account, which can then be attached to virtual machine instances for secure access.
|
|
358
|
+
|
|
359
|
+
:param vpsv1_public_key_store_request: (required)
|
|
360
|
+
:type vpsv1_public_key_store_request: VPSV1PublicKeyStoreRequest
|
|
361
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
362
|
+
number provided, it will be total request
|
|
363
|
+
timeout. It can also be a pair (tuple) of
|
|
364
|
+
(connection, read) timeouts.
|
|
365
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
366
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
367
|
+
request; this effectively ignores the
|
|
368
|
+
authentication in the spec for a single request.
|
|
369
|
+
:type _request_auth: dict, optional
|
|
370
|
+
:param _content_type: force content-type for the request.
|
|
371
|
+
:type _content_type: str, Optional
|
|
372
|
+
:param _headers: set to override the headers for a single
|
|
373
|
+
request; this effectively ignores the headers
|
|
374
|
+
in the spec for a single request.
|
|
375
|
+
:type _headers: dict, optional
|
|
376
|
+
:param _host_index: set to override the host_index for a single
|
|
377
|
+
request; this effectively ignores the host_index
|
|
378
|
+
in the spec for a single request.
|
|
379
|
+
:type _host_index: int, optional
|
|
380
|
+
:return: Returns the result object.
|
|
381
|
+
""" # noqa: E501
|
|
382
|
+
|
|
383
|
+
_param = self._create_new_public_key_v1_serialize(
|
|
384
|
+
vpsv1_public_key_store_request=vpsv1_public_key_store_request,
|
|
385
|
+
_request_auth=_request_auth,
|
|
386
|
+
_content_type=_content_type,
|
|
387
|
+
_headers=_headers,
|
|
388
|
+
_host_index=_host_index
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
392
|
+
'200': "VPSV1PublicKeyPublicKeyResource",
|
|
393
|
+
'422': "CommonSchemaUnprocessableContentResponseSchema",
|
|
394
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
395
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
396
|
+
}
|
|
397
|
+
response_data = self.api_client.call_api(
|
|
398
|
+
*_param,
|
|
399
|
+
_request_timeout=_request_timeout
|
|
400
|
+
)
|
|
401
|
+
response_data.read()
|
|
402
|
+
return self.api_client.response_deserialize(
|
|
403
|
+
response_data=response_data,
|
|
404
|
+
response_types_map=_response_types_map,
|
|
405
|
+
).data
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
@validate_call
|
|
409
|
+
def create_new_public_key_v1_with_http_info(
|
|
410
|
+
self,
|
|
411
|
+
vpsv1_public_key_store_request: VPSV1PublicKeyStoreRequest,
|
|
412
|
+
_request_timeout: Union[
|
|
413
|
+
None,
|
|
414
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
415
|
+
Tuple[
|
|
416
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
417
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
418
|
+
]
|
|
419
|
+
] = None,
|
|
420
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
421
|
+
_content_type: Optional[StrictStr] = None,
|
|
422
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
423
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
424
|
+
) -> ApiResponse[VPSV1PublicKeyPublicKeyResource]:
|
|
425
|
+
"""Create new public key
|
|
426
|
+
|
|
427
|
+
This endpoint allows you to add a new public key to your account, which can then be attached to virtual machine instances for secure access.
|
|
428
|
+
|
|
429
|
+
:param vpsv1_public_key_store_request: (required)
|
|
430
|
+
:type vpsv1_public_key_store_request: VPSV1PublicKeyStoreRequest
|
|
431
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
432
|
+
number provided, it will be total request
|
|
433
|
+
timeout. It can also be a pair (tuple) of
|
|
434
|
+
(connection, read) timeouts.
|
|
435
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
436
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
437
|
+
request; this effectively ignores the
|
|
438
|
+
authentication in the spec for a single request.
|
|
439
|
+
:type _request_auth: dict, optional
|
|
440
|
+
:param _content_type: force content-type for the request.
|
|
441
|
+
:type _content_type: str, Optional
|
|
442
|
+
:param _headers: set to override the headers for a single
|
|
443
|
+
request; this effectively ignores the headers
|
|
444
|
+
in the spec for a single request.
|
|
445
|
+
:type _headers: dict, optional
|
|
446
|
+
:param _host_index: set to override the host_index for a single
|
|
447
|
+
request; this effectively ignores the host_index
|
|
448
|
+
in the spec for a single request.
|
|
449
|
+
:type _host_index: int, optional
|
|
450
|
+
:return: Returns the result object.
|
|
451
|
+
""" # noqa: E501
|
|
452
|
+
|
|
453
|
+
_param = self._create_new_public_key_v1_serialize(
|
|
454
|
+
vpsv1_public_key_store_request=vpsv1_public_key_store_request,
|
|
455
|
+
_request_auth=_request_auth,
|
|
456
|
+
_content_type=_content_type,
|
|
457
|
+
_headers=_headers,
|
|
458
|
+
_host_index=_host_index
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
462
|
+
'200': "VPSV1PublicKeyPublicKeyResource",
|
|
463
|
+
'422': "CommonSchemaUnprocessableContentResponseSchema",
|
|
464
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
465
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
466
|
+
}
|
|
467
|
+
response_data = self.api_client.call_api(
|
|
468
|
+
*_param,
|
|
469
|
+
_request_timeout=_request_timeout
|
|
470
|
+
)
|
|
471
|
+
response_data.read()
|
|
472
|
+
return self.api_client.response_deserialize(
|
|
473
|
+
response_data=response_data,
|
|
474
|
+
response_types_map=_response_types_map,
|
|
475
|
+
)
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
@validate_call
|
|
479
|
+
def create_new_public_key_v1_without_preload_content(
|
|
480
|
+
self,
|
|
481
|
+
vpsv1_public_key_store_request: VPSV1PublicKeyStoreRequest,
|
|
482
|
+
_request_timeout: Union[
|
|
483
|
+
None,
|
|
484
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
485
|
+
Tuple[
|
|
486
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
487
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
488
|
+
]
|
|
489
|
+
] = None,
|
|
490
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
491
|
+
_content_type: Optional[StrictStr] = None,
|
|
492
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
493
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
494
|
+
) -> RESTResponseType:
|
|
495
|
+
"""Create new public key
|
|
496
|
+
|
|
497
|
+
This endpoint allows you to add a new public key to your account, which can then be attached to virtual machine instances for secure access.
|
|
498
|
+
|
|
499
|
+
:param vpsv1_public_key_store_request: (required)
|
|
500
|
+
:type vpsv1_public_key_store_request: VPSV1PublicKeyStoreRequest
|
|
501
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
502
|
+
number provided, it will be total request
|
|
503
|
+
timeout. It can also be a pair (tuple) of
|
|
504
|
+
(connection, read) timeouts.
|
|
505
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
506
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
507
|
+
request; this effectively ignores the
|
|
508
|
+
authentication in the spec for a single request.
|
|
509
|
+
:type _request_auth: dict, optional
|
|
510
|
+
:param _content_type: force content-type for the request.
|
|
511
|
+
:type _content_type: str, Optional
|
|
512
|
+
:param _headers: set to override the headers for a single
|
|
513
|
+
request; this effectively ignores the headers
|
|
514
|
+
in the spec for a single request.
|
|
515
|
+
:type _headers: dict, optional
|
|
516
|
+
:param _host_index: set to override the host_index for a single
|
|
517
|
+
request; this effectively ignores the host_index
|
|
518
|
+
in the spec for a single request.
|
|
519
|
+
:type _host_index: int, optional
|
|
520
|
+
:return: Returns the result object.
|
|
521
|
+
""" # noqa: E501
|
|
522
|
+
|
|
523
|
+
_param = self._create_new_public_key_v1_serialize(
|
|
524
|
+
vpsv1_public_key_store_request=vpsv1_public_key_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': "VPSV1PublicKeyPublicKeyResource",
|
|
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_new_public_key_v1_serialize(
|
|
545
|
+
self,
|
|
546
|
+
vpsv1_public_key_store_request,
|
|
547
|
+
_request_auth,
|
|
548
|
+
_content_type,
|
|
549
|
+
_headers,
|
|
550
|
+
_host_index,
|
|
551
|
+
) -> RequestSerialized:
|
|
552
|
+
|
|
553
|
+
_host = None
|
|
554
|
+
|
|
555
|
+
_collection_formats: Dict[str, str] = {
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
_path_params: Dict[str, str] = {}
|
|
559
|
+
_query_params: List[Tuple[str, str]] = []
|
|
560
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
561
|
+
_form_params: List[Tuple[str, str]] = []
|
|
562
|
+
_files: Dict[
|
|
563
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
564
|
+
] = {}
|
|
565
|
+
_body_params: Optional[bytes] = None
|
|
566
|
+
|
|
567
|
+
# process the path parameters
|
|
568
|
+
# process the query parameters
|
|
569
|
+
# process the header parameters
|
|
570
|
+
# process the form parameters
|
|
571
|
+
# process the body parameter
|
|
572
|
+
if vpsv1_public_key_store_request is not None:
|
|
573
|
+
_body_params = vpsv1_public_key_store_request
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
# set the HTTP header `Accept`
|
|
577
|
+
if 'Accept' not in _header_params:
|
|
578
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
579
|
+
[
|
|
580
|
+
'application/json'
|
|
581
|
+
]
|
|
582
|
+
)
|
|
583
|
+
|
|
584
|
+
# set the HTTP header `Content-Type`
|
|
585
|
+
if _content_type:
|
|
586
|
+
_header_params['Content-Type'] = _content_type
|
|
587
|
+
else:
|
|
588
|
+
_default_content_type = (
|
|
589
|
+
self.api_client.select_header_content_type(
|
|
590
|
+
[
|
|
591
|
+
'application/json'
|
|
592
|
+
]
|
|
593
|
+
)
|
|
594
|
+
)
|
|
595
|
+
if _default_content_type is not None:
|
|
596
|
+
_header_params['Content-Type'] = _default_content_type
|
|
597
|
+
|
|
598
|
+
# authentication setting
|
|
599
|
+
_auth_settings: List[str] = [
|
|
600
|
+
'apiToken'
|
|
601
|
+
]
|
|
602
|
+
|
|
603
|
+
return self.api_client.param_serialize(
|
|
604
|
+
method='POST',
|
|
605
|
+
resource_path='/api/vps/v1/public-keys',
|
|
606
|
+
path_params=_path_params,
|
|
607
|
+
query_params=_query_params,
|
|
608
|
+
header_params=_header_params,
|
|
609
|
+
body=_body_params,
|
|
610
|
+
post_params=_form_params,
|
|
611
|
+
files=_files,
|
|
612
|
+
auth_settings=_auth_settings,
|
|
613
|
+
collection_formats=_collection_formats,
|
|
614
|
+
_host=_host,
|
|
615
|
+
_request_auth=_request_auth
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
@validate_call
|
|
622
|
+
def delete_a_public_key_v1(
|
|
623
|
+
self,
|
|
624
|
+
public_key_id: Annotated[StrictInt, Field(description="Public Key ID")],
|
|
625
|
+
_request_timeout: Union[
|
|
626
|
+
None,
|
|
627
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
628
|
+
Tuple[
|
|
629
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
630
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
631
|
+
]
|
|
632
|
+
] = None,
|
|
633
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
634
|
+
_content_type: Optional[StrictStr] = None,
|
|
635
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
636
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
637
|
+
) -> CommonSuccessEmptyResource:
|
|
638
|
+
"""Delete a public key
|
|
639
|
+
|
|
640
|
+
This endpoint deletes a public key from your account. **Deleting public key from account does not remove it from virtual machine**
|
|
641
|
+
|
|
642
|
+
:param public_key_id: Public Key ID (required)
|
|
643
|
+
:type public_key_id: int
|
|
644
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
645
|
+
number provided, it will be total request
|
|
646
|
+
timeout. It can also be a pair (tuple) of
|
|
647
|
+
(connection, read) timeouts.
|
|
648
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
649
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
650
|
+
request; this effectively ignores the
|
|
651
|
+
authentication in the spec for a single request.
|
|
652
|
+
:type _request_auth: dict, optional
|
|
653
|
+
:param _content_type: force content-type for the request.
|
|
654
|
+
:type _content_type: str, Optional
|
|
655
|
+
:param _headers: set to override the headers for a single
|
|
656
|
+
request; this effectively ignores the headers
|
|
657
|
+
in the spec for a single request.
|
|
658
|
+
:type _headers: dict, optional
|
|
659
|
+
:param _host_index: set to override the host_index for a single
|
|
660
|
+
request; this effectively ignores the host_index
|
|
661
|
+
in the spec for a single request.
|
|
662
|
+
:type _host_index: int, optional
|
|
663
|
+
:return: Returns the result object.
|
|
664
|
+
""" # noqa: E501
|
|
665
|
+
|
|
666
|
+
_param = self._delete_a_public_key_v1_serialize(
|
|
667
|
+
public_key_id=public_key_id,
|
|
668
|
+
_request_auth=_request_auth,
|
|
669
|
+
_content_type=_content_type,
|
|
670
|
+
_headers=_headers,
|
|
671
|
+
_host_index=_host_index
|
|
672
|
+
)
|
|
673
|
+
|
|
674
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
675
|
+
'200': "CommonSuccessEmptyResource",
|
|
676
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
677
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
678
|
+
}
|
|
679
|
+
response_data = self.api_client.call_api(
|
|
680
|
+
*_param,
|
|
681
|
+
_request_timeout=_request_timeout
|
|
682
|
+
)
|
|
683
|
+
response_data.read()
|
|
684
|
+
return self.api_client.response_deserialize(
|
|
685
|
+
response_data=response_data,
|
|
686
|
+
response_types_map=_response_types_map,
|
|
687
|
+
).data
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
@validate_call
|
|
691
|
+
def delete_a_public_key_v1_with_http_info(
|
|
692
|
+
self,
|
|
693
|
+
public_key_id: Annotated[StrictInt, Field(description="Public Key ID")],
|
|
694
|
+
_request_timeout: Union[
|
|
695
|
+
None,
|
|
696
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
697
|
+
Tuple[
|
|
698
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
699
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
700
|
+
]
|
|
701
|
+
] = None,
|
|
702
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
703
|
+
_content_type: Optional[StrictStr] = None,
|
|
704
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
705
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
706
|
+
) -> ApiResponse[CommonSuccessEmptyResource]:
|
|
707
|
+
"""Delete a public key
|
|
708
|
+
|
|
709
|
+
This endpoint deletes a public key from your account. **Deleting public key from account does not remove it from virtual machine**
|
|
710
|
+
|
|
711
|
+
:param public_key_id: Public Key ID (required)
|
|
712
|
+
:type public_key_id: int
|
|
713
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
714
|
+
number provided, it will be total request
|
|
715
|
+
timeout. It can also be a pair (tuple) of
|
|
716
|
+
(connection, read) timeouts.
|
|
717
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
718
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
719
|
+
request; this effectively ignores the
|
|
720
|
+
authentication in the spec for a single request.
|
|
721
|
+
:type _request_auth: dict, optional
|
|
722
|
+
:param _content_type: force content-type for the request.
|
|
723
|
+
:type _content_type: str, Optional
|
|
724
|
+
:param _headers: set to override the headers for a single
|
|
725
|
+
request; this effectively ignores the headers
|
|
726
|
+
in the spec for a single request.
|
|
727
|
+
:type _headers: dict, optional
|
|
728
|
+
:param _host_index: set to override the host_index for a single
|
|
729
|
+
request; this effectively ignores the host_index
|
|
730
|
+
in the spec for a single request.
|
|
731
|
+
:type _host_index: int, optional
|
|
732
|
+
:return: Returns the result object.
|
|
733
|
+
""" # noqa: E501
|
|
734
|
+
|
|
735
|
+
_param = self._delete_a_public_key_v1_serialize(
|
|
736
|
+
public_key_id=public_key_id,
|
|
737
|
+
_request_auth=_request_auth,
|
|
738
|
+
_content_type=_content_type,
|
|
739
|
+
_headers=_headers,
|
|
740
|
+
_host_index=_host_index
|
|
741
|
+
)
|
|
742
|
+
|
|
743
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
744
|
+
'200': "CommonSuccessEmptyResource",
|
|
745
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
746
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
747
|
+
}
|
|
748
|
+
response_data = self.api_client.call_api(
|
|
749
|
+
*_param,
|
|
750
|
+
_request_timeout=_request_timeout
|
|
751
|
+
)
|
|
752
|
+
response_data.read()
|
|
753
|
+
return self.api_client.response_deserialize(
|
|
754
|
+
response_data=response_data,
|
|
755
|
+
response_types_map=_response_types_map,
|
|
756
|
+
)
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
@validate_call
|
|
760
|
+
def delete_a_public_key_v1_without_preload_content(
|
|
761
|
+
self,
|
|
762
|
+
public_key_id: Annotated[StrictInt, Field(description="Public Key ID")],
|
|
763
|
+
_request_timeout: Union[
|
|
764
|
+
None,
|
|
765
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
766
|
+
Tuple[
|
|
767
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
768
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
769
|
+
]
|
|
770
|
+
] = None,
|
|
771
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
772
|
+
_content_type: Optional[StrictStr] = None,
|
|
773
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
774
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
775
|
+
) -> RESTResponseType:
|
|
776
|
+
"""Delete a public key
|
|
777
|
+
|
|
778
|
+
This endpoint deletes a public key from your account. **Deleting public key from account does not remove it from virtual machine**
|
|
779
|
+
|
|
780
|
+
:param public_key_id: Public Key ID (required)
|
|
781
|
+
:type public_key_id: int
|
|
782
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
783
|
+
number provided, it will be total request
|
|
784
|
+
timeout. It can also be a pair (tuple) of
|
|
785
|
+
(connection, read) timeouts.
|
|
786
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
787
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
788
|
+
request; this effectively ignores the
|
|
789
|
+
authentication in the spec for a single request.
|
|
790
|
+
:type _request_auth: dict, optional
|
|
791
|
+
:param _content_type: force content-type for the request.
|
|
792
|
+
:type _content_type: str, Optional
|
|
793
|
+
:param _headers: set to override the headers for a single
|
|
794
|
+
request; this effectively ignores the headers
|
|
795
|
+
in the spec for a single request.
|
|
796
|
+
:type _headers: dict, optional
|
|
797
|
+
:param _host_index: set to override the host_index for a single
|
|
798
|
+
request; this effectively ignores the host_index
|
|
799
|
+
in the spec for a single request.
|
|
800
|
+
:type _host_index: int, optional
|
|
801
|
+
:return: Returns the result object.
|
|
802
|
+
""" # noqa: E501
|
|
803
|
+
|
|
804
|
+
_param = self._delete_a_public_key_v1_serialize(
|
|
805
|
+
public_key_id=public_key_id,
|
|
806
|
+
_request_auth=_request_auth,
|
|
807
|
+
_content_type=_content_type,
|
|
808
|
+
_headers=_headers,
|
|
809
|
+
_host_index=_host_index
|
|
810
|
+
)
|
|
811
|
+
|
|
812
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
813
|
+
'200': "CommonSuccessEmptyResource",
|
|
814
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
815
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
816
|
+
}
|
|
817
|
+
response_data = self.api_client.call_api(
|
|
818
|
+
*_param,
|
|
819
|
+
_request_timeout=_request_timeout
|
|
820
|
+
)
|
|
821
|
+
return response_data.response
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
def _delete_a_public_key_v1_serialize(
|
|
825
|
+
self,
|
|
826
|
+
public_key_id,
|
|
827
|
+
_request_auth,
|
|
828
|
+
_content_type,
|
|
829
|
+
_headers,
|
|
830
|
+
_host_index,
|
|
831
|
+
) -> RequestSerialized:
|
|
832
|
+
|
|
833
|
+
_host = None
|
|
834
|
+
|
|
835
|
+
_collection_formats: Dict[str, str] = {
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
_path_params: Dict[str, str] = {}
|
|
839
|
+
_query_params: List[Tuple[str, str]] = []
|
|
840
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
841
|
+
_form_params: List[Tuple[str, str]] = []
|
|
842
|
+
_files: Dict[
|
|
843
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
844
|
+
] = {}
|
|
845
|
+
_body_params: Optional[bytes] = None
|
|
846
|
+
|
|
847
|
+
# process the path parameters
|
|
848
|
+
if public_key_id is not None:
|
|
849
|
+
_path_params['publicKeyId'] = public_key_id
|
|
850
|
+
# process the query parameters
|
|
851
|
+
# process the header parameters
|
|
852
|
+
# process the form parameters
|
|
853
|
+
# process the body parameter
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
# set the HTTP header `Accept`
|
|
857
|
+
if 'Accept' not in _header_params:
|
|
858
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
859
|
+
[
|
|
860
|
+
'application/json'
|
|
861
|
+
]
|
|
862
|
+
)
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
# authentication setting
|
|
866
|
+
_auth_settings: List[str] = [
|
|
867
|
+
'apiToken'
|
|
868
|
+
]
|
|
869
|
+
|
|
870
|
+
return self.api_client.param_serialize(
|
|
871
|
+
method='DELETE',
|
|
872
|
+
resource_path='/api/vps/v1/public-keys/{publicKeyId}',
|
|
873
|
+
path_params=_path_params,
|
|
874
|
+
query_params=_query_params,
|
|
875
|
+
header_params=_header_params,
|
|
876
|
+
body=_body_params,
|
|
877
|
+
post_params=_form_params,
|
|
878
|
+
files=_files,
|
|
879
|
+
auth_settings=_auth_settings,
|
|
880
|
+
collection_formats=_collection_formats,
|
|
881
|
+
_host=_host,
|
|
882
|
+
_request_auth=_request_auth
|
|
883
|
+
)
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
@validate_call
|
|
889
|
+
def get_public_key_list_v1(
|
|
890
|
+
self,
|
|
891
|
+
page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
|
|
892
|
+
_request_timeout: Union[
|
|
893
|
+
None,
|
|
894
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
895
|
+
Tuple[
|
|
896
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
897
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
898
|
+
]
|
|
899
|
+
] = None,
|
|
900
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
901
|
+
_content_type: Optional[StrictStr] = None,
|
|
902
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
903
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
904
|
+
) -> VPSGetPublicKeyListV1200Response:
|
|
905
|
+
"""Get public key list
|
|
906
|
+
|
|
907
|
+
This endpoint retrieves a list of public keys associated with your account.
|
|
908
|
+
|
|
909
|
+
:param page: Page number
|
|
910
|
+
:type page: int
|
|
911
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
912
|
+
number provided, it will be total request
|
|
913
|
+
timeout. It can also be a pair (tuple) of
|
|
914
|
+
(connection, read) timeouts.
|
|
915
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
916
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
917
|
+
request; this effectively ignores the
|
|
918
|
+
authentication in the spec for a single request.
|
|
919
|
+
:type _request_auth: dict, optional
|
|
920
|
+
:param _content_type: force content-type for the request.
|
|
921
|
+
:type _content_type: str, Optional
|
|
922
|
+
:param _headers: set to override the headers for a single
|
|
923
|
+
request; this effectively ignores the headers
|
|
924
|
+
in the spec for a single request.
|
|
925
|
+
:type _headers: dict, optional
|
|
926
|
+
:param _host_index: set to override the host_index for a single
|
|
927
|
+
request; this effectively ignores the host_index
|
|
928
|
+
in the spec for a single request.
|
|
929
|
+
:type _host_index: int, optional
|
|
930
|
+
:return: Returns the result object.
|
|
931
|
+
""" # noqa: E501
|
|
932
|
+
|
|
933
|
+
_param = self._get_public_key_list_v1_serialize(
|
|
934
|
+
page=page,
|
|
935
|
+
_request_auth=_request_auth,
|
|
936
|
+
_content_type=_content_type,
|
|
937
|
+
_headers=_headers,
|
|
938
|
+
_host_index=_host_index
|
|
939
|
+
)
|
|
940
|
+
|
|
941
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
942
|
+
'200': "VPSGetPublicKeyListV1200Response",
|
|
943
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
944
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
945
|
+
}
|
|
946
|
+
response_data = self.api_client.call_api(
|
|
947
|
+
*_param,
|
|
948
|
+
_request_timeout=_request_timeout
|
|
949
|
+
)
|
|
950
|
+
response_data.read()
|
|
951
|
+
return self.api_client.response_deserialize(
|
|
952
|
+
response_data=response_data,
|
|
953
|
+
response_types_map=_response_types_map,
|
|
954
|
+
).data
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
@validate_call
|
|
958
|
+
def get_public_key_list_v1_with_http_info(
|
|
959
|
+
self,
|
|
960
|
+
page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
|
|
961
|
+
_request_timeout: Union[
|
|
962
|
+
None,
|
|
963
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
964
|
+
Tuple[
|
|
965
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
966
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
967
|
+
]
|
|
968
|
+
] = None,
|
|
969
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
970
|
+
_content_type: Optional[StrictStr] = None,
|
|
971
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
972
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
973
|
+
) -> ApiResponse[VPSGetPublicKeyListV1200Response]:
|
|
974
|
+
"""Get public key list
|
|
975
|
+
|
|
976
|
+
This endpoint retrieves a list of public keys associated with your account.
|
|
977
|
+
|
|
978
|
+
:param page: Page number
|
|
979
|
+
:type page: int
|
|
980
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
981
|
+
number provided, it will be total request
|
|
982
|
+
timeout. It can also be a pair (tuple) of
|
|
983
|
+
(connection, read) timeouts.
|
|
984
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
985
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
986
|
+
request; this effectively ignores the
|
|
987
|
+
authentication in the spec for a single request.
|
|
988
|
+
:type _request_auth: dict, optional
|
|
989
|
+
:param _content_type: force content-type for the request.
|
|
990
|
+
:type _content_type: str, Optional
|
|
991
|
+
:param _headers: set to override the headers for a single
|
|
992
|
+
request; this effectively ignores the headers
|
|
993
|
+
in the spec for a single request.
|
|
994
|
+
:type _headers: dict, optional
|
|
995
|
+
:param _host_index: set to override the host_index for a single
|
|
996
|
+
request; this effectively ignores the host_index
|
|
997
|
+
in the spec for a single request.
|
|
998
|
+
:type _host_index: int, optional
|
|
999
|
+
:return: Returns the result object.
|
|
1000
|
+
""" # noqa: E501
|
|
1001
|
+
|
|
1002
|
+
_param = self._get_public_key_list_v1_serialize(
|
|
1003
|
+
page=page,
|
|
1004
|
+
_request_auth=_request_auth,
|
|
1005
|
+
_content_type=_content_type,
|
|
1006
|
+
_headers=_headers,
|
|
1007
|
+
_host_index=_host_index
|
|
1008
|
+
)
|
|
1009
|
+
|
|
1010
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
1011
|
+
'200': "VPSGetPublicKeyListV1200Response",
|
|
1012
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
1013
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
1014
|
+
}
|
|
1015
|
+
response_data = self.api_client.call_api(
|
|
1016
|
+
*_param,
|
|
1017
|
+
_request_timeout=_request_timeout
|
|
1018
|
+
)
|
|
1019
|
+
response_data.read()
|
|
1020
|
+
return self.api_client.response_deserialize(
|
|
1021
|
+
response_data=response_data,
|
|
1022
|
+
response_types_map=_response_types_map,
|
|
1023
|
+
)
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
@validate_call
|
|
1027
|
+
def get_public_key_list_v1_without_preload_content(
|
|
1028
|
+
self,
|
|
1029
|
+
page: Annotated[Optional[StrictInt], Field(description="Page number")] = None,
|
|
1030
|
+
_request_timeout: Union[
|
|
1031
|
+
None,
|
|
1032
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1033
|
+
Tuple[
|
|
1034
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
1035
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
1036
|
+
]
|
|
1037
|
+
] = None,
|
|
1038
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
1039
|
+
_content_type: Optional[StrictStr] = None,
|
|
1040
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
1041
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
1042
|
+
) -> RESTResponseType:
|
|
1043
|
+
"""Get public key list
|
|
1044
|
+
|
|
1045
|
+
This endpoint retrieves a list of public keys associated with your account.
|
|
1046
|
+
|
|
1047
|
+
:param page: Page number
|
|
1048
|
+
:type page: int
|
|
1049
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
1050
|
+
number provided, it will be total request
|
|
1051
|
+
timeout. It can also be a pair (tuple) of
|
|
1052
|
+
(connection, read) timeouts.
|
|
1053
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
1054
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
1055
|
+
request; this effectively ignores the
|
|
1056
|
+
authentication in the spec for a single request.
|
|
1057
|
+
:type _request_auth: dict, optional
|
|
1058
|
+
:param _content_type: force content-type for the request.
|
|
1059
|
+
:type _content_type: str, Optional
|
|
1060
|
+
:param _headers: set to override the headers for a single
|
|
1061
|
+
request; this effectively ignores the headers
|
|
1062
|
+
in the spec for a single request.
|
|
1063
|
+
:type _headers: dict, optional
|
|
1064
|
+
:param _host_index: set to override the host_index for a single
|
|
1065
|
+
request; this effectively ignores the host_index
|
|
1066
|
+
in the spec for a single request.
|
|
1067
|
+
:type _host_index: int, optional
|
|
1068
|
+
:return: Returns the result object.
|
|
1069
|
+
""" # noqa: E501
|
|
1070
|
+
|
|
1071
|
+
_param = self._get_public_key_list_v1_serialize(
|
|
1072
|
+
page=page,
|
|
1073
|
+
_request_auth=_request_auth,
|
|
1074
|
+
_content_type=_content_type,
|
|
1075
|
+
_headers=_headers,
|
|
1076
|
+
_host_index=_host_index
|
|
1077
|
+
)
|
|
1078
|
+
|
|
1079
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
1080
|
+
'200': "VPSGetPublicKeyListV1200Response",
|
|
1081
|
+
'401': "CommonSchemaUnauthorizedResponseSchema",
|
|
1082
|
+
'500': "CommonSchemaErrorResponseSchema",
|
|
1083
|
+
}
|
|
1084
|
+
response_data = self.api_client.call_api(
|
|
1085
|
+
*_param,
|
|
1086
|
+
_request_timeout=_request_timeout
|
|
1087
|
+
)
|
|
1088
|
+
return response_data.response
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
def _get_public_key_list_v1_serialize(
|
|
1092
|
+
self,
|
|
1093
|
+
page,
|
|
1094
|
+
_request_auth,
|
|
1095
|
+
_content_type,
|
|
1096
|
+
_headers,
|
|
1097
|
+
_host_index,
|
|
1098
|
+
) -> RequestSerialized:
|
|
1099
|
+
|
|
1100
|
+
_host = None
|
|
1101
|
+
|
|
1102
|
+
_collection_formats: Dict[str, str] = {
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
_path_params: Dict[str, str] = {}
|
|
1106
|
+
_query_params: List[Tuple[str, str]] = []
|
|
1107
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
1108
|
+
_form_params: List[Tuple[str, str]] = []
|
|
1109
|
+
_files: Dict[
|
|
1110
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
1111
|
+
] = {}
|
|
1112
|
+
_body_params: Optional[bytes] = None
|
|
1113
|
+
|
|
1114
|
+
# process the path parameters
|
|
1115
|
+
# process the query parameters
|
|
1116
|
+
if page is not None:
|
|
1117
|
+
|
|
1118
|
+
_query_params.append(('page', page))
|
|
1119
|
+
|
|
1120
|
+
# process the header parameters
|
|
1121
|
+
# process the form parameters
|
|
1122
|
+
# process the body parameter
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
# set the HTTP header `Accept`
|
|
1126
|
+
if 'Accept' not in _header_params:
|
|
1127
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
1128
|
+
[
|
|
1129
|
+
'application/json'
|
|
1130
|
+
]
|
|
1131
|
+
)
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
# authentication setting
|
|
1135
|
+
_auth_settings: List[str] = [
|
|
1136
|
+
'apiToken'
|
|
1137
|
+
]
|
|
1138
|
+
|
|
1139
|
+
return self.api_client.param_serialize(
|
|
1140
|
+
method='GET',
|
|
1141
|
+
resource_path='/api/vps/v1/public-keys',
|
|
1142
|
+
path_params=_path_params,
|
|
1143
|
+
query_params=_query_params,
|
|
1144
|
+
header_params=_header_params,
|
|
1145
|
+
body=_body_params,
|
|
1146
|
+
post_params=_form_params,
|
|
1147
|
+
files=_files,
|
|
1148
|
+
auth_settings=_auth_settings,
|
|
1149
|
+
collection_formats=_collection_formats,
|
|
1150
|
+
_host=_host,
|
|
1151
|
+
_request_auth=_request_auth
|
|
1152
|
+
)
|
|
1153
|
+
|
|
1154
|
+
|