Skip to content

Commit 0145505

Browse files
committed
[API] Adds data stream options endpoints
1 parent ee26b2f commit 0145505

File tree

6 files changed

+345
-0
lines changed

6 files changed

+345
-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+
# Delete data stream options.
26+
# Removes the data stream options from a data stream.
27+
#
28+
# @option arguments [String, Array<String>] :name A comma-separated list of data streams of which the data stream options will be deleted; use `*` to get all data streams (*Required*)
29+
# @option arguments [String, Array<String>] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open)
30+
# @option arguments [Time] :master_timeout Specify timeout for connection to master
31+
# @option arguments [Time] :timeout Explicit timestamp for the document
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/guide/en/elasticsearch/reference/current/index.html
46+
#
47+
def delete_data_stream_options(arguments = {})
48+
request_opts = { endpoint: arguments[:endpoint] || 'indices.delete_data_stream_options' }
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_DELETE
65+
path = "_data_stream/#{Utils.listify(_name)}/_options"
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: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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 options.
26+
# Get the data stream options configuration of one or more data streams.
27+
#
28+
# @option arguments [String, Array<String>] :name Comma-separated list of data streams to limit the request.
29+
# Supports wildcards (`*`).
30+
# To target all data streams, omit this parameter or use `*` or `_all`. (*Required*)
31+
# @option arguments [String, Array<String>] :expand_wildcards Type of data stream that wildcard patterns can match.
32+
# Supports comma-separated values, such as `open,hidden`.
33+
# Valid values are: `all`, `open`, `closed`, `hidden`, `none`. Server default: open.
34+
# @option arguments [Time] :master_timeout 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.
35+
# @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors
36+
# when they occur.
37+
# @option arguments [String] :filter_path Comma-separated list of filters in dot notation which reduce the response
38+
# returned by Elasticsearch.
39+
# @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans.
40+
# For example `"exists_time": "1h"` for humans and
41+
# `"eixsts_time_in_millis": 3600000` for computers. When disabled the human
42+
# readable values will be omitted. This makes sense for responses being consumed
43+
# only by machines.
44+
# @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use
45+
# this option for debugging only.
46+
# @option arguments [Hash] :headers Custom HTTP headers
47+
#
48+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
49+
#
50+
def get_data_stream_options(arguments = {})
51+
request_opts = { endpoint: arguments[:endpoint] || 'indices.get_data_stream_options' }
52+
53+
defined_params = [:name].each_with_object({}) do |variable, set_variables|
54+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
55+
end
56+
request_opts[:defined_params] = defined_params unless defined_params.empty?
57+
58+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
59+
60+
arguments = arguments.clone
61+
headers = arguments.delete(:headers) || {}
62+
63+
body = nil
64+
65+
_name = arguments.delete(:name)
66+
67+
method = Elasticsearch::API::HTTP_GET
68+
path = "_data_stream/#{Utils.listify(_name)}/_options"
69+
params = Utils.process_params(arguments)
70+
71+
Elasticsearch::API::Response.new(
72+
perform_request(method, path, params, body, headers, request_opts)
73+
)
74+
end
75+
end
76+
end
77+
end
78+
end
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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 options.
26+
# Update the data stream options of the specified data streams.
27+
#
28+
# @option arguments [String, Array<String>] :name Comma-separated list of data streams used to limit the request.
29+
# Supports wildcards (`*`).
30+
# To target all data streams use `*` or `_all`. (*Required*)
31+
# @option arguments [String, Array<String>] :expand_wildcards Type of data stream that wildcard patterns can match.
32+
# Supports comma-separated values, such as `open,hidden`.
33+
# Valid values are: `all`, `hidden`, `open`, `closed`, `none`. Server default: open.
34+
# @option arguments [Time] :master_timeout Period to wait for a connection to the master node. If no response is
35+
# received before the timeout expires, the request fails and returns an
36+
# error. Server default: 30s.
37+
# @option arguments [Time] :timeout Period to wait for a response.
38+
# If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.
39+
# @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors
40+
# when they occur.
41+
# @option arguments [String] :filter_path Comma-separated list of filters in dot notation which reduce the response
42+
# returned by Elasticsearch.
43+
# @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans.
44+
# For example `"exists_time": "1h"` for humans and
45+
# `"eixsts_time_in_millis": 3600000` for computers. When disabled the human
46+
# readable values will be omitted. This makes sense for responses being consumed
47+
# only by machines.
48+
# @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use
49+
# this option for debugging only.
50+
# @option arguments [Hash] :headers Custom HTTP headers
51+
# @option arguments [Hash] :body request body
52+
#
53+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
54+
#
55+
def put_data_stream_options(arguments = {})
56+
request_opts = { endpoint: arguments[:endpoint] || 'indices.put_data_stream_options' }
57+
58+
defined_params = [:name].each_with_object({}) do |variable, set_variables|
59+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
60+
end
61+
request_opts[:defined_params] = defined_params unless defined_params.empty?
62+
63+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
64+
65+
arguments = arguments.clone
66+
headers = arguments.delete(:headers) || {}
67+
68+
body = arguments.delete(:body)
69+
70+
_name = arguments.delete(:name)
71+
72+
method = Elasticsearch::API::HTTP_PUT
73+
path = "_data_stream/#{Utils.listify(_name)}/_options"
74+
params = Utils.process_params(arguments)
75+
76+
Elasticsearch::API::Response.new(
77+
perform_request(method, path, params, body, headers, request_opts)
78+
)
79+
end
80+
end
81+
end
82+
end
83+
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.delete_data_stream_options' do
21+
let(:expected_args) do
22+
[
23+
'DELETE',
24+
'_data_stream/foo/_options',
25+
{},
26+
nil,
27+
{},
28+
{ endpoint: 'indices.delete_data_stream_options', defined_params: { name: 'foo' } }
29+
]
30+
end
31+
32+
let(:index) { 'foo' }
33+
34+
it 'performs the request' do
35+
expect(client_double.indices.delete_data_stream_options(name: 'foo')).to be_a Elasticsearch::API::Response
36+
end
37+
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_options' do
21+
let(:expected_args) do
22+
[
23+
'GET',
24+
'_data_stream/foo/_options',
25+
{},
26+
nil,
27+
{},
28+
{ endpoint: 'indices.get_data_stream_options', 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_options(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_options' do
21+
let(:expected_args) do
22+
[
23+
'PUT',
24+
'_data_stream/foo/_options',
25+
{},
26+
nil,
27+
{},
28+
{ endpoint: 'indices.put_data_stream_options', defined_params: { name: 'foo' } }
29+
]
30+
end
31+
32+
it 'performs the request' do
33+
expect(client_double.indices.put_data_stream_options(name: 'foo')).to be_a Elasticsearch::API::Response
34+
end
35+
end

0 commit comments

Comments
 (0)