Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to use new events handling #148

Merged
merged 4 commits into from
Aug 7, 2023
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
47 changes: 34 additions & 13 deletions chart/permissions-api/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,47 @@ spec:
- name: PERMISSIONSAPI_SERVER_TRUSTED_PROXIES
value: "{{ join " " . }}"
{{- end }}
- name: PERMISSIONSAPI_EVENTS_SUBSCRIBER_URL
value: "{{ .Values.config.events.url }}"
- name: PERMISSIONSAPI_EVENTS_SUBSCRIBER_TIMEOUT
value: "{{ .Values.config.events.timeout }}"
- name: PERMISSIONSAPI_EVENTS_SUBSCRIBER_PREFIX
value: "{{ .Values.config.events.prefix }}"
- name: PERMISSIONSAPI_EVENTS_SUBSCRIBER_QUEUEGROUP
value: "{{ .Values.config.events.queueGroup }}"
- name: PERMISSIONSAPI_EVENTS_NATS_URL
value: "{{ .Values.config.events.nats.url }}"
- name: PERMISSIONSAPI_EVENTS_NATS_SUBSCRIBEPREFIX
value: "{{ .Values.config.events.nats.subscribePrefix }}"
- name: PERMISSIONSAPI_EVENTS_NATS_QUEUEGROUP
value: "{{ .Values.config.events.nats.queueGroup }}"
- name: PERMISSIONSAPI_EVENTS_NATS_SOURCE
value: "{{ .Values.config.events.nats.source }}"
- name: PERMISSIONSAPI_EVENTS_NATS_CONNECTTIMEOUT
value: "{{ .Values.config.events.nats.connectTimeout }}"
- name: PERMISSIONSAPI_EVENTS_NATS_SHUTDOWNTIMEOUT
value: "{{ .Values.config.events.nats.shutdownTimeout }}"
- name: PERMISSIONSAPI_EVENTS_NATS_SUBSCRIBERFETCHBATCHSIZE
value: "{{ .Values.config.events.nats.subscriberFetchBatchSize }}"
- name: PERMISSIONSAPI_EVENTS_NATS_SUBSCRIBERFETCHTIMEOUT
value: "{{ .Values.config.events.nats.subscriberFetchTimeout }}"
- name: PERMISSIONSAPI_EVENTS_NATS_SUBSCRIBERFETCHBACKOFF
value: "{{ .Values.config.events.nats.subscriberFetchBackoff }}"
- name: PERMISSIONSAPI_EVENTS_NATS_SUBSCRIBERNOACKEXPLICIT
value: "{{ .Values.config.events.nats.subscriberNoAckExplicit }}"
- name: PERMISSIONSAPI_EVENTS_NATS_SUBSCRIBERNOMANUALACK
value: "{{ .Values.config.events.nats.subscriberNoManualAck }}"
- name: PERMISSIONSAPI_EVENTS_NATS_SUBSCRIBERDELIVERYPOLICY
value: "{{ .Values.config.events.nats.subscriberDeliveryPolicy }}"
- name: PERMISSIONSAPI_EVENTS_NATS_SUBSCRIBERSTARTSEQUENCE
value: "{{ .Values.config.events.nats.subscriberStartSequence }}"
{{- with .Values.config.events.topics }}
- name: PERMISSIONSAPI_EVENTS_TOPICS
value: "{{ join " " . }}"
{{- end }}
{{- if .Values.config.events.nats.tokenSecretName }}
- name: PERMISSIONSAPI_EVENTS_NATS_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.config.events.nats.tokenSecretName }}
key: token
{{- end }}
{{- if .Values.config.events.nats.credsSecretName }}
- name: PERMISSIONSAPI_EVENTS_SUBSCRIBER_NATS_CREDSFILE
- name: PERMISSIONSAPI_EVENTS_NATS_CREDSFILE
value: "{{ .Values.config.events.nats.credsFile }}"
{{- end }}
{{- if .Values.config.events.nats.token }}
- name: PERMISSIONSAPI_EVENTS_SUBSCRIBER_NATS_TOKEN
value: "{{ .Values.config.events.nats.token }}"
{{- end }}
{{- if .Values.config.oidc.issuer }}
{{- with .Values.config.oidc.audience }}
- name: PERMISSIONSAPI_OIDC_AUDIENCE
Expand Down
39 changes: 29 additions & 10 deletions chart/permissions-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,39 @@ config:
policyConfigMapName: ""

events:
# url is the event server connection url
url: ""
# timeout is event connection timeout
timeout: ""
# prefix is the subscribe event prefix
prefix: ""
# queueGroup defines the events queue group
queueGroup: ""
# topics are the list of topics to subscribe to
topics: []

# nats contains nats specific configuration
nats:
# token is the nats auth token
token: ""
# url is the event server connection url
url: ""
# subscribePrefix is the subscribe event prefix
subscribePrefix: ""
# queueGroup defines the events queue group
queueGroup: ""
# source defines the source of the events (defaults to application name)
source: ""
# connectTimeout is event connection timeout
connectTimeout: "10s"
# shutdownTimeout is the shutdown grace period
shutdownTimeout: "5s"
# subscriberFetchBatchSize is the subscribers fetch batch size
subscriberFetchBatchSize: "20"
# subscriberFetchTimeout is the subscribers fetch timeout
subscriberFetchTimeout: "5s"
# subscriberFetchBackoff is the subscriber fetch retry delay
subscriberFetchBackoff: "5s"
# subscriberNoAckExplicit disables Ack Explicit
subscriberNoAckExplicit: false
# subscriberNoManualAck disables Manual Ack
subscriberNoManualAck: false
# subscriberDeliveryPolicy sets the delivery policy
subscriberDeliveryPolicy: "all"
# subscriberStartSequence is the subscribers consumer start sequence (subscriberDeliveryPolicy must be `start-sequence`)
subscriberStartSequence: 0
# tokenSecretName is the secret to load the auth token
tokenSecretName: ""
# credsSecretName is the secret to load the creds auth file from
credsSecretName: ""
# credsFile is the location to read the creds file from
Expand Down
78 changes: 59 additions & 19 deletions cmd/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ package cmd

