Skip to content

Commit e18df5b

Browse files
regedaashutosh-narkar
authored andcommitted
chore: import v1 packages
Signed-off-by: Anthony Regeda <[email protected]>
1 parent a41ef12 commit e18df5b

File tree

14 files changed

+92
-93
lines changed

14 files changed

+92
-93
lines changed

cmd/opa-envoy-plugin/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
"github.com/open-policy-agent/opa-envoy-plugin/plugin"
1111
"github.com/open-policy-agent/opa/cmd"
12-
"github.com/open-policy-agent/opa/runtime"
12+
"github.com/open-policy-agent/opa/v1/runtime"
1313
)
1414

1515
func main() {

envoyauth/evaluation.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/open-policy-agent/opa/ast"
8-
"github.com/open-policy-agent/opa/config"
9-
"github.com/open-policy-agent/opa/logging"
10-
"github.com/open-policy-agent/opa/rego"
11-
"github.com/open-policy-agent/opa/storage"
12-
"github.com/open-policy-agent/opa/topdown/builtins"
13-
iCache "github.com/open-policy-agent/opa/topdown/cache"
14-
"github.com/open-policy-agent/opa/topdown/print"
15-
"github.com/open-policy-agent/opa/tracing"
7+
"github.com/open-policy-agent/opa/v1/ast"
8+
"github.com/open-policy-agent/opa/v1/config"
9+
"github.com/open-policy-agent/opa/v1/logging"
10+
"github.com/open-policy-agent/opa/v1/rego"
11+
"github.com/open-policy-agent/opa/v1/storage"
12+
"github.com/open-policy-agent/opa/v1/topdown/builtins"
13+
iCache "github.com/open-policy-agent/opa/v1/topdown/cache"
14+
"github.com/open-policy-agent/opa/v1/topdown/print"
15+
"github.com/open-policy-agent/opa/v1/tracing"
1616
)
1717

1818
// EvalContext - This is an SPI that has to be provided if the envoy external authorization

envoyauth/evaluation_test.go

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,18 @@ import (
66
"sync"
77
"testing"
88

9-
"github.com/open-policy-agent/opa/config"
10-
"github.com/open-policy-agent/opa/tracing"
11-
12-
"github.com/open-policy-agent/opa/logging"
13-
loggingtest "github.com/open-policy-agent/opa/logging/test"
14-
"github.com/open-policy-agent/opa/plugins/logs"
15-
16-
"github.com/open-policy-agent/opa/ast"
17-
"github.com/open-policy-agent/opa/plugins"
18-
"github.com/open-policy-agent/opa/rego"
19-
"github.com/open-policy-agent/opa/storage"
20-
"github.com/open-policy-agent/opa/storage/inmem"
21-
iCache "github.com/open-policy-agent/opa/topdown/cache"
22-
"github.com/open-policy-agent/opa/topdown/print"
9+
"github.com/open-policy-agent/opa/v1/ast"
10+
"github.com/open-policy-agent/opa/v1/config"
11+
"github.com/open-policy-agent/opa/v1/logging"
12+
loggingtest "github.com/open-policy-agent/opa/v1/logging/test"
13+
"github.com/open-policy-agent/opa/v1/plugins"
14+
"github.com/open-policy-agent/opa/v1/plugins/logs"
15+
"github.com/open-policy-agent/opa/v1/rego"
16+
"github.com/open-policy-agent/opa/v1/storage"
17+
"github.com/open-policy-agent/opa/v1/storage/inmem"
18+
iCache "github.com/open-policy-agent/opa/v1/topdown/cache"
19+
"github.com/open-policy-agent/opa/v1/topdown/print"
20+
"github.com/open-policy-agent/opa/v1/tracing"
2321
)
2422

