diagnostics

package
v0.0.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

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.

Types

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

func WithStringSnippetEnabled(enabled bool) StringOpt

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL