Skip to content

Commit bd16056

Browse files
committed
[API] Updates connectors, body and id not required in post and put anymore
1 parent d48c110 commit bd16056

File tree

2 files changed

+7
-8
lines changed
  • elasticsearch-api/lib/elasticsearch/api/actions/connector

2 files changed

+7
-8
lines changed

elasticsearch-api/lib/elasticsearch/api/actions/connector/post.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@ module Actions
2929
# support SLA of official GA features.
3030
#
3131
# @option arguments [Hash] :headers Custom HTTP headers
32-
# @option arguments [Hash] :body The connector configuration. (*Required*)
32+
# @option arguments [Hash] :body The connector configuration.
3333
#
3434
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/create-connector-api.html
3535
#
3636
def post(arguments = {})
3737
request_opts = { endpoint: arguments[:endpoint] || 'connector.post' }
3838

39-
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
40-
4139
arguments = arguments.clone
4240
headers = arguments.delete(:headers) || {}
4341

elasticsearch-api/lib/elasticsearch/api/actions/connector/put.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module Actions
3030
#
3131
# @option arguments [String] :connector_id The unique identifier of the connector to be created or updated.
3232
# @option arguments [Hash] :headers Custom HTTP headers
33-
# @option arguments [Hash] :body The connector configuration. (*Required*)
33+
# @option arguments [Hash] :body The connector configuration.
3434
#
3535
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/create-connector-api.html
3636
#
@@ -42,9 +42,6 @@ def put(arguments = {})
4242
end
4343
request_opts[:defined_params] = defined_params unless defined_params.empty?
4444

45-
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
46-
raise ArgumentError, "Required argument 'connector_id' missing" unless arguments[:connector_id]
47-
4845
arguments = arguments.clone
4946
headers = arguments.delete(:headers) || {}
5047

@@ -53,7 +50,11 @@ def put(arguments = {})
5350
_connector_id = arguments.delete(:connector_id)
5451

5552
method = Elasticsearch::API::HTTP_PUT
56-
path = "_connector/#{Utils.__listify(_connector_id)}"
53+
path = if _connector_id
54+
"_connector/#{Utils.__listify(_connector_id)}"
55+
else
56+
'_connector'
57+
end
5758
params = {}
5859

5960
Elasticsearch::API::Response.new(

0 commit comments

Comments
 (0)