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,239 @@
|
|
|
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.http_validation_error import HTTPValidationError
|
|
11
|
+
from ...models.volume_model import VolumeModel
|
|
12
|
+
from ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
project: str,
|
|
18
|
+
region: None | str | Unset = UNSET,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
params: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
params["project"] = project
|
|
23
|
+
|
|
24
|
+
json_region: None | str | Unset
|
|
25
|
+
if isinstance(region, Unset):
|
|
26
|
+
json_region = UNSET
|
|
27
|
+
else:
|
|
28
|
+
json_region = region
|
|
29
|
+
params["region"] = json_region
|
|
30
|
+
|
|
31
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
32
|
+
|
|
33
|
+
_kwargs: dict[str, Any] = {
|
|
34
|
+
"method": "get",
|
|
35
|
+
"url": "/v2/volumes",
|
|
36
|
+
"params": params,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return _kwargs
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _parse_response(
|
|
43
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
44
|
+
) -> HTTPValidationError | list[VolumeModel] | None:
|
|
45
|
+
if response.status_code == 200:
|
|
46
|
+
response_200 = []
|
|
47
|
+
_response_200 = response.json()
|
|
48
|
+
for response_200_item_data in _response_200:
|
|
49
|
+
response_200_item = VolumeModel.from_dict(response_200_item_data)
|
|
50
|
+
|
|
51
|
+
response_200.append(response_200_item)
|
|
52
|
+
|
|
53
|
+
return response_200
|
|
54
|
+
|
|
55
|
+
if response.status_code == 422:
|
|
56
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
57
|
+
|
|
58
|
+
return response_422
|
|
59
|
+
|
|
60
|
+
if client.raise_on_unexpected_status:
|
|
61
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
62
|
+
return None
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _build_response(
|
|
66
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
67
|
+
) -> Response[HTTPValidationError | list[VolumeModel]]:
|
|
68
|
+
return Response(
|
|
69
|
+
status_code=HTTPStatus(response.status_code),
|
|
70
|
+
content=response.content,
|
|
71
|
+
headers=response.headers,
|
|
72
|
+
parsed=_parse_response(client=client, response=response),
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def sync_detailed(
|
|
77
|
+
*,
|
|
78
|
+
client: AuthenticatedClient,
|
|
79
|
+
project: str,
|
|
80
|
+
region: None | str | Unset = UNSET,
|
|
81
|
+
) -> Response[HTTPValidationError | list[VolumeModel]]:
|
|
82
|
+
"""Get Volumes
|
|
83
|
+
|
|
84
|
+
Retrieves all storage volumes for a specific project.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
user_info: Authenticated user information.
|
|
88
|
+
project: Identifier of the project to list volumes for.
|
|
89
|
+
region: Optional region filter.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
list[VolumeModel]: A list of volume models belonging to the project.
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
HTTPException: If project is missing or user is not authorized.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
project (str):
|
|
99
|
+
region (None | str | Unset):
|
|
100
|
+
|
|
101
|
+
Raises:
|
|
102
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
103
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
Response[HTTPValidationError | list[VolumeModel]]
|
|
107
|
+
"""
|
|
108
|
+
kwargs = _get_kwargs(
|
|
109
|
+
project=project,
|
|
110
|
+
region=region,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
response = client.get_httpx_client().request(
|
|
114
|
+
**kwargs,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
return _build_response(client=client, response=response)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def sync(
|
|
121
|
+
*,
|
|
122
|
+
client: AuthenticatedClient,
|
|
123
|
+
project: str,
|
|
124
|
+
region: None | str | Unset = UNSET,
|
|
125
|
+
) -> HTTPValidationError | list[VolumeModel] | None:
|
|
126
|
+
"""Get Volumes
|
|
127
|
+
|
|
128
|
+
Retrieves all storage volumes for a specific project.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
user_info: Authenticated user information.
|
|
132
|
+
project: Identifier of the project to list volumes for.
|
|
133
|
+
region: Optional region filter.
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
list[VolumeModel]: A list of volume models belonging to the project.
|
|
137
|
+
|
|
138
|
+
Raises:
|
|
139
|
+
HTTPException: If project is missing or user is not authorized.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
project (str):
|
|
143
|
+
region (None | str | Unset):
|
|
144
|
+
|
|
145
|
+
Raises:
|
|
146
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
147
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
HTTPValidationError | list[VolumeModel]
|
|
151
|
+
"""
|
|
152
|
+
return sync_detailed(
|
|
153
|
+
client=client,
|
|
154
|
+
project=project,
|
|
155
|
+
region=region,
|
|
156
|
+
).parsed
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
async def asyncio_detailed(
|
|
160
|
+
*,
|
|
161
|
+
client: AuthenticatedClient,
|
|
162
|
+
project: str,
|
|
163
|
+
region: None | str | Unset = UNSET,
|
|
164
|
+
) -> Response[HTTPValidationError | list[VolumeModel]]:
|
|
165
|
+
"""Get Volumes
|
|
166
|
+
|
|
167
|
+
Retrieves all storage volumes for a specific project.
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
user_info: Authenticated user information.
|
|
171
|
+
project: Identifier of the project to list volumes for.
|
|
172
|
+
region: Optional region filter.
|
|
173
|
+
|
|
174
|
+
Returns:
|
|
175
|
+
list[VolumeModel]: A list of volume models belonging to the project.
|
|
176
|
+
|
|
177
|
+
Raises:
|
|
178
|
+
HTTPException: If project is missing or user is not authorized.
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
project (str):
|
|
182
|
+
region (None | str | Unset):
|
|
183
|
+
|
|
184
|
+
Raises:
|
|
185
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
186
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
Response[HTTPValidationError | list[VolumeModel]]
|
|
190
|
+
"""
|
|
191
|
+
kwargs = _get_kwargs(
|
|
192
|
+
project=project,
|
|
193
|
+
region=region,
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
197
|
+
|
|
198
|
+
return _build_response(client=client, response=response)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
async def asyncio(
|
|
202
|
+
*,
|
|
203
|
+
client: AuthenticatedClient,
|
|
204
|
+
project: str,
|
|
205
|
+
region: None | str | Unset = UNSET,
|
|
206
|
+
) -> HTTPValidationError | list[VolumeModel] | None:
|
|
207
|
+
"""Get Volumes
|
|
208
|
+
|
|
209
|
+
Retrieves all storage volumes for a specific project.
|
|
210
|
+
|
|
211
|
+
Args:
|
|
212
|
+
user_info: Authenticated user information.
|
|
213
|
+
project: Identifier of the project to list volumes for.
|
|
214
|
+
region: Optional region filter.
|
|
215
|
+
|
|
216
|
+
Returns:
|
|
217
|
+
list[VolumeModel]: A list of volume models belonging to the project.
|
|
218
|
+
|
|
219
|
+
Raises:
|
|
220
|
+
HTTPException: If project is missing or user is not authorized.
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
project (str):
|
|
224
|
+
region (None | str | Unset):
|
|
225
|
+
|
|
226
|
+
Raises:
|
|
227
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
228
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
229
|
+
|
|
230
|
+
Returns:
|
|
231
|
+
HTTPValidationError | list[VolumeModel]
|
|
232
|
+
"""
|
|
233
|
+
return (
|
|
234
|
+
await asyncio_detailed(
|
|
235
|
+
client=client,
|
|
236
|
+
project=project,
|
|
237
|
+
region=region,
|
|
238
|
+
)
|
|
239
|
+
).parsed
|
|
@@ -0,0 +1,243 @@
|
|
|
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.update_volume_request import UpdateVolumeRequest
|
|
13
|
+
from ...models.volume_model import VolumeModel
|
|
14
|
+
from ...types import Response
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
volume_fid: str,
|
|
19
|
+
*,
|
|
20
|
+
body: UpdateVolumeRequest,
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
_kwargs: dict[str, Any] = {
|
|
25
|
+
"method": "patch",
|
|
26
|
+
"url": "/v2/volumes/{volume_fid}".format(
|
|
27
|
+
volume_fid=quote(str(volume_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 | VolumeModel | None:
|
|
42
|
+
if response.status_code == 200:
|
|
43
|
+
response_200 = VolumeModel.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 | VolumeModel]:
|
|
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
|
+
volume_fid: str,
|
|
70
|
+
*,
|
|
71
|
+
client: AuthenticatedClient,
|
|
72
|
+
body: UpdateVolumeRequest,
|
|
73
|
+
) -> Response[HTTPValidationError | VolumeModel]:
|
|
74
|
+
"""Update Volume
|
|
75
|
+
|
|
76
|
+
Updates a storage volume's mutable properties (e.g., name).
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
user_info: Authenticated user information.
|
|
80
|
+
volume_fid: Identifier of the volume to update.
|
|
81
|
+
body: Request body containing updated fields.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
VolumeModel: The updated volume model.
|
|
85
|
+
|
|
86
|
+
Raises:
|
|
87
|
+
HTTPException: If volume not found or user unauthorized.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
volume_fid (str):
|
|
91
|
+
body (UpdateVolumeRequest): Request model for updating an existing storage volume.
|
|
92
|
+
|
|
93
|
+
Attributes:
|
|
94
|
+
name: New name for the volume. Must follow naming conventions.
|
|
95
|
+
|
|
96
|
+
Raises:
|
|
97
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
98
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
Response[HTTPValidationError | VolumeModel]
|
|
102
|
+
"""
|
|
103
|
+
kwargs = _get_kwargs(
|
|
104
|
+
volume_fid=volume_fid,
|
|
105
|
+
body=body,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
response = client.get_httpx_client().request(
|
|
109
|
+
**kwargs,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
return _build_response(client=client, response=response)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def sync(
|
|
116
|
+
volume_fid: str,
|
|
117
|
+
*,
|
|
118
|
+
client: AuthenticatedClient,
|
|
119
|
+
body: UpdateVolumeRequest,
|
|
120
|
+
) -> HTTPValidationError | VolumeModel | None:
|
|
121
|
+
"""Update Volume
|
|
122
|
+
|
|
123
|
+
Updates a storage volume's mutable properties (e.g., name).
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
user_info: Authenticated user information.
|
|
127
|
+
volume_fid: Identifier of the volume to update.
|
|
128
|
+
body: Request body containing updated fields.
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
VolumeModel: The updated volume model.
|
|
132
|
+
|
|
133
|
+
Raises:
|
|
134
|
+
HTTPException: If volume not found or user unauthorized.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
volume_fid (str):
|
|
138
|
+
body (UpdateVolumeRequest): Request model for updating an existing storage volume.
|
|
139
|
+
|
|
140
|
+
Attributes:
|
|
141
|
+
name: New name for the volume. Must follow naming conventions.
|
|
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
|
+
HTTPValidationError | VolumeModel
|
|
149
|
+
"""
|
|
150
|
+
return sync_detailed(
|
|
151
|
+
volume_fid=volume_fid,
|
|
152
|
+
client=client,
|
|
153
|
+
body=body,
|
|
154
|
+
).parsed
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
async def asyncio_detailed(
|
|
158
|
+
volume_fid: str,
|
|
159
|
+
*,
|
|
160
|
+
client: AuthenticatedClient,
|
|
161
|
+
body: UpdateVolumeRequest,
|
|
162
|
+
) -> Response[HTTPValidationError | VolumeModel]:
|
|
163
|
+
"""Update Volume
|
|
164
|
+
|
|
165
|
+
Updates a storage volume's mutable properties (e.g., name).
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
user_info: Authenticated user information.
|
|
169
|
+
volume_fid: Identifier of the volume to update.
|
|
170
|
+
body: Request body containing updated fields.
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
VolumeModel: The updated volume model.
|
|
174
|
+
|
|
175
|
+
Raises:
|
|
176
|
+
HTTPException: If volume not found or user unauthorized.
|
|
177
|
+
|
|
178
|
+
Args:
|
|
179
|
+
volume_fid (str):
|
|
180
|
+
body (UpdateVolumeRequest): Request model for updating an existing storage volume.
|
|
181
|
+
|
|
182
|
+
Attributes:
|
|
183
|
+
name: New name for the volume. Must follow naming conventions.
|
|
184
|
+
|
|
185
|
+
Raises:
|
|
186
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
187
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
Response[HTTPValidationError | VolumeModel]
|
|
191
|
+
"""
|
|
192
|
+
kwargs = _get_kwargs(
|
|
193
|
+
volume_fid=volume_fid,
|
|
194
|
+
body=body,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
198
|
+
|
|
199
|
+
return _build_response(client=client, response=response)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
async def asyncio(
|
|
203
|
+
volume_fid: str,
|
|
204
|
+
*,
|
|
205
|
+
client: AuthenticatedClient,
|
|
206
|
+
body: UpdateVolumeRequest,
|
|
207
|
+
) -> HTTPValidationError | VolumeModel | None:
|
|
208
|
+
"""Update Volume
|
|
209
|
+
|
|
210
|
+
Updates a storage volume's mutable properties (e.g., name).
|
|
211
|
+
|
|
212
|
+
Args:
|
|
213
|
+
user_info: Authenticated user information.
|
|
214
|
+
volume_fid: Identifier of the volume to update.
|
|
215
|
+
body: Request body containing updated fields.
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
VolumeModel: The updated volume model.
|
|
219
|
+
|
|
220
|
+
Raises:
|
|
221
|
+
HTTPException: If volume not found or user unauthorized.
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
volume_fid (str):
|
|
225
|
+
body (UpdateVolumeRequest): Request model for updating an existing storage volume.
|
|
226
|
+
|
|
227
|
+
Attributes:
|
|
228
|
+
name: New name for the volume. Must follow naming conventions.
|
|
229
|
+
|
|
230
|
+
Raises:
|
|
231
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
232
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
233
|
+
|
|
234
|
+
Returns:
|
|
235
|
+
HTTPValidationError | VolumeModel
|
|
236
|
+
"""
|
|
237
|
+
return (
|
|
238
|
+
await asyncio_detailed(
|
|
239
|
+
volume_fid=volume_fid,
|
|
240
|
+
client=client,
|
|
241
|
+
body=body,
|
|
242
|
+
)
|
|
243
|
+
).parsed
|