From d4066c6f380016c726da92b1753569fb1495d025 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 27 Nov 2025 17:09:42 +0400 Subject: [PATCH] Add private capabilities API (#5741) * Add private capabilities API * Add failures * Run make spec-format-fix (cherry picked from commit a245ec050696cdb7ff00a3b887e7ec31afc57183) --- specification/_doc_ids/table.csv | 1 + .../capabilities/CapabilitiesRequest.ts | 75 +++++++++++++++++++ .../capabilities/CapabilitiesResponse.ts | 34 +++++++++ 3 files changed, 110 insertions(+) create mode 100644 specification/_global/capabilities/CapabilitiesRequest.ts create mode 100644 specification/_global/capabilities/CapabilitiesResponse.ts diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 07e7cf00c6..fa13d8c872 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -48,6 +48,7 @@ behavioral-analytics-event-reference,https://www.elastic.co/guide/en/elasticsear byte-units,https://www.elastic.co/docs/reference/elasticsearch/rest-apis/api-conventions#byte-units,, bytes-processor,https://www.elastic.co/docs/reference/enrich-processor/bytes-processor,, calendar-and-fixed-intervals,https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-datehistogram-aggregation#calendar_and_fixed_intervals,, +capabilities,https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/README.asciidoc#require-or-skip-api-capabilities,, cat-alias,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-aliases,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-alias.html, cat-allocation,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-allocation,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-allocation.html, cat-anomaly-detectors,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-ml-jobs,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-anomaly-detectors.html, diff --git a/specification/_global/capabilities/CapabilitiesRequest.ts b/specification/_global/capabilities/CapabilitiesRequest.ts new file mode 100644 index 0000000000..76f6a33d61 --- /dev/null +++ b/specification/_global/capabilities/CapabilitiesRequest.ts @@ -0,0 +1,75 @@ +/* + * 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' +import { Duration } from '@_types/Time' + +/** + * Checks if the specified combination of method, API, parameters, and arbitrary capabilities are supported. + * + * @rest_spec_name capabilities + * @availability stack stability=experimental visibility=private + * @doc_id capabilities + */ +export interface Request extends RequestBase { + urls: [ + { + path: '/_capabilities' + methods: ['GET'] + } + ] + query_parameters: { + /** + * REST method to check + * @server_default GET + */ + method?: RestMethod + /** + * API path to check + * @server_default / + */ + path?: string + /** + * Comma-separated list of API parameters to check + */ + parameters?: string | string[] + /** + * Comma-separated list of arbitrary API capabilities to check + */ + capabilities?: string | string[] + /** + * True if only the node being called should be considered + * @server_default false + */ + local_only?: boolean + /** + * Period to wait for a response. + * If no response is received before the timeout expires, the request fails and returns an error. + */ + timeout?: Duration + } +} + +export enum RestMethod { + GET, + HEAD, + POST, + PUT, + DELETE +} diff --git a/specification/_global/capabilities/CapabilitiesResponse.ts b/specification/_global/capabilities/CapabilitiesResponse.ts new file mode 100644 index 0000000000..b0be4db16e --- /dev/null +++ b/specification/_global/capabilities/CapabilitiesResponse.ts @@ -0,0 +1,34 @@ +/* + * 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 { Id, Name } from '@_types/common' +import { NodeStatistics } from '@_types/Node' + +export class Response { + body: { + _nodes: NodeStatistics + cluster_name: Name + supported: boolean | null + failures?: FailedNodeException[] + } +} + +export class FailedNodeException { + node_id: Id +}