Repository navigation
CXP-481 Support for Incremental Sync #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
566a40c
a79d0e0
f1c9e74
cff220b
2d9eded
28c9e4e
695c81a
f5e1226
caf49c6
10d89e7
c33b364
4813715
4ad2f4a
077423f
8385e9c
7e32e4d
94ee628
15cbd40
0667867
edfd9ea
5b62739
9b3b8ed
3745cfc
8247b6b
ea155a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| --- | ||
| # Connector Configuration Reference | ||
| # =============================== | ||
| # =================================== | ||
| # This is a reference configuration demonstrating all available options | ||
| # and their purposes in a connector configuration file. | ||
|
|
||
|
|
@@ -10,7 +10,7 @@ app_name: Example Application | |
| # Connection Configuration | ||
| # ---------------------- | ||
| # Specifies how to connect to the data source. Supports various connection methods. | ||
| # | ||
| # | ||
| # RECOMMENDED: Use structured fields! | ||
| connect: | ||
| scheme: "mysql" | ||
|
|
@@ -32,135 +32,185 @@ connect: | |
| # connect: | ||
| # dsn: "mysql://${DB_USER}:${DB_PASS}@${DB_HOST}:3306/${DB_NAME}?parseTime=true" | ||
|
|
||
| # Event Feed Settings (Optional) | ||
| # ------------------------------ | ||
| # Global settings for the event feed (incremental change detection). | ||
| # When any resource type or grants query has event_feed configured, the connector | ||
| # automatically exposes an EventFeed to ConductorOne for efficient change detection. | ||
| # | ||
| # Each poll re-reads rows from `overlap` before the last committed timestamp, so rows that share | ||
| # a timestamp or commit late are not missed. Re-read rows produce the same event IDs and are | ||
| # de-duplicated by ConductorOne. Event feed queries should filter with `>= ?<since>` and order by | ||
| # the cursor column plus the pagination primary key, so offset paging is stable. | ||
| event_feed: | ||
| default_lookback: 3h # How far back to look on first run; any Go duration string | ||
| overlap: 60s # How far before the committed cursor each poll starts; defaults to 60s | ||
|
|
||
| # Resource Types | ||
| # ------------- | ||
| # Defines the resources that can be synchronized from the data source. | ||
| # Each resource type represents a distinct entity type (e.g., users, groups, roles). | ||
| resource_types: | ||
|
|
||
| # Example User Resource | ||
| # ------------------- | ||
| # --------------------- | ||
| user: | ||
| name: "User" # Display name for this resource type | ||
| name: "User" | ||
| description: "Represents a user account in the system" | ||
|
|
||
| # Targeted Sync — Get Query | ||
| # ------------------------- | ||
| # Fetches a single resource by ID. Required when event_feed is configured | ||
| # on this resource type. Uses the same list.map for column mapping. | ||
| get: | ||
| query: | | ||
| SELECT id, username, email, created_at, status, department, updated_at | ||
| FROM users | ||
| WHERE id = ?<resource_id> | ||
|
|
||
| # List Configuration | ||
| # ---------------- | ||
| # Defines how to retrieve a list of resources | ||
| # ------------------ | ||
| # Defines how to retrieve a paginated list of resources. | ||
| list: | ||
| # SQL query to fetch resources. Supports multiple query types: | ||
| # - Direct SQL queries | ||
| # - Stored procedure calls | ||
| # - Complex joins and subqueries | ||
| query: | | ||
| SELECT | ||
| SELECT | ||
| id, | ||
| username, | ||
| email, | ||
| created_at, | ||
| status, | ||
| department | ||
| department, | ||
| updated_at | ||
| FROM users | ||
| WHERE status = 'active' | ||
| AND id > ?<Cursor> | ||
| WHERE id > ?<Cursor> | ||
| ORDER BY id ASC | ||
| LIMIT ?<Limit> | ||
|
|
||
| # Mapping Configuration | ||
| # ------------------- | ||
| # Defines how to transform raw data into standardized resource objects | ||
| map: | ||
| # Required Fields | ||
| # -------------- | ||
| # These fields are required for all resources | ||
| id: ".id" # Maps the 'id' column to the resource ID | ||
| display_name: ".username" # Human-readable name | ||
| description: "string(.department) + ' department user'" # Can use CEL expressions | ||
|
|
||
| # Optional Traits | ||
| # -------------- | ||
| # Custom attributes specific to this resource type | ||
| id: ".id" | ||
| display_name: ".username" | ||
| description: "string(.department) + ' department user'" | ||
| traits: | ||
| user: | ||
| # The trait name defines the schema | ||
| emails: | ||
| # Array fields | ||
| - ".email" # Direct field mapping | ||
| - "lowercase(.email)" # CEL transformation | ||
| status: ".status" # Simple field mapping | ||
| - ".email" | ||
| status: ".status" | ||
| profile: | ||
| department: ".department" | ||
| joined_date: ".created_at" | ||
| # Complex CEL transformation example | ||
| full_name: "titleCase(.first_name) + ' ' + titleCase(.last_name)" | ||
| pagination: | ||
| strategy: "cursor" | ||
| primary_key: "id" | ||
|
|
||
| # Pagination Configuration | ||
| # ---------------------- | ||
| # Defines how to handle large result sets | ||
| # Resource Event Feed | ||
| # ------------------- | ||
| # Detects new/modified resources via timestamp filtering. Emits a ResourceChangeEvent | ||
| # per row; C1 then calls the get query above to re-fetch the full resource. | ||
| # ?<since> is automatically injected with the cursor timestamp for this source. | ||
| event_feed: | ||
| query: | | ||
| SELECT id, username, email, created_at, status, department, updated_at | ||
| FROM users | ||
| WHERE updated_at >= ?<since> | ||
| ORDER BY updated_at ASC, id ASC | ||
| LIMIT ?<Limit> OFFSET ?<Offset> | ||
| cursor_column: updated_at # Column whose max value advances this source's cursor | ||
| pagination: | ||
| strategy: "cursor" # Options: "cursor", "offset" | ||
| primary_key: "id" # Column used for pagination tracking | ||
| strategy: offset | ||
| primary_key: id | ||
|
|
||
| # Static Entitlements | ||
| # ------------------ | ||
| # Pre-defined permissions that can be granted | ||
| # ------------------- | ||
| # Pre-defined permissions that can be granted. | ||
| static_entitlements: | ||
| - id: "access" # Unique identifier for this entitlement | ||
| - id: "access" | ||
| display_name: "Basic Access" | ||
| description: "Provides basic access to the application" | ||
| purpose: "access" # Purpose: "access", "assignment", "permission" | ||
| purpose: "assignment" | ||
| grantable_to: | ||
| # Resource types that can receive this entitlement | ||
| - "user" | ||
| - "service_account" | ||
| # Provisioning Configuration | ||
| # ------------------------ | ||
| # Defines how to implement entitlement changes | ||
| provisioning: | ||
| vars: | ||
| # Variables available in provisioning queries | ||
| user_id: "principal.ID" | ||
| access_level: "'basic'" | ||
|
|
||
| # Grant Operations | ||
| # --------------- | ||
| # Grant revives a soft-deleted row, or inserts a new one. Upsert syntax depends on | ||
| # the database (e.g. ON CONFLICT in PostgreSQL, MERGE in SQL Server or Oracle). | ||
| grant: | ||
| # SQL statements to execute when granting | ||
| queries: | ||
| - | | ||
| UPDATE user_access | ||
| SET deleted_at = NULL, updated_at = CURRENT_TIMESTAMP | ||
| WHERE user_id = ?<user_id> AND level = ?<access_level> AND deleted_at IS NOT NULL | ||
| - | | ||
| INSERT INTO user_access (user_id, level) | ||
| VALUES (?<user_id>, ?<access_level>) | ||
|
|
||
| # Revoke Operations | ||
| # ---------------- | ||
| SELECT ?<user_id>, ?<access_level> FROM DUAL | ||
| WHERE NOT EXISTS ( | ||
| SELECT 1 FROM user_access WHERE user_id = ?<user_id> AND level = ?<access_level> | ||
|
Comment on lines
+145
to
+150
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion (medium confidence): The grant queries read and write a |
||
| ) | ||
| # Revoke soft-deletes so the grants event feed's revokes_query can report it. | ||
| revoke: | ||
| # SQL statements to execute when revoking | ||
| queries: | ||
| - | | ||
| DELETE FROM user_access | ||
| WHERE user_id = ?<user_id> | ||
| UPDATE user_access | ||
| SET deleted_at = CURRENT_TIMESTAMP, updated_at = CURRENT_TIMESTAMP | ||
| WHERE user_id = ?<user_id> AND deleted_at IS NULL | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion (medium confidence): The revoke is scoped by |
||
|
|
||
| # Grants Query Configuration | ||
| # ------------------------ | ||
| # Defines how to discover existing entitlements | ||
| # -------------------------- | ||
| # Defines how to discover existing entitlement assignments. | ||
| grants: | ||
| - query: | | ||
| SELECT | ||
| SELECT | ||
| id AS grant_id, | ||
| user_id, | ||
| access_level, | ||
| granted_at | ||
| updated_at | ||
| FROM user_access | ||
| WHERE deleted_at IS NULL | ||
| LIMIT ?<Limit> OFFSET ?<Offset> | ||
|
|
||
| # Grant Mapping | ||
| # ------------ | ||
| # Defines how to interpret grant query results | ||
| map: | ||
| - skip_if: ".access_level != 'basic'" # CEL condition to filter results | ||
| - skip_if: ".access_level != 'basic'" | ||
| principal_id: ".user_id" | ||
| principal_type: "user" | ||
| entitlement_id: "access" | ||
| # Grants Pagination | ||
| # ---------------- | ||
| pagination: | ||
| strategy: "offset" | ||
| primary_key: "user_id" | ||
| # Example: groups, roles, applications, etc. | ||
| primary_key: "grant_id" | ||
|
|
||
| # Grants Event Feed | ||
| # ----------------- | ||
| # Detects new and revoked grants without a full re-sync. | ||
| # The parent map is reused for row-to-grant mapping. | ||
| # NOTE: CEL expressions in map must not reference resource trait fields | ||
| # (display_name, description, etc.) in this context — only row columns are available. | ||
| event_feed: | ||
| resource_id: ".user_id" # CEL expr: extracts resource ID from each row | ||
| # (required — event feed queries span ALL resources) | ||
| changes_query: | | ||
| SELECT id AS grant_id, user_id, access_level, updated_at | ||
| FROM user_access | ||
| WHERE deleted_at IS NULL | ||
| AND updated_at >= ?<since> | ||
| ORDER BY updated_at ASC, id ASC | ||
| LIMIT ?<Limit> OFFSET ?<Offset> | ||
| # updated_at must change on every insert and update (a trigger or ON UPDATE default). | ||
| changes_cursor_column: updated_at | ||
|
|
||
| # Optional: only configure when the table soft-deletes rows. Hard deletes can't be | ||
| # detected. When set, the full-sync grants query must exclude soft-deleted rows, revoke | ||
| # must soft-delete, and grant must revive a soft-deleted row (see provisioning above). | ||
| revokes_query: | | ||
| SELECT id AS grant_id, user_id, access_level, deleted_at | ||
| FROM user_access | ||
| WHERE deleted_at >= ?<since> | ||
| ORDER BY deleted_at ASC, id ASC | ||
| LIMIT ?<Limit> OFFSET ?<Offset> | ||
| revokes_cursor_column: deleted_at | ||
|
|
||
| pagination: | ||
| strategy: offset | ||
| primary_key: grant_id # Must be present in both changes_query and revokes_query SELECTs | ||
|
|
||
| # Example: add groups, roles, applications, etc. following the same pattern. | ||
Uh oh!
There was an error while loading. Please reload this page.