Constants & Magic Strings
Relevant source files
The following files were used as context for generating this wiki page:
The flext-tap-oracle-oic project utilizes a centralized constants architecture to ensure consistency across API interactions, data modeling, and configuration management. These constants extend the core flext-core and flext-oracle-oic platforms, providing specific magic strings and values required for Oracle Integration Cloud (OIC) operations.
This module acts as the Single Source of Truth (SSOT) for regex patterns, API paths, status enumerations, and default configuration values. By leveraging StrEnum and Final types, the project maintains type safety and prevents hardcoding of strings within business logic.
Sources: src/flext_tap_oracle_oic/constants.py:1-20, src/flext_tap_oracle_oic/models.py:75-80
API and Network Constants
The tap defines specific paths and thresholds for interacting with various OIC API categories, including Core, Monitoring, B2B, and Process integrations.
API Base Paths
| Constant Name | Value | Description |
|---|---|---|
OIC_API_BASE_PATH | /ic/api/integration/v1 | Core integration API path |
OIC_MONITORING_API_PATH | /ic/api/monitoring/v1 | Monitoring and execution API path |
OIC_B2B_API_PATH | /ic/api/b2b/v1 | B2B integration API path |
OIC_PROCESS_API_PATH | /ic/api/process/v1 | Process automation API path |
Sources: src/flext_tap_oracle_oic/constants.py:47-50
HTTP Status Thresholds
The project uses specific magic numbers to categorize HTTP responses and trigger error handling logic in OICBaseStream.
- HTTP_ERROR_STATUS_THRESHOLD: 400 (Base for error classification)
- HTTP_UNAUTHORIZED: 401 (Triggers
AuthenticationError) - HTTP_FORBIDDEN: 403 (Triggers
AuthorizationError) - HTTP_RATE_LIMITED: 429 (Triggers
RateLimitError)
Sources: src/flext_tap_oracle_oic/constants.py:73-76, src/flext_tap_oracle_oic/models.py:284-300
Regex Authority Patterns
Regex constants are used for input validation, OCI region discovery from URLs, and string normalization for Singer-compatible identifiers.
OCI_REGION_RE*: (\w+-\w+-\d+) - Used to extract regions like us-ashburn-1 from integration URLs.
- NORMALIZE_NON_ALNUM_RE:
[^a-zA-Z0-9]- Used to replace non-alphanumeric characters with underscores. - SANITIZE_CAMEL_BOUNDARY_RE:
(?<!^)(?=[A-Z])- Used to insert underscores at camelCase boundaries.
Sources: src/flext_tap_oracle_oic/constants.py:32-41, src/flext_tap_oracle_oic/utilities.py:192-220
Enumerated Statuses and Types
The project heavily uses StrEnum to define magic strings for resource types and lifecycle statuses. This ensures that only valid OIC statuses are processed.
OIC Resource Types
Used in OICResourceType to identify the target entity:
INTEGRATION: "integration"CONNECTION: "connection"CERTIFICATE: "certificate"PACKAGE: "package"PROJECT: "project"
Sources: src/flext_tap_oracle_oic/constants.py:157-163
Lifecycle Statuses
| Enum Class | Values |
|---|---|
OicIntegrationStatus | CONFIGURED, ACTIVATED, DEACTIVATED, DRAFT, ERROR, FAILED, LOCKED |
OicJobStatus | COMPLETED, FAILED, RUNNING, PENDING, ABORTED |
OicAgentStatus | ONLINE, OFFLINE, ERROR |
OicHealthStatus | healthy, unhealthy, warning, unknown, degraded |
Sources: src/flext_tap_oracle_oic/constants.py:87-133
Configuration and Paging Defaults
Defaults are defined for the Singer tap behavior, including page sizes, timeouts, and replication methods.
Operational Defaults
- DEFAULT_PAGE_SIZE: 50
- MAX_PAGE_SIZE: 1000
- DEFAULT_BATCH_SIZE: 100
- DEFAULT_MAX_RETRIES: 3
- MIN_TOKEN_EXPIRY_BUFFER: 60 (seconds)
Sources: src/flext_tap_oracle_oic/constants.py:43-71
Stream Registration Magic Strings
The ALL_STREAMS registry maps magic strings to internal stream class implementations.
# Stream registry - maps stream names to their classes
ALL_STREAMS: t.MappingKV[str, type[m.TapOracleOic.OICBaseStream]] = {
"integrations": FlextTapOracleOicModelsStreams.IntegrationsStream,
"connections": FlextTapOracleOicModelsStreams.ConnectionsStream,
"packages": FlextTapOracleOicModelsStreams.PackagesStream,
"lookups": FlextTapOracleOicModelsStreams.LookupsStream,
"libraries": FlextTapOracleOicModelsStreams.LibrariesStream,
}
Sources: src/flext_tap_oracle_oic/_models/streams.py:539-550
Configuration Settings (SettingsConfigDict)
The FlextTapOracleOicSettings class defines the environment variable prefix and the standard configuration keys used by the tap.
- ENV_PREFIX:
FLEXT_TAP_ORACLE_OIC_ - DEFAULT_TOKEN_URL:
{c.OracleOic.DEFAULT_BASE_URL}/oauth/token - DEFAULT_TIMEOUT: 30 (seconds, derived via
c.DEFAULT_TIMEOUT_SECONDS)
Sources: src/flext_tap_oracle_oic/settings.py:22-38, src/flext_tap_oracle_oic/tap.py:182-192
Summary of Usage Logic
The architecture follows a strict hierarchy where constants define the "What" (values) and utilities/models implement the "How" (logic). For example, FlextTapOracleOicUtilities.sanitize_oic_field_name uses the SANITIZE_NON_IDENTIFIER_RE constant to transform raw API field names into safe Singer property names.
Similarly, the OICBaseStream.url_base property uses OIC_API_BASE_PATH and OCI_REGION_RE to dynamically construct OIC endpoints based on the api_category constant assigned to each stream class.
Sources: src/flext_tap_oracle_oic/models.py:133-167, src/flext_tap_oracle_oic/utilities.py:206-224