Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/add-new-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ interface Request {}
class Response {}
```

Try to use less files as possible, for example there is no need to create a custom file for an enum,
you can define it in the same file where it's used, unless is a commonly used type.
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.

### Add the endpoint request definition

Expand Down
3 changes: 3 additions & 0 deletions specification/_doc_ids/table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,9 @@ stop-dfanalytics,https://www.elastic.co/docs/api/doc/elasticsearch/operation/ope
stop-trained-model-deployment,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-stop-trained-model-deployment,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/stop-trained-model-deployment.html,
stop-transform,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-transform-stop-transform,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/stop-transform.html,
stored-fields,https://www.elastic.co/docs/reference/elasticsearch/rest-apis/retrieve-selected-fields#stored-fields,,
streams-status,https://www.elastic.co/docs/reference/elasticsearch/rest-apis,,
streams-logs-enable,https://www.elastic.co/docs/reference/elasticsearch/rest-apis,,
streams-logs-disable,https://www.elastic.co/docs/reference/elasticsearch/rest-apis,,
synonym-api-examples,https://www.elastic.co/docs/solutions/search/full-text/create-update-synonyms-api-example,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-synonyms-set.html,
synonym-rule-create,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-synonyms-put-synonym-rule,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/put-synonym-rule.html,
synonym-rule-delete,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-synonyms-delete-synonym-rule,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-synonym-rule.html,
Expand Down
51 changes: 51 additions & 0 deletions specification/streams/logs_disable/StreamsLogsDisableRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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'

/**
* Disable logs stream
*
* This disables the logs stream feature for this cluster.
* @rest_spec_name streams.logs_disable
* @availability stack since=9.1.0 stability=experimental visibility=feature_flag feature_flag=logs_stream
* @cluster_privileges manage
* @doc_id streams-logs-disable
*/
export interface Request extends RequestBase {
urls: [
{
path: '/_streams/logs/_disable'
methods: ['POST']
}
]
query_parameters: {
/**
* The period to wait for a connection to the master node.
* If no response is received before the timeout expires, the request fails and returns an error.
*/
master_timeout?: Duration
/**
* The period to wait for a response.
* If no response is received before the timeout expires, the request fails and returns an error.
*/
timeout?: Duration
}
}
25 changes: 25 additions & 0 deletions specification/streams/logs_disable/StreamsLogsDisableResponse.ts
Original file line number Diff line number Diff line change
@@ -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.
*/

import { AcknowledgedResponseBase } from '@_types/Base'

export class Response {
/** @codegen_name result */
body: AcknowledgedResponseBase
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
summary: Disable logs streams
description: >
A successful response from `POST _streams/logs/_disable` endpoint
# type: response
value:
acknowledged: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
summary: 'Disable the logs streams on this cluster'
method_request: POST _streams/logs/_disable
# type: request
55 changes: 55 additions & 0 deletions specification/streams/logs_enable/StreamsLogsEnableRequest.ts
Original file line number Diff line number Diff line change
@@ -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 { RequestBase } from '@_types/Base'
import { Duration } from '@_types/Time'

/**
* Enable logs stream
*
* This enables the logs stream feature for this cluster.
*
* Note: To protect existing data, this feature can only be enabled on a cluster if
* it does not have existing indices or data streams matching the pattern `logs|logs.*`.
* If this is the case, a `409 - Conflict` response and error will be returned.
* @rest_spec_name streams.logs_enable
* @availability stack since=9.1.0 stability=experimental visibility=feature_flag feature_flag=logs_stream
* @cluster_privileges manage
* @doc_id streams-logs-enable
*/
export interface Request extends RequestBase {
urls: [
{
path: '/_streams/logs/_enable'
methods: ['POST']
}
]
query_parameters: {
/**
* The period to wait for a connection to the master node.
* If no response is received before the timeout expires, the request fails and returns an error.
*/
master_timeout?: Duration
/**
* The period to wait for a response.
* If no response is received before the timeout expires, the request fails and returns an error.
*/
timeout?: Duration
}
}
25 changes: 25 additions & 0 deletions specification/streams/logs_enable/StreamsLogsEnableResponse.ts
Original file line number Diff line number Diff line change
@@ -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.
*/

import { AcknowledgedResponseBase } from '@_types/Base'

export class Response {
/** @codegen_name result */
body: AcknowledgedResponseBase
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
summary: Enable logs streams
description: >
A successful response from `POST _streams/logs/_enable` endpoint
# type: response
value:
acknowledged: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
summary: Enable logs streams - Failure due to conflicting index
description: >
An error response from the `POST _streams/logs/_enable` endpoint caused by attempting to enable logs streams
when an existing index with the name `logs` already exists
# type: response
value: |-
{
"error": {
"root_cause": [
{
"type": "status_exception",
"reason": "Cannot enable logs streams: indices named 'logs' or starting with 'logs.' already exist."
}
],
"type": "status_exception",
"reason": "Cannot enable logs streams: indices named 'logs' or starting with 'logs.' already exist."
},
"status": 409
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
summary: 'Enable the logs streams on this cluster'
method_request: POST _streams/logs/_enable
# type: request
46 changes: 46 additions & 0 deletions specification/streams/status/StreamsStatusRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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 { TimeUnit } from '@_types/Time'

/**
* Get the status of streams
*
* Gets the current status of all stream types
* @rest_spec_name streams.status
* @availability stack since=9.1.0 stability=experimental visibility=feature_flag feature_flag=logs_stream
* @cluster_privileges monitor
* @doc_id streams-status
*/
export interface Request extends RequestBase {
urls: [
{
path: '/_streams/status'
methods: ['GET']
}
]
query_parameters: {
/**
* Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
* @server_default 30s
*/
master_timeout?: TimeUnit
}
}
28 changes: 28 additions & 0 deletions specification/streams/status/StreamsStatusResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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: {
logs: LogsStatus
}
}

export class LogsStatus {
enabled: boolean
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
summary: Get Streams Status
A successful response from `GET _streams/status` that outlines the current state of all wired streams in the cluster.
# type: response
value: |-
{
"logs": {
"enabled": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
summary: 'Get the current status of streams'
method_request: GET _streams/status
# type: request
1 change: 1 addition & 0 deletions specification/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@shutdown/*": ["shutdown/*"],
"@slm/*": ["slm/*"],
"@snapshot/*": ["snapshot/*"],
"@streams/*": ["streams/*"],
"@sql/*": ["sql/*"],
"@ssl/*": ["ssl/*"],
"@synonyms/*": ["synonyms/*"],
Expand Down