Extension Client Module
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The Extension Client Module provides a unified, enterprise-grade interface for interacting with Oracle Integration Cloud (OIC). It consolidates authentication, API operations, and complex workflow executions (such as file transfers and scheduled orchestrations) into a single FlextOracleOicClient class. This module is built upon the flext-api framework, utilizing railway-oriented error handling to ensure robust integration with Oracle's cloud infrastructure.
Sources: src/flext_oracle_oic/ext_client.py:1-25
The module serves as the core communication layer for the flext-oracle-oic project, translating high-level service requests into authenticated REST API calls. It handles OAuth2 client credentials flows, automatic token management, and standardized pagination for resource-heavy endpoints like integrations, connections, and packages.
Sources: src/flext_oracle_oic/ext_client.py:115-180, src/flext_oracle_oic/services/integration_crud.py:20-45
Architecture and Core Components
The FlextOracleOicClient Class
The primary entry point is the FlextOracleOicClient. It is designed with a context manager pattern to ensure proper lifecycle management of the underlying HTTP client.
The diagram shows the relationship between the client and its required configuration models.
Sources: src/flext_oracle_oic/ext_client.py:28-60, src/flext_oracle_oic/models.py:32-80
Authentication Logic
Authentication utilizes the OAuth2 Client Credentials flow. The client manages the acquisition and storage of access tokens, injecting them as Bearer tokens into subsequent API requests.
This flow illustrates the transition from basic credential encoding to bearer-token authenticated requests.
Sources: src/flext_oracle_oic/ext_client.py:115-135, src/flext_oracle_oic/ext_client.py:280-320
API Operations and Data Flow
Request Handling
All requests are routed through the make_request method, which enforces a specific execution pipeline:
- Validate client initialization.
- Ensure valid authentication (acquiring a token if necessary).
- Execute the API call via
FlextApi. - Parse and normalize the response.
Sources: src/flext_oracle_oic/ext_client.py:182-210
Supported Resource Endpoints
The module provides specialized methods for the most common Oracle OIC REST resources:
| Resource | Method | Endpoint | Description |
|---|---|---|---|
| Integrations | get_integrations | /integrations | Retrieves list of integration flows with status filtering. |
| Connections | get_connections | /connections | Retrieves adapter connections with type filtering. |
| Packages | get_packages | /packages | Lists integration packages. |
| Lookups | get_lookups | /lookups | Retrieves lookup table metadata. |
| Orchestration | execute_scheduled_orchestration | /integrations/{id}/schedules | Triggers scheduled integration runs. |
Sources: src/flext_oracle_oic/ext_client.py:100-180
Pagination Pattern
To handle large datasets, the module implements a standard offset-based pagination strategy. It automatically follows the hasMore flag returned by Oracle OIC until all records are retrieved.
The flowchart visualizes the loop responsible for gathering multi-page results into a single sequence.
Sources: src/flext_oracle_oic/ext_client.py:212-250
Configuration and Settings
The client is configured via the FlextOracleOicSettings and corresponding Pydantic models. These settings can be loaded from environment variables with the FLEXT_ORACLE_OIC_ prefix.
| Setting | Type | Default | Description |
|---|---|---|---|
base_url | String | https://localhost... | The OIC instance URL. |
api_version | Enum | v1 | Target OIC API version. |
request_timeout | Integer | 30 | Network timeout in seconds. |
oauth_token_url | String | base_url + /oauth/token | The IDCS token endpoint. |
verify_ssl | Boolean | True | Whether to verify SSL certificates. |
Sources: src/flext_oracle_oic/settings.py:25-50, src/flext_oracle_oic/constants.py:65-75
Implementation Details
Client Credential Encoding
The client manually handles the encoding of credentials for the initial token request.
def encode_client_credentials(self) -> str:
"""Encode client credentials for HTTP Basic authentication."""
client_id = self.auth_config.oauth_client_id
client_secret = self.auth_config.oauth_client_secret.get_secret_value()
credentials = f"{client_id}:{client_secret}"
return base64.b64encode(credentials.encode()).decode()
Sources: src/flext_oracle_oic/ext_client.py:88-93
Integration Lifecycle Operations
Beyond simple fetches, the module supports the full CRUD lifecycle via mixins that leverage the core client.
- Create: Validates integration data before POSTing to
/integrations. - Update: Uses PUT on
/integrations/{id}to modify existing flows. - Delete: Issues a DELETE request to the integration endpoint.
Sources: src/flext_oracle_oic/services/integration_crud.py:25-100
Summary
The Extension Client Module encapsulates the complexities of Oracle Integration Cloud communication. By providing a unified FlextOracleOicClient that manages authentication, pagination, and standardized error handling, it allows higher-level services to perform enterprise operations—such as deploying integrations or monitoring connections—without managing raw HTTP state or identity tokens.
Sources: src/flext_oracle_oic/ext_client.py:28-40, src/flext_oracle_oic/main.py:40-60