fromproto

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2025 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package fromproto contains an implementation to decode a structure generated from *.proto into a real Go structure. This package is not intended to be used directly from plugins.

Many primitives can be handled as-is, but some interfaces and errors require special decoding. The `hcl.Expression` restores the interface by reparsed based on the bytes and their range. The `tflint.Rule` restores the interface by filling the value in a pseudo-structure that satisfies the interface. Error makes use of gRPC error details to recover the wrapped error. Rewrap the error based on the error code obtained from details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttributePath

func AttributePath(path *proto.AttributePath) cty.Path

AttributePath converts proto.AttributePath to cty.Path

func BodyContent

func BodyContent(body *proto.BodyContent) (*hclext.BodyContent, hcl.Diagnostics)

BodyContent converts proto.BodyContent to hclext.BodyContent

func BodySchema

func BodySchema(body *proto.BodySchema) *hclext.BodySchema

BodySchema converts proto.BodySchema to hclext.BodySchema

func Config

Config converts proto.ApplyGlobalConfig_Config to tflint.Config

func Error

func Error(err error) error

Error converts gRPC error status to wrapped error

func ExpandMode

ExpandMode converts proto.GetModuleContent_ExpandMode to tflint.ExpandMode

func Expression

func Expression(expr *proto.Expression) (hcl.Expression, hcl.Diagnostics)

Expression converts proto.Expression to hcl.Expression

func GetModuleContentHint

func GetModuleContentHint(hint *proto.GetModuleContent_Hint) tflint.GetModuleContentHint

GetModuleContentHint converts proto.GetModuleContent_Hint to tflint.GetModuleContentHint

func GetModuleContentOption

func GetModuleContentOption(opts *proto.GetModuleContent_Option) tflint.GetModuleContentOption

GetModuleContentOption converts proto.GetModuleContent_Option to tflint.GetModuleContentOption

func ModuleCtxType

func ModuleCtxType(ty proto.ModuleCtxType) tflint.ModuleCtxType

ModuleCtxType converts proto.ModuleCtxType to tflint.ModuleCtxType

func Pos

func Pos(pos *proto.Range_Pos) hcl.Pos

Pos converts proto.Range_Pos to hcl.Pos

func Range

func Range(rng *proto.Range) hcl.Range

Range converts proto.Range to hcl.Range

func SchemaMode

func SchemaMode(mode proto.SchemaMode) hclext.SchemaMode

SchemaMode converts proto.SchemaMode to hclext.SchemaMode

func Severity

func Severity(severity proto.EmitIssue_Severity) tflint.Severity

Severity converts proto.EmitIssue_Severity to severity

func Value

func Value(value []byte, ty cty.Type, valueMarks []*proto.ValueMark) (cty.Value, error)

Value converts msgpack and []proto.ValueMark to cty.Value

Types

type RuleObject

type RuleObject struct {
	tflint.DefaultRule
	Data struct {
		Name     string
		Enabled  bool
		Severity tflint.Severity
		Link     string
	}
}

RuleObject is an intermediate representation that satisfies the Rule interface.

func Rule

func Rule(rule *proto.EmitIssue_Rule) *RuleObject

Rule converts proto.EmitIssue_Rule to RuleObject

func (*RuleObject) Check

func (r *RuleObject) Check(tflint.Runner) error

Check does nothing. This is just a method to satisfy the interface

func (*RuleObject) Enabled

func (r *RuleObject) Enabled() bool

Enabled returns whether the rule is enabled

func (r *RuleObject) Link() string

Link returns the link of the rule documentation if exists

func (*RuleObject) Name

func (r *RuleObject) Name() string

Name returns the rule name

func (*RuleObject) Severity

func (r *RuleObject) Severity() tflint.Severity

Severity returns the severify of the rule

Jump to

Keyboard shortcuts

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