hyperstack 0.1.23__py3-none-any.whl → 1.41.0a0__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.
- hyperstack/__init__.py +79 -131
- hyperstack/api/__init__.py +2 -0
- hyperstack/api/alive_api.py +240 -0
- hyperstack/api/api_key_api.py +16 -20
- hyperstack/api/assigning_member_role_api.py +15 -17
- hyperstack/api/auth_api.py +1050 -5
- hyperstack/api/beta_access_api.py +856 -0
- hyperstack/api/billing_api.py +6461 -673
- hyperstack/api/calculate_api.py +8 -9
- hyperstack/api/callbacks_api.py +120 -126
- hyperstack/api/cluster_events_api.py +1 -2
- hyperstack/api/clusters_api.py +2492 -146
- hyperstack/api/compliance_api.py +14 -18
- hyperstack/api/credit_api.py +17 -15
- hyperstack/api/customer_contract_api.py +30 -33
- hyperstack/api/dashboard_api.py +4 -5
- hyperstack/api/deployment_api.py +4 -8
- hyperstack/api/environment_api.py +285 -16
- hyperstack/api/firewall_attachment_api.py +11 -9
- hyperstack/api/firewalls_api.py +341 -347
- hyperstack/api/flavor_api.py +4 -5
- hyperstack/api/floating_ip_api.py +50 -49
- hyperstack/api/gpu_api.py +1 -2
- hyperstack/api/image_api.py +35 -39
- hyperstack/api/invite_api.py +288 -18
- hyperstack/api/keypair_api.py +22 -26
- hyperstack/api/organization_api.py +12 -15
- hyperstack/api/partner_config_api.py +564 -0
- hyperstack/api/payment_api.py +299 -18
- hyperstack/api/permission_api.py +4 -5
- hyperstack/api/policy_api.py +4 -5
- hyperstack/api/pricebook_api.py +14 -12
- hyperstack/api/profile_api.py +13 -17
- hyperstack/api/rbac_role_api.py +20 -25
- hyperstack/api/region_api.py +7 -8
- hyperstack/api/security_rules_api.py +1 -2
- hyperstack/api/snapshot_events_api.py +1 -2
- hyperstack/api/snapshots_api.py +166 -172
- hyperstack/api/stock_api.py +4 -5
- hyperstack/api/template_api.py +14 -19
- hyperstack/api/user_api.py +55 -49
- hyperstack/api/user_detail_choice_api.py +1 -2
- hyperstack/api/user_permission_api.py +8 -10
- hyperstack/api/virtual_machine_api.py +1529 -929
- hyperstack/api/virtual_machine_events_api.py +21 -22
- hyperstack/api/vnc_url_api.py +54 -50
- hyperstack/api/volume_api.py +340 -40
- hyperstack/api/volume_attachment_api.py +342 -42
- hyperstack/api_client.py +1 -1
- hyperstack/configuration.py +154 -47
- hyperstack/models/__init__.py +76 -130
- hyperstack/models/{environment_fieldsfor_volume.py → access_token_field.py} +7 -7
- hyperstack/models/attach_volume_fields.py +6 -2
- hyperstack/models/attach_volumes_payload.py +4 -2
- hyperstack/models/{virtual_machine_usage.py → attachments_fields_for_volume.py} +13 -11
- hyperstack/models/{flavor_vm_fields.py → attributes.py} +15 -18
- hyperstack/models/auth_get_token_response_model.py +4 -6
- hyperstack/models/{future_node_model.py → beta_access_request_fields.py} +27 -25
- hyperstack/models/{create_gpu.py → beta_access_request_payload.py} +9 -11
- hyperstack/models/{create_discount_response.py → beta_access_request_response_model.py} +11 -11
- hyperstack/models/{export_billing_data_request.py → beta_access_status_item.py} +20 -23
- hyperstack/models/{get_all_discount_for_all_organization_response.py → beta_access_status_response_model.py} +15 -15
- hyperstack/models/{exclude_billing_post_response.py → billing_history.py} +13 -11
- hyperstack/models/billing_history_data_synthesis_details.py +105 -0
- hyperstack/models/{vm_usage_response.py → billing_history_fine_tuning.py} +23 -19
- hyperstack/models/billing_history_model_evalutation_details.py +105 -0
- hyperstack/models/{get_all_discounts_fields.py → billing_history_serverless_inference.py} +23 -24
- hyperstack/models/billing_history_serverless_inference_details.py +105 -0
- hyperstack/models/{billingmetricesfields.py → billing_metrices_fields.py} +4 -4
- hyperstack/models/{billingmetricesresponse.py → billing_metrices_response.py} +7 -7
- hyperstack/models/cluster_fields.py +27 -9
- hyperstack/models/{add_update_flavor_organization_payload.py → cluster_flavor_fields.py} +28 -26
- hyperstack/models/{historical_instances_fields.py → cluster_node_fields.py} +24 -22
- hyperstack/models/{internal_instance_flavor_fields.py → cluster_node_group_fields.py} +17 -17
- hyperstack/models/{create_update_policy_response_model.py → cluster_node_groups_create_response.py} +21 -11
- hyperstack/models/{create_update_permission_response_model.py → cluster_node_groups_get_response.py} +11 -11
- hyperstack/models/{auth_request_login_response_model.py → cluster_node_groups_list_response.py} +15 -11
- hyperstack/models/{contract_eligible_instance_fields.py → cluster_node_instance_fields.py} +13 -11
- hyperstack/models/{image_logos.py → cluster_nodes_list_response.py} +14 -14
- hyperstack/models/{internal_environment_fields.py → cluster_version.py} +13 -9
- hyperstack/models/cluster_versions.py +10 -2
- hyperstack/models/{future_nodes_stock_model.py → colors.py} +17 -15
- hyperstack/models/contract_discount_plan_fields.py +3 -1
- hyperstack/models/contract_instance_fields.py +7 -1
- hyperstack/models/{future_node_response_model.py → create_cluster_node_fields.py} +23 -18
- hyperstack/models/{update_gpu.py → create_cluster_node_group_payload.py} +12 -11
- hyperstack/models/create_cluster_payload.py +31 -8
- hyperstack/models/create_environment.py +1 -1
- hyperstack/models/create_instances_payload.py +10 -8
- hyperstack/models/create_profile_payload.py +1 -1
- hyperstack/models/create_snapshot_payload.py +2 -4
- hyperstack/models/create_volume_payload.py +1 -1
- hyperstack/models/data_synthesis_billing_history_details_response_schema.py +95 -0
- hyperstack/models/{deployment_fieldsforstartdeployments.py → deployment_fields_for_start_deployments.py} +4 -4
- hyperstack/models/{editlabelofanexisting_vm_payload.py → edit_label_of_an_existing_vm_payload.py} +4 -4
- hyperstack/models/environment_features.py +14 -2
- hyperstack/models/{node_stocks_payload.py → environment_fields_for_volume.py} +10 -12
- hyperstack/models/flavor_fields.py +3 -1
- hyperstack/models/{customer_fields.py → flavor_label_fields.py} +7 -7
- hyperstack/models/{getcreditandthresholdinfo.py → get_credit_and_threshold_info.py} +4 -4
- hyperstack/models/{getcreditandthresholdinfoinresponse.py → get_credit_and_threshold_info_in_response.py} +7 -7
- hyperstack/models/{region_payload.py → get_instance_logs_response.py} +7 -9
- hyperstack/models/instance_fields.py +14 -4
- hyperstack/models/instance_flavor_fields.py +13 -1
- hyperstack/models/{flavor_response.py → keypair_environment_features.py} +20 -16
- hyperstack/models/{internal_instance_keypair_fields.py → keypair_environment_fields.py} +13 -11
- hyperstack/models/keypair_fields.py +6 -2
- hyperstack/models/{lastdaycostfields.py → last_day_cost_fields.py} +4 -4
- hyperstack/models/{lastdaycostresponse.py → last_day_cost_response.py} +7 -7
- hyperstack/models/{export_billing_data_response.py → logos.py} +13 -9
- hyperstack/models/{creditrequestresponse.py → master_flavors_response.py} +14 -14
- hyperstack/models/{customer_payload.py → mfa_status_fields.py} +8 -10
- hyperstack/models/{gpu.py → mfa_status_response.py} +11 -11
- hyperstack/models/model_evaluation_billing_history_details_response_schema.py +95 -0
- hyperstack/models/{organization_thresholdfields.py → organization_threshold_fields.py} +4 -4
- hyperstack/models/{organizationthresholdupdateresponse.py → organization_threshold_update_response.py} +7 -7
- hyperstack/models/{organizationthresholdsresponse.py → organization_thresholds_response.py} +7 -7
- hyperstack/models/{logo_get_response.py → pagination.py} +12 -12
- hyperstack/models/{billing_response.py → partner_config.py} +31 -20
- hyperstack/models/payment_details_fields.py +5 -1
- hyperstack/models/{logout_payload.py → primary_color.py} +10 -8
- hyperstack/models/region_fields.py +16 -2
- hyperstack/models/{vm_usage_request_payload.py → request_instance_logs_payload.py} +8 -8
- hyperstack/models/{stock_visibility_user_payload.py → request_instance_logs_response.py} +8 -8
- hyperstack/models/{contract_billing_history.py → resource_level_billing_bucket_details_resources.py} +10 -10
- hyperstack/models/{node_response_model.py → resource_level_billing_history_resources_cluster.py} +21 -11
- hyperstack/models/resource_level_billing_history_response_attributes.py +3 -1
- hyperstack/models/{get_all_contracts_response_model.py → resource_level_bucket_billing_details_response_model.py} +11 -15
- hyperstack/models/{contract_billing_history_response_model.py → resource_level_bucket_billing_history_response_model.py} +11 -11
- hyperstack/models/resource_level_cluster_billing_details_response_model.py +95 -0
- hyperstack/models/resource_level_cluster_billing_history_response_model.py +95 -0
- hyperstack/models/{get_discount_detail_response.py → resource_level_cluster_graph_billing_details_response_model.py} +11 -11
- hyperstack/models/{organization_object_response.py → resource_level_graph_billing_details_bucket.py} +18 -14
- hyperstack/models/{update_discounts_status_payload.py → secondary_color.py} +10 -8
- hyperstack/models/{security_rules_fieldsfor_instance.py → security_rules_fields_for_instance.py} +4 -4
- hyperstack/models/serverless_inferenced_billing_history_details_response_schema.py +95 -0
- hyperstack/models/snapshot_fields.py +6 -1
- hyperstack/models/snapshot_retrieve_fields.py +29 -2
- hyperstack/models/start_deployment.py +3 -3
- hyperstack/models/{subscribeorunsubscribeupdatepayload.py → subscribe_or_unsubscribe_update_payload.py} +4 -4
- hyperstack/models/token_based_billing_history_response.py +95 -0
- hyperstack/models/{update_keypairnameresponse.py → update_keypair_name_response.py} +4 -4
- hyperstack/models/update_volume_attachment_payload.py +87 -0
- hyperstack/models/{verify_api_key_payload.py → update_volume_payload.py} +7 -7
- hyperstack/models/{stock_visibility_user_list_response.py → update_volume_response.py} +14 -16
- hyperstack/models/{auth_request_login_fields.py → uris.py} +19 -9
- hyperstack/models/{userinfopostpayload.py → user_info_post_payload.py} +4 -4
- hyperstack/models/{node_stock_response_model.py → user_organizations_response.py} +14 -14
- hyperstack/models/users_info_fields.py +3 -1
- hyperstack/models/volume_attachment_fields.py +9 -5
- hyperstack/models/volume_fields.py +14 -4
- hyperstack/models/{volume_fieldsfor_instance.py → volume_fields_for_instance.py} +4 -4
- hyperstack/models/volumes.py +17 -11
- hyperstack/models/{instances_summary_fields.py → volumes_fields.py} +33 -29
- hyperstack/models/workload_billing_history_response.py +95 -0
- {hyperstack-0.1.23.dist-info → hyperstack-1.41.0a0.dist-info}/METADATA +9 -2
- hyperstack-1.41.0a0.dist-info/RECORD +349 -0
- {hyperstack-0.1.23.dist-info → hyperstack-1.41.0a0.dist-info}/WHEEL +1 -1
- hyperstack/models/api_key_verify_fields.py +0 -93
- hyperstack/models/billing_immune_resources_response.py +0 -95
- hyperstack/models/contract_billing_history_response_attributes.py +0 -99
- hyperstack/models/contract_change_payload.py +0 -101
- hyperstack/models/contract_eligible_instances_response.py +0 -101
- hyperstack/models/contract_event_create_model.py +0 -91
- hyperstack/models/contract_resource_payload.py +0 -95
- hyperstack/models/contractl_billing_history_response_metrics.py +0 -87
- hyperstack/models/create_contract_fields.py +0 -110
- hyperstack/models/create_contract_payload.py +0 -106
- hyperstack/models/create_discounts_payload.py +0 -112
- hyperstack/models/create_update_permission_payload.py +0 -93
- hyperstack/models/create_update_policy_payload.py +0 -93
- hyperstack/models/creditrechargelimitfield.py +0 -93
- hyperstack/models/creditrechargelimitresponse.py +0 -99
- hyperstack/models/creditrequests.py +0 -96
- hyperstack/models/data.py +0 -91
- hyperstack/models/discount_entity_model.py +0 -97
- hyperstack/models/discount_fields.py +0 -100
- hyperstack/models/discount_plan_fields.py +0 -108
- hyperstack/models/discount_resource_fields.py +0 -93
- hyperstack/models/discount_resource_payload.py +0 -93
- hyperstack/models/exclude_billing_post_payload.py +0 -91
- hyperstack/models/field_change.py +0 -91
- hyperstack/models/flavor_payload.py +0 -101
- hyperstack/models/flavor_vms_response.py +0 -99
- hyperstack/models/future_node_stock_model.py +0 -93
- hyperstack/models/future_node_update_model.py +0 -98
- hyperstack/models/get_all_contract_fields.py +0 -100
- hyperstack/models/get_discount_response.py +0 -99
- hyperstack/models/get_entity_discount_detail_response.py +0 -108
- hyperstack/models/get_token_payload.py +0 -89
- hyperstack/models/get_version_response.py +0 -91
- hyperstack/models/historical_instance.py +0 -101
- hyperstack/models/infrahub_resource_object_response.py +0 -119
- hyperstack/models/insert_discount_plan_fields.py +0 -112
- hyperstack/models/internal_instance_fields.py +0 -156
- hyperstack/models/internal_instance_image_fields.py +0 -95
- hyperstack/models/internal_instances_response.py +0 -99
- hyperstack/models/internal_security_rules_fields_for_instance.py +0 -104
- hyperstack/models/internal_volume_attachment_fields.py +0 -98
- hyperstack/models/internal_volume_fields.py +0 -95
- hyperstack/models/internal_volumes_response.py +0 -99
- hyperstack/models/new_stock_update_response_model.py +0 -89
- hyperstack/models/node_model.py +0 -114
- hyperstack/models/node_payload_model.py +0 -97
- hyperstack/models/node_power_usage_model.py +0 -120
- hyperstack/models/node_stock_payload_model.py +0 -95
- hyperstack/models/organizationcreditrechargelimitresponse.py +0 -95
- hyperstack/models/power_usage_model.py +0 -89
- hyperstack/models/pricebook_resource_object_response.py +0 -107
- hyperstack/models/refresh_token_payload.py +0 -89
- hyperstack/models/region_response.py +0 -95
- hyperstack/models/set_defaults_payload.py +0 -89
- hyperstack/models/single_visibility_user_response.py +0 -91
- hyperstack/models/success_response_model.py +0 -89
- hyperstack/models/token_fields.py +0 -91
- hyperstack/models/update_contract_payload.py +0 -104
- hyperstack/models/update_discounts_payload.py +0 -102
- hyperstack/models/user_transfer_payload.py +0 -89
- hyperstack/models/verify_api_key_response_model.py +0 -95
- hyperstack/models/volume_status_change_fields.py +0 -96
- hyperstack/models/volumes_last_status_change_response.py +0 -99
- hyperstack/models/warning_mail_log_fields.py +0 -99
- hyperstack/models/warning_mail_log_response.py +0 -101
- hyperstack-0.1.23.dist-info/RECORD +0 -401
- {hyperstack-0.1.23.dist-info → hyperstack-1.41.0a0.dist-info}/top_level.txt +0 -0
hyperstack/configuration.py
CHANGED
|
@@ -13,14 +13,16 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
import copy
|
|
16
|
+
import http.client as httplib
|
|
16
17
|
import logging
|
|
17
18
|
from logging import FileHandler
|
|
18
19
|
import multiprocessing
|
|
19
20
|
import sys
|
|
20
|
-
from typing import Optional
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict
|
|
22
|
+
from typing_extensions import NotRequired, Self
|
|
23
|
+
|
|
21
24
|
import urllib3
|
|
22
25
|
|
|
23
|
-
import http.client as httplib
|
|
24
26
|
|
|
25
27
|
JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
|
26
28
|
'multipleOf', 'maximum', 'exclusiveMaximum',
|
|
@@ -28,6 +30,107 @@ JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
|
|
28
30
|
'minLength', 'pattern', 'maxItems', 'minItems'
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
ServerVariablesT = Dict[str, str]
|
|
34
|
+
|
|
35
|
+
GenericAuthSetting = TypedDict(
|
|
36
|
+
"GenericAuthSetting",
|
|
37
|
+
{
|
|
38
|
+
"type": str,
|
|
39
|
+
"in": str,
|
|
40
|
+
"key": str,
|
|
41
|
+
"value": str,
|
|
42
|
+
},
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
OAuth2AuthSetting = TypedDict(
|
|
47
|
+
"OAuth2AuthSetting",
|
|
48
|
+
{
|
|
49
|
+
"type": Literal["oauth2"],
|
|
50
|
+
"in": Literal["header"],
|
|
51
|
+
"key": Literal["Authorization"],
|
|
52
|
+
"value": str,
|
|
53
|
+
},
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
APIKeyAuthSetting = TypedDict(
|
|
58
|
+
"APIKeyAuthSetting",
|
|
59
|
+
{
|
|
60
|
+
"type": Literal["api_key"],
|
|
61
|
+
"in": str,
|
|
62
|
+
"key": str,
|
|
63
|
+
"value": Optional[str],
|
|
64
|
+
},
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
BasicAuthSetting = TypedDict(
|
|
69
|
+
"BasicAuthSetting",
|
|
70
|
+
{
|
|
71
|
+
"type": Literal["basic"],
|
|
72
|
+
"in": Literal["header"],
|
|
73
|
+
"key": Literal["Authorization"],
|
|
74
|
+
"value": Optional[str],
|
|
75
|
+
},
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
BearerFormatAuthSetting = TypedDict(
|
|
80
|
+
"BearerFormatAuthSetting",
|
|
81
|
+
{
|
|
82
|
+
"type": Literal["bearer"],
|
|
83
|
+
"in": Literal["header"],
|
|
84
|
+
"format": Literal["JWT"],
|
|
85
|
+
"key": Literal["Authorization"],
|
|
86
|
+
"value": str,
|
|
87
|
+
},
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
BearerAuthSetting = TypedDict(
|
|
92
|
+
"BearerAuthSetting",
|
|
93
|
+
{
|
|
94
|
+
"type": Literal["bearer"],
|
|
95
|
+
"in": Literal["header"],
|
|
96
|
+
"key": Literal["Authorization"],
|
|
97
|
+
"value": str,
|
|
98
|
+
},
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
HTTPSignatureAuthSetting = TypedDict(
|
|
103
|
+
"HTTPSignatureAuthSetting",
|
|
104
|
+
{
|
|
105
|
+
"type": Literal["http-signature"],
|
|
106
|
+
"in": Literal["header"],
|
|
107
|
+
"key": Literal["Authorization"],
|
|
108
|
+
"value": None,
|
|
109
|
+
},
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
AuthSettings = TypedDict(
|
|
114
|
+
"AuthSettings",
|
|
115
|
+
{
|
|
116
|
+
"apiKey": APIKeyAuthSetting,
|
|
117
|
+
},
|
|
118
|
+
total=False,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class HostSettingVariable(TypedDict):
|
|
123
|
+
description: str
|
|
124
|
+
default_value: str
|
|
125
|
+
enum_values: List[str]
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class HostSetting(TypedDict):
|
|
129
|
+
url: str
|
|
130
|
+
description: str
|
|
131
|
+
variables: NotRequired[Dict[str, HostSettingVariable]]
|
|
132
|
+
|
|
133
|
+
|
|
31
134
|
class Configuration:
|
|
32
135
|
"""This class contains various settings of the API client.
|
|
33
136
|
|
|
@@ -81,20 +184,26 @@ conf = hyperstack.Configuration(
|
|
|
81
184
|
Cookie: JSESSIONID abc123
|
|
82
185
|
"""
|
|
83
186
|
|
|
84
|
-
_default = None
|
|
85
|
-
|
|
86
|
-
def __init__(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
187
|
+
_default: ClassVar[Optional[Self]] = None
|
|
188
|
+
|
|
189
|
+
def __init__(
|
|
190
|
+
self,
|
|
191
|
+
host: Optional[str]=None,
|
|
192
|
+
api_key: Optional[Dict[str, str]]=None,
|
|
193
|
+
api_key_prefix: Optional[Dict[str, str]]=None,
|
|
194
|
+
username: Optional[str]=None,
|
|
195
|
+
password: Optional[str]=None,
|
|
196
|
+
access_token: Optional[str]=None,
|
|
197
|
+
server_index: Optional[int]=None,
|
|
198
|
+
server_variables: Optional[ServerVariablesT]=None,
|
|
199
|
+
server_operation_index: Optional[Dict[int, int]]=None,
|
|
200
|
+
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
|
|
201
|
+
ignore_operation_servers: bool=False,
|
|
202
|
+
ssl_ca_cert: Optional[str]=None,
|
|
203
|
+
retries: Optional[int] = None,
|
|
204
|
+
*,
|
|
205
|
+
debug: Optional[bool] = None,
|
|
206
|
+
) -> None:
|
|
98
207
|
"""Constructor
|
|
99
208
|
"""
|
|
100
209
|
self._base_path = "https://infrahub-api.nexgencloud.com/v1" if host is None else host
|
|
@@ -218,7 +327,7 @@ conf = hyperstack.Configuration(
|
|
|
218
327
|
"""date format
|
|
219
328
|
"""
|
|
220
329
|
|
|
221
|
-
def __deepcopy__(self, memo):
|
|
330
|
+
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
|
|
222
331
|
cls = self.__class__
|
|
223
332
|
result = cls.__new__(cls)
|
|
224
333
|
memo[id(self)] = result
|
|
@@ -232,11 +341,11 @@ conf = hyperstack.Configuration(
|
|
|
232
341
|
result.debug = self.debug
|
|
233
342
|
return result
|
|
234
343
|
|
|
235
|
-
def __setattr__(self, name, value):
|
|
344
|
+
def __setattr__(self, name: str, value: Any) -> None:
|
|
236
345
|
object.__setattr__(self, name, value)
|
|
237
346
|
|
|
238
347
|
@classmethod
|
|
239
|
-
def set_default(cls, default):
|
|
348
|
+
def set_default(cls, default: Optional[Self]) -> None:
|
|
240
349
|
"""Set default instance of configuration.
|
|
241
350
|
|
|
242
351
|
It stores default configuration, which can be
|
|
@@ -247,7 +356,7 @@ conf = hyperstack.Configuration(
|
|
|
247
356
|
cls._default = default
|
|
248
357
|
|
|
249
358
|
@classmethod
|
|
250
|
-
def get_default_copy(cls):
|
|
359
|
+
def get_default_copy(cls) -> Self:
|
|
251
360
|
"""Deprecated. Please use `get_default` instead.
|
|
252
361
|
|
|
253
362
|
Deprecated. Please use `get_default` instead.
|
|
@@ -257,7 +366,7 @@ conf = hyperstack.Configuration(
|
|
|
257
366
|
return cls.get_default()
|
|
258
367
|
|
|
259
368
|
@classmethod
|
|
260
|
-
def get_default(cls):
|
|
369
|
+
def get_default(cls) -> Self:
|
|
261
370
|
"""Return the default configuration.
|
|
262
371
|
|
|
263
372
|
This method returns newly created, based on default constructor,
|
|
@@ -267,11 +376,11 @@ conf = hyperstack.Configuration(
|
|
|
267
376
|
:return: The configuration object.
|
|
268
377
|
"""
|
|
269
378
|
if cls._default is None:
|
|
270
|
-
cls._default =
|
|
379
|
+
cls._default = cls()
|
|
271
380
|
return cls._default
|
|
272
381
|
|
|
273
382
|
@property
|
|
274
|
-
def logger_file(self):
|
|
383
|
+
def logger_file(self) -> Optional[str]:
|
|
275
384
|
"""The logger file.
|
|
276
385
|
|
|
277
386
|
If the logger_file is None, then add stream handler and remove file
|
|
@@ -283,7 +392,7 @@ conf = hyperstack.Configuration(
|
|
|
283
392
|
return self.__logger_file
|
|
284
393
|
|
|
285
394
|
@logger_file.setter
|
|
286
|
-
def logger_file(self, value):
|
|
395
|
+
def logger_file(self, value: Optional[str]) -> None:
|
|
287
396
|
"""The logger file.
|
|
288
397
|
|
|
289
398
|
If the logger_file is None, then add stream handler and remove file
|
|
@@ -302,7 +411,7 @@ conf = hyperstack.Configuration(
|
|
|
302
411
|
logger.addHandler(self.logger_file_handler)
|
|
303
412
|
|
|
304
413
|
@property
|
|
305
|
-
def debug(self):
|
|
414
|
+
def debug(self) -> bool:
|
|
306
415
|
"""Debug status
|
|
307
416
|
|
|
308
417
|
:param value: The debug status, True or False.
|
|
@@ -311,7 +420,7 @@ conf = hyperstack.Configuration(
|
|
|
311
420
|
return self.__debug
|
|
312
421
|
|
|
313
422
|
@debug.setter
|
|
314
|
-
def debug(self, value):
|
|
423
|
+
def debug(self, value: bool) -> None:
|
|
315
424
|
"""Debug status
|
|
316
425
|
|
|
317
426
|
:param value: The debug status, True or False.
|
|
@@ -333,7 +442,7 @@ conf = hyperstack.Configuration(
|
|
|
333
442
|
httplib.HTTPConnection.debuglevel = 0
|
|
334
443
|
|
|
335
444
|
@property
|
|
336
|
-
def logger_format(self):
|
|
445
|
+
def logger_format(self) -> str:
|
|
337
446
|
"""The logger format.
|
|
338
447
|
|
|
339
448
|
The logger_formatter will be updated when sets logger_format.
|
|
@@ -344,7 +453,7 @@ conf = hyperstack.Configuration(
|
|
|
344
453
|
return self.__logger_format
|
|
345
454
|
|
|
346
455
|
@logger_format.setter
|
|
347
|
-
def logger_format(self, value):
|
|
456
|
+
def logger_format(self, value: str) -> None:
|
|
348
457
|
"""The logger format.
|
|
349
458
|
|
|
350
459
|
The logger_formatter will be updated when sets logger_format.
|
|
@@ -355,7 +464,7 @@ conf = hyperstack.Configuration(
|
|
|
355
464
|
self.__logger_format = value
|
|
356
465
|
self.logger_formatter = logging.Formatter(self.__logger_format)
|
|
357
466
|
|
|
358
|
-
def get_api_key_with_prefix(self, identifier, alias=None):
|
|
467
|
+
def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]:
|
|
359
468
|
"""Gets API key (with prefix if set).
|
|
360
469
|
|
|
361
470
|
:param identifier: The identifier of apiKey.
|
|
@@ -372,7 +481,9 @@ conf = hyperstack.Configuration(
|
|
|
372
481
|
else:
|
|
373
482
|
return key
|
|
374
483
|
|
|
375
|
-
|
|
484
|
+
return None
|
|
485
|
+
|
|
486
|
+
def get_basic_auth_token(self) -> Optional[str]:
|
|
376
487
|
"""Gets HTTP basic authentication header (string).
|
|
377
488
|
|
|
378
489
|
:return: The token for basic HTTP authentication.
|
|
@@ -387,21 +498,12 @@ conf = hyperstack.Configuration(
|
|
|
387
498
|
basic_auth=username + ':' + password
|
|
388
499
|
).get('authorization')
|
|
389
500
|
|
|
390
|
-
def auth_settings(self):
|
|
501
|
+
def auth_settings(self)-> AuthSettings:
|
|
391
502
|
"""Gets Auth Settings dict for api client.
|
|
392
503
|
|
|
393
504
|
:return: The Auth Settings information dict.
|
|
394
505
|
"""
|
|
395
|
-
auth = {}
|
|
396
|
-
if 'accessToken' in self.api_key:
|
|
397
|
-
auth['accessToken'] = {
|
|
398
|
-
'type': 'api_key',
|
|
399
|
-
'in': 'header',
|
|
400
|
-
'key': 'Authorization',
|
|
401
|
-
'value': self.get_api_key_with_prefix(
|
|
402
|
-
'accessToken',
|
|
403
|
-
),
|
|
404
|
-
}
|
|
506
|
+
auth: AuthSettings = {}
|
|
405
507
|
if 'apiKey' in self.api_key:
|
|
406
508
|
auth['apiKey'] = {
|
|
407
509
|
'type': 'api_key',
|
|
@@ -413,7 +515,7 @@ conf = hyperstack.Configuration(
|
|
|
413
515
|
}
|
|
414
516
|
return auth
|
|
415
517
|
|
|
416
|
-
def to_debug_report(self):
|
|
518
|
+
def to_debug_report(self) -> str:
|
|
417
519
|
"""Gets the essential information for debugging.
|
|
418
520
|
|
|
419
521
|
:return: The report for debugging.
|
|
@@ -422,10 +524,10 @@ conf = hyperstack.Configuration(
|
|
|
422
524
|
"OS: {env}\n"\
|
|
423
525
|
"Python Version: {pyversion}\n"\
|
|
424
526
|
"Version of the API: 1.0\n"\
|
|
425
|
-
"SDK Package Version:
|
|
527
|
+
"SDK Package Version: v1.41.0-alpha".\
|
|
426
528
|
format(env=sys.platform, pyversion=sys.version)
|
|
427
529
|
|
|
428
|
-
def get_host_settings(self):
|
|
530
|
+
def get_host_settings(self) -> List[HostSetting]:
|
|
429
531
|
"""Gets an array of host settings
|
|
430
532
|
|
|
431
533
|
:return: An array of host settings
|
|
@@ -437,7 +539,12 @@ conf = hyperstack.Configuration(
|
|
|
437
539
|
}
|
|
438
540
|
]
|
|
439
541
|
|
|
440
|
-
def get_host_from_settings(
|
|
542
|
+
def get_host_from_settings(
|
|
543
|
+
self,
|
|
544
|
+
index: Optional[int],
|
|
545
|
+
variables: Optional[ServerVariablesT]=None,
|
|
546
|
+
servers: Optional[List[HostSetting]]=None,
|
|
547
|
+
) -> str:
|
|
441
548
|
"""Gets host URL based on the index and variables
|
|
442
549
|
:param index: array index of the host settings
|
|
443
550
|
:param variables: hash of variable and the corresponding value
|
|
@@ -477,12 +584,12 @@ conf = hyperstack.Configuration(
|
|
|
477
584
|
return url
|
|
478
585
|
|
|
479
586
|
@property
|
|
480
|
-
def host(self):
|
|
587
|
+
def host(self) -> str:
|
|
481
588
|
"""Return generated host."""
|
|
482
589
|
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
|
|
483
590
|
|
|
484
591
|
@host.setter
|
|
485
|
-
def host(self, value):
|
|
592
|
+
def host(self, value: str) -> None:
|
|
486
593
|
"""Fix base path."""
|
|
487
594
|
self._base_path = value
|
|
488
595
|
self.server_index = None
|