We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Iter()
RulesResult
1 parent 428554a commit 64209e7Copy full SHA for 64209e7
notifications/source/client.go
@@ -176,6 +176,18 @@ type RulesInfo struct {
176
Rules map[int64]RuleResp // Rules is a map of rule IDs to their corresponding RuleResp objects.
177
}
178
179
+// Iter returns an iterator over the rules in the RulesInfo.
180
+// It yields each RuleResp object until all rules have been processed or the yield function returns false.
181
+func (r *RulesInfo) Iter() iter.Seq[RuleResp] {
182
+ return func(yield func(RuleResp) bool) {
183
+ for _, rule := range r.Rules {
184
+ if !yield(rule) {
185
+ break
186
+ }
187
188
189
+}
190
+
191
// RuleResp represents a response object for a rule in the Icinga Notifications API.
192
type RuleResp struct {
193
Id int64 // Id is the unique identifier of the rule.
0 commit comments