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,664 @@
|
|
|
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.availability_slot_model import AvailabilitySlotModel
|
|
11
|
+
from ...models.get_availability_v2_reservation_availability_get_mode import (
|
|
12
|
+
GetAvailabilityV2ReservationAvailabilityGetMode,
|
|
13
|
+
)
|
|
14
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
15
|
+
from ...types import UNSET, Response, Unset
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
*,
|
|
20
|
+
project: str,
|
|
21
|
+
instance_type: str,
|
|
22
|
+
region: str,
|
|
23
|
+
mode: GetAvailabilityV2ReservationAvailabilityGetMode
|
|
24
|
+
| Unset = GetAvailabilityV2ReservationAvailabilityGetMode.LATEST_END_TIME,
|
|
25
|
+
earliest_start_time: None | str | Unset = UNSET,
|
|
26
|
+
latest_end_time: None | str | Unset = UNSET,
|
|
27
|
+
start_time: None | str | Unset = UNSET,
|
|
28
|
+
end_time: None | str | Unset = UNSET,
|
|
29
|
+
quantity: int | None | Unset = UNSET,
|
|
30
|
+
) -> dict[str, Any]:
|
|
31
|
+
params: dict[str, Any] = {}
|
|
32
|
+
|
|
33
|
+
params["project"] = project
|
|
34
|
+
|
|
35
|
+
params["instance_type"] = instance_type
|
|
36
|
+
|
|
37
|
+
params["region"] = region
|
|
38
|
+
|
|
39
|
+
json_mode: str | Unset = UNSET
|
|
40
|
+
if not isinstance(mode, Unset):
|
|
41
|
+
json_mode = mode.value
|
|
42
|
+
|
|
43
|
+
params["mode"] = json_mode
|
|
44
|
+
|
|
45
|
+
json_earliest_start_time: None | str | Unset
|
|
46
|
+
if isinstance(earliest_start_time, Unset):
|
|
47
|
+
json_earliest_start_time = UNSET
|
|
48
|
+
else:
|
|
49
|
+
json_earliest_start_time = earliest_start_time
|
|
50
|
+
params["earliest_start_time"] = json_earliest_start_time
|
|
51
|
+
|
|
52
|
+
json_latest_end_time: None | str | Unset
|
|
53
|
+
if isinstance(latest_end_time, Unset):
|
|
54
|
+
json_latest_end_time = UNSET
|
|
55
|
+
else:
|
|
56
|
+
json_latest_end_time = latest_end_time
|
|
57
|
+
params["latest_end_time"] = json_latest_end_time
|
|
58
|
+
|
|
59
|
+
json_start_time: None | str | Unset
|
|
60
|
+
if isinstance(start_time, Unset):
|
|
61
|
+
json_start_time = UNSET
|
|
62
|
+
else:
|
|
63
|
+
json_start_time = start_time
|
|
64
|
+
params["start_time"] = json_start_time
|
|
65
|
+
|
|
66
|
+
json_end_time: None | str | Unset
|
|
67
|
+
if isinstance(end_time, Unset):
|
|
68
|
+
json_end_time = UNSET
|
|
69
|
+
else:
|
|
70
|
+
json_end_time = end_time
|
|
71
|
+
params["end_time"] = json_end_time
|
|
72
|
+
|
|
73
|
+
json_quantity: int | None | Unset
|
|
74
|
+
if isinstance(quantity, Unset):
|
|
75
|
+
json_quantity = UNSET
|
|
76
|
+
else:
|
|
77
|
+
json_quantity = quantity
|
|
78
|
+
params["quantity"] = json_quantity
|
|
79
|
+
|
|
80
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
81
|
+
|
|
82
|
+
_kwargs: dict[str, Any] = {
|
|
83
|
+
"method": "get",
|
|
84
|
+
"url": "/v2/reservation/availability",
|
|
85
|
+
"params": params,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return _kwargs
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _parse_response(
|
|
92
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
93
|
+
) -> HTTPValidationError | list[AvailabilitySlotModel] | None:
|
|
94
|
+
if response.status_code == 200:
|
|
95
|
+
response_200 = []
|
|
96
|
+
_response_200 = response.json()
|
|
97
|
+
for response_200_item_data in _response_200:
|
|
98
|
+
response_200_item = AvailabilitySlotModel.from_dict(response_200_item_data)
|
|
99
|
+
|
|
100
|
+
response_200.append(response_200_item)
|
|
101
|
+
|
|
102
|
+
return response_200
|
|
103
|
+
|
|
104
|
+
if response.status_code == 422:
|
|
105
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
106
|
+
|
|
107
|
+
return response_422
|
|
108
|
+
|
|
109
|
+
if client.raise_on_unexpected_status:
|
|
110
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
111
|
+
return None
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _build_response(
|
|
115
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
116
|
+
) -> Response[HTTPValidationError | list[AvailabilitySlotModel]]:
|
|
117
|
+
return Response(
|
|
118
|
+
status_code=HTTPStatus(response.status_code),
|
|
119
|
+
content=response.content,
|
|
120
|
+
headers=response.headers,
|
|
121
|
+
parsed=_parse_response(client=client, response=response),
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def sync_detailed(
|
|
126
|
+
*,
|
|
127
|
+
client: AuthenticatedClient,
|
|
128
|
+
project: str,
|
|
129
|
+
instance_type: str,
|
|
130
|
+
region: str,
|
|
131
|
+
mode: GetAvailabilityV2ReservationAvailabilityGetMode
|
|
132
|
+
| Unset = GetAvailabilityV2ReservationAvailabilityGetMode.LATEST_END_TIME,
|
|
133
|
+
earliest_start_time: None | str | Unset = UNSET,
|
|
134
|
+
latest_end_time: None | str | Unset = UNSET,
|
|
135
|
+
start_time: None | str | Unset = UNSET,
|
|
136
|
+
end_time: None | str | Unset = UNSET,
|
|
137
|
+
quantity: int | None | Unset = UNSET,
|
|
138
|
+
) -> Response[HTTPValidationError | list[AvailabilitySlotModel]]:
|
|
139
|
+
"""Get Availability
|
|
140
|
+
|
|
141
|
+
Get availability information for reservations.
|
|
142
|
+
|
|
143
|
+
This endpoint supports three different modes for querying availability:
|
|
144
|
+
|
|
145
|
+
## Mode: latest_end_time (default)
|
|
146
|
+
Get the latest possible end time for a reservation given a start time and
|
|
147
|
+
quantity.
|
|
148
|
+
|
|
149
|
+
**Required parameters:**
|
|
150
|
+
- `start_time`: Desired start time for the reservation
|
|
151
|
+
- `quantity`: Number of instances needed
|
|
152
|
+
- `project`: Project FID
|
|
153
|
+
- `instance_type`: Instance type FID
|
|
154
|
+
- `region`: Region name
|
|
155
|
+
|
|
156
|
+
**Returns:** Latest possible end time and availability status
|
|
157
|
+
|
|
158
|
+
**Example:**
|
|
159
|
+
```
|
|
160
|
+
GET /reservation/availability?
|
|
161
|
+
start_time=2024-01-01T00:00:00Z&
|
|
162
|
+
quantity=4&
|
|
163
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
164
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
165
|
+
region=us-central1-a
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Mode: slots
|
|
169
|
+
Get all available slots in a time range.
|
|
170
|
+
|
|
171
|
+
**Required parameters:**
|
|
172
|
+
- `earliest_start_time`: Start of the time range to search
|
|
173
|
+
- `latest_end_time`: End of the time range to search
|
|
174
|
+
- `project`: Project FID
|
|
175
|
+
- `instance_type`: Instance type FID
|
|
176
|
+
- `region`: Region name
|
|
177
|
+
|
|
178
|
+
**Returns:** List of available time slots with quantities
|
|
179
|
+
|
|
180
|
+
**Example:**
|
|
181
|
+
```
|
|
182
|
+
GET /reservation/availability?
|
|
183
|
+
mode=slots&
|
|
184
|
+
earliest_start_time=2024-01-01T00:00:00Z&
|
|
185
|
+
latest_end_time=2024-01-02T00:00:00Z&
|
|
186
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
187
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
188
|
+
region=us-central1-a
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Mode: check
|
|
192
|
+
Check if a specific time slot is available for reservation.
|
|
193
|
+
|
|
194
|
+
**Required parameters:**
|
|
195
|
+
- `start_time`: Start of the desired time slot
|
|
196
|
+
- `end_time`: End of the desired time slot
|
|
197
|
+
- `quantity`: Number of instances needed
|
|
198
|
+
- `project`: Project FID
|
|
199
|
+
- `instance_type`: Instance type FID
|
|
200
|
+
- `region`: Region name
|
|
201
|
+
|
|
202
|
+
**Returns:** Boolean indicating if the slot is available
|
|
203
|
+
|
|
204
|
+
**Example:**
|
|
205
|
+
```
|
|
206
|
+
GET /reservation/availability?
|
|
207
|
+
mode=check&
|
|
208
|
+
start_time=2024-01-01T00:00:00Z&
|
|
209
|
+
end_time=2024-01-01T12:00:00Z&
|
|
210
|
+
quantity=4&
|
|
211
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
212
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
213
|
+
region=us-central1-a
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Common Parameters
|
|
217
|
+
All modes require these parameters:
|
|
218
|
+
- `project`: Project FID
|
|
219
|
+
- `instance_type`: Instance type FID
|
|
220
|
+
- `region`: Region name
|
|
221
|
+
|
|
222
|
+
## Authentication
|
|
223
|
+
Requires authentication and user must be a member of the specified project.
|
|
224
|
+
|
|
225
|
+
Args:
|
|
226
|
+
project (str):
|
|
227
|
+
instance_type (str):
|
|
228
|
+
region (str):
|
|
229
|
+
mode (GetAvailabilityV2ReservationAvailabilityGetMode | Unset): Default:
|
|
230
|
+
GetAvailabilityV2ReservationAvailabilityGetMode.LATEST_END_TIME.
|
|
231
|
+
earliest_start_time (None | str | Unset):
|
|
232
|
+
latest_end_time (None | str | Unset):
|
|
233
|
+
start_time (None | str | Unset):
|
|
234
|
+
end_time (None | str | Unset):
|
|
235
|
+
quantity (int | None | Unset):
|
|
236
|
+
|
|
237
|
+
Raises:
|
|
238
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
239
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
240
|
+
|
|
241
|
+
Returns:
|
|
242
|
+
Response[HTTPValidationError | list[AvailabilitySlotModel]]
|
|
243
|
+
"""
|
|
244
|
+
kwargs = _get_kwargs(
|
|
245
|
+
project=project,
|
|
246
|
+
instance_type=instance_type,
|
|
247
|
+
region=region,
|
|
248
|
+
mode=mode,
|
|
249
|
+
earliest_start_time=earliest_start_time,
|
|
250
|
+
latest_end_time=latest_end_time,
|
|
251
|
+
start_time=start_time,
|
|
252
|
+
end_time=end_time,
|
|
253
|
+
quantity=quantity,
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
response = client.get_httpx_client().request(
|
|
257
|
+
**kwargs,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
return _build_response(client=client, response=response)
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def sync(
|
|
264
|
+
*,
|
|
265
|
+
client: AuthenticatedClient,
|
|
266
|
+
project: str,
|
|
267
|
+
instance_type: str,
|
|
268
|
+
region: str,
|
|
269
|
+
mode: GetAvailabilityV2ReservationAvailabilityGetMode
|
|
270
|
+
| Unset = GetAvailabilityV2ReservationAvailabilityGetMode.LATEST_END_TIME,
|
|
271
|
+
earliest_start_time: None | str | Unset = UNSET,
|
|
272
|
+
latest_end_time: None | str | Unset = UNSET,
|
|
273
|
+
start_time: None | str | Unset = UNSET,
|
|
274
|
+
end_time: None | str | Unset = UNSET,
|
|
275
|
+
quantity: int | None | Unset = UNSET,
|
|
276
|
+
) -> HTTPValidationError | list[AvailabilitySlotModel] | None:
|
|
277
|
+
"""Get Availability
|
|
278
|
+
|
|
279
|
+
Get availability information for reservations.
|
|
280
|
+
|
|
281
|
+
This endpoint supports three different modes for querying availability:
|
|
282
|
+
|
|
283
|
+
## Mode: latest_end_time (default)
|
|
284
|
+
Get the latest possible end time for a reservation given a start time and
|
|
285
|
+
quantity.
|
|
286
|
+
|
|
287
|
+
**Required parameters:**
|
|
288
|
+
- `start_time`: Desired start time for the reservation
|
|
289
|
+
- `quantity`: Number of instances needed
|
|
290
|
+
- `project`: Project FID
|
|
291
|
+
- `instance_type`: Instance type FID
|
|
292
|
+
- `region`: Region name
|
|
293
|
+
|
|
294
|
+
**Returns:** Latest possible end time and availability status
|
|
295
|
+
|
|
296
|
+
**Example:**
|
|
297
|
+
```
|
|
298
|
+
GET /reservation/availability?
|
|
299
|
+
start_time=2024-01-01T00:00:00Z&
|
|
300
|
+
quantity=4&
|
|
301
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
302
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
303
|
+
region=us-central1-a
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Mode: slots
|
|
307
|
+
Get all available slots in a time range.
|
|
308
|
+
|
|
309
|
+
**Required parameters:**
|
|
310
|
+
- `earliest_start_time`: Start of the time range to search
|
|
311
|
+
- `latest_end_time`: End of the time range to search
|
|
312
|
+
- `project`: Project FID
|
|
313
|
+
- `instance_type`: Instance type FID
|
|
314
|
+
- `region`: Region name
|
|
315
|
+
|
|
316
|
+
**Returns:** List of available time slots with quantities
|
|
317
|
+
|
|
318
|
+
**Example:**
|
|
319
|
+
```
|
|
320
|
+
GET /reservation/availability?
|
|
321
|
+
mode=slots&
|
|
322
|
+
earliest_start_time=2024-01-01T00:00:00Z&
|
|
323
|
+
latest_end_time=2024-01-02T00:00:00Z&
|
|
324
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
325
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
326
|
+
region=us-central1-a
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## Mode: check
|
|
330
|
+
Check if a specific time slot is available for reservation.
|
|
331
|
+
|
|
332
|
+
**Required parameters:**
|
|
333
|
+
- `start_time`: Start of the desired time slot
|
|
334
|
+
- `end_time`: End of the desired time slot
|
|
335
|
+
- `quantity`: Number of instances needed
|
|
336
|
+
- `project`: Project FID
|
|
337
|
+
- `instance_type`: Instance type FID
|
|
338
|
+
- `region`: Region name
|
|
339
|
+
|
|
340
|
+
**Returns:** Boolean indicating if the slot is available
|
|
341
|
+
|
|
342
|
+
**Example:**
|
|
343
|
+
```
|
|
344
|
+
GET /reservation/availability?
|
|
345
|
+
mode=check&
|
|
346
|
+
start_time=2024-01-01T00:00:00Z&
|
|
347
|
+
end_time=2024-01-01T12:00:00Z&
|
|
348
|
+
quantity=4&
|
|
349
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
350
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
351
|
+
region=us-central1-a
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Common Parameters
|
|
355
|
+
All modes require these parameters:
|
|
356
|
+
- `project`: Project FID
|
|
357
|
+
- `instance_type`: Instance type FID
|
|
358
|
+
- `region`: Region name
|
|
359
|
+
|
|
360
|
+
## Authentication
|
|
361
|
+
Requires authentication and user must be a member of the specified project.
|
|
362
|
+
|
|
363
|
+
Args:
|
|
364
|
+
project (str):
|
|
365
|
+
instance_type (str):
|
|
366
|
+
region (str):
|
|
367
|
+
mode (GetAvailabilityV2ReservationAvailabilityGetMode | Unset): Default:
|
|
368
|
+
GetAvailabilityV2ReservationAvailabilityGetMode.LATEST_END_TIME.
|
|
369
|
+
earliest_start_time (None | str | Unset):
|
|
370
|
+
latest_end_time (None | str | Unset):
|
|
371
|
+
start_time (None | str | Unset):
|
|
372
|
+
end_time (None | str | Unset):
|
|
373
|
+
quantity (int | None | Unset):
|
|
374
|
+
|
|
375
|
+
Raises:
|
|
376
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
377
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
378
|
+
|
|
379
|
+
Returns:
|
|
380
|
+
HTTPValidationError | list[AvailabilitySlotModel]
|
|
381
|
+
"""
|
|
382
|
+
return sync_detailed(
|
|
383
|
+
client=client,
|
|
384
|
+
project=project,
|
|
385
|
+
instance_type=instance_type,
|
|
386
|
+
region=region,
|
|
387
|
+
mode=mode,
|
|
388
|
+
earliest_start_time=earliest_start_time,
|
|
389
|
+
latest_end_time=latest_end_time,
|
|
390
|
+
start_time=start_time,
|
|
391
|
+
end_time=end_time,
|
|
392
|
+
quantity=quantity,
|
|
393
|
+
).parsed
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
async def asyncio_detailed(
|
|
397
|
+
*,
|
|
398
|
+
client: AuthenticatedClient,
|
|
399
|
+
project: str,
|
|
400
|
+
instance_type: str,
|
|
401
|
+
region: str,
|
|
402
|
+
mode: GetAvailabilityV2ReservationAvailabilityGetMode
|
|
403
|
+
| Unset = GetAvailabilityV2ReservationAvailabilityGetMode.LATEST_END_TIME,
|
|
404
|
+
earliest_start_time: None | str | Unset = UNSET,
|
|
405
|
+
latest_end_time: None | str | Unset = UNSET,
|
|
406
|
+
start_time: None | str | Unset = UNSET,
|
|
407
|
+
end_time: None | str | Unset = UNSET,
|
|
408
|
+
quantity: int | None | Unset = UNSET,
|
|
409
|
+
) -> Response[HTTPValidationError | list[AvailabilitySlotModel]]:
|
|
410
|
+
"""Get Availability
|
|
411
|
+
|
|
412
|
+
Get availability information for reservations.
|
|
413
|
+
|
|
414
|
+
This endpoint supports three different modes for querying availability:
|
|
415
|
+
|
|
416
|
+
## Mode: latest_end_time (default)
|
|
417
|
+
Get the latest possible end time for a reservation given a start time and
|
|
418
|
+
quantity.
|
|
419
|
+
|
|
420
|
+
**Required parameters:**
|
|
421
|
+
- `start_time`: Desired start time for the reservation
|
|
422
|
+
- `quantity`: Number of instances needed
|
|
423
|
+
- `project`: Project FID
|
|
424
|
+
- `instance_type`: Instance type FID
|
|
425
|
+
- `region`: Region name
|
|
426
|
+
|
|
427
|
+
**Returns:** Latest possible end time and availability status
|
|
428
|
+
|
|
429
|
+
**Example:**
|
|
430
|
+
```
|
|
431
|
+
GET /reservation/availability?
|
|
432
|
+
start_time=2024-01-01T00:00:00Z&
|
|
433
|
+
quantity=4&
|
|
434
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
435
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
436
|
+
region=us-central1-a
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## Mode: slots
|
|
440
|
+
Get all available slots in a time range.
|
|
441
|
+
|
|
442
|
+
**Required parameters:**
|
|
443
|
+
- `earliest_start_time`: Start of the time range to search
|
|
444
|
+
- `latest_end_time`: End of the time range to search
|
|
445
|
+
- `project`: Project FID
|
|
446
|
+
- `instance_type`: Instance type FID
|
|
447
|
+
- `region`: Region name
|
|
448
|
+
|
|
449
|
+
**Returns:** List of available time slots with quantities
|
|
450
|
+
|
|
451
|
+
**Example:**
|
|
452
|
+
```
|
|
453
|
+
GET /reservation/availability?
|
|
454
|
+
mode=slots&
|
|
455
|
+
earliest_start_time=2024-01-01T00:00:00Z&
|
|
456
|
+
latest_end_time=2024-01-02T00:00:00Z&
|
|
457
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
458
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
459
|
+
region=us-central1-a
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
## Mode: check
|
|
463
|
+
Check if a specific time slot is available for reservation.
|
|
464
|
+
|
|
465
|
+
**Required parameters:**
|
|
466
|
+
- `start_time`: Start of the desired time slot
|
|
467
|
+
- `end_time`: End of the desired time slot
|
|
468
|
+
- `quantity`: Number of instances needed
|
|
469
|
+
- `project`: Project FID
|
|
470
|
+
- `instance_type`: Instance type FID
|
|
471
|
+
- `region`: Region name
|
|
472
|
+
|
|
473
|
+
**Returns:** Boolean indicating if the slot is available
|
|
474
|
+
|
|
475
|
+
**Example:**
|
|
476
|
+
```
|
|
477
|
+
GET /reservation/availability?
|
|
478
|
+
mode=check&
|
|
479
|
+
start_time=2024-01-01T00:00:00Z&
|
|
480
|
+
end_time=2024-01-01T12:00:00Z&
|
|
481
|
+
quantity=4&
|
|
482
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
483
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
484
|
+
region=us-central1-a
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
## Common Parameters
|
|
488
|
+
All modes require these parameters:
|
|
489
|
+
- `project`: Project FID
|
|
490
|
+
- `instance_type`: Instance type FID
|
|
491
|
+
- `region`: Region name
|
|
492
|
+
|
|
493
|
+
## Authentication
|
|
494
|
+
Requires authentication and user must be a member of the specified project.
|
|
495
|
+
|
|
496
|
+
Args:
|
|
497
|
+
project (str):
|
|
498
|
+
instance_type (str):
|
|
499
|
+
region (str):
|
|
500
|
+
mode (GetAvailabilityV2ReservationAvailabilityGetMode | Unset): Default:
|
|
501
|
+
GetAvailabilityV2ReservationAvailabilityGetMode.LATEST_END_TIME.
|
|
502
|
+
earliest_start_time (None | str | Unset):
|
|
503
|
+
latest_end_time (None | str | Unset):
|
|
504
|
+
start_time (None | str | Unset):
|
|
505
|
+
end_time (None | str | Unset):
|
|
506
|
+
quantity (int | None | Unset):
|
|
507
|
+
|
|
508
|
+
Raises:
|
|
509
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
510
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
511
|
+
|
|
512
|
+
Returns:
|
|
513
|
+
Response[HTTPValidationError | list[AvailabilitySlotModel]]
|
|
514
|
+
"""
|
|
515
|
+
kwargs = _get_kwargs(
|
|
516
|
+
project=project,
|
|
517
|
+
instance_type=instance_type,
|
|
518
|
+
region=region,
|
|
519
|
+
mode=mode,
|
|
520
|
+
earliest_start_time=earliest_start_time,
|
|
521
|
+
latest_end_time=latest_end_time,
|
|
522
|
+
start_time=start_time,
|
|
523
|
+
end_time=end_time,
|
|
524
|
+
quantity=quantity,
|
|
525
|
+
)
|
|
526
|
+
|
|
527
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
528
|
+
|
|
529
|
+
return _build_response(client=client, response=response)
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
async def asyncio(
|
|
533
|
+
*,
|
|
534
|
+
client: AuthenticatedClient,
|
|
535
|
+
project: str,
|
|
536
|
+
instance_type: str,
|
|
537
|
+
region: str,
|
|
538
|
+
mode: GetAvailabilityV2ReservationAvailabilityGetMode
|
|
539
|
+
| Unset = GetAvailabilityV2ReservationAvailabilityGetMode.LATEST_END_TIME,
|
|
540
|
+
earliest_start_time: None | str | Unset = UNSET,
|
|
541
|
+
latest_end_time: None | str | Unset = UNSET,
|
|
542
|
+
start_time: None | str | Unset = UNSET,
|
|
543
|
+
end_time: None | str | Unset = UNSET,
|
|
544
|
+
quantity: int | None | Unset = UNSET,
|
|
545
|
+
) -> HTTPValidationError | list[AvailabilitySlotModel] | None:
|
|
546
|
+
"""Get Availability
|
|
547
|
+
|
|
548
|
+
Get availability information for reservations.
|
|
549
|
+
|
|
550
|
+
This endpoint supports three different modes for querying availability:
|
|
551
|
+
|
|
552
|
+
## Mode: latest_end_time (default)
|
|
553
|
+
Get the latest possible end time for a reservation given a start time and
|
|
554
|
+
quantity.
|
|
555
|
+
|
|
556
|
+
**Required parameters:**
|
|
557
|
+
- `start_time`: Desired start time for the reservation
|
|
558
|
+
- `quantity`: Number of instances needed
|
|
559
|
+
- `project`: Project FID
|
|
560
|
+
- `instance_type`: Instance type FID
|
|
561
|
+
- `region`: Region name
|
|
562
|
+
|
|
563
|
+
**Returns:** Latest possible end time and availability status
|
|
564
|
+
|
|
565
|
+
**Example:**
|
|
566
|
+
```
|
|
567
|
+
GET /reservation/availability?
|
|
568
|
+
start_time=2024-01-01T00:00:00Z&
|
|
569
|
+
quantity=4&
|
|
570
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
571
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
572
|
+
region=us-central1-a
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
## Mode: slots
|
|
576
|
+
Get all available slots in a time range.
|
|
577
|
+
|
|
578
|
+
**Required parameters:**
|
|
579
|
+
- `earliest_start_time`: Start of the time range to search
|
|
580
|
+
- `latest_end_time`: End of the time range to search
|
|
581
|
+
- `project`: Project FID
|
|
582
|
+
- `instance_type`: Instance type FID
|
|
583
|
+
- `region`: Region name
|
|
584
|
+
|
|
585
|
+
**Returns:** List of available time slots with quantities
|
|
586
|
+
|
|
587
|
+
**Example:**
|
|
588
|
+
```
|
|
589
|
+
GET /reservation/availability?
|
|
590
|
+
mode=slots&
|
|
591
|
+
earliest_start_time=2024-01-01T00:00:00Z&
|
|
592
|
+
latest_end_time=2024-01-02T00:00:00Z&
|
|
593
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
594
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
595
|
+
region=us-central1-a
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
## Mode: check
|
|
599
|
+
Check if a specific time slot is available for reservation.
|
|
600
|
+
|
|
601
|
+
**Required parameters:**
|
|
602
|
+
- `start_time`: Start of the desired time slot
|
|
603
|
+
- `end_time`: End of the desired time slot
|
|
604
|
+
- `quantity`: Number of instances needed
|
|
605
|
+
- `project`: Project FID
|
|
606
|
+
- `instance_type`: Instance type FID
|
|
607
|
+
- `region`: Region name
|
|
608
|
+
|
|
609
|
+
**Returns:** Boolean indicating if the slot is available
|
|
610
|
+
|
|
611
|
+
**Example:**
|
|
612
|
+
```
|
|
613
|
+
GET /reservation/availability?
|
|
614
|
+
mode=check&
|
|
615
|
+
start_time=2024-01-01T00:00:00Z&
|
|
616
|
+
end_time=2024-01-01T12:00:00Z&
|
|
617
|
+
quantity=4&
|
|
618
|
+
project=proj_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
619
|
+
instance_type=it_01h8x2k9m3n4p5q6r7s8t9u0v&
|
|
620
|
+
region=us-central1-a
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
## Common Parameters
|
|
624
|
+
All modes require these parameters:
|
|
625
|
+
- `project`: Project FID
|
|
626
|
+
- `instance_type`: Instance type FID
|
|
627
|
+
- `region`: Region name
|
|
628
|
+
|
|
629
|
+
## Authentication
|
|
630
|
+
Requires authentication and user must be a member of the specified project.
|
|
631
|
+
|
|
632
|
+
Args:
|
|
633
|
+
project (str):
|
|
634
|
+
instance_type (str):
|
|
635
|
+
region (str):
|
|
636
|
+
mode (GetAvailabilityV2ReservationAvailabilityGetMode | Unset): Default:
|
|
637
|
+
GetAvailabilityV2ReservationAvailabilityGetMode.LATEST_END_TIME.
|
|
638
|
+
earliest_start_time (None | str | Unset):
|
|
639
|
+
latest_end_time (None | str | Unset):
|
|
640
|
+
start_time (None | str | Unset):
|
|
641
|
+
end_time (None | str | Unset):
|
|
642
|
+
quantity (int | None | Unset):
|
|
643
|
+
|
|
644
|
+
Raises:
|
|
645
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
646
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
647
|
+
|
|
648
|
+
Returns:
|
|
649
|
+
HTTPValidationError | list[AvailabilitySlotModel]
|
|
650
|
+
"""
|
|
651
|
+
return (
|
|
652
|
+
await asyncio_detailed(
|
|
653
|
+
client=client,
|
|
654
|
+
project=project,
|
|
655
|
+
instance_type=instance_type,
|
|
656
|
+
region=region,
|
|
657
|
+
mode=mode,
|
|
658
|
+
earliest_start_time=earliest_start_time,
|
|
659
|
+
latest_end_time=latest_end_time,
|
|
660
|
+
start_time=start_time,
|
|
661
|
+
end_time=end_time,
|
|
662
|
+
quantity=quantity,
|
|
663
|
+
)
|
|
664
|
+
).parsed
|