File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,10 +74,45 @@ const (
7474 RegoV1
7575)
7676
77+ const (
78+ regoUndefined string = "undefined"
79+ regoV0 string = "rego.v0"
80+ regoV0V1 string = "rego.v0v1"
81+ regoV1 string = "rego.v1"
82+ )
83+
7784func (v RegoVersion ) ToAstRegoVersion () ast.RegoVersion {
7885 return ast .RegoVersionFromInt (int (v ))
7986}
8087
88+ func (v RegoVersion ) String () string {
89+ switch v {
90+ case RegoUndefined :
91+ return regoUndefined
92+ case RegoV0 :
93+ return regoV0
94+ case RegoV0CompatV1 :
95+ return regoV0V1
96+ case RegoV1 :
97+ return regoV1
98+ default :
99+ return regoUndefined
100+ }
101+ }
102+
103+ func RegoVersionFromString (v string ) RegoVersion {
104+ switch v {
105+ case regoV0 :
106+ return RegoV0
107+ case regoV0V1 :
108+ return RegoV0CompatV1
109+ case regoV1 :
110+ return RegoV1
111+ default :
112+ return RegoV1
113+ }
114+ }
115+
81116// BuildParams contains all parameters used for doing a build.
82117type BuildParams struct {
83118 CapabilitiesJSONFile string
You can’t perform that action at this time.
0 commit comments