Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refacto opsgenie-event to apiv2 #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

psamecentreon
Copy link
Contributor

Refactor the Opsgenie event code to suit the apiv2 version by adding adaptations of the "write", "build_payload" and "send_data" functions.

@psamecentreon psamecentreon added the enhancement Enhance existing label Apr 11, 2022
@psamecentreon psamecentreon self-assigned this Apr 11, 2022
Comment on lines +276 to +280
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@kduret
Copy link
Contributor

kduret commented Feb 24, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhance existing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants