|
1 | 1 | # This file was auto-generated by Fern from our API Definition. |
2 | 2 |
|
3 | | -from ..core.client_wrapper import SyncClientWrapper |
4 | 3 | import typing |
5 | | -from .types.audit_service_list_audit_events_request_filter_ops_context_actor_type import ( |
6 | | - AuditServiceListAuditEventsRequestFilterOpsContextActorType, |
| 4 | + |
| 5 | +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 6 | +from ..core.request_options import RequestOptions |
| 7 | +from ..types.v_1_audit_response import V1AuditResponse |
| 8 | +from .raw_client import AsyncRawAuditClient, RawAuditClient |
| 9 | +from .types.audit_service_list_audit_events_request_filter_ops_action_type import ( |
| 10 | + AuditServiceListAuditEventsRequestFilterOpsActionType, |
7 | 11 | ) |
8 | 12 | from .types.audit_service_list_audit_events_request_filter_ops_context_access_type import ( |
9 | 13 | AuditServiceListAuditEventsRequestFilterOpsContextAccessType, |
10 | 14 | ) |
| 15 | +from .types.audit_service_list_audit_events_request_filter_ops_context_actor_type import ( |
| 16 | + AuditServiceListAuditEventsRequestFilterOpsContextActorType, |
| 17 | +) |
11 | 18 | from .types.audit_service_list_audit_events_request_filter_ops_context_auth_mode import ( |
12 | 19 | AuditServiceListAuditEventsRequestFilterOpsContextAuthMode, |
13 | 20 | ) |
14 | | -from .types.audit_service_list_audit_events_request_filter_ops_action_type import ( |
15 | | - AuditServiceListAuditEventsRequestFilterOpsActionType, |
16 | | -) |
17 | 21 | from .types.audit_service_list_audit_events_request_filter_ops_resource_type import ( |
18 | 22 | AuditServiceListAuditEventsRequestFilterOpsResourceType, |
19 | 23 | ) |
20 | 24 | from .types.audit_service_list_audit_events_request_sort_ops_order_by import ( |
21 | 25 | AuditServiceListAuditEventsRequestSortOpsOrderBy, |
22 | 26 | ) |
23 | | -from ..core.request_options import RequestOptions |
24 | | -from ..types.v_1_audit_response import V1AuditResponse |
25 | | -from ..core.pydantic_utilities import parse_obj_as |
26 | | -from ..errors.not_found_error import NotFoundError |
27 | | -from json.decoder import JSONDecodeError |
28 | | -from ..core.api_error import ApiError |
29 | | -from ..core.client_wrapper import AsyncClientWrapper |
30 | 27 |
|
31 | 28 |
|
32 | 29 | class AuditClient: |
33 | 30 | def __init__(self, *, client_wrapper: SyncClientWrapper): |
34 | | - self._client_wrapper = client_wrapper |
| 31 | + self._raw_client = RawAuditClient(client_wrapper=client_wrapper) |
| 32 | + |
| 33 | + @property |
| 34 | + def with_raw_response(self) -> RawAuditClient: |
| 35 | + """ |
| 36 | + Retrieves a raw implementation of this client that returns raw responses. |
| 37 | +
|
| 38 | + Returns |
| 39 | + ------- |
| 40 | + RawAuditClient |
| 41 | + """ |
| 42 | + return self._raw_client |
35 | 43 |
|
36 | 44 | def audit_service_list_audit_events( |
37 | 45 | self, |
@@ -192,82 +200,62 @@ def audit_service_list_audit_events( |
192 | 200 | Examples |
193 | 201 | -------- |
194 | 202 | from skyflow import Skyflow |
195 | | -
|
196 | | - client = Skyflow( |
197 | | - token="YOUR_TOKEN", |
198 | | - ) |
199 | | - client.audit.audit_service_list_audit_events( |
200 | | - filter_ops_account_id="filterOps.accountID", |
201 | | - ) |
| 203 | + client = Skyflow(token="YOUR_TOKEN", ) |
| 204 | + client.audit.audit_service_list_audit_events(filter_ops_account_id='filterOps.accountID', ) |
202 | 205 | """ |
203 | | - _response = self._client_wrapper.httpx_client.request( |
204 | | - "v1/audit/events", |
205 | | - method="GET", |
206 | | - params={ |
207 | | - "filterOps.context.changeID": filter_ops_context_change_id, |
208 | | - "filterOps.context.requestID": filter_ops_context_request_id, |
209 | | - "filterOps.context.traceID": filter_ops_context_trace_id, |
210 | | - "filterOps.context.sessionID": filter_ops_context_session_id, |
211 | | - "filterOps.context.actor": filter_ops_context_actor, |
212 | | - "filterOps.context.actorType": filter_ops_context_actor_type, |
213 | | - "filterOps.context.accessType": filter_ops_context_access_type, |
214 | | - "filterOps.context.ipAddress": filter_ops_context_ip_address, |
215 | | - "filterOps.context.origin": filter_ops_context_origin, |
216 | | - "filterOps.context.authMode": filter_ops_context_auth_mode, |
217 | | - "filterOps.context.jwtID": filter_ops_context_jwt_id, |
218 | | - "filterOps.context.bearerTokenContextID": filter_ops_context_bearer_token_context_id, |
219 | | - "filterOps.parentAccountID": filter_ops_parent_account_id, |
220 | | - "filterOps.accountID": filter_ops_account_id, |
221 | | - "filterOps.workspaceID": filter_ops_workspace_id, |
222 | | - "filterOps.vaultID": filter_ops_vault_id, |
223 | | - "filterOps.resourceIDs": filter_ops_resource_i_ds, |
224 | | - "filterOps.actionType": filter_ops_action_type, |
225 | | - "filterOps.resourceType": filter_ops_resource_type, |
226 | | - "filterOps.tags": filter_ops_tags, |
227 | | - "filterOps.responseCode": filter_ops_response_code, |
228 | | - "filterOps.startTime": filter_ops_start_time, |
229 | | - "filterOps.endTime": filter_ops_end_time, |
230 | | - "filterOps.apiName": filter_ops_api_name, |
231 | | - "filterOps.responseMessage": filter_ops_response_message, |
232 | | - "filterOps.httpMethod": filter_ops_http_method, |
233 | | - "filterOps.httpURI": filter_ops_http_uri, |
234 | | - "sortOps.sortBy": sort_ops_sort_by, |
235 | | - "sortOps.orderBy": sort_ops_order_by, |
236 | | - "afterOps.timestamp": after_ops_timestamp, |
237 | | - "afterOps.changeID": after_ops_change_id, |
238 | | - "limit": limit, |
239 | | - "offset": offset, |
240 | | - }, |
| 206 | + _response = self._raw_client.audit_service_list_audit_events( |
| 207 | + filter_ops_account_id=filter_ops_account_id, |
| 208 | + filter_ops_context_change_id=filter_ops_context_change_id, |
| 209 | + filter_ops_context_request_id=filter_ops_context_request_id, |
| 210 | + filter_ops_context_trace_id=filter_ops_context_trace_id, |
| 211 | + filter_ops_context_session_id=filter_ops_context_session_id, |
| 212 | + filter_ops_context_actor=filter_ops_context_actor, |
| 213 | + filter_ops_context_actor_type=filter_ops_context_actor_type, |
| 214 | + filter_ops_context_access_type=filter_ops_context_access_type, |
| 215 | + filter_ops_context_ip_address=filter_ops_context_ip_address, |
| 216 | + filter_ops_context_origin=filter_ops_context_origin, |
| 217 | + filter_ops_context_auth_mode=filter_ops_context_auth_mode, |
| 218 | + filter_ops_context_jwt_id=filter_ops_context_jwt_id, |
| 219 | + filter_ops_context_bearer_token_context_id=filter_ops_context_bearer_token_context_id, |
| 220 | + filter_ops_parent_account_id=filter_ops_parent_account_id, |
| 221 | + filter_ops_workspace_id=filter_ops_workspace_id, |
| 222 | + filter_ops_vault_id=filter_ops_vault_id, |
| 223 | + filter_ops_resource_i_ds=filter_ops_resource_i_ds, |
| 224 | + filter_ops_action_type=filter_ops_action_type, |
| 225 | + filter_ops_resource_type=filter_ops_resource_type, |
| 226 | + filter_ops_tags=filter_ops_tags, |
| 227 | + filter_ops_response_code=filter_ops_response_code, |
| 228 | + filter_ops_start_time=filter_ops_start_time, |
| 229 | + filter_ops_end_time=filter_ops_end_time, |
| 230 | + filter_ops_api_name=filter_ops_api_name, |
| 231 | + filter_ops_response_message=filter_ops_response_message, |
| 232 | + filter_ops_http_method=filter_ops_http_method, |
| 233 | + filter_ops_http_uri=filter_ops_http_uri, |
| 234 | + sort_ops_sort_by=sort_ops_sort_by, |
| 235 | + sort_ops_order_by=sort_ops_order_by, |
| 236 | + after_ops_timestamp=after_ops_timestamp, |
| 237 | + after_ops_change_id=after_ops_change_id, |
| 238 | + limit=limit, |
| 239 | + offset=offset, |
241 | 240 | request_options=request_options, |
242 | 241 | ) |
243 | | - try: |
244 | | - if 200 <= _response.status_code < 300: |
245 | | - return typing.cast( |
246 | | - V1AuditResponse, |
247 | | - parse_obj_as( |
248 | | - type_=V1AuditResponse, # type: ignore |
249 | | - object_=_response.json(), |
250 | | - ), |
251 | | - ) |
252 | | - if _response.status_code == 404: |
253 | | - raise NotFoundError( |
254 | | - typing.cast( |
255 | | - typing.Dict[str, typing.Optional[typing.Any]], |
256 | | - parse_obj_as( |
257 | | - type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore |
258 | | - object_=_response.json(), |
259 | | - ), |
260 | | - ) |
261 | | - ) |
262 | | - _response_json = _response.json() |
263 | | - except JSONDecodeError: |
264 | | - raise ApiError(status_code=_response.status_code, body=_response.text) |
265 | | - raise ApiError(status_code=_response.status_code, body=_response_json) |
| 242 | + return _response.data |
266 | 243 |
|
267 | 244 |
|
268 | 245 | class AsyncAuditClient: |
269 | 246 | def __init__(self, *, client_wrapper: AsyncClientWrapper): |
270 | | - self._client_wrapper = client_wrapper |
| 247 | + self._raw_client = AsyncRawAuditClient(client_wrapper=client_wrapper) |
| 248 | + |
| 249 | + @property |
| 250 | + def with_raw_response(self) -> AsyncRawAuditClient: |
| 251 | + """ |
| 252 | + Retrieves a raw implementation of this client that returns raw responses. |
| 253 | +
|
| 254 | + Returns |
| 255 | + ------- |
| 256 | + AsyncRawAuditClient |
| 257 | + """ |
| 258 | + return self._raw_client |
271 | 259 |
|
272 | 260 | async def audit_service_list_audit_events( |
273 | 261 | self, |
@@ -427,83 +415,47 @@ async def audit_service_list_audit_events( |
427 | 415 |
|
428 | 416 | Examples |
429 | 417 | -------- |
430 | | - import asyncio |
431 | | -
|
432 | 418 | from skyflow import AsyncSkyflow |
433 | | -
|
434 | | - client = AsyncSkyflow( |
435 | | - token="YOUR_TOKEN", |
436 | | - ) |
437 | | -
|
438 | | -
|
| 419 | + import asyncio |
| 420 | + client = AsyncSkyflow(token="YOUR_TOKEN", ) |
439 | 421 | async def main() -> None: |
440 | | - await client.audit.audit_service_list_audit_events( |
441 | | - filter_ops_account_id="filterOps.accountID", |
442 | | - ) |
443 | | -
|
444 | | -
|
| 422 | + await client.audit.audit_service_list_audit_events(filter_ops_account_id='filterOps.accountID', ) |
445 | 423 | asyncio.run(main()) |
446 | 424 | """ |
447 | | - _response = await self._client_wrapper.httpx_client.request( |
448 | | - "v1/audit/events", |
449 | | - method="GET", |
450 | | - params={ |
451 | | - "filterOps.context.changeID": filter_ops_context_change_id, |
452 | | - "filterOps.context.requestID": filter_ops_context_request_id, |
453 | | - "filterOps.context.traceID": filter_ops_context_trace_id, |
454 | | - "filterOps.context.sessionID": filter_ops_context_session_id, |
455 | | - "filterOps.context.actor": filter_ops_context_actor, |
456 | | - "filterOps.context.actorType": filter_ops_context_actor_type, |
457 | | - "filterOps.context.accessType": filter_ops_context_access_type, |
458 | | - "filterOps.context.ipAddress": filter_ops_context_ip_address, |
459 | | - "filterOps.context.origin": filter_ops_context_origin, |
460 | | - "filterOps.context.authMode": filter_ops_context_auth_mode, |
461 | | - "filterOps.context.jwtID": filter_ops_context_jwt_id, |
462 | | - "filterOps.context.bearerTokenContextID": filter_ops_context_bearer_token_context_id, |
463 | | - "filterOps.parentAccountID": filter_ops_parent_account_id, |
464 | | - "filterOps.accountID": filter_ops_account_id, |
465 | | - "filterOps.workspaceID": filter_ops_workspace_id, |
466 | | - "filterOps.vaultID": filter_ops_vault_id, |
467 | | - "filterOps.resourceIDs": filter_ops_resource_i_ds, |
468 | | - "filterOps.actionType": filter_ops_action_type, |
469 | | - "filterOps.resourceType": filter_ops_resource_type, |
470 | | - "filterOps.tags": filter_ops_tags, |
471 | | - "filterOps.responseCode": filter_ops_response_code, |
472 | | - "filterOps.startTime": filter_ops_start_time, |
473 | | - "filterOps.endTime": filter_ops_end_time, |
474 | | - "filterOps.apiName": filter_ops_api_name, |
475 | | - "filterOps.responseMessage": filter_ops_response_message, |
476 | | - "filterOps.httpMethod": filter_ops_http_method, |
477 | | - "filterOps.httpURI": filter_ops_http_uri, |
478 | | - "sortOps.sortBy": sort_ops_sort_by, |
479 | | - "sortOps.orderBy": sort_ops_order_by, |
480 | | - "afterOps.timestamp": after_ops_timestamp, |
481 | | - "afterOps.changeID": after_ops_change_id, |
482 | | - "limit": limit, |
483 | | - "offset": offset, |
484 | | - }, |
| 425 | + _response = await self._raw_client.audit_service_list_audit_events( |
| 426 | + filter_ops_account_id=filter_ops_account_id, |
| 427 | + filter_ops_context_change_id=filter_ops_context_change_id, |
| 428 | + filter_ops_context_request_id=filter_ops_context_request_id, |
| 429 | + filter_ops_context_trace_id=filter_ops_context_trace_id, |
| 430 | + filter_ops_context_session_id=filter_ops_context_session_id, |
| 431 | + filter_ops_context_actor=filter_ops_context_actor, |
| 432 | + filter_ops_context_actor_type=filter_ops_context_actor_type, |
| 433 | + filter_ops_context_access_type=filter_ops_context_access_type, |
| 434 | + filter_ops_context_ip_address=filter_ops_context_ip_address, |
| 435 | + filter_ops_context_origin=filter_ops_context_origin, |
| 436 | + filter_ops_context_auth_mode=filter_ops_context_auth_mode, |
| 437 | + filter_ops_context_jwt_id=filter_ops_context_jwt_id, |
| 438 | + filter_ops_context_bearer_token_context_id=filter_ops_context_bearer_token_context_id, |
| 439 | + filter_ops_parent_account_id=filter_ops_parent_account_id, |
| 440 | + filter_ops_workspace_id=filter_ops_workspace_id, |
| 441 | + filter_ops_vault_id=filter_ops_vault_id, |
| 442 | + filter_ops_resource_i_ds=filter_ops_resource_i_ds, |
| 443 | + filter_ops_action_type=filter_ops_action_type, |
| 444 | + filter_ops_resource_type=filter_ops_resource_type, |
| 445 | + filter_ops_tags=filter_ops_tags, |
| 446 | + filter_ops_response_code=filter_ops_response_code, |
| 447 | + filter_ops_start_time=filter_ops_start_time, |
| 448 | + filter_ops_end_time=filter_ops_end_time, |
| 449 | + filter_ops_api_name=filter_ops_api_name, |
| 450 | + filter_ops_response_message=filter_ops_response_message, |
| 451 | + filter_ops_http_method=filter_ops_http_method, |
| 452 | + filter_ops_http_uri=filter_ops_http_uri, |
| 453 | + sort_ops_sort_by=sort_ops_sort_by, |
| 454 | + sort_ops_order_by=sort_ops_order_by, |
| 455 | + after_ops_timestamp=after_ops_timestamp, |
| 456 | + after_ops_change_id=after_ops_change_id, |
| 457 | + limit=limit, |
| 458 | + offset=offset, |
485 | 459 | request_options=request_options, |
486 | 460 | ) |
487 | | - try: |
488 | | - if 200 <= _response.status_code < 300: |
489 | | - return typing.cast( |
490 | | - V1AuditResponse, |
491 | | - parse_obj_as( |
492 | | - type_=V1AuditResponse, # type: ignore |
493 | | - object_=_response.json(), |
494 | | - ), |
495 | | - ) |
496 | | - if _response.status_code == 404: |
497 | | - raise NotFoundError( |
498 | | - typing.cast( |
499 | | - typing.Dict[str, typing.Optional[typing.Any]], |
500 | | - parse_obj_as( |
501 | | - type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore |
502 | | - object_=_response.json(), |
503 | | - ), |
504 | | - ) |
505 | | - ) |
506 | | - _response_json = _response.json() |
507 | | - except JSONDecodeError: |
508 | | - raise ApiError(status_code=_response.status_code, body=_response.text) |
509 | | - raise ApiError(status_code=_response.status_code, body=_response_json) |
| 461 | + return _response.data |
0 commit comments