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.
Files changed (163) hide show
  1. mithril/__init__.py +7 -0
  2. mithril/_mcli.cpython-314-darwin.so +0 -0
  3. mithril/_mcli.pyi +7 -0
  4. mithril/_mcli_entry.py +75 -0
  5. mithril/api/__init__.py +7 -0
  6. mithril/api/bindings/.gitattributes +2 -0
  7. mithril/api/bindings/__init__.py +10 -0
  8. mithril/api/bindings/api/__init__.py +1 -0
  9. mithril/api/bindings/api/api_keys/__init__.py +1 -0
  10. mithril/api/bindings/api/api_keys/create_api_key_v2_api_keys_post.py +179 -0
  11. mithril/api/bindings/api/api_keys/get_api_keys_v2_api_keys_get.py +141 -0
  12. mithril/api/bindings/api/api_keys/revoke_api_key_v2_api_keys_key_fid_delete.py +173 -0
  13. mithril/api/bindings/api/image_versions/__init__.py +1 -0
  14. mithril/api/bindings/api/image_versions/get_image_versions_v2_image_versions_get.py +141 -0
  15. mithril/api/bindings/api/image_versions/get_mcc_image_versions_v2_mcc_image_versions_get.py +179 -0
  16. mithril/api/bindings/api/instance_types/__init__.py +1 -0
  17. mithril/api/bindings/api/instance_types/get_instance_types_v2_instance_types_get.py +137 -0
  18. mithril/api/bindings/api/instances/__init__.py +1 -0
  19. mithril/api/bindings/api/instances/get_instance_status_v2_instances_instance_id_status_get.py +165 -0
  20. mithril/api/bindings/api/instances/get_instances_v2_instances_get.py +409 -0
  21. mithril/api/bindings/api/kubernetes_clusters/__init__.py +1 -0
  22. mithril/api/bindings/api/kubernetes_clusters/create_kubernetes_cluster_v2_kubernetes_clusters_post.py +171 -0
  23. mithril/api/bindings/api/kubernetes_clusters/delete_kubernetes_cluster_v2_kubernetes_clusters_cluster_fid_delete.py +163 -0
  24. mithril/api/bindings/api/kubernetes_clusters/get_kubernetes_cluster_v2_kubernetes_clusters_cluster_fid_get.py +165 -0
  25. mithril/api/bindings/api/kubernetes_clusters/get_kubernetes_clusters_v2_kubernetes_clusters_get.py +175 -0
  26. mithril/api/bindings/api/lifecycle_scripts/__init__.py +1 -0
  27. mithril/api/bindings/api/lifecycle_scripts/create_lifecycle_script_v2_lifecycle_scripts_post.py +171 -0
  28. mithril/api/bindings/api/lifecycle_scripts/delete_lifecycle_script_v2_lifecycle_scripts_ls_fid_delete.py +155 -0
  29. mithril/api/bindings/api/lifecycle_scripts/get_lifecycle_script_content_v2_lifecycle_scripts_ls_fid_content_get.py +155 -0
  30. mithril/api/bindings/api/lifecycle_scripts/list_lifecycle_scripts_v2_lifecycle_scripts_get.py +247 -0
  31. mithril/api/bindings/api/lifecycle_scripts/update_lifecycle_script_v2_lifecycle_scripts_ls_fid_patch.py +179 -0
  32. mithril/api/bindings/api/pricing/__init__.py +1 -0
  33. mithril/api/bindings/api/pricing/get_current_prices_v2_v2_pricing_current_get.py +217 -0
  34. mithril/api/bindings/api/pricing/get_historical_prices_v2_v2_pricing_history_get.py +222 -0
  35. mithril/api/bindings/api/profile/__init__.py +1 -0
  36. mithril/api/bindings/api/profile/get_me_v2_me_get.py +132 -0
  37. mithril/api/bindings/api/profile/get_my_teammates_v2_me_teammates_get.py +153 -0
  38. mithril/api/bindings/api/projects/__init__.py +1 -0
  39. mithril/api/bindings/api/projects/get_projects_v2_projects_get.py +137 -0
  40. mithril/api/bindings/api/quotas/__init__.py +1 -0
  41. mithril/api/bindings/api/quotas/get_quotas_v2_quotas_get.py +175 -0
  42. mithril/api/bindings/api/reservations/__init__.py +1 -0
  43. mithril/api/bindings/api/reservations/create_reservation_v2_reservation_post.py +171 -0
  44. mithril/api/bindings/api/reservations/extend_reservation_v2_reservation_reservation_fid_extend_post.py +187 -0
  45. mithril/api/bindings/api/reservations/get_availability_v2_reservation_availability_get.py +664 -0
  46. mithril/api/bindings/api/reservations/get_extension_availability_v2_reservation_reservation_fid_extension_availability_get.py +165 -0
  47. mithril/api/bindings/api/reservations/get_reservations_v2_reservation_get.py +309 -0
  48. mithril/api/bindings/api/reservations/update_reservation_v2_reservation_reservation_fid_patch.py +187 -0
  49. mithril/api/bindings/api/spot/__init__.py +1 -0
  50. mithril/api/bindings/api/spot/cancel_bid_v2_spot_bids_bid_fid_delete.py +161 -0
  51. mithril/api/bindings/api/spot/create_bid_v2_spot_bids_post.py +171 -0
  52. mithril/api/bindings/api/spot/get_auctions_v2_spot_availability_get.py +137 -0
  53. mithril/api/bindings/api/spot/get_bid_history_v2_spot_bids_bid_fid_history_get.py +193 -0
  54. mithril/api/bindings/api/spot/get_bid_status_v2_spot_bids_bid_fid_status_get.py +189 -0
  55. mithril/api/bindings/api/spot/get_bid_v2_spot_bids_bid_fid_get.py +163 -0
  56. mithril/api/bindings/api/spot/get_bids_v2_spot_bids_get.py +330 -0
  57. mithril/api/bindings/api/spot/update_bid_v2_spot_bids_bid_fid_patch.py +185 -0
  58. mithril/api/bindings/api/ssh_keys/__init__.py +1 -0
  59. mithril/api/bindings/api/ssh_keys/create_ssh_key_v2_ssh_keys_post.py +175 -0
  60. mithril/api/bindings/api/ssh_keys/delete_ssh_key_v2_ssh_keys_ssh_key_fid_delete.py +167 -0
  61. mithril/api/bindings/api/ssh_keys/get_ssh_keys_v2_ssh_keys_get.py +175 -0
  62. mithril/api/bindings/api/ssh_keys/update_ssh_key_v2_ssh_keys_ssh_key_fid_patch.py +187 -0
  63. mithril/api/bindings/api/volumes/__init__.py +1 -0
  64. mithril/api/bindings/api/volumes/create_volume_v2_volumes_post.py +211 -0
  65. mithril/api/bindings/api/volumes/delete_volume_v2_volumes_volume_fid_delete.py +199 -0
  66. mithril/api/bindings/api/volumes/get_volumes_v2_volumes_get.py +239 -0
  67. mithril/api/bindings/api/volumes/update_volume_v2_volumes_volume_fid_patch.py +243 -0
  68. mithril/api/bindings/client.py +284 -0
  69. mithril/api/bindings/errors.py +18 -0
  70. mithril/api/bindings/models/__init__.py +169 -0
  71. mithril/api/bindings/models/api_key_model.py +114 -0
  72. mithril/api/bindings/models/auction_model.py +146 -0
  73. mithril/api/bindings/models/availability_slot_model.py +76 -0
  74. mithril/api/bindings/models/bid_history_event_model.py +157 -0
  75. mithril/api/bindings/models/bid_history_event_model_event_type.py +19 -0
  76. mithril/api/bindings/models/bid_history_response.py +84 -0
  77. mithril/api/bindings/models/bid_model.py +191 -0
  78. mithril/api/bindings/models/bid_model_status.py +14 -0
  79. mithril/api/bindings/models/bid_status_response.py +72 -0
  80. mithril/api/bindings/models/bid_status_response_status.py +15 -0
  81. mithril/api/bindings/models/check_availability_response.py +60 -0
  82. mithril/api/bindings/models/create_api_key_request.py +68 -0
  83. mithril/api/bindings/models/create_api_key_response.py +122 -0
  84. mithril/api/bindings/models/create_bid_request.py +116 -0
  85. mithril/api/bindings/models/create_kubernetes_cluster_request.py +136 -0
  86. mithril/api/bindings/models/create_kubernetes_cluster_request_k8s_version.py +11 -0
  87. mithril/api/bindings/models/create_lifecycle_script_request.py +115 -0
  88. mithril/api/bindings/models/create_reservation_request.py +124 -0
  89. mithril/api/bindings/models/create_ssh_key_request.py +99 -0
  90. mithril/api/bindings/models/create_volume_request.py +98 -0
  91. mithril/api/bindings/models/create_volume_request_disk_interface.py +11 -0
  92. mithril/api/bindings/models/created_ssh_key_model.py +122 -0
  93. mithril/api/bindings/models/current_prices_response.py +202 -0
  94. mithril/api/bindings/models/extend_reservation_request.py +60 -0
  95. mithril/api/bindings/models/extension_availability_response.py +68 -0
  96. mithril/api/bindings/models/get_availability_v2_reservation_availability_get_mode.py +12 -0
  97. mithril/api/bindings/models/get_bids_response.py +96 -0
  98. mithril/api/bindings/models/get_bids_v2_spot_bids_get_sort_by.py +11 -0
  99. mithril/api/bindings/models/get_bids_v2_spot_bids_get_status.py +14 -0
  100. mithril/api/bindings/models/get_instances_response.py +96 -0
  101. mithril/api/bindings/models/get_instances_v2_instances_get_order_type_in_type_0_item.py +11 -0
  102. mithril/api/bindings/models/get_instances_v2_instances_get_sort_by.py +12 -0
  103. mithril/api/bindings/models/get_instances_v2_instances_get_status_in_type_0_item.py +24 -0
  104. mithril/api/bindings/models/get_latest_end_time_response.py +68 -0
  105. mithril/api/bindings/models/get_reservations_response.py +96 -0
  106. mithril/api/bindings/models/get_reservations_v2_reservation_get_sort_by.py +11 -0
  107. mithril/api/bindings/models/get_reservations_v2_reservation_get_status.py +14 -0
  108. mithril/api/bindings/models/historical_price_point_model.py +94 -0
  109. mithril/api/bindings/models/historical_prices_response_model.py +76 -0
  110. mithril/api/bindings/models/http_validation_error.py +78 -0
  111. mithril/api/bindings/models/image_version_model.py +224 -0
  112. mithril/api/bindings/models/instance_model.py +211 -0
  113. mithril/api/bindings/models/instance_model_status.py +24 -0
  114. mithril/api/bindings/models/instance_status_response.py +141 -0
  115. mithril/api/bindings/models/instance_status_response_status.py +24 -0
  116. mithril/api/bindings/models/instance_type_model.py +170 -0
  117. mithril/api/bindings/models/kubernetes_cluster_model.py +207 -0
  118. mithril/api/bindings/models/kubernetes_cluster_model_status.py +12 -0
  119. mithril/api/bindings/models/launch_specification_model.py +152 -0
  120. mithril/api/bindings/models/lifecycle_script_model.py +134 -0
  121. mithril/api/bindings/models/lifecycle_script_scope.py +12 -0
  122. mithril/api/bindings/models/list_lifecycle_scripts_response.py +96 -0
  123. mithril/api/bindings/models/list_lifecycle_scripts_v2_lifecycle_scripts_get_sort_by.py +11 -0
  124. mithril/api/bindings/models/me_response.py +126 -0
  125. mithril/api/bindings/models/new_ssh_key_model.py +100 -0
  126. mithril/api/bindings/models/persistent_disk_change.py +92 -0
  127. mithril/api/bindings/models/project_model.py +76 -0
  128. mithril/api/bindings/models/public_lifecycle_script_scope.py +11 -0
  129. mithril/api/bindings/models/quota_model.py +132 -0
  130. mithril/api/bindings/models/reservation_model.py +215 -0
  131. mithril/api/bindings/models/reservation_model_status.py +14 -0
  132. mithril/api/bindings/models/size.py +70 -0
  133. mithril/api/bindings/models/size_unit.py +18 -0
  134. mithril/api/bindings/models/sort_direction.py +11 -0
  135. mithril/api/bindings/models/teammate_response.py +158 -0
  136. mithril/api/bindings/models/update_bid_request.py +143 -0
  137. mithril/api/bindings/models/update_lifecycle_script_request.py +109 -0
  138. mithril/api/bindings/models/update_reservation_request.py +103 -0
  139. mithril/api/bindings/models/update_ssh_key_request.py +60 -0
  140. mithril/api/bindings/models/update_volume_request.py +65 -0
  141. mithril/api/bindings/models/validation_error.py +89 -0
  142. mithril/api/bindings/models/volume_model.py +140 -0
  143. mithril/api/bindings/models/volume_model_attachments.py +46 -0
  144. mithril/api/bindings/models/volume_model_interface.py +11 -0
  145. mithril/api/bindings/types.py +56 -0
  146. mithril/api/client.py +138 -0
  147. mithril/cli/__init__.py +7 -0
  148. mithril/cli/commands/__init__.py +15 -0
  149. mithril/cli/commands/help.py +88 -0
  150. mithril/cli/commands/launch.py +353 -0
  151. mithril/cli/main.py +68 -0
  152. mithril/cli/utils/__init__.py +1 -0
  153. mithril/cli/utils/skypilot_passthrough.py +38 -0
  154. mithril/cli/utils/streaming.py +235 -0
  155. mithril/cli/utils/volumes.py +110 -0
  156. mithril/config.py +47 -0
  157. mithril/py.typed +0 -0
  158. mithril/sky/__init__.py +141 -0
  159. mithril/sky/client.py +176 -0
  160. mithril_client-0.1.0a1.dist-info/METADATA +56 -0
  161. mithril_client-0.1.0a1.dist-info/RECORD +163 -0
  162. mithril_client-0.1.0a1.dist-info/WHEEL +4 -0
  163. mithril_client-0.1.0a1.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,141 @@
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.image_version_model import ImageVersionModel
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs() -> dict[str, Any]:
15
+ _kwargs: dict[str, Any] = {
16
+ "method": "get",
17
+ "url": "/v2/image-versions",
18
+ }
19
+
20
+ return _kwargs
21
+
22
+
23
+ def _parse_response(
24
+ *, client: AuthenticatedClient | Client, response: httpx.Response
25
+ ) -> list[ImageVersionModel] | None:
26
+ if response.status_code == 200:
27
+ response_200 = []
28
+ _response_200 = response.json()
29
+ for response_200_item_data in _response_200:
30
+ response_200_item = ImageVersionModel.from_dict(response_200_item_data)
31
+
32
+ response_200.append(response_200_item)
33
+
34
+ return response_200
35
+
36
+ if client.raise_on_unexpected_status:
37
+ raise errors.UnexpectedStatus(response.status_code, response.content)
38
+ return None
39
+
40
+
41
+ def _build_response(
42
+ *, client: AuthenticatedClient | Client, response: httpx.Response
43
+ ) -> Response[list[ImageVersionModel]]:
44
+ return Response(
45
+ status_code=HTTPStatus(response.status_code),
46
+ content=response.content,
47
+ headers=response.headers,
48
+ parsed=_parse_response(client=client, response=response),
49
+ )
50
+
51
+
52
+ def sync_detailed(
53
+ *,
54
+ client: AuthenticatedClient,
55
+ ) -> Response[list[ImageVersionModel]]:
56
+ """Get Image Versions
57
+
58
+ Get all available image versions;
59
+ the stable image version is the default unless otherwise specified.
60
+
61
+ Raises:
62
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
63
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
64
+
65
+ Returns:
66
+ Response[list[ImageVersionModel]]
67
+ """
68
+ kwargs = _get_kwargs()
69
+
70
+ response = client.get_httpx_client().request(
71
+ **kwargs,
72
+ )
73
+
74
+ return _build_response(client=client, response=response)
75
+
76
+
77
+ def sync(
78
+ *,
79
+ client: AuthenticatedClient,
80
+ ) -> list[ImageVersionModel] | None:
81
+ """Get Image Versions
82
+
83
+ Get all available image versions;
84
+ the stable image version is the default unless otherwise specified.
85
+
86
+ Raises:
87
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
88
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
89
+
90
+ Returns:
91
+ list[ImageVersionModel]
92
+ """
93
+ return sync_detailed(
94
+ client=client,
95
+ ).parsed
96
+
97
+
98
+ async def asyncio_detailed(
99
+ *,
100
+ client: AuthenticatedClient,
101
+ ) -> Response[list[ImageVersionModel]]:
102
+ """Get Image Versions
103
+
104
+ Get all available image versions;
105
+ the stable image version is the default unless otherwise specified.
106
+
107
+ Raises:
108
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
109
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
110
+
111
+ Returns:
112
+ Response[list[ImageVersionModel]]
113
+ """
114
+ kwargs = _get_kwargs()
115
+
116
+ response = await client.get_async_httpx_client().request(**kwargs)
117
+
118
+ return _build_response(client=client, response=response)
119
+
120
+
121
+ async def asyncio(
122
+ *,
123
+ client: AuthenticatedClient,
124
+ ) -> list[ImageVersionModel] | None:
125
+ """Get Image Versions
126
+
127
+ Get all available image versions;
128
+ the stable image version is the default unless otherwise specified.
129
+
130
+ Raises:
131
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
132
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
133
+
134
+ Returns:
135
+ list[ImageVersionModel]
136
+ """
137
+ return (
138
+ await asyncio_detailed(
139
+ client=client,
140
+ )
141
+ ).parsed
@@ -0,0 +1,179 @@
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.image_version_model import ImageVersionModel
12
+ from ...types import UNSET, Response
13
+
14
+
15
+ def _get_kwargs(
16
+ *,
17
+ region: str,
18
+ ) -> dict[str, Any]:
19
+ params: dict[str, Any] = {}
20
+
21
+ params["region"] = region
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/mcc-image-versions",
28
+ "params": params,
29
+ }
30
+
31
+ return _kwargs
32
+
33
+
34
+ def _parse_response(
35
+ *, client: AuthenticatedClient | Client, response: httpx.Response
36
+ ) -> HTTPValidationError | list[ImageVersionModel] | 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 = ImageVersionModel.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[ImageVersionModel]]:
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
+ region: str,
72
+ ) -> Response[HTTPValidationError | list[ImageVersionModel]]:
73
+ """Get Mcc Image Versions
74
+
75
+ Get MCC (CPU) image versions available for a region.
76
+ These are CPU-only images used for Kubernetes cluster control planes.
77
+
78
+ Args:
79
+ region (str):
80
+
81
+ Raises:
82
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
83
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
84
+
85
+ Returns:
86
+ Response[HTTPValidationError | list[ImageVersionModel]]
87
+ """
88
+ kwargs = _get_kwargs(
89
+ region=region,
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
+ *,
101
+ client: AuthenticatedClient,
102
+ region: str,
103
+ ) -> HTTPValidationError | list[ImageVersionModel] | None:
104
+ """Get Mcc Image Versions
105
+
106
+ Get MCC (CPU) image versions available for a region.
107
+ These are CPU-only images used for Kubernetes cluster control planes.
108
+
109
+ Args:
110
+ region (str):
111
+
112
+ Raises:
113
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
114
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
115
+
116
+ Returns:
117
+ HTTPValidationError | list[ImageVersionModel]
118
+ """
119
+ return sync_detailed(
120
+ client=client,
121
+ region=region,
122
+ ).parsed
123
+
124
+
125
+ async def asyncio_detailed(
126
+ *,
127
+ client: AuthenticatedClient,
128
+ region: str,
129
+ ) -> Response[HTTPValidationError | list[ImageVersionModel]]:
130
+ """Get Mcc Image Versions
131
+
132
+ Get MCC (CPU) image versions available for a region.
133
+ These are CPU-only images used for Kubernetes cluster control planes.
134
+
135
+ Args:
136
+ region (str):
137
+
138
+ Raises:
139
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
140
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
141
+
142
+ Returns:
143
+ Response[HTTPValidationError | list[ImageVersionModel]]
144
+ """
145
+ kwargs = _get_kwargs(
146
+ region=region,
147
+ )
148
+
149
+ response = await client.get_async_httpx_client().request(**kwargs)
150
+
151
+ return _build_response(client=client, response=response)
152
+
153
+
154
+ async def asyncio(
155
+ *,
156
+ client: AuthenticatedClient,
157
+ region: str,
158
+ ) -> HTTPValidationError | list[ImageVersionModel] | None:
159
+ """Get Mcc Image Versions
160
+
161
+ Get MCC (CPU) image versions available for a region.
162
+ These are CPU-only images used for Kubernetes cluster control planes.
163
+
164
+ Args:
165
+ region (str):
166
+
167
+ Raises:
168
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
169
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
170
+
171
+ Returns:
172
+ HTTPValidationError | list[ImageVersionModel]
173
+ """
174
+ return (
175
+ await asyncio_detailed(
176
+ client=client,
177
+ region=region,
178
+ )
179
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,137 @@
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.instance_type_model import InstanceTypeModel
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs() -> dict[str, Any]:
15
+ _kwargs: dict[str, Any] = {
16
+ "method": "get",
17
+ "url": "/v2/instance-types",
18
+ }
19
+
20
+ return _kwargs
21
+
22
+
23
+ def _parse_response(
24
+ *, client: AuthenticatedClient | Client, response: httpx.Response
25
+ ) -> list[InstanceTypeModel] | None:
26
+ if response.status_code == 200:
27
+ response_200 = []
28
+ _response_200 = response.json()
29
+ for response_200_item_data in _response_200:
30
+ response_200_item = InstanceTypeModel.from_dict(response_200_item_data)
31
+
32
+ response_200.append(response_200_item)
33
+
34
+ return response_200
35
+
36
+ if client.raise_on_unexpected_status:
37
+ raise errors.UnexpectedStatus(response.status_code, response.content)
38
+ return None
39
+
40
+
41
+ def _build_response(
42
+ *, client: AuthenticatedClient | Client, response: httpx.Response
43
+ ) -> Response[list[InstanceTypeModel]]:
44
+ return Response(
45
+ status_code=HTTPStatus(response.status_code),
46
+ content=response.content,
47
+ headers=response.headers,
48
+ parsed=_parse_response(client=client, response=response),
49
+ )
50
+
51
+
52
+ def sync_detailed(
53
+ *,
54
+ client: AuthenticatedClient,
55
+ ) -> Response[list[InstanceTypeModel]]:
56
+ """Get Instance Types
57
+
58
+ Get all instance types.
59
+
60
+ Raises:
61
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
62
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
63
+
64
+ Returns:
65
+ Response[list[InstanceTypeModel]]
66
+ """
67
+ kwargs = _get_kwargs()
68
+
69
+ response = client.get_httpx_client().request(
70
+ **kwargs,
71
+ )
72
+
73
+ return _build_response(client=client, response=response)
74
+
75
+
76
+ def sync(
77
+ *,
78
+ client: AuthenticatedClient,
79
+ ) -> list[InstanceTypeModel] | None:
80
+ """Get Instance Types
81
+
82
+ Get all instance types.
83
+
84
+ Raises:
85
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
86
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
87
+
88
+ Returns:
89
+ list[InstanceTypeModel]
90
+ """
91
+ return sync_detailed(
92
+ client=client,
93
+ ).parsed
94
+
95
+
96
+ async def asyncio_detailed(
97
+ *,
98
+ client: AuthenticatedClient,
99
+ ) -> Response[list[InstanceTypeModel]]:
100
+ """Get Instance Types
101
+
102
+ Get all instance types.
103
+
104
+ Raises:
105
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
106
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
107
+
108
+ Returns:
109
+ Response[list[InstanceTypeModel]]
110
+ """
111
+ kwargs = _get_kwargs()
112
+
113
+ response = await client.get_async_httpx_client().request(**kwargs)
114
+
115
+ return _build_response(client=client, response=response)
116
+
117
+
118
+ async def asyncio(
119
+ *,
120
+ client: AuthenticatedClient,
121
+ ) -> list[InstanceTypeModel] | None:
122
+ """Get Instance Types
123
+
124
+ Get all instance types.
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
+ list[InstanceTypeModel]
132
+ """
133
+ return (
134
+ await asyncio_detailed(
135
+ client=client,
136
+ )
137
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,165 @@
1
+ from __future__ import annotations
2
+
3
+ from http import HTTPStatus
4
+ from typing import Any
5
+ from urllib.parse import quote
6
+
7
+ import httpx
8
+
9
+ from ... import errors
10
+ from ...client import AuthenticatedClient, Client
11
+ from ...models.http_validation_error import HTTPValidationError
12
+ from ...models.instance_status_response import InstanceStatusResponse
13
+ from ...types import Response
14
+
15
+
16
+ def _get_kwargs(
17
+ instance_id: str,
18
+ ) -> dict[str, Any]:
19
+ _kwargs: dict[str, Any] = {
20
+ "method": "get",
21
+ "url": "/v2/instances/{instance_id}/status".format(
22
+ instance_id=quote(str(instance_id), safe="")
23
+ ),
24
+ }
25
+
26
+ return _kwargs
27
+
28
+
29
+ def _parse_response(
30
+ *, client: AuthenticatedClient | Client, response: httpx.Response
31
+ ) -> HTTPValidationError | InstanceStatusResponse | None:
32
+ if response.status_code == 200:
33
+ response_200 = InstanceStatusResponse.from_dict(response.json())
34
+
35
+ return response_200
36
+
37
+ if response.status_code == 422:
38
+ response_422 = HTTPValidationError.from_dict(response.json())
39
+
40
+ return response_422
41
+
42
+ if client.raise_on_unexpected_status:
43
+ raise errors.UnexpectedStatus(response.status_code, response.content)
44
+ return None
45
+
46
+
47
+ def _build_response(
48
+ *, client: AuthenticatedClient | Client, response: httpx.Response
49
+ ) -> Response[HTTPValidationError | InstanceStatusResponse]:
50
+ return Response(
51
+ status_code=HTTPStatus(response.status_code),
52
+ content=response.content,
53
+ headers=response.headers,
54
+ parsed=_parse_response(client=client, response=response),
55
+ )
56
+
57
+
58
+ def sync_detailed(
59
+ instance_id: str,
60
+ *,
61
+ client: AuthenticatedClient,
62
+ ) -> Response[HTTPValidationError | InstanceStatusResponse]:
63
+ """Get Instance Status
64
+
65
+ Get the status of a specific instance by its ID
66
+
67
+ Args:
68
+ instance_id (str):
69
+
70
+ Raises:
71
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
72
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
73
+
74
+ Returns:
75
+ Response[HTTPValidationError | InstanceStatusResponse]
76
+ """
77
+ kwargs = _get_kwargs(
78
+ instance_id=instance_id,
79
+ )
80
+
81
+ response = client.get_httpx_client().request(
82
+ **kwargs,
83
+ )
84
+
85
+ return _build_response(client=client, response=response)
86
+
87
+
88
+ def sync(
89
+ instance_id: str,
90
+ *,
91
+ client: AuthenticatedClient,
92
+ ) -> HTTPValidationError | InstanceStatusResponse | None:
93
+ """Get Instance Status
94
+
95
+ Get the status of a specific instance by its ID
96
+
97
+ Args:
98
+ instance_id (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
+ HTTPValidationError | InstanceStatusResponse
106
+ """
107
+ return sync_detailed(
108
+ instance_id=instance_id,
109
+ client=client,
110
+ ).parsed
111
+
112
+
113
+ async def asyncio_detailed(
114
+ instance_id: str,
115
+ *,
116
+ client: AuthenticatedClient,
117
+ ) -> Response[HTTPValidationError | InstanceStatusResponse]:
118
+ """Get Instance Status
119
+
120
+ Get the status of a specific instance by its ID
121
+
122
+ Args:
123
+ instance_id (str):
124
+
125
+ Raises:
126
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
128
+
129
+ Returns:
130
+ Response[HTTPValidationError | InstanceStatusResponse]
131
+ """
132
+ kwargs = _get_kwargs(
133
+ instance_id=instance_id,
134
+ )
135
+
136
+ response = await client.get_async_httpx_client().request(**kwargs)
137
+
138
+ return _build_response(client=client, response=response)
139
+
140
+
141
+ async def asyncio(
142
+ instance_id: str,
143
+ *,
144
+ client: AuthenticatedClient,
145
+ ) -> HTTPValidationError | InstanceStatusResponse | None:
146
+ """Get Instance Status
147
+
148
+ Get the status of a specific instance by its ID
149
+
150
+ Args:
151
+ instance_id (str):
152
+
153
+ Raises:
154
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
155
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
156
+
157
+ Returns:
158
+ HTTPValidationError | InstanceStatusResponse
159
+ """
160
+ return (
161
+ await asyncio_detailed(
162
+ instance_id=instance_id,
163
+ client=client,
164
+ )
165
+ ).parsed