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 ddb2b93 commit 5032573Copy full SHA for 5032573
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 SourceRulesInfo.
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