Refacto opsgenie-event to apiv2#104
Conversation
| if self.sc_event.event.categories == 1 then | ||
| local endpoint = self.sc_params.params.api_url .. url_path | ||
| else | ||
| local endpoint = self.sc_params.params.integration_api_token .. url_path | ||
| end |
There was a problem hiding this comment.
there, we have a little big issue :)
what does it mean ?
it means that depending on the type of event, we need to send them to a dedicated endpoint.
this is handled by the new lib sc_flush and we have a new parameter called send_mixed_events .
when do we need it ? when people want to send ba_status events.
force send_mixed_events to 0 when accepted_categories contains bam
change EventQueue:send_data(payload) to EventQueue:send_data(payload, info) (I'll need to do an update of the sc_flush module)
you'll also need to change [1] = function (payload) return self:send_data(payload) end and add the info parameter
the info method argument will only be available when we don't send mixed events and it will have the following structure
{
"category_name"= "category_name",
"category_id" = "category_id",
"element_name" = "element_name",
"element_id" = "element_id"
}you'll then be able to transform your condition
Refactor the Opsgenie event code to suit the apiv2 version by adding adaptations of the "write", "build_payload" and "send_data" functions.