blob: 18ea5ece7d3275e30b2bcf6942ae400bf7c71f5e [file]
// Copyright IBM Corp. 2014, 2026
// SPDX-License-Identifier: BUSL-1.1
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v5.29.3
// source: diagnostics.proto
package proto
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Severity int32
const (
Severity_INVALID Severity = 0
Severity_WARNING Severity = 1
Severity_ERROR Severity = 2
)
// Enum value maps for Severity.
var (
Severity_name = map[int32]string{
0: "INVALID",
1: "WARNING",
2: "ERROR",
}
Severity_value = map[string]int32{
"INVALID": 0,
"WARNING": 1,
"ERROR": 2,
}
)
func (x Severity) Enum() *Severity {
p := new(Severity)
*p = x
return p
}
func (x Severity) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Severity) Descriptor() protoreflect.EnumDescriptor {
return file_diagnostics_proto_enumTypes[0].Descriptor()
}
func (Severity) Type() protoreflect.EnumType {
return &file_diagnostics_proto_enumTypes[0]
}
func (x Severity) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Severity.Descriptor instead.
func (Severity) EnumDescriptor() ([]byte, []int) {
return file_diagnostics_proto_rawDescGZIP(), []int{0}
}
// Diagnostic is a message that represents a diagnostic message that can be
// returned by the Terraform Policy server.
type Diagnostic struct {
state protoimpl.MessageState `protogen:"open.v1"`
Severity Severity `protobuf:"varint,1,opt,name=severity,proto3,enum=proto.Severity" json:"severity,omitempty"`
Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"`
Detail string `protobuf:"bytes,3,opt,name=detail,proto3" json:"detail,omitempty"`
Subject *Range `protobuf:"bytes,4,opt,name=subject,proto3" json:"subject,omitempty"`
Context *Range `protobuf:"bytes,5,opt,name=context,proto3" json:"context,omitempty"`
// the result allows Terraform to differentiate between a diagnostic
// originating from an error or a denied evaluation.
Result *DiagnosticResult `protobuf:"bytes,6,opt,name=result,proto3" json:"result,omitempty"`
// a diagnostic can be associated with a specific attribute in the Terraform
// resource.
Attribute *AttributePath `protobuf:"bytes,7,opt,name=attribute,proto3" json:"attribute,omitempty"`
// if the server had access to the source code that generated the diagnostic,
// it can provide a snippet of the code that caused the diagnostic.
Snippet *Snippet `protobuf:"bytes,8,opt,name=snippet,proto3" json:"snippet,omitempty"`
// if the diagnostic is associated with an expression, the values for
// variables in the expression can be provided.
ExpressionValues []*ExpressionValue `protobuf:"bytes,9,rep,name=expression_values,json=expressionValues,proto3" json:"expression_values,omitempty"`
// if the diagnostic originated inside a function call, we can provide that
// metadata as well.
FunctionCall string `protobuf:"bytes,10,opt,name=function_call,json=functionCall,proto3" json:"function_call,omitempty"`
// policy set information for the diagnostic
PolicySet *PolicySet `protobuf:"bytes,11,opt,name=policy_set,json=policySet,proto3" json:"policy_set,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Diagnostic) Reset() {
*x = Diagnostic{}
mi := &file_diagnostics_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Diagnostic) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Diagnostic) ProtoMessage() {}
func (x *Diagnostic) ProtoReflect() protoreflect.Message {
mi := &file_diagnostics_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Diagnostic.ProtoReflect.Descriptor instead.
func (*Diagnostic) Descriptor() ([]byte, []int) {
return file_diagnostics_proto_rawDescGZIP(), []int{0}
}
func (x *Diagnostic) GetSeverity() Severity {
if x != nil {
return x.Severity
}
return Severity_INVALID
}
func (x *Diagnostic) GetSummary() string {
if x != nil {
return x.Summary
}
return ""
}
func (x *Diagnostic) GetDetail() string {
if x != nil {
return x.Detail
}
return ""
}
func (x *Diagnostic) GetSubject() *Range {
if x != nil {
return x.Subject
}
return nil
}
func (x *Diagnostic) GetContext() *Range {
if x != nil {
return x.Context
}
return nil
}
func (x *Diagnostic) GetResult() *DiagnosticResult {
if x != nil {
return x.Result
}
return nil
}
func (x *Diagnostic) GetAttribute() *AttributePath {
if x != nil {
return x.Attribute
}
return nil
}
func (x *Diagnostic) GetSnippet() *Snippet {
if x != nil {
return x.Snippet
}
return nil
}
func (x *Diagnostic) GetExpressionValues() []*ExpressionValue {
if x != nil {
return x.ExpressionValues
}
return nil
}
func (x *Diagnostic) GetFunctionCall() string {
if x != nil {
return x.FunctionCall
}
return ""
}
func (x *Diagnostic) GetPolicySet() *PolicySet {
if x != nil {
return x.PolicySet
}
return nil
}
type PolicySet struct {
state protoimpl.MessageState `protogen:"open.v1"`
// name is the name of the policy set.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// path is the path to the policy set directory.
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *PolicySet) Reset() {
*x = PolicySet{}
mi := &file_diagnostics_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PolicySet) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PolicySet) ProtoMessage() {}
func (x *PolicySet) ProtoReflect() protoreflect.Message {
mi := &file_diagnostics_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PolicySet.ProtoReflect.Descriptor instead.
func (*PolicySet) Descriptor() ([]byte, []int) {
return file_diagnostics_proto_rawDescGZIP(), []int{1}
}
func (x *PolicySet) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *PolicySet) GetPath() string {
if x != nil {
return x.Path
}
return ""
}
type Range struct {
state protoimpl.MessageState `protogen:"open.v1"`
Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"`
Start *Position `protobuf:"bytes,2,opt,name=start,proto3" json:"start,omitempty"`
End *Position `protobuf:"bytes,3,opt,name=end,proto3" json:"end,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Range) Reset() {
*x = Range{}
mi := &file_diagnostics_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Range) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Range) ProtoMessage() {}
func (x *Range) ProtoReflect() protoreflect.Message {
mi := &file_diagnostics_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Range.ProtoReflect.Descriptor instead.
func (*Range) Descriptor() ([]byte, []int) {
return file_diagnostics_proto_rawDescGZIP(), []int{2}
}
func (x *Range) GetFilename() string {
if x != nil {
return x.Filename
}
return ""
}
func (x *Range) GetStart() *Position {
if x != nil {
return x.Start
}
return nil
}
func (x *Range) GetEnd() *Position {
if x != nil {
return x.End
}
return nil
}
type Position struct {
state protoimpl.MessageState `protogen:"open.v1"`
Line int64 `protobuf:"varint,1,opt,name=line,proto3" json:"line,omitempty"`
Column int64 `protobuf:"varint,2,opt,name=column,proto3" json:"column,omitempty"`
Byte int64 `protobuf:"varint,3,opt,name=byte,proto3" json:"byte,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Position) Reset() {
*x = Position{}
mi := &file_diagnostics_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Position) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Position) ProtoMessage() {}
func (x *Position) ProtoReflect() protoreflect.Message {
mi := &file_diagnostics_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Position.ProtoReflect.Descriptor instead.
func (*Position) Descriptor() ([]byte, []int) {
return file_diagnostics_proto_rawDescGZIP(), []int{3}
}
func (x *Position) GetLine() int64 {
if x != nil {
return x.Line
}
return 0
}
func (x *Position) GetColumn() int64 {
if x != nil {
return x.Column
}
return 0
}
func (x *Position) GetByte() int64 {
if x != nil {
return x.Byte
}
return 0
}
// Snippet represents a snippet of code that is relevant to a diagnostic.
type Snippet struct {
state protoimpl.MessageState `protogen:"open.v1"`
// context is a high-level summary of the root context of the diagnostic: for example,
// the policy block in which an expression causes an error.
Context *string `protobuf:"bytes,1,opt,name=context,proto3,oneof" json:"context,omitempty"`
// code is the entire code that is relevant to the diagnostic.
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
StartLine int64 `protobuf:"varint,3,opt,name=start_line,json=startLine,proto3" json:"start_line,omitempty"`
HighlightStartOffset int64 `protobuf:"varint,4,opt,name=highlight_start_offset,json=highlightStartOffset,proto3" json:"highlight_start_offset,omitempty"`
HighlightEndOffset int64 `protobuf:"varint,5,opt,name=highlight_end_offset,json=highlightEndOffset,proto3" json:"highlight_end_offset,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Snippet) Reset() {
*x = Snippet{}
mi := &file_diagnostics_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Snippet) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Snippet) ProtoMessage() {}
func (x *Snippet) ProtoReflect() protoreflect.Message {
mi := &file_diagnostics_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Snippet.ProtoReflect.Descriptor instead.
func (*Snippet) Descriptor() ([]byte, []int) {
return file_diagnostics_proto_rawDescGZIP(), []int{4}
}
func (x *Snippet) GetContext() string {
if x != nil && x.Context != nil {
return *x.Context
}
return ""
}
func (x *Snippet) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *Snippet) GetStartLine() int64 {
if x != nil {
return x.StartLine
}
return 0
}
func (x *Snippet) GetHighlightStartOffset() int64 {
if x != nil {
return x.HighlightStartOffset
}
return 0
}
func (x *Snippet) GetHighlightEndOffset() int64 {
if x != nil {
return x.HighlightEndOffset
}
return 0
}
type ExpressionValue struct {
state protoimpl.MessageState `protogen:"open.v1"`
// traversal is the path taken to reach this value in the object graph.
Traversal *AttributePath `protobuf:"bytes,1,opt,name=traversal,proto3" json:"traversal,omitempty"`
// value is the raw value of the expression.
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ExpressionValue) Reset() {
*x = ExpressionValue{}
mi := &file_diagnostics_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ExpressionValue) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ExpressionValue) ProtoMessage() {}
func (x *ExpressionValue) ProtoReflect() protoreflect.Message {
mi := &file_diagnostics_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ExpressionValue.ProtoReflect.Descriptor instead.
func (*ExpressionValue) Descriptor() ([]byte, []int) {
return file_diagnostics_proto_rawDescGZIP(), []int{5}
}
func (x *ExpressionValue) GetTraversal() *AttributePath {
if x != nil {
return x.Traversal
}
return nil
}
func (x *ExpressionValue) GetValue() []byte {
if x != nil {
return x.Value
}
return nil
}
type DiagnosticResult struct {
state protoimpl.MessageState `protogen:"open.v1"`
Result EvaluateResult `protobuf:"varint,1,opt,name=result,proto3,enum=proto.EvaluateResult" json:"result,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DiagnosticResult) Reset() {
*x = DiagnosticResult{}
mi := &file_diagnostics_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DiagnosticResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DiagnosticResult) ProtoMessage() {}
func (x *DiagnosticResult) ProtoReflect() protoreflect.Message {
mi := &file_diagnostics_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DiagnosticResult.ProtoReflect.Descriptor instead.
func (*DiagnosticResult) Descriptor() ([]byte, []int) {
return file_diagnostics_proto_rawDescGZIP(), []int{6}
}
func (x *DiagnosticResult) GetResult() EvaluateResult {
if x != nil {
return x.Result
}
return EvaluateResult_INVALID_EVALUATE_RESULT
}
var File_diagnostics_proto protoreflect.FileDescriptor
const file_diagnostics_proto_rawDesc = "" +
"\n" +
"\x11diagnostics.proto\x12\x05proto\x1a\vtypes.proto\"\xe5\x03\n" +
"\n" +
"Diagnostic\x12+\n" +
"\bseverity\x18\x01 \x01(\x0e2\x0f.proto.SeverityR\bseverity\x12\x18\n" +
"\asummary\x18\x02 \x01(\tR\asummary\x12\x16\n" +
"\x06detail\x18\x03 \x01(\tR\x06detail\x12&\n" +
"\asubject\x18\x04 \x01(\v2\f.proto.RangeR\asubject\x12&\n" +
"\acontext\x18\x05 \x01(\v2\f.proto.RangeR\acontext\x12/\n" +
"\x06result\x18\x06 \x01(\v2\x17.proto.DiagnosticResultR\x06result\x122\n" +
"\tattribute\x18\a \x01(\v2\x14.proto.AttributePathR\tattribute\x12(\n" +
"\asnippet\x18\b \x01(\v2\x0e.proto.SnippetR\asnippet\x12C\n" +
"\x11expression_values\x18\t \x03(\v2\x16.proto.ExpressionValueR\x10expressionValues\x12#\n" +
"\rfunction_call\x18\n" +
" \x01(\tR\ffunctionCall\x12/\n" +
"\n" +
"policy_set\x18\v \x01(\v2\x10.proto.PolicySetR\tpolicySet\"3\n" +
"\tPolicySet\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" +
"\x04path\x18\x02 \x01(\tR\x04path\"m\n" +
"\x05Range\x12\x1a\n" +
"\bfilename\x18\x01 \x01(\tR\bfilename\x12%\n" +
"\x05start\x18\x02 \x01(\v2\x0f.proto.PositionR\x05start\x12!\n" +
"\x03end\x18\x03 \x01(\v2\x0f.proto.PositionR\x03end\"J\n" +
"\bPosition\x12\x12\n" +
"\x04line\x18\x01 \x01(\x03R\x04line\x12\x16\n" +
"\x06column\x18\x02 \x01(\x03R\x06column\x12\x12\n" +
"\x04byte\x18\x03 \x01(\x03R\x04byte\"\xcf\x01\n" +
"\aSnippet\x12\x1d\n" +
"\acontext\x18\x01 \x01(\tH\x00R\acontext\x88\x01\x01\x12\x12\n" +
"\x04code\x18\x02 \x01(\tR\x04code\x12\x1d\n" +
"\n" +
"start_line\x18\x03 \x01(\x03R\tstartLine\x124\n" +
"\x16highlight_start_offset\x18\x04 \x01(\x03R\x14highlightStartOffset\x120\n" +
"\x14highlight_end_offset\x18\x05 \x01(\x03R\x12highlightEndOffsetB\n" +
"\n" +
"\b_context\"[\n" +
"\x0fExpressionValue\x122\n" +
"\ttraversal\x18\x01 \x01(\v2\x14.proto.AttributePathR\ttraversal\x12\x14\n" +
"\x05value\x18\x02 \x01(\fR\x05value\"A\n" +
"\x10DiagnosticResult\x12-\n" +
"\x06result\x18\x01 \x01(\x0e2\x15.proto.EvaluateResultR\x06result*/\n" +
"\bSeverity\x12\v\n" +
"\aINVALID\x10\x00\x12\v\n" +
"\aWARNING\x10\x01\x12\t\n" +
"\x05ERROR\x10\x02B4Z2github.com/hashicorp/terraform-policy-plugin/protob\x06proto3"
var (
file_diagnostics_proto_rawDescOnce sync.Once
file_diagnostics_proto_rawDescData []byte
)
func file_diagnostics_proto_rawDescGZIP() []byte {
file_diagnostics_proto_rawDescOnce.Do(func() {
file_diagnostics_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_diagnostics_proto_rawDesc), len(file_diagnostics_proto_rawDesc)))
})
return file_diagnostics_proto_rawDescData
}
var file_diagnostics_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_diagnostics_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_diagnostics_proto_goTypes = []any{
(Severity)(0), // 0: proto.Severity
(*Diagnostic)(nil), // 1: proto.Diagnostic
(*PolicySet)(nil), // 2: proto.PolicySet
(*Range)(nil), // 3: proto.Range
(*Position)(nil), // 4: proto.Position
(*Snippet)(nil), // 5: proto.Snippet
(*ExpressionValue)(nil), // 6: proto.ExpressionValue
(*DiagnosticResult)(nil), // 7: proto.DiagnosticResult
(*AttributePath)(nil), // 8: proto.AttributePath
(EvaluateResult)(0), // 9: proto.EvaluateResult
}
var file_diagnostics_proto_depIdxs = []int32{
0, // 0: proto.Diagnostic.severity:type_name -> proto.Severity
3, // 1: proto.Diagnostic.subject:type_name -> proto.Range
3, // 2: proto.Diagnostic.context:type_name -> proto.Range
7, // 3: proto.Diagnostic.result:type_name -> proto.DiagnosticResult
8, // 4: proto.Diagnostic.attribute:type_name -> proto.AttributePath
5, // 5: proto.Diagnostic.snippet:type_name -> proto.Snippet
6, // 6: proto.Diagnostic.expression_values:type_name -> proto.ExpressionValue
2, // 7: proto.Diagnostic.policy_set:type_name -> proto.PolicySet
4, // 8: proto.Range.start:type_name -> proto.Position
4, // 9: proto.Range.end:type_name -> proto.Position
8, // 10: proto.ExpressionValue.traversal:type_name -> proto.AttributePath
9, // 11: proto.DiagnosticResult.result:type_name -> proto.EvaluateResult
12, // [12:12] is the sub-list for method output_type
12, // [12:12] is the sub-list for method input_type
12, // [12:12] is the sub-list for extension type_name
12, // [12:12] is the sub-list for extension extendee
0, // [0:12] is the sub-list for field type_name
}
func init() { file_diagnostics_proto_init() }
func file_diagnostics_proto_init() {
if File_diagnostics_proto != nil {
return
}
file_types_proto_init()
file_diagnostics_proto_msgTypes[4].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_diagnostics_proto_rawDesc), len(file_diagnostics_proto_rawDesc)),
NumEnums: 1,
NumMessages: 7,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_diagnostics_proto_goTypes,
DependencyIndexes: file_diagnostics_proto_depIdxs,
EnumInfos: file_diagnostics_proto_enumTypes,
MessageInfos: file_diagnostics_proto_msgTypes,
}.Build()
File_diagnostics_proto = out.File
file_diagnostics_proto_goTypes = nil
file_diagnostics_proto_depIdxs = nil
}