88 "fmt"
99 "github.com/icinga/icinga-go-library/database"
1010 "github.com/icinga/icinga-go-library/logging"
11- "github.com/icinga/icinga-go-library/notifications"
1211 baseEv "github.com/icinga/icinga-go-library/notifications/event"
12+ "github.com/icinga/icinga-go-library/notifications/source"
1313 "github.com/icinga/icinga-notifications/internal"
1414 "github.com/icinga/icinga-notifications/internal/config"
1515 "github.com/icinga/icinga-notifications/internal/daemon"
@@ -124,30 +124,30 @@ func (l *Listener) ProcessEvent(w http.ResponseWriter, r *http.Request) {
124124 return
125125 }
126126
127- source , validAuth := l .sourceFromAuthOrAbort (w , r )
127+ src , validAuth := l .sourceFromAuthOrAbort (w , r )
128128 if ! validAuth {
129129 return
130130 }
131131
132- ruleIdsStr := r .Header .Get (notifications .XIcingaRulesId )
133- ruleVersion := r .Header .Get (notifications .XIcingaRulesVersion )
132+ ruleIdsStr := r .Header .Get (source .XIcingaRulesId )
133+ ruleVersion := r .Header .Get (source .XIcingaRulesVersion )
134134
135135 // If the client uses an outdated rules version, reject the request but send also the current rules version
136136 // and rules for this source back to the client, so it can retry the request with the updated rules.
137- if latestRuleVersion := l .runtimeConfig .GetRulesVersionFor (source .ID ); ruleVersion != latestRuleVersion {
137+ if latestRuleVersion := l .runtimeConfig .GetRulesVersionFor (src .ID ); ruleVersion != latestRuleVersion {
138138 w .WriteHeader (http .StatusPreconditionFailed )
139- l .writeSourceRulesInfo (w , source )
139+ l .writeSourceRulesInfo (w , src )
140140
141141 l .logger .Debugw ("Abort event processing due to outdated rules version" ,
142142 zap .String ("current_version" , latestRuleVersion ),
143143 zap .String ("provided_version" , ruleVersion ),
144- zap .String ("source" , source .Name ))
144+ zap .String ("source" , src .Name ))
145145 return
146146 }
147147
148148 var ev event.Event
149149 if err := ev .LoadMatchedRulesFromString (ruleIdsStr ); err != nil {
150- abort (http .StatusBadRequest , nil , "cannot parse %s header: %v" , notifications .XIcingaRulesId , err )
150+ abort (http .StatusBadRequest , nil , "cannot parse %s header: %v" , source .XIcingaRulesId , err )
151151 return
152152 }
153153
@@ -157,7 +157,7 @@ func (l *Listener) ProcessEvent(w http.ResponseWriter, r *http.Request) {
157157 }
158158
159159 ev .Time = time .Now ()
160- ev .SourceId = source .ID
160+ ev .SourceId = src .ID
161161 if ev .Type == baseEv .TypeUnknown {
162162 ev .Type = baseEv .TypeState
163163 } else if ! ev .Mute .Valid && ev .Type == baseEv .TypeMute {
0 commit comments