Skip to content

Commit 266f534

Browse files
committed
Add spec and docs for new logs streams endpoints
1 parent d3f9caf commit 266f534

15 files changed

+280
-2
lines changed

docs/add-new-api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ interface Request {}
3838
class Response {}
3939
```
4040

41-
Try to use less files as possible, for example there is no need to create a custom file for an enum,
42-
you can define it in the same file where it's used, unless is a commonly used type.
41+
Try to use the least number of files possible, for example there is no need to create a custom file for an enum as you can define it in the same file where it's used, unless is a commonly used type.
4342

4443
### Add the endpoint request definition
4544

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 {Duration} from '@_types/Time'
22+
23+
/**
24+
* Disable logs stream
25+
*
26+
* This disables the logs stream feature for this cluster.
27+
* @rest_spec_name streams.logs_disable
28+
* @availability stack since=9.1.0 stability=experimental visibility=feature_flag
29+
* @feature_flag logs_stream
30+
* @cluster_privileges manage
31+
*/
32+
export interface Request extends RequestBase {
33+
urls: [
34+
{
35+
path: '/_streams/logs/_disable'
36+
methods: ['POST']
37+
}
38+
]
39+
query_parameters: {
40+
/**
41+
* The period to wait for a connection to the master node.
42+
* If no response is received before the timeout expires, the request fails and returns an error.
43+
*/
44+
master_timeout?: Duration
45+
/**
46+
* The period to wait for a response.
47+
* If no response is received before the timeout expires, the request fails and returns an error.
48+
*/
49+
timeout?: Duration
50+
}
51+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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 { AcknowledgedResponseBase } from '@_types/Base'
21+
22+
export class Response {
23+
body: AcknowledgedResponseBase
24+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
summary: Disable logs streams
2+
description: >
3+
A successful response from `POST _streams/logs/_disable` endpoint
4+
# type: response
5+
value:
6+
acknowledged: true
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
summary: "Disable the logs streams on this cluster"
2+
method_request: POST _streams/logs/_disable
3+
# type: request
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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 {Duration} from '@_types/Time'
22+
23+
/**
24+
* Enable logs stream
25+
*
26+
* This enables the logs stream feature for this cluster.
27+
*
28+
* Note: To protect existing data, this feature can only be enabled on a cluster if
29+
* it does not have existing indices or data streams matching the pattern `logs|logs.*`.
30+
* If this is the case, a `409 - Conflict` response and error will be returned.
31+
* @rest_spec_name streams.logs_enable
32+
* @availability stack since=9.1.0 stability=experimental visibility=feature_flag
33+
* @feature_flag logs_stream
34+
* @cluster_privileges manage
35+
*/
36+
export interface Request extends RequestBase {
37+
urls: [
38+
{
39+
path: '/_streams/logs/_enable'
40+
methods: ['POST']
41+
}
42+
]
43+
query_parameters: {
44+
/**
45+
* The period to wait for a connection to the master node.
46+
* If no response is received before the timeout expires, the request fails and returns an error.
47+
*/
48+
master_timeout?: Duration
49+
/**
50+
* The period to wait for a response.
51+
* If no response is received before the timeout expires, the request fails and returns an error.
52+
*/
53+
timeout?: Duration
54+
}
55+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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 { AcknowledgedResponseBase } from '@_types/Base'
21+
22+
export class Response {
23+
body: AcknowledgedResponseBase
24+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
summary: Enable logs streams
2+
description: >
3+
A successful response from `POST _streams/logs/_enable` endpoint
4+
# type: response
5+
value:
6+
acknowledged: true
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
summary: Enable logs streams - Failure due to conflicting index
2+
description: >
3+
An error response from the `POST _streams/logs/_enable` endpoint caused by attempting to enable logs streams
4+
when an existing index with the name `logs` already exists
5+
# type: response
6+
value: |-
7+
{
8+
"error": {
9+
"root_cause": [
10+
{
11+
"type": "status_exception",
12+
"reason": "Cannot enable logs streams: indices named 'logs' or starting with 'logs.' already exist."
13+
}
14+
],
15+
"type": "status_exception",
16+
"reason": "Cannot enable logs streams: indices named 'logs' or starting with 'logs.' already exist."
17+
},
18+
"status": 409
19+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
summary: "Enable the logs streams on this cluster"
2+
method_request: POST _streams/logs/_enable
3+
# type: request

0 commit comments

Comments
 (0)