2523
type testPrintHook struct {
@@ -116,7 +114,7 @@ func testAuthzServer(logger logging.Logger) (*mockExtAuthzGrpcServer, error) {
116114
117115
default allow = false
118116
119-
allow {
117+
allow if {
120118
input.parsed_body.firstname == "foo"
121119
input.parsed_body.lastname == "bar"
122120
print(input.parsed_body)

envoyauth/request.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919
"google.golang.org/protobuf/reflect/protoregistry"
2020
"google.golang.org/protobuf/types/dynamicpb"
2121

22-
"github.com/open-policy-agent/opa/logging"
23-
"github.com/open-policy-agent/opa/util"
22+
"github.com/open-policy-agent/opa/v1/logging"
23+
"github.com/open-policy-agent/opa/v1/util"
2424
)
2525

2626
var v2Info = map[string]string{"ext_authz": "v2", "encoding": "encoding/json"}

envoyauth/request_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88

99
ext_authz "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3"
1010
internal_util "github.com/open-policy-agent/opa-envoy-plugin/internal/util"
11-
"github.com/open-policy-agent/opa/logging"
12-
"github.com/open-policy-agent/opa/util"
11+
"github.com/open-policy-agent/opa/v1/logging"
12+
"github.com/open-policy-agent/opa/v1/util"
1313
"google.golang.org/protobuf/reflect/protoregistry"
1414
)
1515

envoyauth/response.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7+
"net/http"
8+
"slices"
9+
710
ext_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
811
ext_type_v3 "github.com/envoyproxy/go-control-plane/envoy/type/v3"
912
_structpb "github.com/golang/protobuf/ptypes/struct"
1013
"github.com/google/uuid"
11-
"github.com/open-policy-agent/opa/bundle"
12-
"github.com/open-policy-agent/opa/metrics"
13-
"github.com/open-policy-agent/opa/storage"
14-
"github.com/open-policy-agent/opa/topdown/builtins"
14+
"github.com/open-policy-agent/opa/v1/bundle"
15+
"github.com/open-policy-agent/opa/v1/metrics"
16+
"github.com/open-policy-agent/opa/v1/storage"
17+
"github.com/open-policy-agent/opa/v1/topdown/builtins"
1518
"google.golang.org/protobuf/types/known/structpb"
16-
"net/http"
17-
"slices"
1819
)
1920

2021
// EvalResult - Captures the result from evaluating a query against an input

envoyauth/response_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"testing"
99

1010
_structpb "github.com/golang/protobuf/ptypes/struct"
11-
"github.com/open-policy-agent/opa/bundle"
12-
"github.com/open-policy-agent/opa/storage"
13-
"github.com/open-policy-agent/opa/storage/inmem"
11+
"github.com/open-policy-agent/opa/v1/bundle"
12+
"github.com/open-policy-agent/opa/v1/storage"
13+
"github.com/open-policy-agent/opa/v1/storage/inmem"
1414
"google.golang.org/protobuf/proto"
1515
)
1616

internal/internal.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ import (
3535
"google.golang.org/protobuf/reflect/protoregistry"
3636
"google.golang.org/protobuf/types/known/structpb"
3737

38-
"github.com/open-policy-agent/opa/ast"
39-
"github.com/open-policy-agent/opa/config"
40-
"github.com/open-policy-agent/opa/logging"
41-
"github.com/open-policy-agent/opa/plugins"
42-
"github.com/open-policy-agent/opa/plugins/logs"
43-
"github.com/open-policy-agent/opa/rego"
44-
"github.com/open-policy-agent/opa/server"
45-
"github.com/open-policy-agent/opa/storage"
46-
"github.com/open-policy-agent/opa/topdown"
47-
iCache "github.com/open-policy-agent/opa/topdown/cache"
48-
"github.com/open-policy-agent/opa/tracing"
49-
"github.com/open-policy-agent/opa/util"
38+
"github.com/open-policy-agent/opa/v1/ast"
39+
"github.com/open-policy-agent/opa/v1/config"
40+
"github.com/open-policy-agent/opa/v1/logging"
41+
"github.com/open-policy-agent/opa/v1/plugins"
42+
"github.com/open-policy-agent/opa/v1/plugins/logs"
43+
"github.com/open-policy-agent/opa/v1/rego"
44+
"github.com/open-policy-agent/opa/v1/server"
45+
"github.com/open-policy-agent/opa/v1/storage"
46+
"github.com/open-policy-agent/opa/v1/topdown"
47+
iCache "github.com/open-policy-agent/opa/v1/topdown/cache"
48+
"github.com/open-policy-agent/opa/v1/tracing"
49+
"github.com/open-policy-agent/opa/v1/util"
5050

5151
"go.opentelemetry.io/otel/trace"
5252

internal/internal_bench_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
ext_authz "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3"
1212
"google.golang.org/genproto/googleapis/rpc/code"
1313

14-
"github.com/open-policy-agent/opa/util"
14+
"github.com/open-policy-agent/opa/v1/util"
1515
)
1616

