diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb b/elasticsearch-api/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb new file mode 100644 index 0000000000..fdff686f0d --- /dev/null +++ b/elasticsearch-api/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb @@ -0,0 +1,37 @@ +module Elasticsearch + module API + module Nodes + module Actions + + # Re-read the local node's encrypted keystore. Specifically, it will prompt the keystore + # decryption and reading across the cluster. + # + # @example Reload secure settings for all nodes + # + # client.nodes.reload_secure_settings + # + # @example Reload secure settings for a list of nodes + # + # client.nodes.reload_secure_settings(node_id: 'foo,bar') + # + # @option arguments [ Array ] :node_id A comma-separated list of node IDs or names to perform the operation on + # @option arguments [ String ] :timeout Explicit operation timeout + # + # @see http://elasticsearch.org/guide/reference/api/cluster-nodes-reload-secure-settings + # + def reload_secure_settings(arguments={}) + valid_params = [ + :timeout ] + + method = HTTP_POST + path = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]), 'reload_secure_settings' + + params = Utils.__validate_and_extract_params arguments, valid_params + body = nil + + perform_request(method, path, params, body).body + end + end + end + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/nodes/reload_secure_settings_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/nodes/reload_secure_settings_spec.rb new file mode 100644 index 0000000000..41f0cccb57 --- /dev/null +++ b/elasticsearch-api/spec/elasticsearch/api/actions/nodes/reload_secure_settings_spec.rb @@ -0,0 +1,70 @@ +require 'spec_helper' + +describe 'client#reload_secure_settings' do + + let(:expected_args) do + [ + 'POST', + url, + params, + nil, + nil + ] + end + + let(:params) do + {} + end + + let(:url) do + '_nodes/reload_secure_settings' + end + + it 'performs the request' do + expect(client_double.nodes.reload_secure_settings()).to eq({}) + end + + context 'when a node id is specified' do + + let(:url) do + '_nodes/foo/reload_secure_settings' + end + + it 'performs the request' do + expect(client_double.nodes.reload_secure_settings(node_id: 'foo')).to eq({}) + end + end + + context 'when more than one node id is specified as a string' do + + let(:url) do + '_nodes/foo,bar/reload_secure_settings' + end + + it 'performs the request' do + expect(client_double.nodes.reload_secure_settings(node_id: 'foo,bar', body: { foo: 'bar' })).to eq({}) + end + end + + context 'when more than one node id is specified as a list' do + + let(:url) do + '_nodes/foo,bar/reload_secure_settings' + end + + it 'performs the request' do + expect(client_double.nodes.reload_secure_settings(node_id: ['foo', 'bar'], body: { foo: 'bar' })).to eq({}) + end + end + + context 'when a timeout param is specified' do + + let(:params) do + { timeout: '30s'} + end + + it 'performs the request' do + expect(client_double.nodes.reload_secure_settings(timeout: '30s')).to eq({}) + end + end +end