diff --git a/notifier/registrator.go b/notifier/registrator.go index fac5e09a9..dca314e55 100644 --- a/notifier/registrator.go +++ b/notifier/registrator.go @@ -2,23 +2,23 @@ package notifier import ( "fmt" + "github.com/moira-alert/moira/notifier/senders/discord" + "github.com/moira-alert/moira/notifier/senders/mail" + "github.com/moira-alert/moira/notifier/senders/mattermost" + "github.com/moira-alert/moira/notifier/senders/msteams" + "github.com/moira-alert/moira/notifier/senders/opsgenie" + "github.com/moira-alert/moira/notifier/senders/pagerduty" + "github.com/moira-alert/moira/notifier/senders/pushover" + "github.com/moira-alert/moira/notifier/senders/script" + "github.com/moira-alert/moira/notifier/senders/selfstate" + "github.com/moira-alert/moira/notifier/senders/slack" + "github.com/moira-alert/moira/notifier/senders/telegram" + "github.com/moira-alert/moira/notifier/senders/twilio" + "github.com/moira-alert/moira/notifier/senders/victorops" + "github.com/moira-alert/moira/notifier/senders/webhook" "strings" "github.com/moira-alert/moira" - "github.com/moira-alert/moira/senders/discord" - "github.com/moira-alert/moira/senders/mail" - "github.com/moira-alert/moira/senders/mattermost" - "github.com/moira-alert/moira/senders/msteams" - "github.com/moira-alert/moira/senders/opsgenie" - "github.com/moira-alert/moira/senders/pagerduty" - "github.com/moira-alert/moira/senders/pushover" - "github.com/moira-alert/moira/senders/script" - "github.com/moira-alert/moira/senders/selfstate" - "github.com/moira-alert/moira/senders/slack" - "github.com/moira-alert/moira/senders/telegram" - "github.com/moira-alert/moira/senders/twilio" - "github.com/moira-alert/moira/senders/victorops" - "github.com/moira-alert/moira/senders/webhook" // "github.com/moira-alert/moira/senders/kontur" ) diff --git a/senders/calc_message_parts.go b/notifier/senders/calc_message_parts.go similarity index 100% rename from senders/calc_message_parts.go rename to notifier/senders/calc_message_parts.go diff --git a/senders/calc_message_parts_test.go b/notifier/senders/calc_message_parts_test.go similarity index 100% rename from senders/calc_message_parts_test.go rename to notifier/senders/calc_message_parts_test.go diff --git a/senders/discord/response.go b/notifier/senders/discord/response.go similarity index 100% rename from senders/discord/response.go rename to notifier/senders/discord/response.go diff --git a/senders/discord/response_test.go b/notifier/senders/discord/response_test.go similarity index 100% rename from senders/discord/response_test.go rename to notifier/senders/discord/response_test.go diff --git a/senders/discord/send.go b/notifier/senders/discord/send.go similarity index 98% rename from senders/discord/send.go rename to notifier/senders/discord/send.go index f2fb34ebb..5dba94d1f 100644 --- a/senders/discord/send.go +++ b/notifier/senders/discord/send.go @@ -3,13 +3,13 @@ package discord import ( "bytes" "fmt" + "github.com/moira-alert/moira/notifier/senders" "net/http" "regexp" "strings" "github.com/bwmarrin/discordgo" "github.com/moira-alert/moira" - "github.com/moira-alert/moira/senders" ) const ( diff --git a/senders/discord/send_test.go b/notifier/senders/discord/send_test.go similarity index 100% rename from senders/discord/send_test.go rename to notifier/senders/discord/send_test.go diff --git a/senders/discord/sender.go b/notifier/senders/discord/sender.go similarity index 100% rename from senders/discord/sender.go rename to notifier/senders/discord/sender.go diff --git a/senders/discord/sender_test.go b/notifier/senders/discord/sender_test.go similarity index 100% rename from senders/discord/sender_test.go rename to notifier/senders/discord/sender_test.go diff --git a/senders/mail/mail.go b/notifier/senders/mail/mail.go similarity index 100% rename from senders/mail/mail.go rename to notifier/senders/mail/mail.go diff --git a/senders/mail/mail_test.go b/notifier/senders/mail/mail_test.go similarity index 100% rename from senders/mail/mail_test.go rename to notifier/senders/mail/mail_test.go diff --git a/senders/mail/send.go b/notifier/senders/mail/send.go similarity index 100% rename from senders/mail/send.go rename to notifier/senders/mail/send.go diff --git a/senders/mail/send_test.go b/notifier/senders/mail/send_test.go similarity index 96% rename from senders/mail/send_test.go rename to notifier/senders/mail/send_test.go index d14a43000..c8c24e142 100644 --- a/senders/mail/send_test.go +++ b/notifier/senders/mail/send_test.go @@ -48,7 +48,7 @@ some other text _italics text_`, } Convey("Make message", t, func() { - message := sender.makeMessage(generateTestEvents(10, trigger.ID), contact, trigger, [][]byte{[]byte{1, 0, 1}}, true) //nolint + message := sender.makeMessage(generateTestEvents(10, trigger.ID), contact, trigger, [][]byte{{1, 0, 1}}, true) //nolint So(message.GetHeader("From")[0], ShouldEqual, sender.From) So(message.GetHeader("To")[0], ShouldEqual, contact.Value) @@ -107,7 +107,7 @@ func TestEmptyTriggerID(t *testing.T) { } Convey("Make message", t, func() { - message := sender.makeMessage(generateTestEvents(10, trigger.ID), contact, trigger, [][]byte{[]byte{1, 0, 1}}, true) //nolint + message := sender.makeMessage(generateTestEvents(10, trigger.ID), contact, trigger, [][]byte{{1, 0, 1}}, true) //nolint So(message.GetHeader("From")[0], ShouldEqual, sender.From) So(message.GetHeader("To")[0], ShouldEqual, contact.Value) messageStr := new(bytes.Buffer) diff --git a/senders/mail/template.go b/notifier/senders/mail/template.go similarity index 100% rename from senders/mail/template.go rename to notifier/senders/mail/template.go diff --git a/senders/mattermost/client.go b/notifier/senders/mattermost/client.go similarity index 100% rename from senders/mattermost/client.go rename to notifier/senders/mattermost/client.go diff --git a/senders/mattermost/doc.go b/notifier/senders/mattermost/doc.go similarity index 100% rename from senders/mattermost/doc.go rename to notifier/senders/mattermost/doc.go diff --git a/senders/mattermost/sender.go b/notifier/senders/mattermost/sender.go similarity index 99% rename from senders/mattermost/sender.go rename to notifier/senders/mattermost/sender.go index bc672d6be..c82e1630b 100644 --- a/senders/mattermost/sender.go +++ b/notifier/senders/mattermost/sender.go @@ -3,15 +3,14 @@ package mattermost import ( "crypto/tls" "fmt" + "github.com/moira-alert/moira/notifier/senders" "net/http" "strconv" "strings" "time" - "github.com/moira-alert/moira" - "github.com/moira-alert/moira/senders" - "github.com/mattermost/mattermost-server/v6/model" + "github.com/moira-alert/moira" ) // Sender posts messages to Mattermost chat. diff --git a/senders/mattermost/sender_internal_test.go b/notifier/senders/mattermost/sender_internal_test.go similarity index 100% rename from senders/mattermost/sender_internal_test.go rename to notifier/senders/mattermost/sender_internal_test.go diff --git a/senders/mattermost/sender_manual_test.go b/notifier/senders/mattermost/sender_manual_test.go similarity index 95% rename from senders/mattermost/sender_manual_test.go rename to notifier/senders/mattermost/sender_manual_test.go index bf59ef657..831ecf928 100644 --- a/senders/mattermost/sender_manual_test.go +++ b/notifier/senders/mattermost/sender_manual_test.go @@ -3,12 +3,11 @@ package mattermost_test import ( + "github.com/moira-alert/moira/notifier/senders/mattermost" "testing" "time" "github.com/moira-alert/moira" - "github.com/moira-alert/moira/senders/mattermost" - . "github.com/smartystreets/goconvey/convey" ) diff --git a/senders/mattermost/sender_test.go b/notifier/senders/mattermost/sender_test.go similarity index 96% rename from senders/mattermost/sender_test.go rename to notifier/senders/mattermost/sender_test.go index 216efcd4b..7e236112c 100644 --- a/senders/mattermost/sender_test.go +++ b/notifier/senders/mattermost/sender_test.go @@ -1,10 +1,9 @@ package mattermost_test import ( + "github.com/moira-alert/moira/notifier/senders/mattermost" "testing" - "github.com/moira-alert/moira/senders/mattermost" - . "github.com/smartystreets/goconvey/convey" ) diff --git a/senders/msteams/datatypes.go b/notifier/senders/msteams/datatypes.go similarity index 100% rename from senders/msteams/datatypes.go rename to notifier/senders/msteams/datatypes.go diff --git a/senders/msteams/msteams.go b/notifier/senders/msteams/msteams.go similarity index 100% rename from senders/msteams/msteams.go rename to notifier/senders/msteams/msteams.go diff --git a/senders/msteams/msteams_test.go b/notifier/senders/msteams/msteams_test.go similarity index 100% rename from senders/msteams/msteams_test.go rename to notifier/senders/msteams/msteams_test.go diff --git a/senders/opsgenie/send.go b/notifier/senders/opsgenie/send.go similarity index 99% rename from senders/opsgenie/send.go rename to notifier/senders/opsgenie/send.go index d078c9862..f0c5db205 100644 --- a/senders/opsgenie/send.go +++ b/notifier/senders/opsgenie/send.go @@ -4,10 +4,10 @@ import ( "bytes" "context" "fmt" + "github.com/moira-alert/moira/notifier/senders" "strings" "github.com/moira-alert/moira" - "github.com/moira-alert/moira/senders" "github.com/opsgenie/opsgenie-go-sdk-v2/alert" blackfriday "github.com/russross/blackfriday/v2" ) diff --git a/senders/opsgenie/send_test.go b/notifier/senders/opsgenie/send_test.go similarity index 100% rename from senders/opsgenie/send_test.go rename to notifier/senders/opsgenie/send_test.go diff --git a/senders/opsgenie/sender.go b/notifier/senders/opsgenie/sender.go similarity index 96% rename from senders/opsgenie/sender.go rename to notifier/senders/opsgenie/sender.go index 3e81a8cd2..b3b16c617 100644 --- a/senders/opsgenie/sender.go +++ b/notifier/senders/opsgenie/sender.go @@ -2,10 +2,10 @@ package opsgenie import ( "fmt" + "github.com/moira-alert/moira/notifier/senders" "time" "github.com/moira-alert/moira" - "github.com/moira-alert/moira/senders" "github.com/opsgenie/opsgenie-go-sdk-v2/alert" "github.com/opsgenie/opsgenie-go-sdk-v2/client" ) diff --git a/senders/opsgenie/sender_test.go b/notifier/senders/opsgenie/sender_test.go similarity index 100% rename from senders/opsgenie/sender_test.go rename to notifier/senders/opsgenie/sender_test.go diff --git a/senders/pagerduty/send.go b/notifier/senders/pagerduty/send.go similarity index 100% rename from senders/pagerduty/send.go rename to notifier/senders/pagerduty/send.go diff --git a/senders/pagerduty/send_test.go b/notifier/senders/pagerduty/send_test.go similarity index 100% rename from senders/pagerduty/send_test.go rename to notifier/senders/pagerduty/send_test.go diff --git a/senders/pagerduty/sender.go b/notifier/senders/pagerduty/sender.go similarity index 95% rename from senders/pagerduty/sender.go rename to notifier/senders/pagerduty/sender.go index 21819fb80..3fe3bcc20 100644 --- a/senders/pagerduty/sender.go +++ b/notifier/senders/pagerduty/sender.go @@ -1,10 +1,10 @@ package pagerduty import ( + "github.com/moira-alert/moira/notifier/senders" "time" "github.com/moira-alert/moira" - "github.com/moira-alert/moira/senders" ) // Sender implements moira sender interface for PagerDuty. diff --git a/senders/pagerduty/sender_test.go b/notifier/senders/pagerduty/sender_test.go similarity index 100% rename from senders/pagerduty/sender_test.go rename to notifier/senders/pagerduty/sender_test.go diff --git a/senders/pushover/pushover.go b/notifier/senders/pushover/pushover.go similarity index 100% rename from senders/pushover/pushover.go rename to notifier/senders/pushover/pushover.go diff --git a/senders/pushover/pushover_test.go b/notifier/senders/pushover/pushover_test.go similarity index 100% rename from senders/pushover/pushover_test.go rename to notifier/senders/pushover/pushover_test.go diff --git a/senders/read_image_store_config.go b/notifier/senders/read_image_store_config.go similarity index 100% rename from senders/read_image_store_config.go rename to notifier/senders/read_image_store_config.go diff --git a/senders/read_image_store_config_test.go b/notifier/senders/read_image_store_config_test.go similarity index 100% rename from senders/read_image_store_config_test.go rename to notifier/senders/read_image_store_config_test.go diff --git a/senders/script/script.go b/notifier/senders/script/script.go similarity index 100% rename from senders/script/script.go rename to notifier/senders/script/script.go diff --git a/senders/script/script_test.go b/notifier/senders/script/script_test.go similarity index 100% rename from senders/script/script_test.go rename to notifier/senders/script/script_test.go diff --git a/senders/selfstate/selfstate.go b/notifier/senders/selfstate/selfstate.go similarity index 100% rename from senders/selfstate/selfstate.go rename to notifier/senders/selfstate/selfstate.go diff --git a/senders/selfstate/selfstate_test.go b/notifier/senders/selfstate/selfstate_test.go similarity index 100% rename from senders/selfstate/selfstate_test.go rename to notifier/senders/selfstate/selfstate_test.go diff --git a/senders/slack/slack.go b/notifier/senders/slack/slack.go similarity index 99% rename from senders/slack/slack.go rename to notifier/senders/slack/slack.go index d270dca55..84e0b00f7 100644 --- a/senders/slack/slack.go +++ b/notifier/senders/slack/slack.go @@ -3,13 +3,13 @@ package slack import ( "bytes" "fmt" + "github.com/moira-alert/moira/notifier/senders" "strconv" "strings" "time" slackdown "github.com/karriereat/blackfriday-slack" "github.com/moira-alert/moira" - "github.com/moira-alert/moira/senders" blackfriday "github.com/russross/blackfriday/v2" "github.com/slack-go/slack" diff --git a/senders/slack/slack_test.go b/notifier/senders/slack/slack_test.go similarity index 100% rename from senders/slack/slack_test.go rename to notifier/senders/slack/slack_test.go diff --git a/senders/telegram/handle_message.go b/notifier/senders/telegram/handle_message.go similarity index 100% rename from senders/telegram/handle_message.go rename to notifier/senders/telegram/handle_message.go diff --git a/senders/telegram/handle_message_test.go b/notifier/senders/telegram/handle_message_test.go similarity index 100% rename from senders/telegram/handle_message_test.go rename to notifier/senders/telegram/handle_message_test.go diff --git a/senders/telegram/send.go b/notifier/senders/telegram/send.go similarity index 100% rename from senders/telegram/send.go rename to notifier/senders/telegram/send.go diff --git a/senders/telegram/send_test.go b/notifier/senders/telegram/send_test.go similarity index 100% rename from senders/telegram/send_test.go rename to notifier/senders/telegram/send_test.go diff --git a/senders/telegram/sender.go b/notifier/senders/telegram/sender.go similarity index 100% rename from senders/telegram/sender.go rename to notifier/senders/telegram/sender.go diff --git a/senders/telegram/sender_test.go b/notifier/senders/telegram/sender_test.go similarity index 93% rename from senders/telegram/sender_test.go rename to notifier/senders/telegram/sender_test.go index fb1241edd..d09bc4be6 100644 --- a/senders/telegram/sender_test.go +++ b/notifier/senders/telegram/sender_test.go @@ -2,11 +2,11 @@ package telegram_test import ( "fmt" + "github.com/moira-alert/moira/notifier/senders/telegram" "testing" "time" logging "github.com/moira-alert/moira/logging/zerolog_adapter" - "github.com/moira-alert/moira/senders/telegram" . "github.com/smartystreets/goconvey/convey" ) diff --git a/senders/twilio/sms.go b/notifier/senders/twilio/sms.go similarity index 97% rename from senders/twilio/sms.go rename to notifier/senders/twilio/sms.go index b25ab0709..8a4b3772e 100644 --- a/senders/twilio/sms.go +++ b/notifier/senders/twilio/sms.go @@ -14,7 +14,7 @@ type twilioSenderSms struct { twilioSender } -func (sender *twilioSenderSms) SendEvents(events moira.NotificationEvents, contact moira.ContactData, trigger moira.TriggerData, plots [][]byte, throttled bool) error { +func (sender *twilioSenderSms) SendEvents(events moira.NotificationEvents, contact moira.ContactData, trigger moira.TriggerData, _ [][]byte, throttled bool) error { message := sender.buildMessage(events, trigger, throttled) sender.logger.Debugf("Calling twilio sms api to phone %s and message body %s", contact.Value, message) twilioMessage, err := twilio.NewMessage(sender.client, sender.APIFromPhone, contact.Value, twilio.Body(message)) diff --git a/senders/twilio/sms_test.go b/notifier/senders/twilio/sms_test.go similarity index 100% rename from senders/twilio/sms_test.go rename to notifier/senders/twilio/sms_test.go diff --git a/senders/twilio/twilio.go b/notifier/senders/twilio/twilio.go similarity index 100% rename from senders/twilio/twilio.go rename to notifier/senders/twilio/twilio.go diff --git a/senders/twilio/twilio_test.go b/notifier/senders/twilio/twilio_test.go similarity index 100% rename from senders/twilio/twilio_test.go rename to notifier/senders/twilio/twilio_test.go diff --git a/senders/twilio/voice.go b/notifier/senders/twilio/voice.go similarity index 87% rename from senders/twilio/voice.go rename to notifier/senders/twilio/voice.go index 116d9d569..9f7483936 100644 --- a/senders/twilio/voice.go +++ b/notifier/senders/twilio/voice.go @@ -17,7 +17,7 @@ type twilioSenderVoice struct { twimletsEcho bool } -func (sender *twilioSenderVoice) SendEvents(events moira.NotificationEvents, contact moira.ContactData, trigger moira.TriggerData, plots [][]byte, throttled bool) error { +func (sender *twilioSenderVoice) SendEvents(_ moira.NotificationEvents, contact moira.ContactData, trigger moira.TriggerData, _ [][]byte, _ bool) error { voiceURL := sender.buildVoiceURL(trigger) twilioCall, err := twilio.NewCall(sender.client, sender.APIFromPhone, contact.Value, twilio.Callback(voiceURL)) if err != nil { diff --git a/senders/twilio/voice_test.go b/notifier/senders/twilio/voice_test.go similarity index 100% rename from senders/twilio/voice_test.go rename to notifier/senders/twilio/voice_test.go diff --git a/senders/victorops/api/alert.go b/notifier/senders/victorops/api/alert.go similarity index 100% rename from senders/victorops/api/alert.go rename to notifier/senders/victorops/api/alert.go diff --git a/senders/victorops/api/alert_test.go b/notifier/senders/victorops/api/alert_test.go similarity index 100% rename from senders/victorops/api/alert_test.go rename to notifier/senders/victorops/api/alert_test.go diff --git a/senders/victorops/api/client.go b/notifier/senders/victorops/api/client.go similarity index 100% rename from senders/victorops/api/client.go rename to notifier/senders/victorops/api/client.go diff --git a/senders/victorops/api/client_test.go b/notifier/senders/victorops/api/client_test.go similarity index 100% rename from senders/victorops/api/client_test.go rename to notifier/senders/victorops/api/client_test.go diff --git a/senders/victorops/send.go b/notifier/senders/victorops/send.go similarity index 98% rename from senders/victorops/send.go rename to notifier/senders/victorops/send.go index 85c9b1cc2..ad36228ef 100644 --- a/senders/victorops/send.go +++ b/notifier/senders/victorops/send.go @@ -2,13 +2,13 @@ package victorops import ( "fmt" + "github.com/moira-alert/moira/notifier/senders/victorops/api" "strings" "time" stripmd "github.com/writeas/go-strip-markdown" "github.com/moira-alert/moira" - "github.com/moira-alert/moira/senders/victorops/api" ) // SendEvents implements Sender interface Send diff --git a/senders/victorops/send_test.go b/notifier/senders/victorops/send_test.go similarity index 98% rename from senders/victorops/send_test.go rename to notifier/senders/victorops/send_test.go index d2fb0e857..b3d9e4f19 100644 --- a/senders/victorops/send_test.go +++ b/notifier/senders/victorops/send_test.go @@ -1,12 +1,11 @@ package victorops import ( + "github.com/moira-alert/moira/notifier/senders/victorops/api" "testing" "time" "github.com/golang/mock/gomock" - "github.com/moira-alert/moira/senders/victorops/api" - "github.com/moira-alert/moira" mock_moira_alert "github.com/moira-alert/moira/mock/moira-alert" . "github.com/smartystreets/goconvey/convey" diff --git a/senders/victorops/sender.go b/notifier/senders/victorops/sender.go similarity index 96% rename from senders/victorops/sender.go rename to notifier/senders/victorops/sender.go index 101856c14..d743e65d0 100644 --- a/senders/victorops/sender.go +++ b/notifier/senders/victorops/sender.go @@ -2,10 +2,9 @@ package victorops import ( "fmt" + "github.com/moira-alert/moira/notifier/senders/victorops/api" "time" - "github.com/moira-alert/moira/senders/victorops/api" - "github.com/moira-alert/moira" ) diff --git a/senders/victorops/sender_test.go b/notifier/senders/victorops/sender_test.go similarity index 97% rename from senders/victorops/sender_test.go rename to notifier/senders/victorops/sender_test.go index 6a0b7de79..bdba7222e 100644 --- a/senders/victorops/sender_test.go +++ b/notifier/senders/victorops/sender_test.go @@ -2,13 +2,12 @@ package victorops import ( "fmt" + "github.com/moira-alert/moira/notifier/senders/victorops/api" "testing" "time" "github.com/golang/mock/gomock" "github.com/moira-alert/moira" - "github.com/moira-alert/moira/senders/victorops/api" - logging "github.com/moira-alert/moira/logging/zerolog_adapter" mock_moira_alert "github.com/moira-alert/moira/mock/moira-alert" . "github.com/smartystreets/goconvey/convey" diff --git a/senders/webhook/payload.go b/notifier/senders/webhook/payload.go similarity index 100% rename from senders/webhook/payload.go rename to notifier/senders/webhook/payload.go diff --git a/senders/webhook/request.go b/notifier/senders/webhook/request.go similarity index 100% rename from senders/webhook/request.go rename to notifier/senders/webhook/request.go diff --git a/senders/webhook/request_test.go b/notifier/senders/webhook/request_test.go similarity index 100% rename from senders/webhook/request_test.go rename to notifier/senders/webhook/request_test.go diff --git a/senders/webhook/webhook.go b/notifier/senders/webhook/webhook.go similarity index 100% rename from senders/webhook/webhook.go rename to notifier/senders/webhook/webhook.go diff --git a/senders/webhook/webhook_test.go b/notifier/senders/webhook/webhook_test.go similarity index 100% rename from senders/webhook/webhook_test.go rename to notifier/senders/webhook/webhook_test.go