Skip to content

Commit dda6e49

Browse files
committed
[API] Updates new indices APIs
Adds experimental status message, required parameter name - delete_data_lifecycle - get_data_lifecycle - put_data_lifecycle
1 parent 3b51dd5 commit dda6e49

File tree

6 files changed

+27
-51
lines changed

6 files changed

+27
-51
lines changed

elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_data_lifecycle.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ module API
2323
module Indices
2424
module Actions
2525
# Deletes the data lifecycle of the selected data streams.
26+
# This functionality is Experimental and may be changed or removed
27+
# completely in a future release. Elastic will take a best effort approach
28+
# to fix any issues, but experimental features are not subject to the
29+
# support SLA of official GA features.
2630
#
2731
# @option arguments [List] :name A comma-separated list of data streams of which the data lifecycle will be deleted; use `*` to get all data streams
2832
# @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)
@@ -33,6 +37,8 @@ module Actions
3337
# @see https://www.elastic.co/guide/en/elasticsearch/reference/8.8/dlm-delete-lifecycle.html
3438
#
3539
def delete_data_lifecycle(arguments = {})
40+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
41+
3642
arguments = arguments.clone
3743
headers = arguments.delete(:headers) || {}
3844

@@ -41,11 +47,7 @@ def delete_data_lifecycle(arguments = {})
4147
_name = arguments.delete(:name)
4248

4349
method = Elasticsearch::API::HTTP_DELETE
44-
path = if _name
45-
"_data_stream/#{Utils.__listify(_name)}/_lifecycle"
46-
else
47-
"_data_stream/_lifecycle"
48-
end
50+
path = "_data_stream/#{Utils.__listify(_name)}/_lifecycle"
4951
params = Utils.process_params(arguments)
5052

5153
Elasticsearch::API::Response.new(

elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_lifecycle.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ module API
2323
module Indices
2424
module Actions
2525
# Returns the data lifecycle of the selected data streams.
26+
# This functionality is Experimental and may be changed or removed
27+
# completely in a future release. Elastic will take a best effort approach
28+
# to fix any issues, but experimental features are not subject to the
29+
# support SLA of official GA features.
2630
#
2731
# @option arguments [List] :name A comma-separated list of data streams to get; use `*` to get all data streams
2832
# @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)
@@ -32,6 +36,8 @@ module Actions
3236
# @see https://www.elastic.co/guide/en/elasticsearch/reference/8.8/dlm-get-lifecycle.html
3337
#
3438
def get_data_lifecycle(arguments = {})
39+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
40+
3541
arguments = arguments.clone
3642
headers = arguments.delete(:headers) || {}
3743

@@ -40,11 +46,7 @@ def get_data_lifecycle(arguments = {})
4046
_name = arguments.delete(:name)
4147

4248
method = Elasticsearch::API::HTTP_GET
43-
path = if _name
44-
"_data_stream/#{Utils.__listify(_name)}/_lifecycle"
45-
else
46-
"_data_stream/_lifecycle"
47-
end
49+
path = "_data_stream/#{Utils.__listify(_name)}/_lifecycle"
4850
params = Utils.process_params(arguments)
4951

5052
Elasticsearch::API::Response.new(

elasticsearch-api/lib/elasticsearch/api/actions/indices/put_data_lifecycle.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ module API
2323
module Indices
2424
module Actions
2525
# Updates the data lifecycle of the selected data streams.
26+
# This functionality is Experimental and may be changed or removed
27+
# completely in a future release. Elastic will take a best effort approach
28+
# to fix any issues, but experimental features are not subject to the
29+
# support SLA of official GA features.
2630
#
2731
# @option arguments [List] :name A comma-separated list of data streams whose lifecycle will be updated; use `*` to set the lifecycle to all data streams
2832
# @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)
@@ -34,6 +38,8 @@ module Actions
3438
# @see https://www.elastic.co/guide/en/elasticsearch/reference/8.8/dlm-put-lifecycle.html
3539
#
3640
def put_data_lifecycle(arguments = {})
41+
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
42+
3743
arguments = arguments.clone
3844
headers = arguments.delete(:headers) || {}
3945

@@ -42,11 +48,7 @@ def put_data_lifecycle(arguments = {})
4248
_name = arguments.delete(:name)
4349

4450
method = Elasticsearch::API::HTTP_PUT
45-
path = if _name
46-
"_data_stream/#{Utils.__listify(_name)}/_lifecycle"
47-
else
48-
"_data_stream/_lifecycle"
49-
end
51+
path = "_data_stream/#{Utils.__listify(_name)}/_lifecycle"
5052
params = Utils.process_params(arguments)
5153

5254
Elasticsearch::API::Response.new(

elasticsearch-api/spec/elasticsearch/api/actions/indices/delete_data_lifecycle_spec.rb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,14 @@
2121
let(:expected_args) do
2222
[
2323
'DELETE',
24-
url,
24+
'_data_stream/foo/_lifecycle',
2525
{},
2626
nil,
2727
{}
2828
]
2929
end
3030

31-
let(:url) { '_data_stream/_lifecycle'}
32-
3331
it 'performs the request' do
34-
expect(client_double.indices.delete_data_lifecycle).to be_a Elasticsearch::API::Response
35-
end
36-
37-
context 'when name is specified' do
38-
let(:url) { '_data_stream/foo/_lifecycle'}
39-
40-
it 'performs the request' do
41-
expect(client_double.indices.delete_data_lifecycle(name: 'foo')).to be_a Elasticsearch::API::Response
42-
end
32+
expect(client_double.indices.delete_data_lifecycle(name: 'foo')).to be_a Elasticsearch::API::Response
4333
end
4434
end

elasticsearch-api/spec/elasticsearch/api/actions/indices/get_data_lifecycle_spec.rb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,14 @@
2121
let(:expected_args) do
2222
[
2323
'GET',
24-
url,
24+
'_data_stream/foo/_lifecycle',
2525
{},
2626
nil,
2727
{}
2828
]
2929
end
3030

31-
let(:url) { '_data_stream/_lifecycle'}
32-
3331
it 'performs the request' do
34-
expect(client_double.indices.get_data_lifecycle).to be_a Elasticsearch::API::Response
35-
end
36-
37-
context 'when name is specified' do
38-
let(:url) { '_data_stream/foo/_lifecycle'}
39-
40-
it 'performs the request' do
41-
expect(client_double.indices.get_data_lifecycle(name: 'foo')).to be_a Elasticsearch::API::Response
42-
end
32+
expect(client_double.indices.get_data_lifecycle(name: 'foo')).to be_a Elasticsearch::API::Response
4333
end
4434
end

elasticsearch-api/spec/elasticsearch/api/actions/indices/put_data_lifecycle_spec.rb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,14 @@
2121
let(:expected_args) do
2222
[
2323
'PUT',
24-
url,
24+
'_data_stream/foo/_lifecycle',
2525
{},
2626
nil,
2727
{}
2828
]
2929
end
3030

31-
let(:url) { '_data_stream/_lifecycle'}
32-
3331
it 'performs the request' do
34-
expect(client_double.indices.put_data_lifecycle).to be_a Elasticsearch::API::Response
35-
end
36-
37-
context 'when name is specified' do
38-
let(:url) { '_data_stream/foo/_lifecycle'}
39-
40-
it 'performs the request' do
41-
expect(client_double.indices.put_data_lifecycle(name: 'foo')).to be_a Elasticsearch::API::Response
42-
end
32+
expect(client_double.indices.put_data_lifecycle(name: 'foo')).to be_a Elasticsearch::API::Response
4333
end
4434
end

0 commit comments

Comments
 (0)