99 "iter"
1010 "net/http"
1111 "net/url"
12- "strconv"
1312 "strings"
1413
1514 "github.com/icinga/icinga-go-library/notifications/event"
@@ -88,9 +87,8 @@ func NewClient(cfg Config, projectName string) (*Client, error) {
8887
8988// ProcessEvent submits an event to the Icinga Notifications /process-event API endpoint.
9089//
91- // It serializes the event into JSON and sends it as a POST request to the process event endpoint.
92- // The given ruleVersion is transmitted as [XIcingaRulesVersion] header along with the [XIcingaRulesId] header,
93- // containing a comma-separated list of rule IDs.
90+ // It serializes the event into JSON and sends it as a POST request to the process event endpoint. In most cases, the
91+ // Event.RulesVersion and Event.RuleIds must be set.
9492//
9593// It may return an ErrRulesOutdated error, implying that the provided ruleVersion does not match the current rules
9694// version in Icinga Notifications daemon. In this case, it will also return the current rules specific to your source
@@ -99,7 +97,7 @@ func NewClient(cfg Config, projectName string) (*Client, error) {
9997// you're using an outdated event rules config.
10098//
10199// If the request fails or the response is not as expected, it returns an error; otherwise, it returns nil.
102- func (c * Client ) ProcessEvent (ctx context.Context , ev * event.Event , ruleVersion string , ruleIDs ... int64 ) (* RulesInfo , error ) {
100+ func (c * Client ) ProcessEvent (ctx context.Context , ev * event.Event ) (* RulesInfo , error ) {
103101 body , err := json .Marshal (ev )
104102 if err != nil {
105103 return nil , errors .Wrap (err , "cannot encode event to JSON" )
@@ -110,15 +108,8 @@ func (c *Client) ProcessEvent(ctx context.Context, ev *event.Event, ruleVersion
110108 return nil , errors .Wrap (err , "cannot create HTTP request" )
111109 }
112110
113- ruleIdsStrArr := make ([]string , 0 , len (ruleIDs ))
114- for _ , ruleId := range ruleIDs {
115- ruleIdsStrArr = append (ruleIdsStrArr , strconv .FormatInt (ruleId , 10 ))
116- }
117-
118111 req .Header .Add ("Content-Type" , "application/json" )
119112 req .Header .Add ("Accept" , "application/json" )
120- req .Header .Add (XIcingaRulesVersion , ruleVersion )
121- req .Header .Add (XIcingaRulesId , strings .Join (ruleIdsStrArr , "," ))
122113
123114 resp , err := c .client .Do (req )
124115 if err != nil {
0 commit comments