mithril-client 0.1.0a1__cp314-cp314-macosx_11_0_arm64.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 (163) hide show
  1. mithril/__init__.py +7 -0
  2. mithril/_mcli.cpython-314-darwin.so +0 -0
  3. mithril/_mcli.pyi +7 -0
  4. mithril/_mcli_entry.py +75 -0
  5. mithril/api/__init__.py +7 -0
  6. mithril/api/bindings/.gitattributes +2 -0
  7. mithril/api/bindings/__init__.py +10 -0
  8. mithril/api/bindings/api/__init__.py +1 -0
  9. mithril/api/bindings/api/api_keys/__init__.py +1 -0
  10. mithril/api/bindings/api/api_keys/create_api_key_v2_api_keys_post.py +179 -0
  11. mithril/api/bindings/api/api_keys/get_api_keys_v2_api_keys_get.py +141 -0
  12. mithril/api/bindings/api/api_keys/revoke_api_key_v2_api_keys_key_fid_delete.py +173 -0
  13. mithril/api/bindings/api/image_versions/__init__.py +1 -0
  14. mithril/api/bindings/api/image_versions/get_image_versions_v2_image_versions_get.py +141 -0
  15. mithril/api/bindings/api/image_versions/get_mcc_image_versions_v2_mcc_image_versions_get.py +179 -0
  16. mithril/api/bindings/api/instance_types/__init__.py +1 -0
  17. mithril/api/bindings/api/instance_types/get_instance_types_v2_instance_types_get.py +137 -0
  18. mithril/api/bindings/api/instances/__init__.py +1 -0
  19. mithril/api/bindings/api/instances/get_instance_status_v2_instances_instance_id_status_get.py +165 -0
  20. mithril/api/bindings/api/instances/get_instances_v2_instances_get.py +409 -0
  21. mithril/api/bindings/api/kubernetes_clusters/__init__.py +1 -0
  22. mithril/api/bindings/api/kubernetes_clusters/create_kubernetes_cluster_v2_kubernetes_clusters_post.py +171 -0
  23. mithril/api/bindings/api/kubernetes_clusters/delete_kubernetes_cluster_v2_kubernetes_clusters_cluster_fid_delete.py +163 -0
  24. mithril/api/bindings/api/kubernetes_clusters/get_kubernetes_cluster_v2_kubernetes_clusters_cluster_fid_get.py +165 -0
  25. mithril/api/bindings/api/kubernetes_clusters/get_kubernetes_clusters_v2_kubernetes_clusters_get.py +175 -0
  26. mithril/api/bindings/api/lifecycle_scripts/__init__.py +1 -0
  27. mithril/api/bindings/api/lifecycle_scripts/create_lifecycle_script_v2_lifecycle_scripts_post.py +171 -0
  28. mithril/api/bindings/api/lifecycle_scripts/delete_lifecycle_script_v2_lifecycle_scripts_ls_fid_delete.py +155 -0
  29. mithril/api/bindings/api/lifecycle_scripts/get_lifecycle_script_content_v2_lifecycle_scripts_ls_fid_content_get.py +155 -0
  30. mithril/api/bindings/api/lifecycle_scripts/list_lifecycle_scripts_v2_lifecycle_scripts_get.py +247 -0
  31. mithril/api/bindings/api/lifecycle_scripts/update_lifecycle_script_v2_lifecycle_scripts_ls_fid_patch.py +179 -0
  32. mithril/api/bindings/api/pricing/__init__.py +1 -0
  33. mithril/api/bindings/api/pricing/get_current_prices_v2_v2_pricing_current_get.py +217 -0
  34. mithril/api/bindings/api/pricing/get_historical_prices_v2_v2_pricing_history_get.py +222 -0
  35. mithril/api/bindings/api/profile/__init__.py +1 -0
  36. mithril/api/bindings/api/profile/get_me_v2_me_get.py +132 -0
  37. mithril/api/bindings/api/profile/get_my_teammates_v2_me_teammates_get.py +153 -0
  38. mithril/api/bindings/api/projects/__init__.py +1 -0
  39. mithril/api/bindings/api/projects/get_projects_v2_projects_get.py +137 -0
  40. mithril/api/bindings/api/quotas/__init__.py +1 -0
  41. mithril/api/bindings/api/quotas/get_quotas_v2_quotas_get.py +175 -0
  42. mithril/api/bindings/api/reservations/__init__.py +1 -0
  43. mithril/api/bindings/api/reservations/create_reservation_v2_reservation_post.py +171 -0
  44. mithril/api/bindings/api/reservations/extend_reservation_v2_reservation_reservation_fid_extend_post.py +187 -0
  45. mithril/api/bindings/api/reservations/get_availability_v2_reservation_availability_get.py +664 -0
  46. mithril/api/bindings/api/reservations/get_extension_availability_v2_reservation_reservation_fid_extension_availability_get.py +165 -0
  47. mithril/api/bindings/api/reservations/get_reservations_v2_reservation_get.py +309 -0
  48. mithril/api/bindings/api/reservations/update_reservation_v2_reservation_reservation_fid_patch.py +187 -0
  49. mithril/api/bindings/api/spot/__init__.py +1 -0
  50. mithril/api/bindings/api/spot/cancel_bid_v2_spot_bids_bid_fid_delete.py +161 -0
  51. mithril/api/bindings/api/spot/create_bid_v2_spot_bids_post.py +171 -0
  52. mithril/api/bindings/api/spot/get_auctions_v2_spot_availability_get.py +137 -0
  53. mithril/api/bindings/api/spot/get_bid_history_v2_spot_bids_bid_fid_history_get.py +193 -0
  54. mithril/api/bindings/api/spot/get_bid_status_v2_spot_bids_bid_fid_status_get.py +189 -0
  55. mithril/api/bindings/api/spot/get_bid_v2_spot_bids_bid_fid_get.py +163 -0
  56. mithril/api/bindings/api/spot/get_bids_v2_spot_bids_get.py +330 -0
  57. mithril/api/bindings/api/spot/update_bid_v2_spot_bids_bid_fid_patch.py +185 -0
  58. mithril/api/bindings/api/ssh_keys/__init__.py +1 -0
  59. mithril/api/bindings/api/ssh_keys/create_ssh_key_v2_ssh_keys_post.py +175 -0
  60. mithril/api/bindings/api/ssh_keys/delete_ssh_key_v2_ssh_keys_ssh_key_fid_delete.py +167 -0
  61. mithril/api/bindings/api/ssh_keys/get_ssh_keys_v2_ssh_keys_get.py +175 -0
  62. mithril/api/bindings/api/ssh_keys/update_ssh_key_v2_ssh_keys_ssh_key_fid_patch.py +187 -0
  63. mithril/api/bindings/api/volumes/__init__.py +1 -0
  64. mithril/api/bindings/api/volumes/create_volume_v2_volumes_post.py +211 -0
  65. mithril/api/bindings/api/volumes/delete_volume_v2_volumes_volume_fid_delete.py +199 -0
  66. mithril/api/bindings/api/volumes/get_volumes_v2_volumes_get.py +239 -0
  67. mithril/api/bindings/api/volumes/update_volume_v2_volumes_volume_fid_patch.py +243 -0
  68. mithril/api/bindings/client.py +284 -0
  69. mithril/api/bindings/errors.py +18 -0
  70. mithril/api/bindings/models/__init__.py +169 -0
  71. mithril/api/bindings/models/api_key_model.py +114 -0
  72. mithril/api/bindings/models/auction_model.py +146 -0
  73. mithril/api/bindings/models/availability_slot_model.py +76 -0
  74. mithril/api/bindings/models/bid_history_event_model.py +157 -0
  75. mithril/api/bindings/models/bid_history_event_model_event_type.py +19 -0
  76. mithril/api/bindings/models/bid_history_response.py +84 -0
  77. mithril/api/bindings/models/bid_model.py +191 -0
  78. mithril/api/bindings/models/bid_model_status.py +14 -0
  79. mithril/api/bindings/models/bid_status_response.py +72 -0
  80. mithril/api/bindings/models/bid_status_response_status.py +15 -0
  81. mithril/api/bindings/models/check_availability_response.py +60 -0
  82. mithril/api/bindings/models/create_api_key_request.py +68 -0
  83. mithril/api/bindings/models/create_api_key_response.py +122 -0
  84. mithril/api/bindings/models/create_bid_request.py +116 -0
  85. mithril/api/bindings/models/create_kubernetes_cluster_request.py +136 -0
  86. mithril/api/bindings/models/create_kubernetes_cluster_request_k8s_version.py +11 -0
  87. mithril/api/bindings/models/create_lifecycle_script_request.py +115 -0
  88. mithril/api/bindings/models/create_reservation_request.py +124 -0
  89. mithril/api/bindings/models/create_ssh_key_request.py +99 -0
  90. mithril/api/bindings/models/create_volume_request.py +98 -0
  91. mithril/api/bindings/models/create_volume_request_disk_interface.py +11 -0
  92. mithril/api/bindings/models/created_ssh_key_model.py +122 -0
  93. mithril/api/bindings/models/current_prices_response.py +202 -0
  94. mithril/api/bindings/models/extend_reservation_request.py +60 -0
  95. mithril/api/bindings/models/extension_availability_response.py +68 -0
  96. mithril/api/bindings/models/get_availability_v2_reservation_availability_get_mode.py +12 -0
  97. mithril/api/bindings/models/get_bids_response.py +96 -0
  98. mithril/api/bindings/models/get_bids_v2_spot_bids_get_sort_by.py +11 -0
  99. mithril/api/bindings/models/get_bids_v2_spot_bids_get_status.py +14 -0
  100. mithril/api/bindings/models/get_instances_response.py +96 -0
  101. mithril/api/bindings/models/get_instances_v2_instances_get_order_type_in_type_0_item.py +11 -0
  102. mithril/api/bindings/models/get_instances_v2_instances_get_sort_by.py +12 -0
  103. mithril/api/bindings/models/get_instances_v2_instances_get_status_in_type_0_item.py +24 -0
  104. mithril/api/bindings/models/get_latest_end_time_response.py +68 -0
  105. mithril/api/bindings/models/get_reservations_response.py +96 -0
  106. mithril/api/bindings/models/get_reservations_v2_reservation_get_sort_by.py +11 -0
  107. mithril/api/bindings/models/get_reservations_v2_reservation_get_status.py +14 -0
  108. mithril/api/bindings/models/historical_price_point_model.py +94 -0
  109. mithril/api/bindings/models/historical_prices_response_model.py +76 -0
  110. mithril/api/bindings/models/http_validation_error.py +78 -0
  111. mithril/api/bindings/models/image_version_model.py +224 -0
  112. mithril/api/bindings/models/instance_model.py +211 -0
  113. mithril/api/bindings/models/instance_model_status.py +24 -0
  114. mithril/api/bindings/models/instance_status_response.py +141 -0
  115. mithril/api/bindings/models/instance_status_response_status.py +24 -0
  116. mithril/api/bindings/models/instance_type_model.py +170 -0
  117. mithril/api/bindings/models/kubernetes_cluster_model.py +207 -0
  118. mithril/api/bindings/models/kubernetes_cluster_model_status.py +12 -0
  119. mithril/api/bindings/models/launch_specification_model.py +152 -0
  120. mithril/api/bindings/models/lifecycle_script_model.py +134 -0
  121. mithril/api/bindings/models/lifecycle_script_scope.py +12 -0
  122. mithril/api/bindings/models/list_lifecycle_scripts_response.py +96 -0
  123. mithril/api/bindings/models/list_lifecycle_scripts_v2_lifecycle_scripts_get_sort_by.py +11 -0
  124. mithril/api/bindings/models/me_response.py +126 -0
  125. mithril/api/bindings/models/new_ssh_key_model.py +100 -0
  126. mithril/api/bindings/models/persistent_disk_change.py +92 -0
  127. mithril/api/bindings/models/project_model.py +76 -0
  128. mithril/api/bindings/models/public_lifecycle_script_scope.py +11 -0
  129. mithril/api/bindings/models/quota_model.py +132 -0
  130. mithril/api/bindings/models/reservation_model.py +215 -0
  131. mithril/api/bindings/models/reservation_model_status.py +14 -0
  132. mithril/api/bindings/models/size.py +70 -0
  133. mithril/api/bindings/models/size_unit.py +18 -0
  134. mithril/api/bindings/models/sort_direction.py +11 -0
  135. mithril/api/bindings/models/teammate_response.py +158 -0
  136. mithril/api/bindings/models/update_bid_request.py +143 -0
  137. mithril/api/bindings/models/update_lifecycle_script_request.py +109 -0
  138. mithril/api/bindings/models/update_reservation_request.py +103 -0
  139. mithril/api/bindings/models/update_ssh_key_request.py +60 -0
  140. mithril/api/bindings/models/update_volume_request.py +65 -0
  141. mithril/api/bindings/models/validation_error.py +89 -0
  142. mithril/api/bindings/models/volume_model.py +140 -0
  143. mithril/api/bindings/models/volume_model_attachments.py +46 -0
  144. mithril/api/bindings/models/volume_model_interface.py +11 -0
  145. mithril/api/bindings/types.py +56 -0
  146. mithril/api/client.py +138 -0
  147. mithril/cli/__init__.py +7 -0
  148. mithril/cli/commands/__init__.py +15 -0
  149. mithril/cli/commands/help.py +88 -0
  150. mithril/cli/commands/launch.py +353 -0
  151. mithril/cli/main.py +68 -0
  152. mithril/cli/utils/__init__.py +1 -0
  153. mithril/cli/utils/skypilot_passthrough.py +38 -0
  154. mithril/cli/utils/streaming.py +235 -0
  155. mithril/cli/utils/volumes.py +110 -0
  156. mithril/config.py +47 -0
  157. mithril/py.typed +0 -0
  158. mithril/sky/__init__.py +141 -0
  159. mithril/sky/client.py +176 -0
  160. mithril_client-0.1.0a1.dist-info/METADATA +56 -0
  161. mithril_client-0.1.0a1.dist-info/RECORD +163 -0
  162. mithril_client-0.1.0a1.dist-info/WHEEL +4 -0
  163. mithril_client-0.1.0a1.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,211 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, Self, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..models.instance_model_status import InstanceModelStatus
