Module: Elasticsearch::XPack::API::Watcher::Actions
- Included in:
- WatcherClient
- Defined in:
- lib/elasticsearch/xpack/api/namespace/watcher.rb,
lib/elasticsearch/xpack/api/actions/watcher/stop.rb,
lib/elasticsearch/xpack/api/actions/watcher/start.rb,
lib/elasticsearch/xpack/api/actions/watcher/stats.rb,
lib/elasticsearch/xpack/api/actions/watcher/restart.rb,
lib/elasticsearch/xpack/api/actions/watcher/ack_watch.rb,
lib/elasticsearch/xpack/api/actions/watcher/get_watch.rb,
lib/elasticsearch/xpack/api/actions/watcher/put_watch.rb,
lib/elasticsearch/xpack/api/actions/watcher/delete_watch.rb,
lib/elasticsearch/xpack/api/actions/watcher/execute_watch.rb,
lib/elasticsearch/xpack/api/actions/watcher/activate_watch.rb,
lib/elasticsearch/xpack/api/actions/watcher/deactivate_watch.rb
Instance Method Summary collapse
-
#ack_watch(arguments = {}) ⇒ Object
Acknowledge watch actions to throttle their executions.
-
#activate_watch(arguments = {}) ⇒ Object
Activate a currently inactive watch.
-
#deactivate_watch(arguments = {}) ⇒ Object
Deactivate a currently active watch.
-
#delete_watch(arguments = {}) ⇒ Object
Remove a watch.
-
#execute_watch(arguments = {}) ⇒ Object
Force the execution of a stored watch.
-
#get_watch(arguments = {}) ⇒ Object
Retrieve a watch.
-
#put_watch(arguments = {}) ⇒ Object
Register a new watch in or update an existing one.
-
#restart(arguments = {}) ⇒ Object
Start and stop the Watcher service.
-
#start(arguments = {}) ⇒ Object
Start the Watcher service.
-
#stats(arguments = {}) ⇒ Object
Return the current Watcher metrics.
-
#stop(arguments = {}) ⇒ Object
Stop the Watcher service.
Instance Method Details
#ack_watch(arguments = {}) ⇒ Object
Acknowledge watch actions to throttle their executions
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/ack_watch.rb', line 15 def ack_watch(arguments={}) raise ArgumentError, "Required argument 'watch_id' missing" unless arguments[:watch_id] valid_params = [ :master_timeout ] arguments = arguments.clone watch_id = arguments.delete(:watch_id) action_id = arguments.delete(:action_id) method = Elasticsearch::API::HTTP_PUT path = "_xpack/watcher/watch/#{watch_id}/_ack" path << "/#{action_id}" if action_id params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#activate_watch(arguments = {}) ⇒ Object
Activate a currently inactive watch
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/activate_watch.rb', line 14 def activate_watch(arguments={}) raise ArgumentError, "Required argument 'watch_id' missing" unless arguments[:watch_id] valid_params = [ :master_timeout ] arguments = arguments.clone watch_id = arguments.delete(:watch_id) method = Elasticsearch::API::HTTP_PUT path = "_xpack/watcher/watch/#{watch_id}/_activate" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#deactivate_watch(arguments = {}) ⇒ Object
Deactivate a currently active watch
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/deactivate_watch.rb', line 14 def deactivate_watch(arguments={}) raise ArgumentError, "Required argument 'watch_id' missing" unless arguments[:watch_id] valid_params = [ :master_timeout ] arguments = arguments.clone watch_id = arguments.delete(:watch_id) method = Elasticsearch::API::HTTP_PUT path = "_xpack/watcher/watch/#{watch_id}/_deactivate" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#delete_watch(arguments = {}) ⇒ Object
Remove a watch
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/delete_watch.rb', line 15 def delete_watch(arguments={}) raise ArgumentError, "Required argument 'id' missing" unless arguments[:id] valid_params = [ :master_timeout, :force ] method = Elasticsearch::API::HTTP_DELETE path = "_xpack/watcher/watch/#{arguments[:id]}" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil if Array(arguments[:ignore]).include?(404) Elasticsearch::API::Utils.__rescue_from_not_found { perform_request(method, path, params, body).body } else perform_request(method, path, params, body).body end end |
#execute_watch(arguments = {}) ⇒ Object
Force the execution of a stored watch
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/execute_watch.rb', line 15 def execute_watch(arguments={}) valid_params = [ :debug ] method = Elasticsearch::API::HTTP_PUT path = Elasticsearch::API::Utils.__pathify "_xpack/watcher/watch", arguments.delete(:id), "_execute" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#get_watch(arguments = {}) ⇒ Object
Retrieve a watch
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/get_watch.rb', line 13 def get_watch(arguments={}) raise ArgumentError, "Required argument 'id' missing" unless arguments[:id] method = Elasticsearch::API::HTTP_GET path = "_xpack/watcher/watch/#{arguments[:id]}" params = {} body = nil perform_request(method, path, params, body).body end |
#put_watch(arguments = {}) ⇒ Object
Register a new watch in or update an existing one
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/put_watch.rb', line 16 def put_watch(arguments={}) raise ArgumentError, "Required argument 'id' missing" unless arguments[:id] raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :master_timeout, :active, :version, :if_seq_no, :if_primary_term ] method = Elasticsearch::API::HTTP_PUT path = "_xpack/watcher/watch/#{arguments[:id]}" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#restart(arguments = {}) ⇒ Object
Start and stop the Watcher service
11 12 13 14 15 16 17 18 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/restart.rb', line 11 def restart(arguments={}) method = Elasticsearch::API::HTTP_POST path = "_xpack/watcher/_restart" params = {} body = nil perform_request(method, path, params, body).body end |
#start(arguments = {}) ⇒ Object
Start the Watcher service
12 13 14 15 16 17 18 19 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/start.rb', line 12 def start(arguments={}) method = Elasticsearch::API::HTTP_POST path = "_xpack/watcher/_start" params = {} body = nil perform_request(method, path, params, body).body end |
#stats(arguments = {}) ⇒ Object
Return the current Watcher metrics
14 15 16 17 18 19 20 21 22 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/stats.rb', line 14 def stats(arguments={}) valid_params = [ :metric, :emit_stacktraces ] method = Elasticsearch::API::HTTP_GET path = "_xpack/watcher/stats" params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |
#stop(arguments = {}) ⇒ Object
Stop the Watcher service
12 13 14 15 16 17 18 19 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/stop.rb', line 12 def stop(arguments={}) method = Elasticsearch::API::HTTP_POST path = "_xpack/watcher/_stop" params = {} body = nil perform_request(method, path, params, body).body end |