Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# vendor/

# Go workspace file
go.work
#go.work

tmp/
.DS_Store
Expand Down
4 changes: 3 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ run:
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 5m

skip-files:
- ".*\\.pb\\.go"
- ".*\\.pb\\.gw.go"

# This file contains only configs which differ from defaults.
# All possible options can be found here https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
Expand Down
8 changes: 4 additions & 4 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ version: v1
managed:
enabled: true
go_package_prefix:
default: github.com/opentdf/opentdf-v2-poc/gen
default: github.com/opentdf/opentdf-v2-poc/sdk
except:
- buf.build/bufbuild/protovalidate
- buf.build/googleapis/googleapis
- buf.build/grpc-ecosystem/grpc-gateway
plugins:
- plugin: buf.build/grpc-ecosystem/gateway:v2.18.1
out: gen
out: sdk
opt:
- paths=source_relative
# dependencies
- plugin: buf.build/protocolbuffers/go:v1.31.0
out: gen
out: sdk
opt:
- paths=source_relative
- plugin: buf.build/grpc/go:v1.3.0
out: gen
out: sdk
opt:
- paths=source_relative
# - plugin: buf.build/grpc-ecosystem/openapiv2:v2.18.1
Expand Down
8 changes: 4 additions & 4 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (
"github.com/opentdf/opentdf-v2-poc/internal/logger"
"github.com/opentdf/opentdf-v2-poc/internal/opa"
"github.com/opentdf/opentdf-v2-poc/internal/server"
"github.com/opentdf/opentdf-v2-poc/pkg/services/acre"
"github.com/opentdf/opentdf-v2-poc/pkg/services/acse"
"github.com/opentdf/opentdf-v2-poc/pkg/services/attributes"
"github.com/opentdf/opentdf-v2-poc/pkg/services/keyaccessgrants"
"github.com/opentdf/opentdf-v2-poc/services/acre"
"github.com/opentdf/opentdf-v2-poc/services/acse"
"github.com/opentdf/opentdf-v2-poc/services/attributes"
"github.com/opentdf/opentdf-v2-poc/services/keyaccessgrants"
"github.com/spf13/cobra"
)

Expand Down
23 changes: 23 additions & 0 deletions examples/attributes/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module github.com/opentdf/opentdf-v2-poc/examples/attributes

go 1.21.5

replace github.com/opentdf/opentdf-v2-poc/sdk => ../../sdk

require (
github.com/opentdf/opentdf-v2-poc/sdk v0.0.0-00010101000000-000000000000
google.golang.org/grpc v1.60.1
)

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20231115204500-e097f827e652.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
29 changes: 29 additions & 0 deletions examples/attributes/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20231115204500-e097f827e652.2 h1:iEPA5SBtdLJNwQis/SrcCuDWJh5E1V0mVO4Ih7/mRbg=
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20231115204500-e097f827e652.2/go.mod h1:xafc+XIsTxTy76GJQ1TKgvJWsSugFBqMaN27WhUblew=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 h1:6UKoz5ujsI55KNpsJH3UwCq3T8kKbZwNZBNPuTTje8U=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1/go.mod h1:YvJ2f6MplWDhfxiUC3KpyTy76kYUZA4W3pTv/wdKQ9Y=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ=
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY=
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo=
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc=
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
17 changes: 7 additions & 10 deletions examples/go/attributes/main.go → examples/attributes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import (
"log/slog"
"os"

"github.com/opentdf/opentdf-v2-poc/gen/attributes"
"github.com/opentdf/opentdf-v2-poc/gen/common"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/opentdf/opentdf-v2-poc/sdk"
"github.com/opentdf/opentdf-v2-poc/sdk/attributes"
"github.com/opentdf/opentdf-v2-poc/sdk/common"
)

func main() {
Expand All @@ -33,16 +32,14 @@ func main() {
},
}

conn, err := grpc.Dial("localhost:9000", grpc.WithTransportCredentials(insecure.NewCredentials()))
s, err := sdk.New("localhost:9000", sdk.WithInsecureConn())
if err != nil {
slog.Error("could not connect", slog.String("error", err.Error()))
os.Exit(1)
}
defer conn.Close()
defer s.Close()

attrClient := attributes.NewAttributesServiceClient(conn)

_, err = attrClient.CreateAttribute(context.Background(), &attributes.CreateAttributeRequest{
_, err = s.Attributes.CreateAttribute(context.Background(), &attributes.CreateAttributeRequest{
Definition: &definition,
})
if err != nil {
Expand All @@ -52,7 +49,7 @@ func main() {

slog.Info("attribute created")

allAttr, err := attrClient.ListAttributes(context.Background(), &attributes.ListAttributesRequest{})
allAttr, err := s.Attributes.ListAttributes(context.Background(), &attributes.ListAttributesRequest{})
if err != nil {
slog.Error("could not list attributes", slog.String("error", err.Error()))
os.Exit(1)
Expand Down
11 changes: 7 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module github.com/opentdf/opentdf-v2-poc

go 1.21
go 1.21.5

replace github.com/opentdf/opentdf-v2-poc/sdk => ./sdk

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20231115204500-e097f827e652.2
github.com/Masterminds/squirrel v1.5.4
github.com/bufbuild/protovalidate-go v0.4.3
github.com/creasty/defaults v1.7.0
Expand All @@ -12,17 +13,19 @@ require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1
github.com/jackc/pgx/v5 v5.5.0
github.com/open-policy-agent/opa v0.59.0
github.com/opentdf/opentdf-v2-poc/sdk v0.0.0-00010101000000-000000000000
github.com/pressly/goose/v3 v3.16.0
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.1
github.com/stretchr/testify v1.8.4
github.com/testcontainers/testcontainers-go v0.26.0
github.com/valyala/fasthttp v1.51.0
google.golang.org/grpc v1.59.0
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.31.0
)

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20231115204500-e097f827e652.2 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
Expand Down Expand Up @@ -126,6 +129,6 @@ require (
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc=
google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk=
google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
Expand Down
7 changes: 7 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
go 1.21.5

use (
.
./examples/attributes
./sdk
)
2 changes: 1 addition & 1 deletion internal/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/jackc/pgx/v5/pgconn"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/jackc/pgx/v5/stdlib"
"github.com/opentdf/opentdf-v2-poc/gen/common"
"github.com/opentdf/opentdf-v2-poc/migrations"
"github.com/opentdf/opentdf-v2-poc/sdk/common"
"github.com/pressly/goose/v3"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/db/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/opentdf/opentdf-v2-poc/gen/acre"
"github.com/opentdf/opentdf-v2-poc/gen/common"
"github.com/opentdf/opentdf-v2-poc/sdk/acre"
"github.com/opentdf/opentdf-v2-poc/sdk/common"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/encoding/protojson"
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package key_access_grants;
package keyaccessgrants;

import "attributes/attributes.proto";
import "buf/validate/validate.proto";
Expand Down
8 changes: 4 additions & 4 deletions gen/acre/acre.pb.go → sdk/acre/acre.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions gen/acse/acse.pb.go → sdk/acse/acse.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions gen/common/common.pb.go → sdk/common/common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions sdk/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module github.com/opentdf/opentdf-v2-poc/sdk

go 1.21.5

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.31.0-20231115204500-e097f827e652.2
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.31.0
)

require (
github.com/golang/protobuf v1.5.3 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
)
Loading