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.2.0.tar.gz (41.5 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.2.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for intelliopsopenfgasdk_python-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ec7b1a625033632249c70f4a14fcb96e9076221482718393956d9cc6f2a0211a
MD5 f76d6f05ec684479eed40785629c265e
BLAKE2b-256 8eb1a5aef9aa8983b497a014a56466189be36fa6516529a50a78f5499a7ff483

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for intelliopsopenfgasdk_python-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2da36dd5638b9abbd5866a5a85fc6a587957f7da60b2c5ae002723e535693050
MD5 cd0e6596d7aa518a90f956f8e86c6408
BLAKE2b-256 981e4359b755263e9c0b3c85114cc29808fddf8b7523351e304ff575d2c0ef2c

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