Skip to content

Commit a7e9a9a

Browse files
authored
Add types for new cluster info api (_info/<target>) (#2140)
1 parent 6954346 commit a7e9a9a

File tree

7 files changed

+281
-10
lines changed

7 files changed

+281
-10
lines changed

output/schema/schema.json

Lines changed: 186 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/validation-errors.json

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_doc_ids/table.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ indices-component-template,https://www.elastic.co/guide/en/elasticsearch/referen
4949
voting-config-exclusions,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/voting-config-exclusions.html
5050
cluster-get-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-get-settings.html
5151
cluster-health,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-health.html
52+
cluster-info,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-info.html
5253
cluster-pending,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-pending.html
5354
cluster-update-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-update-settings.html
5455
cluster-remote-info,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/cluster-remote-info.html

specification/_types/common.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,3 +339,13 @@ export enum SlicesCalculation {
339339
*/
340340
auto
341341
}
342+
343+
export enum ClusterInfoTarget {
344+
_all,
345+
http,
346+
ingest,
347+
thread_pool,
348+
script
349+
}
350+
351+
export type ClusterInfoTargets = ClusterInfoTarget | ClusterInfoTarget[]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { RequestBase } from '@_types/Base'
21+
import { ClusterInfoTargets } from '@_types/common'
22+
23+
/**
24+
* @rest_spec_name cluster.info
25+
* @availability stack since=8.9.0 stability=stable
26+
* @availability serverless stability=stable visibility=public
27+
* @doc_id cluster-info
28+
*/
29+
export interface Request extends RequestBase {
30+
path_parts: {
31+
/** Limits the information returned to the specific target. Supports a comma-separated list, such as http,ingest. */
32+
target: ClusterInfoTargets
33+
}
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Name } from '@_types/common'
21+
import { Http, Ingest, Scripting, ThreadCount } from '@nodes/_types/Stats'
22+
import { Dictionary } from '@spec_utils/Dictionary'
23+
24+
// The cluster info response can be filtered by target. Every property needs to
25+
// be optional to be compliant with the API behaviour
26+
export class Response {
27+
body: {
28+
cluster_name: Name
29+
http?: Http
30+
ingest?: Ingest
31+
thread_pool?: Dictionary<string, ThreadCount>
32+
script?: Scripting
33+
}
34+
}

0 commit comments

Comments
 (0)