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,146 @@
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="AuctionModel")
12
+
13
+
14
+ @_attrs_define
15
+ class AuctionModel:
16
+ """Attributes:
17
+ fid (str):
18
+ instance_type (str):
19
+ region (str):
20
+ capacity (int):
21
+ last_instance_price (str):
22
+ adjustable_memory (bool):
23
+ lowest_allocated_price (None | str | Unset):
24
+ default_image_version (None | str | Unset):
25
+ """
26
+
27
+ fid: str
28
+ instance_type: str
29
+ region: str
30
+ capacity: int
31
+ last_instance_price: str
32
+ adjustable_memory: bool
33
+ lowest_allocated_price: None | str | Unset = UNSET
34
+ default_image_version: None | str | Unset = UNSET
35
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
36
+
37
+ def to_dict(self) -> dict[str, Any]:
38
+ fid = self.fid
39
+
40
+ instance_type = self.instance_type
41
+
42
+ region = self.region
43
+
44
+ capacity = self.capacity
45
+
46
+ last_instance_price = self.last_instance_price
47
+
48
+ adjustable_memory = self.adjustable_memory
49
+
50
+ lowest_allocated_price: None | str | Unset
51
+ if isinstance(self.lowest_allocated_price, Unset):
52
+ lowest_allocated_price = UNSET
53
+ else:
54
+ lowest_allocated_price = self.lowest_allocated_price
55
+
56
+ default_image_version: None | str | Unset
57
+ if isinstance(self.default_image_version, Unset):
58
+ default_image_version = UNSET
59
+ else:
60
+ default_image_version = self.default_image_version
61
+
62
+ field_dict: dict[str, Any] = {}
63
+ field_dict.update(self.additional_properties)
64
+ field_dict.update(
65
+ {
66
+ "fid": fid,
67
+ "instance_type": instance_type,
68
+ "region": region,
69
+ "capacity": capacity,
70
+ "last_instance_price": last_instance_price,
71
+ "adjustable_memory": adjustable_memory,
72
+ }
73
+ )
74
+ if lowest_allocated_price is not UNSET:
75
+ field_dict["lowest_allocated_price"] = lowest_allocated_price
76
+ if default_image_version is not UNSET:
77
+ field_dict["default_image_version"] = default_image_version
78
+
79
+ return field_dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
83
+ d = dict(src_dict)
84
+ fid = d.pop("fid")
85
+
86
+ instance_type = d.pop("instance_type")
87
+
88
+ region = d.pop("region")
89
+
90
+ capacity = d.pop("capacity")
91
+
92
+ last_instance_price = d.pop("last_instance_price")
93
+
94
+ adjustable_memory = d.pop("adjustable_memory")
95
+
96
+ def _parse_lowest_allocated_price(data: object) -> None | str | Unset:
97
+ if data is None:
98
+ return data
99
+ if isinstance(data, Unset):
100
+ return data
101
+ return cast(None | str | Unset, data)
102
+
103
+ lowest_allocated_price = _parse_lowest_allocated_price(
104
+ d.pop("lowest_allocated_price", UNSET)
105
+ )
106
+
107
+ def _parse_default_image_version(data: object) -> None | str | Unset:
108
+ if data is None:
109
+ return data
110
+ if isinstance(data, Unset):
111
+ return data
112
+ return cast(None | str | Unset, data)
113
+
114
+ default_image_version = _parse_default_image_version(
115
+ d.pop("default_image_version", UNSET)
116
+ )
117
+
118
+ auction_model = cls(
119
+ fid=fid,
120
+ instance_type=instance_type,
121
+ region=region,
122
+ capacity=capacity,
123
+ last_instance_price=last_instance_price,
124
+ adjustable_memory=adjustable_memory,
125
+ lowest_allocated_price=lowest_allocated_price,
126
+ default_image_version=default_image_version,
127
+ )
128
+
129
+ auction_model.additional_properties = d
130
+ return auction_model
131
+
132
+ @property
133
+ def additional_keys(self) -> list[str]:
134
+ return list(self.additional_properties.keys())
135
+
136
+ def __getitem__(self, key: str) -> Any:
137
+ return self.additional_properties[key]
138
+
139
+ def __setitem__(self, key: str, value: Any) -> None:
140
+ self.additional_properties[key] = value
141
+
142
+ def __delitem__(self, key: str) -> None:
143
+ del self.additional_properties[key]
144
+
145
+ def __contains__(self, key: str) -> bool:
146
+ return key in self.additional_properties
@@ -0,0 +1,76 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, Self, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ T = TypeVar("T", bound="AvailabilitySlotModel")
10
+
11
+
12
+ @_attrs_define
13
+ class AvailabilitySlotModel:
14
+ """Attributes:
15
+ start_time (str):
16
+ end_time (str):
17
+ quantity (int):
18
+ """
19
+
20
+ start_time: str
21
+ end_time: str
22
+ quantity: int
23
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
24
+
25
+ def to_dict(self) -> dict[str, Any]:
26
+ start_time = self.start_time
27
+
28
+ end_time = self.end_time
29
+
30
+ quantity = self.quantity
31
+
32
+ field_dict: dict[str, Any] = {}
33
+ field_dict.update(self.additional_properties)
34
+ field_dict.update(
35
+ {
36
+ "start_time": start_time,
37
+ "end_time": end_time,
38
+ "quantity": quantity,
39
+ }
40
+ )
41
+
42
+ return field_dict
43
+
44
+ @classmethod
45
+ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
46
+ d = dict(src_dict)
47
+ start_time = d.pop("start_time")
48
+
49
+ end_time = d.pop("end_time")
50
+
51
+ quantity = d.pop("quantity")
52
+
53
+ availability_slot_model = cls(
54
+ start_time=start_time,
55
+ end_time=end_time,
56
+ quantity=quantity,
57
+ )
58
+
59
+ availability_slot_model.additional_properties = d
60
+ return availability_slot_model
61
+
62
+ @property
63
+ def additional_keys(self) -> list[str]:
64
+ return list(self.additional_properties.keys())
65
+
66
+ def __getitem__(self, key: str) -> Any:
67
+ return self.additional_properties[key]
68
+
69
+ def __setitem__(self, key: str, value: Any) -> None:
70
+ self.additional_properties[key] = value
71
+
72
+ def __delitem__(self, key: str) -> None:
73
+ del self.additional_properties[key]
74
+
75
+ def __contains__(self, key: str) -> bool:
76
+ return key in self.additional_properties
@@ -0,0 +1,157 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, 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.bid_history_event_model_event_type import BidHistoryEventModelEventType
10
+ from ..types import UNSET, Unset
11
+
12
+ if TYPE_CHECKING:
13
+ from ..models.persistent_disk_change import PersistentDiskChange
14
+
15
+
16
+ T = TypeVar("T", bound="BidHistoryEventModel")
17
+
18
+
19
+ @_attrs_define
20
+ class BidHistoryEventModel:
21
+ """A single event in the history of a spot bid.
22
+
23
+ Attributes:
24
+ timestamp (str): When the event occurred
25
+ event_type (BidHistoryEventModelEventType):
26
+ limit_price (None | str | Unset):
27
+ user_id (None | str | Unset):
28
+ memory_gb (int | None | Unset):
29
+ persistent_disk_change (PersistentDiskChange | Unset):
30
+ """
31
+
32
+ timestamp: str
33
+ event_type: BidHistoryEventModelEventType
34
+ limit_price: None | str | Unset = UNSET
35
+ user_id: None | str | Unset = UNSET
36
+ memory_gb: int | None | Unset = UNSET
37
+ persistent_disk_change: PersistentDiskChange | Unset = UNSET
38
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
39
+
40
+ def to_dict(self) -> dict[str, Any]:
41
+ timestamp = self.timestamp
42
+
43
+ event_type = self.event_type.value
44
+
45
+ limit_price: None | str | Unset
46
+ if isinstance(self.limit_price, Unset):
47
+ limit_price = UNSET
48
+ else:
49
+ limit_price = self.limit_price
50
+
51
+ user_id: None | str | Unset
52
+ if isinstance(self.user_id, Unset):
53
+ user_id = UNSET
54
+ else:
55
+ user_id = self.user_id
56
+
57
+ memory_gb: int | None | Unset
58
+ if isinstance(self.memory_gb, Unset):
59
+ memory_gb = UNSET
60
+ else:
61
+ memory_gb = self.memory_gb
62
+
63
+ persistent_disk_change: dict[str, Any] | Unset = UNSET
64
+ if not isinstance(self.persistent_disk_change, Unset):
65
+ persistent_disk_change = self.persistent_disk_change.to_dict()
66
+
67
+ field_dict: dict[str, Any] = {}
68
+ field_dict.update(self.additional_properties)
69
+ field_dict.update(
70
+ {
71
+ "timestamp": timestamp,
72
+ "event_type": event_type,
73
+ }
74
+ )
75
+ if limit_price is not UNSET:
76
+ field_dict["limit_price"] = limit_price
77
+ if user_id is not UNSET:
78
+ field_dict["user_id"] = user_id
79
+ if memory_gb is not UNSET:
80
+ field_dict["memory_gb"] = memory_gb
81
+ if persistent_disk_change is not UNSET:
82
+ field_dict["persistent_disk_change"] = persistent_disk_change
83
+
84
+ return field_dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
88
+ from ..models.persistent_disk_change import PersistentDiskChange
89
+
90
+ d = dict(src_dict)
91
+ timestamp = d.pop("timestamp")
92
+
93
+ event_type = BidHistoryEventModelEventType(d.pop("event_type"))
94
+
95
+ def _parse_limit_price(data: object) -> None | str | Unset:
96
+ if data is None:
97
+ return data
98
+ if isinstance(data, Unset):
99
+ return data
100
+ return cast(None | str | Unset, data)
101
+
102
+ limit_price = _parse_limit_price(d.pop("limit_price", UNSET))
103
+
104
+ def _parse_user_id(data: object) -> None | str | Unset:
105
+ if data is None:
106
+ return data
107
+ if isinstance(data, Unset):
108
+ return data
109
+ return cast(None | str | Unset, data)
110
+
111
+ user_id = _parse_user_id(d.pop("user_id", UNSET))
112
+
113
+ def _parse_memory_gb(data: object) -> int | None | Unset:
114
+ if data is None:
115
+ return data
116
+ if isinstance(data, Unset):
117
+ return data
118
+ return cast(int | None | Unset, data)
119
+
120
+ memory_gb = _parse_memory_gb(d.pop("memory_gb", UNSET))
121
+
122
+ _persistent_disk_change = d.pop("persistent_disk_change", UNSET)
123
+ persistent_disk_change: PersistentDiskChange | Unset
124
+ if isinstance(_persistent_disk_change, Unset):
125
+ persistent_disk_change = UNSET
126
+ else:
127
+ persistent_disk_change = PersistentDiskChange.from_dict(
128
+ _persistent_disk_change
129
+ )
130
+
131
+ bid_history_event_model = cls(
132
+ timestamp=timestamp,
133
+ event_type=event_type,
134
+ limit_price=limit_price,
135
+ user_id=user_id,
136
+ memory_gb=memory_gb,
137
+ persistent_disk_change=persistent_disk_change,
138
+ )
139
+
140
+ bid_history_event_model.additional_properties = d
141
+ return bid_history_event_model
142
+
143
+ @property
144
+ def additional_keys(self) -> list[str]:
145
+ return list(self.additional_properties.keys())
146
+
147
+ def __getitem__(self, key: str) -> Any:
148
+ return self.additional_properties[key]
149
+
150
+ def __setitem__(self, key: str, value: Any) -> None:
151
+ self.additional_properties[key] = value
152
+
153
+ def __delitem__(self, key: str) -> None:
154
+ del self.additional_properties[key]
155
+
156
+ def __contains__(self, key: str) -> bool:
157
+ return key in self.additional_properties
@@ -0,0 +1,19 @@
1
+ from __future__ import annotations
2
+
3
+ from enum import Enum
4
+
5
+
6
+ class BidHistoryEventModelEventType(str, Enum):
7
+ ALLOCATED = "Allocated"
8
+ LIMIT_PRICE_CHANGED = "Limit Price Changed"
9
+ MEMORY_ADJUSTED = "Memory Adjusted"
10
+ PAUSED = "Paused"
11
+ PLACED = "Placed"
12
+ PREEMPTED = "Preempted"
13
+ RESUMED = "Resumed"
14
+ TERMINATED = "Terminated"
15
+ VOLUMES_ATTACHED = "Volumes Attached"
16
+ VOLUMES_REMOVED = "Volumes Removed"
17
+
18
+ def __str__(self) -> str:
19
+ return str(self.value)
@@ -0,0 +1,84 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, Self, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ if TYPE_CHECKING:
10
+ from ..models.bid_history_event_model import BidHistoryEventModel
11
+
12
+
13
+ T = TypeVar("T", bound="BidHistoryResponse")
14
+
15
+
16
+ @_attrs_define
17
+ class BidHistoryResponse:
18
+ """Response model for bid history.
19
+
20
+ Attributes:
21
+ bid_fid (str):
22
+ events (list[BidHistoryEventModel]): List of historical events for this bid, ordered by timestamp
23
+ """
24
+
25
+ bid_fid: str
26
+ events: list[BidHistoryEventModel]
27
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28
+
29
+ def to_dict(self) -> dict[str, Any]:
30
+ bid_fid = self.bid_fid
31
+
32
+ events = []
33
+ for events_item_data in self.events:
34
+ events_item = events_item_data.to_dict()
35
+ events.append(events_item)
36
+
37
+ field_dict: dict[str, Any] = {}
38
+ field_dict.update(self.additional_properties)
39
+ field_dict.update(
40
+ {
41
+ "bid_fid": bid_fid,
42
+ "events": events,
43
+ }
44
+ )
45
+
46
+ return field_dict
47
+
48
+ @classmethod
49
+ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
50
+ from ..models.bid_history_event_model import BidHistoryEventModel
51
+
52
+ d = dict(src_dict)
53
+ bid_fid = d.pop("bid_fid")
54
+
55
+ events = []
56
+ _events = d.pop("events")
57
+ for events_item_data in _events:
58
+ events_item = BidHistoryEventModel.from_dict(events_item_data)
59
+
60
+ events.append(events_item)
61
+
62
+ bid_history_response = cls(
63
+ bid_fid=bid_fid,
64
+ events=events,
65
+ )
66
+
67
+ bid_history_response.additional_properties = d
68
+ return bid_history_response
69
+
70
+ @property
71
+ def additional_keys(self) -> list[str]:
72
+ return list(self.additional_properties.keys())
73
+
74
+ def __getitem__(self, key: str) -> Any:
75
+ return self.additional_properties[key]
76
+
77
+ def __setitem__(self, key: str, value: Any) -> None:
78
+ self.additional_properties[key] = value
79
+
80
+ def __delitem__(self, key: str) -> None:
81
+ del self.additional_properties[key]
82
+
83
+ def __contains__(self, key: str) -> bool:
84
+ return key in self.additional_properties
@@ -0,0 +1,191 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, 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.bid_model_status import BidModelStatus
10
+ from ..types import UNSET, Unset
11
+
12
+ if TYPE_CHECKING:
13
+ from ..models.launch_specification_model import LaunchSpecificationModel
14
+
15
+
16
+ T = TypeVar("T", bound="BidModel")
17
+
18
+
19
+ @_attrs_define
20
+ class BidModel:
21
+ """Attributes:
22
+ fid (str):
23
+ name (str):
24
+ project (str):
25
+ created_by (str):
26
+ created_at (str):
27
+ limit_price (str):
28
+ instance_quantity (int):
29
+ instance_type (str):
30
+ instances (list[str]):
31
+ launch_specification (LaunchSpecificationModel):
32
+ status (BidModelStatus):
33
+ deactivated_at (None | str | Unset):
34
+ region (None | str | Unset):
35
+ """
36
+
37
+ fid: str
38
+ name: str
39
+ project: str
40
+ created_by: str
41
+ created_at: str
42
+ limit_price: str
43
+ instance_quantity: int
44
+ instance_type: str
45
+ instances: list[str]
46
+ launch_specification: LaunchSpecificationModel
47
+ status: BidModelStatus
48
+ deactivated_at: None | str | Unset = UNSET
49
+ region: None | str | Unset = UNSET
50
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
51
+
52
+ def to_dict(self) -> dict[str, Any]:
53
+ fid = self.fid
54
+
55
+ name = self.name
56
+
57
+ project = self.project
58
+
59
+ created_by = self.created_by
60
+
61
+ created_at = self.created_at
62
+
63
+ limit_price = self.limit_price
64
+
65
+ instance_quantity = self.instance_quantity
66
+
67
+ instance_type = self.instance_type
68
+
69
+ instances = self.instances
70
+
71
+ launch_specification = self.launch_specification.to_dict()
72
+
73
+ status = self.status.value
74
+
75
+ deactivated_at: None | str | Unset
76
+ if isinstance(self.deactivated_at, Unset):
77
+ deactivated_at = UNSET
78
+ else:
79
+ deactivated_at = self.deactivated_at
80
+
81
+ region: None | str | Unset
82
+ if isinstance(self.region, Unset):
83
+ region = UNSET
84
+ else:
85
+ region = self.region
86
+
87
+ field_dict: dict[str, Any] = {}
88
+ field_dict.update(self.additional_properties)
89
+ field_dict.update(
90
+ {
91
+ "fid": fid,
92
+ "name": name,
93
+ "project": project,
94
+ "created_by": created_by,
95
+ "created_at": created_at,
96
+ "limit_price": limit_price,
97
+ "instance_quantity": instance_quantity,
98
+ "instance_type": instance_type,
99
+ "instances": instances,
100
+ "launch_specification": launch_specification,
101
+ "status": status,
102
+ }
103
+ )
104
+ if deactivated_at is not UNSET:
105
+ field_dict["deactivated_at"] = deactivated_at
106
+ if region is not UNSET:
107
+ field_dict["region"] = region
108
+
109
+ return field_dict
110
+
111
+ @classmethod
112
+ def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
113
+ from ..models.launch_specification_model import LaunchSpecificationModel
114
+
115
+ d = dict(src_dict)
116
+ fid = d.pop("fid")
117
+
118
+ name = d.pop("name")
119
+
120
+ project = d.pop("project")
121
+
122
+ created_by = d.pop("created_by")
123
+
124
+ created_at = d.pop("created_at")
125
+
126
+ limit_price = d.pop("limit_price")
127
+
128
+ instance_quantity = d.pop("instance_quantity")
129
+
130
+ instance_type = d.pop("instance_type")
131
+
132
+ instances = cast(list[str], d.pop("instances"))
133
+
134
+ launch_specification = LaunchSpecificationModel.from_dict(
135
+ d.pop("launch_specification")
136
+ )
137
+
138
+ status = BidModelStatus(d.pop("status"))
139
+
140
+ def _parse_deactivated_at(data: object) -> None | str | Unset:
141
+ if data is None:
142
+ return data
143
+ if isinstance(data, Unset):
144
+ return data
145
+ return cast(None | str | Unset, data)
146
+
147
+ deactivated_at = _parse_deactivated_at(d.pop("deactivated_at", UNSET))
148
+
149
+ def _parse_region(data: object) -> None | str | Unset:
150
+ if data is None:
151
+ return data
152
+ if isinstance(data, Unset):
153
+ return data
154
+ return cast(None | str | Unset, data)
155
+
156
+ region = _parse_region(d.pop("region", UNSET))
157
+
158
+ bid_model = cls(
159
+ fid=fid,
160
+ name=name,
161
+ project=project,
162
+ created_by=created_by,
163
+ created_at=created_at,
164
+ limit_price=limit_price,
165
+ instance_quantity=instance_quantity,
166
+ instance_type=instance_type,
167
+ instances=instances,
168
+ launch_specification=launch_specification,
169
+ status=status,
170
+ deactivated_at=deactivated_at,
171
+ region=region,
172
+ )
173
+
174
+ bid_model.additional_properties = d
175
+ return bid_model
176
+
177
+ @property
178
+ def additional_keys(self) -> list[str]:
179
+ return list(self.additional_properties.keys())
180
+
181
+ def __getitem__(self, key: str) -> Any:
182
+ return self.additional_properties[key]
183
+
184
+ def __setitem__(self, key: str, value: Any) -> None:
185
+ self.additional_properties[key] = value
186
+
187
+ def __delitem__(self, key: str) -> None:
188
+ del self.additional_properties[key]
189
+
190
+ def __contains__(self, key: str) -> bool:
191
+ return key in self.additional_properties
@@ -0,0 +1,14 @@
1
+ from __future__ import annotations
2
+
3
+ from enum import Enum
4
+
5
+
6
+ class BidModelStatus(str, Enum):
7
+ ALLOCATED = "Allocated"
8
+ OPEN = "Open"
9
+ PAUSED = "Paused"
10
+ PREEMPTING = "Preempting"
11
+ TERMINATED = "Terminated"
12
+
13
+ def __str__(self) -> str:
14
+ return str(self.value)