Skip to content

Commit 0825944

Browse files
alexweavGiedriusS
authored andcommitted
chore: Export rulefmt.ruleNode (#16252)
* Export rulefmt.ruleNode Signed-off-by: Alex Weaver <[email protected]> * Export RuleGroupNode for consistency Signed-off-by: Alex Weaver <[email protected]> --------- Signed-off-by: Alex Weaver <[email protected]>
1 parent 3dcecab commit 0825944

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

model/rulefmt/rulefmt.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ type RuleGroups struct {
9292
}
9393

9494
type ruleGroups struct {
95-
Groups []ruleGroupNode `yaml:"groups"`
95+
Groups []RuleGroupNode `yaml:"groups"`
9696
}
9797

9898
// Validate validates all rules in the rule groups.
@@ -158,14 +158,14 @@ type RuleGroup struct {
158158
Labels map[string]string `yaml:"labels,omitempty"`
159159
}
160160

161-
// ruleGroupNode adds yaml.v3 layer to support line and columns outputs for invalid rule groups.
162-
type ruleGroupNode struct {
161+
// RuleGroupNode adds yaml.v3 layer to support line and columns outputs for invalid rule groups.
162+
type RuleGroupNode struct {
163163
yaml.Node
164164
Name string `yaml:"name"`
165165
Interval model.Duration `yaml:"interval,omitempty"`
166166
QueryOffset *model.Duration `yaml:"query_offset,omitempty"`
167167
Limit int `yaml:"limit,omitempty"`
168-
Rules []ruleNode `yaml:"rules"`
168+
Rules []RuleNode `yaml:"rules"`
169169
Labels map[string]string `yaml:"labels,omitempty"`
170170
}
171171

@@ -180,8 +180,8 @@ type Rule struct {
180180
Annotations map[string]string `yaml:"annotations,omitempty"`
181181
}
182182

183-
// ruleNode adds yaml.v3 layer to support line and column outputs for invalid rules.
184-
type ruleNode struct {
183+
// RuleNode adds yaml.v3 layer to support line and column outputs for invalid rules.
184+
type RuleNode struct {
185185
Record yaml.Node `yaml:"record,omitempty"`
186186
Alert yaml.Node `yaml:"alert,omitempty"`
187187
Expr yaml.Node `yaml:"expr"`
@@ -192,7 +192,7 @@ type ruleNode struct {
192192
}
193193

194194
// Validate the rule and return a list of encountered errors.
195-
func (r *Rule) Validate(node ruleNode) (nodes []WrappedError) {
195+
func (r *Rule) Validate(node RuleNode) (nodes []WrappedError) {
196196
if r.Record != "" && r.Alert != "" {
197197
nodes = append(nodes, WrappedError{
198198
err: errors.New("only one of 'record' and 'alert' must be set"),

0 commit comments

Comments
 (0)