import (
"context"
"os"
"os/signal"
"syscall"
"time"

"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.infratographer.com/x/echox"
"go.infratographer.com/x/events"
"go.infratographer.com/x/otelx"
"go.infratographer.com/x/versionx"
"go.infratographer.com/x/viperx"
"go.uber.org/zap"

"go.infratographer.com/permissions-api/internal/config"
Expand All @@ -19,6 +22,8 @@ import (
"go.infratographer.com/permissions-api/internal/spicedbx"
)

const shutdownTimeout = 10 * time.Second

var workerCmd = &cobra.Command{
Use: "worker",
Short: "starts a permissions-api queue worker",
Expand All @@ -31,11 +36,9 @@ func init() {
rootCmd.AddCommand(workerCmd)

otelx.MustViperFlags(viper.GetViper(), workerCmd.Flags())
events.MustViperFlagsForSubscriber(viper.GetViper(), workerCmd.Flags())
events.MustViperFlags(viper.GetViper(), workerCmd.Flags(), appName)
echox.MustViperFlags(viper.GetViper(), workerCmd.Flags(), apiDefaultListen)

workerCmd.PersistentFlags().StringSlice("events-topics", []string{}, "event topics to subscribe to")
viperx.MustBindFlag(viper.GetViper(), "events.topics", workerCmd.PersistentFlags().Lookup("events-topics"))
config.MustViperFlags(viper.GetViper(), workerCmd.Flags())
}

func worker(ctx context.Context, cfg *config.AppConfig) {
Expand Down Expand Up @@ -68,39 +71,76 @@ func worker(ctx context.Context, cfg *config.AppConfig) {

engine := query.NewEngine("infratographer", spiceClient, query.WithPolicy(policy), query.WithLogger(logger))

subscriber, err := pubsub.NewSubscriber(ctx, cfg.Events.Subscriber, engine, pubsub.WithLogger(logger))
events, err := events.NewConnection(cfg.Events.Config, events.WithLogger(logger))
if err != nil {
logger.Fatalw("failed to initialize events", "error", err)
}

subscriber, err := pubsub.NewSubscriber(ctx, events, engine,
pubsub.WithLogger(logger),
)
if err != nil {
logger.Fatalw("unable to initialize subscriber", "error", err)
}

defer subscriber.Close()
topics := cfg.Events.Topics

for _, topic := range viper.GetStringSlice("events.topics") {
// if no topics are defined, add all topics from the schema.
if len(topics) == 0 {
schema := policy.Schema()

for _, rt := range schema {
topics = append(topics, "*."+rt.Name)
}
}

for _, topic := range topics {
if err := subscriber.Subscribe(topic); err != nil {
logger.Fatalw("failed to subscribe to changes topic", "topic", topic, "error", err)
}
}

logger.Info("Listening for events")
srv, err := echox.NewServer(logger.Desugar(), cfg.Server, versionx.BuildDetails())
if err != nil {
logger.Fatal("failed to initialize new server", zap.Error(err))
}

srv.AddReadinessCheck("spicedb", spicedbx.Healthcheck(spiceClient))

quit := make(chan os.Signal, 1)

signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)

go func() {
logger.Info("Listening for events")

if err := subscriber.Listen(); err != nil {
logger.Fatalw("error listening for events", "error", err)
}
}()

srv, err := echox.NewServer(
logger.Desugar(),
echox.ConfigFromViper(viper.GetViper()),
versionx.BuildDetails(),
)
if err != nil {
logger.Fatal("failed to initialize new server", zap.Error(err))
go func() {
if err := srv.Run(); err != nil {
logger.Fatal("failed to run server", zap.Error(err))
}
}()

var cancel func()

select {
case <-quit:
logger.Info("signal caught, shutting down")

ctx, cancel = context.WithTimeout(ctx, shutdownTimeout)
case <-ctx.Done():
logger.Info("context done, shutting down")

ctx, cancel = context.WithTimeout(context.Background(), shutdownTimeout)
}

srv.AddReadinessCheck("spicedb", spicedbx.Healthcheck(spiceClient))
defer cancel()

if err := srv.Run(); err != nil {
logger.Fatal("failed to run server", zap.Error(err))
if err := events.Shutdown(ctx); err != nil {
logger.Fatalw("failed to shutdown events gracefully", "error", "err")
}
}
10 changes: 2 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ module go.infratographer.com/permissions-api
go 1.20

require (
github.com/ThreeDotsLabs/watermill v1.2.0
github.com/authzed/authzed-go v0.8.0
github.com/authzed/grpcutil v0.0.0-20230524151342-4caf7fd1108a
github.com/labstack/echo/v4 v4.11.1
github.com/nats-io/nats.go v1.27.1
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
go.infratographer.com/x v0.3.4
go.infratographer.com/x v0.3.5-0.20230804152936-1fb9cfe07da6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we going to be on this prerelease commit for everything until v0.3.5 is cut?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are for now, still waiting for the actual release to be cut.

go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0
go.opentelemetry.io/otel v1.16.0
Expand All @@ -26,7 +24,6 @@ require (

require (
github.com/MicahParks/keyfunc/v2 v2.0.3 // indirect
github.com/ThreeDotsLabs/watermill-nats/v2 v2.0.0 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
Expand All @@ -36,13 +33,11 @@ require (
github.com/envoyproxy/protoc-gen-validate v0.10.1 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/garsue/watermillzap v1.2.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand All @@ -54,7 +49,6 @@ require (
github.com/labstack/echo-contrib v0.15.0 // indirect
github.com/labstack/echo-jwt/v4 v4.2.0 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/lithammer/shortuuid/v3 v3.0.7 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
Expand All @@ -65,9 +59,9 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nats-io/jwt/v2 v2.4.1 // indirect
github.com/nats-io/nats-server/v2 v2.9.17 // indirect
github.com/nats-io/nats.go v1.27.1 // indirect
github.com/nats-io/nkeys v0.4.4 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
Expand Down
20 changes: 4 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/MicahParks/keyfunc/v2 v2.0.3 h1:uKUEOc+knRO0UoucONisgNPiT85V2s/W5c0FQYsd9kc=
github.com/MicahParks/keyfunc/v2 v2.0.3/go.mod h1:rW42fi+xgLJ2FRRXAfNx9ZA8WpD4OeE/yHVMteCkw9k=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/ThreeDotsLabs/watermill v1.2.0 h1:TU3TML1dnQ/ifK09F2+4JQk2EKhmhXe7Qv7eb5ZpTS8=
github.com/ThreeDotsLabs/watermill v1.2.0/go.mod h1:IuVxGk/kgCN0cex2S94BLglUiB0PwOm8hbUhm6g2Nx4=
github.com/ThreeDotsLabs/watermill-nats/v2 v2.0.0 h1:ZbdQ+cHwOZmXByEoKUH8SS6qR/erNQfrsNpvH5z/gfk=
github.com/ThreeDotsLabs/watermill-nats/v2 v2.0.0/go.mod h1:X6pcl579pScj4mII3KM/WJ+bcOqORqiCToy92f4gqJ4=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/authzed/authzed-go v0.8.0 h1:gb4X+7RxVqXSCFReAnKmSda68TBIqRdc47W2spLqoEc=
github.com/authzed/authzed-go v0.8.0/go.mod h1:h9Zar1MSSrVsqbcbE5/RO7gpg6Fx5QYW2C5QduSox5M=
Expand Down Expand Up @@ -100,8 +96,6 @@ github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/garsue/watermillzap v1.2.0 h1:IA0zGb5b7mIGLXN9P2/6CmP5+f7Qgb00BdL2VCAk2SA=
github.com/garsue/watermillzap v1.2.0/go.mod h1:uo3SDSGYaw6RBzUx9jcHMYqypOTqlQ4/vz+8r1olRto=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand Down Expand Up @@ -180,9 +174,7 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
Expand All @@ -192,8 +184,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFb
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0 h1:t7uX3JBHdVwAi3G7sSSdbsk8NfgA+LnUS88V/2EKaA0=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0/go.mod h1:4OGVnY4qf2+gw+ssiHbW+pq4mo2yko94YxxMmXZ7jCA=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
Expand Down Expand Up @@ -229,8 +219,6 @@ github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUU
github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ=
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
github.com/lithammer/shortuuid/v3 v3.0.7 h1:trX0KTHy4Pbwo/6ia8fscyHoGA+mf1jWbPJVuvyJQQ8=
github.com/lithammer/shortuuid/v3 v3.0.7/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
Expand All @@ -242,6 +230,8 @@ github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APP
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/mikemrm/infratographer-x v0.0.0-20230804122801-b75f397f9d1a h1:eXzGWSXL+ltVGXso3Ji46f66ob78s8FT/g/5Nixs+HQ=
github.com/mikemrm/infratographer-x v0.0.0-20230804122801-b75f397f9d1a/go.mod h1:AMNcTkqb+yHLCbnZtiiHTC7QvN+4MOpzdOhqHXfKQUk=
github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g=
github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
Expand All @@ -261,8 +251,6 @@ github.com/nats-io/nkeys v0.4.4 h1:xvBJ8d69TznjcQl9t6//Q5xXuVhyYiSos6RPtvQNTwA=
github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
Expand Down Expand Up @@ -325,8 +313,8 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.infratographer.com/x v0.3.4 h1:K7azcoiLZPRdOnr4M7DMyB2DjZzXRVcfr7G6FeQd16o=
go.infratographer.com/x v0.3.4/go.mod h1:pXXSdeJBisAK3AdED5EFj7Yo8z8td7fOWDkNl4Dkp0s=
go.infratographer.com/x v0.3.5-0.20230804152936-1fb9cfe07da6 h1:XDsi9eXtvIyyrvn+S/H3siQl8ccfV+QJ5qU4+jGGQuU=
go.infratographer.com/x v0.3.5-0.20230804152936-1fb9cfe07da6/go.mod h1:AMNcTkqb+yHLCbnZtiiHTC7QvN+4MOpzdOhqHXfKQUk=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
Expand Down
2 changes: 1 addition & 1 deletion internal/api/relationships.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (r *Router) relationshipDelete(c echo.Context) error {
Subject: relatedResource,
}

_, err = r.engine.DeleteRelationship(ctx, relationship)
_, err = r.engine.DeleteRelationships(ctx, relationship)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "error deleting relationship").SetInternal(err)
}
Expand Down
Loading