busbar-admin 0.1.0__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.
- busbar_admin/__init__.py +8 -0
- busbar_admin/api/__init__.py +1 -0
- busbar_admin/api/default/__init__.py +1 -0
- busbar_admin/api/default/delete_api_v1_admin_hooks_name.py +193 -0
- busbar_admin/api/default/delete_api_v1_admin_keys_id.py +198 -0
- busbar_admin/api/default/get_api_v1_admin_admin_auth.py +137 -0
- busbar_admin/api/default/get_api_v1_admin_audit.py +218 -0
- busbar_admin/api/default/get_api_v1_admin_auth.py +135 -0
- busbar_admin/api/default/get_api_v1_admin_config.py +139 -0
- busbar_admin/api/default/get_api_v1_admin_config_diff.py +194 -0
- busbar_admin/api/default/get_api_v1_admin_config_versions.py +190 -0
- busbar_admin/api/default/get_api_v1_admin_config_versions_v.py +171 -0
- busbar_admin/api/default/get_api_v1_admin_hooks.py +137 -0
- busbar_admin/api/default/get_api_v1_admin_hooks_name.py +167 -0
- busbar_admin/api/default/get_api_v1_admin_hooks_name_health.py +169 -0
- busbar_admin/api/default/get_api_v1_admin_hooks_name_schema.py +169 -0
- busbar_admin/api/default/get_api_v1_admin_hooks_name_status.py +173 -0
- busbar_admin/api/default/get_api_v1_admin_info.py +135 -0
- busbar_admin/api/default/get_api_v1_admin_keys.py +221 -0
- busbar_admin/api/default/get_api_v1_admin_keys_id.py +167 -0
- busbar_admin/api/default/get_api_v1_admin_keys_id_usage.py +171 -0
- busbar_admin/api/default/get_api_v1_admin_models.py +137 -0
- busbar_admin/api/default/get_api_v1_admin_openapi_json.py +139 -0
- busbar_admin/api/default/get_api_v1_admin_plugins.py +169 -0
- busbar_admin/api/default/get_api_v1_admin_pools.py +169 -0
- busbar_admin/api/default/get_api_v1_admin_pools_name.py +169 -0
- busbar_admin/api/default/get_api_v1_admin_providers.py +139 -0
- busbar_admin/api/default/get_api_v1_admin_usage.py +171 -0
- busbar_admin/api/default/patch_api_v1_admin_hooks_name_settings.py +200 -0
- busbar_admin/api/default/patch_api_v1_admin_keys_id.py +200 -0
- busbar_admin/api/default/post_api_v1_admin_auth_cache_flush.py +151 -0
- busbar_admin/api/default/post_api_v1_admin_config_apply.py +187 -0
- busbar_admin/api/default/post_api_v1_admin_config_reload.py +153 -0
- busbar_admin/api/default/post_api_v1_admin_config_rollback.py +188 -0
- busbar_admin/api/default/post_api_v1_admin_config_validate.py +149 -0
- busbar_admin/api/default/post_api_v1_admin_hooks.py +184 -0
- busbar_admin/api/default/post_api_v1_admin_keys.py +156 -0
- busbar_admin/api/default/post_api_v1_admin_keys_id_rotate.py +183 -0
- busbar_admin/api/default/put_api_v1_admin_admin_auth.py +187 -0
- busbar_admin/api/default/put_api_v1_admin_hooks_name.py +200 -0
- busbar_admin/client.py +268 -0
- busbar_admin/errors.py +16 -0
- busbar_admin/models/__init__.py +119 -0
- busbar_admin/models/admin_auth_put_view.py +95 -0
- busbar_admin/models/admin_auth_view.py +75 -0
- busbar_admin/models/audit_entry.py +127 -0
- busbar_admin/models/audit_page_view.py +91 -0
- busbar_admin/models/auth_view.py +82 -0
- busbar_admin/models/build_info.py +79 -0
- busbar_admin/models/cache_flush_view.py +62 -0
- busbar_admin/models/config_apply_view.py +78 -0
- busbar_admin/models/config_diff_global_hooks.py +70 -0
- busbar_admin/models/config_diff_hooks.py +79 -0
- busbar_admin/models/config_diff_view.py +123 -0
- busbar_admin/models/config_reload_view.py +70 -0
- busbar_admin/models/config_rollback_view.py +71 -0
- busbar_admin/models/config_validate_view.py +75 -0
- busbar_admin/models/config_version.py +88 -0
- busbar_admin/models/config_version_detail_view.py +109 -0
- busbar_admin/models/config_version_detail_view_hooks.py +60 -0
- busbar_admin/models/config_version_page_view.py +90 -0
- busbar_admin/models/created_key_view.py +198 -0
- busbar_admin/models/effective_config_view.py +165 -0
- busbar_admin/models/error.py +67 -0
- busbar_admin/models/error_error.py +71 -0
- busbar_admin/models/error_error_code.py +16 -0
- busbar_admin/models/get_api_v1_admin_openapi_json_response_200.py +47 -0
- busbar_admin/models/hook_desired_status.py +77 -0
- busbar_admin/models/hook_desired_status_settings.py +47 -0
- busbar_admin/models/hook_health_view.py +112 -0
- busbar_admin/models/hook_reported_status.py +103 -0
- busbar_admin/models/hook_reported_status_settings_type_0.py +47 -0
- busbar_admin/models/hook_schema_view.py +71 -0
- busbar_admin/models/hook_status_view.py +172 -0
- busbar_admin/models/hook_transport_view.py +77 -0
- busbar_admin/models/hook_view.py +168 -0
- busbar_admin/models/hook_view_settings.py +50 -0
- busbar_admin/models/info_view.py +140 -0
- busbar_admin/models/key_metering_view.py +138 -0
- busbar_admin/models/key_page_view.py +91 -0
- busbar_admin/models/key_usage_view.py +127 -0
- busbar_admin/models/key_view.py +145 -0
- busbar_admin/models/model_usage_view.py +120 -0
- busbar_admin/models/model_view.py +71 -0
- busbar_admin/models/page_hook_view.py +91 -0
- busbar_admin/models/page_model_view.py +91 -0
- busbar_admin/models/page_plugin_view.py +91 -0
- busbar_admin/models/page_pool_view.py +91 -0
- busbar_admin/models/page_provider_view.py +91 -0
- busbar_admin/models/plugin_view.py +114 -0
- busbar_admin/models/pool_detail_view.py +87 -0
- busbar_admin/models/pool_member_status_view.py +171 -0
- busbar_admin/models/pool_member_view.py +70 -0
- busbar_admin/models/pool_view.py +87 -0
- busbar_admin/models/provider_view.py +71 -0
- busbar_admin/models/rotated_key_view.py +152 -0
- busbar_admin/models/topology_info.py +78 -0
- busbar_admin/models/usage_breakdown.py +105 -0
- busbar_admin/models/usage_view.py +201 -0
- busbar_admin/models/usage_window.py +70 -0
- busbar_admin/py.typed +1 -0
- busbar_admin/types.py +54 -0
- busbar_admin-0.1.0.dist-info/METADATA +89 -0
- busbar_admin-0.1.0.dist-info/RECORD +107 -0
- busbar_admin-0.1.0.dist-info/WHEEL +5 -0
- busbar_admin-0.1.0.dist-info/licenses/LICENSE +201 -0
- busbar_admin-0.1.0.dist-info/top_level.txt +1 -0
busbar_admin/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.error import Error
|
|
10
|
+
from ...types import UNSET, Response, Unset
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
name: str,
|
|
15
|
+
*,
|
|
16
|
+
if_match: str | Unset = UNSET,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
if not isinstance(if_match, Unset):
|
|
20
|
+
headers["If-Match"] = if_match
|
|
21
|
+
|
|
22
|
+
_kwargs: dict[str, Any] = {
|
|
23
|
+
"method": "delete",
|
|
24
|
+
"url": "/api/v1/admin/hooks/{name}".format(
|
|
25
|
+
name=quote(str(name), safe=""),
|
|
26
|
+
),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_kwargs["headers"] = headers
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | Error | None:
|
|
34
|
+
if response.status_code == 204:
|
|
35
|
+
response_204 = cast(Any, None)
|
|
36
|
+
return response_204
|
|
37
|
+
|
|
38
|
+
if response.status_code == 401:
|
|
39
|
+
response_401 = Error.from_dict(response.json())
|
|
40
|
+
|
|
41
|
+
return response_401
|
|
42
|
+
|
|
43
|
+
if response.status_code == 403:
|
|
44
|
+
response_403 = Error.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_403
|
|
47
|
+
|
|
48
|
+
if response.status_code == 404:
|
|
49
|
+
response_404 = Error.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_404
|
|
52
|
+
|
|
53
|
+
if response.status_code == 409:
|
|
54
|
+
response_409 = Error.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_409
|
|
57
|
+
|
|
58
|
+
if response.status_code == 429:
|
|
59
|
+
response_429 = Error.from_dict(response.json())
|
|
60
|
+
|
|
61
|
+
return response_429
|
|
62
|
+
|
|
63
|
+
if client.raise_on_unexpected_status:
|
|
64
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
65
|
+
else:
|
|
66
|
+
return None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | Error]:
|
|
70
|
+
return Response(
|
|
71
|
+
status_code=HTTPStatus(response.status_code),
|
|
72
|
+
content=response.content,
|
|
73
|
+
headers=response.headers,
|
|
74
|
+
parsed=_parse_response(client=client, response=response),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def sync_detailed(
|
|
79
|
+
name: str,
|
|
80
|
+
*,
|
|
81
|
+
client: AuthenticatedClient,
|
|
82
|
+
if_match: str | Unset = UNSET,
|
|
83
|
+
) -> Response[Any | Error]:
|
|
84
|
+
"""Remove a hook at runtime — live immediately
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
name (str):
|
|
88
|
+
if_match (str | Unset):
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
92
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
Response[Any | Error]
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
kwargs = _get_kwargs(
|
|
99
|
+
name=name,
|
|
100
|
+
if_match=if_match,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
response = client.get_httpx_client().request(
|
|
104
|
+
**kwargs,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
return _build_response(client=client, response=response)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def sync(
|
|
111
|
+
name: str,
|
|
112
|
+
*,
|
|
113
|
+
client: AuthenticatedClient,
|
|
114
|
+
if_match: str | Unset = UNSET,
|
|
115
|
+
) -> Any | Error | None:
|
|
116
|
+
"""Remove a hook at runtime — live immediately
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
name (str):
|
|
120
|
+
if_match (str | Unset):
|
|
121
|
+
|
|
122
|
+
Raises:
|
|
123
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
124
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
Any | Error
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
return sync_detailed(
|
|
131
|
+
name=name,
|
|
132
|
+
client=client,
|
|
133
|
+
if_match=if_match,
|
|
134
|
+
).parsed
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
async def asyncio_detailed(
|
|
138
|
+
name: str,
|
|
139
|
+
*,
|
|
140
|
+
client: AuthenticatedClient,
|
|
141
|
+
if_match: str | Unset = UNSET,
|
|
142
|
+
) -> Response[Any | Error]:
|
|
143
|
+
"""Remove a hook at runtime — live immediately
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
name (str):
|
|
147
|
+
if_match (str | Unset):
|
|
148
|
+
|
|
149
|
+
Raises:
|
|
150
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
151
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
Response[Any | Error]
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
kwargs = _get_kwargs(
|
|
158
|
+
name=name,
|
|
159
|
+
if_match=if_match,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
163
|
+
|
|
164
|
+
return _build_response(client=client, response=response)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
async def asyncio(
|
|
168
|
+
name: str,
|
|
169
|
+
*,
|
|
170
|
+
client: AuthenticatedClient,
|
|
171
|
+
if_match: str | Unset = UNSET,
|
|
172
|
+
) -> Any | Error | None:
|
|
173
|
+
"""Remove a hook at runtime — live immediately
|
|
174
|
+
|
|
175
|
+
Args:
|
|
176
|
+
name (str):
|
|
177
|
+
if_match (str | Unset):
|
|
178
|
+
|
|
179
|
+
Raises:
|
|
180
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
181
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
Any | Error
|
|
185
|
+
"""
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
await asyncio_detailed(
|
|
189
|
+
name=name,
|
|
190
|
+
client=client,
|
|
191
|
+
if_match=if_match,
|
|
192
|
+
)
|
|
193
|
+
).parsed
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.error import Error
|
|
10
|
+
from ...types import UNSET, Response, Unset
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
id: str,
|
|
15
|
+
*,
|
|
16
|
+
if_match: str | Unset = UNSET,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
if not isinstance(if_match, Unset):
|
|
20
|
+
headers["If-Match"] = if_match
|
|
21
|
+
|
|
22
|
+
_kwargs: dict[str, Any] = {
|
|
23
|
+
"method": "delete",
|
|
24
|
+
"url": "/api/v1/admin/keys/{id}".format(
|
|
25
|
+
id=quote(str(id), safe=""),
|
|
26
|
+
),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_kwargs["headers"] = headers
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | Error | None:
|
|
34
|
+
if response.status_code == 204:
|
|
35
|
+
response_204 = cast(Any, None)
|
|
36
|
+
return response_204
|
|
37
|
+
|
|
38
|
+
if response.status_code == 400:
|
|
39
|
+
response_400 = Error.from_dict(response.json())
|
|
40
|
+
|
|
41
|
+
return response_400
|
|
42
|
+
|
|
43
|
+
if response.status_code == 401:
|
|
44
|
+
response_401 = Error.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_401
|
|
47
|
+
|
|
48
|
+
if response.status_code == 403:
|
|
49
|
+
response_403 = Error.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_403
|
|
52
|
+
|
|
53
|
+
if response.status_code == 404:
|
|
54
|
+
response_404 = Error.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_404
|
|
57
|
+
|
|
58
|
+
if response.status_code == 409:
|
|
59
|
+
response_409 = Error.from_dict(response.json())
|
|
60
|
+
|
|
61
|
+
return response_409
|
|
62
|
+
|
|
63
|
+
if response.status_code == 429:
|
|
64
|
+
response_429 = Error.from_dict(response.json())
|
|
65
|
+
|
|
66
|
+
return response_429
|
|
67
|
+
|
|
68
|
+
if client.raise_on_unexpected_status:
|
|
69
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
70
|
+
else:
|
|
71
|
+
return None
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | Error]:
|
|
75
|
+
return Response(
|
|
76
|
+
status_code=HTTPStatus(response.status_code),
|
|
77
|
+
content=response.content,
|
|
78
|
+
headers=response.headers,
|
|
79
|
+
parsed=_parse_response(client=client, response=response),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def sync_detailed(
|
|
84
|
+
id: str,
|
|
85
|
+
*,
|
|
86
|
+
client: AuthenticatedClient,
|
|
87
|
+
if_match: str | Unset = UNSET,
|
|
88
|
+
) -> Response[Any | Error]:
|
|
89
|
+
"""Revoke a key — it stops resolving immediately. Optional `If-Match` (the key's ETag)
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
id (str):
|
|
93
|
+
if_match (str | Unset):
|
|
94
|
+
|
|
95
|
+
Raises:
|
|
96
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
97
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
Response[Any | Error]
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
kwargs = _get_kwargs(
|
|
104
|
+
id=id,
|
|
105
|
+
if_match=if_match,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
response = client.get_httpx_client().request(
|
|
109
|
+
**kwargs,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
return _build_response(client=client, response=response)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def sync(
|
|
116
|
+
id: str,
|
|
117
|
+
*,
|
|
118
|
+
client: AuthenticatedClient,
|
|
119
|
+
if_match: str | Unset = UNSET,
|
|
120
|
+
) -> Any | Error | None:
|
|
121
|
+
"""Revoke a key — it stops resolving immediately. Optional `If-Match` (the key's ETag)
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
id (str):
|
|
125
|
+
if_match (str | Unset):
|
|
126
|
+
|
|
127
|
+
Raises:
|
|
128
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
129
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
Any | Error
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
return sync_detailed(
|
|
136
|
+
id=id,
|
|
137
|
+
client=client,
|
|
138
|
+
if_match=if_match,
|
|
139
|
+
).parsed
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
async def asyncio_detailed(
|
|
143
|
+
id: str,
|
|
144
|
+
*,
|
|
145
|
+
client: AuthenticatedClient,
|
|
146
|
+
if_match: str | Unset = UNSET,
|
|
147
|
+
) -> Response[Any | Error]:
|
|
148
|
+
"""Revoke a key — it stops resolving immediately. Optional `If-Match` (the key's ETag)
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
id (str):
|
|
152
|
+
if_match (str | Unset):
|
|
153
|
+
|
|
154
|
+
Raises:
|
|
155
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
156
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
Response[Any | Error]
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
kwargs = _get_kwargs(
|
|
163
|
+
id=id,
|
|
164
|
+
if_match=if_match,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
168
|
+
|
|
169
|
+
return _build_response(client=client, response=response)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
async def asyncio(
|
|
173
|
+
id: str,
|
|
174
|
+
*,
|
|
175
|
+
client: AuthenticatedClient,
|
|
176
|
+
if_match: str | Unset = UNSET,
|
|
177
|
+
) -> Any | Error | None:
|
|
178
|
+
"""Revoke a key — it stops resolving immediately. Optional `If-Match` (the key's ETag)
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
id (str):
|
|
182
|
+
if_match (str | Unset):
|
|
183
|
+
|
|
184
|
+
Raises:
|
|
185
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
186
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
Any | Error
|
|
190
|
+
"""
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
await asyncio_detailed(
|
|
194
|
+
id=id,
|
|
195
|
+
client=client,
|
|
196
|
+
if_match=if_match,
|
|
197
|
+
)
|
|
198
|
+
).parsed
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.admin_auth_view import AdminAuthView
|
|
9
|
+
from ...models.error import Error
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs() -> dict[str, Any]:
|
|
14
|
+
|
|
15
|
+
_kwargs: dict[str, Any] = {
|
|
16
|
+
"method": "get",
|
|
17
|
+
"url": "/api/v1/admin/admin-auth",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return _kwargs
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AdminAuthView | Error | None:
|
|
24
|
+
if response.status_code == 200:
|
|
25
|
+
response_200 = AdminAuthView.from_dict(response.json())
|
|
26
|
+
|
|
27
|
+
return response_200
|
|
28
|
+
|
|
29
|
+
if response.status_code == 401:
|
|
30
|
+
response_401 = Error.from_dict(response.json())
|
|
31
|
+
|
|
32
|
+
return response_401
|
|
33
|
+
|
|
34
|
+
if response.status_code == 403:
|
|
35
|
+
response_403 = Error.from_dict(response.json())
|
|
36
|
+
|
|
37
|
+
return response_403
|
|
38
|
+
|
|
39
|
+
if client.raise_on_unexpected_status:
|
|
40
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
41
|
+
else:
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _build_response(
|
|
46
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
47
|
+
) -> Response[AdminAuthView | Error]:
|
|
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
|
+
*,
|
|
58
|
+
client: AuthenticatedClient,
|
|
59
|
+
) -> Response[AdminAuthView | Error]:
|
|
60
|
+
"""Admin-plane auth config (the admin surface guard)
|
|
61
|
+
|
|
62
|
+
Raises:
|
|
63
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
64
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
Response[AdminAuthView | Error]
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
kwargs = _get_kwargs()
|
|
71
|
+
|
|
72
|
+
response = client.get_httpx_client().request(
|
|
73
|
+
**kwargs,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
return _build_response(client=client, response=response)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def sync(
|
|
80
|
+
*,
|
|
81
|
+
client: AuthenticatedClient,
|
|
82
|
+
) -> AdminAuthView | Error | None:
|
|
83
|
+
"""Admin-plane auth config (the admin surface guard)
|
|
84
|
+
|
|
85
|
+
Raises:
|
|
86
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
87
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
AdminAuthView | Error
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
return sync_detailed(
|
|
94
|
+
client=client,
|
|
95
|
+
).parsed
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
async def asyncio_detailed(
|
|
99
|
+
*,
|
|
100
|
+
client: AuthenticatedClient,
|
|
101
|
+
) -> Response[AdminAuthView | Error]:
|
|
102
|
+
"""Admin-plane auth config (the admin surface guard)
|
|
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[AdminAuthView | Error]
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
kwargs = _get_kwargs()
|
|
113
|
+
|
|
114
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
115
|
+
|
|
116
|
+
return _build_response(client=client, response=response)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
async def asyncio(
|
|
120
|
+
*,
|
|
121
|
+
client: AuthenticatedClient,
|
|
122
|
+
) -> AdminAuthView | Error | None:
|
|
123
|
+
"""Admin-plane auth config (the admin surface guard)
|
|
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
|
+
AdminAuthView | Error
|
|
131
|
+
"""
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
await asyncio_detailed(
|
|
135
|
+
client=client,
|
|
136
|
+
)
|
|
137
|
+
).parsed
|