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
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/ack_watch.rb', line 32 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
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/activate_watch.rb', line 31 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
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/deactivate_watch.rb', line 31 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
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/delete_watch.rb', line 32 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
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/execute_watch.rb', line 32 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
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/get_watch.rb', line 30 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
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/put_watch.rb', line 33 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
28 29 30 31 32 33 34 35 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/restart.rb', line 28 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
29 30 31 32 33 34 35 36 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/start.rb', line 29 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
31 32 33 34 35 36 37 38 39 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/stats.rb', line 31 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
29 30 31 32 33 34 35 36 |
# File 'lib/elasticsearch/xpack/api/actions/watcher/stop.rb', line 29 def stop(arguments={}) method = Elasticsearch::API::HTTP_POST path = "_xpack/watcher/_stop" params = {} body = nil perform_request(method, path, params, body).body end |