Public API Surface
Relevant source files
The following files were used as context for generating this wiki page:
The Public API Surface of flext-target-ldap provides a structured interface for loading Singer-compatible data into LDAP directories. It leverages the flext-core framework to manage configuration, dependency injection, and orchestration while providing specialized sinks for common LDAP object types such as Users, Groups, and Organizational Units.
The primary entry point is the FlextTargetLdap facade class, which encapsulates the logic for stream-to-sink mapping and CLI execution. This API is designed to handle standard Singer messages (SCHEMA, RECORD, STATE) and translate them into LDAP operations including entry addition, modification, and deletion.
Sources: src/flext_target_ldap/api.py:15-32, src/flext_target_ldap/__init__.py:41-60
Main Facade: FlextTargetLdap
The FlextTargetLdap class serves as the central authority for the target's operation. It inherits from FlextTargetLdapTarget and implements the core Singer target lifecycle, including setup, configuration validation, and teardown.
Key Components and Responsibilities
- Orchestration: Manages the
FlextTargetLdapOrchestratorto coordinate processing logic. - Sink Mapping: Routes incoming Singer streams to specific LDAP sink implementations.
- CLI Interface: Provides a static
run_climethod to process standard input streams.
Stream and Sink Architecture
The API uses a specialized sink system to handle different LDAP object categories. When a stream is processed, the target identifies the appropriate sink class based on the stream name.
| Stream Name | Sink Class | Description |
|---|---|---|
users | FlextTargetLdapUsersSink | Handles user entries, mapping fields like email to mail. |
groups | FlextTargetLdapGroupsSink | Manages group entries and member lists. |
organizational_units | FlextTargetLdapOrganizationalUnitsSink | Manages OU structure within the directory. |
| Others | FlextTargetLdapBaseSink | Fallback sink for generic LDAP entries. |
Sources: src/flext_target_ldap/api.py:75-96, src/flext_target_ldap/_models/sinks.py:302-458
Record Processing Flow
The processing logic translates JSON records into Distinguished Names (DNs) and LDAP attribute sets.
LDAP Client Interface
The FlextTargetLdapClient is the low-level utility used by sinks to interact with the LDAP server. It delegates operations to the flext-ldap library.
Core Client Methods
add_entry(dn, attributes, object_classes): Creates a new entry in the directory.modify_entry(dn, changes): Updates attributes of an existing entry usingREPLACEoperations.delete_entry(dn): Removes an entry from the directory.search_entry(base_dn, search_filter, attributes): Queries the directory for specific entries.connect() / disconnect(): Manages the lifecycle of the LDAP session.
Sources: src/flext_target_ldap/_utilities/client.py:123-287
Service Runtime and Adapters
For integration with higher-level Meltano or Singer environments, the API provides a FlextTargetLdapServiceRuntime. This module contains adapter classes that bridge the gap between generic Singer sinks and the specialized LDAP runtime sinks.
Adapter Components
- Runtime Sink Adapter: A
SingerSinkBasesubclass that wraps aFlextTargetLdapSink. It ensures that record handling is delegated correctly to the LDAP-specific logic. - Schema Normalization: Converts flat Singer schemas into the mutable payloads expected by the LDAP runtime.
Sources: src/flext_target_ldap/_utilities/service_runtime.py:15-102
Summary of Public Exports
The package organizes its public surface through lazy loading to optimize performance. Key exported symbols include:
- Facades:
FlextTargetLdap,target_ldap - Models:
FlextTargetLdapSettings,FlextTargetLdapModels(m) - Utilities:
FlextTargetLdapUtilities(u),FlextTargetLdapClient - Constants:
FlextTargetLdapConstants(c)
Sources: src/flext_target_ldap/__init__.py:41-86, src/flext_target_ldap/_exports_lazy_part_01.py:12-45
This API surface ensures a clean separation between Singer protocol handling and LDAP directory operations, allowing for extensible data loading strategies across various LDAP implementations.