Skip to main content
This guide serves as a quick reference for developers building custom Lumos connectors. It explains each file in a logical order so you can understand the connector structure and implement your own connector efficiently.

Implementation Workflow

When implementing a connector, follow this recommended order:
  1. Define settings in settings.py - what configuration does your connector need?
  2. Define resources and entitlements in enums.py - map your app’s concepts to Lumos
  3. Set up constants in constants.py - define API URLs and other constants
  4. Implement the client in client.py - create methods for API communication
  5. Implement validate_credentials in capabilities_read.py - this is the minimum required capability
  6. Implement read capabilities in capabilities_read.py - typically easier to implement
  7. Implement write capabilities in capabilities_write.py - as needed
  8. Configure the integration in integration.py - register your implemented capabilities

Minimum Viable Connector

A minimal connector needs:
  1. settings.py - Defining what configuration users need to provide
  2. enums.py - Defining resource and entitlement types (can be minimal)
  3. client.py - With at least enough functionality to validate credentials
  4. capabilities_read.py - With at least validate_credentials implemented
  5. integration.py - Registering at least the validate_credentials capability

Core Files Overview

Here’s a conceptual map of how the files relate to each other:

1. settings.py

Purpose: Defines the configuration settings that users will provide when setting up the connector. Key aspects:
  • Uses Pydantic models for type safety and validation
  • Each setting can have descriptions, defaults, and validation rules
  • Settings are passed to every capability function
Example implementation:

2. constants.py

Purpose: Stores constant values used throughout the connector, like API paths. Key aspects:
  • API endpoints
  • Default values
  • URL templates
Example implementation:

3. enums.py

Purpose: Defines the types of resources and entitlements in your application. Key aspects:
  • Resource types (containers like projects, teams, etc.)
  • Entitlement types (permissions within resources)
  • Maps application-specific concepts to Lumos concepts
Example implementation:

4. pagination.py

Purpose: Handles pagination for large data sets. Key aspects:
  • Stores pagination state between requests
  • Encodes/decodes pagination tokens
  • Maintains default page sizes
Example implementation:

5. client.py

Purpose: Handles communication with your application’s API. Key aspects:
  • Authentication with your API
  • Methods for each API endpoint
  • Error handling for API calls
  • Transformation of API responses
Example implementation:

6. capabilities_read.py

Purpose: Implements read operations (list_accounts, list_resources, etc.). Key aspects:
  • Translates between your API and Lumos data formats
  • Handles pagination
  • Implements error handling
Example implementation:

7. capabilities_write.py

Purpose: Implements write operations (create_account, assign_entitlement, etc.). Key aspects:
  • Translates Lumos requests to your API format
  • Handles creation, updates, and deletion of entities
  • Implements error handling
Example implementation:

8. integration.py

Purpose: The main configuration file that registers capabilities and sets up the connector. Key aspects:
  • Defines connector metadata (name, description, logo)
  • Registers capabilities
  • Configures error handling
  • Specifies authentication type
Example implementation:

9. main.py

Purpose: Entry point for the CLI tool. Key aspects:
  • Very simple - just runs the integration
Example implementation:

10. __about__.py

Purpose: Contains version information. Example implementation:

Testing Your Connector

Run these commands to test your connector:

Common Authentication Types

Lumos supports multiple authentication methods:
  • OAuthCredential - For OAuth 2.0 flows
  • BasicCredential - For username/password authentication
  • TokenCredential - For API key or token-based authentication
  • JWTCredential - For JWT-based authentication
Choose the appropriate type in your integration.py.

Key Capabilities

Here are the most important capabilities to implement:
  1. validate_credentials (Required) - Verifies connection and credentials
  2. list_accounts - Lists user accounts
  3. list_resources - Lists available resources (projects, teams, etc.)
  4. list_entitlements - Lists available entitlements (roles, permissions)
  5. find_entitlement_associations - Shows which users have which entitlements
The write capabilities are optional but useful:
  1. create_account - Creates a new user account
  2. assign_entitlement - Grants access/permissions to a user
  3. unassign_entitlement - Removes access/permissions from a user

Troubleshooting Tips

  • Authentication issues: Check token format and scope permissions
  • Missing data: Verify field mappings between your API and Lumos models
  • Pagination errors: Ensure your NextPageToken implementation is correct
  • Type errors: Run mypy . to catch type mismatches

Next Steps

After implementing the basic connector:
  1. Add more capabilities - Implement additional read/write capabilities
  2. Improve error handling - Add specific exception handlers
  3. Add custom attributes - For application-specific user properties
  4. Add OAuth support - If your application uses OAuth
For more detailed guidance, refer to the full documentation or the complete tutorial.