Skip to main content

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(
    token="your-token",
    tenantId="your-tenant-id",
    connectorType="Confluence",
    orgId="your-org-id",
    fgaStoreId="your-fga-store-id"
)
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(
    orgId="your-org-id",
    connectorType="Confluence",
    fgaStoreId="your-fga-store-id",
    tenantId="your-tenant-id"
)
sdk._IntelliOpsOpenFgaSDK__init_datasource(datasource_model)

3. Initialize FGA (Manual)

from intelliopsopenfgasdk_python.intelliops_openfga_sdk import IntelliOpsOpenFgaSDK
from intelliopsopenfgasdk_python.models import CreateFgaModel

sdk = IntelliOpsOpenFgaSDK()
fga_model = CreateFgaModel(
    token="your-token",
    tenantId="your-tenant-id",
    connectorType="Confluence",
    orgId="your-org-id",
    fgaStoreId="your-fga-store-id"
)
sdk._IntelliOpsOpenFgaSDK__init_fga(fga_model)

4. Check Access (Sync)

from intelliopsopenfgasdk_python.intelliops_openfga_sdk import IntelliOpsOpenFgaSDK

sdk = IntelliOpsOpenFgaSDK()
user_id = "user-id"
l2_object_id = "object-id"
has_access = sdk.check_access(user_id, l2_object_id)
print("User has access?", has_access)

5. Check Access (Async)

import asyncio
from intelliopsopenfgasdk_python.intelliops_openfga_sdk import IntelliOpsOpenFgaSDK

sdk = IntelliOpsOpenFgaSDK()
async def main():
    user_id = "user-id"
    l2_object_id = "object-id"
    has_access = await sdk.async_check_access(user_id, l2_object_id)
    print("User has access?", has_access)

asyncio.run(main())

6. Async Initialization (Advanced)

import asyncio
from intelliopsopenfgasdk_python.intelliops_openfga_sdk import IntelliOpsOpenFgaSDK
from intelliopsopenfgasdk_python.models import CreateFgaModel, CreateDataSourceModel

sdk = IntelliOpsOpenFgaSDK()
async def main():
    datasource_model = CreateDataSourceModel(
        orgId="your-org-id",
        connectorType="Confluence",
        fgaStoreId="your-fga-store-id",
        tenantId="your-tenant-id"
    )
    await sdk.__async_init_datasource(datasource_model)
    fga_model = CreateFgaModel(
        token="your-token",
        tenantId="your-tenant-id",
        connectorType="Confluence",
        orgId="your-org-id",
        fgaStoreId="your-fga-store-id"
    )
    await sdk.__async_init_fga(fga_model)

asyncio.run(main())

Testing

Run tests using pytest:

pytest

Build & Publish

See build.md for detailed build and publishing instructions.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

intelliopsopenfgasdk_python-0.1.3.tar.gz (42.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

intelliopsopenfgasdk_python-0.1.3-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file intelliopsopenfgasdk_python-0.1.3.tar.gz.

File metadata

File hashes

Hashes for intelliopsopenfgasdk_python-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fec31fbbbbfe04aaa85713177dabe7262ce1d85936c300d4761d48d27861c0b9
MD5 e48084bafc0ca0342a80a9016c90d8d7
BLAKE2b-256 49bc58bbb2103da88e459913a5493139b0f60232d74bf2bec9d91fa9d2dd1750

See more details on using hashes here.

File details

Details for the file intelliopsopenfgasdk_python-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for intelliopsopenfgasdk_python-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 daf73cf2b516d9d9ddb16045cee3a7db231de3e58ca288cddb86125392c205cd
MD5 ae131761c5a8809f644dd3f8e7db5f77
BLAKE2b-256 92b4a1af9c1da93c414b9a262d90c273129e98b97ccee3c9cfaf28f55c440ba4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page