Implementation Workflow
When implementing a connector, follow this recommended order:- Define settings in
settings.py- what configuration does your connector need? - Define resources and entitlements in
enums.py- map your app’s concepts to Lumos - Set up constants in
constants.py- define API URLs and other constants - Implement the client in
client.py- create methods for API communication - Implement validate_credentials in
capabilities_read.py- this is the minimum required capability - Implement read capabilities in
capabilities_read.py- typically easier to implement - Implement write capabilities in
capabilities_write.py- as needed - Configure the integration in
integration.py- register your implemented capabilities
Minimum Viable Connector
A minimal connector needs:- settings.py - Defining what configuration users need to provide
- enums.py - Defining resource and entitlement types (can be minimal)
- client.py - With at least enough functionality to validate credentials
- capabilities_read.py - With at least validate_credentials implemented
- 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
2. constants.py
Purpose: Stores constant values used throughout the connector, like API paths.
Key aspects:
- API endpoints
- Default values
- URL templates
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
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
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
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
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
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
9. main.py
Purpose: Entry point for the CLI tool.
Key aspects:
- Very simple - just runs the integration
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
integration.py.
Key Capabilities
Here are the most important capabilities to implement:- validate_credentials (Required) - Verifies connection and credentials
- list_accounts - Lists user accounts
- list_resources - Lists available resources (projects, teams, etc.)
- list_entitlements - Lists available entitlements (roles, permissions)
- find_entitlement_associations - Shows which users have which entitlements
- create_account - Creates a new user account
- assign_entitlement - Grants access/permissions to a user
- 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:- Add more capabilities - Implement additional read/write capabilities
- Improve error handling - Add specific exception handlers
- Add custom attributes - For application-specific user properties
- Add OAuth support - If your application uses OAuth