From 519dcf10bea0a0231e09aff39f296751b70b1615 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 25 Nov 2025 11:03:52 +0400 Subject: [PATCH] Add connector.secret private APIs (#5727) * Add connector.secret private APIs * Run make spec-format-fix * Make value optional in connector.secret_post (cherry picked from commit ac92dfba074c4a32fe04c0617636e1db05f2ec5e) --- output/schema/schema.json | 312 +++++++++++++++++- output/typescript/types.ts | 38 +++ .../ConnectorSecretDeleteRequest.ts | 39 +++ .../ConnectorSecretDeleteResponse.ts | 24 ++ .../secret_get/ConnectorSecretGetRequest.ts | 39 +++ .../secret_get/ConnectorSecretGetResponse.ts | 25 ++ .../secret_post/ConnectorSecretPostRequest.ts | 38 +++ .../ConnectorSecretPostResponse.ts | 24 ++ .../secret_put/ConnectorSecretPutRequest.ts | 42 +++ .../secret_put/ConnectorSecretPutResponse.ts | 26 ++ 10 files changed, 595 insertions(+), 12 deletions(-) create mode 100644 specification/connector/secret_delete/ConnectorSecretDeleteRequest.ts create mode 100644 specification/connector/secret_delete/ConnectorSecretDeleteResponse.ts create mode 100644 specification/connector/secret_get/ConnectorSecretGetRequest.ts create mode 100644 specification/connector/secret_get/ConnectorSecretGetResponse.ts create mode 100644 specification/connector/secret_post/ConnectorSecretPostRequest.ts create mode 100644 specification/connector/secret_post/ConnectorSecretPostResponse.ts create mode 100644 specification/connector/secret_put/ConnectorSecretPutRequest.ts create mode 100644 specification/connector/secret_put/ConnectorSecretPutResponse.ts diff --git a/output/schema/schema.json b/output/schema/schema.json index 17fd438c55..db31c994be 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -3368,12 +3368,18 @@ "visibility": "private" } }, - "description": "Deletes a connector secret", + "description": "Deletes a connector secret.", "docUrl": null, "name": "connector.secret_delete", - "request": null, + "request": { + "name": "Request", + "namespace": "connector.secret_delete" + }, "requestBodyRequired": false, - "response": null, + "response": { + "name": "Response", + "namespace": "connector.secret_delete" + }, "responseMediaType": [ "application/json" ], @@ -3393,12 +3399,18 @@ "visibility": "private" } }, - "description": "Retrieves a secret stored by Connectors", + "description": "Retrieves a secret stored by Connectors.", "docUrl": null, "name": "connector.secret_get", - "request": null, + "request": { + "name": "Request", + "namespace": "connector.secret_get" + }, "requestBodyRequired": false, - "response": null, + "response": { + "name": "Response", + "namespace": "connector.secret_get" + }, "responseMediaType": [ "application/json" ], @@ -3418,12 +3430,18 @@ "visibility": "private" } }, - "description": "Creates a secret for a Connector", + "description": "Creates a secret for a Connector.", "docUrl": null, "name": "connector.secret_post", - "request": null, + "request": { + "name": "Request", + "namespace": "connector.secret_post" + }, "requestBodyRequired": true, - "response": null, + "response": { + "name": "Response", + "namespace": "connector.secret_post" + }, "responseMediaType": [ "application/json" ], @@ -3443,12 +3461,18 @@ "visibility": "private" } }, - "description": "Creates or updates a secret for a Connector", + "description": "Creates or updates a secret for a Connector.", "docUrl": null, "name": "connector.secret_put", - "request": null, + "request": { + "name": "Request", + "namespace": "connector.secret_put" + }, "requestBodyRequired": true, - "response": null, + "response": { + "name": "Response", + "namespace": "connector.secret_put" + }, "responseMediaType": [ "application/json" ], @@ -135926,6 +135950,270 @@ }, "specLocation": "connector/put/ConnectorPutResponse.ts#L23-L28" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Deletes a connector secret.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "connector.secret_delete" + }, + "path": [ + { + "description": "The ID of the secret", + "name": "id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "query": [], + "specLocation": "connector/secret_delete/ConnectorSecretDeleteRequest.ts#L22-L39" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "deleted", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "connector.secret_delete" + }, + "specLocation": "connector/secret_delete/ConnectorSecretDeleteResponse.ts#L20-L24" + }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Retrieves a secret stored by Connectors.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "connector.secret_get" + }, + "path": [ + { + "description": "The ID of the secret", + "name": "id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "query": [], + "specLocation": "connector/secret_get/ConnectorSecretGetRequest.ts#L22-L39" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "value", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "connector.secret_get" + }, + "specLocation": "connector/secret_get/ConnectorSecretGetResponse.ts#L20-L25" + }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "properties", + "properties": [ + { + "name": "value", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ] + }, + "description": "Creates a secret for a Connector.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "connector.secret_post" + }, + "path": [], + "query": [], + "specLocation": "connector/secret_post/ConnectorSecretPostRequest.ts#L22-L38" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "connector.secret_post" + }, + "specLocation": "connector/secret_post/ConnectorSecretPostResponse.ts#L20-L24" + }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "properties", + "properties": [ + { + "name": "value", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ] + }, + "description": "Creates or updates a secret for a Connector.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "connector.secret_put" + }, + "path": [ + { + "description": "The ID of the secret", + "name": "id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "query": [], + "specLocation": "connector/secret_put/ConnectorSecretPutRequest.ts#L22-L42" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "result", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Result", + "namespace": "_types" + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "connector.secret_put" + }, + "specLocation": "connector/secret_put/ConnectorSecretPutResponse.ts#L22-L26" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index f5736a5683..a4996e22f3 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -10748,6 +10748,44 @@ export interface ConnectorPutResponse { id: Id } +export interface ConnectorSecretDeleteRequest extends RequestBase { + id: string +} + +export interface ConnectorSecretDeleteResponse { + deleted: boolean +} + +export interface ConnectorSecretGetRequest extends RequestBase { + id: string +} + +export interface ConnectorSecretGetResponse { + id: string + value: string +} + +export interface ConnectorSecretPostRequest extends RequestBase { + body?: { + value?: string + } +} + +export interface ConnectorSecretPostResponse { + id: string +} + +export interface ConnectorSecretPutRequest extends RequestBase { + id: string + body?: { + value: string + } +} + +export interface ConnectorSecretPutResponse { + result: Result +} + export interface ConnectorSyncJobCancelRequest extends RequestBase { connector_sync_job_id: Id } diff --git a/specification/connector/secret_delete/ConnectorSecretDeleteRequest.ts b/specification/connector/secret_delete/ConnectorSecretDeleteRequest.ts new file mode 100644 index 0000000000..c1296329e6 --- /dev/null +++ b/specification/connector/secret_delete/ConnectorSecretDeleteRequest.ts @@ -0,0 +1,39 @@ +/* + * 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 { RequestBase } from '@_types/Base' + +/** + * Deletes a connector secret. + * + * @rest_spec_name connector.secret_delete + * @availability stack stability=experimental visibility=private + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_connector/_secret/{id}' + methods: ['DELETE'] + } + ] + path_parts: { + /** The ID of the secret */ + id: string + } +} diff --git a/specification/connector/secret_delete/ConnectorSecretDeleteResponse.ts b/specification/connector/secret_delete/ConnectorSecretDeleteResponse.ts new file mode 100644 index 0000000000..51d10bac9a --- /dev/null +++ b/specification/connector/secret_delete/ConnectorSecretDeleteResponse.ts @@ -0,0 +1,24 @@ +/* + * 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: { + deleted: boolean + } +} diff --git a/specification/connector/secret_get/ConnectorSecretGetRequest.ts b/specification/connector/secret_get/ConnectorSecretGetRequest.ts new file mode 100644 index 0000000000..dd1d440c27 --- /dev/null +++ b/specification/connector/secret_get/ConnectorSecretGetRequest.ts @@ -0,0 +1,39 @@ +/* + * 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 { RequestBase } from '@_types/Base' + +/** + * Retrieves a secret stored by Connectors. + * + * @rest_spec_name connector.secret_get + * @availability stack stability=experimental visibility=private + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_connector/_secret/{id}' + methods: ['GET'] + } + ] + path_parts: { + /** The ID of the secret */ + id: string + } +} diff --git a/specification/connector/secret_get/ConnectorSecretGetResponse.ts b/specification/connector/secret_get/ConnectorSecretGetResponse.ts new file mode 100644 index 0000000000..f30aae70fc --- /dev/null +++ b/specification/connector/secret_get/ConnectorSecretGetResponse.ts @@ -0,0 +1,25 @@ +/* + * 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: { + id: string + value: string + } +} diff --git a/specification/connector/secret_post/ConnectorSecretPostRequest.ts b/specification/connector/secret_post/ConnectorSecretPostRequest.ts new file mode 100644 index 0000000000..9129b46d59 --- /dev/null +++ b/specification/connector/secret_post/ConnectorSecretPostRequest.ts @@ -0,0 +1,38 @@ +/* + * 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 { RequestBase } from '@_types/Base' + +/** + * Creates a secret for a Connector. + * + * @rest_spec_name connector.secret_post + * @availability stack stability=experimental visibility=private + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_connector/_secret' + methods: ['POST'] + } + ] + body: { + value?: string + } +} diff --git a/specification/connector/secret_post/ConnectorSecretPostResponse.ts b/specification/connector/secret_post/ConnectorSecretPostResponse.ts new file mode 100644 index 0000000000..c8491cd171 --- /dev/null +++ b/specification/connector/secret_post/ConnectorSecretPostResponse.ts @@ -0,0 +1,24 @@ +/* + * 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: { + id: string + } +} diff --git a/specification/connector/secret_put/ConnectorSecretPutRequest.ts b/specification/connector/secret_put/ConnectorSecretPutRequest.ts new file mode 100644 index 0000000000..7e44e2975b --- /dev/null +++ b/specification/connector/secret_put/ConnectorSecretPutRequest.ts @@ -0,0 +1,42 @@ +/* + * 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 { RequestBase } from '@_types/Base' + +/** + * Creates or updates a secret for a Connector. + * + * @rest_spec_name connector.secret_put + * @availability stack stability=experimental visibility=private + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_connector/_secret/{id}' + methods: ['PUT'] + } + ] + path_parts: { + /** The ID of the secret */ + id: string + } + body: { + value: string + } +} diff --git a/specification/connector/secret_put/ConnectorSecretPutResponse.ts b/specification/connector/secret_put/ConnectorSecretPutResponse.ts new file mode 100644 index 0000000000..fc194d6f20 --- /dev/null +++ b/specification/connector/secret_put/ConnectorSecretPutResponse.ts @@ -0,0 +1,26 @@ +/* + * 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 { Result } from '@_types/Result' + +export class Response { + body: { + result: Result + } +}