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,101 @@
|
|
|
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
|
|
20
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
21
|
+
from typing import Optional, Set
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
class VPSV1MalwareMetricsResource(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
VPSV1MalwareMetricsResource
|
|
27
|
+
""" # noqa: E501
|
|
28
|
+
records: Optional[StrictInt] = Field(default=None, description="Records found during last scan")
|
|
29
|
+
malicious: Optional[StrictInt] = Field(default=None, description="Malicious files found during last scan")
|
|
30
|
+
compromised: Optional[StrictInt] = Field(default=None, description="Compromised files found during last scan")
|
|
31
|
+
scanned_files: Optional[StrictInt] = Field(default=None, description="Total number of files scanned during last scan")
|
|
32
|
+
scan_started_at: Optional[datetime] = None
|
|
33
|
+
scan_ended_at: Optional[datetime] = None
|
|
34
|
+
__properties: ClassVar[List[str]] = ["records", "malicious", "compromised", "scanned_files", "scan_started_at", "scan_ended_at"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of VPSV1MalwareMetricsResource from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# set to None if scan_ended_at (nullable) is None
|
|
76
|
+
# and model_fields_set contains the field
|
|
77
|
+
if self.scan_ended_at is None and "scan_ended_at" in self.model_fields_set:
|
|
78
|
+
_dict['scan_ended_at'] = None
|
|
79
|
+
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of VPSV1MalwareMetricsResource from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({
|
|
92
|
+
"records": obj.get("records"),
|
|
93
|
+
"malicious": obj.get("malicious"),
|
|
94
|
+
"compromised": obj.get("compromised"),
|
|
95
|
+
"scanned_files": obj.get("scanned_files"),
|
|
96
|
+
"scan_started_at": obj.get("scan_started_at"),
|
|
97
|
+
"scan_ended_at": obj.get("scan_ended_at")
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -0,0 +1,149 @@
|
|
|
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
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
20
|
+
from hostinger_api.models.vpsv1_metrics_metrics_collection_cpu_usage import VPSV1MetricsMetricsCollectionCpuUsage
|
|
21
|
+
from hostinger_api.models.vpsv1_metrics_metrics_collection_disk_space import VPSV1MetricsMetricsCollectionDiskSpace
|
|
22
|
+
from hostinger_api.models.vpsv1_metrics_metrics_collection_incoming_traffic import VPSV1MetricsMetricsCollectionIncomingTraffic
|
|
23
|
+
from hostinger_api.models.vpsv1_metrics_metrics_collection_outgoing_traffic import VPSV1MetricsMetricsCollectionOutgoingTraffic
|
|
24
|
+
from hostinger_api.models.vpsv1_metrics_metrics_collection_ram_usage import VPSV1MetricsMetricsCollectionRamUsage
|
|
25
|
+
from hostinger_api.models.vpsv1_metrics_metrics_collection_uptime import VPSV1MetricsMetricsCollectionUptime
|
|
26
|
+
from typing import Optional, Set
|
|
27
|
+
from typing_extensions import Self
|
|
28
|
+
|
|
29
|
+
class VPSV1MetricsMetricsCollection(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
VPSV1MetricsMetricsCollection
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
cpu_usage: Optional[VPSV1MetricsMetricsCollectionCpuUsage] = None
|
|
34
|
+
ram_usage: Optional[VPSV1MetricsMetricsCollectionRamUsage] = None
|
|
35
|
+
disk_space: Optional[VPSV1MetricsMetricsCollectionDiskSpace] = None
|
|
36
|
+
outgoing_traffic: Optional[VPSV1MetricsMetricsCollectionOutgoingTraffic] = None
|
|
37
|
+
incoming_traffic: Optional[VPSV1MetricsMetricsCollectionIncomingTraffic] = None
|
|
38
|
+
uptime: Optional[VPSV1MetricsMetricsCollectionUptime] = None
|
|
39
|
+
__properties: ClassVar[List[str]] = ["cpu_usage", "ram_usage", "disk_space", "outgoing_traffic", "incoming_traffic", "uptime"]
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of VPSV1MetricsMetricsCollection from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of cpu_usage
|
|
81
|
+
if self.cpu_usage:
|
|
82
|
+
_dict['cpu_usage'] = self.cpu_usage.to_dict()
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of ram_usage
|
|
84
|
+
if self.ram_usage:
|
|
85
|
+
_dict['ram_usage'] = self.ram_usage.to_dict()
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of disk_space
|
|
87
|
+
if self.disk_space:
|
|
88
|
+
_dict['disk_space'] = self.disk_space.to_dict()
|
|
89
|
+
# override the default output from pydantic by calling `to_dict()` of outgoing_traffic
|
|
90
|
+
if self.outgoing_traffic:
|
|
91
|
+
_dict['outgoing_traffic'] = self.outgoing_traffic.to_dict()
|
|
92
|
+
# override the default output from pydantic by calling `to_dict()` of incoming_traffic
|
|
93
|
+
if self.incoming_traffic:
|
|
94
|
+
_dict['incoming_traffic'] = self.incoming_traffic.to_dict()
|
|
95
|
+
# override the default output from pydantic by calling `to_dict()` of uptime
|
|
96
|
+
if self.uptime:
|
|
97
|
+
_dict['uptime'] = self.uptime.to_dict()
|
|
98
|
+
# set to None if cpu_usage (nullable) is None
|
|
99
|
+
# and model_fields_set contains the field
|
|
100
|
+
if self.cpu_usage is None and "cpu_usage" in self.model_fields_set:
|
|
101
|
+
_dict['cpu_usage'] = None
|
|
102
|
+
|
|
103
|
+
# set to None if ram_usage (nullable) is None
|
|
104
|
+
# and model_fields_set contains the field
|
|
105
|
+
if self.ram_usage is None and "ram_usage" in self.model_fields_set:
|
|
106
|
+
_dict['ram_usage'] = None
|
|
107
|
+
|
|
108
|
+
# set to None if disk_space (nullable) is None
|
|
109
|
+
# and model_fields_set contains the field
|
|
110
|
+
if self.disk_space is None and "disk_space" in self.model_fields_set:
|
|
111
|
+
_dict['disk_space'] = None
|
|
112
|
+
|
|
113
|
+
# set to None if outgoing_traffic (nullable) is None
|
|
114
|
+
# and model_fields_set contains the field
|
|
115
|
+
if self.outgoing_traffic is None and "outgoing_traffic" in self.model_fields_set:
|
|
116
|
+
_dict['outgoing_traffic'] = None
|
|
117
|
+
|
|
118
|
+
# set to None if incoming_traffic (nullable) is None
|
|
119
|
+
# and model_fields_set contains the field
|
|
120
|
+
if self.incoming_traffic is None and "incoming_traffic" in self.model_fields_set:
|
|
121
|
+
_dict['incoming_traffic'] = None
|
|
122
|
+
|
|
123
|
+
# set to None if uptime (nullable) is None
|
|
124
|
+
# and model_fields_set contains the field
|
|
125
|
+
if self.uptime is None and "uptime" in self.model_fields_set:
|
|
126
|
+
_dict['uptime'] = None
|
|
127
|
+
|
|
128
|
+
return _dict
|
|
129
|
+
|
|
130
|
+
@classmethod
|
|
131
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
132
|
+
"""Create an instance of VPSV1MetricsMetricsCollection from a dict"""
|
|
133
|
+
if obj is None:
|
|
134
|
+
return None
|
|
135
|
+
|
|
136
|
+
if not isinstance(obj, dict):
|
|
137
|
+
return cls.model_validate(obj)
|
|
138
|
+
|
|
139
|
+
_obj = cls.model_validate({
|
|
140
|
+
"cpu_usage": VPSV1MetricsMetricsCollectionCpuUsage.from_dict(obj["cpu_usage"]) if obj.get("cpu_usage") is not None else None,
|
|
141
|
+
"ram_usage": VPSV1MetricsMetricsCollectionRamUsage.from_dict(obj["ram_usage"]) if obj.get("ram_usage") is not None else None,
|
|
142
|
+
"disk_space": VPSV1MetricsMetricsCollectionDiskSpace.from_dict(obj["disk_space"]) if obj.get("disk_space") is not None else None,
|
|
143
|
+
"outgoing_traffic": VPSV1MetricsMetricsCollectionOutgoingTraffic.from_dict(obj["outgoing_traffic"]) if obj.get("outgoing_traffic") is not None else None,
|
|
144
|
+
"incoming_traffic": VPSV1MetricsMetricsCollectionIncomingTraffic.from_dict(obj["incoming_traffic"]) if obj.get("incoming_traffic") is not None else None,
|
|
145
|
+
"uptime": VPSV1MetricsMetricsCollectionUptime.from_dict(obj["uptime"]) if obj.get("uptime") is not None else None
|
|
146
|
+
})
|
|
147
|
+
return _obj
|
|
148
|
+
|
|
149
|
+
|
|
@@ -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
|
+
VPSV1METRICSMETRICSCOLLECTIONCPUUSAGE_ONE_OF_SCHEMAS = ["VPSV1MetricsMetricsResource"]
|
|
24
|
+
|
|
25
|
+
class VPSV1MetricsMetricsCollectionCpuUsage(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
CPU usage in percentage, 0 - 100%
|
|
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 = VPSV1MetricsMetricsCollectionCpuUsage.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 VPSV1MetricsMetricsCollectionCpuUsage 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 VPSV1MetricsMetricsCollectionCpuUsage 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 VPSV1MetricsMetricsCollectionCpuUsage 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 VPSV1MetricsMetricsCollectionCpuUsage 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
|
+
VPSV1METRICSMETRICSCOLLECTIONDISKSPACE_ONE_OF_SCHEMAS = ["VPSV1MetricsMetricsResource"]
|
|
24
|
+
|
|
25
|
+
class VPSV1MetricsMetricsCollectionDiskSpace(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Disk space 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 = VPSV1MetricsMetricsCollectionDiskSpace.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 VPSV1MetricsMetricsCollectionDiskSpace 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 VPSV1MetricsMetricsCollectionDiskSpace 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 VPSV1MetricsMetricsCollectionDiskSpace 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 VPSV1MetricsMetricsCollectionDiskSpace 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
|
+
VPSV1METRICSMETRICSCOLLECTIONINCOMINGTRAFFIC_ONE_OF_SCHEMAS = ["VPSV1MetricsMetricsResource"]
|
|
24
|
+
|
|
25
|
+
class VPSV1MetricsMetricsCollectionIncomingTraffic(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Incoming 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 = VPSV1MetricsMetricsCollectionIncomingTraffic.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 VPSV1MetricsMetricsCollectionIncomingTraffic 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 VPSV1MetricsMetricsCollectionIncomingTraffic 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 VPSV1MetricsMetricsCollectionIncomingTraffic 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 VPSV1MetricsMetricsCollectionIncomingTraffic 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
|
+
|