Skip to content

Commit 1762b64

Browse files
committed
[API] Adds indices get and put data_stream_settings endpoints
1 parent ae5fb08 commit 1762b64

File tree

4 files changed

+232
-0
lines changed

4 files changed

+232
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# This code was automatically generated from the Elasticsearch Specification
19+
# See https://github.com/elastic/elasticsearch-specification
20+
# See Elasticsearch::ES_SPECIFICATION_COMMIT for commit hash.
21+
module Elasticsearch
22+
module API
23+
module Indices
24+
module Actions
25+
# Get data stream settings.
26+
# Get setting information for one or more data streams.
27+
#
28+
# @option arguments [String, Array] :name A comma-separated list of data streams or data stream patterns. Supports wildcards (`*`). (*Required*)
29+
# @option arguments [Time] :master_timeout The period to wait for a connection to the master node. If no response is
30+
# received before the timeout expires, the request fails and returns an
31+
# error. Server default: 30s.
32+
# @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors
33+
# when they occur.
34+
# @option arguments [String] :filter_path Comma-separated list of filters in dot notation which reduce the response
35+
# returned by Elasticsearch.
36+
# @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans.
37+
# For example `"exists_time": "1h"` for humans and
38+
# `"eixsts_time_in_millis": 3600000` for computers. When disabled the human
39+
# readable values will be omitted. This makes sense for responses being consumed
40+
# only by machines.
41+
# @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use
42+
# this option for debugging only.
43+
# @option arguments [Hash] :headers Custom HTTP headers
44+
#
45+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream-settings
46+
#
47+
def get_data_stream_settings(arguments = {})
48+
request_opts = { endpoint: arguments[:endpoint] || 'indices.get_data_stream_settings' }
49+
50+
defined_params = [:name].each_with_object({}) do |variable, set_variables|
51+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
52+
end
53+
request_opts[:defined_params] = defined_params unless defined_params.empty?
54+
55+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
56+
57+
arguments = arguments.clone
58+
headers = arguments.delete(:headers) || {}
59+
60+
body = nil
61+
62+
_name = arguments.delete(:name)
63+
64+
method = Elasticsearch::API::HTTP_GET
65+
path = "_data_stream/#{Utils.listify(_name)}/_settings"
66+
params = Utils.process_params(arguments)
67+
68+
Elasticsearch::API::Response.new(
69+
perform_request(method, path, params, body, headers, request_opts)
70+
)
71+
end
72+
end
73+
end
74+
end
75+
end
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# This code was automatically generated from the Elasticsearch Specification
19+
# See https://github.com/elastic/elasticsearch-specification
20+
# See Elasticsearch::ES_SPECIFICATION_COMMIT for commit hash.
21+
module Elasticsearch
22+
module API
23+
module Indices
24+
module Actions
25+
# Update data stream settings.
26+
# This API can be used to override settings on specific data streams. These overrides will take precedence over what
27+
# is specified in the template that the data stream matches. To prevent your data stream from getting into an invalid state,
28+
# only certain settings are allowed. If possible, the setting change is applied to all
29+
# backing indices. Otherwise, it will be applied when the data stream is next rolled over.
30+
#
31+
# @option arguments [String, Array] :name A comma-separated list of data streams or data stream patterns. (*Required*)
32+
# @option arguments [Boolean] :dry_run If `true`, the request does not actually change the settings on any data streams or indices. Instead, it
33+
# simulates changing the settings and reports back to the user what would have happened had these settings
34+
# actually been applied.
35+
# @option arguments [Time] :master_timeout The period to wait for a connection to the master node. If no response is
36+
# received before the timeout expires, the request fails and returns an
37+
# error. Server default: 30s.
38+
# @option arguments [Time] :timeout The period to wait for a response. If no response is received before the
39+
# timeout expires, the request fails and returns an error. Server default: 30s.
40+
# @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors
41+
# when they occur.
42+
# @option arguments [String] :filter_path Comma-separated list of filters in dot notation which reduce the response
43+
# returned by Elasticsearch.
44+
# @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans.
45+
# For example `"exists_time": "1h"` for humans and
46+
# `"eixsts_time_in_millis": 3600000` for computers. When disabled the human
47+
# readable values will be omitted. This makes sense for responses being consumed
48+
# only by machines.
49+
# @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use
50+
# this option for debugging only.
51+
# @option arguments [Hash] :headers Custom HTTP headers
52+
# @option arguments [Hash] :body settings
53+
#
54+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-settings
55+
#
56+
def put_data_stream_settings(arguments = {})
57+
request_opts = { endpoint: arguments[:endpoint] || 'indices.put_data_stream_settings' }
58+
59+
defined_params = [:name].each_with_object({}) do |variable, set_variables|
60+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
61+
end
62+
request_opts[:defined_params] = defined_params unless defined_params.empty?
63+
64+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
65+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
66+
67+
arguments = arguments.clone
68+
headers = arguments.delete(:headers) || {}
69+
70+
body = arguments.delete(:body)
71+
72+
_name = arguments.delete(:name)
73+
74+
method = Elasticsearch::API::HTTP_PUT
75+
path = "_data_stream/#{Utils.listify(_name)}/_settings"
76+
params = Utils.process_params(arguments)
77+
78+
Elasticsearch::API::Response.new(
79+
perform_request(method, path, params, body, headers, request_opts)
80+
)
81+
end
82+
end
83+
end
84+
end
85+
end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
require 'spec_helper'
19+
20+
describe 'client.indices.get_data_stream_settings' do
21+
let(:expected_args) do
22+
[
23+
'GET',
24+
'_data_stream/foo/_settings',
25+
{},
26+
nil,
27+
{},
28+
{ endpoint: 'indices.get_data_stream_settings', defined_params: { name: 'foo' } }
29+
]
30+
end
31+
32+
let(:index) { 'foo' }
33+
34+
it 'performs the request' do
35+
expect(client_double.indices.get_data_stream_settings(name: 'foo')).to be_a Elasticsearch::API::Response
36+
end
37+
end
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Licensed to Elasticsearch B.V. under one or more contributor
2+
# license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright
4+
# ownership. Elasticsearch B.V. licenses this file to you under
5+
# the Apache License, Version 2.0 (the "License"); you may
6+
# not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
require 'spec_helper'
19+
20+
describe 'client.cluster#put_data_stream_settings' do
21+
let(:expected_args) do
22+
[
23+
'PUT',
24+
'_data_stream/foo/_settings',
25+
{},
26+
{},
27+
{},
28+
{ endpoint: 'indices.put_data_stream_settings', defined_params: { name: 'foo' } }
29+
]
30+
end
31+
32+
it 'performs the request' do
33+
expect(client_double.indices.put_data_stream_settings(name: 'foo', body: {})).to be_a Elasticsearch::API::Response
34+
end
35+
end

0 commit comments

Comments
 (0)