Integration CRUD Operations
Relevant source files
The following files were used as context for generating this wiki page:
Integration CRUD (Create, Read, Update, Delete) Operations within the flext-oracle-oic project provide a standardized interface for managing Oracle Integration Cloud (OIC) resources. These operations are implemented as a mixin service that leverages a unified client to interact with the Oracle OIC REST API, ensuring that integration metadata and connection configurations are handled consistently across the enterprise.
The system utilizes railway-oriented programming via a Result pattern to handle errors gracefully, ensuring that network failures or API errors are captured and returned without crashing the service execution flow. This module is essential for lifecycle management, allowing developers to programmatically deploy, retrieve, modify, and remove integration flows and their associated connections.
Architecture and Components
The CRUD functionality is structured as a mixin class, FlextOracleOicIntegrationCrudMixin, which is inherited by the main service facade. It relies on a specialized FlextOracleOicClient for low-level HTTP communication and OAuth2 authentication.
Service Layer Interaction
The following diagram illustrates the relationship between the API Facade, the CRUD Mixin, and the underlying REST Client.
Key Data Models
The CRUD operations primarily interact with two entities defined in the FlextOracleOicModels.OracleOic namespace:
| Model | Description | Key Fields |
|---|---|---|
OICIntegrationInfo | Represents metadata for an OIC integration flow. | integration_id, name, status, integration_version |
OICConnectionInfo | Represents metadata for an adapter connection. | connection_id, name, adapter_type, status |
Sources: src/flext_oracle_oic/models.py:91-140
Core CRUD Logic
Integration Creation and Deployment
Creating an integration involves sending configuration data to the /integrations endpoint. The service handles the mapping from raw JSON responses to the structured OICIntegrationInfo model.
Integration Retrieval (Fetch)
The fetch_integration method retrieves a specific integration by its ID. Because the OIC API often returns lists, the mixin performs a lookup within the list returned by the client's get_integrations call to find the matching identifier.
Sources: src/flext_oracle_oic/services/integration_crud.py:58-96
Validation Utilities
Before data is sent to OIC, the system can utilize FlextOracleOicUtilitiesOracleOic to validate integration fields.
- Name Validation: Checks against
INTEGRATION_NAME_REand length constraints (1-100 characters). - Version Validation: Ensures the
XX.XX.XXXXformat usingVERSION_PATTERN. - Status Validation: Validates against a set of allowed statuses such as
ACTIVATED,DRAFT, orERROR.
Sources: src/flext_oracle_oic/_utilities/oracle_oic.py:46-78, src/flext_oracle_oic/constants.py:214-230
API Endpoints and Mappings
The following table summarizes how the high-level CRUD methods map to the internal Client methods and the resulting OIC API endpoints.
| Service Method | Client Method | HTTP Method | OIC API Endpoint |
|---|---|---|---|
create_integration | create_integration | POST | /integrations |
fetch_integration | get_integrations | GET | /integrations |
update_integration | update_integration | PUT | /integrations/{id} |
delete_integration | make_request | DELETE | /integrations/{id} |
list_connections | get_connections | GET | /connections |
Sources: src/flext_oracle_oic/services/integration_crud.py:100-165, src/flext_oracle_oic/ext_client.py:76-84, 150-165, 237-248
Connection Management
The list_connections operation supports filtering by adapter type (e.g., REST, SOAP, DATABASE). It uses pagination to handle large sets of connection resources, iterating through pages using offset and limit parameters until hasMore is false.
Sources: src/flext_oracle_oic/services/integration_crud.py:177-217, src/flext_oracle_oic/ext_client.py:150-158, 203-235
Error Handling Pattern
The CRUD operations utilize a unified exception handling capture for c.EXC_NETWORK_TYPE. If a network-level error occurs during any API call, the mixin logs the exception and returns a failed Result object using fail_op, which includes the operation context (e.g., "Integration deletion").
Sources: src/flext_oracle_oic/services/integration_crud.py:133-143, 169-175
Conclusion
The Integration CRUD Operations provide a robust, type-safe, and validated gateway for managing Oracle Integration Cloud resources. By abstracting the complexities of OIC's REST API and pagination logic into a clean mixin architecture, the project enables consistent resource lifecycle management across different execution contexts, from CLI tools to automated deployment pipelines.