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,185 @@
|
|
|
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.bid_model import BidModel
|
|
12
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
13
|
+
from ...models.update_bid_request import UpdateBidRequest
|
|
14
|
+
from ...types import Response
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
bid_fid: str,
|
|
19
|
+
*,
|
|
20
|
+
body: UpdateBidRequest,
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
_kwargs: dict[str, Any] = {
|
|
25
|
+
"method": "patch",
|
|
26
|
+
"url": "/v2/spot/bids/{bid_fid}".format(bid_fid=quote(str(bid_fid), safe="")),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_kwargs["json"] = body.to_dict()
|
|
30
|
+
|
|
31
|
+
headers["Content-Type"] = "application/json"
|
|
32
|
+
|
|
33
|
+
_kwargs["headers"] = headers
|
|
34
|
+
return _kwargs
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse_response(
|
|
38
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
39
|
+
) -> BidModel | HTTPValidationError | None:
|
|
40
|
+
if response.status_code == 200:
|
|
41
|
+
response_200 = BidModel.from_dict(response.json())
|
|
42
|
+
|
|
43
|
+
return response_200
|
|
44
|
+
|
|
45
|
+
if response.status_code == 422:
|
|
46
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_422
|
|
49
|
+
|
|
50
|
+
if client.raise_on_unexpected_status:
|
|
51
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
52
|
+
return None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _build_response(
|
|
56
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
57
|
+
) -> Response[BidModel | HTTPValidationError]:
|
|
58
|
+
return Response(
|
|
59
|
+
status_code=HTTPStatus(response.status_code),
|
|
60
|
+
content=response.content,
|
|
61
|
+
headers=response.headers,
|
|
62
|
+
parsed=_parse_response(client=client, response=response),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def sync_detailed(
|
|
67
|
+
bid_fid: str,
|
|
68
|
+
*,
|
|
69
|
+
client: AuthenticatedClient,
|
|
70
|
+
body: UpdateBidRequest,
|
|
71
|
+
) -> Response[BidModel | HTTPValidationError]:
|
|
72
|
+
"""Update Bid
|
|
73
|
+
|
|
74
|
+
Update the limit price of a Spot bid
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
bid_fid (str):
|
|
78
|
+
body (UpdateBidRequest):
|
|
79
|
+
|
|
80
|
+
Raises:
|
|
81
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
82
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
Response[BidModel | HTTPValidationError]
|
|
86
|
+
"""
|
|
87
|
+
kwargs = _get_kwargs(
|
|
88
|
+
bid_fid=bid_fid,
|
|
89
|
+
body=body,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
response = client.get_httpx_client().request(
|
|
93
|
+
**kwargs,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
return _build_response(client=client, response=response)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def sync(
|
|
100
|
+
bid_fid: str,
|
|
101
|
+
*,
|
|
102
|
+
client: AuthenticatedClient,
|
|
103
|
+
body: UpdateBidRequest,
|
|
104
|
+
) -> BidModel | HTTPValidationError | None:
|
|
105
|
+
"""Update Bid
|
|
106
|
+
|
|
107
|
+
Update the limit price of a Spot bid
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
bid_fid (str):
|
|
111
|
+
body (UpdateBidRequest):
|
|
112
|
+
|
|
113
|
+
Raises:
|
|
114
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
115
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
BidModel | HTTPValidationError
|
|
119
|
+
"""
|
|
120
|
+
return sync_detailed(
|
|
121
|
+
bid_fid=bid_fid,
|
|
122
|
+
client=client,
|
|
123
|
+
body=body,
|
|
124
|
+
).parsed
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
async def asyncio_detailed(
|
|
128
|
+
bid_fid: str,
|
|
129
|
+
*,
|
|
130
|
+
client: AuthenticatedClient,
|
|
131
|
+
body: UpdateBidRequest,
|
|
132
|
+
) -> Response[BidModel | HTTPValidationError]:
|
|
133
|
+
"""Update Bid
|
|
134
|
+
|
|
135
|
+
Update the limit price of a Spot bid
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
bid_fid (str):
|
|
139
|
+
body (UpdateBidRequest):
|
|
140
|
+
|
|
141
|
+
Raises:
|
|
142
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
143
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
Response[BidModel | HTTPValidationError]
|
|
147
|
+
"""
|
|
148
|
+
kwargs = _get_kwargs(
|
|
149
|
+
bid_fid=bid_fid,
|
|
150
|
+
body=body,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
154
|
+
|
|
155
|
+
return _build_response(client=client, response=response)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
async def asyncio(
|
|
159
|
+
bid_fid: str,
|
|
160
|
+
*,
|
|
161
|
+
client: AuthenticatedClient,
|
|
162
|
+
body: UpdateBidRequest,
|
|
163
|
+
) -> BidModel | HTTPValidationError | None:
|
|
164
|
+
"""Update Bid
|
|
165
|
+
|
|
166
|
+
Update the limit price of a Spot bid
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
bid_fid (str):
|
|
170
|
+
body (UpdateBidRequest):
|
|
171
|
+
|
|
172
|
+
Raises:
|
|
173
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
174
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
BidModel | HTTPValidationError
|
|
178
|
+
"""
|
|
179
|
+
return (
|
|
180
|
+
await asyncio_detailed(
|
|
181
|
+
bid_fid=bid_fid,
|
|
182
|
+
client=client,
|
|
183
|
+
body=body,
|
|
184
|
+
)
|
|
185
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from http import HTTPStatus
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
|
|
8
|
+
from ... import errors
|
|
9
|
+
from ...client import AuthenticatedClient, Client
|
|
10
|
+
from ...models.create_ssh_key_request import CreateSshKeyRequest
|
|
11
|
+
from ...models.created_ssh_key_model import CreatedSshKeyModel
|
|
12
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
13
|
+
from ...types import Response
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
*,
|
|
18
|
+
body: CreateSshKeyRequest,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
headers: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
_kwargs: dict[str, Any] = {
|
|
23
|
+
"method": "post",
|
|
24
|
+
"url": "/v2/ssh-keys",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_kwargs["json"] = body.to_dict()
|
|
28
|
+
|
|
29
|
+
headers["Content-Type"] = "application/json"
|
|
30
|
+
|
|
31
|
+
_kwargs["headers"] = headers
|
|
32
|
+
return _kwargs
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _parse_response(
|
|
36
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
37
|
+
) -> CreatedSshKeyModel | HTTPValidationError | None:
|
|
38
|
+
if response.status_code == 201:
|
|
39
|
+
response_201 = CreatedSshKeyModel.from_dict(response.json())
|
|
40
|
+
|
|
41
|
+
return response_201
|
|
42
|
+
|
|
43
|
+
if response.status_code == 422:
|
|
44
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_422
|
|
47
|
+
|
|
48
|
+
if client.raise_on_unexpected_status:
|
|
49
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _build_response(
|
|
54
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
55
|
+
) -> Response[CreatedSshKeyModel | HTTPValidationError]:
|
|
56
|
+
return Response(
|
|
57
|
+
status_code=HTTPStatus(response.status_code),
|
|
58
|
+
content=response.content,
|
|
59
|
+
headers=response.headers,
|
|
60
|
+
parsed=_parse_response(client=client, response=response),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def sync_detailed(
|
|
65
|
+
*,
|
|
66
|
+
client: AuthenticatedClient,
|
|
67
|
+
body: CreateSshKeyRequest,
|
|
68
|
+
) -> Response[CreatedSshKeyModel | HTTPValidationError]:
|
|
69
|
+
"""Create Ssh Key
|
|
70
|
+
|
|
71
|
+
Create a new SSH key. If public_key is not provided, this endpoint will generate
|
|
72
|
+
a new RSA key pair and return both the private and public keys.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
body (CreateSshKeyRequest):
|
|
76
|
+
|
|
77
|
+
Raises:
|
|
78
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
79
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
Response[CreatedSshKeyModel | HTTPValidationError]
|
|
83
|
+
"""
|
|
84
|
+
kwargs = _get_kwargs(
|
|
85
|
+
body=body,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
response = client.get_httpx_client().request(
|
|
89
|
+
**kwargs,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
return _build_response(client=client, response=response)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def sync(
|
|
96
|
+
*,
|
|
97
|
+
client: AuthenticatedClient,
|
|
98
|
+
body: CreateSshKeyRequest,
|
|
99
|
+
) -> CreatedSshKeyModel | HTTPValidationError | None:
|
|
100
|
+
"""Create Ssh Key
|
|
101
|
+
|
|
102
|
+
Create a new SSH key. If public_key is not provided, this endpoint will generate
|
|
103
|
+
a new RSA key pair and return both the private and public keys.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
body (CreateSshKeyRequest):
|
|
107
|
+
|
|
108
|
+
Raises:
|
|
109
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
110
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
CreatedSshKeyModel | HTTPValidationError
|
|
114
|
+
"""
|
|
115
|
+
return sync_detailed(
|
|
116
|
+
client=client,
|
|
117
|
+
body=body,
|
|
118
|
+
).parsed
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
async def asyncio_detailed(
|
|
122
|
+
*,
|
|
123
|
+
client: AuthenticatedClient,
|
|
124
|
+
body: CreateSshKeyRequest,
|
|
125
|
+
) -> Response[CreatedSshKeyModel | HTTPValidationError]:
|
|
126
|
+
"""Create Ssh Key
|
|
127
|
+
|
|
128
|
+
Create a new SSH key. If public_key is not provided, this endpoint will generate
|
|
129
|
+
a new RSA key pair and return both the private and public keys.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
body (CreateSshKeyRequest):
|
|
133
|
+
|
|
134
|
+
Raises:
|
|
135
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
136
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
137
|
+
|
|
138
|
+
Returns:
|
|
139
|
+
Response[CreatedSshKeyModel | HTTPValidationError]
|
|
140
|
+
"""
|
|
141
|
+
kwargs = _get_kwargs(
|
|
142
|
+
body=body,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
146
|
+
|
|
147
|
+
return _build_response(client=client, response=response)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
async def asyncio(
|
|
151
|
+
*,
|
|
152
|
+
client: AuthenticatedClient,
|
|
153
|
+
body: CreateSshKeyRequest,
|
|
154
|
+
) -> CreatedSshKeyModel | HTTPValidationError | None:
|
|
155
|
+
"""Create Ssh Key
|
|
156
|
+
|
|
157
|
+
Create a new SSH key. If public_key is not provided, this endpoint will generate
|
|
158
|
+
a new RSA key pair and return both the private and public keys.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
body (CreateSshKeyRequest):
|
|
162
|
+
|
|
163
|
+
Raises:
|
|
164
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
165
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
CreatedSshKeyModel | HTTPValidationError
|
|
169
|
+
"""
|
|
170
|
+
return (
|
|
171
|
+
await asyncio_detailed(
|
|
172
|
+
client=client,
|
|
173
|
+
body=body,
|
|
174
|
+
)
|
|
175
|
+
).parsed
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from http import HTTPStatus
|
|
4
|
+
from typing import Any, cast
|
|
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 ...types import Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
ssh_key_fid: str,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
_kwargs: dict[str, Any] = {
|
|
19
|
+
"method": "delete",
|
|
20
|
+
"url": "/v2/ssh-keys/{ssh_key_fid}".format(
|
|
21
|
+
ssh_key_fid=quote(str(ssh_key_fid), safe="")
|
|
22
|
+
),
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return _kwargs
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _parse_response(
|
|
29
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
30
|
+
) -> Any | HTTPValidationError | None:
|
|
31
|
+
if response.status_code == 204:
|
|
32
|
+
response_204 = cast(Any, None)
|
|
33
|
+
return response_204
|
|
34
|
+
|
|
35
|
+
if response.status_code == 422:
|
|
36
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
37
|
+
|
|
38
|
+
return response_422
|
|
39
|
+
|
|
40
|
+
if client.raise_on_unexpected_status:
|
|
41
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _build_response(
|
|
46
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
47
|
+
) -> Response[Any | HTTPValidationError]:
|
|
48
|
+
return Response(
|
|
49
|
+
status_code=HTTPStatus(response.status_code),
|
|
50
|
+
content=response.content,
|
|
51
|
+
headers=response.headers,
|
|
52
|
+
parsed=_parse_response(client=client, response=response),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def sync_detailed(
|
|
57
|
+
ssh_key_fid: str,
|
|
58
|
+
*,
|
|
59
|
+
client: AuthenticatedClient,
|
|
60
|
+
) -> Response[Any | HTTPValidationError]:
|
|
61
|
+
"""Delete Ssh Key
|
|
62
|
+
|
|
63
|
+
Delete an SSH key. Note that SSH keys used in active bids/reservations cannot
|
|
64
|
+
be deleted.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
ssh_key_fid (str):
|
|
68
|
+
|
|
69
|
+
Raises:
|
|
70
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
71
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
Response[Any | HTTPValidationError]
|
|
75
|
+
"""
|
|
76
|
+
kwargs = _get_kwargs(
|
|
77
|
+
ssh_key_fid=ssh_key_fid,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
response = client.get_httpx_client().request(
|
|
81
|
+
**kwargs,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
return _build_response(client=client, response=response)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def sync(
|
|
88
|
+
ssh_key_fid: str,
|
|
89
|
+
*,
|
|
90
|
+
client: AuthenticatedClient,
|
|
91
|
+
) -> Any | HTTPValidationError | None:
|
|
92
|
+
"""Delete Ssh Key
|
|
93
|
+
|
|
94
|
+
Delete an SSH key. Note that SSH keys used in active bids/reservations cannot
|
|
95
|
+
be deleted.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
ssh_key_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
|
+
Any | HTTPValidationError
|
|
106
|
+
"""
|
|
107
|
+
return sync_detailed(
|
|
108
|
+
ssh_key_fid=ssh_key_fid,
|
|
109
|
+
client=client,
|
|
110
|
+
).parsed
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
async def asyncio_detailed(
|
|
114
|
+
ssh_key_fid: str,
|
|
115
|
+
*,
|
|
116
|
+
client: AuthenticatedClient,
|
|
117
|
+
) -> Response[Any | HTTPValidationError]:
|
|
118
|
+
"""Delete Ssh Key
|
|
119
|
+
|
|
120
|
+
Delete an SSH key. Note that SSH keys used in active bids/reservations cannot
|
|
121
|
+
be deleted.
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
ssh_key_fid (str):
|
|
125
|
+
|
|
126
|
+
Raises:
|
|
127
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
128
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
Response[Any | HTTPValidationError]
|
|
132
|
+
"""
|
|
133
|
+
kwargs = _get_kwargs(
|
|
134
|
+
ssh_key_fid=ssh_key_fid,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
138
|
+
|
|
139
|
+
return _build_response(client=client, response=response)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
async def asyncio(
|
|
143
|
+
ssh_key_fid: str,
|
|
144
|
+
*,
|
|
145
|
+
client: AuthenticatedClient,
|
|
146
|
+
) -> Any | HTTPValidationError | None:
|
|
147
|
+
"""Delete Ssh Key
|
|
148
|
+
|
|
149
|
+
Delete an SSH key. Note that SSH keys used in active bids/reservations cannot
|
|
150
|
+
be deleted.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
ssh_key_fid (str):
|
|
154
|
+
|
|
155
|
+
Raises:
|
|
156
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
157
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
158
|
+
|
|
159
|
+
Returns:
|
|
160
|
+
Any | HTTPValidationError
|
|
161
|
+
"""
|
|
162
|
+
return (
|
|
163
|
+
await asyncio_detailed(
|
|
164
|
+
ssh_key_fid=ssh_key_fid,
|
|
165
|
+
client=client,
|
|
166
|
+
)
|
|
167
|
+
).parsed
|
|
@@ -0,0 +1,175 @@
|
|
|
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.new_ssh_key_model import NewSshKeyModel
|
|
12
|
+
from ...types import UNSET, Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
project: str,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
params: dict[str, Any] = {}
|
|
20
|
+
|
|
21
|
+
params["project"] = project
|
|
22
|
+
|
|
23
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
24
|
+
|
|
25
|
+
_kwargs: dict[str, Any] = {
|
|
26
|
+
"method": "get",
|
|
27
|
+
"url": "/v2/ssh-keys",
|
|
28
|
+
"params": params,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return _kwargs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(
|
|
35
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
36
|
+
) -> HTTPValidationError | list[NewSshKeyModel] | None:
|
|
37
|
+
if response.status_code == 200:
|
|
38
|
+
response_200 = []
|
|
39
|
+
_response_200 = response.json()
|
|
40
|
+
for response_200_item_data in _response_200:
|
|
41
|
+
response_200_item = NewSshKeyModel.from_dict(response_200_item_data)
|
|
42
|
+
|
|
43
|
+
response_200.append(response_200_item)
|
|
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 | list[NewSshKeyModel]]:
|
|
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
|
+
*,
|
|
70
|
+
client: AuthenticatedClient,
|
|
71
|
+
project: str,
|
|
72
|
+
) -> Response[HTTPValidationError | list[NewSshKeyModel]]:
|
|
73
|
+
"""Get Ssh Keys
|
|
74
|
+
|
|
75
|
+
Get all SSH keys for a project
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
project (str):
|
|
79
|
+
|
|
80
|
+
Raises:
|
|
81
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
82
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
Response[HTTPValidationError | list[NewSshKeyModel]]
|
|
86
|
+
"""
|
|
87
|
+
kwargs = _get_kwargs(
|
|
88
|
+
project=project,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
response = client.get_httpx_client().request(
|
|
92
|
+
**kwargs,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
return _build_response(client=client, response=response)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def sync(
|
|
99
|
+
*,
|
|
100
|
+
client: AuthenticatedClient,
|
|
101
|
+
project: str,
|
|
102
|
+
) -> HTTPValidationError | list[NewSshKeyModel] | None:
|
|
103
|
+
"""Get Ssh Keys
|
|
104
|
+
|
|
105
|
+
Get all SSH keys for a project
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
project (str):
|
|
109
|
+
|
|
110
|
+
Raises:
|
|
111
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
112
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
HTTPValidationError | list[NewSshKeyModel]
|
|
116
|
+
"""
|
|
117
|
+
return sync_detailed(
|
|
118
|
+
client=client,
|
|
119
|
+
project=project,
|
|
120
|
+
).parsed
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
async def asyncio_detailed(
|
|
124
|
+
*,
|
|
125
|
+
client: AuthenticatedClient,
|
|
126
|
+
project: str,
|
|
127
|
+
) -> Response[HTTPValidationError | list[NewSshKeyModel]]:
|
|
128
|
+
"""Get Ssh Keys
|
|
129
|
+
|
|
130
|
+
Get all SSH keys for a project
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
project (str):
|
|
134
|
+
|
|
135
|
+
Raises:
|
|
136
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
137
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
138
|
+
|
|
139
|
+
Returns:
|
|
140
|
+
Response[HTTPValidationError | list[NewSshKeyModel]]
|
|
141
|
+
"""
|
|
142
|
+
kwargs = _get_kwargs(
|
|
143
|
+
project=project,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
147
|
+
|
|
148
|
+
return _build_response(client=client, response=response)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
async def asyncio(
|
|
152
|
+
*,
|
|
153
|
+
client: AuthenticatedClient,
|
|
154
|
+
project: str,
|
|
155
|
+
) -> HTTPValidationError | list[NewSshKeyModel] | None:
|
|
156
|
+
"""Get Ssh Keys
|
|
157
|
+
|
|
158
|
+
Get all SSH keys for a project
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
project (str):
|
|
162
|
+
|
|
163
|
+
Raises:
|
|
164
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
165
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
HTTPValidationError | list[NewSshKeyModel]
|
|
169
|
+
"""
|
|
170
|
+
return (
|
|
171
|
+
await asyncio_detailed(
|
|
172
|
+
client=client,
|
|
173
|
+
project=project,
|
|
174
|
+
)
|
|
175
|
+
).parsed
|