Method: Elasticsearch::API::Watcher::Actions#ack_watch

Defined in:
lib/elasticsearch/api/actions/watcher/ack_watch.rb

#ack_watch(arguments = {}) ⇒ Object

Acknowledges a watch, manually throttling the execution of the watch’s actions.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :watch_id (String)

    Watch ID

  • :action_id (List)

    A comma-separated list of the action ids to be acked

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/elasticsearch/api/actions/watcher/ack_watch.rb', line 33

def ack_watch(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'watcher.ack_watch' }

  defined_params = %i[watch_id action_id].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  end
  request_opts[:defined_params] = defined_params unless defined_params.empty?

  raise ArgumentError, "Required argument 'watch_id' missing" unless arguments[:watch_id]

  arguments = arguments.clone
  headers = arguments.delete(:headers) || {}

  body = nil

  _watch_id = arguments.delete(:watch_id)

  _action_id = arguments.delete(:action_id)

  method = Elasticsearch::API::HTTP_PUT
  path   = if _watch_id && _action_id
             "_watcher/watch/#{Utils.__listify(_watch_id)}/_ack/#{Utils.__listify(_action_id)}"
           else
             "_watcher/watch/#{Utils.__listify(_watch_id)}/_ack"
           end
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end