Skip to content

Commit

Permalink
update snow
Browse files Browse the repository at this point in the history
  • Loading branch information
tanguyvda committed Oct 11, 2021
1 parent 5ab906a commit f7cdc71
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions centreon-certified/servicenow/servicenow-events-apiv2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ EventQueue.__index = EventQueue
-- @return the new EventQueue
--------------------------------------------------------------------------------

function EventQueue:new (params)
function EventQueue.new (params)
local self = {}
local mandatory_parameters = {
[1] = "instance",
Expand Down Expand Up @@ -358,6 +358,11 @@ end

local queue

-- Fonction init()
function init(conf)
queue = EventQueue.new(conf)
end

--------------------------------------------------------------------------------
-- init, initiate stream connector with parameters from the configuration file
-- @param {table} parameters, the table with all the configuration parameters
Expand All @@ -382,10 +387,17 @@ end
-- @return {boolean}
--------------------------------------------------------------------------------
function EventQueue:send_data(data, element)
local authToken = self:getAuthToken()
local authToken
local counter = 0
local http_post_data

-- generate a fake token for test purpose or use a real one if not testing
if self.sc_params.params.send_data_test == 1 then
authToken = "fake_token"
else
authToken = self:getAuthToken()
end

for _, raw_event in ipairs(data) do
if counter == 0 then
http_post_data = broker.json_encode(raw_event)
Expand Down

0 comments on commit f7cdc71

Please sign in to comment.