Lumos Connector SDK Types

0.47.0 · active · verified Thu Apr 16

This library provides generated Python type definitions for the Lumos Connector SDK, enabling developers to build custom connectors for integrating diverse systems with the Lumos identity governance platform. It aims to simplify connector development by offering standardized data models and interfaces for a more type-safe approach. The current version is 0.47.0, and the associated Lumos Connector SDK undergoes frequent updates, indicating active development.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to define custom connector settings and data models using the types provided by `connector-sdk-types`. In a typical Lumos Connector SDK project (built with `connector-py`), these types would be imported and utilized within the `settings.py`, `models.py`, and capability implementation files. It shows how to represent connector configuration and fetched user accounts using the SDK's type-safe structures.

import os
from typing import List, Dict, Any
from connector_sdk.settings import ConnectorSettings
from connector_sdk.models import Account, Identity

# This is a simplified example. In a real scenario, you'd scaffold with 'connector-py'
# and implement capabilities. The types are used within that implementation.

# Define a custom settings model using the generated types
class MyConnectorSettings(ConnectorSettings):
    api_key: str = os.environ.get('MY_CONNECTOR_API_KEY', '')
    base_url: str = os.environ.get('MY_CONNECTOR_BASE_URL', 'https://api.example.com')

# A hypothetical function demonstrating usage of types
def fetch_accounts(settings: MyConnectorSettings) -> List[Account]:
    print(f"Fetching accounts from {settings.base_url} with key: {settings.api_key[:5]}...")
    # In a real connector, this would make API calls and map responses to Account objects
    mock_accounts: List[Account] = [
        Account(identity=Identity(id='user1', username='john.doe', email='john.doe@example.com'), 
                attributes={'firstName': 'John', 'lastName': 'Doe'}),
        Account(identity=Identity(id='user2', username='jane.smith', email='jane.smith@example.com'), 
                attributes={'firstName': 'Jane', 'lastName': 'Smith'})
    ]
    return mock_accounts

if __name__ == '__main__':
    # Example usage (usually managed by the connector-py framework)
    settings_instance = MyConnectorSettings()
    if not settings_instance.api_key:
        print("Warning: MY_CONNECTOR_API_KEY not set in environment. Using empty string.")

    accounts = fetch_accounts(settings_instance)
    print(f"Fetched {len(accounts)} accounts:")
    for account in accounts:
        print(f" - ID: {account.identity.id}, Username: {account.identity.username}, Email: {account.identity.email}")

view raw JSON →