API Interface
Relevant source files
The following files were used as context for generating this wiki page:
The API Interface for flext-tap-ldap provides a structured gateway for interacting with LDAP directory services and processing LDIF (LDAP Data Interchange Format) data. It is primarily built upon the FlextTapLdapClient, which abstracts complex LDAP operations into a simplified interface suitable for Singer tap workflows, and the FlextTapLdapTap class, which manages the lifecycle of data extraction, stream discovery, and CLI execution.
This interface supports standard LDAP operations such as connection testing, health checks, and directory searches, alongside specialized capabilities for Oracle OID support and LDIF file transformation. By delegating core logic to underlying libraries like flext-ldap and flext-ldif, the API ensures consistency and technical accuracy across diverse directory service environments.
Sources: src/flext_tap_ldap/client.py:21-35, src/flext_tap_ldap/tap.py:34-45
LDAP Client Interface
The LDAPClient serves as the primary operational interface for directory interactions. It utilizes a Parameter Object Pattern, accepting m.Ldap.ConnectionConfig for initialization, but also maintains keyword-argument convenience for testing and rapid development.
Connection and Health Management
The client provides methods to validate connectivity and report system health status. The health_check method aggregates connection test results and response latency to provide a high-level status of the LDAP service.
The health check calculates response_time_ms by measuring the interval required for a limited search against the base_dn.
Sources: src/flext_tap_ldap/client.py:91-105, src/flext_tap_ldap/client.py:164-178
Search Operations
Search functionality is divided into standard and specialized (Oracle) flows. The standard search method performs synchronous queries using the flext-ldap infrastructure, applying normalization to scopes and attributes.
| Parameter | Type | Default | Description |
|---|---|---|---|
base_dn | str | N/A | The starting point for the LDAP search. |
search_filter | str | (objectClass=*) | The LDAP filter string. |
attributes | StrSequence | None | List of attributes to retrieve. |
scope | str | SUBTREE | Search depth (BASE, ONELEVEL, SUBTREE). |
size_limit | int | 0 | Maximum number of entries to return. |
Sources: src/flext_tap_ldap/client.py:107-130, src/flext_tap_ldap/_utilities/client_support.py:28-40
LDIF Processing API
The API includes a robust LDIF processing suite located within the u.TapLdap namespace. This suite allows for parsing, validating, and transforming LDIF data through specialized inner classes.
Processor, Validator, and Transformer
The processing architecture follows a modular approach:
- Processor: Handles the loading of LDIF data from files or strings, converting raw content into
Entryobjects. - Validator: Leverages
flext-ldifto ensure entries comply with LDAP structural rules. - Transformer: Applies attribute mapping, value mapping, and schema normalization.
Tap and CLI Interface
The FlextTapLdapTap class implements the FlextMeltanoAbstractions protocol, facilitating integration with Meltano and the Singer ecosystem.
Stream Discovery
The discover_streams method dynamically generates the Singer catalog. It identifies standard streams (Users, Groups, OUs, Schema) and conditionally adds LDIF-based streams if enable_ldif_streams is set in the configuration.
Configuration Schema
The API defines a JSON Schema for tap settings, ensuring that configurations provided via CLI or Meltano environments are strictly validated.
| Field | Type | Description |
|---|---|---|
host | string | LDAP server hostname. |
port | integer | LDAP server port (default 389). |
bind_dn | string | Distinguished Name for authentication. |
use_ssl | boolean | Whether to use an encrypted connection. |
enable_ldif_streams | boolean | Flag to enable LDIF processing capabilities. |
Sources: src/flext_tap_ldap/tap.py:53-100, src/flext_tap_ldap/models.py:75-95
Oracle OID Support Interface
Specialized logic is provided for Oracle Internet Directory (OID) environments. This includes attribute extension and structural normalization (e.g., mapping orclPassword to userPassword).
The search_with_oracle_support method manages a dedicated event loop to handle these searches safely, preventing interference with the primary tap execution loop.
Sources: src/flext_tap_ldap/client.py:132-159, src/flext_tap_ldap/_utilities/client_support.py:84-118
The API Interface enables a high degree of flexibility by combining low-level directory access with high-level data transformation utilities, supporting both direct directory extraction and LDIF-based migration workflows.