Add your description here
Project description
IntelliOpsOpenFgaSDK-Python
An efficient, asynchronous Python SDK for communicating with the IntelliOps FGA API.
Features
- Async API calls using
aiohttp - Fast and efficient client
- Easy integration with asyncio-based applications
- Example methods for permission checking and listing
Installation
Install via pip (after publishing):
pip install intelliopsopenfgasdk-python
Or install dependencies for development:
pip install -r requirements.txt
Usage Examples
1. Initialize the SDK (Recommended)
from intelliopsopenfgasdk_python.intelliops_openfga_sdk import IntelliOpsOpenFgaSDK
from intelliopsopenfgasdk_python.models import CreateFgaModel
sdk = IntelliOpsOpenFgaSDK()
fga_model = CreateFgaModel(
intelliopsUserUId="your-user-id",
intelliopsTenantUId="your-tenant-id",
intelliopsConnectorUId="your-connector-id",
intelliopsConnectorType="Confluence",
datasourceTenantUId="your-datasource-tenant-id",
accessToken="your-access-token",
refreshToken="your-refresh-token"
)
sdk.initialize(fga_model) # This will call both datasource and FGA initialization
2. Initialize FGA Data Source (Manual)
from intelliopsopenfgasdk_python.intelliops_openfga_sdk import IntelliOpsOpenFgaSDK
from intelliopsopenfgasdk_python.models import CreateDataSourceModel
sdk = IntelliOpsOpenFgaSDK()
datasource_model = CreateDataSourceModel(
intelliopsTenantUId="your-tenant-id",
intelliopsConnectorType="Confluence",
datasourceTenantUId="your-datasource-tenant-id"
)
sdk._IntelliOpsOpenFgaSDK__init_datasource(datasource_model) # Not recommended, use initialize() if possible
3. Initialize FGA (Manual)
from intelliopsopenfgasdk_python.intelliops_openfga_sdk import IntelliOpsOpenFgaSDK
from intelliopsopenfgasdk_python.models import CreateFgaModel
sdk = IntelliOpsOpenFgaSDK()
fga_model = CreateFgaModel(
intelliopsUserUId="your-user-id",
intelliopsTenantUId="your-tenant-id",
intelliopsConnectorUId="your-connector-id",
intelliopsConnectorType="Confluence",
datasourceTenantUId="your-datasource-tenant-id",
accessToken="your-access-token",
refreshToken="your-refresh-token"
)
sdk._IntelliOpsOpenFgaSDK__init_fga(fga_model) # Not recommended, use initialize() if possible
4. Check Access (Sync)
from intelliopsopenfgasdk_python.intelliops_openfga_sdk import IntelliOpsOpenFgaSDK
from intelliopsopenfgasdk_python.models import CheckAccessModel, FgaObjectModel
sdk = IntelliOpsOpenFgaSDK()
model = CheckAccessModel(
intelliopsUserUId="your-user-id",
fgaObject=FgaObjectModel(
intelliopsConnectorUId="your-connector-id",
objectId="your-object-id"
)
)
has_access = sdk.check_access(model)
print("User has access?", has_access)
5. Check Access (Async)
import asyncio
from intelliopsopenfgasdk_python.intelliops_openfga_sdk import IntelliOpsOpenFgaSDK
from intelliopsopenfgasdk_python.models import CheckAccessModel, FgaObjectModel
sdk = IntelliOpsOpenFgaSDK()
async def main():
model = CheckAccessModel(
intelliopsUserUId="your-user-id",
fgaObject=FgaObjectModel(
intelliopsConnectorUId="your-connector-id",
objectId="your-object-id"
)
)
has_access = await sdk.async_check_access(model)
print("User has access?", has_access)
asyncio.run(main())
6. Check Multiple Access (Sync)
from intelliopsopenfgasdk_python.intelliops_openfga_sdk import IntelliOpsOpenFgaSDK
from intelliopsopenfgasdk_python.models import CheckMultipleAccessModel, FgaObjectModel
sdk = IntelliOpsOpenFgaSDK()
model = CheckMultipleAccessModel(
intelliopsUserUId="your-user-id",
fgaObjects=[
FgaObjectModel(intelliopsConnectorUId="your-connector-id", objectId="object-id-1"),
FgaObjectModel(intelliopsConnectorUId="your-connector-id", objectId="object-id-2"),
]
)
result = sdk.check_multi_access(model)
print(result) # {"object-id-1": True, "object-id-2": False}
7. Check Multiple Access (Async)
import asyncio
from intelliopsopenfgasdk_python.intelliops_openfga_sdk import IntelliOpsOpenFgaSDK
from intelliopsopenfgasdk_python.models import CheckMultipleAccessModel, FgaObjectModel
sdk = IntelliOpsOpenFgaSDK()
async def main():
model = CheckMultipleAccessModel(
intelliopsUserUId="your-user-id",
fgaObjects=[
FgaObjectModel(intelliopsConnectorUId="your-connector-id", objectId="object-id-1"),
FgaObjectModel(intelliopsConnectorUId="your-connector-id", objectId="object-id-2"),
]
)
result = await sdk.async_check_multi_access(model)
print(result)
asyncio.run(main())
Testing
Run tests using pytest:
pytest
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file intelliopsopenfgasdk_python-0.2.9.tar.gz.
File metadata
- Download URL: intelliopsopenfgasdk_python-0.2.9.tar.gz
- Upload date:
- Size: 41.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39c4b9d6f78d3035c2da86f91bb125336db6fc61f37abdf6cd44a743536a7881
|
|
| MD5 |
c18649007f821ffe55eb7c83b2fd4c76
|
|
| BLAKE2b-256 |
997f92c6f36e13130206e726e30c25e8b4522266b6cd74b888b7d142bfbe1007
|
File details
Details for the file intelliopsopenfgasdk_python-0.2.9-py3-none-any.whl.
File metadata
- Download URL: intelliopsopenfgasdk_python-0.2.9-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbfe2fd6cb9d1d15009d7cc61ed51d0632fc7221a8b86e7d235b136c4993ca4e
|
|
| MD5 |
80446c5e4f371df492a5224969b0dae1
|
|
| BLAKE2b-256 |
575fc27823e2042d5b85e3d075fb44897d3c7293d18df85b1febf675bb209069
|