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.1.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.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for intelliopsopenfgasdk_python-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8bc7aa72bdc75df3478e9ca573ac40f0dd9085865ee885144f9b05a85d1be46e
MD5 78c3878895414bca7106881b4dd52fc5
BLAKE2b-256 d6f70c78dcad62114f67db689d3923df294c88469d96c576405216de5f613364

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for intelliopsopenfgasdk_python-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f1806537010ad3594ac58cef022870dc0126f9ded8131d9942569b0f3cf93b23
MD5 c8135034c3dcee51c17c4a62ded3cfe2
BLAKE2b-256 19e9c1d53745fe621548d35eb8dae20d4d5e6a01235a8c1efd0b432dfa951cee

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