hyperstack 1.43.0a0__py3-none-any.whl → 1.46.1a0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. hyperstack/__init__.py +7 -2
  2. hyperstack/api/__init__.py +2 -1
  3. hyperstack/api/alive_api.py +10 -10
  4. hyperstack/api/api_key_api.py +7 -7
  5. hyperstack/api/auth_api.py +69 -69
  6. hyperstack/api/beta_access_api.py +50 -50
  7. hyperstack/api/billing_api.py +1659 -1659
  8. hyperstack/api/calculate_api.py +7 -7
  9. hyperstack/api/callbacks_api.py +21 -21
  10. hyperstack/api/cluster_events_api.py +7 -7
  11. hyperstack/api/clusters_api.py +669 -370
  12. hyperstack/api/compliance_api.py +21 -21
  13. hyperstack/api/credit_api.py +7 -7
  14. hyperstack/api/customer_contract_api.py +139 -139
  15. hyperstack/api/dashboard_api.py +7 -7
  16. hyperstack/api/deployment_api.py +7 -7
  17. hyperstack/api/environment_api.py +107 -107
  18. hyperstack/api/{admin_api.py → fip_exclusions_api.py} +44 -28
  19. hyperstack/api/firewall_attachment_api.py +7 -7
  20. hyperstack/api/firewalls_api.py +145 -145
  21. hyperstack/api/floating_ip_api.py +14 -14
  22. hyperstack/api/image_api.py +14 -14
  23. hyperstack/api/payment_api.py +102 -102
  24. hyperstack/api/profile_api.py +56 -56
  25. hyperstack/api/snapshot_events_api.py +7 -7
  26. hyperstack/api/snapshots_api.py +167 -167
  27. hyperstack/api/stock_api.py +7 -7
  28. hyperstack/api/template_api.py +76 -76
  29. hyperstack/api/user_api.py +76 -76
  30. hyperstack/api/user_detail_choice_api.py +10 -10
  31. hyperstack/api/virtual_machine_api.py +799 -782
  32. hyperstack/api/virtual_machine_events_api.py +7 -7
  33. hyperstack/api/vnc_url_api.py +53 -53
  34. hyperstack/api/volume_api.py +77 -77
  35. hyperstack/api/volume_attachment_api.py +21 -21
  36. hyperstack/api/vouchers_api.py +326 -0
  37. hyperstack/api_client.py +1 -1
  38. hyperstack/configuration.py +1 -1
  39. hyperstack/models/__init__.py +4 -0
  40. hyperstack/models/delete_cluster_nodes_fields.py +87 -0
  41. hyperstack/models/redeem_voucher_payload.py +87 -0
  42. hyperstack/models/voucher.py +91 -0
  43. hyperstack/models/voucher_redeem_response_schema.py +95 -0
  44. {hyperstack-1.43.0a0.dist-info → hyperstack-1.46.1a0.dist-info}/METADATA +1 -1
  45. {hyperstack-1.43.0a0.dist-info → hyperstack-1.46.1a0.dist-info}/RECORD +47 -42
  46. {hyperstack-1.43.0a0.dist-info → hyperstack-1.46.1a0.dist-info}/WHEEL +0 -0
  47. {hyperstack-1.43.0a0.dist-info → hyperstack-1.46.1a0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,326 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Infrahub-API
5
+
6
+ Leverage the Infrahub API and Hyperstack platform to easily create, manage, and scale powerful GPU virtual machines and their associated resources. Access this SDK to automate the deployment of your workloads and streamline your infrastructure management. To contribute, please raise an issue with a bug report, feature request, feedback, or general inquiry.
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from ..models.redeem_voucher_payload import RedeemVoucherPayload
20
+ from ..models.voucher_redeem_response_schema import VoucherRedeemResponseSchema
21
+
22
+ from ..api_client import ApiClient, RequestSerialized
23
+ from ..api_response import ApiResponse
24
+ from ..rest import RESTResponseType
25
+
26
+
27
+ class VouchersApi:
28
+ """NOTE: This class is auto generated by OpenAPI Generator
29
+ Ref: https://openapi-generator.tech
30
+
31
+ Do not edit the class manually.
32
+ """
33
+
34
+ def __init__(self, api_client=None) -> None:
35
+ if api_client is None:
36
+ api_client = ApiClient.get_default()
37
+ self.api_client = api_client
38
+
39
+
40
+ @validate_call
41
+ def redeem_a_voucher(
42
+ self,
43
+ payload: RedeemVoucherPayload,
44
+ _request_timeout: Union[
45
+ None,
46
+ Annotated[StrictFloat, Field(gt=0)],
47
+ Tuple[
48
+ Annotated[StrictFloat, Field(gt=0)],
49
+ Annotated[StrictFloat, Field(gt=0)]
50
+ ]
51
+ ] = None,
52
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
53
+ _content_type: Optional[StrictStr] = None,
54
+ _headers: Optional[Dict[StrictStr, Any]] = None,
55
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
56
+ ) -> VoucherRedeemResponseSchema:
57
+ """Redeem a voucher with a voucher_code
58
+
59
+ Request to redeem a voucher with a voucher code.
60
+
61
+ :param payload: (required)
62
+ :type payload: RedeemVoucherPayload
63
+ :param _request_timeout: timeout setting for this request. If one
64
+ number provided, it will be total request
65
+ timeout. It can also be a pair (tuple) of
66
+ (connection, read) timeouts.
67
+ :type _request_timeout: int, tuple(int, int), optional
68
+ :param _request_auth: set to override the auth_settings for an a single
69
+ request; this effectively ignores the
70
+ authentication in the spec for a single request.
71
+ :type _request_auth: dict, optional
72
+ :param _content_type: force content-type for the request.
73
+ :type _content_type: str, Optional
74
+ :param _headers: set to override the headers for a single
75
+ request; this effectively ignores the headers
76
+ in the spec for a single request.
77
+ :type _headers: dict, optional
78
+ :param _host_index: set to override the host_index for a single
79
+ request; this effectively ignores the host_index
80
+ in the spec for a single request.
81
+ :type _host_index: int, optional
82
+ :return: Returns the result object.
83
+ """ # noqa: E501
84
+
85
+ _param = self._redeem_a_voucher_serialize(
86
+ payload=payload,
87
+ _request_auth=_request_auth,
88
+ _content_type=_content_type,
89
+ _headers=_headers,
90
+ _host_index=_host_index
91
+ )
92
+
93
+ _response_types_map: Dict[str, Optional[str]] = {
94
+ '200': "VoucherRedeemResponseSchema",
95
+ '400': "ErrorResponseModel",
96
+ '401': "ErrorResponseModel",
97
+ '403': "ErrorResponseModel",
98
+ '404': "ErrorResponseModel",
99
+ '500': None,
100
+ }
101
+ response_data = self.api_client.call_api(
102
+ *_param,
103
+ _request_timeout=_request_timeout
104
+ )
105
+ response_data.read()
106
+ return self.api_client.response_deserialize(
107
+ response_data=response_data,
108
+ response_types_map=_response_types_map,
109
+ ).data
110
+
111
+
112
+ @validate_call
113
+ def redeem_a_voucher_with_http_info(
114
+ self,
115
+ payload: RedeemVoucherPayload,
116
+ _request_timeout: Union[
117
+ None,
118
+ Annotated[StrictFloat, Field(gt=0)],
119
+ Tuple[
120
+ Annotated[StrictFloat, Field(gt=0)],
121
+ Annotated[StrictFloat, Field(gt=0)]
122
+ ]
123
+ ] = None,
124
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
125
+ _content_type: Optional[StrictStr] = None,
126
+ _headers: Optional[Dict[StrictStr, Any]] = None,
127
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
128
+ ) -> ApiResponse[VoucherRedeemResponseSchema]:
129
+ """Redeem a voucher with a voucher_code
130
+
131
+ Request to redeem a voucher with a voucher code.
132
+
133
+ :param payload: (required)
134
+ :type payload: RedeemVoucherPayload
135
+ :param _request_timeout: timeout setting for this request. If one
136
+ number provided, it will be total request
137
+ timeout. It can also be a pair (tuple) of
138
+ (connection, read) timeouts.
139
+ :type _request_timeout: int, tuple(int, int), optional
140
+ :param _request_auth: set to override the auth_settings for an a single
141
+ request; this effectively ignores the
142
+ authentication in the spec for a single request.
143
+ :type _request_auth: dict, optional
144
+ :param _content_type: force content-type for the request.
145
+ :type _content_type: str, Optional
146
+ :param _headers: set to override the headers for a single
147
+ request; this effectively ignores the headers
148
+ in the spec for a single request.
149
+ :type _headers: dict, optional
150
+ :param _host_index: set to override the host_index for a single
151
+ request; this effectively ignores the host_index
152
+ in the spec for a single request.
153
+ :type _host_index: int, optional
154
+ :return: Returns the result object.
155
+ """ # noqa: E501
156
+
157
+ _param = self._redeem_a_voucher_serialize(
158
+ payload=payload,
159
+ _request_auth=_request_auth,
160
+ _content_type=_content_type,
161
+ _headers=_headers,
162
+ _host_index=_host_index
163
+ )
164
+
165
+ _response_types_map: Dict[str, Optional[str]] = {
166
+ '200': "VoucherRedeemResponseSchema",
167
+ '400': "ErrorResponseModel",
168
+ '401': "ErrorResponseModel",
169
+ '403': "ErrorResponseModel",
170
+ '404': "ErrorResponseModel",
171
+ '500': None,
172
+ }
173
+ response_data = self.api_client.call_api(
174
+ *_param,
175
+ _request_timeout=_request_timeout
176
+ )
177
+ response_data.read()
178
+ return self.api_client.response_deserialize(
179
+ response_data=response_data,
180
+ response_types_map=_response_types_map,
181
+ )
182
+
183
+
184
+ @validate_call
185
+ def redeem_a_voucher_without_preload_content(
186
+ self,
187
+ payload: RedeemVoucherPayload,
188
+ _request_timeout: Union[
189
+ None,
190
+ Annotated[StrictFloat, Field(gt=0)],
191
+ Tuple[
192
+ Annotated[StrictFloat, Field(gt=0)],
193
+ Annotated[StrictFloat, Field(gt=0)]
194
+ ]
195
+ ] = None,
196
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
197
+ _content_type: Optional[StrictStr] = None,
198
+ _headers: Optional[Dict[StrictStr, Any]] = None,
199
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
200
+ ) -> RESTResponseType:
201
+ """Redeem a voucher with a voucher_code
202
+
203
+ Request to redeem a voucher with a voucher code.
204
+
205
+ :param payload: (required)
206
+ :type payload: RedeemVoucherPayload
207
+ :param _request_timeout: timeout setting for this request. If one
208
+ number provided, it will be total request
209
+ timeout. It can also be a pair (tuple) of
210
+ (connection, read) timeouts.
211
+ :type _request_timeout: int, tuple(int, int), optional
212
+ :param _request_auth: set to override the auth_settings for an a single
213
+ request; this effectively ignores the
214
+ authentication in the spec for a single request.
215
+ :type _request_auth: dict, optional
216
+ :param _content_type: force content-type for the request.
217
+ :type _content_type: str, Optional
218
+ :param _headers: set to override the headers for a single
219
+ request; this effectively ignores the headers
220
+ in the spec for a single request.
221
+ :type _headers: dict, optional
222
+ :param _host_index: set to override the host_index for a single
223
+ request; this effectively ignores the host_index
224
+ in the spec for a single request.
225
+ :type _host_index: int, optional
226
+ :return: Returns the result object.
227
+ """ # noqa: E501
228
+
229
+ _param = self._redeem_a_voucher_serialize(
230
+ payload=payload,
231
+ _request_auth=_request_auth,
232
+ _content_type=_content_type,
233
+ _headers=_headers,
234
+ _host_index=_host_index
235
+ )
236
+
237
+ _response_types_map: Dict[str, Optional[str]] = {
238
+ '200': "VoucherRedeemResponseSchema",
239
+ '400': "ErrorResponseModel",
240
+ '401': "ErrorResponseModel",
241
+ '403': "ErrorResponseModel",
242
+ '404': "ErrorResponseModel",
243
+ '500': None,
244
+ }
245
+ response_data = self.api_client.call_api(
246
+ *_param,
247
+ _request_timeout=_request_timeout
248
+ )
249
+ return response_data.response
250
+
251
+
252
+ def _redeem_a_voucher_serialize(
253
+ self,
254
+ payload,
255
+ _request_auth,
256
+ _content_type,
257
+ _headers,
258
+ _host_index,
259
+ ) -> RequestSerialized:
260
+
261
+ _host = None
262
+
263
+ _collection_formats: Dict[str, str] = {
264
+ }
265
+
266
+ _path_params: Dict[str, str] = {}
267
+ _query_params: List[Tuple[str, str]] = []
268
+ _header_params: Dict[str, Optional[str]] = _headers or {}
269
+ _form_params: List[Tuple[str, str]] = []
270
+ _files: Dict[
271
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
272
+ ] = {}
273
+ _body_params: Optional[bytes] = None
274
+
275
+ # process the path parameters
276
+ # process the query parameters
277
+ # process the header parameters
278
+ # process the form parameters
279
+ # process the body parameter
280
+ if payload is not None:
281
+ _body_params = payload
282
+
283
+
284
+ # set the HTTP header `Accept`
285
+ if 'Accept' not in _header_params:
286
+ _header_params['Accept'] = self.api_client.select_header_accept(
287
+ [
288
+ 'application/json'
289
+ ]
290
+ )
291
+
292
+ # set the HTTP header `Content-Type`
293
+ if _content_type:
294
+ _header_params['Content-Type'] = _content_type
295
+ else:
296
+ _default_content_type = (
297
+ self.api_client.select_header_content_type(
298
+ [
299
+ 'application/json'
300
+ ]
301
+ )
302
+ )
303
+ if _default_content_type is not None:
304
+ _header_params['Content-Type'] = _default_content_type
305
+
306
+ # authentication setting
307
+ _auth_settings: List[str] = [
308
+ 'apiKey'
309
+ ]
310
+
311
+ return self.api_client.param_serialize(
312
+ method='POST',
313
+ resource_path='/billing/billing/vouchers/redeem',
314
+ path_params=_path_params,
315
+ query_params=_query_params,
316
+ header_params=_header_params,
317
+ body=_body_params,
318
+ post_params=_form_params,
319
+ files=_files,
320
+ auth_settings=_auth_settings,
321
+ collection_formats=_collection_formats,
322
+ _host=_host,
323
+ _request_auth=_request_auth
324
+ )
325
+
326
+
hyperstack/api_client.py CHANGED
@@ -90,7 +90,7 @@ class ApiClient:
90
90
  self.default_headers[header_name] = header_value
91
91
  self.cookie = cookie
92
92
  # Set default User-Agent.
93
- self.user_agent = 'OpenAPI-Generator/v1.43.0-alpha/python'
93
+ self.user_agent = 'OpenAPI-Generator/v1.46.1-alpha/python'
94
94
  self.client_side_validation = configuration.client_side_validation
95
95
 
96
96
  def __enter__(self):
@@ -524,7 +524,7 @@ conf = hyperstack.Configuration(
524
524
  "OS: {env}\n"\
525
525
  "Python Version: {pyversion}\n"\
526
526
  "Version of the API: 1.0\n"\
527
- "SDK Package Version: v1.43.0-alpha".\
527
+ "SDK Package Version: v1.46.1-alpha".\
528
528
  format(env=sys.platform, pyversion=sys.version)
529
529
 
530
530
  def get_host_settings(self) -> List[HostSetting]:
@@ -93,6 +93,7 @@ from .customer_contract_detail_response_model import CustomerContractDetailRespo
93
93
  from .customer_contract_fields import CustomerContractFields
94
94
  from .dashboard_info_response import DashboardInfoResponse
95
95
  from .data_synthesis_billing_history_details_response_schema import DataSynthesisBillingHistoryDetailsResponseSchema
96
+ from .delete_cluster_nodes_fields import DeleteClusterNodesFields
96
97
  from .deployment_fields import DeploymentFields
97
98
  from .deployment_fields_for_start_deployments import DeploymentFieldsForStartDeployments
98
99
  from .deployments import Deployments
@@ -209,6 +210,7 @@ from .rbac_role_detail_response_model import RbacRoleDetailResponseModel
209
210
  from .rbac_role_detail_response_model_fixed import RbacRoleDetailResponseModelFixed
210
211
  from .rbac_role_field import RbacRoleField
211
212
  from .rbac_role_fields import RbacRoleFields
213
+ from .redeem_voucher_payload import RedeemVoucherPayload
212
214
  from .region_fields import RegionFields
213
215
  from .regions import Regions
214
216
  from .remove_member_from_organization_response_model import RemoveMemberFromOrganizationResponseModel
@@ -305,4 +307,6 @@ from .volume_overview_fields import VolumeOverviewFields
305
307
  from .volume_types import VolumeTypes
306
308
  from .volumes import Volumes
307
309
  from .volumes_fields import VolumesFields
310
+ from .voucher import Voucher
311
+ from .voucher_redeem_response_schema import VoucherRedeemResponseSchema
308
312
  from .workload_billing_history_response import WorkloadBillingHistoryResponse
@@ -0,0 +1,87 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Infrahub-API
5
+
6
+ Leverage the Infrahub API and Hyperstack platform to easily create, manage, and scale powerful GPU virtual machines and their associated resources. Access this SDK to automate the deployment of your workloads and streamline your infrastructure management. To contribute, please raise an issue with a bug report, feature request, feedback, or general inquiry.
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictInt
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class DeleteClusterNodesFields(BaseModel):
26
+ """
27
+ DeleteClusterNodesFields
28
+ """ # noqa: E501
29
+ ids: Optional[List[StrictInt]] = None
30
+ __properties: ClassVar[List[str]] = ["ids"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
37
+
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of DeleteClusterNodesFields from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([
64
+ ])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of DeleteClusterNodesFields from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({
83
+ "ids": obj.get("ids")
84
+ })
85
+ return _obj
86
+
87
+
@@ -0,0 +1,87 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Infrahub-API
5
+
6
+ Leverage the Infrahub API and Hyperstack platform to easily create, manage, and scale powerful GPU virtual machines and their associated resources. Access this SDK to automate the deployment of your workloads and streamline your infrastructure management. To contribute, please raise an issue with a bug report, feature request, feedback, or general inquiry.
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class RedeemVoucherPayload(BaseModel):
26
+ """
27
+ RedeemVoucherPayload
28
+ """ # noqa: E501
29
+ voucher_code: StrictStr = Field(description="The code of the voucher you want to redeem.")
30
+ __properties: ClassVar[List[str]] = ["voucher_code"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
37
+
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of RedeemVoucherPayload from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([
64
+ ])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of RedeemVoucherPayload from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({
83
+ "voucher_code": obj.get("voucher_code")
84
+ })
85
+ return _obj
86
+
87
+
@@ -0,0 +1,91 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Infrahub-API
5
+
6
+ Leverage the Infrahub API and Hyperstack platform to easily create, manage, and scale powerful GPU virtual machines and their associated resources. Access this SDK to automate the deployment of your workloads and streamline your infrastructure management. To contribute, please raise an issue with a bug report, feature request, feedback, or general inquiry.
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class Voucher(BaseModel):
26
+ """
27
+ Voucher
28
+ """ # noqa: E501
29
+ code: StrictStr = Field(description="Voucher code")
30
+ id: StrictInt = Field(description="Voucher ID")
31
+ status: StrictStr = Field(description="Voucher status")
32
+ __properties: ClassVar[List[str]] = ["code", "id", "status"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of Voucher from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
+ """Create an instance of Voucher from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate({
85
+ "code": obj.get("code"),
86
+ "id": obj.get("id"),
87
+ "status": obj.get("status")
88
+ })
89
+ return _obj
90
+
91
+