1717
func BenchmarkCheck(b *testing.B) {

internal/internal_test.go

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ import (
2727
"google.golang.org/protobuf/proto"
2828

2929
"github.com/open-policy-agent/opa-envoy-plugin/envoyauth"
30-
"github.com/open-policy-agent/opa/ast"
31-
"github.com/open-policy-agent/opa/plugins"
32-
"github.com/open-policy-agent/opa/plugins/logs"
33-
"github.com/open-policy-agent/opa/storage"
34-
"github.com/open-policy-agent/opa/storage/inmem"
35-
"github.com/open-policy-agent/opa/topdown"
36-
"github.com/open-policy-agent/opa/util"
30+
"github.com/open-policy-agent/opa/v1/ast"
31+
"github.com/open-policy-agent/opa/v1/plugins"
32+
"github.com/open-policy-agent/opa/v1/plugins/logs"
33+
"github.com/open-policy-agent/opa/v1/storage"
34+
"github.com/open-policy-agent/opa/v1/storage/inmem"
35+
"github.com/open-policy-agent/opa/v1/topdown"
36+
"github.com/open-policy-agent/opa/v1/util"
3737
)
3838

3939
const exampleAllowedRequest = `{
@@ -469,7 +469,7 @@ func TestCheckAllowWithLoggerNDBCache(t *testing.T) {
469469
470470
default allow = false
471471
472-
allow {
472+
allow if {
473473
res := http.send({"url": "%s", "method": "GET"})
474474
res.status_code == 200
475475
}
@@ -952,7 +952,7 @@ func TestCheckAllowObjectDecisionWithBadReqHeadersToRemoveWithLogger(t *testing.
952952
953953
default allow = false
954954
955-
allow {
955+
allow if {
956956
input.parsed_path = ["my", "test", "path"]
957957
}
958958
@@ -1150,7 +1150,7 @@ func TestCheckTwiceWithCachedBuiltinCall(t *testing.T) {
11501150
package envoy.authz
11511151
11521152
default allow = false
1153-
allow {
1153+
allow if {
11541154
resp := http.send({"url": "%s", "method":"GET",
11551155
"force_cache": true, "force_cache_duration_seconds": 10})
11561156
resp.body.count == 1
@@ -1379,7 +1379,7 @@ func TestCheckAllowObjectDecisionDynamicMetadata(t *testing.T) {
13791379
13801380
default allow = false
13811381
1382-
allow {
1382+
allow if {
13831383
input.parsed_path = ["my", "test", "path"]
13841384
}
13851385
@@ -1433,7 +1433,7 @@ func TestCheckAllowObjectDecisionDynamicMetadataDecisionID(t *testing.T) {
14331433
14341434
default allow = false
14351435
1436-
allow {
1436+
allow if {
14371437
input.parsed_path = ["my", "test", "path"]
14381438
}
14391439
@@ -1469,7 +1469,7 @@ func TestCheckAllowBooleanDecisionDynamicMetadata(t *testing.T) {
14691469
14701470
default allow = false
14711471
1472-
allow {
1472+
allow if {
14731473
input.parsed_path = ["my", "test", "path"]
14741474
}
14751475
`
@@ -1499,7 +1499,7 @@ func TestCheckAllowBooleanDecisionDynamicMetadataDecisionID(t *testing.T) {
14991499
15001500
default allow = false
15011501
1502-
allow {
1502+
allow if {
15031503
input.parsed_path = ["my", "test", "path"]
15041504
}
15051505
`
@@ -1573,7 +1573,7 @@ func TestCheckAllowObjectDecisionReqHeadersToRemove(t *testing.T) {
15731573
15741574
default allow = false
15751575
1576-
allow {
1576+
allow if {
15771577
input.parsed_path = ["my", "test", "path"]
15781578
}
15791579
@@ -1625,7 +1625,7 @@ func TestCheckAllowObjectDecisionResponseHeadersToAdd(t *testing.T) {
16251625
16261626
default allow = false
16271627
1628-
allow {
1628+
allow if {
16291629
input.parsed_path = ["my", "test", "path"]
16301630
}
16311631
@@ -1677,7 +1677,7 @@ func TestCheckAllowObjectDecisionMultiValuedHeaders(t *testing.T) {
16771677
16781678
default allow = false
16791679
1680-
allow {
1680+
allow if {
16811681
input.parsed_path = ["my", "test", "path"]
16821682
}
16831683
@@ -1976,34 +1976,34 @@ func testAuthzServer(customConfig *Config, customPluginFuncs ...customPluginFunc
19761976
19771977
default allow = false
19781978
1979-
allow {
1979+
allow if {
19801980
roles_for_user[r]
19811981
required_roles[r]
19821982
}
19831983
1984-
allow {
1984+
allow if {
19851985
input.parsed_path = ["my", "test", "path"]
19861986
input.parsed_query.a = ["1", "2"]
19871987
input.parsed_query.x = ["y"]
19881988
}
19891989
1990-
allow {
1990+
allow if {
19911991
input.parsed_body.firstname == "foo"
19921992
input.parsed_body.lastname == "bar"
19931993
input.parsed_body.dept.it == "eng"
19941994
}
19951995
1996-
roles_for_user[r] {
1996+
roles_for_user[r] if {
19971997
r := user_roles[user_name][_]
19981998
}
19991999
2000-
required_roles[r] {
2000+
required_roles[r] if {
20012001
perm := role_perms[r][_]
20022002
perm.method = http_request.method
20032003
perm.path = http_request.path
20042004
}
20052005
2006-
user_name = parsed {
2006+
user_name = parsed if {
20072007
[_, encoded] := split(http_request.headers.authorization, " ")
20082008
[parsed, _] := split(base64url.decode(encoded), ":")
20092009
}
@@ -2080,7 +2080,7 @@ func testAuthzServerWithObjectDecision(customConfig *Config, customPluginFuncs .
20802080
"dynamic_metadata": {"test": "foo", "bar": "baz"}
20812081
}
20822082
2083-
allow = response {
2083+
allow = response if {
20842084
input.parsed_path = ["my", "test", "path"]
20852085
response := {
20862086
"allowed": true,
@@ -2098,7 +2098,7 @@ func testAuthzServerWithTruncatedBody(customConfig *Config, customPluginFuncs ..
20982098
20992099
default allow = false
21002100
2101-
allow {
2101+
allow if {
21022102
not input.truncated_body
21032103
}
21042104
`
@@ -2197,7 +2197,7 @@ func TestVersionInfoInputV3(t *testing.T) {
21972197
module := `
21982198
package envoy.authz
21992199
2200-
allow {
2200+
allow if {
22012201
input.version.ext_authz == "v3"
22022202
input.version.encoding == "protojson"
22032203
}
@@ -2224,7 +2224,7 @@ func TestVersionInfoInputV2(t *testing.T) {
22242224
module := `
22252225
package envoy.authz
22262226
2227-
allow {
2227+
allow if {
22282228
input.version.ext_authz == "v2"
22292229
input.version.encoding == "encoding/json"
22302230
}

0 commit comments

Comments
 (0)