Documentation ¶
Index ¶
- func Concat(diags ...[]*pb.Diagnostic) []*pb.Diagnostic
- func FromErr(err error) []*pb.Diagnostic
- func FromHCL(files map[string]*hcl.File, diags hcl.Diagnostics) []*pb.Diagnostic
- func FromTFJSON(in []tfjson.Diagnostic) []*pb.Diagnostic
- func HasErrors(diags ...[]*pb.Diagnostic) bool
- func HasFailed(failOnWarn bool, diags ...[]*pb.Diagnostic) bool
- func HasWarnings(diags ...[]*pb.Diagnostic) bool
- func OpEventErrors(e *pb.Operation_Event) bool
- func OpEventWarnings(e *pb.Operation_Event) bool
- func OpResErrors(res *pb.Operation_Response) bool
- func OpResFailed(failOnWarn bool, res *pb.Operation_Response) bool
- func OpResWarnings(res *pb.Operation_Response) bool
- func OperationStatus(failOnWarn bool, res *pb.Operation_Response) pb.Operation_Status
- func Status(failOnWarn bool, diags ...*pb.Diagnostic) pb.Operation_Status
- func String(diag *pb.Diagnostic, opts ...StringOpt) string
- func ToError(diags ...*pb.Diagnostic) error
- type Error
- type StringOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Concat ¶
func Concat(diags ...[]*pb.Diagnostic) []*pb.Diagnostic
Concat takes one-or-more sets of daignostics and returns a combined set.
func FromErr ¶
func FromErr(err error) []*pb.Diagnostic
FromErr takes a standard go error and returns proto diagnostics.
func FromHCL ¶
func FromHCL(files map[string]*hcl.File, diags hcl.Diagnostics) []*pb.Diagnostic
FromHCL takes a map of hcl.Files and hcl.Diagnostics and returns pb diagnostics. When possible it will attempt to create a valid snippet.
func FromTFJSON ¶
func FromTFJSON(in []tfjson.Diagnostic) []*pb.Diagnostic
FromTFJSON takes terraform-json Diagnostics and returns them as proto diagnostics.
func HasErrors ¶
func HasErrors(diags ...[]*pb.Diagnostic) bool
HasErrors returns true if any diagnostic has an error severity.
func HasFailed ¶
func HasFailed(failOnWarn bool, diags ...[]*pb.Diagnostic) bool
HasFailed takes a bool about warnings as errors and a set of diagnostic and returns a bool if a failure has occurred.
func HasWarnings ¶
func HasWarnings(diags ...[]*pb.Diagnostic) bool
HasWarnings returns true if any diagnostic has a warning severity.
func OpEventErrors ¶
func OpEventErrors(e *pb.Operation_Event) bool
OpEventErrors returns whether the event has errors.
func OpEventWarnings ¶
func OpEventWarnings(e *pb.Operation_Event) bool
OpEventWarnings returns whether the event has warnings.
func OpResErrors ¶
func OpResErrors(res *pb.Operation_Response) bool
OpResErrors checks an operation response failure diagnostics.
func OpResFailed ¶
func OpResFailed(failOnWarn bool, res *pb.Operation_Response) bool
OpResFailed checks an operation response for failure diagnostics.
func OpResWarnings ¶
func OpResWarnings(res *pb.Operation_Response) bool
OpResWarnings checks an operation response warning diagnostics.
func OperationStatus ¶
func OperationStatus(failOnWarn bool, res *pb.Operation_Response) pb.Operation_Status
func Status ¶
func Status(failOnWarn bool, diags ...*pb.Diagnostic) pb.Operation_Status
func String ¶
func String(diag *pb.Diagnostic, opts ...StringOpt) string
String writes the diagnostic as a string. It takes optional configuration settings to modify the format.
func ToError ¶ added in v0.0.29
func ToError(diags ...*pb.Diagnostic) error
ToError takes a slice of diagnostics and returns an wrapper error chain.
Types ¶
type Error ¶ added in v0.0.29
type Error struct { Diags []*pb.Diagnostic DiagStringOpts []StringOpt Err error }
Error is an error that can carry diagnostics information.
func (*Error) SetStringOpts ¶ added in v0.0.29
SetStringOpts allows configuring the stringer opts on the error. This allows the caller to determine the formatting of the error message if diagnostics are preset.
type StringOpt ¶
type StringOpt func(*stringOptConfig)
StringOpt is an option to the string formatter.
func WithStringColor ¶
func WithStringColor(color *colorstring.Colorize) StringOpt
WithStringColor passes color settings to the formatter.
func WithStringSnippetEnabled ¶
WithStringSnippetEnabled enables or diables the snippet in the formatting.
func WithStringUISettings ¶
func WithStringUISettings(settings *pb.UI_Settings) StringOpt
WithStringUISettings passes UI settings to the string formatter.