diff options
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/authz/grpc.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/authz/grpc.go b/pkg/authz/grpc.go index 234208c..9851db4 100644 --- a/pkg/authz/grpc.go +++ b/pkg/authz/grpc.go @@ -4,7 +4,9 @@ import ( "context" "crypto/x509" "net" + "os" + v1 "github.com/authzed/authzed-go/proto/authzed/api/v1" "github.com/authzed/authzed-go/v1" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls" "google.golang.org/grpc" @@ -58,3 +60,13 @@ func credentialsFor(ctx context.Context, host string) credentials.TransportCrede return credentials.NewClientTLSFromCert(pool, "") } + +func LoadSpiceSchema(ctx context.Context, client *authzed.Client, path string) error { + content, err := os.ReadFile(path) + _, err = client.WriteSchema(ctx, &v1.WriteSchemaRequest{Schema: string(content)}) + if err != nil { + return err + } + + return nil +} |
