archil-openapi 0.0.1__py3-none-any.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.
- archil_openapi/__init__.py +8 -0
- archil_openapi/api/__init__.py +1 -0
- archil_openapi/api/activity/__init__.py +1 -0
- archil_openapi/api/activity/list_activity.py +268 -0
- archil_openapi/api/api_tokens/__init__.py +1 -0
- archil_openapi/api/api_tokens/create_api_token.py +188 -0
- archil_openapi/api/api_tokens/delete_api_token.py +177 -0
- archil_openapi/api/api_tokens/list_api_tokens.py +193 -0
- archil_openapi/api/disk_configuration/__init__.py +1 -0
- archil_openapi/api/disk_configuration/get_allowed_i_ps.py +177 -0
- archil_openapi/api/disk_configuration/list_delegations.py +189 -0
- archil_openapi/api/disk_configuration/revoke_delegation.py +208 -0
- archil_openapi/api/disk_configuration/set_allowed_i_ps.py +208 -0
- archil_openapi/api/disk_users/__init__.py +1 -0
- archil_openapi/api/disk_users/add_disk_user.py +212 -0
- archil_openapi/api/disk_users/remove_disk_user.py +228 -0
- archil_openapi/api/disks/__init__.py +1 -0
- archil_openapi/api/disks/create_disk.py +228 -0
- archil_openapi/api/disks/delete_disk.py +182 -0
- archil_openapi/api/disks/exec_.py +222 -0
- archil_openapi/api/disks/exec_disk.py +217 -0
- archil_openapi/api/disks/get_disk.py +182 -0
- archil_openapi/api/disks/grep_disk.py +292 -0
- archil_openapi/api/disks/list_disks.py +208 -0
- archil_openapi/api/sandboxes/__init__.py +1 -0
- archil_openapi/api/sandboxes/cancel_sandbox_exec.py +196 -0
- archil_openapi/api/sandboxes/create_sandbox.py +225 -0
- archil_openapi/api/sandboxes/exec_in_sandbox.py +251 -0
- archil_openapi/api/sandboxes/get_sandbox.py +170 -0
- archil_openapi/api/sandboxes/get_sandbox_exec.py +184 -0
- archil_openapi/api/sandboxes/list_sandbox_execs.py +178 -0
- archil_openapi/api/sandboxes/list_sandboxes.py +183 -0
- archil_openapi/api/sandboxes/pause_sandbox.py +214 -0
- archil_openapi/api/sandboxes/resume_sandbox.py +231 -0
- archil_openapi/api/sandboxes/start_sandbox.py +235 -0
- archil_openapi/api/sandboxes/stop_sandbox.py +210 -0
- archil_openapi/client.py +268 -0
- archil_openapi/errors.py +16 -0
- archil_openapi/models/__init__.py +181 -0
- archil_openapi/models/activity_event.py +119 -0
- archil_openapi/models/activity_event_details.py +47 -0
- archil_openapi/models/activity_event_level.py +10 -0
- archil_openapi/models/api_response_activity_list.py +93 -0
- archil_openapi/models/api_response_allowed_i_ps.py +73 -0
- archil_openapi/models/api_response_allowed_i_ps_data.py +59 -0
- archil_openapi/models/api_response_authorized_user.py +73 -0
- archil_openapi/models/api_response_create_disk.py +73 -0
- archil_openapi/models/api_response_create_disk_data.py +84 -0
- archil_openapi/models/api_response_delegations.py +73 -0
- archil_openapi/models/api_response_delegations_data.py +73 -0
- archil_openapi/models/api_response_disk.py +73 -0
- archil_openapi/models/api_response_disk_list.py +95 -0
- archil_openapi/models/api_response_empty.py +59 -0
- archil_openapi/models/api_response_exec.py +73 -0
- archil_openapi/models/api_response_exec_disk.py +73 -0
- archil_openapi/models/api_response_grep_disk.py +73 -0
- archil_openapi/models/api_response_message.py +73 -0
- archil_openapi/models/api_response_message_data.py +59 -0
- archil_openapi/models/api_response_sandbox.py +73 -0
- archil_openapi/models/api_response_sandbox_exec.py +73 -0
- archil_openapi/models/api_response_sandbox_exec_list.py +73 -0
- archil_openapi/models/api_response_sandbox_exec_list_data.py +75 -0
- archil_openapi/models/api_response_sandbox_list.py +73 -0
- archil_openapi/models/api_response_sandbox_list_data.py +75 -0
- archil_openapi/models/api_response_token_created.py +73 -0
- archil_openapi/models/api_response_token_created_data.py +129 -0
- archil_openapi/models/api_response_token_list.py +73 -0
- archil_openapi/models/api_response_token_list_data.py +75 -0
- archil_openapi/models/api_token_response.py +120 -0
- archil_openapi/models/authorized_user.py +201 -0
- archil_openapi/models/authorized_user_status.py +10 -0
- archil_openapi/models/authorized_user_type.py +9 -0
- archil_openapi/models/aws_sts_user.py +118 -0
- archil_openapi/models/aws_sts_user_type.py +8 -0
- archil_openapi/models/azure_blob_storage.py +124 -0
- archil_openapi/models/azure_blob_storage_type.py +8 -0
- archil_openapi/models/cloudflare_r2.py +113 -0
- archil_openapi/models/cloudflare_r2_type.py +8 -0
- archil_openapi/models/connected_client.py +86 -0
- archil_openapi/models/create_api_token_request.py +70 -0
- archil_openapi/models/create_disk_request.py +214 -0
- archil_openapi/models/create_sandbox_request.py +139 -0
- archil_openapi/models/create_sandbox_request_env.py +44 -0
- archil_openapi/models/delegation_entry.py +96 -0
- archil_openapi/models/disk_metrics.py +77 -0
- archil_openapi/models/disk_response.py +287 -0
- archil_openapi/models/disk_response_capabilities_item.py +8 -0
- archil_openapi/models/disk_response_status.py +12 -0
- archil_openapi/models/error_response.py +78 -0
- archil_openapi/models/exec_disk_request.py +59 -0
- archil_openapi/models/exec_disk_result.py +89 -0
- archil_openapi/models/exec_mount.py +124 -0
- archil_openapi/models/exec_request.py +87 -0
- archil_openapi/models/exec_request_disks.py +92 -0
- archil_openapi/models/exec_timing.py +80 -0
- archil_openapi/models/google_cloud_storage.py +105 -0
- archil_openapi/models/google_cloud_storage_type.py +8 -0
- archil_openapi/models/grep_disk_request.py +118 -0
- archil_openapi/models/grep_disk_result.py +145 -0
- archil_openapi/models/grep_match.py +75 -0
- archil_openapi/models/grep_stopped_reason.py +12 -0
- archil_openapi/models/list_activity_level_item.py +10 -0
- archil_openapi/models/mount_config_response.py +96 -0
- archil_openapi/models/mount_response.py +177 -0
- archil_openapi/models/mount_response_access_mode.py +9 -0
- archil_openapi/models/mount_response_authorization_type.py +10 -0
- archil_openapi/models/mount_response_connection_status.py +9 -0
- archil_openapi/models/mount_response_type.py +12 -0
- archil_openapi/models/remove_disk_user_user_type.py +9 -0
- archil_openapi/models/revoke_delegation_request.py +67 -0
- archil_openapi/models/s3.py +116 -0
- archil_openapi/models/s3_compatible.py +113 -0
- archil_openapi/models/s3_compatible_type.py +8 -0
- archil_openapi/models/s3_type.py +8 -0
- archil_openapi/models/sandbox.py +228 -0
- archil_openapi/models/sandbox_endpoint.py +67 -0
- archil_openapi/models/sandbox_exec.py +158 -0
- archil_openapi/models/sandbox_exec_request.py +101 -0
- archil_openapi/models/sandbox_exec_request_env.py +44 -0
- archil_openapi/models/sandbox_exec_state.py +12 -0
- archil_openapi/models/sandbox_platform.py +9 -0
- archil_openapi/models/sandbox_port_mapping.py +69 -0
- archil_openapi/models/sandbox_port_mapping_protocol.py +9 -0
- archil_openapi/models/sandbox_state.py +15 -0
- archil_openapi/models/set_allowed_i_ps_body.py +60 -0
- archil_openapi/models/token_user.py +141 -0
- archil_openapi/models/token_user_type.py +8 -0
- archil_openapi/py.typed +0 -0
- archil_openapi/types.py +54 -0
- archil_openapi-0.0.1.dist-info/METADATA +80 -0
- archil_openapi-0.0.1.dist-info/RECORD +132 -0
- archil_openapi-0.0.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.api_response_activity_list import ApiResponseActivityList
|
|
9
|
+
from ...models.error_response import ErrorResponse
|
|
10
|
+
from ...models.list_activity_level_item import ListActivityLevelItem
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
limit: Union[Unset, int] = UNSET,
|
|
17
|
+
cursor: Union[Unset, str] = UNSET,
|
|
18
|
+
disk_id: Union[Unset, str] = UNSET,
|
|
19
|
+
event_type: Union[Unset, list[str]] = UNSET,
|
|
20
|
+
level: Union[Unset, list[ListActivityLevelItem]] = UNSET,
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
params: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
params["limit"] = limit
|
|
25
|
+
|
|
26
|
+
params["cursor"] = cursor
|
|
27
|
+
|
|
28
|
+
params["diskId"] = disk_id
|
|
29
|
+
|
|
30
|
+
json_event_type: Union[Unset, list[str]] = UNSET
|
|
31
|
+
if not isinstance(event_type, Unset):
|
|
32
|
+
json_event_type = event_type
|
|
33
|
+
|
|
34
|
+
params["eventType"] = json_event_type
|
|
35
|
+
|
|
36
|
+
json_level: Union[Unset, list[str]] = UNSET
|
|
37
|
+
if not isinstance(level, Unset):
|
|
38
|
+
json_level = []
|
|
39
|
+
for level_item_data in level:
|
|
40
|
+
level_item = level_item_data.value
|
|
41
|
+
json_level.append(level_item)
|
|
42
|
+
|
|
43
|
+
params["level"] = json_level
|
|
44
|
+
|
|
45
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
46
|
+
|
|
47
|
+
_kwargs: dict[str, Any] = {
|
|
48
|
+
"method": "get",
|
|
49
|
+
"url": "/api/activity",
|
|
50
|
+
"params": params,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return _kwargs
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _parse_response(
|
|
57
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
58
|
+
) -> Optional[Union[ApiResponseActivityList, ErrorResponse]]:
|
|
59
|
+
if response.status_code == 200:
|
|
60
|
+
response_200 = ApiResponseActivityList.from_dict(response.json())
|
|
61
|
+
|
|
62
|
+
return response_200
|
|
63
|
+
|
|
64
|
+
if response.status_code == 400:
|
|
65
|
+
response_400 = ErrorResponse.from_dict(response.json())
|
|
66
|
+
|
|
67
|
+
return response_400
|
|
68
|
+
|
|
69
|
+
if response.status_code == 401:
|
|
70
|
+
response_401 = ErrorResponse.from_dict(response.json())
|
|
71
|
+
|
|
72
|
+
return response_401
|
|
73
|
+
|
|
74
|
+
if response.status_code == 404:
|
|
75
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
|
76
|
+
|
|
77
|
+
return response_404
|
|
78
|
+
|
|
79
|
+
if response.status_code == 500:
|
|
80
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
|
81
|
+
|
|
82
|
+
return response_500
|
|
83
|
+
|
|
84
|
+
if client.raise_on_unexpected_status:
|
|
85
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
86
|
+
else:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _build_response(
|
|
91
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
92
|
+
) -> Response[Union[ApiResponseActivityList, ErrorResponse]]:
|
|
93
|
+
return Response(
|
|
94
|
+
status_code=HTTPStatus(response.status_code),
|
|
95
|
+
content=response.content,
|
|
96
|
+
headers=response.headers,
|
|
97
|
+
parsed=_parse_response(client=client, response=response),
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def sync_detailed(
|
|
102
|
+
*,
|
|
103
|
+
client: Union[AuthenticatedClient, Client],
|
|
104
|
+
limit: Union[Unset, int] = UNSET,
|
|
105
|
+
cursor: Union[Unset, str] = UNSET,
|
|
106
|
+
disk_id: Union[Unset, str] = UNSET,
|
|
107
|
+
event_type: Union[Unset, list[str]] = UNSET,
|
|
108
|
+
level: Union[Unset, list[ListActivityLevelItem]] = UNSET,
|
|
109
|
+
) -> Response[Union[ApiResponseActivityList, ErrorResponse]]:
|
|
110
|
+
"""List activity events
|
|
111
|
+
|
|
112
|
+
Returns the authenticated account's activity events (disk lifecycle and exec events), newest first.
|
|
113
|
+
Omitting `limit` returns up to 50 events; pass the response's `nextCursor` back as `cursor` to fetch
|
|
114
|
+
the next page.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
limit (Union[Unset, int]):
|
|
118
|
+
cursor (Union[Unset, str]):
|
|
119
|
+
disk_id (Union[Unset, str]): Example: dsk-0123456789abcdef.
|
|
120
|
+
event_type (Union[Unset, list[str]]):
|
|
121
|
+
level (Union[Unset, list[ListActivityLevelItem]]):
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
125
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
Response[Union[ApiResponseActivityList, ErrorResponse]]
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
kwargs = _get_kwargs(
|
|
132
|
+
limit=limit,
|
|
133
|
+
cursor=cursor,
|
|
134
|
+
disk_id=disk_id,
|
|
135
|
+
event_type=event_type,
|
|
136
|
+
level=level,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
response = client.get_httpx_client().request(
|
|
140
|
+
**kwargs,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
return _build_response(client=client, response=response)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def sync(
|
|
147
|
+
*,
|
|
148
|
+
client: Union[AuthenticatedClient, Client],
|
|
149
|
+
limit: Union[Unset, int] = UNSET,
|
|
150
|
+
cursor: Union[Unset, str] = UNSET,
|
|
151
|
+
disk_id: Union[Unset, str] = UNSET,
|
|
152
|
+
event_type: Union[Unset, list[str]] = UNSET,
|
|
153
|
+
level: Union[Unset, list[ListActivityLevelItem]] = UNSET,
|
|
154
|
+
) -> Optional[Union[ApiResponseActivityList, ErrorResponse]]:
|
|
155
|
+
"""List activity events
|
|
156
|
+
|
|
157
|
+
Returns the authenticated account's activity events (disk lifecycle and exec events), newest first.
|
|
158
|
+
Omitting `limit` returns up to 50 events; pass the response's `nextCursor` back as `cursor` to fetch
|
|
159
|
+
the next page.
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
limit (Union[Unset, int]):
|
|
163
|
+
cursor (Union[Unset, str]):
|
|
164
|
+
disk_id (Union[Unset, str]): Example: dsk-0123456789abcdef.
|
|
165
|
+
event_type (Union[Unset, list[str]]):
|
|
166
|
+
level (Union[Unset, list[ListActivityLevelItem]]):
|
|
167
|
+
|
|
168
|
+
Raises:
|
|
169
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
170
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
Union[ApiResponseActivityList, ErrorResponse]
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
return sync_detailed(
|
|
177
|
+
client=client,
|
|
178
|
+
limit=limit,
|
|
179
|
+
cursor=cursor,
|
|
180
|
+
disk_id=disk_id,
|
|
181
|
+
event_type=event_type,
|
|
182
|
+
level=level,
|
|
183
|
+
).parsed
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
async def asyncio_detailed(
|
|
187
|
+
*,
|
|
188
|
+
client: Union[AuthenticatedClient, Client],
|
|
189
|
+
limit: Union[Unset, int] = UNSET,
|
|
190
|
+
cursor: Union[Unset, str] = UNSET,
|
|
191
|
+
disk_id: Union[Unset, str] = UNSET,
|
|
192
|
+
event_type: Union[Unset, list[str]] = UNSET,
|
|
193
|
+
level: Union[Unset, list[ListActivityLevelItem]] = UNSET,
|
|
194
|
+
) -> Response[Union[ApiResponseActivityList, ErrorResponse]]:
|
|
195
|
+
"""List activity events
|
|
196
|
+
|
|
197
|
+
Returns the authenticated account's activity events (disk lifecycle and exec events), newest first.
|
|
198
|
+
Omitting `limit` returns up to 50 events; pass the response's `nextCursor` back as `cursor` to fetch
|
|
199
|
+
the next page.
|
|
200
|
+
|
|
201
|
+
Args:
|
|
202
|
+
limit (Union[Unset, int]):
|
|
203
|
+
cursor (Union[Unset, str]):
|
|
204
|
+
disk_id (Union[Unset, str]): Example: dsk-0123456789abcdef.
|
|
205
|
+
event_type (Union[Unset, list[str]]):
|
|
206
|
+
level (Union[Unset, list[ListActivityLevelItem]]):
|
|
207
|
+
|
|
208
|
+
Raises:
|
|
209
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
210
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
Response[Union[ApiResponseActivityList, ErrorResponse]]
|
|
214
|
+
"""
|
|
215
|
+
|
|
216
|
+
kwargs = _get_kwargs(
|
|
217
|
+
limit=limit,
|
|
218
|
+
cursor=cursor,
|
|
219
|
+
disk_id=disk_id,
|
|
220
|
+
event_type=event_type,
|
|
221
|
+
level=level,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
225
|
+
|
|
226
|
+
return _build_response(client=client, response=response)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
async def asyncio(
|
|
230
|
+
*,
|
|
231
|
+
client: Union[AuthenticatedClient, Client],
|
|
232
|
+
limit: Union[Unset, int] = UNSET,
|
|
233
|
+
cursor: Union[Unset, str] = UNSET,
|
|
234
|
+
disk_id: Union[Unset, str] = UNSET,
|
|
235
|
+
event_type: Union[Unset, list[str]] = UNSET,
|
|
236
|
+
level: Union[Unset, list[ListActivityLevelItem]] = UNSET,
|
|
237
|
+
) -> Optional[Union[ApiResponseActivityList, ErrorResponse]]:
|
|
238
|
+
"""List activity events
|
|
239
|
+
|
|
240
|
+
Returns the authenticated account's activity events (disk lifecycle and exec events), newest first.
|
|
241
|
+
Omitting `limit` returns up to 50 events; pass the response's `nextCursor` back as `cursor` to fetch
|
|
242
|
+
the next page.
|
|
243
|
+
|
|
244
|
+
Args:
|
|
245
|
+
limit (Union[Unset, int]):
|
|
246
|
+
cursor (Union[Unset, str]):
|
|
247
|
+
disk_id (Union[Unset, str]): Example: dsk-0123456789abcdef.
|
|
248
|
+
event_type (Union[Unset, list[str]]):
|
|
249
|
+
level (Union[Unset, list[ListActivityLevelItem]]):
|
|
250
|
+
|
|
251
|
+
Raises:
|
|
252
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
253
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
254
|
+
|
|
255
|
+
Returns:
|
|
256
|
+
Union[ApiResponseActivityList, ErrorResponse]
|
|
257
|
+
"""
|
|
258
|
+
|
|
259
|
+
return (
|
|
260
|
+
await asyncio_detailed(
|
|
261
|
+
client=client,
|
|
262
|
+
limit=limit,
|
|
263
|
+
cursor=cursor,
|
|
264
|
+
disk_id=disk_id,
|
|
265
|
+
event_type=event_type,
|
|
266
|
+
level=level,
|
|
267
|
+
)
|
|
268
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.api_response_token_created import ApiResponseTokenCreated
|
|
9
|
+
from ...models.create_api_token_request import CreateApiTokenRequest
|
|
10
|
+
from ...models.error_response import ErrorResponse
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: CreateApiTokenRequest,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/api/tokens",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_kwargs["json"] = body.to_dict()
|
|
26
|
+
|
|
27
|
+
headers["Content-Type"] = "application/json"
|
|
28
|
+
|
|
29
|
+
_kwargs["headers"] = headers
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(
|
|
34
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
35
|
+
) -> Optional[Union[ApiResponseTokenCreated, ErrorResponse]]:
|
|
36
|
+
if response.status_code == 201:
|
|
37
|
+
response_201 = ApiResponseTokenCreated.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
return response_201
|
|
40
|
+
|
|
41
|
+
if response.status_code == 400:
|
|
42
|
+
response_400 = ErrorResponse.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_400
|
|
45
|
+
|
|
46
|
+
if response.status_code == 401:
|
|
47
|
+
response_401 = ErrorResponse.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_401
|
|
50
|
+
|
|
51
|
+
if response.status_code == 500:
|
|
52
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_500
|
|
55
|
+
|
|
56
|
+
if client.raise_on_unexpected_status:
|
|
57
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
58
|
+
else:
|
|
59
|
+
return None
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _build_response(
|
|
63
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
64
|
+
) -> Response[Union[ApiResponseTokenCreated, ErrorResponse]]:
|
|
65
|
+
return Response(
|
|
66
|
+
status_code=HTTPStatus(response.status_code),
|
|
67
|
+
content=response.content,
|
|
68
|
+
headers=response.headers,
|
|
69
|
+
parsed=_parse_response(client=client, response=response),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def sync_detailed(
|
|
74
|
+
*,
|
|
75
|
+
client: AuthenticatedClient,
|
|
76
|
+
body: CreateApiTokenRequest,
|
|
77
|
+
) -> Response[Union[ApiResponseTokenCreated, ErrorResponse]]:
|
|
78
|
+
"""Create API token
|
|
79
|
+
|
|
80
|
+
Creates a new API token for programmatic access. The full token value
|
|
81
|
+
is only returned once at creation time.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
body (CreateApiTokenRequest):
|
|
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
|
+
Response[Union[ApiResponseTokenCreated, ErrorResponse]]
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
kwargs = _get_kwargs(
|
|
95
|
+
body=body,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
response = client.get_httpx_client().request(
|
|
99
|
+
**kwargs,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
return _build_response(client=client, response=response)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def sync(
|
|
106
|
+
*,
|
|
107
|
+
client: AuthenticatedClient,
|
|
108
|
+
body: CreateApiTokenRequest,
|
|
109
|
+
) -> Optional[Union[ApiResponseTokenCreated, ErrorResponse]]:
|
|
110
|
+
"""Create API token
|
|
111
|
+
|
|
112
|
+
Creates a new API token for programmatic access. The full token value
|
|
113
|
+
is only returned once at creation time.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
body (CreateApiTokenRequest):
|
|
117
|
+
|
|
118
|
+
Raises:
|
|
119
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
120
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
Union[ApiResponseTokenCreated, ErrorResponse]
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
return sync_detailed(
|
|
127
|
+
client=client,
|
|
128
|
+
body=body,
|
|
129
|
+
).parsed
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
async def asyncio_detailed(
|
|
133
|
+
*,
|
|
134
|
+
client: AuthenticatedClient,
|
|
135
|
+
body: CreateApiTokenRequest,
|
|
136
|
+
) -> Response[Union[ApiResponseTokenCreated, ErrorResponse]]:
|
|
137
|
+
"""Create API token
|
|
138
|
+
|
|
139
|
+
Creates a new API token for programmatic access. The full token value
|
|
140
|
+
is only returned once at creation time.
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
body (CreateApiTokenRequest):
|
|
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
|
+
Response[Union[ApiResponseTokenCreated, ErrorResponse]]
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
kwargs = _get_kwargs(
|
|
154
|
+
body=body,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
158
|
+
|
|
159
|
+
return _build_response(client=client, response=response)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
async def asyncio(
|
|
163
|
+
*,
|
|
164
|
+
client: AuthenticatedClient,
|
|
165
|
+
body: CreateApiTokenRequest,
|
|
166
|
+
) -> Optional[Union[ApiResponseTokenCreated, ErrorResponse]]:
|
|
167
|
+
"""Create API token
|
|
168
|
+
|
|
169
|
+
Creates a new API token for programmatic access. The full token value
|
|
170
|
+
is only returned once at creation time.
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
body (CreateApiTokenRequest):
|
|
174
|
+
|
|
175
|
+
Raises:
|
|
176
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
177
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
Union[ApiResponseTokenCreated, ErrorResponse]
|
|
181
|
+
"""
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
await asyncio_detailed(
|
|
185
|
+
client=client,
|
|
186
|
+
body=body,
|
|
187
|
+
)
|
|
188
|
+
).parsed
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.api_response_message import ApiResponseMessage
|
|
9
|
+
from ...models.error_response import ErrorResponse
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
id: str,
|
|
15
|
+
) -> dict[str, Any]:
|
|
16
|
+
_kwargs: dict[str, Any] = {
|
|
17
|
+
"method": "delete",
|
|
18
|
+
"url": "/api/tokens/{id}".format(
|
|
19
|
+
id=id,
|
|
20
|
+
),
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return _kwargs
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _parse_response(
|
|
27
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
28
|
+
) -> Optional[Union[ApiResponseMessage, ErrorResponse]]:
|
|
29
|
+
if response.status_code == 200:
|
|
30
|
+
response_200 = ApiResponseMessage.from_dict(response.json())
|
|
31
|
+
|
|
32
|
+
return response_200
|
|
33
|
+
|
|
34
|
+
if response.status_code == 401:
|
|
35
|
+
response_401 = ErrorResponse.from_dict(response.json())
|
|
36
|
+
|
|
37
|
+
return response_401
|
|
38
|
+
|
|
39
|
+
if response.status_code == 404:
|
|
40
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_404
|
|
43
|
+
|
|
44
|
+
if response.status_code == 500:
|
|
45
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_500
|
|
48
|
+
|
|
49
|
+
if client.raise_on_unexpected_status:
|
|
50
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
51
|
+
else:
|
|
52
|
+
return None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _build_response(
|
|
56
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
57
|
+
) -> Response[Union[ApiResponseMessage, ErrorResponse]]:
|
|
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
|
+
id: str,
|
|
68
|
+
*,
|
|
69
|
+
client: AuthenticatedClient,
|
|
70
|
+
) -> Response[Union[ApiResponseMessage, ErrorResponse]]:
|
|
71
|
+
"""Delete API token
|
|
72
|
+
|
|
73
|
+
Revokes and deletes an API token.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
id (str):
|
|
77
|
+
|
|
78
|
+
Raises:
|
|
79
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
80
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
Response[Union[ApiResponseMessage, ErrorResponse]]
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
kwargs = _get_kwargs(
|
|
87
|
+
id=id,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
response = client.get_httpx_client().request(
|
|
91
|
+
**kwargs,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return _build_response(client=client, response=response)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def sync(
|
|
98
|
+
id: str,
|
|
99
|
+
*,
|
|
100
|
+
client: AuthenticatedClient,
|
|
101
|
+
) -> Optional[Union[ApiResponseMessage, ErrorResponse]]:
|
|
102
|
+
"""Delete API token
|
|
103
|
+
|
|
104
|
+
Revokes and deletes an API token.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
id (str):
|
|
108
|
+
|
|
109
|
+
Raises:
|
|
110
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
111
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
112
|
+
|
|
113
|
+
Returns:
|
|
114
|
+
Union[ApiResponseMessage, ErrorResponse]
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
return sync_detailed(
|
|
118
|
+
id=id,
|
|
119
|
+
client=client,
|
|
120
|
+
).parsed
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
async def asyncio_detailed(
|
|
124
|
+
id: str,
|
|
125
|
+
*,
|
|
126
|
+
client: AuthenticatedClient,
|
|
127
|
+
) -> Response[Union[ApiResponseMessage, ErrorResponse]]:
|
|
128
|
+
"""Delete API token
|
|
129
|
+
|
|
130
|
+
Revokes and deletes an API token.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
id (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[Union[ApiResponseMessage, ErrorResponse]]
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
kwargs = _get_kwargs(
|
|
144
|
+
id=id,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
148
|
+
|
|
149
|
+
return _build_response(client=client, response=response)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
async def asyncio(
|
|
153
|
+
id: str,
|
|
154
|
+
*,
|
|
155
|
+
client: AuthenticatedClient,
|
|
156
|
+
) -> Optional[Union[ApiResponseMessage, ErrorResponse]]:
|
|
157
|
+
"""Delete API token
|
|
158
|
+
|
|
159
|
+
Revokes and deletes an API token.
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
id (str):
|
|
163
|
+
|
|
164
|
+
Raises:
|
|
165
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
166
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
Union[ApiResponseMessage, ErrorResponse]
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
await asyncio_detailed(
|
|
174
|
+
id=id,
|
|
175
|
+
client=client,
|
|
176
|
+
)
|
|
177
|
+
).parsed
|