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,165 @@
|
|
|
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.extension_availability_response import ExtensionAvailabilityResponse
|
|
12
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
13
|
+
from ...types import Response
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
reservation_fid: str,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "get",
|
|
21
|
+
"url": "/v2/reservation/{reservation_fid}/extension-availability".format(
|
|
22
|
+
reservation_fid=quote(str(reservation_fid), safe="")
|
|
23
|
+
),
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return _kwargs
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _parse_response(
|
|
30
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
31
|
+
) -> ExtensionAvailabilityResponse | HTTPValidationError | None:
|
|
32
|
+
if response.status_code == 200:
|
|
33
|
+
response_200 = ExtensionAvailabilityResponse.from_dict(response.json())
|
|
34
|
+
|
|
35
|
+
return response_200
|
|
36
|
+
|
|
37
|
+
if response.status_code == 422:
|
|
38
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_422
|
|
41
|
+
|
|
42
|
+
if client.raise_on_unexpected_status:
|
|
43
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _build_response(
|
|
48
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
49
|
+
) -> Response[ExtensionAvailabilityResponse | HTTPValidationError]:
|
|
50
|
+
return Response(
|
|
51
|
+
status_code=HTTPStatus(response.status_code),
|
|
52
|
+
content=response.content,
|
|
53
|
+
headers=response.headers,
|
|
54
|
+
parsed=_parse_response(client=client, response=response),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def sync_detailed(
|
|
59
|
+
reservation_fid: str,
|
|
60
|
+
*,
|
|
61
|
+
client: AuthenticatedClient,
|
|
62
|
+
) -> Response[ExtensionAvailabilityResponse | HTTPValidationError]:
|
|
63
|
+
"""Get Extension Availability
|
|
64
|
+
|
|
65
|
+
Get extension availability for a reservation
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
reservation_fid (str):
|
|
69
|
+
|
|
70
|
+
Raises:
|
|
71
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
72
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
Response[ExtensionAvailabilityResponse | HTTPValidationError]
|
|
76
|
+
"""
|
|
77
|
+
kwargs = _get_kwargs(
|
|
78
|
+
reservation_fid=reservation_fid,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
response = client.get_httpx_client().request(
|
|
82
|
+
**kwargs,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
return _build_response(client=client, response=response)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def sync(
|
|
89
|
+
reservation_fid: str,
|
|
90
|
+
*,
|
|
91
|
+
client: AuthenticatedClient,
|
|
92
|
+
) -> ExtensionAvailabilityResponse | HTTPValidationError | None:
|
|
93
|
+
"""Get Extension Availability
|
|
94
|
+
|
|
95
|
+
Get extension availability for a reservation
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
reservation_fid (str):
|
|
99
|
+
|
|
100
|
+
Raises:
|
|
101
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
102
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
ExtensionAvailabilityResponse | HTTPValidationError
|
|
106
|
+
"""
|
|
107
|
+
return sync_detailed(
|
|
108
|
+
reservation_fid=reservation_fid,
|
|
109
|
+
client=client,
|
|
110
|
+
).parsed
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
async def asyncio_detailed(
|
|
114
|
+
reservation_fid: str,
|
|
115
|
+
*,
|
|
116
|
+
client: AuthenticatedClient,
|
|
117
|
+
) -> Response[ExtensionAvailabilityResponse | HTTPValidationError]:
|
|
118
|
+
"""Get Extension Availability
|
|
119
|
+
|
|
120
|
+
Get extension availability for a reservation
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
reservation_fid (str):
|
|
124
|
+
|
|
125
|
+
Raises:
|
|
126
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
127
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
Response[ExtensionAvailabilityResponse | HTTPValidationError]
|
|
131
|
+
"""
|
|
132
|
+
kwargs = _get_kwargs(
|
|
133
|
+
reservation_fid=reservation_fid,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
137
|
+
|
|
138
|
+
return _build_response(client=client, response=response)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
async def asyncio(
|
|
142
|
+
reservation_fid: str,
|
|
143
|
+
*,
|
|
144
|
+
client: AuthenticatedClient,
|
|
145
|
+
) -> ExtensionAvailabilityResponse | HTTPValidationError | None:
|
|
146
|
+
"""Get Extension Availability
|
|
147
|
+
|
|
148
|
+
Get extension availability for a reservation
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
reservation_fid (str):
|
|
152
|
+
|
|
153
|
+
Raises:
|
|
154
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
155
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
156
|
+
|
|
157
|
+
Returns:
|
|
158
|
+
ExtensionAvailabilityResponse | HTTPValidationError
|
|
159
|
+
"""
|
|
160
|
+
return (
|
|
161
|
+
await asyncio_detailed(
|
|
162
|
+
reservation_fid=reservation_fid,
|
|
163
|
+
client=client,
|
|
164
|
+
)
|
|
165
|
+
).parsed
|
|
@@ -0,0 +1,309 @@
|
|
|
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_reservations_response import GetReservationsResponse
|
|
11
|
+
from ...models.get_reservations_v2_reservation_get_sort_by import (
|
|
12
|
+
GetReservationsV2ReservationGetSortBy,
|
|
13
|
+
)
|
|
14
|
+
from ...models.get_reservations_v2_reservation_get_status import (
|
|
15
|
+
GetReservationsV2ReservationGetStatus,
|
|
16
|
+
)
|
|
17
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
18
|
+
from ...models.sort_direction import SortDirection
|
|
19
|
+
from ...types import UNSET, Response, Unset
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _get_kwargs(
|
|
23
|
+
*,
|
|
24
|
+
next_cursor: Any | Unset = UNSET,
|
|
25
|
+
sort_by: GetReservationsV2ReservationGetSortBy | Unset = UNSET,
|
|
26
|
+
sort_dir: SortDirection | Unset = UNSET,
|
|
27
|
+
project: str,
|
|
28
|
+
instance_type: None | str | Unset = UNSET,
|
|
29
|
+
region: None | str | Unset = UNSET,
|
|
30
|
+
status: GetReservationsV2ReservationGetStatus | Unset = UNSET,
|
|
31
|
+
limit: int | None | Unset = UNSET,
|
|
32
|
+
) -> dict[str, Any]:
|
|
33
|
+
params: dict[str, Any] = {}
|
|
34
|
+
|
|
35
|
+
params["next_cursor"] = next_cursor
|
|
36
|
+
|
|
37
|
+
json_sort_by: str | Unset = UNSET
|
|
38
|
+
if not isinstance(sort_by, Unset):
|
|
39
|
+
json_sort_by = sort_by.value
|
|
40
|
+
|
|
41
|
+
params["sort_by"] = json_sort_by
|
|
42
|
+
|
|
43
|
+
json_sort_dir: str | Unset = UNSET
|
|
44
|
+
if not isinstance(sort_dir, Unset):
|
|
45
|
+
json_sort_dir = sort_dir.value
|
|
46
|
+
|
|
47
|
+
params["sort_dir"] = json_sort_dir
|
|
48
|
+
|
|
49
|
+
params["project"] = project
|
|
50
|
+
|
|
51
|
+
json_instance_type: None | str | Unset
|
|
52
|
+
if isinstance(instance_type, Unset):
|
|
53
|
+
json_instance_type = UNSET
|
|
54
|
+
else:
|
|
55
|
+
json_instance_type = instance_type
|
|
56
|
+
params["instance_type"] = json_instance_type
|
|
57
|
+
|
|
58
|
+
json_region: None | str | Unset
|
|
59
|
+
if isinstance(region, Unset):
|
|
60
|
+
json_region = UNSET
|
|
61
|
+
else:
|
|
62
|
+
json_region = region
|
|
63
|
+
params["region"] = json_region
|
|
64
|
+
|
|
65
|
+
json_status: str | Unset = UNSET
|
|
66
|
+
if not isinstance(status, Unset):
|
|
67
|
+
json_status = status.value
|
|
68
|
+
|
|
69
|
+
params["status"] = json_status
|
|
70
|
+
|
|
71
|
+
json_limit: int | None | Unset
|
|
72
|
+
if isinstance(limit, Unset):
|
|
73
|
+
json_limit = UNSET
|
|
74
|
+
else:
|
|
75
|
+
json_limit = limit
|
|
76
|
+
params["limit"] = json_limit
|
|
77
|
+
|
|
78
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
79
|
+
|
|
80
|
+
_kwargs: dict[str, Any] = {
|
|
81
|
+
"method": "get",
|
|
82
|
+
"url": "/v2/reservation",
|
|
83
|
+
"params": params,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return _kwargs
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _parse_response(
|
|
90
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
91
|
+
) -> GetReservationsResponse | HTTPValidationError | None:
|
|
92
|
+
if response.status_code == 200:
|
|
93
|
+
response_200 = GetReservationsResponse.from_dict(response.json())
|
|
94
|
+
|
|
95
|
+
return response_200
|
|
96
|
+
|
|
97
|
+
if response.status_code == 422:
|
|
98
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
99
|
+
|
|
100
|
+
return response_422
|
|
101
|
+
|
|
102
|
+
if client.raise_on_unexpected_status:
|
|
103
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
104
|
+
return None
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def _build_response(
|
|
108
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
109
|
+
) -> Response[GetReservationsResponse | HTTPValidationError]:
|
|
110
|
+
return Response(
|
|
111
|
+
status_code=HTTPStatus(response.status_code),
|
|
112
|
+
content=response.content,
|
|
113
|
+
headers=response.headers,
|
|
114
|
+
parsed=_parse_response(client=client, response=response),
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def sync_detailed(
|
|
119
|
+
*,
|
|
120
|
+
client: AuthenticatedClient,
|
|
121
|
+
next_cursor: Any | Unset = UNSET,
|
|
122
|
+
sort_by: GetReservationsV2ReservationGetSortBy | Unset = UNSET,
|
|
123
|
+
sort_dir: SortDirection | Unset = UNSET,
|
|
124
|
+
project: str,
|
|
125
|
+
instance_type: None | str | Unset = UNSET,
|
|
126
|
+
region: None | str | Unset = UNSET,
|
|
127
|
+
status: GetReservationsV2ReservationGetStatus | Unset = UNSET,
|
|
128
|
+
limit: int | None | Unset = UNSET,
|
|
129
|
+
) -> Response[GetReservationsResponse | HTTPValidationError]:
|
|
130
|
+
"""Get Reservations
|
|
131
|
+
|
|
132
|
+
Get all reservations for a project
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
next_cursor (Any | Unset):
|
|
136
|
+
sort_by (GetReservationsV2ReservationGetSortBy | Unset):
|
|
137
|
+
sort_dir (SortDirection | Unset):
|
|
138
|
+
project (str):
|
|
139
|
+
instance_type (None | str | Unset):
|
|
140
|
+
region (None | str | Unset):
|
|
141
|
+
status (GetReservationsV2ReservationGetStatus | Unset):
|
|
142
|
+
limit (int | None | Unset):
|
|
143
|
+
|
|
144
|
+
Raises:
|
|
145
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
146
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
Response[GetReservationsResponse | HTTPValidationError]
|
|
150
|
+
"""
|
|
151
|
+
kwargs = _get_kwargs(
|
|
152
|
+
next_cursor=next_cursor,
|
|
153
|
+
sort_by=sort_by,
|
|
154
|
+
sort_dir=sort_dir,
|
|
155
|
+
project=project,
|
|
156
|
+
instance_type=instance_type,
|
|
157
|
+
region=region,
|
|
158
|
+
status=status,
|
|
159
|
+
limit=limit,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
response = client.get_httpx_client().request(
|
|
163
|
+
**kwargs,
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
return _build_response(client=client, response=response)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def sync(
|
|
170
|
+
*,
|
|
171
|
+
client: AuthenticatedClient,
|
|
172
|
+
next_cursor: Any | Unset = UNSET,
|
|
173
|
+
sort_by: GetReservationsV2ReservationGetSortBy | Unset = UNSET,
|
|
174
|
+
sort_dir: SortDirection | Unset = UNSET,
|
|
175
|
+
project: str,
|
|
176
|
+
instance_type: None | str | Unset = UNSET,
|
|
177
|
+
region: None | str | Unset = UNSET,
|
|
178
|
+
status: GetReservationsV2ReservationGetStatus | Unset = UNSET,
|
|
179
|
+
limit: int | None | Unset = UNSET,
|
|
180
|
+
) -> GetReservationsResponse | HTTPValidationError | None:
|
|
181
|
+
"""Get Reservations
|
|
182
|
+
|
|
183
|
+
Get all reservations for a project
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
next_cursor (Any | Unset):
|
|
187
|
+
sort_by (GetReservationsV2ReservationGetSortBy | Unset):
|
|
188
|
+
sort_dir (SortDirection | Unset):
|
|
189
|
+
project (str):
|
|
190
|
+
instance_type (None | str | Unset):
|
|
191
|
+
region (None | str | Unset):
|
|
192
|
+
status (GetReservationsV2ReservationGetStatus | Unset):
|
|
193
|
+
limit (int | None | Unset):
|
|
194
|
+
|
|
195
|
+
Raises:
|
|
196
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
197
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
GetReservationsResponse | HTTPValidationError
|
|
201
|
+
"""
|
|
202
|
+
return sync_detailed(
|
|
203
|
+
client=client,
|
|
204
|
+
next_cursor=next_cursor,
|
|
205
|
+
sort_by=sort_by,
|
|
206
|
+
sort_dir=sort_dir,
|
|
207
|
+
project=project,
|
|
208
|
+
instance_type=instance_type,
|
|
209
|
+
region=region,
|
|
210
|
+
status=status,
|
|
211
|
+
limit=limit,
|
|
212
|
+
).parsed
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
async def asyncio_detailed(
|
|
216
|
+
*,
|
|
217
|
+
client: AuthenticatedClient,
|
|
218
|
+
next_cursor: Any | Unset = UNSET,
|
|
219
|
+
sort_by: GetReservationsV2ReservationGetSortBy | Unset = UNSET,
|
|
220
|
+
sort_dir: SortDirection | Unset = UNSET,
|
|
221
|
+
project: str,
|
|
222
|
+
instance_type: None | str | Unset = UNSET,
|
|
223
|
+
region: None | str | Unset = UNSET,
|
|
224
|
+
status: GetReservationsV2ReservationGetStatus | Unset = UNSET,
|
|
225
|
+
limit: int | None | Unset = UNSET,
|
|
226
|
+
) -> Response[GetReservationsResponse | HTTPValidationError]:
|
|
227
|
+
"""Get Reservations
|
|
228
|
+
|
|
229
|
+
Get all reservations for a project
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
next_cursor (Any | Unset):
|
|
233
|
+
sort_by (GetReservationsV2ReservationGetSortBy | Unset):
|
|
234
|
+
sort_dir (SortDirection | Unset):
|
|
235
|
+
project (str):
|
|
236
|
+
instance_type (None | str | Unset):
|
|
237
|
+
region (None | str | Unset):
|
|
238
|
+
status (GetReservationsV2ReservationGetStatus | Unset):
|
|
239
|
+
limit (int | None | Unset):
|
|
240
|
+
|
|
241
|
+
Raises:
|
|
242
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
243
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
244
|
+
|
|
245
|
+
Returns:
|
|
246
|
+
Response[GetReservationsResponse | HTTPValidationError]
|
|
247
|
+
"""
|
|
248
|
+
kwargs = _get_kwargs(
|
|
249
|
+
next_cursor=next_cursor,
|
|
250
|
+
sort_by=sort_by,
|
|
251
|
+
sort_dir=sort_dir,
|
|
252
|
+
project=project,
|
|
253
|
+
instance_type=instance_type,
|
|
254
|
+
region=region,
|
|
255
|
+
status=status,
|
|
256
|
+
limit=limit,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
260
|
+
|
|
261
|
+
return _build_response(client=client, response=response)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
async def asyncio(
|
|
265
|
+
*,
|
|
266
|
+
client: AuthenticatedClient,
|
|
267
|
+
next_cursor: Any | Unset = UNSET,
|
|
268
|
+
sort_by: GetReservationsV2ReservationGetSortBy | Unset = UNSET,
|
|
269
|
+
sort_dir: SortDirection | Unset = UNSET,
|
|
270
|
+
project: str,
|
|
271
|
+
instance_type: None | str | Unset = UNSET,
|
|
272
|
+
region: None | str | Unset = UNSET,
|
|
273
|
+
status: GetReservationsV2ReservationGetStatus | Unset = UNSET,
|
|
274
|
+
limit: int | None | Unset = UNSET,
|
|
275
|
+
) -> GetReservationsResponse | HTTPValidationError | None:
|
|
276
|
+
"""Get Reservations
|
|
277
|
+
|
|
278
|
+
Get all reservations for a project
|
|
279
|
+
|
|
280
|
+
Args:
|
|
281
|
+
next_cursor (Any | Unset):
|
|
282
|
+
sort_by (GetReservationsV2ReservationGetSortBy | Unset):
|
|
283
|
+
sort_dir (SortDirection | Unset):
|
|
284
|
+
project (str):
|
|
285
|
+
instance_type (None | str | Unset):
|
|
286
|
+
region (None | str | Unset):
|
|
287
|
+
status (GetReservationsV2ReservationGetStatus | Unset):
|
|
288
|
+
limit (int | None | Unset):
|
|
289
|
+
|
|
290
|
+
Raises:
|
|
291
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
292
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
293
|
+
|
|
294
|
+
Returns:
|
|
295
|
+
GetReservationsResponse | HTTPValidationError
|
|
296
|
+
"""
|
|
297
|
+
return (
|
|
298
|
+
await asyncio_detailed(
|
|
299
|
+
client=client,
|
|
300
|
+
next_cursor=next_cursor,
|
|
301
|
+
sort_by=sort_by,
|
|
302
|
+
sort_dir=sort_dir,
|
|
303
|
+
project=project,
|
|
304
|
+
instance_type=instance_type,
|
|
305
|
+
region=region,
|
|
306
|
+
status=status,
|
|
307
|
+
limit=limit,
|
|
308
|
+
)
|
|
309
|
+
).parsed
|
mithril/api/bindings/api/reservations/update_reservation_v2_reservation_reservation_fid_patch.py
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
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.reservation_model import ReservationModel
|
|
13
|
+
from ...models.update_reservation_request import UpdateReservationRequest
|
|
14
|
+
from ...types import Response
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
reservation_fid: str,
|
|
19
|
+
*,
|
|
20
|
+
body: UpdateReservationRequest,
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
_kwargs: dict[str, Any] = {
|
|
25
|
+
"method": "patch",
|
|
26
|
+
"url": "/v2/reservation/{reservation_fid}".format(
|
|
27
|
+
reservation_fid=quote(str(reservation_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 | ReservationModel | None:
|
|
42
|
+
if response.status_code == 200:
|
|
43
|
+
response_200 = ReservationModel.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 | ReservationModel]:
|
|
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
|
+
reservation_fid: str,
|
|
70
|
+
*,
|
|
71
|
+
client: AuthenticatedClient,
|
|
72
|
+
body: UpdateReservationRequest,
|
|
73
|
+
) -> Response[HTTPValidationError | ReservationModel]:
|
|
74
|
+
"""Update Reservation
|
|
75
|
+
|
|
76
|
+
Update a reservation's pause/resume status and/or volumes
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
reservation_fid (str):
|
|
80
|
+
body (UpdateReservationRequest):
|
|
81
|
+
|
|
82
|
+
Raises:
|
|
83
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
84
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Response[HTTPValidationError | ReservationModel]
|
|
88
|
+
"""
|
|
89
|
+
kwargs = _get_kwargs(
|
|
90
|
+
reservation_fid=reservation_fid,
|
|
91
|
+
body=body,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
response = client.get_httpx_client().request(
|
|
95
|
+
**kwargs,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
return _build_response(client=client, response=response)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def sync(
|
|
102
|
+
reservation_fid: str,
|
|
103
|
+
*,
|
|
104
|
+
client: AuthenticatedClient,
|
|
105
|
+
body: UpdateReservationRequest,
|
|
106
|
+
) -> HTTPValidationError | ReservationModel | None:
|
|
107
|
+
"""Update Reservation
|
|
108
|
+
|
|
109
|
+
Update a reservation's pause/resume status and/or volumes
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
reservation_fid (str):
|
|
113
|
+
body (UpdateReservationRequest):
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
HTTPValidationError | ReservationModel
|
|
121
|
+
"""
|
|
122
|
+
return sync_detailed(
|
|
123
|
+
reservation_fid=reservation_fid,
|
|
124
|
+
client=client,
|
|
125
|
+
body=body,
|
|
126
|
+
).parsed
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
async def asyncio_detailed(
|
|
130
|
+
reservation_fid: str,
|
|
131
|
+
*,
|
|
132
|
+
client: AuthenticatedClient,
|
|
133
|
+
body: UpdateReservationRequest,
|
|
134
|
+
) -> Response[HTTPValidationError | ReservationModel]:
|
|
135
|
+
"""Update Reservation
|
|
136
|
+
|
|
137
|
+
Update a reservation's pause/resume status and/or volumes
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
reservation_fid (str):
|
|
141
|
+
body (UpdateReservationRequest):
|
|
142
|
+
|
|
143
|
+
Raises:
|
|
144
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
145
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
146
|
+
|
|
147
|
+
Returns:
|
|
148
|
+
Response[HTTPValidationError | ReservationModel]
|
|
149
|
+
"""
|
|
150
|
+
kwargs = _get_kwargs(
|
|
151
|
+
reservation_fid=reservation_fid,
|
|
152
|
+
body=body,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
156
|
+
|
|
157
|
+
return _build_response(client=client, response=response)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
async def asyncio(
|
|
161
|
+
reservation_fid: str,
|
|
162
|
+
*,
|
|
163
|
+
client: AuthenticatedClient,
|
|
164
|
+
body: UpdateReservationRequest,
|
|
165
|
+
) -> HTTPValidationError | ReservationModel | None:
|
|
166
|
+
"""Update Reservation
|
|
167
|
+
|
|
168
|
+
Update a reservation's pause/resume status and/or volumes
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
reservation_fid (str):
|
|
172
|
+
body (UpdateReservationRequest):
|
|
173
|
+
|
|
174
|
+
Raises:
|
|
175
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
176
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
HTTPValidationError | ReservationModel
|
|
180
|
+
"""
|
|
181
|
+
return (
|
|
182
|
+
await asyncio_detailed(
|
|
183
|
+
reservation_fid=reservation_fid,
|
|
184
|
+
client=client,
|
|
185
|
+
body=body,
|
|
186
|
+
)
|
|
187
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|