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,127 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import json
|
|
15
|
+
import pprint
|
|
16
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
17
|
+
from typing import Any, List, Optional
|
|
18
|
+
from hostinger_api.models.vpsv1_metrics_metrics_resource import VPSV1MetricsMetricsResource
|
|
19
|
+
from pydantic import StrictStr, Field
|
|
20
|
+
from typing import Union, List, Set, Optional, Dict
|
|
21
|
+
from typing_extensions import Literal, Self
|
|
22
|
+
|
|
23
|
+
VPSV1METRICSMETRICSCOLLECTIONOUTGOINGTRAFFIC_ONE_OF_SCHEMAS = ["VPSV1MetricsMetricsResource"]
|
|
24
|
+
|
|
25
|
+
class VPSV1MetricsMetricsCollectionOutgoingTraffic(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Outgoing traffic in bytes
|
|
28
|
+
"""
|
|
29
|
+
# data type: VPSV1MetricsMetricsResource
|
|
30
|
+
oneof_schema_1_validator: Optional[VPSV1MetricsMetricsResource] = None
|
|
31
|
+
actual_instance: Optional[Union[VPSV1MetricsMetricsResource]] = None
|
|
32
|
+
one_of_schemas: Set[str] = { "VPSV1MetricsMetricsResource" }
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
41
|
+
if args:
|
|
42
|
+
if len(args) > 1:
|
|
43
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
44
|
+
if kwargs:
|
|
45
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
46
|
+
super().__init__(actual_instance=args[0])
|
|
47
|
+
else:
|
|
48
|
+
super().__init__(**kwargs)
|
|
49
|
+
|
|
50
|
+
@field_validator('actual_instance')
|
|
51
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
52
|
+
if v is None:
|
|
53
|
+
return v
|
|
54
|
+
|
|
55
|
+
instance = VPSV1MetricsMetricsCollectionOutgoingTraffic.model_construct()
|
|
56
|
+
error_messages = []
|
|
57
|
+
match = 0
|
|
58
|
+
# validate data type: VPSV1MetricsMetricsResource
|
|
59
|
+
if not isinstance(v, VPSV1MetricsMetricsResource):
|
|
60
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `VPSV1MetricsMetricsResource`")
|
|
61
|
+
else:
|
|
62
|
+
match += 1
|
|
63
|
+
if match > 1:
|
|
64
|
+
# more than 1 match
|
|
65
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in VPSV1MetricsMetricsCollectionOutgoingTraffic with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
66
|
+
elif match == 0:
|
|
67
|
+
# no match
|
|
68
|
+
raise ValueError("No match found when setting `actual_instance` in VPSV1MetricsMetricsCollectionOutgoingTraffic with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
69
|
+
else:
|
|
70
|
+
return v
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
74
|
+
return cls.from_json(json.dumps(obj))
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_json(cls, json_str: Optional[str]) -> Self:
|
|
78
|
+
"""Returns the object represented by the json string"""
|
|
79
|
+
instance = cls.model_construct()
|
|
80
|
+
if json_str is None:
|
|
81
|
+
return instance
|
|
82
|
+
|
|
83
|
+
error_messages = []
|
|
84
|
+
match = 0
|
|
85
|
+
|
|
86
|
+
# deserialize data into VPSV1MetricsMetricsResource
|
|
87
|
+
try:
|
|
88
|
+
instance.actual_instance = VPSV1MetricsMetricsResource.from_json(json_str)
|
|
89
|
+
match += 1
|
|
90
|
+
except (ValidationError, ValueError) as e:
|
|
91
|
+
error_messages.append(str(e))
|
|
92
|
+
|
|
93
|
+
if match > 1:
|
|
94
|
+
# more than 1 match
|
|
95
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into VPSV1MetricsMetricsCollectionOutgoingTraffic with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
96
|
+
elif match == 0:
|
|
97
|
+
# no match
|
|
98
|
+
raise ValueError("No match found when deserializing the JSON string into VPSV1MetricsMetricsCollectionOutgoingTraffic with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
99
|
+
else:
|
|
100
|
+
return instance
|
|
101
|
+
|
|
102
|
+
def to_json(self) -> str:
|
|
103
|
+
"""Returns the JSON representation of the actual instance"""
|
|
104
|
+
if self.actual_instance is None:
|
|
105
|
+
return "null"
|
|
106
|
+
|
|
107
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
108
|
+
return self.actual_instance.to_json()
|
|
109
|
+
else:
|
|
110
|
+
return json.dumps(self.actual_instance)
|
|
111
|
+
|
|
112
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], VPSV1MetricsMetricsResource]]:
|
|
113
|
+
"""Returns the dict representation of the actual instance"""
|
|
114
|
+
if self.actual_instance is None:
|
|
115
|
+
return None
|
|
116
|
+
|
|
117
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
118
|
+
return self.actual_instance.to_dict()
|
|
119
|
+
else:
|
|
120
|
+
# primitive type
|
|
121
|
+
return self.actual_instance
|
|
122
|
+
|
|
123
|
+
def to_str(self) -> str:
|
|
124
|
+
"""Returns the string representation of the actual instance"""
|
|
125
|
+
return pprint.pformat(self.model_dump())
|
|
126
|
+
|
|
127
|
+
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import json
|
|
15
|
+
import pprint
|
|
16
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
17
|
+
from typing import Any, List, Optional
|
|
18
|
+
from hostinger_api.models.vpsv1_metrics_metrics_resource import VPSV1MetricsMetricsResource
|
|
19
|
+
from pydantic import StrictStr, Field
|
|
20
|
+
from typing import Union, List, Set, Optional, Dict
|
|
21
|
+
from typing_extensions import Literal, Self
|
|
22
|
+
|
|
23
|
+
VPSV1METRICSMETRICSCOLLECTIONRAMUSAGE_ONE_OF_SCHEMAS = ["VPSV1MetricsMetricsResource"]
|
|
24
|
+
|
|
25
|
+
class VPSV1MetricsMetricsCollectionRamUsage(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
RAM usage in bytes
|
|
28
|
+
"""
|
|
29
|
+
# data type: VPSV1MetricsMetricsResource
|
|
30
|
+
oneof_schema_1_validator: Optional[VPSV1MetricsMetricsResource] = None
|
|
31
|
+
actual_instance: Optional[Union[VPSV1MetricsMetricsResource]] = None
|
|
32
|
+
one_of_schemas: Set[str] = { "VPSV1MetricsMetricsResource" }
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
41
|
+
if args:
|
|
42
|
+
if len(args) > 1:
|
|
43
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
44
|
+
if kwargs:
|
|
45
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
46
|
+
super().__init__(actual_instance=args[0])
|
|
47
|
+
else:
|
|
48
|
+
super().__init__(**kwargs)
|
|
49
|
+
|
|
50
|
+
@field_validator('actual_instance')
|
|
51
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
52
|
+
if v is None:
|
|
53
|
+
return v
|
|
54
|
+
|
|
55
|
+
instance = VPSV1MetricsMetricsCollectionRamUsage.model_construct()
|
|
56
|
+
error_messages = []
|
|
57
|
+
match = 0
|
|
58
|
+
# validate data type: VPSV1MetricsMetricsResource
|
|
59
|
+
if not isinstance(v, VPSV1MetricsMetricsResource):
|
|
60
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `VPSV1MetricsMetricsResource`")
|
|
61
|
+
else:
|
|
62
|
+
match += 1
|
|
63
|
+
if match > 1:
|
|
64
|
+
# more than 1 match
|
|
65
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in VPSV1MetricsMetricsCollectionRamUsage with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
66
|
+
elif match == 0:
|
|
67
|
+
# no match
|
|
68
|
+
raise ValueError("No match found when setting `actual_instance` in VPSV1MetricsMetricsCollectionRamUsage with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
69
|
+
else:
|
|
70
|
+
return v
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
74
|
+
return cls.from_json(json.dumps(obj))
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_json(cls, json_str: Optional[str]) -> Self:
|
|
78
|
+
"""Returns the object represented by the json string"""
|
|
79
|
+
instance = cls.model_construct()
|
|
80
|
+
if json_str is None:
|
|
81
|
+
return instance
|
|
82
|
+
|
|
83
|
+
error_messages = []
|
|
84
|
+
match = 0
|
|
85
|
+
|
|
86
|
+
# deserialize data into VPSV1MetricsMetricsResource
|
|
87
|
+
try:
|
|
88
|
+
instance.actual_instance = VPSV1MetricsMetricsResource.from_json(json_str)
|
|
89
|
+
match += 1
|
|
90
|
+
except (ValidationError, ValueError) as e:
|
|
91
|
+
error_messages.append(str(e))
|
|
92
|
+
|
|
93
|
+
if match > 1:
|
|
94
|
+
# more than 1 match
|
|
95
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into VPSV1MetricsMetricsCollectionRamUsage with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
96
|
+
elif match == 0:
|
|
97
|
+
# no match
|
|
98
|
+
raise ValueError("No match found when deserializing the JSON string into VPSV1MetricsMetricsCollectionRamUsage with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
99
|
+
else:
|
|
100
|
+
return instance
|
|
101
|
+
|
|
102
|
+
def to_json(self) -> str:
|
|
103
|
+
"""Returns the JSON representation of the actual instance"""
|
|
104
|
+
if self.actual_instance is None:
|
|
105
|
+
return "null"
|
|
106
|
+
|
|
107
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
108
|
+
return self.actual_instance.to_json()
|
|
109
|
+
else:
|
|
110
|
+
return json.dumps(self.actual_instance)
|
|
111
|
+
|
|
112
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], VPSV1MetricsMetricsResource]]:
|
|
113
|
+
"""Returns the dict representation of the actual instance"""
|
|
114
|
+
if self.actual_instance is None:
|
|
115
|
+
return None
|
|
116
|
+
|
|
117
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
118
|
+
return self.actual_instance.to_dict()
|
|
119
|
+
else:
|
|
120
|
+
# primitive type
|
|
121
|
+
return self.actual_instance
|
|
122
|
+
|
|
123
|
+
def to_str(self) -> str:
|
|
124
|
+
"""Returns the string representation of the actual instance"""
|
|
125
|
+
return pprint.pformat(self.model_dump())
|
|
126
|
+
|
|
127
|
+
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import json
|
|
15
|
+
import pprint
|
|
16
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
17
|
+
from typing import Any, List, Optional
|
|
18
|
+
from hostinger_api.models.vpsv1_metrics_metrics_resource import VPSV1MetricsMetricsResource
|
|
19
|
+
from pydantic import StrictStr, Field
|
|
20
|
+
from typing import Union, List, Set, Optional, Dict
|
|
21
|
+
from typing_extensions import Literal, Self
|
|
22
|
+
|
|
23
|
+
VPSV1METRICSMETRICSCOLLECTIONUPTIME_ONE_OF_SCHEMAS = ["VPSV1MetricsMetricsResource"]
|
|
24
|
+
|
|
25
|
+
class VPSV1MetricsMetricsCollectionUptime(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Uptime in milliseconds
|
|
28
|
+
"""
|
|
29
|
+
# data type: VPSV1MetricsMetricsResource
|
|
30
|
+
oneof_schema_1_validator: Optional[VPSV1MetricsMetricsResource] = None
|
|
31
|
+
actual_instance: Optional[Union[VPSV1MetricsMetricsResource]] = None
|
|
32
|
+
one_of_schemas: Set[str] = { "VPSV1MetricsMetricsResource" }
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
41
|
+
if args:
|
|
42
|
+
if len(args) > 1:
|
|
43
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
44
|
+
if kwargs:
|
|
45
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
46
|
+
super().__init__(actual_instance=args[0])
|
|
47
|
+
else:
|
|
48
|
+
super().__init__(**kwargs)
|
|
49
|
+
|
|
50
|
+
@field_validator('actual_instance')
|
|
51
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
52
|
+
if v is None:
|
|
53
|
+
return v
|
|
54
|
+
|
|
55
|
+
instance = VPSV1MetricsMetricsCollectionUptime.model_construct()
|
|
56
|
+
error_messages = []
|
|
57
|
+
match = 0
|
|
58
|
+
# validate data type: VPSV1MetricsMetricsResource
|
|
59
|
+
if not isinstance(v, VPSV1MetricsMetricsResource):
|
|
60
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `VPSV1MetricsMetricsResource`")
|
|
61
|
+
else:
|
|
62
|
+
match += 1
|
|
63
|
+
if match > 1:
|
|
64
|
+
# more than 1 match
|
|
65
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in VPSV1MetricsMetricsCollectionUptime with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
66
|
+
elif match == 0:
|
|
67
|
+
# no match
|
|
68
|
+
raise ValueError("No match found when setting `actual_instance` in VPSV1MetricsMetricsCollectionUptime with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
69
|
+
else:
|
|
70
|
+
return v
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
74
|
+
return cls.from_json(json.dumps(obj))
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_json(cls, json_str: Optional[str]) -> Self:
|
|
78
|
+
"""Returns the object represented by the json string"""
|
|
79
|
+
instance = cls.model_construct()
|
|
80
|
+
if json_str is None:
|
|
81
|
+
return instance
|
|
82
|
+
|
|
83
|
+
error_messages = []
|
|
84
|
+
match = 0
|
|
85
|
+
|
|
86
|
+
# deserialize data into VPSV1MetricsMetricsResource
|
|
87
|
+
try:
|
|
88
|
+
instance.actual_instance = VPSV1MetricsMetricsResource.from_json(json_str)
|
|
89
|
+
match += 1
|
|
90
|
+
except (ValidationError, ValueError) as e:
|
|
91
|
+
error_messages.append(str(e))
|
|
92
|
+
|
|
93
|
+
if match > 1:
|
|
94
|
+
# more than 1 match
|
|
95
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into VPSV1MetricsMetricsCollectionUptime with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
96
|
+
elif match == 0:
|
|
97
|
+
# no match
|
|
98
|
+
raise ValueError("No match found when deserializing the JSON string into VPSV1MetricsMetricsCollectionUptime with oneOf schemas: VPSV1MetricsMetricsResource. Details: " + ", ".join(error_messages))
|
|
99
|
+
else:
|
|
100
|
+
return instance
|
|
101
|
+
|
|
102
|
+
def to_json(self) -> str:
|
|
103
|
+
"""Returns the JSON representation of the actual instance"""
|
|
104
|
+
if self.actual_instance is None:
|
|
105
|
+
return "null"
|
|
106
|
+
|
|
107
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
108
|
+
return self.actual_instance.to_json()
|
|
109
|
+
else:
|
|
110
|
+
return json.dumps(self.actual_instance)
|
|
111
|
+
|
|
112
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], VPSV1MetricsMetricsResource]]:
|
|
113
|
+
"""Returns the dict representation of the actual instance"""
|
|
114
|
+
if self.actual_instance is None:
|
|
115
|
+
return None
|
|
116
|
+
|
|
117
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
118
|
+
return self.actual_instance.to_dict()
|
|
119
|
+
else:
|
|
120
|
+
# primitive type
|
|
121
|
+
return self.actual_instance
|
|
122
|
+
|
|
123
|
+
def to_str(self) -> str:
|
|
124
|
+
"""Returns the string representation of the actual instance"""
|
|
125
|
+
return pprint.pformat(self.model_dump())
|
|
126
|
+
|
|
127
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import pprint
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
20
|
+
from typing import Optional, Set
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
class VPSV1MetricsMetricsResource(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
VPSV1MetricsMetricsResource
|
|
26
|
+
""" # noqa: E501
|
|
27
|
+
unit: Optional[StrictStr] = Field(default=None, description="Measurement unit")
|
|
28
|
+
usage: Optional[Dict[str, Any]] = Field(default=None, description="Object, containing UNIX timestamps as a key and measurement as a value.")
|
|
29
|
+
__properties: ClassVar[List[str]] = ["unit", "usage"]
|
|
30
|
+
|
|
31
|
+
model_config = ConfigDict(
|
|
32
|
+
populate_by_name=True,
|
|
33
|
+
validate_assignment=True,
|
|
34
|
+
protected_namespaces=(),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def to_str(self) -> str:
|
|
39
|
+
"""Returns the string representation of the model using alias"""
|
|
40
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
41
|
+
|
|
42
|
+
def to_json(self) -> str:
|
|
43
|
+
"""Returns the JSON representation of the model using alias"""
|
|
44
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
45
|
+
return json.dumps(self.to_dict())
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
49
|
+
"""Create an instance of VPSV1MetricsMetricsResource from a JSON string"""
|
|
50
|
+
return cls.from_dict(json.loads(json_str))
|
|
51
|
+
|
|
52
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
53
|
+
"""Return the dictionary representation of the model using alias.
|
|
54
|
+
|
|
55
|
+
This has the following differences from calling pydantic's
|
|
56
|
+
`self.model_dump(by_alias=True)`:
|
|
57
|
+
|
|
58
|
+
* `None` is only added to the output dict for nullable fields that
|
|
59
|
+
were set at model initialization. Other fields with value `None`
|
|
60
|
+
are ignored.
|
|
61
|
+
"""
|
|
62
|
+
excluded_fields: Set[str] = set([
|
|
63
|
+
])
|
|
64
|
+
|
|
65
|
+
_dict = self.model_dump(
|
|
66
|
+
by_alias=True,
|
|
67
|
+
exclude=excluded_fields,
|
|
68
|
+
exclude_none=True,
|
|
69
|
+
)
|
|
70
|
+
return _dict
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
74
|
+
"""Create an instance of VPSV1MetricsMetricsResource from a dict"""
|
|
75
|
+
if obj is None:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
if not isinstance(obj, dict):
|
|
79
|
+
return cls.model_validate(obj)
|
|
80
|
+
|
|
81
|
+
_obj = cls.model_validate({
|
|
82
|
+
"unit": obj.get("unit"),
|
|
83
|
+
"usage": obj.get("usage")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import pprint
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from datetime import datetime
|
|
19
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
20
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
21
|
+
from typing import Optional, Set
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
class VPSV1PostInstallScriptPostInstallScriptResource(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
VPSV1PostInstallScriptPostInstallScriptResource
|
|
27
|
+
""" # noqa: E501
|
|
28
|
+
id: Optional[StrictInt] = Field(default=None, description="Post-install script ID")
|
|
29
|
+
name: Optional[StrictStr] = Field(default=None, description="Name of the script")
|
|
30
|
+
content: Optional[StrictStr] = Field(default=None, description="Content of the script")
|
|
31
|
+
created_at: Optional[datetime] = None
|
|
32
|
+
updated_at: Optional[datetime] = None
|
|
33
|
+
__properties: ClassVar[List[str]] = ["id", "name", "content", "created_at", "updated_at"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of VPSV1PostInstallScriptPostInstallScriptResource from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
return _dict
|
|
75
|
+
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
78
|
+
"""Create an instance of VPSV1PostInstallScriptPostInstallScriptResource from a dict"""
|
|
79
|
+
if obj is None:
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
if not isinstance(obj, dict):
|
|
83
|
+
return cls.model_validate(obj)
|
|
84
|
+
|
|
85
|
+
_obj = cls.model_validate({
|
|
86
|
+
"id": obj.get("id"),
|
|
87
|
+
"name": obj.get("name"),
|
|
88
|
+
"content": obj.get("content"),
|
|
89
|
+
"created_at": obj.get("created_at"),
|
|
90
|
+
"updated_at": obj.get("updated_at")
|
|
91
|
+
})
|
|
92
|
+
return _obj
|
|
93
|
+
|
|
94
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
import pprint
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
import json
|
|
17
|
+
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
19
|
+
from typing import Any, ClassVar, Dict, List
|
|
20
|
+
from typing import Optional, Set
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
class VPSV1PostInstallScriptStoreRequest(BaseModel):
|
|
24
|
+
"""
|
|
25
|
+
VPSV1PostInstallScriptStoreRequest
|
|
26
|
+
""" # noqa: E501
|
|
27
|
+
name: StrictStr = Field(description="Name of the script")
|
|
28
|
+
content: StrictStr = Field(description="Content of the script")
|
|
29
|
+
__properties: ClassVar[List[str]] = ["name", "content"]
|
|
30
|
+
|
|
31
|
+
model_config = ConfigDict(
|
|
32
|
+
populate_by_name=True,
|
|
33
|
+
validate_assignment=True,
|
|
34
|
+
protected_namespaces=(),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def to_str(self) -> str:
|
|
39
|
+
"""Returns the string representation of the model using alias"""
|
|
40
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
41
|
+
|
|
42
|
+
def to_json(self) -> str:
|
|
43
|
+
"""Returns the JSON representation of the model using alias"""
|
|
44
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
45
|
+
return json.dumps(self.to_dict())
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
49
|
+
"""Create an instance of VPSV1PostInstallScriptStoreRequest from a JSON string"""
|
|
50
|
+
return cls.from_dict(json.loads(json_str))
|
|
51
|
+
|
|
52
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
53
|
+
"""Return the dictionary representation of the model using alias.
|
|
54
|
+
|
|
55
|
+
This has the following differences from calling pydantic's
|
|
56
|
+
`self.model_dump(by_alias=True)`:
|
|
57
|
+
|
|
58
|
+
* `None` is only added to the output dict for nullable fields that
|
|
59
|
+
were set at model initialization. Other fields with value `None`
|
|
60
|
+
are ignored.
|
|
61
|
+
"""
|
|
62
|
+
excluded_fields: Set[str] = set([
|
|
63
|
+
])
|
|
64
|
+
|
|
65
|
+
_dict = self.model_dump(
|
|
66
|
+
by_alias=True,
|
|
67
|
+
exclude=excluded_fields,
|
|
68
|
+
exclude_none=True,
|
|
69
|
+
)
|
|
70
|
+
return _dict
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
74
|
+
"""Create an instance of VPSV1PostInstallScriptStoreRequest from a dict"""
|
|
75
|
+
if obj is None:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
if not isinstance(obj, dict):
|
|
79
|
+
return cls.model_validate(obj)
|
|
80
|
+
|
|
81
|
+
_obj = cls.model_validate({
|
|
82
|
+
"name": obj.get("name"),
|
|
83
|
+
"content": obj.get("content")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|