From 3d3096419301f1a0253c4f15d71ae90cc920e3ed Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Thu, 19 Dec 2024 10:02:06 -0800 Subject: [PATCH] Add specification for claim connector sync job (#3366) (cherry picked from commit 68dcbfb1d141a21d80ca1ec3cc609fb79f406d84) --- output/openapi/elasticsearch-openapi.json | 59 +++++++++++++ output/schema/schema.json | 85 ++++++++++++++++++- output/schema/validation-errors.json | 6 -- output/typescript/types.ts | 11 +++ specification/_doc_ids/table.csv | 2 + .../sync_job_claim/SyncJobClaimRequest.ts | 55 ++++++++++++ .../sync_job_claim/SyncJobClaimResponse.ts | 22 +++++ 7 files changed, 230 insertions(+), 10 deletions(-) create mode 100644 specification/connector/sync_job_claim/SyncJobClaimRequest.ts create mode 100644 specification/connector/sync_job_claim/SyncJobClaimResponse.ts diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 327ab8b64e..527adaf67e 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -4935,6 +4935,65 @@ "x-beta": true } }, + "/_connector/_sync_job/{connector_sync_job_id}/_claim": { + "put": { + "tags": [ + "connector" + ], + "summary": "Claim a connector sync job", + "description": "This action updates the job status to `in_progress` and sets the `last_seen` and `started_at` timestamps to the current time.\nAdditionally, it can set the `sync_cursor` property for the sync job.\n\nThis API is not intended for direct connector management by users.\nIt supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch.\n\nTo sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.\nThis service runs automatically on Elastic Cloud for Elastic managed connectors.", + "operationId": "connector-sync-job-claim", + "parameters": [ + { + "in": "path", + "name": "connector_sync_job_id", + "description": "The unique identifier of the connector sync job.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Id" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "sync_cursor": { + "description": "The cursor object from the last incremental sync job.\nThis should reference the `sync_cursor` field in the connector state for which the job runs.", + "type": "object" + }, + "worker_hostname": { + "description": "The host name of the current system that will run the job.", + "type": "string" + } + }, + "required": [ + "worker_hostname" + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "x-state": "Technical preview" + } + }, "/_connector/_sync_job/{connector_sync_job_id}": { "get": { "tags": [ diff --git a/output/schema/schema.json b/output/schema/schema.json index 51b2c160ea..bebe6e92bc 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -3347,15 +3347,22 @@ "visibility": "public" } }, - "description": "Claims a connector sync job.", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/claim-connector-sync-job-api.html", + "description": "Claim a connector sync job.\nThis action updates the job status to `in_progress` and sets the `last_seen` and `started_at` timestamps to the current time.\nAdditionally, it can set the `sync_cursor` property for the sync job.\n\nThis API is not intended for direct connector management by users.\nIt supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch.\n\nTo sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.\nThis service runs automatically on Elastic Cloud for Elastic managed connectors.", + "docId": "connector-sync-job-claim", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/claim-connector-sync-job-api.html", "name": "connector.sync_job_claim", - "request": null, + "request": { + "name": "Request", + "namespace": "connector.sync_job_claim" + }, "requestBodyRequired": true, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "connector.sync_job_claim" + }, "responseMediaType": [ "application/json" ], @@ -115035,6 +115042,76 @@ }, "specLocation": "connector/sync_job_cancel/SyncJobCancelResponse.ts#L22-L26" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "properties", + "properties": [ + { + "description": "The cursor object from the last incremental sync job.\nThis should reference the `sync_cursor` field in the connector state for which the job runs.", + "name": "sync_cursor", + "required": false, + "type": { + "kind": "user_defined_value" + } + }, + { + "description": "The host name of the current system that will run the job.", + "name": "worker_hostname", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ] + }, + "description": "Claim a connector sync job.\nThis action updates the job status to `in_progress` and sets the `last_seen` and `started_at` timestamps to the current time.\nAdditionally, it can set the `sync_cursor` property for the sync job.\n\nThis API is not intended for direct connector management by users.\nIt supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch.\n\nTo sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure.\nThis service runs automatically on Elastic Cloud for Elastic managed connectors.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "connector.sync_job_claim" + }, + "path": [ + { + "description": "The unique identifier of the connector sync job.", + "name": "connector_sync_job_id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + } + ], + "query": [], + "specLocation": "connector/sync_job_claim/SyncJobClaimRequest.ts#L23-L55" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [] + }, + "name": { + "name": "Response", + "namespace": "connector.sync_job_claim" + }, + "specLocation": "connector/sync_job_claim/SyncJobClaimResponse.ts#L20-L22" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index d4b0ff9fdb..990f241836 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -476,12 +476,6 @@ ], "response": [] }, - "connector.sync_job_claim": { - "request": [ - "Missing request & response" - ], - "response": [] - }, "connector.sync_job_error": { "request": [ "Missing request & response" diff --git a/output/typescript/types.ts b/output/typescript/types.ts index f8a720ba85..2829f96a9c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -9996,6 +9996,17 @@ export interface ConnectorSyncJobCancelResponse { result: Result } +export interface ConnectorSyncJobClaimRequest extends RequestBase { + connector_sync_job_id: Id + body?: { + sync_cursor?: any + worker_hostname: string + } +} + +export interface ConnectorSyncJobClaimResponse { +} + export interface ConnectorSyncJobDeleteRequest extends RequestBase { connector_sync_job_id: Id } diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 1e7fac6559..ae6cfe5c9f 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -85,6 +85,8 @@ cluster,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster common-options,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/common-options.html community-id-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/community-id-processor.html connector-sync-job-cancel,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cancel-connector-sync-job-api.html +connector-sync-job-checkin,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/check-in-connector-sync-job-api.html +connector-sync-job-claim,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/claim-connector-sync-job-api.html collapse-search-results,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/collapse-search-results.html connector-sync-job-delete,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/delete-connector-sync-job-api.html connector-sync-job-get,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/get-connector-sync-job-api.html diff --git a/specification/connector/sync_job_claim/SyncJobClaimRequest.ts b/specification/connector/sync_job_claim/SyncJobClaimRequest.ts new file mode 100644 index 0000000000..a10e21a608 --- /dev/null +++ b/specification/connector/sync_job_claim/SyncJobClaimRequest.ts @@ -0,0 +1,55 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { UserDefinedValue } from '@spec_utils/UserDefinedValue' +import { RequestBase } from '@_types/Base' +import { Id } from '@_types/common' + +/** + * Claim a connector sync job. + * This action updates the job status to `in_progress` and sets the `last_seen` and `started_at` timestamps to the current time. + * Additionally, it can set the `sync_cursor` property for the sync job. + * + * This API is not intended for direct connector management by users. + * It supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch. + * + * To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + * This service runs automatically on Elastic Cloud for Elastic managed connectors. + * @rest_spec_name connector.sync_job_claim + * @availability stack stability=experimental visibility=public + * @doc_id connector-sync-job-claim + */ +export interface Request extends RequestBase { + path_parts: { + /** + * The unique identifier of the connector sync job. + */ + connector_sync_job_id: Id + } + body: { + /** + * The cursor object from the last incremental sync job. + * This should reference the `sync_cursor` field in the connector state for which the job runs. + */ + sync_cursor?: UserDefinedValue + /** + * The host name of the current system that will run the job. + */ + worker_hostname: string + } +} diff --git a/specification/connector/sync_job_claim/SyncJobClaimResponse.ts b/specification/connector/sync_job_claim/SyncJobClaimResponse.ts new file mode 100644 index 0000000000..0769bf66cb --- /dev/null +++ b/specification/connector/sync_job_claim/SyncJobClaimResponse.ts @@ -0,0 +1,22 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export class Response { + body: {} +}