Class: Conjur::API

Inherits:
Object
  • Object
show all
Defined in:
lib/conjur/api/audit_send.rb

Instance Method Summary collapse

Instance Method Details

#audit_send(input) ⇒ Object

Send custom event to the audit system

Parameters:

  • input (String|Hash|Array)

    event or array of events (optionally serialized to JSON)



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/conjur/api/audit_send.rb', line 25

def audit_send input 
  json = if input.kind_of? String
            input
         elsif input.kind_of? Array or input.kind_of? Hash
            input.to_json
         else
            raise ArgumentError, "Parameter should be either String, Hash or Array"
         end
  rest_api = RestClient::Resource.new(Conjur::Authz::API.host, credentials)["audit"]
  rest_api.post json, content_type: "text/plain"
end