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,409 @@
1
+ from __future__ import annotations
2
+
3
+ from http import HTTPStatus
4
+ from typing import Any
5
+
6
+ import httpx
7
+
8
+ from ... import errors
9
+ from ...client import AuthenticatedClient, Client
10
+ from ...models.get_instances_response import GetInstancesResponse
11
+ from ...models.get_instances_v2_instances_get_order_type_in_type_0_item import (
12
+ GetInstancesV2InstancesGetOrderTypeInType0Item,
13
+ )
14
+ from ...models.get_instances_v2_instances_get_sort_by import (
15
+ GetInstancesV2InstancesGetSortBy,
16
+ )
17
+ from ...models.get_instances_v2_instances_get_status_in_type_0_item import (
18
+ GetInstancesV2InstancesGetStatusInType0Item,
19
+ )
20
+ from ...models.http_validation_error import HTTPValidationError
21
+ from ...models.sort_direction import SortDirection
22
+ from ...types import UNSET, Response, Unset
23
+
24
+
25
+ def _get_kwargs(
26
+ *,
27
+ next_cursor: Any | Unset = UNSET,
28
+ sort_by: GetInstancesV2InstancesGetSortBy | Unset = UNSET,
29
+ sort_dir: SortDirection | Unset = UNSET,
30
+ project: str,
31
+ instance_type: None | str | Unset = UNSET,
32
+ region: None | str | Unset = UNSET,
33
+ status_in: list[GetInstancesV2InstancesGetStatusInType0Item] | None | Unset = UNSET,
34
+ order_type_in: list[GetInstancesV2InstancesGetOrderTypeInType0Item]
35
+ | None
36
+ | Unset = UNSET,
37
+ bid_fid_in: list[str] | None | Unset = UNSET,
38
+ reservation_fid_in: list[str] | None | Unset = UNSET,
39
+ limit: int | None | Unset = UNSET,
40
+ ) -> dict[str, Any]:
41
+ params: dict[str, Any] = {}
42
+
43
+ params["next_cursor"] = next_cursor
44
+
45
+ json_sort_by: str | Unset = UNSET
46
+ if not isinstance(sort_by, Unset):
47
+ json_sort_by = sort_by.value
48
+
49
+ params["sort_by"] = json_sort_by
50
+
51
+ json_sort_dir: str | Unset = UNSET
52
+ if not isinstance(sort_dir, Unset):
53
+ json_sort_dir = sort_dir.value
54
+
55
+ params["sort_dir"] = json_sort_dir
56
+
57
+ params["project"] = project
58
+
59
+ json_instance_type: None | str | Unset
60
+ if isinstance(instance_type, Unset):
61
+ json_instance_type = UNSET
62
+ else:
63
+ json_instance_type = instance_type
64
+ params["instance_type"] = json_instance_type
65
+
66
+ json_region: None | str | Unset
67
+ if isinstance(region, Unset):
68
+ json_region = UNSET
69
+ else:
70
+ json_region = region
71
+ params["region"] = json_region
72
+
73
+ json_status_in: list[str] | None | Unset
74
+ if isinstance(status_in, Unset):
75
+ json_status_in = UNSET
76
+ elif isinstance(status_in, list):
77
+ json_status_in = []
78
+ for status_in_type_0_item_data in status_in:
79
+ status_in_type_0_item = status_in_type_0_item_data.value
80
+ json_status_in.append(status_in_type_0_item)
81
+
82
+ else:
83
+ json_status_in = status_in
84
+ params["status_in"] = json_status_in
85
+
86
+ json_order_type_in: list[str] | None | Unset
87
+ if isinstance(order_type_in, Unset):
88
+ json_order_type_in = UNSET
89
+ elif isinstance(order_type_in, list):
90
+ json_order_type_in = []
91
+ for order_type_in_type_0_item_data in order_type_in:
92
+ order_type_in_type_0_item = order_type_in_type_0_item_data.value
93
+ json_order_type_in.append(order_type_in_type_0_item)
94
+
95
+ else:
96
+ json_order_type_in = order_type_in
97
+ params["order_type_in"] = json_order_type_in
98
+
99
+ json_bid_fid_in: list[str] | None | Unset
100
+ if isinstance(bid_fid_in, Unset):
101
+ json_bid_fid_in = UNSET
102
+ elif isinstance(bid_fid_in, list):
103
+ json_bid_fid_in = bid_fid_in
104
+
105
+ else:
106
+ json_bid_fid_in = bid_fid_in
107
+ params["bid_fid_in"] = json_bid_fid_in
108
+
109
+ json_reservation_fid_in: list[str] | None | Unset
110
+ if isinstance(reservation_fid_in, Unset):
111
+ json_reservation_fid_in = UNSET
112
+ elif isinstance(reservation_fid_in, list):
113
+ json_reservation_fid_in = reservation_fid_in
114
+
115
+ else:
116
+ json_reservation_fid_in = reservation_fid_in
117
+ params["reservation_fid_in"] = json_reservation_fid_in
118
+
119
+ json_limit: int | None | Unset
120
+ if isinstance(limit, Unset):
121
+ json_limit = UNSET
122
+ else:
123
+ json_limit = limit
124
+ params["limit"] = json_limit
125
+
126
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
127
+
128
+ _kwargs: dict[str, Any] = {
129
+ "method": "get",
130
+ "url": "/v2/instances",
131
+ "params": params,
132
+ }
133
+
134
+ return _kwargs
135
+
136
+
137
+ def _parse_response(
138
+ *, client: AuthenticatedClient | Client, response: httpx.Response
139
+ ) -> GetInstancesResponse | HTTPValidationError | None:
140
+ if response.status_code == 200:
141
+ response_200 = GetInstancesResponse.from_dict(response.json())
142
+
143
+ return response_200
144
+
145
+ if response.status_code == 422:
146
+ response_422 = HTTPValidationError.from_dict(response.json())
147
+
148
+ return response_422
149
+
150
+ if client.raise_on_unexpected_status:
151
+ raise errors.UnexpectedStatus(response.status_code, response.content)
152
+ return None
153
+
154
+
155
+ def _build_response(
156
+ *, client: AuthenticatedClient | Client, response: httpx.Response
157
+ ) -> Response[GetInstancesResponse | HTTPValidationError]:
158
+ return Response(
159
+ status_code=HTTPStatus(response.status_code),
160
+ content=response.content,
161
+ headers=response.headers,
162
+ parsed=_parse_response(client=client, response=response),
163
+ )
164
+
165
+
166
+ def sync_detailed(
167
+ *,
168
+ client: AuthenticatedClient,
169
+ next_cursor: Any | Unset = UNSET,
170
+ sort_by: GetInstancesV2InstancesGetSortBy | Unset = UNSET,
171
+ sort_dir: SortDirection | Unset = UNSET,
172
+ project: str,
173
+ instance_type: None | str | Unset = UNSET,
174
+ region: None | str | Unset = UNSET,
175
+ status_in: list[GetInstancesV2InstancesGetStatusInType0Item] | None | Unset = UNSET,
176
+ order_type_in: list[GetInstancesV2InstancesGetOrderTypeInType0Item]
177
+ | None
178
+ | Unset = UNSET,
179
+ bid_fid_in: list[str] | None | Unset = UNSET,
180
+ reservation_fid_in: list[str] | None | Unset = UNSET,
181
+ limit: int | None | Unset = UNSET,
182
+ ) -> Response[GetInstancesResponse | HTTPValidationError]:
183
+ """Get Instances
184
+
185
+ Get all instances for a project
186
+
187
+ Args:
188
+ next_cursor (Any | Unset):
189
+ sort_by (GetInstancesV2InstancesGetSortBy | Unset):
190
+ sort_dir (SortDirection | Unset):
191
+ project (str):
192
+ instance_type (None | str | Unset):
193
+ region (None | str | Unset):
194
+ status_in (list[GetInstancesV2InstancesGetStatusInType0Item] | None | Unset): Comma-
195
+ separated list of instance statuses
196
+ order_type_in (list[GetInstancesV2InstancesGetOrderTypeInType0Item] | None | Unset):
197
+ Comma-separated list of order types
198
+ bid_fid_in (list[str] | None | Unset): Comma-separated list of bid FIDs
199
+ reservation_fid_in (list[str] | None | Unset): Comma-separated list of reservation FIDs
200
+ limit (int | None | Unset):
201
+
202
+ Raises:
203
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
204
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
205
+
206
+ Returns:
207
+ Response[GetInstancesResponse | HTTPValidationError]
208
+ """
209
+ kwargs = _get_kwargs(
210
+ next_cursor=next_cursor,
211
+ sort_by=sort_by,
212
+ sort_dir=sort_dir,
213
+ project=project,
214
+ instance_type=instance_type,
215
+ region=region,
216
+ status_in=status_in,
217
+ order_type_in=order_type_in,
218
+ bid_fid_in=bid_fid_in,
219
+ reservation_fid_in=reservation_fid_in,
220
+ limit=limit,
221
+ )
222
+
223
+ response = client.get_httpx_client().request(
224
+ **kwargs,
225
+ )
226
+
227
+ return _build_response(client=client, response=response)
228
+
229
+
230
+ def sync(
231
+ *,
232
+ client: AuthenticatedClient,
233
+ next_cursor: Any | Unset = UNSET,
234
+ sort_by: GetInstancesV2InstancesGetSortBy | Unset = UNSET,
235
+ sort_dir: SortDirection | Unset = UNSET,
236
+ project: str,
237
+ instance_type: None | str | Unset = UNSET,
238
+ region: None | str | Unset = UNSET,
239
+ status_in: list[GetInstancesV2InstancesGetStatusInType0Item] | None | Unset = UNSET,
240
+ order_type_in: list[GetInstancesV2InstancesGetOrderTypeInType0Item]
241
+ | None
242
+ | Unset = UNSET,
243
+ bid_fid_in: list[str] | None | Unset = UNSET,
244
+ reservation_fid_in: list[str] | None | Unset = UNSET,
245
+ limit: int | None | Unset = UNSET,
246
+ ) -> GetInstancesResponse | HTTPValidationError | None:
247
+ """Get Instances
248
+
249
+ Get all instances for a project
250
+
251
+ Args:
252
+ next_cursor (Any | Unset):
253
+ sort_by (GetInstancesV2InstancesGetSortBy | Unset):
254
+ sort_dir (SortDirection | Unset):
255
+ project (str):
256
+ instance_type (None | str | Unset):
257
+ region (None | str | Unset):
258
+ status_in (list[GetInstancesV2InstancesGetStatusInType0Item] | None | Unset): Comma-
259
+ separated list of instance statuses
260
+ order_type_in (list[GetInstancesV2InstancesGetOrderTypeInType0Item] | None | Unset):
261
+ Comma-separated list of order types
262
+ bid_fid_in (list[str] | None | Unset): Comma-separated list of bid FIDs
263
+ reservation_fid_in (list[str] | None | Unset): Comma-separated list of reservation FIDs
264
+ limit (int | None | Unset):
265
+
266
+ Raises:
267
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
268
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
269
+
270
+ Returns:
271
+ GetInstancesResponse | HTTPValidationError
272
+ """
273
+ return sync_detailed(
274
+ client=client,
275
+ next_cursor=next_cursor,
276
+ sort_by=sort_by,
277
+ sort_dir=sort_dir,
278
+ project=project,
279
+ instance_type=instance_type,
280
+ region=region,
281
+ status_in=status_in,
282
+ order_type_in=order_type_in,
283
+ bid_fid_in=bid_fid_in,
284
+ reservation_fid_in=reservation_fid_in,
285
+ limit=limit,
286
+ ).parsed
287
+
288
+
289
+ async def asyncio_detailed(
290
+ *,
291
+ client: AuthenticatedClient,
292
+ next_cursor: Any | Unset = UNSET,
293
+ sort_by: GetInstancesV2InstancesGetSortBy | Unset = UNSET,
294
+ sort_dir: SortDirection | Unset = UNSET,
295
+ project: str,
296
+ instance_type: None | str | Unset = UNSET,
297
+ region: None | str | Unset = UNSET,
298
+ status_in: list[GetInstancesV2InstancesGetStatusInType0Item] | None | Unset = UNSET,
299
+ order_type_in: list[GetInstancesV2InstancesGetOrderTypeInType0Item]
300
+ | None
301
+ | Unset = UNSET,
302
+ bid_fid_in: list[str] | None | Unset = UNSET,
303
+ reservation_fid_in: list[str] | None | Unset = UNSET,
304
+ limit: int | None | Unset = UNSET,
305
+ ) -> Response[GetInstancesResponse | HTTPValidationError]:
306
+ """Get Instances
307
+
308
+ Get all instances for a project
309
+
310
+ Args:
311
+ next_cursor (Any | Unset):
312
+ sort_by (GetInstancesV2InstancesGetSortBy | Unset):
313
+ sort_dir (SortDirection | Unset):
314
+ project (str):
315
+ instance_type (None | str | Unset):
316
+ region (None | str | Unset):
317
+ status_in (list[GetInstancesV2InstancesGetStatusInType0Item] | None | Unset): Comma-
318
+ separated list of instance statuses
319
+ order_type_in (list[GetInstancesV2InstancesGetOrderTypeInType0Item] | None | Unset):
320
+ Comma-separated list of order types
321
+ bid_fid_in (list[str] | None | Unset): Comma-separated list of bid FIDs
322
+ reservation_fid_in (list[str] | None | Unset): Comma-separated list of reservation FIDs
323
+ limit (int | None | Unset):
324
+
325
+ Raises:
326
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
327
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
328
+
329
+ Returns:
330
+ Response[GetInstancesResponse | HTTPValidationError]
331
+ """
332
+ kwargs = _get_kwargs(
333
+ next_cursor=next_cursor,
334
+ sort_by=sort_by,
335
+ sort_dir=sort_dir,
336
+ project=project,
337
+ instance_type=instance_type,
338
+ region=region,
339
+ status_in=status_in,
340
+ order_type_in=order_type_in,
341
+ bid_fid_in=bid_fid_in,
342
+ reservation_fid_in=reservation_fid_in,
343
+ limit=limit,
344
+ )
345
+
346
+ response = await client.get_async_httpx_client().request(**kwargs)
347
+
348
+ return _build_response(client=client, response=response)
349
+
350
+
351
+ async def asyncio(
352
+ *,
353
+ client: AuthenticatedClient,
354
+ next_cursor: Any | Unset = UNSET,
355
+ sort_by: GetInstancesV2InstancesGetSortBy | Unset = UNSET,
356
+ sort_dir: SortDirection | Unset = UNSET,
357
+ project: str,
358
+ instance_type: None | str | Unset = UNSET,
359
+ region: None | str | Unset = UNSET,
360
+ status_in: list[GetInstancesV2InstancesGetStatusInType0Item] | None | Unset = UNSET,
361
+ order_type_in: list[GetInstancesV2InstancesGetOrderTypeInType0Item]
362
+ | None
363
+ | Unset = UNSET,
364
+ bid_fid_in: list[str] | None | Unset = UNSET,
365
+ reservation_fid_in: list[str] | None | Unset = UNSET,
366
+ limit: int | None | Unset = UNSET,
367
+ ) -> GetInstancesResponse | HTTPValidationError | None:
368
+ """Get Instances
369
+
370
+ Get all instances for a project
371
+
372
+ Args:
373
+ next_cursor (Any | Unset):
374
+ sort_by (GetInstancesV2InstancesGetSortBy | Unset):
375
+ sort_dir (SortDirection | Unset):
376
+ project (str):
377
+ instance_type (None | str | Unset):
378
+ region (None | str | Unset):
379
+ status_in (list[GetInstancesV2InstancesGetStatusInType0Item] | None | Unset): Comma-
380
+ separated list of instance statuses
381
+ order_type_in (list[GetInstancesV2InstancesGetOrderTypeInType0Item] | None | Unset):
382
+ Comma-separated list of order types
383
+ bid_fid_in (list[str] | None | Unset): Comma-separated list of bid FIDs
384
+ reservation_fid_in (list[str] | None | Unset): Comma-separated list of reservation FIDs
385
+ limit (int | None | Unset):
386
+
387
+ Raises:
388
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
389
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
390
+
391
+ Returns:
392
+ GetInstancesResponse | HTTPValidationError
393
+ """
394
+ return (
395
+ await asyncio_detailed(
396
+ client=client,
397
+ next_cursor=next_cursor,
398
+ sort_by=sort_by,
399
+ sort_dir=sort_dir,
400
+ project=project,
401
+ instance_type=instance_type,
402
+ region=region,
403
+ status_in=status_in,
404
+ order_type_in=order_type_in,
405
+ bid_fid_in=bid_fid_in,
406
+ reservation_fid_in=reservation_fid_in,
407
+ limit=limit,
408
+ )
409
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,171 @@
1
+ from __future__ import annotations
2
+
3
+ from http import HTTPStatus
4
+ from typing import Any
5
+
6
+ import httpx
7
+
8
+ from ... import errors
9
+ from ...client import AuthenticatedClient, Client
10
+ from ...models.create_kubernetes_cluster_request import CreateKubernetesClusterRequest
11
+ from ...models.http_validation_error import HTTPValidationError
12
+ from ...models.kubernetes_cluster_model import KubernetesClusterModel
13
+ from ...types import Response
14
+
15
+
16
+ def _get_kwargs(
17
+ *,
18
+ body: CreateKubernetesClusterRequest,
19
+ ) -> dict[str, Any]:
20
+ headers: dict[str, Any] = {}
21
+
22
+ _kwargs: dict[str, Any] = {
23
+ "method": "post",
24
+ "url": "/v2/kubernetes/clusters",
25
+ }
26
+
27
+ _kwargs["json"] = body.to_dict()
28
+
29
+ headers["Content-Type"] = "application/json"
30
+
31
+ _kwargs["headers"] = headers
32
+ return _kwargs
33
+
34
+
35
+ def _parse_response(
36
+ *, client: AuthenticatedClient | Client, response: httpx.Response
37
+ ) -> HTTPValidationError | KubernetesClusterModel | None:
38
+ if response.status_code == 201:
39
+ response_201 = KubernetesClusterModel.from_dict(response.json())
40
+
41
+ return response_201
42
+
43
+ if response.status_code == 422:
44
+ response_422 = HTTPValidationError.from_dict(response.json())
45
+
46
+ return response_422
47
+
48
+ if client.raise_on_unexpected_status:
49
+ raise errors.UnexpectedStatus(response.status_code, response.content)
50
+ return None
51
+
52
+
53
+ def _build_response(
54
+ *, client: AuthenticatedClient | Client, response: httpx.Response
55
+ ) -> Response[HTTPValidationError | KubernetesClusterModel]:
56
+ return Response(
57
+ status_code=HTTPStatus(response.status_code),
58
+ content=response.content,
59
+ headers=response.headers,
60
+ parsed=_parse_response(client=client, response=response),
61
+ )
62
+
63
+
64
+ def sync_detailed(
65
+ *,
66
+ client: AuthenticatedClient,
67
+ body: CreateKubernetesClusterRequest,
68
+ ) -> Response[HTTPValidationError | KubernetesClusterModel]:
69
+ """Create Kubernetes Cluster
70
+
71
+ Create a new Kubernetes cluster
72
+
73
+ Args:
74
+ body (CreateKubernetesClusterRequest):
75
+
76
+ Raises:
77
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
78
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
79
+
80
+ Returns:
81
+ Response[HTTPValidationError | KubernetesClusterModel]
82
+ """
83
+ kwargs = _get_kwargs(
84
+ body=body,
85
+ )
86
+
87
+ response = client.get_httpx_client().request(
88
+ **kwargs,
89
+ )
90
+
91
+ return _build_response(client=client, response=response)
92
+
93
+
94
+ def sync(
95
+ *,
96
+ client: AuthenticatedClient,
97
+ body: CreateKubernetesClusterRequest,
98
+ ) -> HTTPValidationError | KubernetesClusterModel | None:
99
+ """Create Kubernetes Cluster
100
+
101
+ Create a new Kubernetes cluster
102
+
103
+ Args:
104
+ body (CreateKubernetesClusterRequest):
105
+
106
+ Raises:
107
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
108
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
109
+
110
+ Returns:
111
+ HTTPValidationError | KubernetesClusterModel
112
+ """
113
+ return sync_detailed(
114
+ client=client,
115
+ body=body,
116
+ ).parsed
117
+
118
+
119
+ async def asyncio_detailed(
120
+ *,
121
+ client: AuthenticatedClient,
122
+ body: CreateKubernetesClusterRequest,
123
+ ) -> Response[HTTPValidationError | KubernetesClusterModel]:
124
+ """Create Kubernetes Cluster
125
+
126
+ Create a new Kubernetes cluster
127
+
128
+ Args:
129
+ body (CreateKubernetesClusterRequest):
130
+
131
+ Raises:
132
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
133
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
134
+
135
+ Returns:
136
+ Response[HTTPValidationError | KubernetesClusterModel]
137
+ """
138
+ kwargs = _get_kwargs(
139
+ body=body,
140
+ )
141
+
142
+ response = await client.get_async_httpx_client().request(**kwargs)
143
+
144
+ return _build_response(client=client, response=response)
145
+
146
+
147
+ async def asyncio(
148
+ *,
149
+ client: AuthenticatedClient,
150
+ body: CreateKubernetesClusterRequest,
151
+ ) -> HTTPValidationError | KubernetesClusterModel | None:
152
+ """Create Kubernetes Cluster
153
+
154
+ Create a new Kubernetes cluster
155
+
156
+ Args:
157
+ body (CreateKubernetesClusterRequest):
158
+
159
+ Raises:
160
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
161
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
162
+
163
+ Returns:
164
+ HTTPValidationError | KubernetesClusterModel
165
+ """
166
+ return (
167
+ await asyncio_detailed(
168
+ client=client,
169
+ body=body,
170
+ )
171
+ ).parsed