Module: Sensu::API::Routes::Resolve

Includes:
Utilities::ResolveEvent
Included in:
Sensu::API::Routes
Defined in:
lib/sensu/api/routes/resolve.rb

Constant Summary collapse

RESOLVE_URI =
/^\/resolve$/

Instance Method Summary collapse

Instance Method Details

#post_resolveObject

POST /resolve



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sensu/api/routes/resolve.rb', line 12

def post_resolve
  rules = {
    :client => {:type => String, :nil_ok => false},
    :check => {:type => String, :nil_ok => false}
  }
  read_data(rules) do |data|
    @redis.hgetall("events:#{data[:client]}") do |events|
      if events.include?(data[:check])
        resolve_event(events[data[:check]])
        @response_content = {:issued => Time.now.to_i}
        accepted!
      else
        not_found!
      end
    end
  end
end