AssertMaxRuleGroups limit has not been reached compared to the current number of total rule groups in input and returns an error if so.
(userID string, rg int)
| 1550 | // AssertMaxRuleGroups limit has not been reached compared to the current |
| 1551 | // number of total rule groups in input and returns an error if so. |
| 1552 | func (r *Ruler) AssertMaxRuleGroups(userID string, rg int) error { |
| 1553 | limit := r.limits.RulerMaxRuleGroupsPerTenant(userID) |
| 1554 | |
| 1555 | if limit <= 0 { |
| 1556 | return nil |
| 1557 | } |
| 1558 | |
| 1559 | if rg <= limit { |
| 1560 | return nil |
| 1561 | } |
| 1562 | |
| 1563 | return fmt.Errorf(errMaxRuleGroupsPerUserLimitExceeded, limit, rg) |
| 1564 | } |
| 1565 | |
| 1566 | // AssertMaxRulesPerRuleGroup limit has not been reached compared to the current |
| 1567 | // number of rules in a rule group in input and returns an error if so. |
no test coverage detected