]>
Commit | Line | Data |
---|---|---|
15c0b25d AP |
1 | package tfdiags |
2 | ||
107c1cdb ND |
3 | import ( |
4 | "github.com/hashicorp/hcl2/hcl" | |
5 | ) | |
6 | ||
15c0b25d AP |
7 | type Diagnostic interface { |
8 | Severity() Severity | |
9 | Description() Description | |
10 | Source() Source | |
107c1cdb ND |
11 | |
12 | // FromExpr returns the expression-related context for the diagnostic, if | |
13 | // available. Returns nil if the diagnostic is not related to an | |
14 | // expression evaluation. | |
15 | FromExpr() *FromExpr | |
15c0b25d AP |
16 | } |
17 | ||
18 | type Severity rune | |
19 | ||
20 | //go:generate stringer -type=Severity | |
21 | ||
22 | const ( | |
23 | Error Severity = 'E' | |
24 | Warning Severity = 'W' | |
25 | ) | |
26 | ||
27 | type Description struct { | |
28 | Summary string | |
29 | Detail string | |
30 | } | |
31 | ||
32 | type Source struct { | |
33 | Subject *SourceRange | |
34 | Context *SourceRange | |
35 | } | |
107c1cdb ND |
36 | |
37 | type FromExpr struct { | |
38 | Expression hcl.Expression | |
39 | EvalContext *hcl.EvalContext | |
40 | } |