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.
- mithril/__init__.py +7 -0
- mithril/_mcli.cpython-314-darwin.so +0 -0
- mithril/_mcli.pyi +7 -0
- mithril/_mcli_entry.py +75 -0
- mithril/api/__init__.py +7 -0
- mithril/api/bindings/.gitattributes +2 -0
- mithril/api/bindings/__init__.py +10 -0
- mithril/api/bindings/api/__init__.py +1 -0
- mithril/api/bindings/api/api_keys/__init__.py +1 -0
- mithril/api/bindings/api/api_keys/create_api_key_v2_api_keys_post.py +179 -0
- mithril/api/bindings/api/api_keys/get_api_keys_v2_api_keys_get.py +141 -0
- mithril/api/bindings/api/api_keys/revoke_api_key_v2_api_keys_key_fid_delete.py +173 -0
- mithril/api/bindings/api/image_versions/__init__.py +1 -0
- mithril/api/bindings/api/image_versions/get_image_versions_v2_image_versions_get.py +141 -0
- mithril/api/bindings/api/image_versions/get_mcc_image_versions_v2_mcc_image_versions_get.py +179 -0
- mithril/api/bindings/api/instance_types/__init__.py +1 -0
- mithril/api/bindings/api/instance_types/get_instance_types_v2_instance_types_get.py +137 -0
- mithril/api/bindings/api/instances/__init__.py +1 -0
- mithril/api/bindings/api/instances/get_instance_status_v2_instances_instance_id_status_get.py +165 -0
- mithril/api/bindings/api/instances/get_instances_v2_instances_get.py +409 -0
- mithril/api/bindings/api/kubernetes_clusters/__init__.py +1 -0
- mithril/api/bindings/api/kubernetes_clusters/create_kubernetes_cluster_v2_kubernetes_clusters_post.py +171 -0
- mithril/api/bindings/api/kubernetes_clusters/delete_kubernetes_cluster_v2_kubernetes_clusters_cluster_fid_delete.py +163 -0
- mithril/api/bindings/api/kubernetes_clusters/get_kubernetes_cluster_v2_kubernetes_clusters_cluster_fid_get.py +165 -0
- mithril/api/bindings/api/kubernetes_clusters/get_kubernetes_clusters_v2_kubernetes_clusters_get.py +175 -0
- mithril/api/bindings/api/lifecycle_scripts/__init__.py +1 -0
- mithril/api/bindings/api/lifecycle_scripts/create_lifecycle_script_v2_lifecycle_scripts_post.py +171 -0
- mithril/api/bindings/api/lifecycle_scripts/delete_lifecycle_script_v2_lifecycle_scripts_ls_fid_delete.py +155 -0
- mithril/api/bindings/api/lifecycle_scripts/get_lifecycle_script_content_v2_lifecycle_scripts_ls_fid_content_get.py +155 -0
- mithril/api/bindings/api/lifecycle_scripts/list_lifecycle_scripts_v2_lifecycle_scripts_get.py +247 -0
- mithril/api/bindings/api/lifecycle_scripts/update_lifecycle_script_v2_lifecycle_scripts_ls_fid_patch.py +179 -0
- mithril/api/bindings/api/pricing/__init__.py +1 -0
- mithril/api/bindings/api/pricing/get_current_prices_v2_v2_pricing_current_get.py +217 -0
- mithril/api/bindings/api/pricing/get_historical_prices_v2_v2_pricing_history_get.py +222 -0
- mithril/api/bindings/api/profile/__init__.py +1 -0
- mithril/api/bindings/api/profile/get_me_v2_me_get.py +132 -0
- mithril/api/bindings/api/profile/get_my_teammates_v2_me_teammates_get.py +153 -0
- mithril/api/bindings/api/projects/__init__.py +1 -0
- mithril/api/bindings/api/projects/get_projects_v2_projects_get.py +137 -0
- mithril/api/bindings/api/quotas/__init__.py +1 -0
- mithril/api/bindings/api/quotas/get_quotas_v2_quotas_get.py +175 -0
- mithril/api/bindings/api/reservations/__init__.py +1 -0
- mithril/api/bindings/api/reservations/create_reservation_v2_reservation_post.py +171 -0
- mithril/api/bindings/api/reservations/extend_reservation_v2_reservation_reservation_fid_extend_post.py +187 -0
- mithril/api/bindings/api/reservations/get_availability_v2_reservation_availability_get.py +664 -0
- mithril/api/bindings/api/reservations/get_extension_availability_v2_reservation_reservation_fid_extension_availability_get.py +165 -0
- mithril/api/bindings/api/reservations/get_reservations_v2_reservation_get.py +309 -0
- mithril/api/bindings/api/reservations/update_reservation_v2_reservation_reservation_fid_patch.py +187 -0
- mithril/api/bindings/api/spot/__init__.py +1 -0
- mithril/api/bindings/api/spot/cancel_bid_v2_spot_bids_bid_fid_delete.py +161 -0
- mithril/api/bindings/api/spot/create_bid_v2_spot_bids_post.py +171 -0
- mithril/api/bindings/api/spot/get_auctions_v2_spot_availability_get.py +137 -0
- mithril/api/bindings/api/spot/get_bid_history_v2_spot_bids_bid_fid_history_get.py +193 -0
- mithril/api/bindings/api/spot/get_bid_status_v2_spot_bids_bid_fid_status_get.py +189 -0
- mithril/api/bindings/api/spot/get_bid_v2_spot_bids_bid_fid_get.py +163 -0
- mithril/api/bindings/api/spot/get_bids_v2_spot_bids_get.py +330 -0
- mithril/api/bindings/api/spot/update_bid_v2_spot_bids_bid_fid_patch.py +185 -0
- mithril/api/bindings/api/ssh_keys/__init__.py +1 -0
- mithril/api/bindings/api/ssh_keys/create_ssh_key_v2_ssh_keys_post.py +175 -0
- mithril/api/bindings/api/ssh_keys/delete_ssh_key_v2_ssh_keys_ssh_key_fid_delete.py +167 -0
- mithril/api/bindings/api/ssh_keys/get_ssh_keys_v2_ssh_keys_get.py +175 -0
- mithril/api/bindings/api/ssh_keys/update_ssh_key_v2_ssh_keys_ssh_key_fid_patch.py +187 -0
- mithril/api/bindings/api/volumes/__init__.py +1 -0
- mithril/api/bindings/api/volumes/create_volume_v2_volumes_post.py +211 -0
- mithril/api/bindings/api/volumes/delete_volume_v2_volumes_volume_fid_delete.py +199 -0
- mithril/api/bindings/api/volumes/get_volumes_v2_volumes_get.py +239 -0
- mithril/api/bindings/api/volumes/update_volume_v2_volumes_volume_fid_patch.py +243 -0
- mithril/api/bindings/client.py +284 -0
- mithril/api/bindings/errors.py +18 -0
- mithril/api/bindings/models/__init__.py +169 -0
- mithril/api/bindings/models/api_key_model.py +114 -0
- mithril/api/bindings/models/auction_model.py +146 -0
- mithril/api/bindings/models/availability_slot_model.py +76 -0
- mithril/api/bindings/models/bid_history_event_model.py +157 -0
- mithril/api/bindings/models/bid_history_event_model_event_type.py +19 -0
- mithril/api/bindings/models/bid_history_response.py +84 -0
- mithril/api/bindings/models/bid_model.py +191 -0
- mithril/api/bindings/models/bid_model_status.py +14 -0
- mithril/api/bindings/models/bid_status_response.py +72 -0
- mithril/api/bindings/models/bid_status_response_status.py +15 -0
- mithril/api/bindings/models/check_availability_response.py +60 -0
- mithril/api/bindings/models/create_api_key_request.py +68 -0
- mithril/api/bindings/models/create_api_key_response.py +122 -0
- mithril/api/bindings/models/create_bid_request.py +116 -0
- mithril/api/bindings/models/create_kubernetes_cluster_request.py +136 -0
- mithril/api/bindings/models/create_kubernetes_cluster_request_k8s_version.py +11 -0
- mithril/api/bindings/models/create_lifecycle_script_request.py +115 -0
- mithril/api/bindings/models/create_reservation_request.py +124 -0
- mithril/api/bindings/models/create_ssh_key_request.py +99 -0
- mithril/api/bindings/models/create_volume_request.py +98 -0
- mithril/api/bindings/models/create_volume_request_disk_interface.py +11 -0
- mithril/api/bindings/models/created_ssh_key_model.py +122 -0
- mithril/api/bindings/models/current_prices_response.py +202 -0
- mithril/api/bindings/models/extend_reservation_request.py +60 -0
- mithril/api/bindings/models/extension_availability_response.py +68 -0
- mithril/api/bindings/models/get_availability_v2_reservation_availability_get_mode.py +12 -0
- mithril/api/bindings/models/get_bids_response.py +96 -0
- mithril/api/bindings/models/get_bids_v2_spot_bids_get_sort_by.py +11 -0
- mithril/api/bindings/models/get_bids_v2_spot_bids_get_status.py +14 -0
- mithril/api/bindings/models/get_instances_response.py +96 -0
- mithril/api/bindings/models/get_instances_v2_instances_get_order_type_in_type_0_item.py +11 -0
- mithril/api/bindings/models/get_instances_v2_instances_get_sort_by.py +12 -0
- mithril/api/bindings/models/get_instances_v2_instances_get_status_in_type_0_item.py +24 -0
- mithril/api/bindings/models/get_latest_end_time_response.py +68 -0
- mithril/api/bindings/models/get_reservations_response.py +96 -0
- mithril/api/bindings/models/get_reservations_v2_reservation_get_sort_by.py +11 -0
- mithril/api/bindings/models/get_reservations_v2_reservation_get_status.py +14 -0
- mithril/api/bindings/models/historical_price_point_model.py +94 -0
- mithril/api/bindings/models/historical_prices_response_model.py +76 -0
- mithril/api/bindings/models/http_validation_error.py +78 -0
- mithril/api/bindings/models/image_version_model.py +224 -0
- mithril/api/bindings/models/instance_model.py +211 -0
- mithril/api/bindings/models/instance_model_status.py +24 -0
- mithril/api/bindings/models/instance_status_response.py +141 -0
- mithril/api/bindings/models/instance_status_response_status.py +24 -0
- mithril/api/bindings/models/instance_type_model.py +170 -0
- mithril/api/bindings/models/kubernetes_cluster_model.py +207 -0
- mithril/api/bindings/models/kubernetes_cluster_model_status.py +12 -0
- mithril/api/bindings/models/launch_specification_model.py +152 -0
- mithril/api/bindings/models/lifecycle_script_model.py +134 -0
- mithril/api/bindings/models/lifecycle_script_scope.py +12 -0
- mithril/api/bindings/models/list_lifecycle_scripts_response.py +96 -0
- mithril/api/bindings/models/list_lifecycle_scripts_v2_lifecycle_scripts_get_sort_by.py +11 -0
- mithril/api/bindings/models/me_response.py +126 -0
- mithril/api/bindings/models/new_ssh_key_model.py +100 -0
- mithril/api/bindings/models/persistent_disk_change.py +92 -0
- mithril/api/bindings/models/project_model.py +76 -0
- mithril/api/bindings/models/public_lifecycle_script_scope.py +11 -0
- mithril/api/bindings/models/quota_model.py +132 -0
- mithril/api/bindings/models/reservation_model.py +215 -0
- mithril/api/bindings/models/reservation_model_status.py +14 -0
- mithril/api/bindings/models/size.py +70 -0
- mithril/api/bindings/models/size_unit.py +18 -0
- mithril/api/bindings/models/sort_direction.py +11 -0
- mithril/api/bindings/models/teammate_response.py +158 -0
- mithril/api/bindings/models/update_bid_request.py +143 -0
- mithril/api/bindings/models/update_lifecycle_script_request.py +109 -0
- mithril/api/bindings/models/update_reservation_request.py +103 -0
- mithril/api/bindings/models/update_ssh_key_request.py +60 -0
- mithril/api/bindings/models/update_volume_request.py +65 -0
- mithril/api/bindings/models/validation_error.py +89 -0
- mithril/api/bindings/models/volume_model.py +140 -0
- mithril/api/bindings/models/volume_model_attachments.py +46 -0
- mithril/api/bindings/models/volume_model_interface.py +11 -0
- mithril/api/bindings/types.py +56 -0
- mithril/api/client.py +138 -0
- mithril/cli/__init__.py +7 -0
- mithril/cli/commands/__init__.py +15 -0
- mithril/cli/commands/help.py +88 -0
- mithril/cli/commands/launch.py +353 -0
- mithril/cli/main.py +68 -0
- mithril/cli/utils/__init__.py +1 -0
- mithril/cli/utils/skypilot_passthrough.py +38 -0
- mithril/cli/utils/streaming.py +235 -0
- mithril/cli/utils/volumes.py +110 -0
- mithril/config.py +47 -0
- mithril/py.typed +0 -0
- mithril/sky/__init__.py +141 -0
- mithril/sky/client.py +176 -0
- mithril_client-0.1.0a1.dist-info/METADATA +56 -0
- mithril_client-0.1.0a1.dist-info/RECORD +163 -0
- mithril_client-0.1.0a1.dist-info/WHEEL +4 -0
- mithril_client-0.1.0a1.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from http import HTTPStatus
|
|
4
|
+
from typing import Any
|
|
5
|
+
from urllib.parse import quote
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ... import errors
|
|
10
|
+
from ...client import AuthenticatedClient, Client
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...models.lifecycle_script_model import LifecycleScriptModel
|
|
13
|
+
from ...models.update_lifecycle_script_request import UpdateLifecycleScriptRequest
|
|
14
|
+
from ...types import Response
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
ls_fid: str,
|
|
19
|
+
*,
|
|
20
|
+
body: UpdateLifecycleScriptRequest,
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
_kwargs: dict[str, Any] = {
|
|
25
|
+
"method": "patch",
|
|
26
|
+
"url": "/v2/lifecycle-scripts/{ls_fid}".format(
|
|
27
|
+
ls_fid=quote(str(ls_fid), safe="")
|
|
28
|
+
),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_kwargs["json"] = body.to_dict()
|
|
32
|
+
|
|
33
|
+
headers["Content-Type"] = "application/json"
|
|
34
|
+
|
|
35
|
+
_kwargs["headers"] = headers
|
|
36
|
+
return _kwargs
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _parse_response(
|
|
40
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
41
|
+
) -> HTTPValidationError | LifecycleScriptModel | None:
|
|
42
|
+
if response.status_code == 200:
|
|
43
|
+
response_200 = LifecycleScriptModel.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_200
|
|
46
|
+
|
|
47
|
+
if response.status_code == 422:
|
|
48
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_422
|
|
51
|
+
|
|
52
|
+
if client.raise_on_unexpected_status:
|
|
53
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _build_response(
|
|
58
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
59
|
+
) -> Response[HTTPValidationError | LifecycleScriptModel]:
|
|
60
|
+
return Response(
|
|
61
|
+
status_code=HTTPStatus(response.status_code),
|
|
62
|
+
content=response.content,
|
|
63
|
+
headers=response.headers,
|
|
64
|
+
parsed=_parse_response(client=client, response=response),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def sync_detailed(
|
|
69
|
+
ls_fid: str,
|
|
70
|
+
*,
|
|
71
|
+
client: AuthenticatedClient,
|
|
72
|
+
body: UpdateLifecycleScriptRequest,
|
|
73
|
+
) -> Response[HTTPValidationError | LifecycleScriptModel]:
|
|
74
|
+
"""Update Lifecycle Script
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
ls_fid (str):
|
|
78
|
+
body (UpdateLifecycleScriptRequest):
|
|
79
|
+
|
|
80
|
+
Raises:
|
|
81
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
82
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
Response[HTTPValidationError | LifecycleScriptModel]
|
|
86
|
+
"""
|
|
87
|
+
kwargs = _get_kwargs(
|
|
88
|
+
ls_fid=ls_fid,
|
|
89
|
+
body=body,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
response = client.get_httpx_client().request(
|
|
93
|
+
**kwargs,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
return _build_response(client=client, response=response)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def sync(
|
|
100
|
+
ls_fid: str,
|
|
101
|
+
*,
|
|
102
|
+
client: AuthenticatedClient,
|
|
103
|
+
body: UpdateLifecycleScriptRequest,
|
|
104
|
+
) -> HTTPValidationError | LifecycleScriptModel | None:
|
|
105
|
+
"""Update Lifecycle Script
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
ls_fid (str):
|
|
109
|
+
body (UpdateLifecycleScriptRequest):
|
|
110
|
+
|
|
111
|
+
Raises:
|
|
112
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
113
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
HTTPValidationError | LifecycleScriptModel
|
|
117
|
+
"""
|
|
118
|
+
return sync_detailed(
|
|
119
|
+
ls_fid=ls_fid,
|
|
120
|
+
client=client,
|
|
121
|
+
body=body,
|
|
122
|
+
).parsed
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
async def asyncio_detailed(
|
|
126
|
+
ls_fid: str,
|
|
127
|
+
*,
|
|
128
|
+
client: AuthenticatedClient,
|
|
129
|
+
body: UpdateLifecycleScriptRequest,
|
|
130
|
+
) -> Response[HTTPValidationError | LifecycleScriptModel]:
|
|
131
|
+
"""Update Lifecycle Script
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
ls_fid (str):
|
|
135
|
+
body (UpdateLifecycleScriptRequest):
|
|
136
|
+
|
|
137
|
+
Raises:
|
|
138
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
139
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
Response[HTTPValidationError | LifecycleScriptModel]
|
|
143
|
+
"""
|
|
144
|
+
kwargs = _get_kwargs(
|
|
145
|
+
ls_fid=ls_fid,
|
|
146
|
+
body=body,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
150
|
+
|
|
151
|
+
return _build_response(client=client, response=response)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
async def asyncio(
|
|
155
|
+
ls_fid: str,
|
|
156
|
+
*,
|
|
157
|
+
client: AuthenticatedClient,
|
|
158
|
+
body: UpdateLifecycleScriptRequest,
|
|
159
|
+
) -> HTTPValidationError | LifecycleScriptModel | None:
|
|
160
|
+
"""Update Lifecycle Script
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
ls_fid (str):
|
|
164
|
+
body (UpdateLifecycleScriptRequest):
|
|
165
|
+
|
|
166
|
+
Raises:
|
|
167
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
168
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
HTTPValidationError | LifecycleScriptModel
|
|
172
|
+
"""
|
|
173
|
+
return (
|
|
174
|
+
await asyncio_detailed(
|
|
175
|
+
ls_fid=ls_fid,
|
|
176
|
+
client=client,
|
|
177
|
+
body=body,
|
|
178
|
+
)
|
|
179
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,217 @@
|
|
|
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.current_prices_response import CurrentPricesResponse
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
instance_type: str,
|
|
18
|
+
region: None | str | Unset = UNSET,
|
|
19
|
+
instance_quantity: int | Unset = 1,
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
params: dict[str, Any] = {}
|
|
22
|
+
|
|
23
|
+
params["instance_type"] = instance_type
|
|
24
|
+
|
|
25
|
+
json_region: None | str | Unset
|
|
26
|
+
if isinstance(region, Unset):
|
|
27
|
+
json_region = UNSET
|
|
28
|
+
else:
|
|
29
|
+
json_region = region
|
|
30
|
+
params["region"] = json_region
|
|
31
|
+
|
|
32
|
+
params["instance_quantity"] = instance_quantity
|
|
33
|
+
|
|
34
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
35
|
+
|
|
36
|
+
_kwargs: dict[str, Any] = {
|
|
37
|
+
"method": "get",
|
|
38
|
+
"url": "/v2/pricing/current",
|
|
39
|
+
"params": params,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return _kwargs
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _parse_response(
|
|
46
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
47
|
+
) -> CurrentPricesResponse | HTTPValidationError | None:
|
|
48
|
+
if response.status_code == 200:
|
|
49
|
+
response_200 = CurrentPricesResponse.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_200
|
|
52
|
+
|
|
53
|
+
if response.status_code == 422:
|
|
54
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_422
|
|
57
|
+
|
|
58
|
+
if client.raise_on_unexpected_status:
|
|
59
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _build_response(
|
|
64
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
65
|
+
) -> Response[CurrentPricesResponse | HTTPValidationError]:
|
|
66
|
+
return Response(
|
|
67
|
+
status_code=HTTPStatus(response.status_code),
|
|
68
|
+
content=response.content,
|
|
69
|
+
headers=response.headers,
|
|
70
|
+
parsed=_parse_response(client=client, response=response),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def sync_detailed(
|
|
75
|
+
*,
|
|
76
|
+
client: AuthenticatedClient,
|
|
77
|
+
instance_type: str,
|
|
78
|
+
region: None | str | Unset = UNSET,
|
|
79
|
+
instance_quantity: int | Unset = 1,
|
|
80
|
+
) -> Response[CurrentPricesResponse | HTTPValidationError]:
|
|
81
|
+
"""Get Current Prices V2
|
|
82
|
+
|
|
83
|
+
Get current pricing information for an instance type.
|
|
84
|
+
|
|
85
|
+
Returns the current spot price, reserved price, and minimum price for a given
|
|
86
|
+
instance type, optionally filtered by region.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
instance_type (str):
|
|
90
|
+
region (None | str | Unset):
|
|
91
|
+
instance_quantity (int | Unset): Default: 1.
|
|
92
|
+
|
|
93
|
+
Raises:
|
|
94
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
95
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
Response[CurrentPricesResponse | HTTPValidationError]
|
|
99
|
+
"""
|
|
100
|
+
kwargs = _get_kwargs(
|
|
101
|
+
instance_type=instance_type,
|
|
102
|
+
region=region,
|
|
103
|
+
instance_quantity=instance_quantity,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
response = client.get_httpx_client().request(
|
|
107
|
+
**kwargs,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return _build_response(client=client, response=response)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def sync(
|
|
114
|
+
*,
|
|
115
|
+
client: AuthenticatedClient,
|
|
116
|
+
instance_type: str,
|
|
117
|
+
region: None | str | Unset = UNSET,
|
|
118
|
+
instance_quantity: int | Unset = 1,
|
|
119
|
+
) -> CurrentPricesResponse | HTTPValidationError | None:
|
|
120
|
+
"""Get Current Prices V2
|
|
121
|
+
|
|
122
|
+
Get current pricing information for an instance type.
|
|
123
|
+
|
|
124
|
+
Returns the current spot price, reserved price, and minimum price for a given
|
|
125
|
+
instance type, optionally filtered by region.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
instance_type (str):
|
|
129
|
+
region (None | str | Unset):
|
|
130
|
+
instance_quantity (int | Unset): Default: 1.
|
|
131
|
+
|
|
132
|
+
Raises:
|
|
133
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
134
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
135
|
+
|
|
136
|
+
Returns:
|
|
137
|
+
CurrentPricesResponse | HTTPValidationError
|
|
138
|
+
"""
|
|
139
|
+
return sync_detailed(
|
|
140
|
+
client=client,
|
|
141
|
+
instance_type=instance_type,
|
|
142
|
+
region=region,
|
|
143
|
+
instance_quantity=instance_quantity,
|
|
144
|
+
).parsed
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
async def asyncio_detailed(
|
|
148
|
+
*,
|
|
149
|
+
client: AuthenticatedClient,
|
|
150
|
+
instance_type: str,
|
|
151
|
+
region: None | str | Unset = UNSET,
|
|
152
|
+
instance_quantity: int | Unset = 1,
|
|
153
|
+
) -> Response[CurrentPricesResponse | HTTPValidationError]:
|
|
154
|
+
"""Get Current Prices V2
|
|
155
|
+
|
|
156
|
+
Get current pricing information for an instance type.
|
|
157
|
+
|
|
158
|
+
Returns the current spot price, reserved price, and minimum price for a given
|
|
159
|
+
instance type, optionally filtered by region.
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
instance_type (str):
|
|
163
|
+
region (None | str | Unset):
|
|
164
|
+
instance_quantity (int | Unset): Default: 1.
|
|
165
|
+
|
|
166
|
+
Raises:
|
|
167
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
168
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
Response[CurrentPricesResponse | HTTPValidationError]
|
|
172
|
+
"""
|
|
173
|
+
kwargs = _get_kwargs(
|
|
174
|
+
instance_type=instance_type,
|
|
175
|
+
region=region,
|
|
176
|
+
instance_quantity=instance_quantity,
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
180
|
+
|
|
181
|
+
return _build_response(client=client, response=response)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
async def asyncio(
|
|
185
|
+
*,
|
|
186
|
+
client: AuthenticatedClient,
|
|
187
|
+
instance_type: str,
|
|
188
|
+
region: None | str | Unset = UNSET,
|
|
189
|
+
instance_quantity: int | Unset = 1,
|
|
190
|
+
) -> CurrentPricesResponse | HTTPValidationError | None:
|
|
191
|
+
"""Get Current Prices V2
|
|
192
|
+
|
|
193
|
+
Get current pricing information for an instance type.
|
|
194
|
+
|
|
195
|
+
Returns the current spot price, reserved price, and minimum price for a given
|
|
196
|
+
instance type, optionally filtered by region.
|
|
197
|
+
|
|
198
|
+
Args:
|
|
199
|
+
instance_type (str):
|
|
200
|
+
region (None | str | Unset):
|
|
201
|
+
instance_quantity (int | Unset): Default: 1.
|
|
202
|
+
|
|
203
|
+
Raises:
|
|
204
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
205
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
CurrentPricesResponse | HTTPValidationError
|
|
209
|
+
"""
|
|
210
|
+
return (
|
|
211
|
+
await asyncio_detailed(
|
|
212
|
+
client=client,
|
|
213
|
+
instance_type=instance_type,
|
|
214
|
+
region=region,
|
|
215
|
+
instance_quantity=instance_quantity,
|
|
216
|
+
)
|
|
217
|
+
).parsed
|
|
@@ -0,0 +1,222 @@
|
|
|
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.historical_prices_response_model import HistoricalPricesResponseModel
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
instance_type: None | str | Unset = UNSET,
|
|
18
|
+
region: None | str | Unset = UNSET,
|
|
19
|
+
num_samples: int | Unset = 100,
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
params: dict[str, Any] = {}
|
|
22
|
+
|
|
23
|
+
json_instance_type: None | str | Unset
|
|
24
|
+
if isinstance(instance_type, Unset):
|
|
25
|
+
json_instance_type = UNSET
|
|
26
|
+
else:
|
|
27
|
+
json_instance_type = instance_type
|
|
28
|
+
params["instance_type"] = json_instance_type
|
|
29
|
+
|
|
30
|
+
json_region: None | str | Unset
|
|
31
|
+
if isinstance(region, Unset):
|
|
32
|
+
json_region = UNSET
|
|
33
|
+
else:
|
|
34
|
+
json_region = region
|
|
35
|
+
params["region"] = json_region
|
|
36
|
+
|
|
37
|
+
params["num_samples"] = num_samples
|
|
38
|
+
|
|
39
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
40
|
+
|
|
41
|
+
_kwargs: dict[str, Any] = {
|
|
42
|
+
"method": "get",
|
|
43
|
+
"url": "/v2/pricing/history",
|
|
44
|
+
"params": params,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return _kwargs
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _parse_response(
|
|
51
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
52
|
+
) -> HTTPValidationError | HistoricalPricesResponseModel | None:
|
|
53
|
+
if response.status_code == 200:
|
|
54
|
+
response_200 = HistoricalPricesResponseModel.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_200
|
|
57
|
+
|
|
58
|
+
if response.status_code == 422:
|
|
59
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
60
|
+
|
|
61
|
+
return response_422
|
|
62
|
+
|
|
63
|
+
if client.raise_on_unexpected_status:
|
|
64
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
65
|
+
return None
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _build_response(
|
|
69
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
70
|
+
) -> Response[HTTPValidationError | HistoricalPricesResponseModel]:
|
|
71
|
+
return Response(
|
|
72
|
+
status_code=HTTPStatus(response.status_code),
|
|
73
|
+
content=response.content,
|
|
74
|
+
headers=response.headers,
|
|
75
|
+
parsed=_parse_response(client=client, response=response),
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def sync_detailed(
|
|
80
|
+
*,
|
|
81
|
+
client: AuthenticatedClient,
|
|
82
|
+
instance_type: None | str | Unset = UNSET,
|
|
83
|
+
region: None | str | Unset = UNSET,
|
|
84
|
+
num_samples: int | Unset = 100,
|
|
85
|
+
) -> Response[HTTPValidationError | HistoricalPricesResponseModel]:
|
|
86
|
+
"""Get Historical Prices V2
|
|
87
|
+
|
|
88
|
+
Get historical pricing information for instance types.
|
|
89
|
+
|
|
90
|
+
Returns historical spot and reserved prices over time for instance types,
|
|
91
|
+
optionally filtered by specific instance type and region.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
instance_type (None | str | Unset):
|
|
95
|
+
region (None | str | Unset):
|
|
96
|
+
num_samples (int | Unset): Default: 100.
|
|
97
|
+
|
|
98
|
+
Raises:
|
|
99
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
100
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
Response[HTTPValidationError | HistoricalPricesResponseModel]
|
|
104
|
+
"""
|
|
105
|
+
kwargs = _get_kwargs(
|
|
106
|
+
instance_type=instance_type,
|
|
107
|
+
region=region,
|
|
108
|
+
num_samples=num_samples,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
response = client.get_httpx_client().request(
|
|
112
|
+
**kwargs,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
return _build_response(client=client, response=response)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def sync(
|
|
119
|
+
*,
|
|
120
|
+
client: AuthenticatedClient,
|
|
121
|
+
instance_type: None | str | Unset = UNSET,
|
|
122
|
+
region: None | str | Unset = UNSET,
|
|
123
|
+
num_samples: int | Unset = 100,
|
|
124
|
+
) -> HTTPValidationError | HistoricalPricesResponseModel | None:
|
|
125
|
+
"""Get Historical Prices V2
|
|
126
|
+
|
|
127
|
+
Get historical pricing information for instance types.
|
|
128
|
+
|
|
129
|
+
Returns historical spot and reserved prices over time for instance types,
|
|
130
|
+
optionally filtered by specific instance type and region.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
instance_type (None | str | Unset):
|
|
134
|
+
region (None | str | Unset):
|
|
135
|
+
num_samples (int | Unset): Default: 100.
|
|
136
|
+
|
|
137
|
+
Raises:
|
|
138
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
139
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
HTTPValidationError | HistoricalPricesResponseModel
|
|
143
|
+
"""
|
|
144
|
+
return sync_detailed(
|
|
145
|
+
client=client,
|
|
146
|
+
instance_type=instance_type,
|
|
147
|
+
region=region,
|
|
148
|
+
num_samples=num_samples,
|
|
149
|
+
).parsed
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
async def asyncio_detailed(
|
|
153
|
+
*,
|
|
154
|
+
client: AuthenticatedClient,
|
|
155
|
+
instance_type: None | str | Unset = UNSET,
|
|
156
|
+
region: None | str | Unset = UNSET,
|
|
157
|
+
num_samples: int | Unset = 100,
|
|
158
|
+
) -> Response[HTTPValidationError | HistoricalPricesResponseModel]:
|
|
159
|
+
"""Get Historical Prices V2
|
|
160
|
+
|
|
161
|
+
Get historical pricing information for instance types.
|
|
162
|
+
|
|
163
|
+
Returns historical spot and reserved prices over time for instance types,
|
|
164
|
+
optionally filtered by specific instance type and region.
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
instance_type (None | str | Unset):
|
|
168
|
+
region (None | str | Unset):
|
|
169
|
+
num_samples (int | Unset): Default: 100.
|
|
170
|
+
|
|
171
|
+
Raises:
|
|
172
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
173
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
174
|
+
|
|
175
|
+
Returns:
|
|
176
|
+
Response[HTTPValidationError | HistoricalPricesResponseModel]
|
|
177
|
+
"""
|
|
178
|
+
kwargs = _get_kwargs(
|
|
179
|
+
instance_type=instance_type,
|
|
180
|
+
region=region,
|
|
181
|
+
num_samples=num_samples,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
185
|
+
|
|
186
|
+
return _build_response(client=client, response=response)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
async def asyncio(
|
|
190
|
+
*,
|
|
191
|
+
client: AuthenticatedClient,
|
|
192
|
+
instance_type: None | str | Unset = UNSET,
|
|
193
|
+
region: None | str | Unset = UNSET,
|
|
194
|
+
num_samples: int | Unset = 100,
|
|
195
|
+
) -> HTTPValidationError | HistoricalPricesResponseModel | None:
|
|
196
|
+
"""Get Historical Prices V2
|
|
197
|
+
|
|
198
|
+
Get historical pricing information for instance types.
|
|
199
|
+
|
|
200
|
+
Returns historical spot and reserved prices over time for instance types,
|
|
201
|
+
optionally filtered by specific instance type and region.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
instance_type (None | str | Unset):
|
|
205
|
+
region (None | str | Unset):
|
|
206
|
+
num_samples (int | Unset): Default: 100.
|
|
207
|
+
|
|
208
|
+
Raises:
|
|
209
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
210
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
HTTPValidationError | HistoricalPricesResponseModel
|
|
214
|
+
"""
|
|
215
|
+
return (
|
|
216
|
+
await asyncio_detailed(
|
|
217
|
+
client=client,
|
|
218
|
+
instance_type=instance_type,
|
|
219
|
+
region=region,
|
|
220
|
+
num_samples=num_samples,
|
|
221
|
+
)
|
|
222
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|