10
+ from ..types import UNSET, Unset
11
+
12
+ T = TypeVar("T", bound="InstanceModel")
13
+
14
+
15
+ @_attrs_define
16
+ class InstanceModel:
17
+ """Attributes:
18
+ fid (str):
19
+ name (str):
20
+ project (str):
21
+ created_at (str):
22
+ created_by (str):
23
+ instance_type (str):
24
+ status (InstanceModelStatus):
25
+ region (None | str | Unset):
26
+ bid (None | str | Unset):
27
+ reservation (None | str | Unset):
28
+ ssh_destination (None | str | Unset):
29
+ private_ip (None | str | Unset):
30
+ """
31
+
32
+ fid: str
33
+ name: str
34
+ project: str
35
+ created_at: str
36
+ created_by: str
37
+ instance_type: str
38
+ status: InstanceModelStatus
39
+ region: None | str | Unset = UNSET
40
+ bid: None | str | Unset = UNSET
41
+ reservation: None | str | Unset = UNSET
42
+ ssh_destination: None | str | Unset = UNSET
43
+ private_ip: None | str | Unset = UNSET
44
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
45
+
46
+ def to_dict(self) -> dict[str, Any]:
47
+ fid = self.fid
48
+
49
+ name = self.name
50
+
51
+ project = self.project
52
+
53
+ created_at = self.created_at
54
+
55
+ created_by = self.created_by
56
+
57
+ instance_type = self.instance_type
58
+
59
+ status = self.status.value
60
+
61
+ region: None | str | Unset
62
+ if isinstance(self.region, Unset):
63
+ region = UNSET
64
+ else:
65
+ region = self.region
66
+
67
+ bid: None | str | Unset
68
+ if isinstance(self.bid, Unset):
69
+ bid = UNSET
70
+ else:
71
+ bid = self.bid
72
+
73
+ reservation: None | str | Unset
74
+ if isinstance(self.reservation, Unset):
75
+ reservation = UNSET
76
+ else:
77
+ reservation = self.reservation
78
+
79
+ ssh_destination: None | str | Unset
80
+ if isinstance(self.ssh_destination, Unset):
81
+ ssh_destination = UNSET
82
+ else:
83
+ ssh_destination = self.ssh_destination
84
+
85
+ private_ip: None | str | Unset
86
+ if isinstance(self.private_ip, Unset):
87
+ private_ip = UNSET
88
+ else:
89
+ private_ip = self.private_ip
90
+
91
+ field_dict: dict[str, Any] = {}
92
+ field_dict.update(self.additional_properties)
93
+ field_dict.update(
94
+ {
95
+ "fid": fid,
96
+ "name": name,
97
+ "project": project,
98
+ "created_at": created_at,
99
+ "created_by": created_by,
100
+ "instance_type": instance_type,
101
+ "status": status,
102
+ }
103
+ )
104
+ if region is not UNSET:
105
+ field_dict["region"] = region
106
+ if bid is not UNSET:
107
+ field_dict["bid"] = bid
108
+ if reservation is not UNSET:
109
+ field_dict["reservation"] = reservation
110
+ if ssh_destination is not UNSET:
111
+ field_dict["ssh_destination"] = ssh_destination
112
+ if private_ip is not UNSET:
113
+ field_dict["private_ip"] = private_ip
114
+
115
+ return field_dict
116
+
117
+ @classmethod
118
+ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
119
+ d = dict(src_dict)
120
+ fid = d.pop("fid")
121
+
122
+ name = d.pop("name")
123
+
124
+ project = d.pop("project")
125
+
126
+ created_at = d.pop("created_at")
127
+
128
+ created_by = d.pop("created_by")
129
+
130
+ instance_type = d.pop("instance_type")
131
+
132
+ status = InstanceModelStatus(d.pop("status"))
133
+
134
+ def _parse_region(data: object) -> None | str | Unset:
135
+ if data is None:
136
+ return data
137
+ if isinstance(data, Unset):
138
+ return data
139
+ return cast(None | str | Unset, data)
140
+
141
+ region = _parse_region(d.pop("region", UNSET))
142
+
143
+ def _parse_bid(data: object) -> None | str | Unset:
144
+ if data is None:
145
+ return data
146
+ if isinstance(data, Unset):
147
+ return data
148
+ return cast(None | str | Unset, data)
149
+
150
+ bid = _parse_bid(d.pop("bid", UNSET))
151
+
152
+ def _parse_reservation(data: object) -> None | str | Unset:
153
+ if data is None:
154
+ return data
155
+ if isinstance(data, Unset):
156
+ return data
157
+ return cast(None | str | Unset, data)
158
+
159
+ reservation = _parse_reservation(d.pop("reservation", UNSET))
160
+
161
+ def _parse_ssh_destination(data: object) -> None | str | Unset:
162
+ if data is None:
163
+ return data
164
+ if isinstance(data, Unset):
165
+ return data
166
+ return cast(None | str | Unset, data)
167
+
168
+ ssh_destination = _parse_ssh_destination(d.pop("ssh_destination", UNSET))
169
+
170
+ def _parse_private_ip(data: object) -> None | str | Unset:
171
+ if data is None:
172
+ return data
173
+ if isinstance(data, Unset):
174
+ return data
175
+ return cast(None | str | Unset, data)
176
+
177
+ private_ip = _parse_private_ip(d.pop("private_ip", UNSET))
178
+
179
+ instance_model = cls(
180
+ fid=fid,
181
+ name=name,
182
+ project=project,
183
+ created_at=created_at,
184
+ created_by=created_by,
185
+ instance_type=instance_type,
186
+ status=status,
187
+ region=region,
188
+ bid=bid,
189
+ reservation=reservation,
190
+ ssh_destination=ssh_destination,
191
+ private_ip=private_ip,
192
+ )
193
+
194
+ instance_model.additional_properties = d
195
+ return instance_model
196
+
197
+ @property
198
+ def additional_keys(self) -> list[str]:
199
+ return list(self.additional_properties.keys())
200
+
201
+ def __getitem__(self, key: str) -> Any:
202
+ return self.additional_properties[key]
203
+
204
+ def __setitem__(self, key: str, value: Any) -> None:
205
+ self.additional_properties[key] = value
206
+
207
+ def __delitem__(self, key: str) -> None:
208
+ del self.additional_properties[key]
209
+
210
+ def __contains__(self, key: str) -> bool:
211
+ return key in self.additional_properties
@@ -0,0 +1,24 @@
1
+ from __future__ import annotations
2
+
3
+ from enum import Enum
4
+
5
+
6
+ class InstanceModelStatus(str, Enum):
7
+ STATUS_CONFIRMED = "STATUS_CONFIRMED"
8
+ STATUS_ERROR = "STATUS_ERROR"
9
+ STATUS_INITIALIZING = "STATUS_INITIALIZING"
10
+ STATUS_NEW = "STATUS_NEW"
11
+ STATUS_PAUSED = "STATUS_PAUSED"
12
+ STATUS_PREEMPTED = "STATUS_PREEMPTED"
13
+ STATUS_PREEMPTING = "STATUS_PREEMPTING"
14
+ STATUS_RELOCATING = "STATUS_RELOCATING"
15
+ STATUS_REPLACED = "STATUS_REPLACED"
16
+ STATUS_RUNNING = "STATUS_RUNNING"
17
+ STATUS_SCHEDULED = "STATUS_SCHEDULED"
18
+ STATUS_STARTING = "STATUS_STARTING"
19
+ STATUS_STOPPED = "STATUS_STOPPED"
20
+ STATUS_STOPPING = "STATUS_STOPPING"
21
+ STATUS_TERMINATED = "STATUS_TERMINATED"
22
+
23
+ def __str__(self) -> str:
24
+ return str(self.value)
@@ -0,0 +1,141 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, Self, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..models.instance_status_response_status import InstanceStatusResponseStatus
10
+ from ..types import UNSET, Unset
11
+
12
+ T = TypeVar("T", bound="InstanceStatusResponse")
13
+
14
+
15
+ @_attrs_define
16
+ class InstanceStatusResponse:
17
+ """Response model for instance status endpoint.
18
+
19
+ Attributes:
20
+ fid (str):
21
+ name (str):
22
+ status (InstanceStatusResponseStatus):
23
+ bid (None | str | Unset):
24
+ reservation (None | str | Unset):
25
+ end_time (None | str | Unset):
26
+ """
27
+
28
+ fid: str
29
+ name: str
30
+ status: InstanceStatusResponseStatus
31
+ bid: None | str | Unset = UNSET
32
+ reservation: None | str | Unset = UNSET
33
+ end_time: None | str | Unset = UNSET
34
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
35
+
36
+ def to_dict(self) -> dict[str, Any]:
37
+ fid = self.fid
38
+
39
+ name = self.name
40
+
41
+ status = self.status.value
42
+
43
+ bid: None | str | Unset
44
+ if isinstance(self.bid, Unset):
45
+ bid = UNSET
46
+ else:
47
+ bid = self.bid
48
+
49
+ reservation: None | str | Unset
50
+ if isinstance(self.reservation, Unset):
51
+ reservation = UNSET
52
+ else:
53
+ reservation = self.reservation
54
+
55
+ end_time: None | str | Unset
56
+ if isinstance(self.end_time, Unset):
57
+ end_time = UNSET
58
+ else:
59
+ end_time = self.end_time
60
+
61
+ field_dict: dict[str, Any] = {}
62
+ field_dict.update(self.additional_properties)
63
+ field_dict.update(
64
+ {
65
+ "fid": fid,
66
+ "name": name,
67
+ "status": status,
68
+ }
69
+ )
70
+ if bid is not UNSET:
71
+ field_dict["bid"] = bid
72
+ if reservation is not UNSET:
73
+ field_dict["reservation"] = reservation
74
+ if end_time is not UNSET:
75
+ field_dict["end_time"] = end_time
76
+
77
+ return field_dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
81
+ d = dict(src_dict)
82
+ fid = d.pop("fid")
83
+
84
+ name = d.pop("name")
85
+
86
+ status = InstanceStatusResponseStatus(d.pop("status"))
87
+
88
+ def _parse_bid(data: object) -> None | str | Unset:
89
+ if data is None:
90
+ return data
91
+ if isinstance(data, Unset):
92
+ return data
93
+ return cast(None | str | Unset, data)
94
+
95
+ bid = _parse_bid(d.pop("bid", UNSET))
96
+
97
+ def _parse_reservation(data: object) -> None | str | Unset:
98
+ if data is None:
99
+ return data
100
+ if isinstance(data, Unset):
101
+ return data
102
+ return cast(None | str | Unset, data)
103
+
104
+ reservation = _parse_reservation(d.pop("reservation", UNSET))
105
+
106
+ def _parse_end_time(data: object) -> None | str | Unset:
107
+ if data is None:
108
+ return data
109
+ if isinstance(data, Unset):
110
+ return data
111
+ return cast(None | str | Unset, data)
112
+
113
+ end_time = _parse_end_time(d.pop("end_time", UNSET))
114
+
115
+ instance_status_response = cls(
116
+ fid=fid,
117
+ name=name,
118
+ status=status,
119
+ bid=bid,
120
+ reservation=reservation,
121
+ end_time=end_time,
122
+ )
123
+
124
+ instance_status_response.additional_properties = d
125
+ return instance_status_response
126
+
127
+ @property
128
+ def additional_keys(self) -> list[str]:
129
+ return list(self.additional_properties.keys())
130
+
131
+ def __getitem__(self, key: str) -> Any:
132
+ return self.additional_properties[key]
133
+
134
+ def __setitem__(self, key: str, value: Any) -> None:
135
+ self.additional_properties[key] = value
136
+
137
+ def __delitem__(self, key: str) -> None:
138
+ del self.additional_properties[key]
139
+
140
+ def __contains__(self, key: str) -> bool:
141
+ return key in self.additional_properties
@@ -0,0 +1,24 @@
1
+ from __future__ import annotations
2
+
3
+ from enum import Enum
4
+
5
+
6
+ class InstanceStatusResponseStatus(str, Enum):
7
+ STATUS_CONFIRMED = "STATUS_CONFIRMED"
8
+ STATUS_ERROR = "STATUS_ERROR"
9
+ STATUS_INITIALIZING = "STATUS_INITIALIZING"
10
+ STATUS_NEW = "STATUS_NEW"
11
+ STATUS_PAUSED = "STATUS_PAUSED"
12
+ STATUS_PREEMPTED = "STATUS_PREEMPTED"
13
+ STATUS_PREEMPTING = "STATUS_PREEMPTING"
14
+ STATUS_RELOCATING = "STATUS_RELOCATING"
15
+ STATUS_REPLACED = "STATUS_REPLACED"
16
+ STATUS_RUNNING = "STATUS_RUNNING"
17
+ STATUS_SCHEDULED = "STATUS_SCHEDULED"
18
+ STATUS_STARTING = "STATUS_STARTING"
19
+ STATUS_STOPPED = "STATUS_STOPPED"
20
+ STATUS_STOPPING = "STATUS_STOPPING"
21
+ STATUS_TERMINATED = "STATUS_TERMINATED"
22
+
23
+ def __str__(self) -> str:
24
+ return str(self.value)
@@ -0,0 +1,170 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, Self, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="InstanceTypeModel")
12
+
13
+
14
+ @_attrs_define
15
+ class InstanceTypeModel:
16
+ """Attributes:
17
+ fid (str):
18
+ name (str):
19
+ num_cpus (int):
20
+ cpu_type (str):
21
+ ram_gb (int):
22
+ num_gpus (int):
23
+ gpu_type (str):
24
+ gpu_memory_gb (int):
25
+ gpu_socket (str):
26
+ local_storage_gb (int):
27
+ ib_count (int):
28
+ bridge_count (int):
29
+ network_type (None | str | Unset):
30
+ """
31
+
32
+ fid: str
33
+ name: str
34
+ num_cpus: int
35
+ cpu_type: str
36
+ ram_gb: int
37
+ num_gpus: int
38
+ gpu_type: str
39
+ gpu_memory_gb: int
40
+ gpu_socket: str
41
+ local_storage_gb: int
42
+ ib_count: int
43
+ bridge_count: int
44
+ network_type: None | str | Unset = UNSET
45
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
46
+
47
+ def to_dict(self) -> dict[str, Any]:
48
+ fid = self.fid
49
+
50
+ name = self.name
51
+
52
+ num_cpus = self.num_cpus
53
+
54
+ cpu_type = self.cpu_type
55
+
56
+ ram_gb = self.ram_gb
57
+
58
+ num_gpus = self.num_gpus
59
+
60
+ gpu_type = self.gpu_type
61
+
62
+ gpu_memory_gb = self.gpu_memory_gb
63
+
64
+ gpu_socket = self.gpu_socket
65
+
66
+ local_storage_gb = self.local_storage_gb
67
+
68
+ ib_count = self.ib_count
69
+
70
+ bridge_count = self.bridge_count
71
+
72
+ network_type: None | str | Unset
73
+ if isinstance(self.network_type, Unset):
74
+ network_type = UNSET
75
+ else:
76
+ network_type = self.network_type
77
+
78
+ field_dict: dict[str, Any] = {}
79
+ field_dict.update(self.additional_properties)
80
+ field_dict.update(
81
+ {
82
+ "fid": fid,
83
+ "name": name,
84
+ "num_cpus": num_cpus,
85
+ "cpu_type": cpu_type,
86
+ "ram_gb": ram_gb,
87
+ "num_gpus": num_gpus,
88
+ "gpu_type": gpu_type,
89
+ "gpu_memory_gb": gpu_memory_gb,
90
+ "gpu_socket": gpu_socket,
91
+ "local_storage_gb": local_storage_gb,
92
+ "ib_count": ib_count,
93
+ "bridge_count": bridge_count,
94
+ }
95
+ )
96
+ if network_type is not UNSET:
97
+ field_dict["network_type"] = network_type
98
+
99
+ return field_dict
100
+
101
+ @classmethod
102
+ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
103
+ d = dict(src_dict)
104
+ fid = d.pop("fid")
105
+
106
+ name = d.pop("name")
107
+
108
+ num_cpus = d.pop("num_cpus")
109
+
110
+ cpu_type = d.pop("cpu_type")
111
+
112
+ ram_gb = d.pop("ram_gb")
113
+
114
+ num_gpus = d.pop("num_gpus")
115
+
116
+ gpu_type = d.pop("gpu_type")
117
+
118
+ gpu_memory_gb = d.pop("gpu_memory_gb")
119
+
120
+ gpu_socket = d.pop("gpu_socket")
121
+
122
+ local_storage_gb = d.pop("local_storage_gb")
123
+
124
+ ib_count = d.pop("ib_count")
125
+
126
+ bridge_count = d.pop("bridge_count")
127
+
128
+ def _parse_network_type(data: object) -> None | str | Unset:
129
+ if data is None:
130
+ return data
131
+ if isinstance(data, Unset):
132
+ return data
133
+ return cast(None | str | Unset, data)
134
+
135
+ network_type = _parse_network_type(d.pop("network_type", UNSET))
136
+
137
+ instance_type_model = cls(
138
+ fid=fid,
139
+ name=name,
140
+ num_cpus=num_cpus,
141
+ cpu_type=cpu_type,
142
+ ram_gb=ram_gb,
143
+ num_gpus=num_gpus,
144
+ gpu_type=gpu_type,
145
+ gpu_memory_gb=gpu_memory_gb,
146
+ gpu_socket=gpu_socket,
147
+ local_storage_gb=local_storage_gb,
148
+ ib_count=ib_count,
149
+ bridge_count=bridge_count,
150
+ network_type=network_type,
151
+ )
152
+
153
+ instance_type_model.additional_properties = d
154
+ return instance_type_model
155
+
156
+ @property
157
+ def additional_keys(self) -> list[str]:
158
+ return list(self.additional_properties.keys())
159
+
160
+ def __getitem__(self, key: str) -> Any:
161
+ return self.additional_properties[key]
162
+
163
+ def __setitem__(self, key: str, value: Any) -> None:
164
+ self.additional_properties[key] = value
165
+
166
+ def __delitem__(self, key: str) -> None:
167
+ del self.additional_properties[key]
168
+
169
+ def __contains__(self, key: str) -> bool:
170
+ return key in self.additional_properties