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 ¶
- func AttributePath(path *proto.AttributePath) cty.Path
- func BodyContent(body *proto.BodyContent) (*hclext.BodyContent, hcl.Diagnostics)
- func BodySchema(body *proto.BodySchema) *hclext.BodySchema
- func Config(config *proto.ApplyGlobalConfig_Config) *tflint.Config
- func Error(err error) error
- func ExpandMode(mode proto.GetModuleContent_ExpandMode) tflint.ExpandMode
- func Expression(expr *proto.Expression) (hcl.Expression, hcl.Diagnostics)
- func GetModuleContentHint(hint *proto.GetModuleContent_Hint) tflint.GetModuleContentHint
- func GetModuleContentOption(opts *proto.GetModuleContent_Option) tflint.GetModuleContentOption
- func ModuleCtxType(ty proto.ModuleCtxType) tflint.ModuleCtxType
- func Pos(pos *proto.Range_Pos) hcl.Pos
- func Range(rng *proto.Range) hcl.Range
- func SchemaMode(mode proto.SchemaMode) hclext.SchemaMode
- func Severity(severity proto.EmitIssue_Severity) tflint.Severity
- func Value(value []byte, ty cty.Type, valueMarks []*proto.ValueMark) (cty.Value, error)
- type RuleObject
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 ¶
func Config(config *proto.ApplyGlobalConfig_Config) *tflint.Config
Config converts proto.ApplyGlobalConfig_Config to tflint.Config
func ExpandMode ¶
func ExpandMode(mode proto.GetModuleContent_ExpandMode) tflint.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 SchemaMode ¶
func SchemaMode(mode proto.SchemaMode) hclext.SchemaMode
SchemaMode converts proto.SchemaMode to hclext.SchemaMode
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 (*RuleObject) Link ¶
func (r *RuleObject) Link() string
Link returns the link of the rule documentation if exists
func (*RuleObject) Severity ¶
func (r *RuleObject) Severity() tflint.Severity
Severity returns the severify of the rule