Module: Elasticsearch::API::Watcher::Actions

Included in:
WatcherClient
Defined in:
lib/elasticsearch/watcher.rb,
lib/elasticsearch/watcher/api/actions/info.rb,
lib/elasticsearch/watcher/api/actions/stop.rb,
lib/elasticsearch/watcher/api/actions/start.rb,
lib/elasticsearch/watcher/api/actions/stats.rb,
lib/elasticsearch/watcher/api/actions/restart.rb,
lib/elasticsearch/watcher/api/actions/ack_watch.rb,
lib/elasticsearch/watcher/api/actions/get_watch.rb,
lib/elasticsearch/watcher/api/actions/put_watch.rb,
lib/elasticsearch/watcher/api/actions/delete_watch.rb,
lib/elasticsearch/watcher/api/actions/execute_watch.rb

Instance Method Summary collapse

Instance Method Details

#ack_watch(arguments = {}) ⇒ Object

Throttle the execution of the watch by acknowledging it

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    Watch ID (Required)

Raises:

  • (ArgumentError)

See Also:



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/elasticsearch/watcher/api/actions/ack_watch.rb', line 12

def ack_watch(arguments={})
  raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
  valid_params = [
    :master_timeout
  ]
  method = 'PUT'
  path   = "_watcher/watch/#{arguments[:id]}/_ack"
  params = {}
  body   = nil

  perform_request(method, path, params, body).body
end

#delete_watch(arguments = {}) ⇒ Object

Delete a specific watch

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    Watch ID (Required)

  • :force (Boolean)

    Ignore any locks on the watch and force the execution

Raises:

  • (ArgumentError)

See Also:



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/elasticsearch/watcher/api/actions/delete_watch.rb', line 13

def delete_watch(arguments={})
  raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
  valid_params = [
    :master_timeout,
    :force
  ]
  method = 'DELETE'
  path   = "_watcher/watch/#{arguments[:id]}"
  params = {}
  body   = nil

  perform_request(method, path, params, body).body
end

#execute_watch(arguments = {}) ⇒ Object

Force the execution of the watch actions (eg. for testing)

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    Watch ID (Required)

  • :body (Hash)

    Execution control

Raises:

  • (ArgumentError)

See Also:



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/elasticsearch/watcher/api/actions/execute_watch.rb', line 13

def execute_watch(arguments={})
  raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
  valid_params = [
     ]
  method = 'PUT'
  path   = "_watcher/watch/#{arguments[:id]}/_execute"
  params = {}
  body   = arguments[:body]

  perform_request(method, path, params, body).body
end

#get_watch(arguments = {}) ⇒ Object

Get a specific watch

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    Watch ID (Required)

See Also:



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/elasticsearch/watcher/api/actions/get_watch.rb', line 12

def get_watch(arguments={})
  raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
  valid_params = [
     ]
  method = 'GET'
  path   = "_watcher/watch/#{arguments[:id]}"
  params = {}
  body   = nil

  perform_request(method, path, params, body).body
rescue Exception => e
  # NOTE: Use exception name, not full class in Elasticsearch::Client to allow client plugability
  if Array(arguments[:ignore]).include?(404) && e.class.to_s =~ /NotFound/; false
  else raise(e)
  end
end

#info(arguments = {}) ⇒ Object

Return information about the installed Watcher plugin



10
11
12
13
14
15
16
17
18
19
# File 'lib/elasticsearch/watcher/api/actions/info.rb', line 10

def info(arguments={})
  valid_params = [
     ]
  method = 'GET'
  path   = "/_watcher/"
  params = {}
  body   = nil

  perform_request(method, path, params, body).body
end

#put_watch(arguments = {}) ⇒ Object

Create a new watch or update an existing one

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    Watch ID (Required)

  • :body (Hash)

    The watch (Required)

  • :pretty (Boolean)

    Pretty the output

Raises:

  • (ArgumentError)

See Also:



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/elasticsearch/watcher/api/actions/put_watch.rb', line 14

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 ]
  method = 'PUT'
  path   = "_watcher/watch/#{arguments[:id]}"
  params = Utils.__validate_and_extract_params arguments, valid_params
  body   = arguments[:body]

  perform_request(method, path, params, body).body
end

#restart(arguments = {}) ⇒ Object

Restart the watcher service



11
12
13
14
15
16
17
18
19
20
# File 'lib/elasticsearch/watcher/api/actions/restart.rb', line 11

def restart(arguments={})
  valid_params = [
     ]
  method = 'PUT'
  path   = "/_watcher/_restart"
  params = {}
  body   = nil

  perform_request(method, path, params, body).body
end

#start(arguments = {}) ⇒ Object

Start the watcher service



10
11
12
13
14
15
16
17
18
19
# File 'lib/elasticsearch/watcher/api/actions/start.rb', line 10

def start(arguments={})
  valid_params = [
     ]
  method = 'PUT'
  path   = "/_watcher/_start"
  params = {}
  body   = nil

  perform_request(method, path, params, body).body
end

#stats(arguments = {}) ⇒ Object

Return statistical information about the watcher service



10
11
12
13
14
15
16
17
18
19
# File 'lib/elasticsearch/watcher/api/actions/stats.rb', line 10

def stats(arguments={})
  valid_params = [
     ]
  method = 'GET'
  path   = "/_watcher/stats"
  params = {}
  body   = nil

  perform_request(method, path, params, body).body
end

#stop(arguments = {}) ⇒ Object

Stop the watcher service



10
11
12
13
14
15
16
17
18
19
# File 'lib/elasticsearch/watcher/api/actions/stop.rb', line 10

def stop(arguments={})
  valid_params = [
     ]
  method = 'PUT'
  path   = "/_watcher/_stop"
  params = {}
  body   = nil

  perform_request(method, path, params, body).body
end