Skip to content

Commit d6dbadf

Browse files
committed
[API] Adds required request body to APIs where it was missing
1 parent 5c1bddc commit d6dbadf

File tree

80 files changed

+156
-161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+156
-161
lines changed

elasticsearch-api/lib/elasticsearch/api/actions/close_point_in_time.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ module Actions
4646
def close_point_in_time(arguments = {})
4747
request_opts = { endpoint: arguments[:endpoint] || 'close_point_in_time' }
4848

49+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
50+
4951
arguments = arguments.clone
5052
headers = arguments.delete(:headers) || {}
5153

elasticsearch-api/lib/elasticsearch/api/actions/fleet/search.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def search(arguments = {})
102102
end
103103
request_opts[:defined_params] = defined_params unless defined_params.empty?
104104

105+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
105106
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
106107

107108
arguments = arguments.clone
@@ -111,12 +112,7 @@ def search(arguments = {})
111112

112113
_index = arguments.delete(:index)
113114

114-
method = if body
115-
Elasticsearch::API::HTTP_POST
116-
else
117-
Elasticsearch::API::HTTP_GET
118-
end
119-
115+
method = Elasticsearch::API::HTTP_POST
120116
path = "#{Utils.listify(_index)}/_fleet/_fleet_search"
121117
params = Utils.process_params(arguments)
122118

elasticsearch-api/lib/elasticsearch/api/actions/graph/explore.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def explore(arguments = {})
5858
end
5959
request_opts[:defined_params] = defined_params unless defined_params.empty?
6060

61+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
6162
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
6263

6364
arguments = arguments.clone
@@ -67,12 +68,7 @@ def explore(arguments = {})
6768

6869
_index = arguments.delete(:index)
6970

70-
method = if body
71-
Elasticsearch::API::HTTP_POST
72-
else
73-
Elasticsearch::API::HTTP_GET
74-
end
75-
71+
method = Elasticsearch::API::HTTP_POST
7672
path = "#{Utils.listify(_index)}/_graph/explore"
7773
params = Utils.process_params(arguments)
7874

elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/move_to_step.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def move_to_step(arguments = {})
5959
end
6060
request_opts[:defined_params] = defined_params unless defined_params.empty?
6161

62+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
6263
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
6364

6465
arguments = arguments.clone

elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/put_lifecycle.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def put_lifecycle(arguments = {})
5353
end
5454
request_opts[:defined_params] = defined_params unless defined_params.empty?
5555

56+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
5657
raise ArgumentError, "Required argument 'policy' missing" unless arguments[:policy]
5758

5859
arguments = arguments.clone

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,16 @@ def analyze(arguments = {})
5656
end
5757
request_opts[:defined_params] = defined_params unless defined_params.empty?
5858

59+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
60+
5961
arguments = arguments.clone
6062
headers = arguments.delete(:headers) || {}
6163

6264
body = arguments.delete(:body)
6365

6466
_index = arguments.delete(:index)
6567

66-
method = if body
67-
Elasticsearch::API::HTTP_POST
68-
else
69-
Elasticsearch::API::HTTP_GET
70-
end
71-
68+
method = Elasticsearch::API::HTTP_POST
7269
path = if _index
7370
"#{Utils.listify(_index)}/_analyze"
7471
else

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def put_data_lifecycle(arguments = {})
5959
end
6060
request_opts[:defined_params] = defined_params unless defined_params.empty?
6161

62+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
6263
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
6364

6465
arguments = arguments.clone

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def put_data_stream_options(arguments = {})
5959
end
6060
request_opts[:defined_params] = defined_params unless defined_params.empty?
6161

62+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
6263
raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
6364

6465
arguments = arguments.clone

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def shrink(arguments = {})
7878
end
7979
request_opts[:defined_params] = defined_params unless defined_params.empty?
8080

81+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
8182
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
8283
raise ArgumentError, "Required argument 'target' missing" unless arguments[:target]
8384

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def split(arguments = {})
8181
end
8282
request_opts[:defined_params] = defined_params unless defined_params.empty?
8383

84+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
8485
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
8586
raise ArgumentError, "Required argument 'target' missing" unless arguments[:target]
8687

0 commit comments

Comments
 (0)