Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Connector API] Implement update last_sync endpoint (#102858)
- Loading branch information
Showing
14 changed files
with
669 additions
and
62 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
rest-api-spec/src/main/resources/rest-api-spec/api/connector.last_sync.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"connector.last_sync": { | ||
"documentation": { | ||
"url": "https://www.elastic.co/guide/en/enterprise-search/current/connectors.html", | ||
"description": "Updates the stats of last sync in the connector document." | ||
}, | ||
"stability": "experimental", | ||
"visibility": "feature_flag", | ||
"feature_flag": "es.connector_api_feature_flag_enabled", | ||
"headers": { | ||
"accept": [ | ||
"application/json" | ||
], | ||
"content_type": [ | ||
"application/json" | ||
] | ||
}, | ||
"url": { | ||
"paths": [ | ||
{ | ||
"path": "/_connector/{connector_id}/_last_sync", | ||
"methods": [ | ||
"PUT" | ||
], | ||
"parts": { | ||
"connector_id": { | ||
"type": "string", | ||
"description": "The unique identifier of the connector to be updated." | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"body": { | ||
"description": "Object with stats related to the last connector sync run.", | ||
"required": true | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
...lRestTest/resources/rest-api-spec/test/entsearch/334_connector_update_last_sync_stats.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
setup: | ||
- skip: | ||
version: " - 8.11.99" | ||
reason: Introduced in 8.12.0 | ||
|
||
- do: | ||
connector.put: | ||
connector_id: test-connector | ||
body: | ||
index_name: search-1-test | ||
name: my-connector | ||
language: pl | ||
is_native: false | ||
service_type: super-connector | ||
--- | ||
"Update Connector Last Sync Stats": | ||
- do: | ||
connector.last_sync: | ||
connector_id: test-connector | ||
body: | ||
last_sync_error: "oh no error" | ||
last_access_control_sync_scheduled_at: "2023-05-25T12:30:00.000Z" | ||
|
||
- match: { result: updated } | ||
|
||
- do: | ||
connector.get: | ||
connector_id: test-connector | ||
|
||
- match: { last_sync_error: "oh no error" } | ||
- match: { last_access_control_sync_scheduled_at: "2023-05-25T12:30:00.000Z" } | ||
|
||
--- | ||
"Update Connector Last Sync Stats - Connector doesn't exist": | ||
- do: | ||
catch: "missing" | ||
connector.last_sync: | ||
connector_id: test-non-existent-connector | ||
body: | ||
last_sync_error: "oh no error" | ||
last_access_control_sync_scheduled_at: "2023-05-25T12:30:00.000Z" | ||
|
||
--- | ||
"Update Connector Filtering - Wrong datetime expression": | ||
- do: | ||
catch: "bad_request" | ||
connector.last_sync: | ||
connector_id: test-connector | ||
body: | ||
last_access_control_sync_scheduled_at: "this is not a timestamp" | ||
|
||
|
||
--- | ||
"Update Connector Filtering - Wrong status": | ||
- do: | ||
catch: "bad_request" | ||
connector.last_sync: | ||
connector_id: test-connector | ||
body: | ||
last_sync_status: "this is not a valid status" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.