-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into AGE-1417/reduce-ag-grid-affect-on-bundle-size
- Loading branch information
Showing
67 changed files
with
2,313 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This file was auto-generated by Fern from our API Definition. |
167 changes: 167 additions & 0 deletions
167
agenta-cli/agenta/client/backend/access_control/client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
from ..core.client_wrapper import SyncClientWrapper | ||
import typing | ||
from ..core.request_options import RequestOptions | ||
from ..core.pydantic_utilities import parse_obj_as | ||
from ..errors.unprocessable_entity_error import UnprocessableEntityError | ||
from ..types.http_validation_error import HttpValidationError | ||
from json.decoder import JSONDecodeError | ||
from ..core.api_error import ApiError | ||
from ..core.client_wrapper import AsyncClientWrapper | ||
|
||
|
||
class AccessControlClient: | ||
def __init__(self, *, client_wrapper: SyncClientWrapper): | ||
self._client_wrapper = client_wrapper | ||
|
||
def verify_permissions( | ||
self, | ||
*, | ||
action: typing.Optional[str] = None, | ||
resource_type: typing.Optional[str] = None, | ||
resource_id: typing.Optional[str] = None, | ||
request_options: typing.Optional[RequestOptions] = None, | ||
) -> typing.Optional[typing.Any]: | ||
""" | ||
Parameters | ||
---------- | ||
action : typing.Optional[str] | ||
resource_type : typing.Optional[str] | ||
resource_id : typing.Optional[str] | ||
request_options : typing.Optional[RequestOptions] | ||
Request-specific configuration. | ||
Returns | ||
------- | ||
typing.Optional[typing.Any] | ||
Successful Response | ||
Examples | ||
-------- | ||
from agenta import AgentaApi | ||
client = AgentaApi( | ||
api_key="YOUR_API_KEY", | ||
base_url="https://yourhost.com/path/to/api", | ||
) | ||
client.access_control.verify_permissions() | ||
""" | ||
_response = self._client_wrapper.httpx_client.request( | ||
"permissions/verify", | ||
method="GET", | ||
params={ | ||
"action": action, | ||
"resource_type": resource_type, | ||
"resource_id": resource_id, | ||
}, | ||
request_options=request_options, | ||
) | ||
try: | ||
if 200 <= _response.status_code < 300: | ||
return typing.cast( | ||
typing.Optional[typing.Any], | ||
parse_obj_as( | ||
type_=typing.Optional[typing.Any], # type: ignore | ||
object_=_response.json(), | ||
), | ||
) | ||
if _response.status_code == 422: | ||
raise UnprocessableEntityError( | ||
typing.cast( | ||
HttpValidationError, | ||
parse_obj_as( | ||
type_=HttpValidationError, # type: ignore | ||
object_=_response.json(), | ||
), | ||
) | ||
) | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) | ||
|
||
|
||
class AsyncAccessControlClient: | ||
def __init__(self, *, client_wrapper: AsyncClientWrapper): | ||
self._client_wrapper = client_wrapper | ||
|
||
async def verify_permissions( | ||
self, | ||
*, | ||
action: typing.Optional[str] = None, | ||
resource_type: typing.Optional[str] = None, | ||
resource_id: typing.Optional[str] = None, | ||
request_options: typing.Optional[RequestOptions] = None, | ||
) -> typing.Optional[typing.Any]: | ||
""" | ||
Parameters | ||
---------- | ||
action : typing.Optional[str] | ||
resource_type : typing.Optional[str] | ||
resource_id : typing.Optional[str] | ||
request_options : typing.Optional[RequestOptions] | ||
Request-specific configuration. | ||
Returns | ||
------- | ||
typing.Optional[typing.Any] | ||
Successful Response | ||
Examples | ||
-------- | ||
import asyncio | ||
from agenta import AsyncAgentaApi | ||
client = AsyncAgentaApi( | ||
api_key="YOUR_API_KEY", | ||
base_url="https://yourhost.com/path/to/api", | ||
) | ||
async def main() -> None: | ||
await client.access_control.verify_permissions() | ||
asyncio.run(main()) | ||
""" | ||
_response = await self._client_wrapper.httpx_client.request( | ||
"permissions/verify", | ||
method="GET", | ||
params={ | ||
"action": action, | ||
"resource_type": resource_type, | ||
"resource_id": resource_id, | ||
}, | ||
request_options=request_options, | ||
) | ||
try: | ||
if 200 <= _response.status_code < 300: | ||
return typing.cast( | ||
typing.Optional[typing.Any], | ||
parse_obj_as( | ||
type_=typing.Optional[typing.Any], # type: ignore | ||
object_=_response.json(), | ||
), | ||
) | ||
if _response.status_code == 422: | ||
raise UnprocessableEntityError( | ||
typing.cast( | ||
HttpValidationError, | ||
parse_obj_as( | ||
type_=HttpValidationError, # type: ignore | ||
object_=_response.json(), | ||
), | ||
) | ||
) | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) |
Oops, something went wrong.