diff --git a/.bin/go.mod b/.bin/go.mod index e1bebe31a..9292965e7 100644 --- a/.bin/go.mod +++ b/.bin/go.mod @@ -6,6 +6,7 @@ replace github.com/goreleaser/nfpm => github.com/goreleaser/nfpm v1.10.2 require ( github.com/bufbuild/buf v1.9.0 + github.com/go-swagger/go-swagger v0.30.3 github.com/josephburnett/jd v1.6.0 github.com/mattn/goveralls v0.0.11 github.com/mikefarah/yq/v4 v4.27.2 @@ -20,11 +21,14 @@ require ( github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver v1.5.0 // indirect + github.com/Masterminds/semver/v3 v3.1.1 // indirect github.com/Masterminds/sprig v2.22.0+incompatible // indirect + github.com/Masterminds/sprig/v3 v3.2.2 // indirect github.com/Microsoft/go-winio v0.6.0 // indirect github.com/OneOfOne/xxhash v1.2.8 // indirect github.com/a8m/envsubst v1.3.0 // indirect github.com/alecthomas/participle/v2 v2.0.0-beta.4 // indirect + github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect github.com/bufbuild/connect-go v1.0.0 // indirect github.com/bufbuild/protocompile v0.1.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect @@ -39,12 +43,22 @@ require ( github.com/elliotchance/orderedmap v1.4.0 // indirect github.com/envoyproxy/protoc-gen-validate v0.6.2 // indirect github.com/fatih/color v1.13.0 // indirect + github.com/felixge/httpsnoop v1.0.3 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/go-chi/chi/v5 v5.0.7 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/analysis v0.21.4 // indirect + github.com/go-openapi/errors v0.20.3 // indirect + github.com/go-openapi/inflect v0.19.0 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/swag v0.21.1 // indirect + github.com/go-openapi/jsonreference v0.20.0 // indirect + github.com/go-openapi/loads v0.21.2 // indirect + github.com/go-openapi/runtime v0.24.1 // indirect + github.com/go-openapi/spec v0.20.7 // indirect + github.com/go-openapi/strfmt v0.21.3 // indirect + github.com/go-openapi/swag v0.22.3 // indirect + github.com/go-openapi/validate v0.22.0 // indirect github.com/goccy/go-json v0.9.10 // indirect github.com/goccy/go-yaml v1.9.5 // indirect github.com/gofrs/flock v0.8.1 // indirect @@ -53,16 +67,20 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/uuid v1.3.0 // indirect + github.com/gorilla/handlers v1.5.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/huandu/xstrings v1.3.2 // indirect github.com/imdario/mergo v0.3.12 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a // indirect + github.com/jessevdk/go-flags v1.5.0 // indirect github.com/jinzhu/copier v0.3.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/klauspost/compress v1.15.11 // indirect github.com/klauspost/pgzip v1.2.5 // indirect + github.com/kr/pretty v0.3.0 // indirect + github.com/kr/text v0.2.0 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.12 // indirect @@ -75,25 +93,31 @@ require ( github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/mwitkow/go-proto-validators v0.2.0 // indirect + github.com/oklog/ulid v1.3.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect github.com/ory/viper v1.7.5 // indirect github.com/pborman/uuid v1.2.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.1 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pkg/profile v1.6.0 // indirect github.com/pseudomuto/protokit v0.2.0 // indirect - github.com/rogpeppe/go-internal v1.8.1 // indirect + github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/rs/cors v1.8.2 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/shopspring/decimal v1.2.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/spf13/afero v1.8.2 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.6.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.12.0 // indirect github.com/subosito/gotenv v1.3.0 // indirect + github.com/toqueteos/webbrowser v1.2.0 // indirect + go.mongodb.org/mongo-driver v1.10.1 // indirect go.opencensus.io v0.23.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.3 // indirect go.opentelemetry.io/otel v1.11.0 // indirect @@ -103,7 +127,7 @@ require ( go.uber.org/goleak v1.1.12 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.23.0 // indirect - golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect + golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect golang.org/x/net v0.0.0-20221017152216-f25eb7ecb193 // indirect golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 // indirect diff --git a/.bin/go.sum b/.bin/go.sum index 00fa89b86..48b67aebd 100644 --- a/.bin/go.sum +++ b/.bin/go.sum @@ -45,13 +45,19 @@ github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJ github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= +github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= +github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8= github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/a8m/envsubst v1.3.0 h1:GmXKmVssap0YtlU3E230W98RWtWCyIZzjtf1apWWyAg= github.com/a8m/envsubst v1.3.0/go.mod h1:MVUTQNGQ3tsjOOtKCNd+fl8RzhsXcDvvAEzkhGtlsbY= github.com/alecthomas/assert/v2 v2.0.3 h1:WKqJODfOiQG0nEJKFKzDIG3E29CN2/4zR9XGJzKIkbg= @@ -61,6 +67,9 @@ github.com/alecthomas/repr v0.1.0 h1:ENn2e1+J3k09gyj2shc0dHr/yjaWSHRlrJ4DPMevDqE github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -111,6 +120,7 @@ github.com/docker/docker v20.10.19+incompatible h1:lzEmjivyNHFHMNAFLXORMBXyGIhw/ github.com/docker/docker v20.10.19+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/elliotchance/orderedmap v1.4.0 h1:wZtfeEONCbx6in1CZyE6bELEt/vFayMvsxqI5SgsR+A= @@ -126,6 +136,9 @@ github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= +github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -146,16 +159,77 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/analysis v0.21.2/go.mod h1:HZwRk4RRisyG8vx2Oe6aqeSQcoxRp47Xkp3+K6q+LdY= +github.com/go-openapi/analysis v0.21.4 h1:ZDFLvSNxpDaomuCueM0BlSXxpANBlFYiBvr+GXrvIHc= +github.com/go-openapi/analysis v0.21.4/go.mod h1:4zQ35W4neeZTqh3ol0rv/O8JBbka9QyAgQRPp9y3pfo= +github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.3 h1:rz6kiC84sqNQoqrtulzaL/VERgkoCyB6WdEkc2ujzUc= +github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= +github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4= +github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= +github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= +github.com/go-openapi/loads v0.21.1/go.mod h1:/DtAMXXneXFjbQMGEtbamCZb+4x7eGwkvZCvBmwUG+g= +github.com/go-openapi/loads v0.21.2 h1:r2a/xFIYeZ4Qd2TnGpWDIQNcP80dIaZgf704za8enro= +github.com/go-openapi/loads v0.21.2/go.mod h1:Jq58Os6SSGz0rzh62ptiu8Z31I+OTHqmULx5e/gJbNw= +github.com/go-openapi/runtime v0.24.1 h1:Sml5cgQKGYQHF+M7yYSHaH1eOjvTykrddTE/KtQVjqo= +github.com/go-openapi/runtime v0.24.1/go.mod h1:AKurw9fNre+h3ELZfk6ILsfvPN+bvvlaU/M9q/r9hpk= +github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= +github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= +github.com/go-openapi/spec v0.20.7 h1:1Rlu/ZrOCCob0n+JKKJAWhNWMPW8bOZRg8FJaY+0SKI= +github.com/go-openapi/spec v0.20.7/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= +github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= +github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= +github.com/go-openapi/strfmt v0.21.2/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= +github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o= +github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrKU= github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/validate v0.21.0/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= +github.com/go-openapi/validate v0.22.0 h1:b0QecH6VslW/TxtpKgzpO1SNG7GU2FsaqKdP1E2T50Y= +github.com/go-openapi/validate v0.22.0/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-swagger/go-swagger v0.30.3 h1:HuzvdMRed/9Q8vmzVcfNBQByZVtT79DNZxZ18OprdoI= +github.com/go-swagger/go-swagger v0.30.3/go.mod h1:neDPes8r8PCz2JPvHRDj8BTULLh4VJUt7n6MpQqxhHM= +github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= +github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= +github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= +github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= +github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= +github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= +github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= +github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= +github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= +github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= +github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= +github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= +github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= +github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= +github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= +github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/goccy/go-json v0.9.10 h1:hCeNmprSNLB8B8vQKWl6DpuH0t60oEs+TAk9a7CScKc= github.com/goccy/go-json v0.9.10/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-yaml v1.9.5 h1:Eh/+3uk9kLxG4koCX6lRMAPS1OaMSAi+FJcya0INdB0= @@ -200,6 +274,7 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -238,6 +313,8 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/googleapis/gax-go/v2 v2.1.1 h1:dp3bWCh+PPO1zjRRiCSczJav13sBvG4UhNyVTa1KqdU= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= +github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= @@ -249,11 +326,13 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -261,9 +340,12 @@ github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7P github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a h1:d4+I1YEKVmWZrgkt6jpXBnLgV2ZjO0YxEtLDdfIZfH4= github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a/go.mod h1:Zi/ZFkEqFHTm7qkjyNJjaWH4LQA9LQhGJyF0lTYGpxw= +github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc= +github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jhump/protoreflect v1.13.1-0.20220928232736-101791cb1b4c h1:XImQJfpJLmGEEd8ll5yPVyL/aEvmgGHW4WYTyNseLOM= github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josephburnett/jd v1.6.0 h1:P6Kis7x+m/8iVW3S+Tmf1nc5W5dF/YJlDIeFRQx9DBc= github.com/josephburnett/jd v1.6.0/go.mod h1:R8ZnZnLt2D4rhW4NvBc/USTo6mzyNT6fYNIIWOJA9GY= @@ -273,21 +355,26 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= +github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -303,6 +390,8 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= @@ -317,31 +406,39 @@ github.com/mdempsky/go114-fuzz-build v0.0.0-20200813011514-561a369ae6e1 h1:WSodF github.com/mdempsky/go114-fuzz-build v0.0.0-20200813011514-561a369ae6e1/go.mod h1:+ERgsn0pkpyL8DyKWxte5VjCQb+aNJbIQU18YeTp+NQ= github.com/mikefarah/yq/v4 v4.27.2 h1:+I32ystA1lUmSLvVUjEkUvZTgEJ194KCRO6btirqlpU= github.com/mikefarah/yq/v4 v4.27.2/go.mod h1:14pnJPIOQoguuykAa8Knn2yswgoeS0goeSyRVd6UgrE= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/buildkit v0.10.4 h1:FvC+buO8isGpUFZ1abdSLdGHZVqg9sqI4BbFL8tlzP4= github.com/moby/buildkit v0.10.4/go.mod h1:Yajz9vt1Zw5q9Pp4pdb3TCSUXJBIroIQGQ3TTs/sLug= github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae h1:O4SWKdcHVCvYqyDV+9CJA1fcDN2L11Bule0iFy3YlAI= github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-proto-validators v0.2.0 h1:F6LFfmgVnfULfaRsQWBbe7F7ocuHCr9+7m+GAeDzNbQ= github.com/mwitkow/go-proto-validators v0.2.0/go.mod h1:ZfA1hW+UH/2ZHOWvQ3HnQaU0DtnpXu850MZiy+YUgcc= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/ory/go-acc v0.2.8 h1:rOHHAPQjf0u7eHFGWpiXK+gIu/e0GRSJNr9pDukdNC4= github.com/ory/go-acc v0.2.8/go.mod h1:iCRZUdGb/7nqvSn8xWZkhfVrtXRZ9Wru2E5rabCjFPI= github.com/ory/viper v1.7.5 h1:+xVdq7SU3e1vNaCsk/ixsfxE4zylk1TJUiJrY647jUE= @@ -349,9 +446,12 @@ github.com/ory/viper v1.7.5/go.mod h1:ypOuyJmEUb3oENywQZRgeAMwqgOyDqwboO1tj3DjTa github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= +github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= @@ -381,16 +481,25 @@ github.com/pseudomuto/protoc-gen-doc v1.5.1/go.mod h1:XpMKYg6zkcpgfpCfQ8GcWBDRtR github.com/pseudomuto/protokit v0.2.0 h1:hlnBDcy3YEDXH7kc9gV+NLaN0cDzhDvD1s7Y6FZ8RpM= github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= @@ -409,6 +518,7 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.6.0 h1:42a0n6jwCot1pUmomAp4T7DeMD+20LFv4Q54pxLf2LI= github.com/spf13/cobra v1.6.0/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= @@ -419,28 +529,48 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= +github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI= github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/toqueteos/webbrowser v1.2.0 h1:tVP/gpK69Fx+qMJKsLE7TD8LuGWPnEV71wBN9rrstGQ= +github.com/toqueteos/webbrowser v1.2.0/go.mod h1:XWoZq4cyp9WeUeak7w7LXRUQf1F1ATJMir8RTqb4ayM= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 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= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= +go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= +go.mongodb.org/mongo-driver v1.8.3/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= +go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= +go.mongodb.org/mongo-driver v1.10.1 h1:NujsPveKwHaWuKUer/ceo9DzEe7HIj1SlJ6uvXZG0S4= +go.mongodb.org/mongo-driver v1.10.1/go.mod h1:z4XpeoU6w+9Vht+jAFyLgVrD+jGSQQe0+CBWFHNiHt8= 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= @@ -471,16 +601,23 @@ go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY= go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM= +golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -555,7 +692,10 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20221017152216-f25eb7ecb193 h1:3Moaxt4TfzNcQH6DWvlYKraN1ozhBXQHcgvXjRGeim0= golang.org/x/net v0.0.0-20221017152216-f25eb7ecb193/go.mod h1:RpDiru2p0u2F0lLpEoqnP2+7xs0ifAuOcJ442g6GU2s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -572,6 +712,7 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -587,15 +728,19 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -620,7 +765,9 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -630,12 +777,15 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43 h1:OK7RB6t2WQX54srQQYSXMW8dF5C6/8+oA/s5QBmmto4= golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220919170432-7a66f970e087 h1:tPwmk4vmvVCMdr98VgL4JH+qZxPL8fqlUOHnyOM8N3w= golang.org/x/term v0.0.0-20220919170432-7a66f970e087/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -644,6 +794,7 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY= @@ -661,9 +812,13 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= @@ -842,6 +997,7 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/.bin/indirect_pins.go b/.bin/indirect_pins.go index 22717637e..9750e8e11 100644 --- a/.bin/indirect_pins.go +++ b/.bin/indirect_pins.go @@ -16,4 +16,6 @@ import ( _ "google.golang.org/protobuf/cmd/protoc-gen-go" _ "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc" + + _ "github.com/go-swagger/go-swagger/cmd/swagger" ) diff --git a/Makefile b/Makefile index 77a90220e..e5257d440 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,10 @@ GO_DEPENDENCIES = golang.org/x/tools/cmd/goimports \ github.com/josephburnett/jd \ github.com/mikefarah/yq/v4 \ golang.org/x/tools/cmd/stringer \ + github.com/go-swagger/go-swagger/cmd/swagger \ github.com/mdempsky/go114-fuzz-build -SCRIPT_DEPENDENCIES = swagger \ - protoc \ +SCRIPT_DEPENDENCIES = protoc \ grype \ trivy \ ory \ diff --git a/cmd/check/root.go b/cmd/check/root.go index 09194653e..f7c9018c6 100644 --- a/cmd/check/root.go +++ b/cmd/check/root.go @@ -18,7 +18,7 @@ import ( "github.com/ory/keto/cmd/client" ) -type checkOutput check.RESTResponse +type checkOutput check.CheckPermissionResult func (o *checkOutput) String() string { if o.Allowed { diff --git a/cmd/relationtuple/create.go b/cmd/relationtuple/create.go index 5aeeeda1b..e446979f6 100644 --- a/cmd/relationtuple/create.go +++ b/cmd/relationtuple/create.go @@ -22,10 +22,10 @@ import ( func NewCreateCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "create []", - Short: "Create relation tuples from JSON files", - Long: "Create relation tuples from JSON files.\n" + - "A directory will be traversed and all relation tuples will be created.\n" + + Use: "create []", + Short: "Create relationships from JSON files", + Long: "Create relationships from JSON files.\n" + + "A directory will be traversed and all relationships will be created.\n" + "Pass the special filename `-` to read from STD_IN.", Args: cobra.MinimumNArgs(1), RunE: transactRelationTuples(rts.RelationTupleDelta_ACTION_INSERT), diff --git a/cmd/relationtuple/delete.go b/cmd/relationtuple/delete.go index 60a261cc7..89b068b58 100644 --- a/cmd/relationtuple/delete.go +++ b/cmd/relationtuple/delete.go @@ -19,9 +19,9 @@ import ( func NewDeleteCmd() *cobra.Command { cmd := &cobra.Command{ Use: "delete []", - Short: "Delete relation tuples defined in JSON files", - Long: "Delete relation tuples defined in the given JSON files.\n" + - "A directory will be traversed and all relation tuples will be deleted.\n" + + Short: "Delete relationships defined in JSON files", + Long: "Delete relationships defined in the given JSON files.\n" + + "A directory will be traversed and all relationships will be deleted.\n" + "Pass the special filename `-` to read from STD_IN.", Args: cobra.MinimumNArgs(1), RunE: transactRelationTuples(rts.RelationTupleDelta_ACTION_DELETE), diff --git a/cmd/relationtuple/delete_all.go b/cmd/relationtuple/delete_all.go index 8675c504c..fa54725aa 100644 --- a/cmd/relationtuple/delete_all.go +++ b/cmd/relationtuple/delete_all.go @@ -24,15 +24,15 @@ const ( func NewDeleteAllCmd() *cobra.Command { cmd := &cobra.Command{ Use: "delete-all", - Short: "Delete ALL relation tuples matching the relation query.", - Long: "Delete all relation tuples matching the relation query.\n" + + Short: "Delete ALL relationships matching the relation query.", + Long: "Delete all relationships matching the relation query.\n" + "It is recommended to first run the command without the `--force` flag to verify that the operation is safe.", Args: cobra.ExactArgs(0), RunE: deleteRelationTuplesFromQuery, } registerPackageFlags(cmd.Flags()) registerRelationTupleFlags(cmd.Flags()) - cmd.Flags().Bool(FlagForce, false, "Force the deletion of relation tuples") + cmd.Flags().Bool(FlagForce, false, "Force the deletion of relationships") return cmd } diff --git a/cmd/relationtuple/get.go b/cmd/relationtuple/get.go index 03eb33341..c72d50072 100644 --- a/cmd/relationtuple/get.go +++ b/cmd/relationtuple/get.go @@ -80,8 +80,8 @@ func NewGetCmd() *cobra.Command { cmd := &cobra.Command{ Use: "get", - Short: "Get relation tuples", - Long: "Get relation tuples matching the given partial tuple.\n" + + Short: "Get relationships", + Long: "Get relationships matching the given partial tuple.\n" + "Returns paginated results.", Args: cobra.ExactArgs(0), RunE: getTuples(&pageSize, &pageToken), diff --git a/cmd/relationtuple/parse.go b/cmd/relationtuple/parse.go index 4a5914e8d..a33abde71 100644 --- a/cmd/relationtuple/parse.go +++ b/cmd/relationtuple/parse.go @@ -18,8 +18,8 @@ import ( func NewParseCmd() *cobra.Command { cmd := &cobra.Command{ Use: "parse", - Short: "Parse human readable relation tuples", - Long: "Parse human readable relation tuples as used in the documentation.\n" + + Short: "Parse human readable relationships", + Long: "Parse human readable relationships as used in the documentation.\n" + "Supports various output formats. Especially useful for piping into other commands by using `--format json`.\n" + "Ignores comments (lines starting with `//`) and blank lines.", Args: cobra.MinimumNArgs(1), diff --git a/cmd/relationtuple/root.go b/cmd/relationtuple/root.go index 3cca761a0..723d1580b 100644 --- a/cmd/relationtuple/root.go +++ b/cmd/relationtuple/root.go @@ -15,7 +15,7 @@ import ( func newRelationCmd() *cobra.Command { return &cobra.Command{ Use: "relation-tuple", - Short: "Read and manipulate relation tuples", + Short: "Read and manipulate relationships", } } diff --git a/contrib/cat-videos-example/up.sh b/contrib/cat-videos-example/up.sh index fb2a20a8e..28f3cfd03 100755 --- a/contrib/cat-videos-example/up.sh +++ b/contrib/cat-videos-example/up.sh @@ -15,7 +15,7 @@ keto relation-tuple create contrib/cat-videos-example/relation-tuples echo " -Created all relation tuples. Now you can use the Keto CLI client to play around: +Created all relationships. Now you can use the Keto CLI client to play around: export KETO_READ_REMOTE=\"127.0.0.1:4466\" keto relation-tuple get videos diff --git a/doc_swagger.go b/doc_swagger.go index df8d571c6..9d98dc4d7 100644 --- a/doc_swagger.go +++ b/doc_swagger.go @@ -3,21 +3,18 @@ package main -// The standard error format -// swagger:model genericError -// nolint:deadcode,unused -type genericError struct { - Code int `json:"code,omitempty"` - - Status string `json:"status,omitempty"` - - Request string `json:"request,omitempty"` - - Reason string `json:"reason,omitempty"` +import "github.com/ory/herodot" - Details []map[string]interface{} `json:"details,omitempty"` - - Message string `json:"message"` +// JSON API Error Response +// +// The standard Ory JSON API error format. +// +// swagger:model errorGeneric +type errorGeneric struct { + // Contains error details + // + // required: true + Error herodot.DefaultError `json:"error"` } // An empty response diff --git a/docs/.generated/proto-api.mdx b/docs/.generated/proto-api.mdx new file mode 100644 index 000000000..18cc1bfea --- /dev/null +++ b/docs/.generated/proto-api.mdx @@ -0,0 +1,296 @@ +--- +title: Protocol Buffers API +--- + + + +The API is divided into the [read APIs](../concepts/api-overview.mdx#read-apis) +and [write APIs](../concepts/api-overview.mdx#write-apis). Each service is +annotated with the API it belongs to. + +## ory/keto/acl/v1alpha1/acl.proto + +### RelationTuple + +RelationTuple defines a relation between an Object and a Subject. + +| Field | Type | Label | Description | +| --------- | ----------------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------- | +| namespace | [string](#string) | | The namespace this relation tuple lives in. | +| object | [string](#string) | | The object related by this tuple. It is an object in the namespace of the tuple. | +| relation | [string](#string) | | The relation between an Object and a Subject. | +| subject | [Subject](#ory.keto.acl.v1alpha1.Subject) | | The subject related by this tuple. A Subject either represents a concrete subject id or a `SubjectSet` that expands to more Subjects. | + +### Subject + +Subject is either a concrete subject id or a `SubjectSet` expanding to more +Subjects. + +| Field | Type | Label | Description | +| ----- | ----------------------------------------------- | ----- | ----------------------------------------------------------------------------------------------------------------------- | +| id | [string](#string) | | A concrete id of the subject. | +| set | [SubjectSet](#ory.keto.acl.v1alpha1.SubjectSet) | | A subject set that expands to more Subjects. More information are available under [concepts](../concepts/subjects.mdx). | + +### SubjectSet + +SubjectSet refers to all subjects who have the same `relation` on an `object`. + +| Field | Type | Label | Description | +| --------- | ----------------- | ----- | ------------------------------------------------------------------------ | +| namespace | [string](#string) | | The namespace of the object and relation referenced in this subject set. | +| object | [string](#string) | | The object related by this subject set. | +| relation | [string](#string) | | The relation between the object and the subjects. | + +## ory/keto/acl/v1alpha1/check_service.proto + +### CheckService + +The service that performs authorization checks based on the stored Access +Control Lists. + +This service is part of the [read-APIs](../concepts/api-overview.mdx#read-apis). + +| Method Name | Request Type | Response Type | Description | +| ----------- | --------------------------------------------------- | ----------------------------------------------------- | -------------------------------- | +| Check | [CheckRequest](#ory.keto.acl.v1alpha1.CheckRequest) | [CheckResponse](#ory.keto.acl.v1alpha1.CheckResponse) | Performs an authorization check. | + +### CheckRequest + +The request for a CheckService.Check RPC. Checks whether a specific subject is +related to an object. + +| Field | Type | Label | Description | +| --------- | ----------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| namespace | [string](#string) | | The namespace to evaluate the check.
Note: If you use the expand-API and the check evaluates a RelationTuple specifying a SubjectSet as subject or due to a rewrite rule in a namespace config this check request may involve other namespaces automatically. | +| object | [string](#string) | | The related object in this check. | +| relation | [string](#string) | | The relation between the Object and the Subject. | +| subject | [Subject](#ory.keto.acl.v1alpha1.Subject) | | The related subject in this check. | +| latest | [bool](#bool) | | This field is not implemented yet and has no effect. | +| snaptoken | [string](#string) | | This field is not implemented yet and has no effect. | +| max_depth | [int32](#int32) | | The maximum depth to search for a relation.
If the value is less than 1 or greater than the global max-depth then the global max-depth will be used instead. | + +### CheckResponse + +The response for a CheckService.Check rpc. + +| Field | Type | Label | Description | +| --------- | ----------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| allowed | [bool](#bool) | | Whether the specified subject (id) is related to the requested object.
It is false by default if no ACL matches. | +| snaptoken | [string](#string) | | This field is not implemented yet and has no effect. | + +## ory/keto/acl/v1alpha1/expand_service.proto + +### ExpandService + +The service that performs subject set expansion based on the stored Access +Control Lists. + +This service is part of the [read-APIs](../concepts/api-overview.mdx#read-apis). + +| Method Name | Request Type | Response Type | Description | +| ----------- | ----------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------ | +| Expand | [ExpandRequest](#ory.keto.acl.v1alpha1.ExpandRequest) | [ExpandResponse](#ory.keto.acl.v1alpha1.ExpandResponse) | Expands the subject set into a tree of subjects. | + +### ExpandRequest + +The request for an ExpandService.Expand RPC. Expands the given subject set. + +| Field | Type | Label | Description | +| --------- | ----------------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| subject | [Subject](#ory.keto.acl.v1alpha1.Subject) | | The subject to expand. | +| max_depth | [int32](#int32) | | The maximum depth of tree to build.
If the value is less than 1 or greater than the global max-depth then the global max-depth will be used instead.
It is important to set this parameter to a meaningful value. Ponder how deep you really want to display this. | +| snaptoken | [string](#string) | | This field is not implemented yet and has no effect. | + +### ExpandResponse + +The response for a ExpandService.Expand RPC. + +| Field | Type | Label | Description | +| ----- | ------------------------------------------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| tree | [SubjectTree](#ory.keto.acl.v1alpha1.SubjectTree) | | The tree the requested subject set expands to. The requested subject set is the subject of the root.
This field can be nil in some circumstances. | + +### SubjectTree + +| Field | Type | Label | Description | +| --------- | ------------------------------------------------- | -------- | ------------------------------------------------------------------------------------ | +| node_type | [NodeType](#ory.keto.acl.v1alpha1.NodeType) | | The type of the node. | +| subject | [Subject](#ory.keto.acl.v1alpha1.Subject) | | The subject this node represents. | +| children | [SubjectTree](#ory.keto.acl.v1alpha1.SubjectTree) | repeated | The children of this node.
This is never set if `node_type` == `NODE_TYPE_LEAF`. | + +### NodeType + +| Name | Number | Description | +| ---------------------- | ------ | ---------------------------------------------------------------------------------------------------------- | +| NODE_TYPE_UNSPECIFIED | 0 | | +| NODE_TYPE_UNION | 1 | This node expands to a union of all children. | +| NODE_TYPE_EXCLUSION | 2 | Not implemented yet. | +| NODE_TYPE_INTERSECTION | 3 | Not implemented yet. | +| NODE_TYPE_LEAF | 4 | This node is a leaf and contains no children. Its subject is a `SubjectID` unless `max_depth` was reached. | + +## ory/keto/acl/v1alpha1/read_service.proto + +### ReadService + +The service to query relation tuples. + +This service is part of the [read-APIs](../concepts/api-overview.mdx#read-apis). + +| Method Name | Request Type | Response Type | Description | +| ------------------ | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -------------------------- | +| ListRelationTuples | [ListRelationTuplesRequest](#ory.keto.acl.v1alpha1.ListRelationTuplesRequest) | [ListRelationTuplesResponse](#ory.keto.acl.v1alpha1.ListRelationTuplesResponse) | Lists ACL relation tuples. | + +### ListRelationTuplesRequest + +Request for ReadService.ListRelationTuples RPC. See +`ListRelationTuplesRequest_Query` for how to filter the query. + +| Field | Type | Label | Description | +| ----------- | ----------------------------------------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| query | [ListRelationTuplesRequest.Query](#ory.keto.acl.v1alpha1.ListRelationTuplesRequest.Query) | | All query constraints are concatenated with a logical AND operator.
The RelationTuple list from ListRelationTuplesResponse is ordered from the newest RelationTuple to the oldest. | +| expand_mask | [google.protobuf.FieldMask](#google.protobuf.FieldMask) | | This field is not implemented yet and has no effect. | +| snaptoken | [string](#string) | | This field is not implemented yet and has no effect. | +| page_size | [int32](#int32) | | Optional. The maximum number of RelationTuples to return in the response.
Default: 100 | +| page_token | [string](#string) | | Optional. An opaque pagination token returned from a previous call to `ListRelationTuples` that indicates where the page should start at.
An empty token denotes the first page. All successive pages require the token from the previous page. | + +### ListRelationTuplesRequest.Query + +The query for listing relation tuples. Clients can specify any optional field to +partially filter for specific relation tuples. + +Example use cases (namespace is always required): + +- object only: display a list of all permissions referring to a specific object +- relation only: get all groups that have members; get all directories that have + content +- object & relation: display all subjects that have a specific permission + relation +- subject & relation: display all groups a subject belongs to; display all + objects a subject has access to +- object & relation & subject: check whether the relation tuple already exists + +| Field | Type | Label | Description | +| --------- | ----------------------------------------- | ----- | ------------------------------------ | +| namespace | [string](#string) | | Required. The namespace to query. | +| object | [string](#string) | | Optional. The object to query for. | +| relation | [string](#string) | | Optional. The relation to query for. | +| subject | [Subject](#ory.keto.acl.v1alpha1.Subject) | | Optional. The subject to query for. | + +### ListRelationTuplesResponse + +The response of a ReadService.ListRelationTuples RPC. + +| Field | Type | Label | Description | +| --------------- | ----------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------ | +| relation_tuples | [RelationTuple](#ory.keto.acl.v1alpha1.RelationTuple) | repeated | The relation tuples matching the list request. | +| next_page_token | [string](#string) | | The token required to get the next page. If this is the last page, the token will be the empty string. | + +## ory/keto/acl/v1alpha1/version.proto + +### VersionService + +The service returning the specific Ory Keto instance version. + +This service is part of the [read-APIs](../concepts/api-overview.mdx#read-apis) +and [write-APIs](../concepts/api-overview.mdx#write-apis). + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------- | +| GetVersion | [GetVersionRequest](#ory.keto.acl.v1alpha1.GetVersionRequest) | [GetVersionResponse](#ory.keto.acl.v1alpha1.GetVersionResponse) | Returns the version of the Ory Keto instance. | + +### GetVersionRequest + +Request for the VersionService.GetVersion RPC. + +### GetVersionResponse + +Response of the VersionService.GetVersion RPC. + +| Field | Type | Label | Description | +| ------- | ----------------- | ----- | -------------------------------------------- | +| version | [string](#string) | | The version string of the Ory Keto instance. | + +## ory/keto/acl/v1alpha1/write_service.proto + +### WriteService + +The write service to create and delete Access Control Lists. + +This service is part of the +[write-APIs](../concepts/api-overview.mdx#write-apis). + +| Method Name | Request Type | Response Type | Description | +| ---------------------- | ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------- | +| TransactRelationTuples | [TransactRelationTuplesRequest](#ory.keto.acl.v1alpha1.TransactRelationTuplesRequest) | [TransactRelationTuplesResponse](#ory.keto.acl.v1alpha1.TransactRelationTuplesResponse) | Writes one or more relation tuples in a single transaction. | +| DeleteRelationTuples | [DeleteRelationTuplesRequest](#ory.keto.acl.v1alpha1.DeleteRelationTuplesRequest) | [DeleteRelationTuplesResponse](#ory.keto.acl.v1alpha1.DeleteRelationTuplesResponse) | Deletes relation tuples based on relation query | + +### DeleteRelationTuplesRequest + +| Field | Type | Label | Description | +| ----- | --------------------------------------------------------------------------------------------- | ----- | ----------- | +| query | [DeleteRelationTuplesRequest.Query](#ory.keto.acl.v1alpha1.DeleteRelationTuplesRequest.Query) | | | + +### DeleteRelationTuplesRequest.Query + +The query for deleting relation tuples + +| Field | Type | Label | Description | +| --------- | ----------------------------------------- | ----- | ------------------------------------ | +| namespace | [string](#string) | | Optional. The namespace to query. | +| object | [string](#string) | | Optional. The object to query for. | +| relation | [string](#string) | | Optional. The relation to query for. | +| subject | [Subject](#ory.keto.acl.v1alpha1.Subject) | | Optional. The subject to query for. | + +### DeleteRelationTuplesResponse + +### RelationTupleDelta + +Write-delta for a TransactRelationTuplesRequest. + +| Field | Type | Label | Description | +| -------------- | ----------------------------------------------------------------------------- | ----- | -------------------------------------- | +| action | [RelationTupleDelta.Action](#ory.keto.acl.v1alpha1.RelationTupleDelta.Action) | | The action to do on the RelationTuple. | +| relation_tuple | [RelationTuple](#ory.keto.acl.v1alpha1.RelationTuple) | | The target RelationTuple. | + +### TransactRelationTuplesRequest + +The request of a WriteService.TransactRelationTuples RPC. + +| Field | Type | Label | Description | +| --------------------- | --------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ | +| relation_tuple_deltas | [RelationTupleDelta](#ory.keto.acl.v1alpha1.RelationTupleDelta) | repeated | The write delta for the relation tuples operated in one single transaction. Either all actions succeed or no change takes effect on error. | + +### TransactRelationTuplesResponse + +The response of a WriteService.TransactRelationTuples rpc. + +| Field | Type | Label | Description | +| ---------- | ----------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| snaptokens | [string](#string) | repeated | This field is not implemented yet and has no effect. | + +### RelationTupleDelta.Action + +| Name | Number | Description | +| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------- | +| ACTION_UNSPECIFIED | 0 | Unspecified. The `TransactRelationTuples` RPC ignores this RelationTupleDelta if an action was unspecified. | +| INSERT | 1 | Insertion of a new RelationTuple. It is ignored if already existing. | +| DELETE | 2 | Deletion of the RelationTuple. It is ignored if it does not exist. | + +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | +| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ---------- | ----------- | ------- | ---------- | -------------- | ------------------------------ | +| double | | double | double | float | float64 | double | float | Float | +| float | | float | float | float | float32 | float | float | Float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | +| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | diff --git a/internal/check/handler.go b/internal/check/handler.go index 3ba2fd64c..928d7e890 100644 --- a/internal/check/handler.go +++ b/internal/check/handler.go @@ -6,11 +6,12 @@ package check import ( "context" "encoding/json" - "errors" "io" "net/http" "net/url" + "github.com/pkg/errors" + "github.com/ory/herodot" "github.com/ory/keto/ketoapi" @@ -38,7 +39,7 @@ type ( var ( _ rts.CheckServiceServer = (*Handler)(nil) - _ *getCheckRequest = nil + _ *checkPermission = nil ) func NewHandler(d handlerDependencies) *Handler { @@ -61,29 +62,31 @@ func (h *Handler) RegisterReadGRPC(s *grpc.Server) { rts.RegisterCheckServiceServer(s, h) } -// RESTResponse represents the response for a check request. +// Check Permission Result // // The content of the allowed field is mirrored in the HTTP status code. // -// swagger:model getCheckResponse -type RESTResponse struct { +// swagger:model checkPermissionResult +type CheckPermissionResult struct { // whether the relation tuple is allowed // // required: true Allowed bool `json:"allowed"` } -// swagger:parameters getCheck postCheck -type getCheckRequest struct { - // in:query +// Check Permission Request Parameters +// +// swagger:parameters checkPermission +type checkPermission struct { + // in: query MaxDepth int `json:"max-depth"` } -// swagger:route GET /relation-tuples/check/openapi read getCheck +// swagger:route GET /relation-tuples/check/openapi permission checkPermission // -// # Check a relation tuple +// # Check a permission // -// To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). +// To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). // // Consumes: // - application/x-www-form-urlencoded @@ -94,23 +97,31 @@ type getCheckRequest struct { // Schemes: http, https // // Responses: -// 200: getCheckResponse -// 400: genericError -// 500: genericError +// 200: checkPermissionResult +// 400: errorGeneric +// default: errorGeneric func (h *Handler) getCheckNoStatus(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { allowed, err := h.getCheck(r.Context(), r.URL.Query()) if err != nil { h.d.Writer().WriteError(w, r, err) return } - h.d.Writer().Write(w, r, &RESTResponse{Allowed: allowed}) + h.d.Writer().Write(w, r, &CheckPermissionResult{Allowed: allowed}) +} + +// Check Permission Or Error Request Parameters +// +// swagger:parameters checkPermissionOrError +type checkPermissionOrError struct { + // in: query + MaxDepth int `json:"max-depth"` } -// swagger:route GET /relation-tuples/check read getCheckMirrorStatus +// swagger:route GET /relation-tuples/check permission checkPermissionOrError // -// # Check a relation tuple +// # Check a permission // -// To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). +// To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). // // Consumes: // - application/x-www-form-urlencoded @@ -121,10 +132,10 @@ func (h *Handler) getCheckNoStatus(w http.ResponseWriter, r *http.Request, _ htt // Schemes: http, https // // Responses: -// 200: getCheckResponse -// 400: genericError -// 403: getCheckResponse -// 500: genericError +// 200: checkPermissionResult +// 400: errorGeneric +// 403: checkPermissionResult +// default: errorGeneric func (h *Handler) getCheckMirrorStatus(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { allowed, err := h.getCheck(r.Context(), r.URL.Query()) if err != nil { @@ -133,11 +144,11 @@ func (h *Handler) getCheckMirrorStatus(w http.ResponseWriter, r *http.Request, _ } if allowed { - h.d.Writer().Write(w, r, &RESTResponse{Allowed: allowed}) + h.d.Writer().Write(w, r, &CheckPermissionResult{Allowed: allowed}) return } - h.d.Writer().WriteCode(w, r, http.StatusForbidden, &RESTResponse{Allowed: allowed}) + h.d.Writer().WriteCode(w, r, http.StatusForbidden, &CheckPermissionResult{Allowed: allowed}) } func (h *Handler) getCheck(ctx context.Context, q url.Values) (bool, error) { @@ -162,11 +173,29 @@ func (h *Handler) getCheck(ctx context.Context, q url.Values) (bool, error) { return h.d.PermissionEngine().CheckIsMember(ctx, it[0], maxDepth) } -// swagger:route POST /relation-tuples/check/openapi read postCheck +// Check Permission using Post Request Parameters +// +// swagger:parameters postCheckPermission +type postCheckPermission struct { + // in: query + MaxDepth int `json:"max-depth"` + + // in: body + Payload postCheckPermissionBody +} + +// Check Permission using Post Request Body // -// # Check a relation tuple +// swagger:model postCheckPermissionBody +type postCheckPermissionBody struct { + ketoapi.RelationQuery +} + +// swagger:route POST /relation-tuples/check/openapi permission postCheckPermission +// +// # Check a permission // -// To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). +// To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). // // Consumes: // - application/json @@ -177,23 +206,41 @@ func (h *Handler) getCheck(ctx context.Context, q url.Values) (bool, error) { // Schemes: http, https // // Responses: -// 200: getCheckResponse -// 400: genericError -// 500: genericError +// 200: checkPermissionResult +// 400: errorGeneric +// default: errorGeneric func (h *Handler) postCheckNoStatus(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { allowed, err := h.postCheck(r.Context(), r.Body, r.URL.Query()) if err != nil { h.d.Writer().WriteError(w, r, err) return } - h.d.Writer().Write(w, r, &RESTResponse{Allowed: allowed}) + h.d.Writer().Write(w, r, &CheckPermissionResult{Allowed: allowed}) +} + +// Post Check Permission Or Error Request Parameters +// +// swagger:parameters postCheckPermissionOrError +type postCheckPermissionOrError struct { + // in: query + MaxDepth int `json:"max-depth"` + + // in: body + Body postCheckPermissionOrErrorBody +} + +// Post Check Permission Or Error Body +// +// swagger:model postCheckPermissionOrErrorBody +type postCheckPermissionOrErrorBody struct { + ketoapi.RelationQuery } -// swagger:route POST /relation-tuples/check read postCheckMirrorStatus +// swagger:route POST /relation-tuples/check permission postCheckPermissionOrError // -// # Check a relation tuple +// # Check a permission // -// To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). +// To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). // // Consumes: // - application/json @@ -204,10 +251,10 @@ func (h *Handler) postCheckNoStatus(w http.ResponseWriter, r *http.Request, _ ht // Schemes: http, https // // Responses: -// 200: getCheckResponse -// 400: genericError -// 403: getCheckResponse -// 500: genericError +// 200: checkPermissionResult +// 400: errorGeneric +// 403: checkPermissionResult +// default: errorGeneric func (h *Handler) postCheckMirrorStatus(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { allowed, err := h.postCheck(r.Context(), r.Body, r.URL.Query()) if err != nil { @@ -216,11 +263,11 @@ func (h *Handler) postCheckMirrorStatus(w http.ResponseWriter, r *http.Request, } if allowed { - h.d.Writer().Write(w, r, &RESTResponse{Allowed: allowed}) + h.d.Writer().Write(w, r, &CheckPermissionResult{Allowed: allowed}) return } - h.d.Writer().WriteCode(w, r, http.StatusForbidden, &RESTResponse{Allowed: allowed}) + h.d.Writer().WriteCode(w, r, http.StatusForbidden, &CheckPermissionResult{Allowed: allowed}) } func (h *Handler) postCheck(ctx context.Context, body io.Reader, query url.Values) (bool, error) { @@ -231,7 +278,7 @@ func (h *Handler) postCheck(ctx context.Context, body io.Reader, query url.Value var tuple ketoapi.RelationTuple if err := json.NewDecoder(body).Decode(&tuple); err != nil { - return false, herodot.ErrBadRequest.WithErrorf("could not unmarshal json: %s", err.Error()) + return false, errors.WithStack(herodot.ErrBadRequest.WithErrorf("could not unmarshal json: %s", err.Error())) } t, err := h.d.Mapper().FromTuple(ctx, &tuple) // herodot.ErrNotFound occurs when the namespace is unknown diff --git a/internal/e2e/cli_client_test.go b/internal/e2e/cli_client_test.go index f4646a223..6889b999e 100644 --- a/internal/e2e/cli_client_test.go +++ b/internal/e2e/cli_client_test.go @@ -112,7 +112,7 @@ func (g *cliClient) check(t require.TestingT, r *ketoapi.RelationTuple) bool { sub = r.SubjectSet.String() } out := g.c.ExecNoErr(t, "check", sub, r.Relation, r.Namespace, r.Object) - var res check.RESTResponse + var res check.CheckPermissionResult require.NoError(t, json.Unmarshal([]byte(out), &res)) return res.Allowed } diff --git a/internal/e2e/rest_client_test.go b/internal/e2e/rest_client_test.go index 49b2ebea1..be49603dd 100644 --- a/internal/e2e/rest_client_test.go +++ b/internal/e2e/rest_client_test.go @@ -132,14 +132,14 @@ func (rc *restClient) check(t require.TestingT, r *ketoapi.RelationTuple) bool { q := r.ToURLQuery() bodyGet, codeGet := rc.makeRequest(t, http.MethodGet, fmt.Sprintf("%s?%s", check.RouteBase, q.Encode()), "", rc.readURL) - var respGet check.RESTResponse + var respGet check.CheckPermissionResult require.NoError(t, json.Unmarshal([]byte(bodyGet), &respGet)) j, err := json.Marshal(r) require.NoError(t, err) bodyPost, codePost := rc.makeRequest(t, http.MethodPost, check.RouteBase, string(j), rc.readURL) - var respPost check.RESTResponse + var respPost check.CheckPermissionResult require.NoError(t, json.Unmarshal([]byte(bodyPost), &respPost)) if codeGet == http.StatusOK && codePost == http.StatusOK { diff --git a/internal/e2e/sdk_client_test.go b/internal/e2e/sdk_client_test.go index 7f18a64bb..44e5e9acf 100644 --- a/internal/e2e/sdk_client_test.go +++ b/internal/e2e/sdk_client_test.go @@ -37,7 +37,7 @@ func (c *sdkClient) requestCtx() context.Context { func (c *sdkClient) oplCheckSyntax(t require.TestingT, content []byte) (parseErrors []*ketoapi.ParseError) { res, _, err := c.getOPLSyntaxClient(). - SyntaxApi. + RelationshipApi. CheckOplSyntax(c.requestCtx()). Body(string(content)). Execute() @@ -82,7 +82,7 @@ func (c *sdkClient) getOPLSyntaxClient() *httpclient.APIClient { } func (c *sdkClient) createTuple(t require.TestingT, r *ketoapi.RelationTuple) { - payload := httpclient.RelationQuery{ + payload := httpclient.CreateRelationshipBody{ Namespace: pointerx.Ptr(r.Namespace), Object: pointerx.Ptr(r.Object), Relation: pointerx.Ptr(r.Relation), @@ -96,9 +96,9 @@ func (c *sdkClient) createTuple(t require.TestingT, r *ketoapi.RelationTuple) { } } - _, _, err := c.getWriteClient().WriteApi. - CreateRelationTuple(c.requestCtx()). - RelationQuery(payload). + _, _, err := c.getWriteClient().RelationshipApi. + CreateRelationship(c.requestCtx()). + CreateRelationshipBody(payload). Execute() require.NoError(t, err) } @@ -122,8 +122,8 @@ func withSubject[P interface { } func (c *sdkClient) deleteTuple(t require.TestingT, r *ketoapi.RelationTuple) { - request := c.getWriteClient().WriteApi. - DeleteRelationTuples(c.requestCtx()). + request := c.getWriteClient().RelationshipApi. + DeleteRelationships(c.requestCtx()). Namespace(r.Namespace). Object(r.Object). Relation(r.Relation) @@ -134,7 +134,7 @@ func (c *sdkClient) deleteTuple(t require.TestingT, r *ketoapi.RelationTuple) { } func (c *sdkClient) deleteAllTuples(t require.TestingT, q *ketoapi.RelationQuery) { - request := c.getWriteClient().WriteApi.DeleteRelationTuples(c.requestCtx()) + request := c.getWriteClient().RelationshipApi.DeleteRelationships(c.requestCtx()) if q.Namespace != nil { request = request.Namespace(*q.Namespace) } @@ -149,7 +149,7 @@ func (c *sdkClient) deleteAllTuples(t require.TestingT, q *ketoapi.RelationQuery require.NoError(t, err) } -func compileParams(req httpclient.ReadApiApiGetRelationTuplesRequest, q *ketoapi.RelationQuery, opts []x.PaginationOptionSetter) httpclient.ReadApiApiGetRelationTuplesRequest { +func compileParams(req httpclient.RelationshipApiApiGetRelationshipsRequest, q *ketoapi.RelationQuery, opts []x.PaginationOptionSetter) httpclient.RelationshipApiApiGetRelationshipsRequest { if q.Namespace != nil { req = req.Namespace(*q.Namespace) } @@ -181,7 +181,7 @@ func compileParams(req httpclient.ReadApiApiGetRelationTuplesRequest, q *ketoapi } func (c *sdkClient) queryTuple(t require.TestingT, q *ketoapi.RelationQuery, opts ...x.PaginationOptionSetter) *ketoapi.GetResponse { - request := c.getReadClient().ReadApi.GetRelationTuples(c.requestCtx()) + request := c.getReadClient().RelationshipApi.GetRelationships(c.requestCtx()) request = compileParams(request, q, opts) resp, _, err := request.Execute() @@ -213,7 +213,7 @@ func (c *sdkClient) queryTuple(t require.TestingT, q *ketoapi.RelationQuery, opt } func (c *sdkClient) queryTupleErr(t require.TestingT, expected herodot.DefaultError, q *ketoapi.RelationQuery, opts ...x.PaginationOptionSetter) { - request := c.getReadClient().ReadApi.GetRelationTuples(c.requestCtx()) + request := c.getReadClient().RelationshipApi.GetRelationships(c.requestCtx()) request = compileParams(request, q, opts) _, _, err := request.Execute() @@ -228,7 +228,7 @@ func (c *sdkClient) queryTupleErr(t require.TestingT, expected herodot.DefaultEr } func (c *sdkClient) check(t require.TestingT, r *ketoapi.RelationTuple) bool { - request := c.getReadClient().ReadApi.GetCheck(c.requestCtx()). + request := c.getReadClient().PermissionApi.CheckPermission(c.requestCtx()). Namespace(r.Namespace). Object(r.Object). Relation(r.Relation) @@ -240,7 +240,7 @@ func (c *sdkClient) check(t require.TestingT, r *ketoapi.RelationTuple) bool { return resp.GetAllowed() } -func buildTree(t require.TestingT, mt *httpclient.ExpandTree) *ketoapi.Tree[*ketoapi.RelationTuple] { +func buildTree(t require.TestingT, mt *httpclient.ExpandedPermissionTree) *ketoapi.Tree[*ketoapi.RelationTuple] { result := &ketoapi.Tree[*ketoapi.RelationTuple]{ Type: ketoapi.TreeNodeType(mt.Type), } @@ -269,7 +269,7 @@ func buildTree(t require.TestingT, mt *httpclient.ExpandTree) *ketoapi.Tree[*ket } func (c *sdkClient) expand(t require.TestingT, r *ketoapi.SubjectSet, depth int) *ketoapi.Tree[*ketoapi.RelationTuple] { - request := c.getReadClient().ReadApi.GetExpand(c.requestCtx()). + request := c.getReadClient().PermissionApi.ExpandPermissions(c.requestCtx()). Namespace(r.Namespace). Object(r.Object). Relation(r.Relation). @@ -290,7 +290,7 @@ func (c *sdkClient) waitUntilLive(t require.TestingT) { } func (c *sdkClient) queryNamespaces(t require.TestingT) (response ketoapi.GetNamespacesResponse) { - res, _, err := c.getReadClient().NamespacesApi.GetNamespaces(c.requestCtx()).Execute() + res, _, err := c.getReadClient().RelationshipApi.ListRelationshipNamespaces(c.requestCtx()).Execute() require.NoError(t, err) require.NoError(t, convert(res, &response)) diff --git a/internal/expand/handler.go b/internal/expand/handler.go index d03b125be..6dfdcdc1c 100644 --- a/internal/expand/handler.go +++ b/internal/expand/handler.go @@ -33,7 +33,7 @@ type ( var ( _ rts.ExpandServiceServer = (*handler)(nil) - _ *getExpandRequest = nil + _ *expandPermissions = nil ) const RouteBase = "/relation-tuples/expand" @@ -50,19 +50,21 @@ func (h *handler) RegisterReadGRPC(s *grpc.Server) { rts.RegisterExpandServiceServer(s, h) } -// swagger:parameters getExpand -type getExpandRequest struct { +// Expand Permissions Request Parameters +// +// swagger:parameters expandPermissions +type expandPermissions struct { // in:query MaxDepth int `json:"max-depth"` // in:query ketoapi.SubjectSet } -// swagger:route GET /relation-tuples/expand read getExpand +// swagger:route GET /relation-tuples/expand permission expandPermissions // -// # Expand a Relation Tuple +// # Expand a Relationship into permissions. // -// Use this endpoint to expand a relation tuple. +// Use this endpoint to expand a relationship tuple into permissions. // // Consumes: // - application/x-www-form-urlencoded @@ -73,10 +75,10 @@ type getExpandRequest struct { // Schemes: http, https // // Responses: -// 200: expandTree -// 400: genericError -// 404: genericError -// 500: genericError +// 200: expandedPermissionTree +// 400: errorGeneric +// 404: errorGeneric +// default: errorGeneric func (h *handler) getExpand(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { maxDepth, err := x.GetMaxDepthFromQuery(r.URL.Query()) if err != nil { diff --git a/internal/httpclient/.openapi-generator/FILES b/internal/httpclient/.openapi-generator/FILES index 3a4442ac5..498f627cb 100644 --- a/internal/httpclient/.openapi-generator/FILES +++ b/internal/httpclient/.openapi-generator/FILES @@ -4,17 +4,16 @@ README.md api/openapi.yaml api_metadata.go -api_namespaces.go -api_read.go -api_syntax.go -api_write.go +api_permission.go +api_relationship.go client.go configuration.go -docs/ExpandTree.md +docs/CheckOplSyntaxResult.md +docs/CheckPermissionResult.md +docs/CreateRelationshipBody.md +docs/ErrorGeneric.md +docs/ExpandedPermissionTree.md docs/GenericError.md -docs/GetCheckResponse.md -docs/GetNamespacesResponse.md -docs/GetRelationTuplesResponse.md docs/HealthNotReadyStatus.md docs/HealthStatus.md docs/InlineResponse200.md @@ -22,26 +21,28 @@ docs/InlineResponse2001.md docs/InlineResponse503.md docs/MetadataApi.md docs/Namespace.md -docs/NamespacesApi.md docs/ParseError.md -docs/PatchDelta.md -docs/PostCheckOplSyntaxResponse.md -docs/ReadApi.md +docs/PermissionApi.md +docs/PostCheckPermissionBody.md +docs/PostCheckPermissionOrErrorBody.md docs/RelationQuery.md -docs/RelationTuple.md +docs/Relationship.md +docs/RelationshipApi.md +docs/RelationshipNamespaces.md +docs/RelationshipPatch.md +docs/Relationships.md docs/SourcePosition.md docs/SubjectSet.md -docs/SyntaxApi.md docs/Version.md -docs/WriteApi.md git_push.sh go.mod go.sum -model_expand_tree.go +model_check_opl_syntax_result.go +model_check_permission_result.go +model_create_relationship_body.go +model_error_generic.go +model_expanded_permission_tree.go model_generic_error.go -model_get_check_response.go -model_get_namespaces_response.go -model_get_relation_tuples_response.go model_health_not_ready_status.go model_health_status.go model_inline_response_200.go @@ -49,10 +50,13 @@ model_inline_response_200_1.go model_inline_response_503.go model_namespace.go model_parse_error.go -model_patch_delta.go -model_post_check_opl_syntax_response.go +model_post_check_permission_body.go +model_post_check_permission_or_error_body.go model_relation_query.go -model_relation_tuple.go +model_relationship.go +model_relationship_namespaces.go +model_relationship_patch.go +model_relationships.go model_source_position.go model_subject_set.go model_version.go diff --git a/internal/httpclient/README.md b/internal/httpclient/README.md index 936b34b02..16bff2500 100644 --- a/internal/httpclient/README.md +++ b/internal/httpclient/README.md @@ -82,26 +82,27 @@ Class | Method | HTTP request | Description *MetadataApi* | [**GetVersion**](docs/MetadataApi.md#getversion) | **Get** /version | Return Running Software Version. *MetadataApi* | [**IsAlive**](docs/MetadataApi.md#isalive) | **Get** /health/alive | Check HTTP Server Status *MetadataApi* | [**IsReady**](docs/MetadataApi.md#isready) | **Get** /health/ready | Check HTTP Server and Database Status -*NamespacesApi* | [**GetNamespaces**](docs/NamespacesApi.md#getnamespaces) | **Get** /namespaces | Query namespaces -*ReadApi* | [**GetCheck**](docs/ReadApi.md#getcheck) | **Get** /relation-tuples/check/openapi | Check a relation tuple -*ReadApi* | [**GetCheckMirrorStatus**](docs/ReadApi.md#getcheckmirrorstatus) | **Get** /relation-tuples/check | Check a relation tuple -*ReadApi* | [**GetExpand**](docs/ReadApi.md#getexpand) | **Get** /relation-tuples/expand | Expand a Relation Tuple -*ReadApi* | [**GetRelationTuples**](docs/ReadApi.md#getrelationtuples) | **Get** /relation-tuples | Query relation tuples -*ReadApi* | [**PostCheck**](docs/ReadApi.md#postcheck) | **Post** /relation-tuples/check/openapi | Check a relation tuple -*ReadApi* | [**PostCheckMirrorStatus**](docs/ReadApi.md#postcheckmirrorstatus) | **Post** /relation-tuples/check | Check a relation tuple -*SyntaxApi* | [**CheckOplSyntax**](docs/SyntaxApi.md#checkoplsyntax) | **Post** /opl/syntax/check | Check the syntax of an OPL file -*WriteApi* | [**CreateRelationTuple**](docs/WriteApi.md#createrelationtuple) | **Put** /admin/relation-tuples | Create a Relation Tuple -*WriteApi* | [**DeleteRelationTuples**](docs/WriteApi.md#deleterelationtuples) | **Delete** /admin/relation-tuples | Delete Relation Tuples -*WriteApi* | [**PatchRelationTuples**](docs/WriteApi.md#patchrelationtuples) | **Patch** /admin/relation-tuples | Patch Multiple Relation Tuples +*PermissionApi* | [**CheckPermission**](docs/PermissionApi.md#checkpermission) | **Get** /relation-tuples/check/openapi | Check a permission +*PermissionApi* | [**CheckPermissionOrError**](docs/PermissionApi.md#checkpermissionorerror) | **Get** /relation-tuples/check | Check a permission +*PermissionApi* | [**ExpandPermissions**](docs/PermissionApi.md#expandpermissions) | **Get** /relation-tuples/expand | Expand a Relationship into permissions. +*PermissionApi* | [**PostCheckPermission**](docs/PermissionApi.md#postcheckpermission) | **Post** /relation-tuples/check/openapi | Check a permission +*PermissionApi* | [**PostCheckPermissionOrError**](docs/PermissionApi.md#postcheckpermissionorerror) | **Post** /relation-tuples/check | Check a permission +*RelationshipApi* | [**CheckOplSyntax**](docs/RelationshipApi.md#checkoplsyntax) | **Post** /opl/syntax/check | Check the syntax of an OPL file +*RelationshipApi* | [**CreateRelationship**](docs/RelationshipApi.md#createrelationship) | **Put** /admin/relation-tuples | Create a Relationship +*RelationshipApi* | [**DeleteRelationships**](docs/RelationshipApi.md#deleterelationships) | **Delete** /admin/relation-tuples | Delete Relationships +*RelationshipApi* | [**GetRelationships**](docs/RelationshipApi.md#getrelationships) | **Get** /relation-tuples | Query relationships +*RelationshipApi* | [**ListRelationshipNamespaces**](docs/RelationshipApi.md#listrelationshipnamespaces) | **Get** /namespaces | Query namespaces +*RelationshipApi* | [**PatchRelationships**](docs/RelationshipApi.md#patchrelationships) | **Patch** /admin/relation-tuples | Patch Multiple Relationships ## Documentation For Models - - [ExpandTree](docs/ExpandTree.md) + - [CheckOplSyntaxResult](docs/CheckOplSyntaxResult.md) + - [CheckPermissionResult](docs/CheckPermissionResult.md) + - [CreateRelationshipBody](docs/CreateRelationshipBody.md) + - [ErrorGeneric](docs/ErrorGeneric.md) + - [ExpandedPermissionTree](docs/ExpandedPermissionTree.md) - [GenericError](docs/GenericError.md) - - [GetCheckResponse](docs/GetCheckResponse.md) - - [GetNamespacesResponse](docs/GetNamespacesResponse.md) - - [GetRelationTuplesResponse](docs/GetRelationTuplesResponse.md) - [HealthNotReadyStatus](docs/HealthNotReadyStatus.md) - [HealthStatus](docs/HealthStatus.md) - [InlineResponse200](docs/InlineResponse200.md) @@ -109,10 +110,13 @@ Class | Method | HTTP request | Description - [InlineResponse503](docs/InlineResponse503.md) - [Namespace](docs/Namespace.md) - [ParseError](docs/ParseError.md) - - [PatchDelta](docs/PatchDelta.md) - - [PostCheckOplSyntaxResponse](docs/PostCheckOplSyntaxResponse.md) + - [PostCheckPermissionBody](docs/PostCheckPermissionBody.md) + - [PostCheckPermissionOrErrorBody](docs/PostCheckPermissionOrErrorBody.md) - [RelationQuery](docs/RelationQuery.md) - - [RelationTuple](docs/RelationTuple.md) + - [Relationship](docs/Relationship.md) + - [RelationshipNamespaces](docs/RelationshipNamespaces.md) + - [RelationshipPatch](docs/RelationshipPatch.md) + - [Relationships](docs/Relationships.md) - [SourcePosition](docs/SourcePosition.md) - [SubjectSet](docs/SubjectSet.md) - [Version](docs/Version.md) diff --git a/internal/httpclient/api/openapi.yaml b/internal/httpclient/api/openapi.yaml index f33c8da06..15838381c 100644 --- a/internal/httpclient/api/openapi.yaml +++ b/internal/httpclient/api/openapi.yaml @@ -12,10 +12,10 @@ servers: paths: /admin/relation-tuples: delete: - description: Use this endpoint to delete relation tuples - operationId: deleteRelationTuples + description: Use this endpoint to delete relationships + operationId: deleteRelationships parameters: - - description: Namespace of the Relation Tuple + - description: Namespace of the Relationship explode: true in: query name: namespace @@ -23,7 +23,7 @@ paths: schema: type: string style: form - - description: Object of the Relation Tuple + - description: Object of the Relationship explode: true in: query name: object @@ -31,7 +31,7 @@ paths: schema: type: string style: form - - description: Relation of the Relation Tuple + - description: Relation of the Relationship explode: true in: query name: relation @@ -39,7 +39,7 @@ paths: schema: type: string style: form - - description: SubjectID of the Relation Tuple + - description: SubjectID of the Relationship explode: true in: query name: subject_id @@ -79,28 +79,28 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - "500": + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + default: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - summary: Delete Relation Tuples + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + summary: Delete Relationships tags: - - write + - relationship patch: - description: Use this endpoint to patch one or more relation tuples. - operationId: patchRelationTuples + description: Use this endpoint to patch one or more relationships. + operationId: patchRelationships requestBody: content: application/json: schema: items: - $ref: '#/components/schemas/patchDelta' + $ref: '#/components/schemas/relationshipPatch' type: array - x-originalParamName: Payload + x-originalParamName: Body responses: "204": description: Empty responses are sent when, for example, resources are deleted. @@ -109,54 +109,54 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric "404": content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - "500": + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + default: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - summary: Patch Multiple Relation Tuples + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + summary: Patch Multiple Relationships tags: - - write + - relationship put: - description: Use this endpoint to create a relation tuple. - operationId: createRelationTuple + description: Use this endpoint to create a relationship. + operationId: createRelationship requestBody: content: application/json: schema: - $ref: '#/components/schemas/relationQuery' - x-originalParamName: Payload + $ref: '#/components/schemas/createRelationshipBody' + x-originalParamName: Body responses: "201": content: application/json: schema: - $ref: '#/components/schemas/relationQuery' - description: relationQuery + $ref: '#/components/schemas/relationship' + description: relationship "400": content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - "500": + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + default: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - summary: Create a Relation Tuple + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + summary: Create a Relationship tags: - - write + - relationship /health/alive: get: description: |- @@ -216,23 +216,23 @@ paths: /namespaces: get: description: Get all namespaces - operationId: getNamespaces + operationId: listRelationshipNamespaces responses: "200": content: application/json: schema: - $ref: '#/components/schemas/getNamespacesResponse' - description: getNamespacesResponse - "500": + $ref: '#/components/schemas/relationshipNamespaces' + description: relationshipNamespaces + default: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric summary: Query namespaces tags: - - namespaces + - relationship /opl/syntax/check: post: description: The OPL file is expected in the body of the request. @@ -241,38 +241,35 @@ paths: content: text/plain: schema: - description: the OPL content to check - type: string - description: the OPL content to check - required: true - x-originalParamName: content + $ref: '#/components/schemas/checkOplSyntaxBody' + x-originalParamName: Body responses: "200": content: application/json: schema: - $ref: '#/components/schemas/postCheckOplSyntaxResponse' - description: postCheckOplSyntaxResponse + $ref: '#/components/schemas/checkOplSyntaxResult' + description: checkOplSyntaxResult "400": content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - "500": + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + default: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric summary: Check the syntax of an OPL file tags: - - syntax + - relationship /relation-tuples: get: - description: Get all relation tuples that match the query. Only the namespace + description: Get all relationships that match the query. Only the namespace field is required. - operationId: getRelationTuples + operationId: getRelationships parameters: - explode: true in: query @@ -289,7 +286,7 @@ paths: format: int64 type: integer style: form - - description: Namespace of the Relation Tuple + - description: Namespace of the Relationship explode: true in: query name: namespace @@ -297,7 +294,7 @@ paths: schema: type: string style: form - - description: Object of the Relation Tuple + - description: Object of the Relationship explode: true in: query name: object @@ -305,7 +302,7 @@ paths: schema: type: string style: form - - description: Relation of the Relation Tuple + - description: Relation of the Relationship explode: true in: query name: relation @@ -313,7 +310,7 @@ paths: schema: type: string style: form - - description: SubjectID of the Relation Tuple + - description: SubjectID of the Relationship explode: true in: query name: subject_id @@ -350,95 +347,175 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/getRelationTuplesResponse' - description: getRelationTuplesResponse + $ref: '#/components/schemas/relationships' + description: relationships "404": content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - "500": + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + default: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - summary: Query relation tuples + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + summary: Query relationships tags: - - read + - relationship /relation-tuples/check: get: - description: To learn how relation tuples and the check works, head over to - [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). - operationId: getCheckMirrorStatus + description: To learn how relationship tuples and the check works, head over + to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). + operationId: checkPermissionOrError + parameters: + - description: Namespace of the Relationship + explode: true + in: query + name: namespace + required: false + schema: + type: string + style: form + - description: Object of the Relationship + explode: true + in: query + name: object + required: false + schema: + type: string + style: form + - description: Relation of the Relationship + explode: true + in: query + name: relation + required: false + schema: + type: string + style: form + - description: SubjectID of the Relationship + explode: true + in: query + name: subject_id + required: false + schema: + type: string + style: form + - description: Namespace of the Subject Set + explode: true + in: query + name: subject_set.namespace + required: false + schema: + type: string + style: form + - description: Object of the Subject Set + explode: true + in: query + name: subject_set.object + required: false + schema: + type: string + style: form + - description: Relation of the Subject Set + explode: true + in: query + name: subject_set.relation + required: false + schema: + type: string + style: form + - explode: true + in: query + name: max-depth + required: false + schema: + format: int64 + type: integer + style: form responses: "200": content: application/json: schema: - $ref: '#/components/schemas/getCheckResponse' - description: getCheckResponse + $ref: '#/components/schemas/checkPermissionResult' + description: checkPermissionResult "400": content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric "403": content: application/json: schema: - $ref: '#/components/schemas/getCheckResponse' - description: getCheckResponse - "500": + $ref: '#/components/schemas/checkPermissionResult' + description: checkPermissionResult + default: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - summary: Check a relation tuple + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + summary: Check a permission tags: - - read + - permission post: - description: To learn how relation tuples and the check works, head over to - [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). - operationId: postCheckMirrorStatus + description: To learn how relationship tuples and the check works, head over + to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). + operationId: postCheckPermissionOrError + parameters: + - explode: true + in: query + name: max-depth + required: false + schema: + format: int64 + type: integer + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/postCheckPermissionOrErrorBody' + x-originalParamName: Body responses: "200": content: application/json: schema: - $ref: '#/components/schemas/getCheckResponse' - description: getCheckResponse + $ref: '#/components/schemas/checkPermissionResult' + description: checkPermissionResult "400": content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric "403": content: application/json: schema: - $ref: '#/components/schemas/getCheckResponse' - description: getCheckResponse - "500": + $ref: '#/components/schemas/checkPermissionResult' + description: checkPermissionResult + default: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - summary: Check a relation tuple + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + summary: Check a permission tags: - - read + - permission /relation-tuples/check/openapi: get: - description: To learn how relation tuples and the check works, head over to - [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). - operationId: getCheck + description: To learn how relationship tuples and the check works, head over + to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). + operationId: checkPermission parameters: - - description: Namespace of the Relation Tuple + - description: Namespace of the Relationship explode: true in: query name: namespace @@ -446,7 +523,7 @@ paths: schema: type: string style: form - - description: Object of the Relation Tuple + - description: Object of the Relationship explode: true in: query name: object @@ -454,7 +531,7 @@ paths: schema: type: string style: form - - description: Relation of the Relation Tuple + - description: Relation of the Relationship explode: true in: query name: relation @@ -462,7 +539,7 @@ paths: schema: type: string style: form - - description: SubjectID of the Relation Tuple + - description: SubjectID of the Relationship explode: true in: query name: subject_id @@ -507,27 +584,27 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/getCheckResponse' - description: getCheckResponse + $ref: '#/components/schemas/checkPermissionResult' + description: checkPermissionResult "400": content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - "500": + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + default: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - summary: Check a relation tuple + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + summary: Check a permission tags: - - read + - permission post: - description: To learn how relation tuples and the check works, head over to - [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). - operationId: postCheck + description: To learn how relationship tuples and the check works, head over + to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). + operationId: postCheckPermission parameters: - explode: true in: query @@ -541,34 +618,34 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/relationQuery' + $ref: '#/components/schemas/postCheckPermissionBody' x-originalParamName: Payload responses: "200": content: application/json: schema: - $ref: '#/components/schemas/getCheckResponse' - description: getCheckResponse + $ref: '#/components/schemas/checkPermissionResult' + description: checkPermissionResult "400": content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - "500": + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + default: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - summary: Check a relation tuple + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + summary: Check a permission tags: - - read + - permission /relation-tuples/expand: get: - description: Use this endpoint to expand a relation tuple. - operationId: getExpand + description: Use this endpoint to expand a relationship tuple into permissions. + operationId: expandPermissions parameters: - description: Namespace of the Subject Set explode: true @@ -607,29 +684,29 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/expandTree' - description: expandTree + $ref: '#/components/schemas/expandedPermissionTree' + description: expandedPermissionTree "400": content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric "404": content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - "500": + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + default: content: application/json: schema: - $ref: '#/components/schemas/genericError' - description: genericError - summary: Expand a Relation Tuple + $ref: '#/components/schemas/errorGeneric' + description: errorGeneric + summary: Expand a Relationship into permissions. tags: - - read + - permission /version: get: description: |- @@ -689,7 +766,79 @@ components: UUID: format: uuid4 type: string - expandTree: + checkOplSyntaxBody: + description: Ory Permission Language Document + type: string + checkOplSyntaxResult: + example: + errors: + - start: + Line: 0 + column: 6 + end: + Line: 0 + column: 6 + message: message + - start: + Line: 0 + column: 6 + end: + Line: 0 + column: 6 + message: message + properties: + errors: + description: The list of syntax errors + items: + $ref: '#/components/schemas/ParseError' + type: array + title: CheckOPLSyntaxResponse represents the response for an OPL syntax check + request. + type: object + checkPermissionResult: + description: The content of the allowed field is mirrored in the HTTP status + code. + example: + allowed: true + properties: + allowed: + description: whether the relation tuple is allowed + type: boolean + required: + - allowed + title: Check Permission Result + type: object + createRelationshipBody: + description: Create Relationship Request Body + properties: + namespace: + description: Namespace to query + type: string + object: + description: Object to query + type: string + relation: + description: Relation to query + type: string + subject_id: + description: |- + SubjectID to query + + Either SubjectSet or SubjectID can be provided. + type: string + subject_set: + $ref: '#/components/schemas/subjectSet' + type: object + errorGeneric: + description: The standard Ory JSON API error format. + properties: + error: + $ref: '#/components/schemas/genericError' + required: + - error + title: JSON API Error Response + type: object + expandedPermissionTree: example: tuple: subject_id: subject_id @@ -708,10 +857,10 @@ components: children: description: The children of the node, possibly none. items: - $ref: '#/components/schemas/expandTree' + $ref: '#/components/schemas/expandedPermissionTree' type: array tuple: - $ref: '#/components/schemas/relationTuple' + $ref: '#/components/schemas/relationship' type: description: |- The type of the node. @@ -746,80 +895,55 @@ components: - type type: object genericError: - description: The standard error format properties: code: + description: The status code + example: 404 format: int64 type: integer + debug: + description: |- + Debug information + + This field is often not exposed to protect against leaking + sensitive information. + example: SQL field "foo" is not a bool. + type: string details: - items: - additionalProperties: {} - type: object - type: array + additionalProperties: {} + description: Further error details + type: object + id: + description: |- + The error ID + + Useful when trying to identify various errors in application logic. + type: string message: + description: |- + Error message + + The error's message. + example: The resource could not be found type: string reason: + description: A human-readable reason for the error + example: User with ID 1234 does not exist. type: string request: + description: |- + The request ID + + The request ID is often exposed internally in order to trace + errors across service architectures. This is often a UUID. + example: d7ef54b1-ec15-46e6-bccb-524b82c035e6 type: string status: + description: The status description + example: Not Found type: string - type: object - getCheckResponse: - description: The content of the allowed field is mirrored in the HTTP status - code. - example: - allowed: true - properties: - allowed: - description: whether the relation tuple is allowed - type: boolean required: - - allowed - title: RESTResponse represents the response for a check request. - type: object - getNamespacesResponse: - example: - namespaces: - - name: name - - name: name - properties: - namespaces: - items: - $ref: '#/components/schemas/namespace' - type: array - type: object - getRelationTuplesResponse: - example: - next_page_token: next_page_token - relation_tuples: - - subject_id: subject_id - namespace: namespace - object: object - relation: relation - subject_set: - namespace: namespace - object: object - relation: relation - - subject_id: subject_id - namespace: namespace - object: object - relation: relation - subject_set: - namespace: namespace - object: object - relation: relation - properties: - next_page_token: - description: |- - The opaque token to provide in a subsequent request - to get the next page. It is the empty string iff this is - the last page. - type: string - relation_tuples: - items: - $ref: '#/components/schemas/relationTuple' - type: array + - message type: object healthNotReadyStatus: properties: @@ -844,55 +968,50 @@ components: description: Name of the namespace. type: string type: object - patchDelta: + postCheckPermissionBody: + description: Check Permission using Post Request Body properties: - action: - enum: - - insert - - delete + namespace: + description: Namespace to query type: string - x-go-enum-desc: |- - insert ActionInsert - delete ActionDelete - relation_tuple: - $ref: '#/components/schemas/relationTuple' + object: + description: Object to query + type: string + relation: + description: Relation to query + type: string + subject_id: + description: |- + SubjectID to query + + Either SubjectSet or SubjectID can be provided. + type: string + subject_set: + $ref: '#/components/schemas/subjectSet' type: object - postCheckOplSyntaxResponse: - example: - errors: - - start: - Line: 0 - column: 6 - end: - Line: 0 - column: 6 - message: message - - start: - Line: 0 - column: 6 - end: - Line: 0 - column: 6 - message: message + postCheckPermissionOrErrorBody: + description: Post Check Permission Or Error Body properties: - errors: - description: The list of syntax errors - items: - $ref: '#/components/schemas/ParseError' - type: array - title: CheckOPLSyntaxResponse represents the response for an OPL syntax check - request. + namespace: + description: Namespace to query + type: string + object: + description: Object to query + type: string + relation: + description: Relation to query + type: string + subject_id: + description: |- + SubjectID to query + + Either SubjectSet or SubjectID can be provided. + type: string + subject_set: + $ref: '#/components/schemas/subjectSet' type: object relationQuery: - example: - subject_id: subject_id - namespace: namespace - object: object - relation: relation - subject_set: - namespace: namespace - object: object - relation: relation + description: Relation Query properties: namespace: description: Namespace to query @@ -912,7 +1031,8 @@ components: subject_set: $ref: '#/components/schemas/subjectSet' type: object - relationTuple: + relationship: + description: Relationship example: subject_id: subject_id namespace: namespace @@ -945,6 +1065,65 @@ components: - object - relation type: object + relationshipNamespaces: + description: Relationship Namespace List + example: + namespaces: + - name: name + - name: name + properties: + namespaces: + items: + $ref: '#/components/schemas/namespace' + type: array + type: object + relationshipPatch: + description: Payload for patching a relationship + properties: + action: + enum: + - insert + - delete + type: string + x-go-enum-desc: |- + insert ActionInsert + delete ActionDelete + relation_tuple: + $ref: '#/components/schemas/relationship' + type: object + relationships: + description: Paginated Relationship List + example: + next_page_token: next_page_token + relation_tuples: + - subject_id: subject_id + namespace: namespace + object: object + relation: relation + subject_set: + namespace: namespace + object: object + relation: relation + - subject_id: subject_id + namespace: namespace + object: object + relation: relation + subject_set: + namespace: namespace + object: object + relation: relation + properties: + next_page_token: + description: |- + The opaque token to provide in a subsequent request + to get the next page. It is the empty string iff this is + the last page. + type: string + relation_tuples: + items: + $ref: '#/components/schemas/relationship' + type: array + type: object subjectSet: example: namespace: namespace diff --git a/internal/httpclient/api_namespaces.go b/internal/httpclient/api_namespaces.go deleted file mode 100644 index 0c5f79cce..000000000 --- a/internal/httpclient/api_namespaces.go +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Ory Keto API - * - * Documentation for all of Ory Keto's REST APIs. gRPC is documented separately. - * - * API version: 1.0.0 - * Contact: hi@ory.sh - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "bytes" - "context" - "io/ioutil" - "net/http" - "net/url" -) - -// Linger please -var ( - _ context.Context -) - -type NamespacesApi interface { - - /* - * GetNamespaces Query namespaces - * Get all namespaces - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return NamespacesApiApiGetNamespacesRequest - */ - GetNamespaces(ctx context.Context) NamespacesApiApiGetNamespacesRequest - - /* - * GetNamespacesExecute executes the request - * @return GetNamespacesResponse - */ - GetNamespacesExecute(r NamespacesApiApiGetNamespacesRequest) (*GetNamespacesResponse, *http.Response, error) -} - -// NamespacesApiService NamespacesApi service -type NamespacesApiService service - -type NamespacesApiApiGetNamespacesRequest struct { - ctx context.Context - ApiService NamespacesApi -} - -func (r NamespacesApiApiGetNamespacesRequest) Execute() (*GetNamespacesResponse, *http.Response, error) { - return r.ApiService.GetNamespacesExecute(r) -} - -/* - * GetNamespaces Query namespaces - * Get all namespaces - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return NamespacesApiApiGetNamespacesRequest - */ -func (a *NamespacesApiService) GetNamespaces(ctx context.Context) NamespacesApiApiGetNamespacesRequest { - return NamespacesApiApiGetNamespacesRequest{ - ApiService: a, - ctx: ctx, - } -} - -/* - * Execute executes the request - * @return GetNamespacesResponse - */ -func (a *NamespacesApiService) GetNamespacesExecute(r NamespacesApiApiGetNamespacesRequest) (*GetNamespacesResponse, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *GetNamespacesResponse - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NamespacesApiService.GetNamespaces") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/namespaces" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 500 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} diff --git a/internal/httpclient/api_read.go b/internal/httpclient/api_permission.go similarity index 57% rename from internal/httpclient/api_read.go rename to internal/httpclient/api_permission.go index e6e2c5198..af71574a4 100644 --- a/internal/httpclient/api_read.go +++ b/internal/httpclient/api_permission.go @@ -24,99 +24,85 @@ var ( _ context.Context ) -type ReadApi interface { +type PermissionApi interface { /* - * GetCheck Check a relation tuple - * To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). + * CheckPermission Check a permission + * To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiGetCheckRequest + * @return PermissionApiApiCheckPermissionRequest */ - GetCheck(ctx context.Context) ReadApiApiGetCheckRequest + CheckPermission(ctx context.Context) PermissionApiApiCheckPermissionRequest /* - * GetCheckExecute executes the request - * @return GetCheckResponse + * CheckPermissionExecute executes the request + * @return CheckPermissionResult */ - GetCheckExecute(r ReadApiApiGetCheckRequest) (*GetCheckResponse, *http.Response, error) + CheckPermissionExecute(r PermissionApiApiCheckPermissionRequest) (*CheckPermissionResult, *http.Response, error) /* - * GetCheckMirrorStatus Check a relation tuple - * To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). + * CheckPermissionOrError Check a permission + * To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiGetCheckMirrorStatusRequest + * @return PermissionApiApiCheckPermissionOrErrorRequest */ - GetCheckMirrorStatus(ctx context.Context) ReadApiApiGetCheckMirrorStatusRequest + CheckPermissionOrError(ctx context.Context) PermissionApiApiCheckPermissionOrErrorRequest /* - * GetCheckMirrorStatusExecute executes the request - * @return GetCheckResponse + * CheckPermissionOrErrorExecute executes the request + * @return CheckPermissionResult */ - GetCheckMirrorStatusExecute(r ReadApiApiGetCheckMirrorStatusRequest) (*GetCheckResponse, *http.Response, error) + CheckPermissionOrErrorExecute(r PermissionApiApiCheckPermissionOrErrorRequest) (*CheckPermissionResult, *http.Response, error) /* - * GetExpand Expand a Relation Tuple - * Use this endpoint to expand a relation tuple. + * ExpandPermissions Expand a Relationship into permissions. + * Use this endpoint to expand a relationship tuple into permissions. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiGetExpandRequest + * @return PermissionApiApiExpandPermissionsRequest */ - GetExpand(ctx context.Context) ReadApiApiGetExpandRequest + ExpandPermissions(ctx context.Context) PermissionApiApiExpandPermissionsRequest /* - * GetExpandExecute executes the request - * @return ExpandTree + * ExpandPermissionsExecute executes the request + * @return ExpandedPermissionTree */ - GetExpandExecute(r ReadApiApiGetExpandRequest) (*ExpandTree, *http.Response, error) + ExpandPermissionsExecute(r PermissionApiApiExpandPermissionsRequest) (*ExpandedPermissionTree, *http.Response, error) /* - * GetRelationTuples Query relation tuples - * Get all relation tuples that match the query. Only the namespace field is required. + * PostCheckPermission Check a permission + * To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiGetRelationTuplesRequest + * @return PermissionApiApiPostCheckPermissionRequest */ - GetRelationTuples(ctx context.Context) ReadApiApiGetRelationTuplesRequest + PostCheckPermission(ctx context.Context) PermissionApiApiPostCheckPermissionRequest /* - * GetRelationTuplesExecute executes the request - * @return GetRelationTuplesResponse + * PostCheckPermissionExecute executes the request + * @return CheckPermissionResult */ - GetRelationTuplesExecute(r ReadApiApiGetRelationTuplesRequest) (*GetRelationTuplesResponse, *http.Response, error) + PostCheckPermissionExecute(r PermissionApiApiPostCheckPermissionRequest) (*CheckPermissionResult, *http.Response, error) /* - * PostCheck Check a relation tuple - * To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). + * PostCheckPermissionOrError Check a permission + * To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiPostCheckRequest + * @return PermissionApiApiPostCheckPermissionOrErrorRequest */ - PostCheck(ctx context.Context) ReadApiApiPostCheckRequest + PostCheckPermissionOrError(ctx context.Context) PermissionApiApiPostCheckPermissionOrErrorRequest /* - * PostCheckExecute executes the request - * @return GetCheckResponse + * PostCheckPermissionOrErrorExecute executes the request + * @return CheckPermissionResult */ - PostCheckExecute(r ReadApiApiPostCheckRequest) (*GetCheckResponse, *http.Response, error) - - /* - * PostCheckMirrorStatus Check a relation tuple - * To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiPostCheckMirrorStatusRequest - */ - PostCheckMirrorStatus(ctx context.Context) ReadApiApiPostCheckMirrorStatusRequest - - /* - * PostCheckMirrorStatusExecute executes the request - * @return GetCheckResponse - */ - PostCheckMirrorStatusExecute(r ReadApiApiPostCheckMirrorStatusRequest) (*GetCheckResponse, *http.Response, error) + PostCheckPermissionOrErrorExecute(r PermissionApiApiPostCheckPermissionOrErrorRequest) (*CheckPermissionResult, *http.Response, error) } -// ReadApiService ReadApi service -type ReadApiService service +// PermissionApiService PermissionApi service +type PermissionApiService service -type ReadApiApiGetCheckRequest struct { +type PermissionApiApiCheckPermissionRequest struct { ctx context.Context - ApiService ReadApi + ApiService PermissionApi namespace *string object *string relation *string @@ -127,51 +113,51 @@ type ReadApiApiGetCheckRequest struct { maxDepth *int64 } -func (r ReadApiApiGetCheckRequest) Namespace(namespace string) ReadApiApiGetCheckRequest { +func (r PermissionApiApiCheckPermissionRequest) Namespace(namespace string) PermissionApiApiCheckPermissionRequest { r.namespace = &namespace return r } -func (r ReadApiApiGetCheckRequest) Object(object string) ReadApiApiGetCheckRequest { +func (r PermissionApiApiCheckPermissionRequest) Object(object string) PermissionApiApiCheckPermissionRequest { r.object = &object return r } -func (r ReadApiApiGetCheckRequest) Relation(relation string) ReadApiApiGetCheckRequest { +func (r PermissionApiApiCheckPermissionRequest) Relation(relation string) PermissionApiApiCheckPermissionRequest { r.relation = &relation return r } -func (r ReadApiApiGetCheckRequest) SubjectId(subjectId string) ReadApiApiGetCheckRequest { +func (r PermissionApiApiCheckPermissionRequest) SubjectId(subjectId string) PermissionApiApiCheckPermissionRequest { r.subjectId = &subjectId return r } -func (r ReadApiApiGetCheckRequest) SubjectSetNamespace(subjectSetNamespace string) ReadApiApiGetCheckRequest { +func (r PermissionApiApiCheckPermissionRequest) SubjectSetNamespace(subjectSetNamespace string) PermissionApiApiCheckPermissionRequest { r.subjectSetNamespace = &subjectSetNamespace return r } -func (r ReadApiApiGetCheckRequest) SubjectSetObject(subjectSetObject string) ReadApiApiGetCheckRequest { +func (r PermissionApiApiCheckPermissionRequest) SubjectSetObject(subjectSetObject string) PermissionApiApiCheckPermissionRequest { r.subjectSetObject = &subjectSetObject return r } -func (r ReadApiApiGetCheckRequest) SubjectSetRelation(subjectSetRelation string) ReadApiApiGetCheckRequest { +func (r PermissionApiApiCheckPermissionRequest) SubjectSetRelation(subjectSetRelation string) PermissionApiApiCheckPermissionRequest { r.subjectSetRelation = &subjectSetRelation return r } -func (r ReadApiApiGetCheckRequest) MaxDepth(maxDepth int64) ReadApiApiGetCheckRequest { +func (r PermissionApiApiCheckPermissionRequest) MaxDepth(maxDepth int64) PermissionApiApiCheckPermissionRequest { r.maxDepth = &maxDepth return r } -func (r ReadApiApiGetCheckRequest) Execute() (*GetCheckResponse, *http.Response, error) { - return r.ApiService.GetCheckExecute(r) +func (r PermissionApiApiCheckPermissionRequest) Execute() (*CheckPermissionResult, *http.Response, error) { + return r.ApiService.CheckPermissionExecute(r) } /* - * GetCheck Check a relation tuple - * To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). + * CheckPermission Check a permission + * To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiGetCheckRequest + * @return PermissionApiApiCheckPermissionRequest */ -func (a *ReadApiService) GetCheck(ctx context.Context) ReadApiApiGetCheckRequest { - return ReadApiApiGetCheckRequest{ +func (a *PermissionApiService) CheckPermission(ctx context.Context) PermissionApiApiCheckPermissionRequest { + return PermissionApiApiCheckPermissionRequest{ ApiService: a, ctx: ctx, } @@ -179,19 +165,19 @@ func (a *ReadApiService) GetCheck(ctx context.Context) ReadApiApiGetCheckRequest /* * Execute executes the request - * @return GetCheckResponse + * @return CheckPermissionResult */ -func (a *ReadApiService) GetCheckExecute(r ReadApiApiGetCheckRequest) (*GetCheckResponse, *http.Response, error) { +func (a *PermissionApiService) CheckPermissionExecute(r PermissionApiApiCheckPermissionRequest) (*CheckPermissionResult, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue *GetCheckResponse + localVarReturnValue *CheckPermissionResult ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ReadApiService.GetCheck") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PermissionApiService.CheckPermission") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -266,7 +252,7 @@ func (a *ReadApiService) GetCheckExecute(r ReadApiApiGetCheckRequest) (*GetCheck error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v GenericError + var v ErrorGeneric err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -275,15 +261,13 @@ func (a *ReadApiService) GetCheckExecute(r ReadApiApiGetCheckRequest) (*GetCheck newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 500 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -299,23 +283,64 @@ func (a *ReadApiService) GetCheckExecute(r ReadApiApiGetCheckRequest) (*GetCheck return localVarReturnValue, localVarHTTPResponse, nil } -type ReadApiApiGetCheckMirrorStatusRequest struct { - ctx context.Context - ApiService ReadApi +type PermissionApiApiCheckPermissionOrErrorRequest struct { + ctx context.Context + ApiService PermissionApi + namespace *string + object *string + relation *string + subjectId *string + subjectSetNamespace *string + subjectSetObject *string + subjectSetRelation *string + maxDepth *int64 +} + +func (r PermissionApiApiCheckPermissionOrErrorRequest) Namespace(namespace string) PermissionApiApiCheckPermissionOrErrorRequest { + r.namespace = &namespace + return r +} +func (r PermissionApiApiCheckPermissionOrErrorRequest) Object(object string) PermissionApiApiCheckPermissionOrErrorRequest { + r.object = &object + return r +} +func (r PermissionApiApiCheckPermissionOrErrorRequest) Relation(relation string) PermissionApiApiCheckPermissionOrErrorRequest { + r.relation = &relation + return r +} +func (r PermissionApiApiCheckPermissionOrErrorRequest) SubjectId(subjectId string) PermissionApiApiCheckPermissionOrErrorRequest { + r.subjectId = &subjectId + return r +} +func (r PermissionApiApiCheckPermissionOrErrorRequest) SubjectSetNamespace(subjectSetNamespace string) PermissionApiApiCheckPermissionOrErrorRequest { + r.subjectSetNamespace = &subjectSetNamespace + return r +} +func (r PermissionApiApiCheckPermissionOrErrorRequest) SubjectSetObject(subjectSetObject string) PermissionApiApiCheckPermissionOrErrorRequest { + r.subjectSetObject = &subjectSetObject + return r +} +func (r PermissionApiApiCheckPermissionOrErrorRequest) SubjectSetRelation(subjectSetRelation string) PermissionApiApiCheckPermissionOrErrorRequest { + r.subjectSetRelation = &subjectSetRelation + return r +} +func (r PermissionApiApiCheckPermissionOrErrorRequest) MaxDepth(maxDepth int64) PermissionApiApiCheckPermissionOrErrorRequest { + r.maxDepth = &maxDepth + return r } -func (r ReadApiApiGetCheckMirrorStatusRequest) Execute() (*GetCheckResponse, *http.Response, error) { - return r.ApiService.GetCheckMirrorStatusExecute(r) +func (r PermissionApiApiCheckPermissionOrErrorRequest) Execute() (*CheckPermissionResult, *http.Response, error) { + return r.ApiService.CheckPermissionOrErrorExecute(r) } /* - * GetCheckMirrorStatus Check a relation tuple - * To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). + * CheckPermissionOrError Check a permission + * To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiGetCheckMirrorStatusRequest + * @return PermissionApiApiCheckPermissionOrErrorRequest */ -func (a *ReadApiService) GetCheckMirrorStatus(ctx context.Context) ReadApiApiGetCheckMirrorStatusRequest { - return ReadApiApiGetCheckMirrorStatusRequest{ +func (a *PermissionApiService) CheckPermissionOrError(ctx context.Context) PermissionApiApiCheckPermissionOrErrorRequest { + return PermissionApiApiCheckPermissionOrErrorRequest{ ApiService: a, ctx: ctx, } @@ -323,19 +348,19 @@ func (a *ReadApiService) GetCheckMirrorStatus(ctx context.Context) ReadApiApiGet /* * Execute executes the request - * @return GetCheckResponse + * @return CheckPermissionResult */ -func (a *ReadApiService) GetCheckMirrorStatusExecute(r ReadApiApiGetCheckMirrorStatusRequest) (*GetCheckResponse, *http.Response, error) { +func (a *PermissionApiService) CheckPermissionOrErrorExecute(r PermissionApiApiCheckPermissionOrErrorRequest) (*CheckPermissionResult, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue *GetCheckResponse + localVarReturnValue *CheckPermissionResult ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ReadApiService.GetCheckMirrorStatus") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PermissionApiService.CheckPermissionOrError") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -346,6 +371,30 @@ func (a *ReadApiService) GetCheckMirrorStatusExecute(r ReadApiApiGetCheckMirrorS localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.namespace != nil { + localVarQueryParams.Add("namespace", parameterToString(*r.namespace, "")) + } + if r.object != nil { + localVarQueryParams.Add("object", parameterToString(*r.object, "")) + } + if r.relation != nil { + localVarQueryParams.Add("relation", parameterToString(*r.relation, "")) + } + if r.subjectId != nil { + localVarQueryParams.Add("subject_id", parameterToString(*r.subjectId, "")) + } + if r.subjectSetNamespace != nil { + localVarQueryParams.Add("subject_set.namespace", parameterToString(*r.subjectSetNamespace, "")) + } + if r.subjectSetObject != nil { + localVarQueryParams.Add("subject_set.object", parameterToString(*r.subjectSetObject, "")) + } + if r.subjectSetRelation != nil { + localVarQueryParams.Add("subject_set.relation", parameterToString(*r.subjectSetRelation, "")) + } + if r.maxDepth != nil { + localVarQueryParams.Add("max-depth", parameterToString(*r.maxDepth, "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -386,7 +435,7 @@ func (a *ReadApiService) GetCheckMirrorStatusExecute(r ReadApiApiGetCheckMirrorS error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v GenericError + var v ErrorGeneric err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -396,7 +445,7 @@ func (a *ReadApiService) GetCheckMirrorStatusExecute(r ReadApiApiGetCheckMirrorS return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { - var v GetCheckResponse + var v CheckPermissionResult err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -405,15 +454,13 @@ func (a *ReadApiService) GetCheckMirrorStatusExecute(r ReadApiApiGetCheckMirrorS newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 500 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -429,44 +476,44 @@ func (a *ReadApiService) GetCheckMirrorStatusExecute(r ReadApiApiGetCheckMirrorS return localVarReturnValue, localVarHTTPResponse, nil } -type ReadApiApiGetExpandRequest struct { +type PermissionApiApiExpandPermissionsRequest struct { ctx context.Context - ApiService ReadApi + ApiService PermissionApi namespace *string object *string relation *string maxDepth *int64 } -func (r ReadApiApiGetExpandRequest) Namespace(namespace string) ReadApiApiGetExpandRequest { +func (r PermissionApiApiExpandPermissionsRequest) Namespace(namespace string) PermissionApiApiExpandPermissionsRequest { r.namespace = &namespace return r } -func (r ReadApiApiGetExpandRequest) Object(object string) ReadApiApiGetExpandRequest { +func (r PermissionApiApiExpandPermissionsRequest) Object(object string) PermissionApiApiExpandPermissionsRequest { r.object = &object return r } -func (r ReadApiApiGetExpandRequest) Relation(relation string) ReadApiApiGetExpandRequest { +func (r PermissionApiApiExpandPermissionsRequest) Relation(relation string) PermissionApiApiExpandPermissionsRequest { r.relation = &relation return r } -func (r ReadApiApiGetExpandRequest) MaxDepth(maxDepth int64) ReadApiApiGetExpandRequest { +func (r PermissionApiApiExpandPermissionsRequest) MaxDepth(maxDepth int64) PermissionApiApiExpandPermissionsRequest { r.maxDepth = &maxDepth return r } -func (r ReadApiApiGetExpandRequest) Execute() (*ExpandTree, *http.Response, error) { - return r.ApiService.GetExpandExecute(r) +func (r PermissionApiApiExpandPermissionsRequest) Execute() (*ExpandedPermissionTree, *http.Response, error) { + return r.ApiService.ExpandPermissionsExecute(r) } /* - * GetExpand Expand a Relation Tuple - * Use this endpoint to expand a relation tuple. + * ExpandPermissions Expand a Relationship into permissions. + * Use this endpoint to expand a relationship tuple into permissions. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiGetExpandRequest + * @return PermissionApiApiExpandPermissionsRequest */ -func (a *ReadApiService) GetExpand(ctx context.Context) ReadApiApiGetExpandRequest { - return ReadApiApiGetExpandRequest{ +func (a *PermissionApiService) ExpandPermissions(ctx context.Context) PermissionApiApiExpandPermissionsRequest { + return PermissionApiApiExpandPermissionsRequest{ ApiService: a, ctx: ctx, } @@ -474,19 +521,19 @@ func (a *ReadApiService) GetExpand(ctx context.Context) ReadApiApiGetExpandReque /* * Execute executes the request - * @return ExpandTree + * @return ExpandedPermissionTree */ -func (a *ReadApiService) GetExpandExecute(r ReadApiApiGetExpandRequest) (*ExpandTree, *http.Response, error) { +func (a *PermissionApiService) ExpandPermissionsExecute(r PermissionApiApiExpandPermissionsRequest) (*ExpandedPermissionTree, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue *ExpandTree + localVarReturnValue *ExpandedPermissionTree ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ReadApiService.GetExpand") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PermissionApiService.ExpandPermissions") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -552,7 +599,7 @@ func (a *ReadApiService) GetExpandExecute(r ReadApiApiGetExpandRequest) (*Expand error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v GenericError + var v ErrorGeneric err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -562,7 +609,7 @@ func (a *ReadApiService) GetExpandExecute(r ReadApiApiGetExpandRequest) (*Expand return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { - var v GenericError + var v ErrorGeneric err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -571,15 +618,13 @@ func (a *ReadApiService) GetExpandExecute(r ReadApiApiGetExpandRequest) (*Expand newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 500 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -595,69 +640,34 @@ func (a *ReadApiService) GetExpandExecute(r ReadApiApiGetExpandRequest) (*Expand return localVarReturnValue, localVarHTTPResponse, nil } -type ReadApiApiGetRelationTuplesRequest struct { - ctx context.Context - ApiService ReadApi - pageToken *string - pageSize *int64 - namespace *string - object *string - relation *string - subjectId *string - subjectSetNamespace *string - subjectSetObject *string - subjectSetRelation *string +type PermissionApiApiPostCheckPermissionRequest struct { + ctx context.Context + ApiService PermissionApi + maxDepth *int64 + postCheckPermissionBody *PostCheckPermissionBody } -func (r ReadApiApiGetRelationTuplesRequest) PageToken(pageToken string) ReadApiApiGetRelationTuplesRequest { - r.pageToken = &pageToken - return r -} -func (r ReadApiApiGetRelationTuplesRequest) PageSize(pageSize int64) ReadApiApiGetRelationTuplesRequest { - r.pageSize = &pageSize - return r -} -func (r ReadApiApiGetRelationTuplesRequest) Namespace(namespace string) ReadApiApiGetRelationTuplesRequest { - r.namespace = &namespace - return r -} -func (r ReadApiApiGetRelationTuplesRequest) Object(object string) ReadApiApiGetRelationTuplesRequest { - r.object = &object - return r -} -func (r ReadApiApiGetRelationTuplesRequest) Relation(relation string) ReadApiApiGetRelationTuplesRequest { - r.relation = &relation - return r -} -func (r ReadApiApiGetRelationTuplesRequest) SubjectId(subjectId string) ReadApiApiGetRelationTuplesRequest { - r.subjectId = &subjectId - return r -} -func (r ReadApiApiGetRelationTuplesRequest) SubjectSetNamespace(subjectSetNamespace string) ReadApiApiGetRelationTuplesRequest { - r.subjectSetNamespace = &subjectSetNamespace - return r -} -func (r ReadApiApiGetRelationTuplesRequest) SubjectSetObject(subjectSetObject string) ReadApiApiGetRelationTuplesRequest { - r.subjectSetObject = &subjectSetObject +func (r PermissionApiApiPostCheckPermissionRequest) MaxDepth(maxDepth int64) PermissionApiApiPostCheckPermissionRequest { + r.maxDepth = &maxDepth return r } -func (r ReadApiApiGetRelationTuplesRequest) SubjectSetRelation(subjectSetRelation string) ReadApiApiGetRelationTuplesRequest { - r.subjectSetRelation = &subjectSetRelation +func (r PermissionApiApiPostCheckPermissionRequest) PostCheckPermissionBody(postCheckPermissionBody PostCheckPermissionBody) PermissionApiApiPostCheckPermissionRequest { + r.postCheckPermissionBody = &postCheckPermissionBody return r } -func (r ReadApiApiGetRelationTuplesRequest) Execute() (*GetRelationTuplesResponse, *http.Response, error) { - return r.ApiService.GetRelationTuplesExecute(r) +func (r PermissionApiApiPostCheckPermissionRequest) Execute() (*CheckPermissionResult, *http.Response, error) { + return r.ApiService.PostCheckPermissionExecute(r) } /* - * GetRelationTuples Query relation tuples - * Get all relation tuples that match the query. Only the namespace field is required. + * PostCheckPermission Check a permission + * To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiGetRelationTuplesRequest + * @return PermissionApiApiPostCheckPermissionRequest */ -func (a *ReadApiService) GetRelationTuples(ctx context.Context) ReadApiApiGetRelationTuplesRequest { - return ReadApiApiGetRelationTuplesRequest{ +func (a *PermissionApiService) PostCheckPermission(ctx context.Context) PermissionApiApiPostCheckPermissionRequest { + return PermissionApiApiPostCheckPermissionRequest{ ApiService: a, ctx: ctx, } @@ -665,58 +675,34 @@ func (a *ReadApiService) GetRelationTuples(ctx context.Context) ReadApiApiGetRel /* * Execute executes the request - * @return GetRelationTuplesResponse + * @return CheckPermissionResult */ -func (a *ReadApiService) GetRelationTuplesExecute(r ReadApiApiGetRelationTuplesRequest) (*GetRelationTuplesResponse, *http.Response, error) { +func (a *PermissionApiService) PostCheckPermissionExecute(r PermissionApiApiPostCheckPermissionRequest) (*CheckPermissionResult, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue *GetRelationTuplesResponse + localVarReturnValue *CheckPermissionResult ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ReadApiService.GetRelationTuples") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PermissionApiService.PostCheckPermission") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/relation-tuples" + localVarPath := localBasePath + "/relation-tuples/check/openapi" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.pageToken != nil { - localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) - } - if r.pageSize != nil { - localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) - } - if r.namespace != nil { - localVarQueryParams.Add("namespace", parameterToString(*r.namespace, "")) - } - if r.object != nil { - localVarQueryParams.Add("object", parameterToString(*r.object, "")) - } - if r.relation != nil { - localVarQueryParams.Add("relation", parameterToString(*r.relation, "")) - } - if r.subjectId != nil { - localVarQueryParams.Add("subject_id", parameterToString(*r.subjectId, "")) - } - if r.subjectSetNamespace != nil { - localVarQueryParams.Add("subject_set.namespace", parameterToString(*r.subjectSetNamespace, "")) - } - if r.subjectSetObject != nil { - localVarQueryParams.Add("subject_set.object", parameterToString(*r.subjectSetObject, "")) - } - if r.subjectSetRelation != nil { - localVarQueryParams.Add("subject_set.relation", parameterToString(*r.subjectSetRelation, "")) + if r.maxDepth != nil { + localVarQueryParams.Add("max-depth", parameterToString(*r.maxDepth, "")) } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -732,6 +718,8 @@ func (a *ReadApiService) GetRelationTuplesExecute(r ReadApiApiGetRelationTuplesR if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.postCheckPermissionBody req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err @@ -754,8 +742,8 @@ func (a *ReadApiService) GetRelationTuplesExecute(r ReadApiApiGetRelationTuplesR body: localVarBody, error: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 404 { - var v GenericError + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorGeneric err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -764,15 +752,13 @@ func (a *ReadApiService) GetRelationTuplesExecute(r ReadApiApiGetRelationTuplesR newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 500 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } @@ -788,34 +774,34 @@ func (a *ReadApiService) GetRelationTuplesExecute(r ReadApiApiGetRelationTuplesR return localVarReturnValue, localVarHTTPResponse, nil } -type ReadApiApiPostCheckRequest struct { - ctx context.Context - ApiService ReadApi - maxDepth *int64 - relationQuery *RelationQuery +type PermissionApiApiPostCheckPermissionOrErrorRequest struct { + ctx context.Context + ApiService PermissionApi + maxDepth *int64 + postCheckPermissionOrErrorBody *PostCheckPermissionOrErrorBody } -func (r ReadApiApiPostCheckRequest) MaxDepth(maxDepth int64) ReadApiApiPostCheckRequest { +func (r PermissionApiApiPostCheckPermissionOrErrorRequest) MaxDepth(maxDepth int64) PermissionApiApiPostCheckPermissionOrErrorRequest { r.maxDepth = &maxDepth return r } -func (r ReadApiApiPostCheckRequest) RelationQuery(relationQuery RelationQuery) ReadApiApiPostCheckRequest { - r.relationQuery = &relationQuery +func (r PermissionApiApiPostCheckPermissionOrErrorRequest) PostCheckPermissionOrErrorBody(postCheckPermissionOrErrorBody PostCheckPermissionOrErrorBody) PermissionApiApiPostCheckPermissionOrErrorRequest { + r.postCheckPermissionOrErrorBody = &postCheckPermissionOrErrorBody return r } -func (r ReadApiApiPostCheckRequest) Execute() (*GetCheckResponse, *http.Response, error) { - return r.ApiService.PostCheckExecute(r) +func (r PermissionApiApiPostCheckPermissionOrErrorRequest) Execute() (*CheckPermissionResult, *http.Response, error) { + return r.ApiService.PostCheckPermissionOrErrorExecute(r) } /* - * PostCheck Check a relation tuple - * To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). + * PostCheckPermissionOrError Check a permission + * To learn how relationship tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiPostCheckRequest + * @return PermissionApiApiPostCheckPermissionOrErrorRequest */ -func (a *ReadApiService) PostCheck(ctx context.Context) ReadApiApiPostCheckRequest { - return ReadApiApiPostCheckRequest{ +func (a *PermissionApiService) PostCheckPermissionOrError(ctx context.Context) PermissionApiApiPostCheckPermissionOrErrorRequest { + return PermissionApiApiPostCheckPermissionOrErrorRequest{ ApiService: a, ctx: ctx, } @@ -823,24 +809,24 @@ func (a *ReadApiService) PostCheck(ctx context.Context) ReadApiApiPostCheckReque /* * Execute executes the request - * @return GetCheckResponse + * @return CheckPermissionResult */ -func (a *ReadApiService) PostCheckExecute(r ReadApiApiPostCheckRequest) (*GetCheckResponse, *http.Response, error) { +func (a *PermissionApiService) PostCheckPermissionOrErrorExecute(r PermissionApiApiPostCheckPermissionOrErrorRequest) (*CheckPermissionResult, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue *GetCheckResponse + localVarReturnValue *CheckPermissionResult ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ReadApiService.PostCheck") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PermissionApiService.PostCheckPermissionOrError") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/relation-tuples/check/openapi" + localVarPath := localBasePath + "/relation-tuples/check" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -867,127 +853,7 @@ func (a *ReadApiService) PostCheckExecute(r ReadApiApiPostCheckRequest) (*GetChe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.relationQuery - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ReadApiApiPostCheckMirrorStatusRequest struct { - ctx context.Context - ApiService ReadApi -} - -func (r ReadApiApiPostCheckMirrorStatusRequest) Execute() (*GetCheckResponse, *http.Response, error) { - return r.ApiService.PostCheckMirrorStatusExecute(r) -} - -/* - * PostCheckMirrorStatus Check a relation tuple - * To learn how relation tuples and the check works, head over to [the documentation](https://www.ory.sh/docs/keto/concepts/api-overview). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ReadApiApiPostCheckMirrorStatusRequest - */ -func (a *ReadApiService) PostCheckMirrorStatus(ctx context.Context) ReadApiApiPostCheckMirrorStatusRequest { - return ReadApiApiPostCheckMirrorStatusRequest{ - ApiService: a, - ctx: ctx, - } -} - -/* - * Execute executes the request - * @return GetCheckResponse - */ -func (a *ReadApiService) PostCheckMirrorStatusExecute(r ReadApiApiPostCheckMirrorStatusRequest) (*GetCheckResponse, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *GetCheckResponse - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ReadApiService.PostCheckMirrorStatus") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/relation-tuples/check" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } + localVarPostBody = r.postCheckPermissionOrErrorBody req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err @@ -1011,7 +877,7 @@ func (a *ReadApiService) PostCheckMirrorStatusExecute(r ReadApiApiPostCheckMirro error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v GenericError + var v ErrorGeneric err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -1021,7 +887,7 @@ func (a *ReadApiService) PostCheckMirrorStatusExecute(r ReadApiApiPostCheckMirro return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { - var v GetCheckResponse + var v CheckPermissionResult err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -1030,15 +896,13 @@ func (a *ReadApiService) PostCheckMirrorStatusExecute(r ReadApiApiPostCheckMirro newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 500 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr } + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/internal/httpclient/api_relationship.go b/internal/httpclient/api_relationship.go new file mode 100644 index 000000000..72e7e97ea --- /dev/null +++ b/internal/httpclient/api_relationship.go @@ -0,0 +1,953 @@ +/* + * Ory Keto API + * + * Documentation for all of Ory Keto's REST APIs. gRPC is documented separately. + * + * API version: 1.0.0 + * Contact: hi@ory.sh + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" +) + +// Linger please +var ( + _ context.Context +) + +type RelationshipApi interface { + + /* + * CheckOplSyntax Check the syntax of an OPL file + * The OPL file is expected in the body of the request. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiCheckOplSyntaxRequest + */ + CheckOplSyntax(ctx context.Context) RelationshipApiApiCheckOplSyntaxRequest + + /* + * CheckOplSyntaxExecute executes the request + * @return CheckOplSyntaxResult + */ + CheckOplSyntaxExecute(r RelationshipApiApiCheckOplSyntaxRequest) (*CheckOplSyntaxResult, *http.Response, error) + + /* + * CreateRelationship Create a Relationship + * Use this endpoint to create a relationship. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiCreateRelationshipRequest + */ + CreateRelationship(ctx context.Context) RelationshipApiApiCreateRelationshipRequest + + /* + * CreateRelationshipExecute executes the request + * @return Relationship + */ + CreateRelationshipExecute(r RelationshipApiApiCreateRelationshipRequest) (*Relationship, *http.Response, error) + + /* + * DeleteRelationships Delete Relationships + * Use this endpoint to delete relationships + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiDeleteRelationshipsRequest + */ + DeleteRelationships(ctx context.Context) RelationshipApiApiDeleteRelationshipsRequest + + /* + * DeleteRelationshipsExecute executes the request + */ + DeleteRelationshipsExecute(r RelationshipApiApiDeleteRelationshipsRequest) (*http.Response, error) + + /* + * GetRelationships Query relationships + * Get all relationships that match the query. Only the namespace field is required. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiGetRelationshipsRequest + */ + GetRelationships(ctx context.Context) RelationshipApiApiGetRelationshipsRequest + + /* + * GetRelationshipsExecute executes the request + * @return Relationships + */ + GetRelationshipsExecute(r RelationshipApiApiGetRelationshipsRequest) (*Relationships, *http.Response, error) + + /* + * ListRelationshipNamespaces Query namespaces + * Get all namespaces + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiListRelationshipNamespacesRequest + */ + ListRelationshipNamespaces(ctx context.Context) RelationshipApiApiListRelationshipNamespacesRequest + + /* + * ListRelationshipNamespacesExecute executes the request + * @return RelationshipNamespaces + */ + ListRelationshipNamespacesExecute(r RelationshipApiApiListRelationshipNamespacesRequest) (*RelationshipNamespaces, *http.Response, error) + + /* + * PatchRelationships Patch Multiple Relationships + * Use this endpoint to patch one or more relationships. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiPatchRelationshipsRequest + */ + PatchRelationships(ctx context.Context) RelationshipApiApiPatchRelationshipsRequest + + /* + * PatchRelationshipsExecute executes the request + */ + PatchRelationshipsExecute(r RelationshipApiApiPatchRelationshipsRequest) (*http.Response, error) +} + +// RelationshipApiService RelationshipApi service +type RelationshipApiService service + +type RelationshipApiApiCheckOplSyntaxRequest struct { + ctx context.Context + ApiService RelationshipApi + body *string +} + +func (r RelationshipApiApiCheckOplSyntaxRequest) Body(body string) RelationshipApiApiCheckOplSyntaxRequest { + r.body = &body + return r +} + +func (r RelationshipApiApiCheckOplSyntaxRequest) Execute() (*CheckOplSyntaxResult, *http.Response, error) { + return r.ApiService.CheckOplSyntaxExecute(r) +} + +/* + * CheckOplSyntax Check the syntax of an OPL file + * The OPL file is expected in the body of the request. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiCheckOplSyntaxRequest + */ +func (a *RelationshipApiService) CheckOplSyntax(ctx context.Context) RelationshipApiApiCheckOplSyntaxRequest { + return RelationshipApiApiCheckOplSyntaxRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return CheckOplSyntaxResult + */ +func (a *RelationshipApiService) CheckOplSyntaxExecute(r RelationshipApiApiCheckOplSyntaxRequest) (*CheckOplSyntaxResult, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *CheckOplSyntaxResult + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RelationshipApiService.CheckOplSyntax") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/opl/syntax/check" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"text/plain"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type RelationshipApiApiCreateRelationshipRequest struct { + ctx context.Context + ApiService RelationshipApi + createRelationshipBody *CreateRelationshipBody +} + +func (r RelationshipApiApiCreateRelationshipRequest) CreateRelationshipBody(createRelationshipBody CreateRelationshipBody) RelationshipApiApiCreateRelationshipRequest { + r.createRelationshipBody = &createRelationshipBody + return r +} + +func (r RelationshipApiApiCreateRelationshipRequest) Execute() (*Relationship, *http.Response, error) { + return r.ApiService.CreateRelationshipExecute(r) +} + +/* + * CreateRelationship Create a Relationship + * Use this endpoint to create a relationship. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiCreateRelationshipRequest + */ +func (a *RelationshipApiService) CreateRelationship(ctx context.Context) RelationshipApiApiCreateRelationshipRequest { + return RelationshipApiApiCreateRelationshipRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Relationship + */ +func (a *RelationshipApiService) CreateRelationshipExecute(r RelationshipApiApiCreateRelationshipRequest) (*Relationship, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *Relationship + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RelationshipApiService.CreateRelationship") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/relation-tuples" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createRelationshipBody + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type RelationshipApiApiDeleteRelationshipsRequest struct { + ctx context.Context + ApiService RelationshipApi + namespace *string + object *string + relation *string + subjectId *string + subjectSetNamespace *string + subjectSetObject *string + subjectSetRelation *string +} + +func (r RelationshipApiApiDeleteRelationshipsRequest) Namespace(namespace string) RelationshipApiApiDeleteRelationshipsRequest { + r.namespace = &namespace + return r +} +func (r RelationshipApiApiDeleteRelationshipsRequest) Object(object string) RelationshipApiApiDeleteRelationshipsRequest { + r.object = &object + return r +} +func (r RelationshipApiApiDeleteRelationshipsRequest) Relation(relation string) RelationshipApiApiDeleteRelationshipsRequest { + r.relation = &relation + return r +} +func (r RelationshipApiApiDeleteRelationshipsRequest) SubjectId(subjectId string) RelationshipApiApiDeleteRelationshipsRequest { + r.subjectId = &subjectId + return r +} +func (r RelationshipApiApiDeleteRelationshipsRequest) SubjectSetNamespace(subjectSetNamespace string) RelationshipApiApiDeleteRelationshipsRequest { + r.subjectSetNamespace = &subjectSetNamespace + return r +} +func (r RelationshipApiApiDeleteRelationshipsRequest) SubjectSetObject(subjectSetObject string) RelationshipApiApiDeleteRelationshipsRequest { + r.subjectSetObject = &subjectSetObject + return r +} +func (r RelationshipApiApiDeleteRelationshipsRequest) SubjectSetRelation(subjectSetRelation string) RelationshipApiApiDeleteRelationshipsRequest { + r.subjectSetRelation = &subjectSetRelation + return r +} + +func (r RelationshipApiApiDeleteRelationshipsRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteRelationshipsExecute(r) +} + +/* + * DeleteRelationships Delete Relationships + * Use this endpoint to delete relationships + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiDeleteRelationshipsRequest + */ +func (a *RelationshipApiService) DeleteRelationships(ctx context.Context) RelationshipApiApiDeleteRelationshipsRequest { + return RelationshipApiApiDeleteRelationshipsRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + */ +func (a *RelationshipApiService) DeleteRelationshipsExecute(r RelationshipApiApiDeleteRelationshipsRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RelationshipApiService.DeleteRelationships") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/relation-tuples" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.namespace != nil { + localVarQueryParams.Add("namespace", parameterToString(*r.namespace, "")) + } + if r.object != nil { + localVarQueryParams.Add("object", parameterToString(*r.object, "")) + } + if r.relation != nil { + localVarQueryParams.Add("relation", parameterToString(*r.relation, "")) + } + if r.subjectId != nil { + localVarQueryParams.Add("subject_id", parameterToString(*r.subjectId, "")) + } + if r.subjectSetNamespace != nil { + localVarQueryParams.Add("subject_set.namespace", parameterToString(*r.subjectSetNamespace, "")) + } + if r.subjectSetObject != nil { + localVarQueryParams.Add("subject_set.object", parameterToString(*r.subjectSetObject, "")) + } + if r.subjectSetRelation != nil { + localVarQueryParams.Add("subject_set.relation", parameterToString(*r.subjectSetRelation, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type RelationshipApiApiGetRelationshipsRequest struct { + ctx context.Context + ApiService RelationshipApi + pageToken *string + pageSize *int64 + namespace *string + object *string + relation *string + subjectId *string + subjectSetNamespace *string + subjectSetObject *string + subjectSetRelation *string +} + +func (r RelationshipApiApiGetRelationshipsRequest) PageToken(pageToken string) RelationshipApiApiGetRelationshipsRequest { + r.pageToken = &pageToken + return r +} +func (r RelationshipApiApiGetRelationshipsRequest) PageSize(pageSize int64) RelationshipApiApiGetRelationshipsRequest { + r.pageSize = &pageSize + return r +} +func (r RelationshipApiApiGetRelationshipsRequest) Namespace(namespace string) RelationshipApiApiGetRelationshipsRequest { + r.namespace = &namespace + return r +} +func (r RelationshipApiApiGetRelationshipsRequest) Object(object string) RelationshipApiApiGetRelationshipsRequest { + r.object = &object + return r +} +func (r RelationshipApiApiGetRelationshipsRequest) Relation(relation string) RelationshipApiApiGetRelationshipsRequest { + r.relation = &relation + return r +} +func (r RelationshipApiApiGetRelationshipsRequest) SubjectId(subjectId string) RelationshipApiApiGetRelationshipsRequest { + r.subjectId = &subjectId + return r +} +func (r RelationshipApiApiGetRelationshipsRequest) SubjectSetNamespace(subjectSetNamespace string) RelationshipApiApiGetRelationshipsRequest { + r.subjectSetNamespace = &subjectSetNamespace + return r +} +func (r RelationshipApiApiGetRelationshipsRequest) SubjectSetObject(subjectSetObject string) RelationshipApiApiGetRelationshipsRequest { + r.subjectSetObject = &subjectSetObject + return r +} +func (r RelationshipApiApiGetRelationshipsRequest) SubjectSetRelation(subjectSetRelation string) RelationshipApiApiGetRelationshipsRequest { + r.subjectSetRelation = &subjectSetRelation + return r +} + +func (r RelationshipApiApiGetRelationshipsRequest) Execute() (*Relationships, *http.Response, error) { + return r.ApiService.GetRelationshipsExecute(r) +} + +/* + * GetRelationships Query relationships + * Get all relationships that match the query. Only the namespace field is required. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiGetRelationshipsRequest + */ +func (a *RelationshipApiService) GetRelationships(ctx context.Context) RelationshipApiApiGetRelationshipsRequest { + return RelationshipApiApiGetRelationshipsRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Relationships + */ +func (a *RelationshipApiService) GetRelationshipsExecute(r RelationshipApiApiGetRelationshipsRequest) (*Relationships, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *Relationships + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RelationshipApiService.GetRelationships") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/relation-tuples" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageToken != nil { + localVarQueryParams.Add("page_token", parameterToString(*r.pageToken, "")) + } + if r.pageSize != nil { + localVarQueryParams.Add("page_size", parameterToString(*r.pageSize, "")) + } + if r.namespace != nil { + localVarQueryParams.Add("namespace", parameterToString(*r.namespace, "")) + } + if r.object != nil { + localVarQueryParams.Add("object", parameterToString(*r.object, "")) + } + if r.relation != nil { + localVarQueryParams.Add("relation", parameterToString(*r.relation, "")) + } + if r.subjectId != nil { + localVarQueryParams.Add("subject_id", parameterToString(*r.subjectId, "")) + } + if r.subjectSetNamespace != nil { + localVarQueryParams.Add("subject_set.namespace", parameterToString(*r.subjectSetNamespace, "")) + } + if r.subjectSetObject != nil { + localVarQueryParams.Add("subject_set.object", parameterToString(*r.subjectSetObject, "")) + } + if r.subjectSetRelation != nil { + localVarQueryParams.Add("subject_set.relation", parameterToString(*r.subjectSetRelation, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type RelationshipApiApiListRelationshipNamespacesRequest struct { + ctx context.Context + ApiService RelationshipApi +} + +func (r RelationshipApiApiListRelationshipNamespacesRequest) Execute() (*RelationshipNamespaces, *http.Response, error) { + return r.ApiService.ListRelationshipNamespacesExecute(r) +} + +/* + * ListRelationshipNamespaces Query namespaces + * Get all namespaces + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiListRelationshipNamespacesRequest + */ +func (a *RelationshipApiService) ListRelationshipNamespaces(ctx context.Context) RelationshipApiApiListRelationshipNamespacesRequest { + return RelationshipApiApiListRelationshipNamespacesRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return RelationshipNamespaces + */ +func (a *RelationshipApiService) ListRelationshipNamespacesExecute(r RelationshipApiApiListRelationshipNamespacesRequest) (*RelationshipNamespaces, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue *RelationshipNamespaces + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RelationshipApiService.ListRelationshipNamespaces") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/namespaces" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type RelationshipApiApiPatchRelationshipsRequest struct { + ctx context.Context + ApiService RelationshipApi + relationshipPatch *[]RelationshipPatch +} + +func (r RelationshipApiApiPatchRelationshipsRequest) RelationshipPatch(relationshipPatch []RelationshipPatch) RelationshipApiApiPatchRelationshipsRequest { + r.relationshipPatch = &relationshipPatch + return r +} + +func (r RelationshipApiApiPatchRelationshipsRequest) Execute() (*http.Response, error) { + return r.ApiService.PatchRelationshipsExecute(r) +} + +/* + * PatchRelationships Patch Multiple Relationships + * Use this endpoint to patch one or more relationships. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return RelationshipApiApiPatchRelationshipsRequest + */ +func (a *RelationshipApiService) PatchRelationships(ctx context.Context) RelationshipApiApiPatchRelationshipsRequest { + return RelationshipApiApiPatchRelationshipsRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + */ +func (a *RelationshipApiService) PatchRelationshipsExecute(r RelationshipApiApiPatchRelationshipsRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RelationshipApiService.PatchRelationships") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/relation-tuples" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.relationshipPatch + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + var v ErrorGeneric + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/internal/httpclient/api_syntax.go b/internal/httpclient/api_syntax.go deleted file mode 100644 index 4878d5239..000000000 --- a/internal/httpclient/api_syntax.go +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Ory Keto API - * - * Documentation for all of Ory Keto's REST APIs. gRPC is documented separately. - * - * API version: 1.0.0 - * Contact: hi@ory.sh - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "bytes" - "context" - "io/ioutil" - "net/http" - "net/url" -) - -// Linger please -var ( - _ context.Context -) - -type SyntaxApi interface { - - /* - * CheckOplSyntax Check the syntax of an OPL file - * The OPL file is expected in the body of the request. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return SyntaxApiApiCheckOplSyntaxRequest - */ - CheckOplSyntax(ctx context.Context) SyntaxApiApiCheckOplSyntaxRequest - - /* - * CheckOplSyntaxExecute executes the request - * @return PostCheckOplSyntaxResponse - */ - CheckOplSyntaxExecute(r SyntaxApiApiCheckOplSyntaxRequest) (*PostCheckOplSyntaxResponse, *http.Response, error) -} - -// SyntaxApiService SyntaxApi service -type SyntaxApiService service - -type SyntaxApiApiCheckOplSyntaxRequest struct { - ctx context.Context - ApiService SyntaxApi - body *string -} - -func (r SyntaxApiApiCheckOplSyntaxRequest) Body(body string) SyntaxApiApiCheckOplSyntaxRequest { - r.body = &body - return r -} - -func (r SyntaxApiApiCheckOplSyntaxRequest) Execute() (*PostCheckOplSyntaxResponse, *http.Response, error) { - return r.ApiService.CheckOplSyntaxExecute(r) -} - -/* - * CheckOplSyntax Check the syntax of an OPL file - * The OPL file is expected in the body of the request. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return SyntaxApiApiCheckOplSyntaxRequest - */ -func (a *SyntaxApiService) CheckOplSyntax(ctx context.Context) SyntaxApiApiCheckOplSyntaxRequest { - return SyntaxApiApiCheckOplSyntaxRequest{ - ApiService: a, - ctx: ctx, - } -} - -/* - * Execute executes the request - * @return PostCheckOplSyntaxResponse - */ -func (a *SyntaxApiService) CheckOplSyntaxExecute(r SyntaxApiApiCheckOplSyntaxRequest) (*PostCheckOplSyntaxResponse, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *PostCheckOplSyntaxResponse - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntaxApiService.CheckOplSyntax") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/opl/syntax/check" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.body == nil { - return localVarReturnValue, nil, reportError("body is required and must be specified") - } - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"text/plain"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.body - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} diff --git a/internal/httpclient/api_write.go b/internal/httpclient/api_write.go deleted file mode 100644 index 3e6183f50..000000000 --- a/internal/httpclient/api_write.go +++ /dev/null @@ -1,492 +0,0 @@ -/* - * Ory Keto API - * - * Documentation for all of Ory Keto's REST APIs. gRPC is documented separately. - * - * API version: 1.0.0 - * Contact: hi@ory.sh - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "bytes" - "context" - "io/ioutil" - "net/http" - "net/url" -) - -// Linger please -var ( - _ context.Context -) - -type WriteApi interface { - - /* - * CreateRelationTuple Create a Relation Tuple - * Use this endpoint to create a relation tuple. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return WriteApiApiCreateRelationTupleRequest - */ - CreateRelationTuple(ctx context.Context) WriteApiApiCreateRelationTupleRequest - - /* - * CreateRelationTupleExecute executes the request - * @return RelationQuery - */ - CreateRelationTupleExecute(r WriteApiApiCreateRelationTupleRequest) (*RelationQuery, *http.Response, error) - - /* - * DeleteRelationTuples Delete Relation Tuples - * Use this endpoint to delete relation tuples - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return WriteApiApiDeleteRelationTuplesRequest - */ - DeleteRelationTuples(ctx context.Context) WriteApiApiDeleteRelationTuplesRequest - - /* - * DeleteRelationTuplesExecute executes the request - */ - DeleteRelationTuplesExecute(r WriteApiApiDeleteRelationTuplesRequest) (*http.Response, error) - - /* - * PatchRelationTuples Patch Multiple Relation Tuples - * Use this endpoint to patch one or more relation tuples. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return WriteApiApiPatchRelationTuplesRequest - */ - PatchRelationTuples(ctx context.Context) WriteApiApiPatchRelationTuplesRequest - - /* - * PatchRelationTuplesExecute executes the request - */ - PatchRelationTuplesExecute(r WriteApiApiPatchRelationTuplesRequest) (*http.Response, error) -} - -// WriteApiService WriteApi service -type WriteApiService service - -type WriteApiApiCreateRelationTupleRequest struct { - ctx context.Context - ApiService WriteApi - relationQuery *RelationQuery -} - -func (r WriteApiApiCreateRelationTupleRequest) RelationQuery(relationQuery RelationQuery) WriteApiApiCreateRelationTupleRequest { - r.relationQuery = &relationQuery - return r -} - -func (r WriteApiApiCreateRelationTupleRequest) Execute() (*RelationQuery, *http.Response, error) { - return r.ApiService.CreateRelationTupleExecute(r) -} - -/* - * CreateRelationTuple Create a Relation Tuple - * Use this endpoint to create a relation tuple. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return WriteApiApiCreateRelationTupleRequest - */ -func (a *WriteApiService) CreateRelationTuple(ctx context.Context) WriteApiApiCreateRelationTupleRequest { - return WriteApiApiCreateRelationTupleRequest{ - ApiService: a, - ctx: ctx, - } -} - -/* - * Execute executes the request - * @return RelationQuery - */ -func (a *WriteApiService) CreateRelationTupleExecute(r WriteApiApiCreateRelationTupleRequest) (*RelationQuery, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPut - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - localVarReturnValue *RelationQuery - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WriteApiService.CreateRelationTuple") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/admin/relation-tuples" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.relationQuery - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type WriteApiApiDeleteRelationTuplesRequest struct { - ctx context.Context - ApiService WriteApi - namespace *string - object *string - relation *string - subjectId *string - subjectSetNamespace *string - subjectSetObject *string - subjectSetRelation *string -} - -func (r WriteApiApiDeleteRelationTuplesRequest) Namespace(namespace string) WriteApiApiDeleteRelationTuplesRequest { - r.namespace = &namespace - return r -} -func (r WriteApiApiDeleteRelationTuplesRequest) Object(object string) WriteApiApiDeleteRelationTuplesRequest { - r.object = &object - return r -} -func (r WriteApiApiDeleteRelationTuplesRequest) Relation(relation string) WriteApiApiDeleteRelationTuplesRequest { - r.relation = &relation - return r -} -func (r WriteApiApiDeleteRelationTuplesRequest) SubjectId(subjectId string) WriteApiApiDeleteRelationTuplesRequest { - r.subjectId = &subjectId - return r -} -func (r WriteApiApiDeleteRelationTuplesRequest) SubjectSetNamespace(subjectSetNamespace string) WriteApiApiDeleteRelationTuplesRequest { - r.subjectSetNamespace = &subjectSetNamespace - return r -} -func (r WriteApiApiDeleteRelationTuplesRequest) SubjectSetObject(subjectSetObject string) WriteApiApiDeleteRelationTuplesRequest { - r.subjectSetObject = &subjectSetObject - return r -} -func (r WriteApiApiDeleteRelationTuplesRequest) SubjectSetRelation(subjectSetRelation string) WriteApiApiDeleteRelationTuplesRequest { - r.subjectSetRelation = &subjectSetRelation - return r -} - -func (r WriteApiApiDeleteRelationTuplesRequest) Execute() (*http.Response, error) { - return r.ApiService.DeleteRelationTuplesExecute(r) -} - -/* - * DeleteRelationTuples Delete Relation Tuples - * Use this endpoint to delete relation tuples - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return WriteApiApiDeleteRelationTuplesRequest - */ -func (a *WriteApiService) DeleteRelationTuples(ctx context.Context) WriteApiApiDeleteRelationTuplesRequest { - return WriteApiApiDeleteRelationTuplesRequest{ - ApiService: a, - ctx: ctx, - } -} - -/* - * Execute executes the request - */ -func (a *WriteApiService) DeleteRelationTuplesExecute(r WriteApiApiDeleteRelationTuplesRequest) (*http.Response, error) { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WriteApiService.DeleteRelationTuples") - if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/admin/relation-tuples" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if r.namespace != nil { - localVarQueryParams.Add("namespace", parameterToString(*r.namespace, "")) - } - if r.object != nil { - localVarQueryParams.Add("object", parameterToString(*r.object, "")) - } - if r.relation != nil { - localVarQueryParams.Add("relation", parameterToString(*r.relation, "")) - } - if r.subjectId != nil { - localVarQueryParams.Add("subject_id", parameterToString(*r.subjectId, "")) - } - if r.subjectSetNamespace != nil { - localVarQueryParams.Add("subject_set.namespace", parameterToString(*r.subjectSetNamespace, "")) - } - if r.subjectSetObject != nil { - localVarQueryParams.Add("subject_set.object", parameterToString(*r.subjectSetObject, "")) - } - if r.subjectSetRelation != nil { - localVarQueryParams.Add("subject_set.relation", parameterToString(*r.subjectSetRelation, "")) - } - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarHTTPResponse, newErr - } - newErr.model = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarHTTPResponse, newErr - } - newErr.model = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type WriteApiApiPatchRelationTuplesRequest struct { - ctx context.Context - ApiService WriteApi - patchDelta *[]PatchDelta -} - -func (r WriteApiApiPatchRelationTuplesRequest) PatchDelta(patchDelta []PatchDelta) WriteApiApiPatchRelationTuplesRequest { - r.patchDelta = &patchDelta - return r -} - -func (r WriteApiApiPatchRelationTuplesRequest) Execute() (*http.Response, error) { - return r.ApiService.PatchRelationTuplesExecute(r) -} - -/* - * PatchRelationTuples Patch Multiple Relation Tuples - * Use this endpoint to patch one or more relation tuples. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return WriteApiApiPatchRelationTuplesRequest - */ -func (a *WriteApiService) PatchRelationTuples(ctx context.Context) WriteApiApiPatchRelationTuplesRequest { - return WriteApiApiPatchRelationTuplesRequest{ - ApiService: a, - ctx: ctx, - } -} - -/* - * Execute executes the request - */ -func (a *WriteApiService) PatchRelationTuplesExecute(r WriteApiApiPatchRelationTuplesRequest) (*http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - localVarFormFileName string - localVarFileName string - localVarFileBytes []byte - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WriteApiService.PatchRelationTuples") - if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/admin/relation-tuples" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.patchDelta - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarHTTPResponse, newErr - } - newErr.model = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarHTTPResponse, newErr - } - newErr.model = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarHTTPResponse, newErr - } - newErr.model = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} diff --git a/internal/httpclient/client.go b/internal/httpclient/client.go index ca43fef98..667b007df 100644 --- a/internal/httpclient/client.go +++ b/internal/httpclient/client.go @@ -51,13 +51,9 @@ type APIClient struct { MetadataApi MetadataApi - NamespacesApi NamespacesApi + PermissionApi PermissionApi - ReadApi ReadApi - - SyntaxApi SyntaxApi - - WriteApi WriteApi + RelationshipApi RelationshipApi } type service struct { @@ -77,10 +73,8 @@ func NewAPIClient(cfg *Configuration) *APIClient { // API Services c.MetadataApi = (*MetadataApiService)(&c.common) - c.NamespacesApi = (*NamespacesApiService)(&c.common) - c.ReadApi = (*ReadApiService)(&c.common) - c.SyntaxApi = (*SyntaxApiService)(&c.common) - c.WriteApi = (*WriteApiService)(&c.common) + c.PermissionApi = (*PermissionApiService)(&c.common) + c.RelationshipApi = (*RelationshipApiService)(&c.common) return c } diff --git a/internal/httpclient/docs/PostCheckOplSyntaxResponse.md b/internal/httpclient/docs/CheckOplSyntaxResult.md similarity index 62% rename from internal/httpclient/docs/PostCheckOplSyntaxResponse.md rename to internal/httpclient/docs/CheckOplSyntaxResult.md index 62e08beb3..38cbe373e 100644 --- a/internal/httpclient/docs/PostCheckOplSyntaxResponse.md +++ b/internal/httpclient/docs/CheckOplSyntaxResult.md @@ -1,4 +1,4 @@ -# PostCheckOplSyntaxResponse +# CheckOplSyntaxResult ## Properties @@ -8,45 +8,45 @@ Name | Type | Description | Notes ## Methods -### NewPostCheckOplSyntaxResponse +### NewCheckOplSyntaxResult -`func NewPostCheckOplSyntaxResponse() *PostCheckOplSyntaxResponse` +`func NewCheckOplSyntaxResult() *CheckOplSyntaxResult` -NewPostCheckOplSyntaxResponse instantiates a new PostCheckOplSyntaxResponse object +NewCheckOplSyntaxResult instantiates a new CheckOplSyntaxResult object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewPostCheckOplSyntaxResponseWithDefaults +### NewCheckOplSyntaxResultWithDefaults -`func NewPostCheckOplSyntaxResponseWithDefaults() *PostCheckOplSyntaxResponse` +`func NewCheckOplSyntaxResultWithDefaults() *CheckOplSyntaxResult` -NewPostCheckOplSyntaxResponseWithDefaults instantiates a new PostCheckOplSyntaxResponse object +NewCheckOplSyntaxResultWithDefaults instantiates a new CheckOplSyntaxResult object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetErrors -`func (o *PostCheckOplSyntaxResponse) GetErrors() []ParseError` +`func (o *CheckOplSyntaxResult) GetErrors() []ParseError` GetErrors returns the Errors field if non-nil, zero value otherwise. ### GetErrorsOk -`func (o *PostCheckOplSyntaxResponse) GetErrorsOk() (*[]ParseError, bool)` +`func (o *CheckOplSyntaxResult) GetErrorsOk() (*[]ParseError, bool)` GetErrorsOk returns a tuple with the Errors field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetErrors -`func (o *PostCheckOplSyntaxResponse) SetErrors(v []ParseError)` +`func (o *CheckOplSyntaxResult) SetErrors(v []ParseError)` SetErrors sets Errors field to given value. ### HasErrors -`func (o *PostCheckOplSyntaxResponse) HasErrors() bool` +`func (o *CheckOplSyntaxResult) HasErrors() bool` HasErrors returns a boolean if a field has been set. diff --git a/internal/httpclient/docs/GetCheckResponse.md b/internal/httpclient/docs/CheckPermissionResult.md similarity index 65% rename from internal/httpclient/docs/GetCheckResponse.md rename to internal/httpclient/docs/CheckPermissionResult.md index d3d3b84b9..7270de65d 100644 --- a/internal/httpclient/docs/GetCheckResponse.md +++ b/internal/httpclient/docs/CheckPermissionResult.md @@ -1,4 +1,4 @@ -# GetCheckResponse +# CheckPermissionResult ## Properties @@ -8,39 +8,39 @@ Name | Type | Description | Notes ## Methods -### NewGetCheckResponse +### NewCheckPermissionResult -`func NewGetCheckResponse(allowed bool, ) *GetCheckResponse` +`func NewCheckPermissionResult(allowed bool, ) *CheckPermissionResult` -NewGetCheckResponse instantiates a new GetCheckResponse object +NewCheckPermissionResult instantiates a new CheckPermissionResult object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewGetCheckResponseWithDefaults +### NewCheckPermissionResultWithDefaults -`func NewGetCheckResponseWithDefaults() *GetCheckResponse` +`func NewCheckPermissionResultWithDefaults() *CheckPermissionResult` -NewGetCheckResponseWithDefaults instantiates a new GetCheckResponse object +NewCheckPermissionResultWithDefaults instantiates a new CheckPermissionResult object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetAllowed -`func (o *GetCheckResponse) GetAllowed() bool` +`func (o *CheckPermissionResult) GetAllowed() bool` GetAllowed returns the Allowed field if non-nil, zero value otherwise. ### GetAllowedOk -`func (o *GetCheckResponse) GetAllowedOk() (*bool, bool)` +`func (o *CheckPermissionResult) GetAllowedOk() (*bool, bool)` GetAllowedOk returns a tuple with the Allowed field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetAllowed -`func (o *GetCheckResponse) SetAllowed(v bool)` +`func (o *CheckPermissionResult) SetAllowed(v bool)` SetAllowed sets Allowed field to given value. diff --git a/internal/httpclient/docs/CreateRelationshipBody.md b/internal/httpclient/docs/CreateRelationshipBody.md new file mode 100644 index 000000000..91bb3a7ce --- /dev/null +++ b/internal/httpclient/docs/CreateRelationshipBody.md @@ -0,0 +1,160 @@ +# CreateRelationshipBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Namespace** | Pointer to **string** | Namespace to query | [optional] +**Object** | Pointer to **string** | Object to query | [optional] +**Relation** | Pointer to **string** | Relation to query | [optional] +**SubjectId** | Pointer to **string** | SubjectID to query Either SubjectSet or SubjectID can be provided. | [optional] +**SubjectSet** | Pointer to [**SubjectSet**](SubjectSet.md) | | [optional] + +## Methods + +### NewCreateRelationshipBody + +`func NewCreateRelationshipBody() *CreateRelationshipBody` + +NewCreateRelationshipBody instantiates a new CreateRelationshipBody object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewCreateRelationshipBodyWithDefaults + +`func NewCreateRelationshipBodyWithDefaults() *CreateRelationshipBody` + +NewCreateRelationshipBodyWithDefaults instantiates a new CreateRelationshipBody object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetNamespace + +`func (o *CreateRelationshipBody) GetNamespace() string` + +GetNamespace returns the Namespace field if non-nil, zero value otherwise. + +### GetNamespaceOk + +`func (o *CreateRelationshipBody) GetNamespaceOk() (*string, bool)` + +GetNamespaceOk returns a tuple with the Namespace field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNamespace + +`func (o *CreateRelationshipBody) SetNamespace(v string)` + +SetNamespace sets Namespace field to given value. + +### HasNamespace + +`func (o *CreateRelationshipBody) HasNamespace() bool` + +HasNamespace returns a boolean if a field has been set. + +### GetObject + +`func (o *CreateRelationshipBody) GetObject() string` + +GetObject returns the Object field if non-nil, zero value otherwise. + +### GetObjectOk + +`func (o *CreateRelationshipBody) GetObjectOk() (*string, bool)` + +GetObjectOk returns a tuple with the Object field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObject + +`func (o *CreateRelationshipBody) SetObject(v string)` + +SetObject sets Object field to given value. + +### HasObject + +`func (o *CreateRelationshipBody) HasObject() bool` + +HasObject returns a boolean if a field has been set. + +### GetRelation + +`func (o *CreateRelationshipBody) GetRelation() string` + +GetRelation returns the Relation field if non-nil, zero value otherwise. + +### GetRelationOk + +`func (o *CreateRelationshipBody) GetRelationOk() (*string, bool)` + +GetRelationOk returns a tuple with the Relation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRelation + +`func (o *CreateRelationshipBody) SetRelation(v string)` + +SetRelation sets Relation field to given value. + +### HasRelation + +`func (o *CreateRelationshipBody) HasRelation() bool` + +HasRelation returns a boolean if a field has been set. + +### GetSubjectId + +`func (o *CreateRelationshipBody) GetSubjectId() string` + +GetSubjectId returns the SubjectId field if non-nil, zero value otherwise. + +### GetSubjectIdOk + +`func (o *CreateRelationshipBody) GetSubjectIdOk() (*string, bool)` + +GetSubjectIdOk returns a tuple with the SubjectId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSubjectId + +`func (o *CreateRelationshipBody) SetSubjectId(v string)` + +SetSubjectId sets SubjectId field to given value. + +### HasSubjectId + +`func (o *CreateRelationshipBody) HasSubjectId() bool` + +HasSubjectId returns a boolean if a field has been set. + +### GetSubjectSet + +`func (o *CreateRelationshipBody) GetSubjectSet() SubjectSet` + +GetSubjectSet returns the SubjectSet field if non-nil, zero value otherwise. + +### GetSubjectSetOk + +`func (o *CreateRelationshipBody) GetSubjectSetOk() (*SubjectSet, bool)` + +GetSubjectSetOk returns a tuple with the SubjectSet field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSubjectSet + +`func (o *CreateRelationshipBody) SetSubjectSet(v SubjectSet)` + +SetSubjectSet sets SubjectSet field to given value. + +### HasSubjectSet + +`func (o *CreateRelationshipBody) HasSubjectSet() bool` + +HasSubjectSet returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/httpclient/docs/ErrorGeneric.md b/internal/httpclient/docs/ErrorGeneric.md new file mode 100644 index 000000000..a340c2c07 --- /dev/null +++ b/internal/httpclient/docs/ErrorGeneric.md @@ -0,0 +1,51 @@ +# ErrorGeneric + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Error** | [**GenericError**](GenericError.md) | | + +## Methods + +### NewErrorGeneric + +`func NewErrorGeneric(error_ GenericError, ) *ErrorGeneric` + +NewErrorGeneric instantiates a new ErrorGeneric object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewErrorGenericWithDefaults + +`func NewErrorGenericWithDefaults() *ErrorGeneric` + +NewErrorGenericWithDefaults instantiates a new ErrorGeneric object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetError + +`func (o *ErrorGeneric) GetError() GenericError` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *ErrorGeneric) GetErrorOk() (*GenericError, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *ErrorGeneric) SetError(v GenericError)` + +SetError sets Error field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/httpclient/docs/ExpandTree.md b/internal/httpclient/docs/ExpandedPermissionTree.md similarity index 60% rename from internal/httpclient/docs/ExpandTree.md rename to internal/httpclient/docs/ExpandedPermissionTree.md index d39d703e7..3c087822d 100644 --- a/internal/httpclient/docs/ExpandTree.md +++ b/internal/httpclient/docs/ExpandedPermissionTree.md @@ -1,98 +1,98 @@ -# ExpandTree +# ExpandedPermissionTree ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Children** | Pointer to [**[]ExpandTree**](ExpandTree.md) | The children of the node, possibly none. | [optional] -**Tuple** | Pointer to [**RelationTuple**](RelationTuple.md) | | [optional] +**Children** | Pointer to [**[]ExpandedPermissionTree**](ExpandedPermissionTree.md) | The children of the node, possibly none. | [optional] +**Tuple** | Pointer to [**Relationship**](Relationship.md) | | [optional] **Type** | **string** | The type of the node. union TreeNodeUnion exclusion TreeNodeExclusion intersection TreeNodeIntersection leaf TreeNodeLeaf tuple_to_subject_set TreeNodeTupleToSubjectSet computed_subject_set TreeNodeComputedSubjectSet not TreeNodeNot unspecified TreeNodeUnspecified | ## Methods -### NewExpandTree +### NewExpandedPermissionTree -`func NewExpandTree(type_ string, ) *ExpandTree` +`func NewExpandedPermissionTree(type_ string, ) *ExpandedPermissionTree` -NewExpandTree instantiates a new ExpandTree object +NewExpandedPermissionTree instantiates a new ExpandedPermissionTree object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewExpandTreeWithDefaults +### NewExpandedPermissionTreeWithDefaults -`func NewExpandTreeWithDefaults() *ExpandTree` +`func NewExpandedPermissionTreeWithDefaults() *ExpandedPermissionTree` -NewExpandTreeWithDefaults instantiates a new ExpandTree object +NewExpandedPermissionTreeWithDefaults instantiates a new ExpandedPermissionTree object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetChildren -`func (o *ExpandTree) GetChildren() []ExpandTree` +`func (o *ExpandedPermissionTree) GetChildren() []ExpandedPermissionTree` GetChildren returns the Children field if non-nil, zero value otherwise. ### GetChildrenOk -`func (o *ExpandTree) GetChildrenOk() (*[]ExpandTree, bool)` +`func (o *ExpandedPermissionTree) GetChildrenOk() (*[]ExpandedPermissionTree, bool)` GetChildrenOk returns a tuple with the Children field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetChildren -`func (o *ExpandTree) SetChildren(v []ExpandTree)` +`func (o *ExpandedPermissionTree) SetChildren(v []ExpandedPermissionTree)` SetChildren sets Children field to given value. ### HasChildren -`func (o *ExpandTree) HasChildren() bool` +`func (o *ExpandedPermissionTree) HasChildren() bool` HasChildren returns a boolean if a field has been set. ### GetTuple -`func (o *ExpandTree) GetTuple() RelationTuple` +`func (o *ExpandedPermissionTree) GetTuple() Relationship` GetTuple returns the Tuple field if non-nil, zero value otherwise. ### GetTupleOk -`func (o *ExpandTree) GetTupleOk() (*RelationTuple, bool)` +`func (o *ExpandedPermissionTree) GetTupleOk() (*Relationship, bool)` GetTupleOk returns a tuple with the Tuple field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTuple -`func (o *ExpandTree) SetTuple(v RelationTuple)` +`func (o *ExpandedPermissionTree) SetTuple(v Relationship)` SetTuple sets Tuple field to given value. ### HasTuple -`func (o *ExpandTree) HasTuple() bool` +`func (o *ExpandedPermissionTree) HasTuple() bool` HasTuple returns a boolean if a field has been set. ### GetType -`func (o *ExpandTree) GetType() string` +`func (o *ExpandedPermissionTree) GetType() string` GetType returns the Type field if non-nil, zero value otherwise. ### GetTypeOk -`func (o *ExpandTree) GetTypeOk() (*string, bool)` +`func (o *ExpandedPermissionTree) GetTypeOk() (*string, bool)` GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetType -`func (o *ExpandTree) SetType(v string)` +`func (o *ExpandedPermissionTree) SetType(v string)` SetType sets Type field to given value. diff --git a/internal/httpclient/docs/GenericError.md b/internal/httpclient/docs/GenericError.md index 34626eacf..5a09d7392 100644 --- a/internal/httpclient/docs/GenericError.md +++ b/internal/httpclient/docs/GenericError.md @@ -4,18 +4,20 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Code** | Pointer to **int64** | | [optional] -**Details** | Pointer to **[]map[string]interface{}** | | [optional] -**Message** | Pointer to **string** | | [optional] -**Reason** | Pointer to **string** | | [optional] -**Request** | Pointer to **string** | | [optional] -**Status** | Pointer to **string** | | [optional] +**Code** | Pointer to **int64** | The status code | [optional] +**Debug** | Pointer to **string** | Debug information This field is often not exposed to protect against leaking sensitive information. | [optional] +**Details** | Pointer to **map[string]interface{}** | Further error details | [optional] +**Id** | Pointer to **string** | The error ID Useful when trying to identify various errors in application logic. | [optional] +**Message** | **string** | Error message The error's message. | +**Reason** | Pointer to **string** | A human-readable reason for the error | [optional] +**Request** | Pointer to **string** | The request ID The request ID is often exposed internally in order to trace errors across service architectures. This is often a UUID. | [optional] +**Status** | Pointer to **string** | The status description | [optional] ## Methods ### NewGenericError -`func NewGenericError() *GenericError` +`func NewGenericError(message string, ) *GenericError` NewGenericError instantiates a new GenericError object This constructor will assign default values to properties that have it defined, @@ -55,22 +57,47 @@ SetCode sets Code field to given value. HasCode returns a boolean if a field has been set. +### GetDebug + +`func (o *GenericError) GetDebug() string` + +GetDebug returns the Debug field if non-nil, zero value otherwise. + +### GetDebugOk + +`func (o *GenericError) GetDebugOk() (*string, bool)` + +GetDebugOk returns a tuple with the Debug field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDebug + +`func (o *GenericError) SetDebug(v string)` + +SetDebug sets Debug field to given value. + +### HasDebug + +`func (o *GenericError) HasDebug() bool` + +HasDebug returns a boolean if a field has been set. + ### GetDetails -`func (o *GenericError) GetDetails() []map[string]interface{}` +`func (o *GenericError) GetDetails() map[string]interface{}` GetDetails returns the Details field if non-nil, zero value otherwise. ### GetDetailsOk -`func (o *GenericError) GetDetailsOk() (*[]map[string]interface{}, bool)` +`func (o *GenericError) GetDetailsOk() (*map[string]interface{}, bool)` GetDetailsOk returns a tuple with the Details field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetDetails -`func (o *GenericError) SetDetails(v []map[string]interface{})` +`func (o *GenericError) SetDetails(v map[string]interface{})` SetDetails sets Details field to given value. @@ -80,6 +107,31 @@ SetDetails sets Details field to given value. HasDetails returns a boolean if a field has been set. +### GetId + +`func (o *GenericError) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *GenericError) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *GenericError) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *GenericError) HasId() bool` + +HasId returns a boolean if a field has been set. + ### GetMessage `func (o *GenericError) GetMessage() string` @@ -99,11 +151,6 @@ and a boolean to check if the value has been set. SetMessage sets Message field to given value. -### HasMessage - -`func (o *GenericError) HasMessage() bool` - -HasMessage returns a boolean if a field has been set. ### GetReason diff --git a/internal/httpclient/docs/NamespacesApi.md b/internal/httpclient/docs/NamespacesApi.md deleted file mode 100644 index 27c4fc62c..000000000 --- a/internal/httpclient/docs/NamespacesApi.md +++ /dev/null @@ -1,70 +0,0 @@ -# \NamespacesApi - -All URIs are relative to *http://localhost* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**GetNamespaces**](NamespacesApi.md#GetNamespaces) | **Get** /namespaces | Query namespaces - - - -## GetNamespaces - -> GetNamespacesResponse GetNamespaces(ctx).Execute() - -Query namespaces - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.NamespacesApi.GetNamespaces(context.Background()).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `NamespacesApi.GetNamespaces``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GetNamespaces`: GetNamespacesResponse - fmt.Fprintf(os.Stdout, "Response from `NamespacesApi.GetNamespaces`: %v\n", resp) -} -``` - -### Path Parameters - -This endpoint does not need any parameter. - -### Other Parameters - -Other parameters are passed through a pointer to a apiGetNamespacesRequest struct via the builder pattern - - -### Return type - -[**GetNamespacesResponse**](GetNamespacesResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - diff --git a/internal/httpclient/docs/PermissionApi.md b/internal/httpclient/docs/PermissionApi.md new file mode 100644 index 000000000..c9bcf6e5f --- /dev/null +++ b/internal/httpclient/docs/PermissionApi.md @@ -0,0 +1,381 @@ +# \PermissionApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CheckPermission**](PermissionApi.md#CheckPermission) | **Get** /relation-tuples/check/openapi | Check a permission +[**CheckPermissionOrError**](PermissionApi.md#CheckPermissionOrError) | **Get** /relation-tuples/check | Check a permission +[**ExpandPermissions**](PermissionApi.md#ExpandPermissions) | **Get** /relation-tuples/expand | Expand a Relationship into permissions. +[**PostCheckPermission**](PermissionApi.md#PostCheckPermission) | **Post** /relation-tuples/check/openapi | Check a permission +[**PostCheckPermissionOrError**](PermissionApi.md#PostCheckPermissionOrError) | **Post** /relation-tuples/check | Check a permission + + + +## CheckPermission + +> CheckPermissionResult CheckPermission(ctx).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).MaxDepth(maxDepth).Execute() + +Check a permission + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + namespace := "namespace_example" // string | Namespace of the Relationship (optional) + object := "object_example" // string | Object of the Relationship (optional) + relation := "relation_example" // string | Relation of the Relationship (optional) + subjectId := "subjectId_example" // string | SubjectID of the Relationship (optional) + subjectSetNamespace := "subjectSetNamespace_example" // string | Namespace of the Subject Set (optional) + subjectSetObject := "subjectSetObject_example" // string | Object of the Subject Set (optional) + subjectSetRelation := "subjectSetRelation_example" // string | Relation of the Subject Set (optional) + maxDepth := int64(789) // int64 | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PermissionApi.CheckPermission(context.Background()).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).MaxDepth(maxDepth).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PermissionApi.CheckPermission``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CheckPermission`: CheckPermissionResult + fmt.Fprintf(os.Stdout, "Response from `PermissionApi.CheckPermission`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCheckPermissionRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **namespace** | **string** | Namespace of the Relationship | + **object** | **string** | Object of the Relationship | + **relation** | **string** | Relation of the Relationship | + **subjectId** | **string** | SubjectID of the Relationship | + **subjectSetNamespace** | **string** | Namespace of the Subject Set | + **subjectSetObject** | **string** | Object of the Subject Set | + **subjectSetRelation** | **string** | Relation of the Subject Set | + **maxDepth** | **int64** | | + +### Return type + +[**CheckPermissionResult**](CheckPermissionResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CheckPermissionOrError + +> CheckPermissionResult CheckPermissionOrError(ctx).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).MaxDepth(maxDepth).Execute() + +Check a permission + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + namespace := "namespace_example" // string | Namespace of the Relationship (optional) + object := "object_example" // string | Object of the Relationship (optional) + relation := "relation_example" // string | Relation of the Relationship (optional) + subjectId := "subjectId_example" // string | SubjectID of the Relationship (optional) + subjectSetNamespace := "subjectSetNamespace_example" // string | Namespace of the Subject Set (optional) + subjectSetObject := "subjectSetObject_example" // string | Object of the Subject Set (optional) + subjectSetRelation := "subjectSetRelation_example" // string | Relation of the Subject Set (optional) + maxDepth := int64(789) // int64 | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PermissionApi.CheckPermissionOrError(context.Background()).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).MaxDepth(maxDepth).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PermissionApi.CheckPermissionOrError``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CheckPermissionOrError`: CheckPermissionResult + fmt.Fprintf(os.Stdout, "Response from `PermissionApi.CheckPermissionOrError`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCheckPermissionOrErrorRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **namespace** | **string** | Namespace of the Relationship | + **object** | **string** | Object of the Relationship | + **relation** | **string** | Relation of the Relationship | + **subjectId** | **string** | SubjectID of the Relationship | + **subjectSetNamespace** | **string** | Namespace of the Subject Set | + **subjectSetObject** | **string** | Object of the Subject Set | + **subjectSetRelation** | **string** | Relation of the Subject Set | + **maxDepth** | **int64** | | + +### Return type + +[**CheckPermissionResult**](CheckPermissionResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ExpandPermissions + +> ExpandedPermissionTree ExpandPermissions(ctx).Namespace(namespace).Object(object).Relation(relation).MaxDepth(maxDepth).Execute() + +Expand a Relationship into permissions. + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + namespace := "namespace_example" // string | Namespace of the Subject Set + object := "object_example" // string | Object of the Subject Set + relation := "relation_example" // string | Relation of the Subject Set + maxDepth := int64(789) // int64 | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PermissionApi.ExpandPermissions(context.Background()).Namespace(namespace).Object(object).Relation(relation).MaxDepth(maxDepth).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PermissionApi.ExpandPermissions``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ExpandPermissions`: ExpandedPermissionTree + fmt.Fprintf(os.Stdout, "Response from `PermissionApi.ExpandPermissions`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiExpandPermissionsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **namespace** | **string** | Namespace of the Subject Set | + **object** | **string** | Object of the Subject Set | + **relation** | **string** | Relation of the Subject Set | + **maxDepth** | **int64** | | + +### Return type + +[**ExpandedPermissionTree**](ExpandedPermissionTree.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## PostCheckPermission + +> CheckPermissionResult PostCheckPermission(ctx).MaxDepth(maxDepth).PostCheckPermissionBody(postCheckPermissionBody).Execute() + +Check a permission + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + maxDepth := int64(789) // int64 | (optional) + postCheckPermissionBody := *openapiclient.NewPostCheckPermissionBody() // PostCheckPermissionBody | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PermissionApi.PostCheckPermission(context.Background()).MaxDepth(maxDepth).PostCheckPermissionBody(postCheckPermissionBody).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PermissionApi.PostCheckPermission``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `PostCheckPermission`: CheckPermissionResult + fmt.Fprintf(os.Stdout, "Response from `PermissionApi.PostCheckPermission`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiPostCheckPermissionRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **maxDepth** | **int64** | | + **postCheckPermissionBody** | [**PostCheckPermissionBody**](PostCheckPermissionBody.md) | | + +### Return type + +[**CheckPermissionResult**](CheckPermissionResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## PostCheckPermissionOrError + +> CheckPermissionResult PostCheckPermissionOrError(ctx).MaxDepth(maxDepth).PostCheckPermissionOrErrorBody(postCheckPermissionOrErrorBody).Execute() + +Check a permission + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + maxDepth := int64(789) // int64 | (optional) + postCheckPermissionOrErrorBody := *openapiclient.NewPostCheckPermissionOrErrorBody() // PostCheckPermissionOrErrorBody | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PermissionApi.PostCheckPermissionOrError(context.Background()).MaxDepth(maxDepth).PostCheckPermissionOrErrorBody(postCheckPermissionOrErrorBody).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PermissionApi.PostCheckPermissionOrError``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `PostCheckPermissionOrError`: CheckPermissionResult + fmt.Fprintf(os.Stdout, "Response from `PermissionApi.PostCheckPermissionOrError`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiPostCheckPermissionOrErrorRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **maxDepth** | **int64** | | + **postCheckPermissionOrErrorBody** | [**PostCheckPermissionOrErrorBody**](PostCheckPermissionOrErrorBody.md) | | + +### Return type + +[**CheckPermissionResult**](CheckPermissionResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/internal/httpclient/docs/PostCheckPermissionBody.md b/internal/httpclient/docs/PostCheckPermissionBody.md new file mode 100644 index 000000000..852cc00c3 --- /dev/null +++ b/internal/httpclient/docs/PostCheckPermissionBody.md @@ -0,0 +1,160 @@ +# PostCheckPermissionBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Namespace** | Pointer to **string** | Namespace to query | [optional] +**Object** | Pointer to **string** | Object to query | [optional] +**Relation** | Pointer to **string** | Relation to query | [optional] +**SubjectId** | Pointer to **string** | SubjectID to query Either SubjectSet or SubjectID can be provided. | [optional] +**SubjectSet** | Pointer to [**SubjectSet**](SubjectSet.md) | | [optional] + +## Methods + +### NewPostCheckPermissionBody + +`func NewPostCheckPermissionBody() *PostCheckPermissionBody` + +NewPostCheckPermissionBody instantiates a new PostCheckPermissionBody object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewPostCheckPermissionBodyWithDefaults + +`func NewPostCheckPermissionBodyWithDefaults() *PostCheckPermissionBody` + +NewPostCheckPermissionBodyWithDefaults instantiates a new PostCheckPermissionBody object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetNamespace + +`func (o *PostCheckPermissionBody) GetNamespace() string` + +GetNamespace returns the Namespace field if non-nil, zero value otherwise. + +### GetNamespaceOk + +`func (o *PostCheckPermissionBody) GetNamespaceOk() (*string, bool)` + +GetNamespaceOk returns a tuple with the Namespace field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNamespace + +`func (o *PostCheckPermissionBody) SetNamespace(v string)` + +SetNamespace sets Namespace field to given value. + +### HasNamespace + +`func (o *PostCheckPermissionBody) HasNamespace() bool` + +HasNamespace returns a boolean if a field has been set. + +### GetObject + +`func (o *PostCheckPermissionBody) GetObject() string` + +GetObject returns the Object field if non-nil, zero value otherwise. + +### GetObjectOk + +`func (o *PostCheckPermissionBody) GetObjectOk() (*string, bool)` + +GetObjectOk returns a tuple with the Object field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObject + +`func (o *PostCheckPermissionBody) SetObject(v string)` + +SetObject sets Object field to given value. + +### HasObject + +`func (o *PostCheckPermissionBody) HasObject() bool` + +HasObject returns a boolean if a field has been set. + +### GetRelation + +`func (o *PostCheckPermissionBody) GetRelation() string` + +GetRelation returns the Relation field if non-nil, zero value otherwise. + +### GetRelationOk + +`func (o *PostCheckPermissionBody) GetRelationOk() (*string, bool)` + +GetRelationOk returns a tuple with the Relation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRelation + +`func (o *PostCheckPermissionBody) SetRelation(v string)` + +SetRelation sets Relation field to given value. + +### HasRelation + +`func (o *PostCheckPermissionBody) HasRelation() bool` + +HasRelation returns a boolean if a field has been set. + +### GetSubjectId + +`func (o *PostCheckPermissionBody) GetSubjectId() string` + +GetSubjectId returns the SubjectId field if non-nil, zero value otherwise. + +### GetSubjectIdOk + +`func (o *PostCheckPermissionBody) GetSubjectIdOk() (*string, bool)` + +GetSubjectIdOk returns a tuple with the SubjectId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSubjectId + +`func (o *PostCheckPermissionBody) SetSubjectId(v string)` + +SetSubjectId sets SubjectId field to given value. + +### HasSubjectId + +`func (o *PostCheckPermissionBody) HasSubjectId() bool` + +HasSubjectId returns a boolean if a field has been set. + +### GetSubjectSet + +`func (o *PostCheckPermissionBody) GetSubjectSet() SubjectSet` + +GetSubjectSet returns the SubjectSet field if non-nil, zero value otherwise. + +### GetSubjectSetOk + +`func (o *PostCheckPermissionBody) GetSubjectSetOk() (*SubjectSet, bool)` + +GetSubjectSetOk returns a tuple with the SubjectSet field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSubjectSet + +`func (o *PostCheckPermissionBody) SetSubjectSet(v SubjectSet)` + +SetSubjectSet sets SubjectSet field to given value. + +### HasSubjectSet + +`func (o *PostCheckPermissionBody) HasSubjectSet() bool` + +HasSubjectSet returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/httpclient/docs/PostCheckPermissionOrErrorBody.md b/internal/httpclient/docs/PostCheckPermissionOrErrorBody.md new file mode 100644 index 000000000..821c2a53f --- /dev/null +++ b/internal/httpclient/docs/PostCheckPermissionOrErrorBody.md @@ -0,0 +1,160 @@ +# PostCheckPermissionOrErrorBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Namespace** | Pointer to **string** | Namespace to query | [optional] +**Object** | Pointer to **string** | Object to query | [optional] +**Relation** | Pointer to **string** | Relation to query | [optional] +**SubjectId** | Pointer to **string** | SubjectID to query Either SubjectSet or SubjectID can be provided. | [optional] +**SubjectSet** | Pointer to [**SubjectSet**](SubjectSet.md) | | [optional] + +## Methods + +### NewPostCheckPermissionOrErrorBody + +`func NewPostCheckPermissionOrErrorBody() *PostCheckPermissionOrErrorBody` + +NewPostCheckPermissionOrErrorBody instantiates a new PostCheckPermissionOrErrorBody object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewPostCheckPermissionOrErrorBodyWithDefaults + +`func NewPostCheckPermissionOrErrorBodyWithDefaults() *PostCheckPermissionOrErrorBody` + +NewPostCheckPermissionOrErrorBodyWithDefaults instantiates a new PostCheckPermissionOrErrorBody object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetNamespace + +`func (o *PostCheckPermissionOrErrorBody) GetNamespace() string` + +GetNamespace returns the Namespace field if non-nil, zero value otherwise. + +### GetNamespaceOk + +`func (o *PostCheckPermissionOrErrorBody) GetNamespaceOk() (*string, bool)` + +GetNamespaceOk returns a tuple with the Namespace field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNamespace + +`func (o *PostCheckPermissionOrErrorBody) SetNamespace(v string)` + +SetNamespace sets Namespace field to given value. + +### HasNamespace + +`func (o *PostCheckPermissionOrErrorBody) HasNamespace() bool` + +HasNamespace returns a boolean if a field has been set. + +### GetObject + +`func (o *PostCheckPermissionOrErrorBody) GetObject() string` + +GetObject returns the Object field if non-nil, zero value otherwise. + +### GetObjectOk + +`func (o *PostCheckPermissionOrErrorBody) GetObjectOk() (*string, bool)` + +GetObjectOk returns a tuple with the Object field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObject + +`func (o *PostCheckPermissionOrErrorBody) SetObject(v string)` + +SetObject sets Object field to given value. + +### HasObject + +`func (o *PostCheckPermissionOrErrorBody) HasObject() bool` + +HasObject returns a boolean if a field has been set. + +### GetRelation + +`func (o *PostCheckPermissionOrErrorBody) GetRelation() string` + +GetRelation returns the Relation field if non-nil, zero value otherwise. + +### GetRelationOk + +`func (o *PostCheckPermissionOrErrorBody) GetRelationOk() (*string, bool)` + +GetRelationOk returns a tuple with the Relation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRelation + +`func (o *PostCheckPermissionOrErrorBody) SetRelation(v string)` + +SetRelation sets Relation field to given value. + +### HasRelation + +`func (o *PostCheckPermissionOrErrorBody) HasRelation() bool` + +HasRelation returns a boolean if a field has been set. + +### GetSubjectId + +`func (o *PostCheckPermissionOrErrorBody) GetSubjectId() string` + +GetSubjectId returns the SubjectId field if non-nil, zero value otherwise. + +### GetSubjectIdOk + +`func (o *PostCheckPermissionOrErrorBody) GetSubjectIdOk() (*string, bool)` + +GetSubjectIdOk returns a tuple with the SubjectId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSubjectId + +`func (o *PostCheckPermissionOrErrorBody) SetSubjectId(v string)` + +SetSubjectId sets SubjectId field to given value. + +### HasSubjectId + +`func (o *PostCheckPermissionOrErrorBody) HasSubjectId() bool` + +HasSubjectId returns a boolean if a field has been set. + +### GetSubjectSet + +`func (o *PostCheckPermissionOrErrorBody) GetSubjectSet() SubjectSet` + +GetSubjectSet returns the SubjectSet field if non-nil, zero value otherwise. + +### GetSubjectSetOk + +`func (o *PostCheckPermissionOrErrorBody) GetSubjectSetOk() (*SubjectSet, bool)` + +GetSubjectSetOk returns a tuple with the SubjectSet field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSubjectSet + +`func (o *PostCheckPermissionOrErrorBody) SetSubjectSet(v SubjectSet)` + +SetSubjectSet sets SubjectSet field to given value. + +### HasSubjectSet + +`func (o *PostCheckPermissionOrErrorBody) HasSubjectSet() bool` + +HasSubjectSet returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/internal/httpclient/docs/RelationTuple.md b/internal/httpclient/docs/Relationship.md similarity index 70% rename from internal/httpclient/docs/RelationTuple.md rename to internal/httpclient/docs/Relationship.md index ae860cbbb..6ac130452 100644 --- a/internal/httpclient/docs/RelationTuple.md +++ b/internal/httpclient/docs/Relationship.md @@ -1,4 +1,4 @@ -# RelationTuple +# Relationship ## Properties @@ -12,130 +12,130 @@ Name | Type | Description | Notes ## Methods -### NewRelationTuple +### NewRelationship -`func NewRelationTuple(namespace string, object string, relation string, ) *RelationTuple` +`func NewRelationship(namespace string, object string, relation string, ) *Relationship` -NewRelationTuple instantiates a new RelationTuple object +NewRelationship instantiates a new Relationship object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewRelationTupleWithDefaults +### NewRelationshipWithDefaults -`func NewRelationTupleWithDefaults() *RelationTuple` +`func NewRelationshipWithDefaults() *Relationship` -NewRelationTupleWithDefaults instantiates a new RelationTuple object +NewRelationshipWithDefaults instantiates a new Relationship object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetNamespace -`func (o *RelationTuple) GetNamespace() string` +`func (o *Relationship) GetNamespace() string` GetNamespace returns the Namespace field if non-nil, zero value otherwise. ### GetNamespaceOk -`func (o *RelationTuple) GetNamespaceOk() (*string, bool)` +`func (o *Relationship) GetNamespaceOk() (*string, bool)` GetNamespaceOk returns a tuple with the Namespace field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetNamespace -`func (o *RelationTuple) SetNamespace(v string)` +`func (o *Relationship) SetNamespace(v string)` SetNamespace sets Namespace field to given value. ### GetObject -`func (o *RelationTuple) GetObject() string` +`func (o *Relationship) GetObject() string` GetObject returns the Object field if non-nil, zero value otherwise. ### GetObjectOk -`func (o *RelationTuple) GetObjectOk() (*string, bool)` +`func (o *Relationship) GetObjectOk() (*string, bool)` GetObjectOk returns a tuple with the Object field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetObject -`func (o *RelationTuple) SetObject(v string)` +`func (o *Relationship) SetObject(v string)` SetObject sets Object field to given value. ### GetRelation -`func (o *RelationTuple) GetRelation() string` +`func (o *Relationship) GetRelation() string` GetRelation returns the Relation field if non-nil, zero value otherwise. ### GetRelationOk -`func (o *RelationTuple) GetRelationOk() (*string, bool)` +`func (o *Relationship) GetRelationOk() (*string, bool)` GetRelationOk returns a tuple with the Relation field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetRelation -`func (o *RelationTuple) SetRelation(v string)` +`func (o *Relationship) SetRelation(v string)` SetRelation sets Relation field to given value. ### GetSubjectId -`func (o *RelationTuple) GetSubjectId() string` +`func (o *Relationship) GetSubjectId() string` GetSubjectId returns the SubjectId field if non-nil, zero value otherwise. ### GetSubjectIdOk -`func (o *RelationTuple) GetSubjectIdOk() (*string, bool)` +`func (o *Relationship) GetSubjectIdOk() (*string, bool)` GetSubjectIdOk returns a tuple with the SubjectId field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetSubjectId -`func (o *RelationTuple) SetSubjectId(v string)` +`func (o *Relationship) SetSubjectId(v string)` SetSubjectId sets SubjectId field to given value. ### HasSubjectId -`func (o *RelationTuple) HasSubjectId() bool` +`func (o *Relationship) HasSubjectId() bool` HasSubjectId returns a boolean if a field has been set. ### GetSubjectSet -`func (o *RelationTuple) GetSubjectSet() SubjectSet` +`func (o *Relationship) GetSubjectSet() SubjectSet` GetSubjectSet returns the SubjectSet field if non-nil, zero value otherwise. ### GetSubjectSetOk -`func (o *RelationTuple) GetSubjectSetOk() (*SubjectSet, bool)` +`func (o *Relationship) GetSubjectSetOk() (*SubjectSet, bool)` GetSubjectSetOk returns a tuple with the SubjectSet field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetSubjectSet -`func (o *RelationTuple) SetSubjectSet(v SubjectSet)` +`func (o *Relationship) SetSubjectSet(v SubjectSet)` SetSubjectSet sets SubjectSet field to given value. ### HasSubjectSet -`func (o *RelationTuple) HasSubjectSet() bool` +`func (o *Relationship) HasSubjectSet() bool` HasSubjectSet returns a boolean if a field has been set. diff --git a/internal/httpclient/docs/ReadApi.md b/internal/httpclient/docs/RelationshipApi.md similarity index 51% rename from internal/httpclient/docs/ReadApi.md rename to internal/httpclient/docs/RelationshipApi.md index f789381a7..ba3f33e1c 100644 --- a/internal/httpclient/docs/ReadApi.md +++ b/internal/httpclient/docs/RelationshipApi.md @@ -1,23 +1,23 @@ -# \ReadApi +# \RelationshipApi All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**GetCheck**](ReadApi.md#GetCheck) | **Get** /relation-tuples/check/openapi | Check a relation tuple -[**GetCheckMirrorStatus**](ReadApi.md#GetCheckMirrorStatus) | **Get** /relation-tuples/check | Check a relation tuple -[**GetExpand**](ReadApi.md#GetExpand) | **Get** /relation-tuples/expand | Expand a Relation Tuple -[**GetRelationTuples**](ReadApi.md#GetRelationTuples) | **Get** /relation-tuples | Query relation tuples -[**PostCheck**](ReadApi.md#PostCheck) | **Post** /relation-tuples/check/openapi | Check a relation tuple -[**PostCheckMirrorStatus**](ReadApi.md#PostCheckMirrorStatus) | **Post** /relation-tuples/check | Check a relation tuple +[**CheckOplSyntax**](RelationshipApi.md#CheckOplSyntax) | **Post** /opl/syntax/check | Check the syntax of an OPL file +[**CreateRelationship**](RelationshipApi.md#CreateRelationship) | **Put** /admin/relation-tuples | Create a Relationship +[**DeleteRelationships**](RelationshipApi.md#DeleteRelationships) | **Delete** /admin/relation-tuples | Delete Relationships +[**GetRelationships**](RelationshipApi.md#GetRelationships) | **Get** /relation-tuples | Query relationships +[**ListRelationshipNamespaces**](RelationshipApi.md#ListRelationshipNamespaces) | **Get** /namespaces | Query namespaces +[**PatchRelationships**](RelationshipApi.md#PatchRelationships) | **Patch** /admin/relation-tuples | Patch Multiple Relationships -## GetCheck +## CheckOplSyntax -> GetCheckResponse GetCheck(ctx).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).MaxDepth(maxDepth).Execute() +> CheckOplSyntaxResult CheckOplSyntax(ctx).Body(body).Execute() -Check a relation tuple +Check the syntax of an OPL file @@ -34,24 +34,17 @@ import ( ) func main() { - namespace := "namespace_example" // string | Namespace of the Relation Tuple (optional) - object := "object_example" // string | Object of the Relation Tuple (optional) - relation := "relation_example" // string | Relation of the Relation Tuple (optional) - subjectId := "subjectId_example" // string | SubjectID of the Relation Tuple (optional) - subjectSetNamespace := "subjectSetNamespace_example" // string | Namespace of the Subject Set (optional) - subjectSetObject := "subjectSetObject_example" // string | Object of the Subject Set (optional) - subjectSetRelation := "subjectSetRelation_example" // string | Relation of the Subject Set (optional) - maxDepth := int64(789) // int64 | (optional) + body := "body_example" // string | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ReadApi.GetCheck(context.Background()).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).MaxDepth(maxDepth).Execute() + resp, r, err := apiClient.RelationshipApi.CheckOplSyntax(context.Background()).Body(body).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ReadApi.GetCheck``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `RelationshipApi.CheckOplSyntax``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetCheck`: GetCheckResponse - fmt.Fprintf(os.Stdout, "Response from `ReadApi.GetCheck`: %v\n", resp) + // response from `CheckOplSyntax`: CheckOplSyntaxResult + fmt.Fprintf(os.Stdout, "Response from `RelationshipApi.CheckOplSyntax`: %v\n", resp) } ``` @@ -61,23 +54,16 @@ func main() { ### Other Parameters -Other parameters are passed through a pointer to a apiGetCheckRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiCheckOplSyntaxRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **namespace** | **string** | Namespace of the Relation Tuple | - **object** | **string** | Object of the Relation Tuple | - **relation** | **string** | Relation of the Relation Tuple | - **subjectId** | **string** | SubjectID of the Relation Tuple | - **subjectSetNamespace** | **string** | Namespace of the Subject Set | - **subjectSetObject** | **string** | Object of the Subject Set | - **subjectSetRelation** | **string** | Relation of the Subject Set | - **maxDepth** | **int64** | | + **body** | **string** | | ### Return type -[**GetCheckResponse**](GetCheckResponse.md) +[**CheckOplSyntaxResult**](CheckOplSyntaxResult.md) ### Authorization @@ -85,7 +71,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: text/plain - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -93,11 +79,11 @@ No authorization required [[Back to README]](../README.md) -## GetCheckMirrorStatus +## CreateRelationship -> GetCheckResponse GetCheckMirrorStatus(ctx).Execute() +> Relationship CreateRelationship(ctx).CreateRelationshipBody(createRelationshipBody).Execute() -Check a relation tuple +Create a Relationship @@ -114,31 +100,36 @@ import ( ) func main() { + createRelationshipBody := *openapiclient.NewCreateRelationshipBody() // CreateRelationshipBody | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ReadApi.GetCheckMirrorStatus(context.Background()).Execute() + resp, r, err := apiClient.RelationshipApi.CreateRelationship(context.Background()).CreateRelationshipBody(createRelationshipBody).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ReadApi.GetCheckMirrorStatus``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `RelationshipApi.CreateRelationship``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetCheckMirrorStatus`: GetCheckResponse - fmt.Fprintf(os.Stdout, "Response from `ReadApi.GetCheckMirrorStatus`: %v\n", resp) + // response from `CreateRelationship`: Relationship + fmt.Fprintf(os.Stdout, "Response from `RelationshipApi.CreateRelationship`: %v\n", resp) } ``` ### Path Parameters -This endpoint does not need any parameter. + ### Other Parameters -Other parameters are passed through a pointer to a apiGetCheckMirrorStatusRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiCreateRelationshipRequest struct via the builder pattern +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **createRelationshipBody** | [**CreateRelationshipBody**](CreateRelationshipBody.md) | | + ### Return type -[**GetCheckResponse**](GetCheckResponse.md) +[**Relationship**](Relationship.md) ### Authorization @@ -146,7 +137,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -154,11 +145,11 @@ No authorization required [[Back to README]](../README.md) -## GetExpand +## DeleteRelationships -> ExpandTree GetExpand(ctx).Namespace(namespace).Object(object).Relation(relation).MaxDepth(maxDepth).Execute() +> DeleteRelationships(ctx).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).Execute() -Expand a Relation Tuple +Delete Relationships @@ -175,20 +166,21 @@ import ( ) func main() { - namespace := "namespace_example" // string | Namespace of the Subject Set - object := "object_example" // string | Object of the Subject Set - relation := "relation_example" // string | Relation of the Subject Set - maxDepth := int64(789) // int64 | (optional) + namespace := "namespace_example" // string | Namespace of the Relationship (optional) + object := "object_example" // string | Object of the Relationship (optional) + relation := "relation_example" // string | Relation of the Relationship (optional) + subjectId := "subjectId_example" // string | SubjectID of the Relationship (optional) + subjectSetNamespace := "subjectSetNamespace_example" // string | Namespace of the Subject Set (optional) + subjectSetObject := "subjectSetObject_example" // string | Object of the Subject Set (optional) + subjectSetRelation := "subjectSetRelation_example" // string | Relation of the Subject Set (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ReadApi.GetExpand(context.Background()).Namespace(namespace).Object(object).Relation(relation).MaxDepth(maxDepth).Execute() + resp, r, err := apiClient.RelationshipApi.DeleteRelationships(context.Background()).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ReadApi.GetExpand``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `RelationshipApi.DeleteRelationships``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetExpand`: ExpandTree - fmt.Fprintf(os.Stdout, "Response from `ReadApi.GetExpand`: %v\n", resp) } ``` @@ -198,19 +190,22 @@ func main() { ### Other Parameters -Other parameters are passed through a pointer to a apiGetExpandRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiDeleteRelationshipsRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **namespace** | **string** | Namespace of the Subject Set | - **object** | **string** | Object of the Subject Set | - **relation** | **string** | Relation of the Subject Set | - **maxDepth** | **int64** | | + **namespace** | **string** | Namespace of the Relationship | + **object** | **string** | Object of the Relationship | + **relation** | **string** | Relation of the Relationship | + **subjectId** | **string** | SubjectID of the Relationship | + **subjectSetNamespace** | **string** | Namespace of the Subject Set | + **subjectSetObject** | **string** | Object of the Subject Set | + **subjectSetRelation** | **string** | Relation of the Subject Set | ### Return type -[**ExpandTree**](ExpandTree.md) + (empty response body) ### Authorization @@ -226,11 +221,11 @@ No authorization required [[Back to README]](../README.md) -## GetRelationTuples +## GetRelationships -> GetRelationTuplesResponse GetRelationTuples(ctx).PageToken(pageToken).PageSize(pageSize).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).Execute() +> Relationships GetRelationships(ctx).PageToken(pageToken).PageSize(pageSize).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).Execute() -Query relation tuples +Query relationships @@ -249,23 +244,23 @@ import ( func main() { pageToken := "pageToken_example" // string | (optional) pageSize := int64(789) // int64 | (optional) - namespace := "namespace_example" // string | Namespace of the Relation Tuple (optional) - object := "object_example" // string | Object of the Relation Tuple (optional) - relation := "relation_example" // string | Relation of the Relation Tuple (optional) - subjectId := "subjectId_example" // string | SubjectID of the Relation Tuple (optional) + namespace := "namespace_example" // string | Namespace of the Relationship (optional) + object := "object_example" // string | Object of the Relationship (optional) + relation := "relation_example" // string | Relation of the Relationship (optional) + subjectId := "subjectId_example" // string | SubjectID of the Relationship (optional) subjectSetNamespace := "subjectSetNamespace_example" // string | Namespace of the Subject Set (optional) subjectSetObject := "subjectSetObject_example" // string | Object of the Subject Set (optional) subjectSetRelation := "subjectSetRelation_example" // string | Relation of the Subject Set (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ReadApi.GetRelationTuples(context.Background()).PageToken(pageToken).PageSize(pageSize).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).Execute() + resp, r, err := apiClient.RelationshipApi.GetRelationships(context.Background()).PageToken(pageToken).PageSize(pageSize).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ReadApi.GetRelationTuples``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `RelationshipApi.GetRelationships``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetRelationTuples`: GetRelationTuplesResponse - fmt.Fprintf(os.Stdout, "Response from `ReadApi.GetRelationTuples`: %v\n", resp) + // response from `GetRelationships`: Relationships + fmt.Fprintf(os.Stdout, "Response from `RelationshipApi.GetRelationships`: %v\n", resp) } ``` @@ -275,24 +270,24 @@ func main() { ### Other Parameters -Other parameters are passed through a pointer to a apiGetRelationTuplesRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiGetRelationshipsRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **pageToken** | **string** | | **pageSize** | **int64** | | - **namespace** | **string** | Namespace of the Relation Tuple | - **object** | **string** | Object of the Relation Tuple | - **relation** | **string** | Relation of the Relation Tuple | - **subjectId** | **string** | SubjectID of the Relation Tuple | + **namespace** | **string** | Namespace of the Relationship | + **object** | **string** | Object of the Relationship | + **relation** | **string** | Relation of the Relationship | + **subjectId** | **string** | SubjectID of the Relationship | **subjectSetNamespace** | **string** | Namespace of the Subject Set | **subjectSetObject** | **string** | Object of the Subject Set | **subjectSetRelation** | **string** | Relation of the Subject Set | ### Return type -[**GetRelationTuplesResponse**](GetRelationTuplesResponse.md) +[**Relationships**](Relationships.md) ### Authorization @@ -308,11 +303,11 @@ No authorization required [[Back to README]](../README.md) -## PostCheck +## ListRelationshipNamespaces -> GetCheckResponse PostCheck(ctx).MaxDepth(maxDepth).RelationQuery(relationQuery).Execute() +> RelationshipNamespaces ListRelationshipNamespaces(ctx).Execute() -Check a relation tuple +Query namespaces @@ -329,38 +324,31 @@ import ( ) func main() { - maxDepth := int64(789) // int64 | (optional) - relationQuery := *openapiclient.NewRelationQuery() // RelationQuery | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ReadApi.PostCheck(context.Background()).MaxDepth(maxDepth).RelationQuery(relationQuery).Execute() + resp, r, err := apiClient.RelationshipApi.ListRelationshipNamespaces(context.Background()).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ReadApi.PostCheck``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `RelationshipApi.ListRelationshipNamespaces``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `PostCheck`: GetCheckResponse - fmt.Fprintf(os.Stdout, "Response from `ReadApi.PostCheck`: %v\n", resp) + // response from `ListRelationshipNamespaces`: RelationshipNamespaces + fmt.Fprintf(os.Stdout, "Response from `RelationshipApi.ListRelationshipNamespaces`: %v\n", resp) } ``` ### Path Parameters - +This endpoint does not need any parameter. ### Other Parameters -Other parameters are passed through a pointer to a apiPostCheckRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiListRelationshipNamespacesRequest struct via the builder pattern -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **maxDepth** | **int64** | | - **relationQuery** | [**RelationQuery**](RelationQuery.md) | | - ### Return type -[**GetCheckResponse**](GetCheckResponse.md) +[**RelationshipNamespaces**](RelationshipNamespaces.md) ### Authorization @@ -368,7 +356,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -376,11 +364,11 @@ No authorization required [[Back to README]](../README.md) -## PostCheckMirrorStatus +## PatchRelationships -> GetCheckResponse PostCheckMirrorStatus(ctx).Execute() +> PatchRelationships(ctx).RelationshipPatch(relationshipPatch).Execute() -Check a relation tuple +Patch Multiple Relationships @@ -397,31 +385,34 @@ import ( ) func main() { + relationshipPatch := []openapiclient.RelationshipPatch{*openapiclient.NewRelationshipPatch()} // []RelationshipPatch | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ReadApi.PostCheckMirrorStatus(context.Background()).Execute() + resp, r, err := apiClient.RelationshipApi.PatchRelationships(context.Background()).RelationshipPatch(relationshipPatch).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ReadApi.PostCheckMirrorStatus``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `RelationshipApi.PatchRelationships``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `PostCheckMirrorStatus`: GetCheckResponse - fmt.Fprintf(os.Stdout, "Response from `ReadApi.PostCheckMirrorStatus`: %v\n", resp) } ``` ### Path Parameters -This endpoint does not need any parameter. + ### Other Parameters -Other parameters are passed through a pointer to a apiPostCheckMirrorStatusRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiPatchRelationshipsRequest struct via the builder pattern + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **relationshipPatch** | [**[]RelationshipPatch**](RelationshipPatch.md) | | ### Return type -[**GetCheckResponse**](GetCheckResponse.md) + (empty response body) ### Authorization @@ -429,7 +420,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) diff --git a/internal/httpclient/docs/GetNamespacesResponse.md b/internal/httpclient/docs/RelationshipNamespaces.md similarity index 64% rename from internal/httpclient/docs/GetNamespacesResponse.md rename to internal/httpclient/docs/RelationshipNamespaces.md index 1fd71eccc..63fa28712 100644 --- a/internal/httpclient/docs/GetNamespacesResponse.md +++ b/internal/httpclient/docs/RelationshipNamespaces.md @@ -1,4 +1,4 @@ -# GetNamespacesResponse +# RelationshipNamespaces ## Properties @@ -8,45 +8,45 @@ Name | Type | Description | Notes ## Methods -### NewGetNamespacesResponse +### NewRelationshipNamespaces -`func NewGetNamespacesResponse() *GetNamespacesResponse` +`func NewRelationshipNamespaces() *RelationshipNamespaces` -NewGetNamespacesResponse instantiates a new GetNamespacesResponse object +NewRelationshipNamespaces instantiates a new RelationshipNamespaces object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewGetNamespacesResponseWithDefaults +### NewRelationshipNamespacesWithDefaults -`func NewGetNamespacesResponseWithDefaults() *GetNamespacesResponse` +`func NewRelationshipNamespacesWithDefaults() *RelationshipNamespaces` -NewGetNamespacesResponseWithDefaults instantiates a new GetNamespacesResponse object +NewRelationshipNamespacesWithDefaults instantiates a new RelationshipNamespaces object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetNamespaces -`func (o *GetNamespacesResponse) GetNamespaces() []Namespace` +`func (o *RelationshipNamespaces) GetNamespaces() []Namespace` GetNamespaces returns the Namespaces field if non-nil, zero value otherwise. ### GetNamespacesOk -`func (o *GetNamespacesResponse) GetNamespacesOk() (*[]Namespace, bool)` +`func (o *RelationshipNamespaces) GetNamespacesOk() (*[]Namespace, bool)` GetNamespacesOk returns a tuple with the Namespaces field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetNamespaces -`func (o *GetNamespacesResponse) SetNamespaces(v []Namespace)` +`func (o *RelationshipNamespaces) SetNamespaces(v []Namespace)` SetNamespaces sets Namespaces field to given value. ### HasNamespaces -`func (o *GetNamespacesResponse) HasNamespaces() bool` +`func (o *RelationshipNamespaces) HasNamespaces() bool` HasNamespaces returns a boolean if a field has been set. diff --git a/internal/httpclient/docs/PatchDelta.md b/internal/httpclient/docs/RelationshipPatch.md similarity index 63% rename from internal/httpclient/docs/PatchDelta.md rename to internal/httpclient/docs/RelationshipPatch.md index 418beffda..649c62571 100644 --- a/internal/httpclient/docs/PatchDelta.md +++ b/internal/httpclient/docs/RelationshipPatch.md @@ -1,78 +1,78 @@ -# PatchDelta +# RelationshipPatch ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Action** | Pointer to **string** | | [optional] -**RelationTuple** | Pointer to [**RelationTuple**](RelationTuple.md) | | [optional] +**RelationTuple** | Pointer to [**Relationship**](Relationship.md) | | [optional] ## Methods -### NewPatchDelta +### NewRelationshipPatch -`func NewPatchDelta() *PatchDelta` +`func NewRelationshipPatch() *RelationshipPatch` -NewPatchDelta instantiates a new PatchDelta object +NewRelationshipPatch instantiates a new RelationshipPatch object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewPatchDeltaWithDefaults +### NewRelationshipPatchWithDefaults -`func NewPatchDeltaWithDefaults() *PatchDelta` +`func NewRelationshipPatchWithDefaults() *RelationshipPatch` -NewPatchDeltaWithDefaults instantiates a new PatchDelta object +NewRelationshipPatchWithDefaults instantiates a new RelationshipPatch object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetAction -`func (o *PatchDelta) GetAction() string` +`func (o *RelationshipPatch) GetAction() string` GetAction returns the Action field if non-nil, zero value otherwise. ### GetActionOk -`func (o *PatchDelta) GetActionOk() (*string, bool)` +`func (o *RelationshipPatch) GetActionOk() (*string, bool)` GetActionOk returns a tuple with the Action field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetAction -`func (o *PatchDelta) SetAction(v string)` +`func (o *RelationshipPatch) SetAction(v string)` SetAction sets Action field to given value. ### HasAction -`func (o *PatchDelta) HasAction() bool` +`func (o *RelationshipPatch) HasAction() bool` HasAction returns a boolean if a field has been set. ### GetRelationTuple -`func (o *PatchDelta) GetRelationTuple() RelationTuple` +`func (o *RelationshipPatch) GetRelationTuple() Relationship` GetRelationTuple returns the RelationTuple field if non-nil, zero value otherwise. ### GetRelationTupleOk -`func (o *PatchDelta) GetRelationTupleOk() (*RelationTuple, bool)` +`func (o *RelationshipPatch) GetRelationTupleOk() (*Relationship, bool)` GetRelationTupleOk returns a tuple with the RelationTuple field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetRelationTuple -`func (o *PatchDelta) SetRelationTuple(v RelationTuple)` +`func (o *RelationshipPatch) SetRelationTuple(v Relationship)` SetRelationTuple sets RelationTuple field to given value. ### HasRelationTuple -`func (o *PatchDelta) HasRelationTuple() bool` +`func (o *RelationshipPatch) HasRelationTuple() bool` HasRelationTuple returns a boolean if a field has been set. diff --git a/internal/httpclient/docs/GetRelationTuplesResponse.md b/internal/httpclient/docs/Relationships.md similarity index 62% rename from internal/httpclient/docs/GetRelationTuplesResponse.md rename to internal/httpclient/docs/Relationships.md index e82451987..83f813e6b 100644 --- a/internal/httpclient/docs/GetRelationTuplesResponse.md +++ b/internal/httpclient/docs/Relationships.md @@ -1,78 +1,78 @@ -# GetRelationTuplesResponse +# Relationships ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **NextPageToken** | Pointer to **string** | The opaque token to provide in a subsequent request to get the next page. It is the empty string iff this is the last page. | [optional] -**RelationTuples** | Pointer to [**[]RelationTuple**](RelationTuple.md) | | [optional] +**RelationTuples** | Pointer to [**[]Relationship**](Relationship.md) | | [optional] ## Methods -### NewGetRelationTuplesResponse +### NewRelationships -`func NewGetRelationTuplesResponse() *GetRelationTuplesResponse` +`func NewRelationships() *Relationships` -NewGetRelationTuplesResponse instantiates a new GetRelationTuplesResponse object +NewRelationships instantiates a new Relationships object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed -### NewGetRelationTuplesResponseWithDefaults +### NewRelationshipsWithDefaults -`func NewGetRelationTuplesResponseWithDefaults() *GetRelationTuplesResponse` +`func NewRelationshipsWithDefaults() *Relationships` -NewGetRelationTuplesResponseWithDefaults instantiates a new GetRelationTuplesResponse object +NewRelationshipsWithDefaults instantiates a new Relationships object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set ### GetNextPageToken -`func (o *GetRelationTuplesResponse) GetNextPageToken() string` +`func (o *Relationships) GetNextPageToken() string` GetNextPageToken returns the NextPageToken field if non-nil, zero value otherwise. ### GetNextPageTokenOk -`func (o *GetRelationTuplesResponse) GetNextPageTokenOk() (*string, bool)` +`func (o *Relationships) GetNextPageTokenOk() (*string, bool)` GetNextPageTokenOk returns a tuple with the NextPageToken field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetNextPageToken -`func (o *GetRelationTuplesResponse) SetNextPageToken(v string)` +`func (o *Relationships) SetNextPageToken(v string)` SetNextPageToken sets NextPageToken field to given value. ### HasNextPageToken -`func (o *GetRelationTuplesResponse) HasNextPageToken() bool` +`func (o *Relationships) HasNextPageToken() bool` HasNextPageToken returns a boolean if a field has been set. ### GetRelationTuples -`func (o *GetRelationTuplesResponse) GetRelationTuples() []RelationTuple` +`func (o *Relationships) GetRelationTuples() []Relationship` GetRelationTuples returns the RelationTuples field if non-nil, zero value otherwise. ### GetRelationTuplesOk -`func (o *GetRelationTuplesResponse) GetRelationTuplesOk() (*[]RelationTuple, bool)` +`func (o *Relationships) GetRelationTuplesOk() (*[]Relationship, bool)` GetRelationTuplesOk returns a tuple with the RelationTuples field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetRelationTuples -`func (o *GetRelationTuplesResponse) SetRelationTuples(v []RelationTuple)` +`func (o *Relationships) SetRelationTuples(v []Relationship)` SetRelationTuples sets RelationTuples field to given value. ### HasRelationTuples -`func (o *GetRelationTuplesResponse) HasRelationTuples() bool` +`func (o *Relationships) HasRelationTuples() bool` HasRelationTuples returns a boolean if a field has been set. diff --git a/internal/httpclient/docs/SyntaxApi.md b/internal/httpclient/docs/SyntaxApi.md deleted file mode 100644 index 3b5abe2e0..000000000 --- a/internal/httpclient/docs/SyntaxApi.md +++ /dev/null @@ -1,75 +0,0 @@ -# \SyntaxApi - -All URIs are relative to *http://localhost* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**CheckOplSyntax**](SyntaxApi.md#CheckOplSyntax) | **Post** /opl/syntax/check | Check the syntax of an OPL file - - - -## CheckOplSyntax - -> PostCheckOplSyntaxResponse CheckOplSyntax(ctx).Body(body).Execute() - -Check the syntax of an OPL file - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - body := "body_example" // string | the OPL content to check - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.SyntaxApi.CheckOplSyntax(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SyntaxApi.CheckOplSyntax``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `CheckOplSyntax`: PostCheckOplSyntaxResponse - fmt.Fprintf(os.Stdout, "Response from `SyntaxApi.CheckOplSyntax`: %v\n", resp) -} -``` - -### Path Parameters - - - -### Other Parameters - -Other parameters are passed through a pointer to a apiCheckOplSyntaxRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **string** | the OPL content to check | - -### Return type - -[**PostCheckOplSyntaxResponse**](PostCheckOplSyntaxResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: text/plain -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - diff --git a/internal/httpclient/docs/WriteApi.md b/internal/httpclient/docs/WriteApi.md deleted file mode 100644 index 1115b05a8..000000000 --- a/internal/httpclient/docs/WriteApi.md +++ /dev/null @@ -1,217 +0,0 @@ -# \WriteApi - -All URIs are relative to *http://localhost* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**CreateRelationTuple**](WriteApi.md#CreateRelationTuple) | **Put** /admin/relation-tuples | Create a Relation Tuple -[**DeleteRelationTuples**](WriteApi.md#DeleteRelationTuples) | **Delete** /admin/relation-tuples | Delete Relation Tuples -[**PatchRelationTuples**](WriteApi.md#PatchRelationTuples) | **Patch** /admin/relation-tuples | Patch Multiple Relation Tuples - - - -## CreateRelationTuple - -> RelationQuery CreateRelationTuple(ctx).RelationQuery(relationQuery).Execute() - -Create a Relation Tuple - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - relationQuery := *openapiclient.NewRelationQuery() // RelationQuery | (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.WriteApi.CreateRelationTuple(context.Background()).RelationQuery(relationQuery).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `WriteApi.CreateRelationTuple``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `CreateRelationTuple`: RelationQuery - fmt.Fprintf(os.Stdout, "Response from `WriteApi.CreateRelationTuple`: %v\n", resp) -} -``` - -### Path Parameters - - - -### Other Parameters - -Other parameters are passed through a pointer to a apiCreateRelationTupleRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **relationQuery** | [**RelationQuery**](RelationQuery.md) | | - -### Return type - -[**RelationQuery**](RelationQuery.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## DeleteRelationTuples - -> DeleteRelationTuples(ctx).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).Execute() - -Delete Relation Tuples - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - namespace := "namespace_example" // string | Namespace of the Relation Tuple (optional) - object := "object_example" // string | Object of the Relation Tuple (optional) - relation := "relation_example" // string | Relation of the Relation Tuple (optional) - subjectId := "subjectId_example" // string | SubjectID of the Relation Tuple (optional) - subjectSetNamespace := "subjectSetNamespace_example" // string | Namespace of the Subject Set (optional) - subjectSetObject := "subjectSetObject_example" // string | Object of the Subject Set (optional) - subjectSetRelation := "subjectSetRelation_example" // string | Relation of the Subject Set (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.WriteApi.DeleteRelationTuples(context.Background()).Namespace(namespace).Object(object).Relation(relation).SubjectId(subjectId).SubjectSetNamespace(subjectSetNamespace).SubjectSetObject(subjectSetObject).SubjectSetRelation(subjectSetRelation).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `WriteApi.DeleteRelationTuples``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} -``` - -### Path Parameters - - - -### Other Parameters - -Other parameters are passed through a pointer to a apiDeleteRelationTuplesRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **namespace** | **string** | Namespace of the Relation Tuple | - **object** | **string** | Object of the Relation Tuple | - **relation** | **string** | Relation of the Relation Tuple | - **subjectId** | **string** | SubjectID of the Relation Tuple | - **subjectSetNamespace** | **string** | Namespace of the Subject Set | - **subjectSetObject** | **string** | Object of the Subject Set | - **subjectSetRelation** | **string** | Relation of the Subject Set | - -### Return type - - (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## PatchRelationTuples - -> PatchRelationTuples(ctx).PatchDelta(patchDelta).Execute() - -Patch Multiple Relation Tuples - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - patchDelta := []openapiclient.PatchDelta{*openapiclient.NewPatchDelta()} // []PatchDelta | (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.WriteApi.PatchRelationTuples(context.Background()).PatchDelta(patchDelta).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `WriteApi.PatchRelationTuples``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} -``` - -### Path Parameters - - - -### Other Parameters - -Other parameters are passed through a pointer to a apiPatchRelationTuplesRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **patchDelta** | [**[]PatchDelta**](PatchDelta.md) | | - -### Return type - - (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - diff --git a/internal/httpclient/model_post_check_opl_syntax_response.go b/internal/httpclient/model_check_opl_syntax_result.go similarity index 53% rename from internal/httpclient/model_post_check_opl_syntax_response.go rename to internal/httpclient/model_check_opl_syntax_result.go index fbeb243bb..5f741b6d8 100644 --- a/internal/httpclient/model_post_check_opl_syntax_response.go +++ b/internal/httpclient/model_check_opl_syntax_result.go @@ -15,31 +15,31 @@ import ( "encoding/json" ) -// PostCheckOplSyntaxResponse struct for PostCheckOplSyntaxResponse -type PostCheckOplSyntaxResponse struct { +// CheckOplSyntaxResult struct for CheckOplSyntaxResult +type CheckOplSyntaxResult struct { // The list of syntax errors Errors []ParseError `json:"errors,omitempty"` } -// NewPostCheckOplSyntaxResponse instantiates a new PostCheckOplSyntaxResponse object +// NewCheckOplSyntaxResult instantiates a new CheckOplSyntaxResult object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewPostCheckOplSyntaxResponse() *PostCheckOplSyntaxResponse { - this := PostCheckOplSyntaxResponse{} +func NewCheckOplSyntaxResult() *CheckOplSyntaxResult { + this := CheckOplSyntaxResult{} return &this } -// NewPostCheckOplSyntaxResponseWithDefaults instantiates a new PostCheckOplSyntaxResponse object +// NewCheckOplSyntaxResultWithDefaults instantiates a new CheckOplSyntaxResult object // This constructor will only assign default values to properties that have it defined, // but it doesn't guarantee that properties required by API are set -func NewPostCheckOplSyntaxResponseWithDefaults() *PostCheckOplSyntaxResponse { - this := PostCheckOplSyntaxResponse{} +func NewCheckOplSyntaxResultWithDefaults() *CheckOplSyntaxResult { + this := CheckOplSyntaxResult{} return &this } // GetErrors returns the Errors field value if set, zero value otherwise. -func (o *PostCheckOplSyntaxResponse) GetErrors() []ParseError { +func (o *CheckOplSyntaxResult) GetErrors() []ParseError { if o == nil || o.Errors == nil { var ret []ParseError return ret @@ -49,7 +49,7 @@ func (o *PostCheckOplSyntaxResponse) GetErrors() []ParseError { // GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *PostCheckOplSyntaxResponse) GetErrorsOk() ([]ParseError, bool) { +func (o *CheckOplSyntaxResult) GetErrorsOk() ([]ParseError, bool) { if o == nil || o.Errors == nil { return nil, false } @@ -57,7 +57,7 @@ func (o *PostCheckOplSyntaxResponse) GetErrorsOk() ([]ParseError, bool) { } // HasErrors returns a boolean if a field has been set. -func (o *PostCheckOplSyntaxResponse) HasErrors() bool { +func (o *CheckOplSyntaxResult) HasErrors() bool { if o != nil && o.Errors != nil { return true } @@ -66,11 +66,11 @@ func (o *PostCheckOplSyntaxResponse) HasErrors() bool { } // SetErrors gets a reference to the given []ParseError and assigns it to the Errors field. -func (o *PostCheckOplSyntaxResponse) SetErrors(v []ParseError) { +func (o *CheckOplSyntaxResult) SetErrors(v []ParseError) { o.Errors = v } -func (o PostCheckOplSyntaxResponse) MarshalJSON() ([]byte, error) { +func (o CheckOplSyntaxResult) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Errors != nil { toSerialize["errors"] = o.Errors @@ -78,38 +78,38 @@ func (o PostCheckOplSyntaxResponse) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullablePostCheckOplSyntaxResponse struct { - value *PostCheckOplSyntaxResponse +type NullableCheckOplSyntaxResult struct { + value *CheckOplSyntaxResult isSet bool } -func (v NullablePostCheckOplSyntaxResponse) Get() *PostCheckOplSyntaxResponse { +func (v NullableCheckOplSyntaxResult) Get() *CheckOplSyntaxResult { return v.value } -func (v *NullablePostCheckOplSyntaxResponse) Set(val *PostCheckOplSyntaxResponse) { +func (v *NullableCheckOplSyntaxResult) Set(val *CheckOplSyntaxResult) { v.value = val v.isSet = true } -func (v NullablePostCheckOplSyntaxResponse) IsSet() bool { +func (v NullableCheckOplSyntaxResult) IsSet() bool { return v.isSet } -func (v *NullablePostCheckOplSyntaxResponse) Unset() { +func (v *NullableCheckOplSyntaxResult) Unset() { v.value = nil v.isSet = false } -func NewNullablePostCheckOplSyntaxResponse(val *PostCheckOplSyntaxResponse) *NullablePostCheckOplSyntaxResponse { - return &NullablePostCheckOplSyntaxResponse{value: val, isSet: true} +func NewNullableCheckOplSyntaxResult(val *CheckOplSyntaxResult) *NullableCheckOplSyntaxResult { + return &NullableCheckOplSyntaxResult{value: val, isSet: true} } -func (v NullablePostCheckOplSyntaxResponse) MarshalJSON() ([]byte, error) { +func (v NullableCheckOplSyntaxResult) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullablePostCheckOplSyntaxResponse) UnmarshalJSON(src []byte) error { +func (v *NullableCheckOplSyntaxResult) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/internal/httpclient/model_get_check_response.go b/internal/httpclient/model_check_permission_result.go similarity index 52% rename from internal/httpclient/model_get_check_response.go rename to internal/httpclient/model_check_permission_result.go index e7cf58f88..52bbbe7b0 100644 --- a/internal/httpclient/model_get_check_response.go +++ b/internal/httpclient/model_check_permission_result.go @@ -15,32 +15,32 @@ import ( "encoding/json" ) -// GetCheckResponse The content of the allowed field is mirrored in the HTTP status code. -type GetCheckResponse struct { +// CheckPermissionResult The content of the allowed field is mirrored in the HTTP status code. +type CheckPermissionResult struct { // whether the relation tuple is allowed Allowed bool `json:"allowed"` } -// NewGetCheckResponse instantiates a new GetCheckResponse object +// NewCheckPermissionResult instantiates a new CheckPermissionResult object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewGetCheckResponse(allowed bool) *GetCheckResponse { - this := GetCheckResponse{} +func NewCheckPermissionResult(allowed bool) *CheckPermissionResult { + this := CheckPermissionResult{} this.Allowed = allowed return &this } -// NewGetCheckResponseWithDefaults instantiates a new GetCheckResponse object +// NewCheckPermissionResultWithDefaults instantiates a new CheckPermissionResult object // This constructor will only assign default values to properties that have it defined, // but it doesn't guarantee that properties required by API are set -func NewGetCheckResponseWithDefaults() *GetCheckResponse { - this := GetCheckResponse{} +func NewCheckPermissionResultWithDefaults() *CheckPermissionResult { + this := CheckPermissionResult{} return &this } // GetAllowed returns the Allowed field value -func (o *GetCheckResponse) GetAllowed() bool { +func (o *CheckPermissionResult) GetAllowed() bool { if o == nil { var ret bool return ret @@ -51,7 +51,7 @@ func (o *GetCheckResponse) GetAllowed() bool { // GetAllowedOk returns a tuple with the Allowed field value // and a boolean to check if the value has been set. -func (o *GetCheckResponse) GetAllowedOk() (*bool, bool) { +func (o *CheckPermissionResult) GetAllowedOk() (*bool, bool) { if o == nil { return nil, false } @@ -59,11 +59,11 @@ func (o *GetCheckResponse) GetAllowedOk() (*bool, bool) { } // SetAllowed sets field value -func (o *GetCheckResponse) SetAllowed(v bool) { +func (o *CheckPermissionResult) SetAllowed(v bool) { o.Allowed = v } -func (o GetCheckResponse) MarshalJSON() ([]byte, error) { +func (o CheckPermissionResult) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if true { toSerialize["allowed"] = o.Allowed @@ -71,38 +71,38 @@ func (o GetCheckResponse) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableGetCheckResponse struct { - value *GetCheckResponse +type NullableCheckPermissionResult struct { + value *CheckPermissionResult isSet bool } -func (v NullableGetCheckResponse) Get() *GetCheckResponse { +func (v NullableCheckPermissionResult) Get() *CheckPermissionResult { return v.value } -func (v *NullableGetCheckResponse) Set(val *GetCheckResponse) { +func (v *NullableCheckPermissionResult) Set(val *CheckPermissionResult) { v.value = val v.isSet = true } -func (v NullableGetCheckResponse) IsSet() bool { +func (v NullableCheckPermissionResult) IsSet() bool { return v.isSet } -func (v *NullableGetCheckResponse) Unset() { +func (v *NullableCheckPermissionResult) Unset() { v.value = nil v.isSet = false } -func NewNullableGetCheckResponse(val *GetCheckResponse) *NullableGetCheckResponse { - return &NullableGetCheckResponse{value: val, isSet: true} +func NewNullableCheckPermissionResult(val *CheckPermissionResult) *NullableCheckPermissionResult { + return &NullableCheckPermissionResult{value: val, isSet: true} } -func (v NullableGetCheckResponse) MarshalJSON() ([]byte, error) { +func (v NullableCheckPermissionResult) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableGetCheckResponse) UnmarshalJSON(src []byte) error { +func (v *NullableCheckPermissionResult) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/internal/httpclient/model_create_relationship_body.go b/internal/httpclient/model_create_relationship_body.go new file mode 100644 index 000000000..a87a89761 --- /dev/null +++ b/internal/httpclient/model_create_relationship_body.go @@ -0,0 +1,262 @@ +/* + * Ory Keto API + * + * Documentation for all of Ory Keto's REST APIs. gRPC is documented separately. + * + * API version: 1.0.0 + * Contact: hi@ory.sh + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// CreateRelationshipBody Create Relationship Request Body +type CreateRelationshipBody struct { + // Namespace to query + Namespace *string `json:"namespace,omitempty"` + // Object to query + Object *string `json:"object,omitempty"` + // Relation to query + Relation *string `json:"relation,omitempty"` + // SubjectID to query Either SubjectSet or SubjectID can be provided. + SubjectId *string `json:"subject_id,omitempty"` + SubjectSet *SubjectSet `json:"subject_set,omitempty"` +} + +// NewCreateRelationshipBody instantiates a new CreateRelationshipBody object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateRelationshipBody() *CreateRelationshipBody { + this := CreateRelationshipBody{} + return &this +} + +// NewCreateRelationshipBodyWithDefaults instantiates a new CreateRelationshipBody object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateRelationshipBodyWithDefaults() *CreateRelationshipBody { + this := CreateRelationshipBody{} + return &this +} + +// GetNamespace returns the Namespace field value if set, zero value otherwise. +func (o *CreateRelationshipBody) GetNamespace() string { + if o == nil || o.Namespace == nil { + var ret string + return ret + } + return *o.Namespace +} + +// GetNamespaceOk returns a tuple with the Namespace field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRelationshipBody) GetNamespaceOk() (*string, bool) { + if o == nil || o.Namespace == nil { + return nil, false + } + return o.Namespace, true +} + +// HasNamespace returns a boolean if a field has been set. +func (o *CreateRelationshipBody) HasNamespace() bool { + if o != nil && o.Namespace != nil { + return true + } + + return false +} + +// SetNamespace gets a reference to the given string and assigns it to the Namespace field. +func (o *CreateRelationshipBody) SetNamespace(v string) { + o.Namespace = &v +} + +// GetObject returns the Object field value if set, zero value otherwise. +func (o *CreateRelationshipBody) GetObject() string { + if o == nil || o.Object == nil { + var ret string + return ret + } + return *o.Object +} + +// GetObjectOk returns a tuple with the Object field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRelationshipBody) GetObjectOk() (*string, bool) { + if o == nil || o.Object == nil { + return nil, false + } + return o.Object, true +} + +// HasObject returns a boolean if a field has been set. +func (o *CreateRelationshipBody) HasObject() bool { + if o != nil && o.Object != nil { + return true + } + + return false +} + +// SetObject gets a reference to the given string and assigns it to the Object field. +func (o *CreateRelationshipBody) SetObject(v string) { + o.Object = &v +} + +// GetRelation returns the Relation field value if set, zero value otherwise. +func (o *CreateRelationshipBody) GetRelation() string { + if o == nil || o.Relation == nil { + var ret string + return ret + } + return *o.Relation +} + +// GetRelationOk returns a tuple with the Relation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRelationshipBody) GetRelationOk() (*string, bool) { + if o == nil || o.Relation == nil { + return nil, false + } + return o.Relation, true +} + +// HasRelation returns a boolean if a field has been set. +func (o *CreateRelationshipBody) HasRelation() bool { + if o != nil && o.Relation != nil { + return true + } + + return false +} + +// SetRelation gets a reference to the given string and assigns it to the Relation field. +func (o *CreateRelationshipBody) SetRelation(v string) { + o.Relation = &v +} + +// GetSubjectId returns the SubjectId field value if set, zero value otherwise. +func (o *CreateRelationshipBody) GetSubjectId() string { + if o == nil || o.SubjectId == nil { + var ret string + return ret + } + return *o.SubjectId +} + +// GetSubjectIdOk returns a tuple with the SubjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRelationshipBody) GetSubjectIdOk() (*string, bool) { + if o == nil || o.SubjectId == nil { + return nil, false + } + return o.SubjectId, true +} + +// HasSubjectId returns a boolean if a field has been set. +func (o *CreateRelationshipBody) HasSubjectId() bool { + if o != nil && o.SubjectId != nil { + return true + } + + return false +} + +// SetSubjectId gets a reference to the given string and assigns it to the SubjectId field. +func (o *CreateRelationshipBody) SetSubjectId(v string) { + o.SubjectId = &v +} + +// GetSubjectSet returns the SubjectSet field value if set, zero value otherwise. +func (o *CreateRelationshipBody) GetSubjectSet() SubjectSet { + if o == nil || o.SubjectSet == nil { + var ret SubjectSet + return ret + } + return *o.SubjectSet +} + +// GetSubjectSetOk returns a tuple with the SubjectSet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRelationshipBody) GetSubjectSetOk() (*SubjectSet, bool) { + if o == nil || o.SubjectSet == nil { + return nil, false + } + return o.SubjectSet, true +} + +// HasSubjectSet returns a boolean if a field has been set. +func (o *CreateRelationshipBody) HasSubjectSet() bool { + if o != nil && o.SubjectSet != nil { + return true + } + + return false +} + +// SetSubjectSet gets a reference to the given SubjectSet and assigns it to the SubjectSet field. +func (o *CreateRelationshipBody) SetSubjectSet(v SubjectSet) { + o.SubjectSet = &v +} + +func (o CreateRelationshipBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Namespace != nil { + toSerialize["namespace"] = o.Namespace + } + if o.Object != nil { + toSerialize["object"] = o.Object + } + if o.Relation != nil { + toSerialize["relation"] = o.Relation + } + if o.SubjectId != nil { + toSerialize["subject_id"] = o.SubjectId + } + if o.SubjectSet != nil { + toSerialize["subject_set"] = o.SubjectSet + } + return json.Marshal(toSerialize) +} + +type NullableCreateRelationshipBody struct { + value *CreateRelationshipBody + isSet bool +} + +func (v NullableCreateRelationshipBody) Get() *CreateRelationshipBody { + return v.value +} + +func (v *NullableCreateRelationshipBody) Set(val *CreateRelationshipBody) { + v.value = val + v.isSet = true +} + +func (v NullableCreateRelationshipBody) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateRelationshipBody) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateRelationshipBody(val *CreateRelationshipBody) *NullableCreateRelationshipBody { + return &NullableCreateRelationshipBody{value: val, isSet: true} +} + +func (v NullableCreateRelationshipBody) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateRelationshipBody) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/httpclient/model_error_generic.go b/internal/httpclient/model_error_generic.go new file mode 100644 index 000000000..057a6acf3 --- /dev/null +++ b/internal/httpclient/model_error_generic.go @@ -0,0 +1,107 @@ +/* + * Ory Keto API + * + * Documentation for all of Ory Keto's REST APIs. gRPC is documented separately. + * + * API version: 1.0.0 + * Contact: hi@ory.sh + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// ErrorGeneric The standard Ory JSON API error format. +type ErrorGeneric struct { + Error GenericError `json:"error"` +} + +// NewErrorGeneric instantiates a new ErrorGeneric object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewErrorGeneric(error_ GenericError) *ErrorGeneric { + this := ErrorGeneric{} + this.Error = error_ + return &this +} + +// NewErrorGenericWithDefaults instantiates a new ErrorGeneric object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorGenericWithDefaults() *ErrorGeneric { + this := ErrorGeneric{} + return &this +} + +// GetError returns the Error field value +func (o *ErrorGeneric) GetError() GenericError { + if o == nil { + var ret GenericError + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *ErrorGeneric) GetErrorOk() (*GenericError, bool) { + if o == nil { + return nil, false + } + return &o.Error, true +} + +// SetError sets field value +func (o *ErrorGeneric) SetError(v GenericError) { + o.Error = v +} + +func (o ErrorGeneric) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["error"] = o.Error + } + return json.Marshal(toSerialize) +} + +type NullableErrorGeneric struct { + value *ErrorGeneric + isSet bool +} + +func (v NullableErrorGeneric) Get() *ErrorGeneric { + return v.value +} + +func (v *NullableErrorGeneric) Set(val *ErrorGeneric) { + v.value = val + v.isSet = true +} + +func (v NullableErrorGeneric) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorGeneric) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorGeneric(val *ErrorGeneric) *NullableErrorGeneric { + return &NullableErrorGeneric{value: val, isSet: true} +} + +func (v NullableErrorGeneric) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorGeneric) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/httpclient/model_expand_tree.go b/internal/httpclient/model_expanded_permission_tree.go similarity index 55% rename from internal/httpclient/model_expand_tree.go rename to internal/httpclient/model_expanded_permission_tree.go index e92f687b6..bca9ea04e 100644 --- a/internal/httpclient/model_expand_tree.go +++ b/internal/httpclient/model_expanded_permission_tree.go @@ -15,37 +15,37 @@ import ( "encoding/json" ) -// ExpandTree struct for ExpandTree -type ExpandTree struct { +// ExpandedPermissionTree struct for ExpandedPermissionTree +type ExpandedPermissionTree struct { // The children of the node, possibly none. - Children []ExpandTree `json:"children,omitempty"` - Tuple *RelationTuple `json:"tuple,omitempty"` + Children []ExpandedPermissionTree `json:"children,omitempty"` + Tuple *Relationship `json:"tuple,omitempty"` // The type of the node. union TreeNodeUnion exclusion TreeNodeExclusion intersection TreeNodeIntersection leaf TreeNodeLeaf tuple_to_subject_set TreeNodeTupleToSubjectSet computed_subject_set TreeNodeComputedSubjectSet not TreeNodeNot unspecified TreeNodeUnspecified Type string `json:"type"` } -// NewExpandTree instantiates a new ExpandTree object +// NewExpandedPermissionTree instantiates a new ExpandedPermissionTree object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewExpandTree(type_ string) *ExpandTree { - this := ExpandTree{} +func NewExpandedPermissionTree(type_ string) *ExpandedPermissionTree { + this := ExpandedPermissionTree{} this.Type = type_ return &this } -// NewExpandTreeWithDefaults instantiates a new ExpandTree object +// NewExpandedPermissionTreeWithDefaults instantiates a new ExpandedPermissionTree object // This constructor will only assign default values to properties that have it defined, // but it doesn't guarantee that properties required by API are set -func NewExpandTreeWithDefaults() *ExpandTree { - this := ExpandTree{} +func NewExpandedPermissionTreeWithDefaults() *ExpandedPermissionTree { + this := ExpandedPermissionTree{} return &this } // GetChildren returns the Children field value if set, zero value otherwise. -func (o *ExpandTree) GetChildren() []ExpandTree { +func (o *ExpandedPermissionTree) GetChildren() []ExpandedPermissionTree { if o == nil || o.Children == nil { - var ret []ExpandTree + var ret []ExpandedPermissionTree return ret } return o.Children @@ -53,7 +53,7 @@ func (o *ExpandTree) GetChildren() []ExpandTree { // GetChildrenOk returns a tuple with the Children field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *ExpandTree) GetChildrenOk() ([]ExpandTree, bool) { +func (o *ExpandedPermissionTree) GetChildrenOk() ([]ExpandedPermissionTree, bool) { if o == nil || o.Children == nil { return nil, false } @@ -61,7 +61,7 @@ func (o *ExpandTree) GetChildrenOk() ([]ExpandTree, bool) { } // HasChildren returns a boolean if a field has been set. -func (o *ExpandTree) HasChildren() bool { +func (o *ExpandedPermissionTree) HasChildren() bool { if o != nil && o.Children != nil { return true } @@ -69,15 +69,15 @@ func (o *ExpandTree) HasChildren() bool { return false } -// SetChildren gets a reference to the given []ExpandTree and assigns it to the Children field. -func (o *ExpandTree) SetChildren(v []ExpandTree) { +// SetChildren gets a reference to the given []ExpandedPermissionTree and assigns it to the Children field. +func (o *ExpandedPermissionTree) SetChildren(v []ExpandedPermissionTree) { o.Children = v } // GetTuple returns the Tuple field value if set, zero value otherwise. -func (o *ExpandTree) GetTuple() RelationTuple { +func (o *ExpandedPermissionTree) GetTuple() Relationship { if o == nil || o.Tuple == nil { - var ret RelationTuple + var ret Relationship return ret } return *o.Tuple @@ -85,7 +85,7 @@ func (o *ExpandTree) GetTuple() RelationTuple { // GetTupleOk returns a tuple with the Tuple field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *ExpandTree) GetTupleOk() (*RelationTuple, bool) { +func (o *ExpandedPermissionTree) GetTupleOk() (*Relationship, bool) { if o == nil || o.Tuple == nil { return nil, false } @@ -93,7 +93,7 @@ func (o *ExpandTree) GetTupleOk() (*RelationTuple, bool) { } // HasTuple returns a boolean if a field has been set. -func (o *ExpandTree) HasTuple() bool { +func (o *ExpandedPermissionTree) HasTuple() bool { if o != nil && o.Tuple != nil { return true } @@ -101,13 +101,13 @@ func (o *ExpandTree) HasTuple() bool { return false } -// SetTuple gets a reference to the given RelationTuple and assigns it to the Tuple field. -func (o *ExpandTree) SetTuple(v RelationTuple) { +// SetTuple gets a reference to the given Relationship and assigns it to the Tuple field. +func (o *ExpandedPermissionTree) SetTuple(v Relationship) { o.Tuple = &v } // GetType returns the Type field value -func (o *ExpandTree) GetType() string { +func (o *ExpandedPermissionTree) GetType() string { if o == nil { var ret string return ret @@ -118,7 +118,7 @@ func (o *ExpandTree) GetType() string { // GetTypeOk returns a tuple with the Type field value // and a boolean to check if the value has been set. -func (o *ExpandTree) GetTypeOk() (*string, bool) { +func (o *ExpandedPermissionTree) GetTypeOk() (*string, bool) { if o == nil { return nil, false } @@ -126,11 +126,11 @@ func (o *ExpandTree) GetTypeOk() (*string, bool) { } // SetType sets field value -func (o *ExpandTree) SetType(v string) { +func (o *ExpandedPermissionTree) SetType(v string) { o.Type = v } -func (o ExpandTree) MarshalJSON() ([]byte, error) { +func (o ExpandedPermissionTree) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Children != nil { toSerialize["children"] = o.Children @@ -144,38 +144,38 @@ func (o ExpandTree) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableExpandTree struct { - value *ExpandTree +type NullableExpandedPermissionTree struct { + value *ExpandedPermissionTree isSet bool } -func (v NullableExpandTree) Get() *ExpandTree { +func (v NullableExpandedPermissionTree) Get() *ExpandedPermissionTree { return v.value } -func (v *NullableExpandTree) Set(val *ExpandTree) { +func (v *NullableExpandedPermissionTree) Set(val *ExpandedPermissionTree) { v.value = val v.isSet = true } -func (v NullableExpandTree) IsSet() bool { +func (v NullableExpandedPermissionTree) IsSet() bool { return v.isSet } -func (v *NullableExpandTree) Unset() { +func (v *NullableExpandedPermissionTree) Unset() { v.value = nil v.isSet = false } -func NewNullableExpandTree(val *ExpandTree) *NullableExpandTree { - return &NullableExpandTree{value: val, isSet: true} +func NewNullableExpandedPermissionTree(val *ExpandedPermissionTree) *NullableExpandedPermissionTree { + return &NullableExpandedPermissionTree{value: val, isSet: true} } -func (v NullableExpandTree) MarshalJSON() ([]byte, error) { +func (v NullableExpandedPermissionTree) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableExpandTree) UnmarshalJSON(src []byte) error { +func (v *NullableExpandedPermissionTree) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/internal/httpclient/model_generic_error.go b/internal/httpclient/model_generic_error.go index a0519be57..8f1848243 100644 --- a/internal/httpclient/model_generic_error.go +++ b/internal/httpclient/model_generic_error.go @@ -15,22 +15,33 @@ import ( "encoding/json" ) -// GenericError The standard error format +// GenericError struct for GenericError type GenericError struct { - Code *int64 `json:"code,omitempty"` - Details []map[string]interface{} `json:"details,omitempty"` - Message *string `json:"message,omitempty"` - Reason *string `json:"reason,omitempty"` - Request *string `json:"request,omitempty"` - Status *string `json:"status,omitempty"` + // The status code + Code *int64 `json:"code,omitempty"` + // Debug information This field is often not exposed to protect against leaking sensitive information. + Debug *string `json:"debug,omitempty"` + // Further error details + Details map[string]interface{} `json:"details,omitempty"` + // The error ID Useful when trying to identify various errors in application logic. + Id *string `json:"id,omitempty"` + // Error message The error's message. + Message string `json:"message"` + // A human-readable reason for the error + Reason *string `json:"reason,omitempty"` + // The request ID The request ID is often exposed internally in order to trace errors across service architectures. This is often a UUID. + Request *string `json:"request,omitempty"` + // The status description + Status *string `json:"status,omitempty"` } // NewGenericError instantiates a new GenericError object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewGenericError() *GenericError { +func NewGenericError(message string) *GenericError { this := GenericError{} + this.Message = message return &this } @@ -74,10 +85,42 @@ func (o *GenericError) SetCode(v int64) { o.Code = &v } +// GetDebug returns the Debug field value if set, zero value otherwise. +func (o *GenericError) GetDebug() string { + if o == nil || o.Debug == nil { + var ret string + return ret + } + return *o.Debug +} + +// GetDebugOk returns a tuple with the Debug field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GenericError) GetDebugOk() (*string, bool) { + if o == nil || o.Debug == nil { + return nil, false + } + return o.Debug, true +} + +// HasDebug returns a boolean if a field has been set. +func (o *GenericError) HasDebug() bool { + if o != nil && o.Debug != nil { + return true + } + + return false +} + +// SetDebug gets a reference to the given string and assigns it to the Debug field. +func (o *GenericError) SetDebug(v string) { + o.Debug = &v +} + // GetDetails returns the Details field value if set, zero value otherwise. -func (o *GenericError) GetDetails() []map[string]interface{} { +func (o *GenericError) GetDetails() map[string]interface{} { if o == nil || o.Details == nil { - var ret []map[string]interface{} + var ret map[string]interface{} return ret } return o.Details @@ -85,7 +128,7 @@ func (o *GenericError) GetDetails() []map[string]interface{} { // GetDetailsOk returns a tuple with the Details field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *GenericError) GetDetailsOk() ([]map[string]interface{}, bool) { +func (o *GenericError) GetDetailsOk() (map[string]interface{}, bool) { if o == nil || o.Details == nil { return nil, false } @@ -101,41 +144,65 @@ func (o *GenericError) HasDetails() bool { return false } -// SetDetails gets a reference to the given []map[string]interface{} and assigns it to the Details field. -func (o *GenericError) SetDetails(v []map[string]interface{}) { +// SetDetails gets a reference to the given map[string]interface{} and assigns it to the Details field. +func (o *GenericError) SetDetails(v map[string]interface{}) { o.Details = v } -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *GenericError) GetMessage() string { - if o == nil || o.Message == nil { +// GetId returns the Id field value if set, zero value otherwise. +func (o *GenericError) GetId() string { + if o == nil || o.Id == nil { var ret string return ret } - return *o.Message + return *o.Id } -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *GenericError) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { +func (o *GenericError) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { return nil, false } - return o.Message, true + return o.Id, true } -// HasMessage returns a boolean if a field has been set. -func (o *GenericError) HasMessage() bool { - if o != nil && o.Message != nil { +// HasId returns a boolean if a field has been set. +func (o *GenericError) HasId() bool { + if o != nil && o.Id != nil { return true } return false } -// SetMessage gets a reference to the given string and assigns it to the Message field. +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GenericError) SetId(v string) { + o.Id = &v +} + +// GetMessage returns the Message field value +func (o *GenericError) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *GenericError) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value func (o *GenericError) SetMessage(v string) { - o.Message = &v + o.Message = v } // GetReason returns the Reason field value if set, zero value otherwise. @@ -239,10 +306,16 @@ func (o GenericError) MarshalJSON() ([]byte, error) { if o.Code != nil { toSerialize["code"] = o.Code } + if o.Debug != nil { + toSerialize["debug"] = o.Debug + } if o.Details != nil { toSerialize["details"] = o.Details } - if o.Message != nil { + if o.Id != nil { + toSerialize["id"] = o.Id + } + if true { toSerialize["message"] = o.Message } if o.Reason != nil { diff --git a/internal/httpclient/model_post_check_permission_body.go b/internal/httpclient/model_post_check_permission_body.go new file mode 100644 index 000000000..95f75a40e --- /dev/null +++ b/internal/httpclient/model_post_check_permission_body.go @@ -0,0 +1,262 @@ +/* + * Ory Keto API + * + * Documentation for all of Ory Keto's REST APIs. gRPC is documented separately. + * + * API version: 1.0.0 + * Contact: hi@ory.sh + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// PostCheckPermissionBody Check Permission using Post Request Body +type PostCheckPermissionBody struct { + // Namespace to query + Namespace *string `json:"namespace,omitempty"` + // Object to query + Object *string `json:"object,omitempty"` + // Relation to query + Relation *string `json:"relation,omitempty"` + // SubjectID to query Either SubjectSet or SubjectID can be provided. + SubjectId *string `json:"subject_id,omitempty"` + SubjectSet *SubjectSet `json:"subject_set,omitempty"` +} + +// NewPostCheckPermissionBody instantiates a new PostCheckPermissionBody object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPostCheckPermissionBody() *PostCheckPermissionBody { + this := PostCheckPermissionBody{} + return &this +} + +// NewPostCheckPermissionBodyWithDefaults instantiates a new PostCheckPermissionBody object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPostCheckPermissionBodyWithDefaults() *PostCheckPermissionBody { + this := PostCheckPermissionBody{} + return &this +} + +// GetNamespace returns the Namespace field value if set, zero value otherwise. +func (o *PostCheckPermissionBody) GetNamespace() string { + if o == nil || o.Namespace == nil { + var ret string + return ret + } + return *o.Namespace +} + +// GetNamespaceOk returns a tuple with the Namespace field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PostCheckPermissionBody) GetNamespaceOk() (*string, bool) { + if o == nil || o.Namespace == nil { + return nil, false + } + return o.Namespace, true +} + +// HasNamespace returns a boolean if a field has been set. +func (o *PostCheckPermissionBody) HasNamespace() bool { + if o != nil && o.Namespace != nil { + return true + } + + return false +} + +// SetNamespace gets a reference to the given string and assigns it to the Namespace field. +func (o *PostCheckPermissionBody) SetNamespace(v string) { + o.Namespace = &v +} + +// GetObject returns the Object field value if set, zero value otherwise. +func (o *PostCheckPermissionBody) GetObject() string { + if o == nil || o.Object == nil { + var ret string + return ret + } + return *o.Object +} + +// GetObjectOk returns a tuple with the Object field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PostCheckPermissionBody) GetObjectOk() (*string, bool) { + if o == nil || o.Object == nil { + return nil, false + } + return o.Object, true +} + +// HasObject returns a boolean if a field has been set. +func (o *PostCheckPermissionBody) HasObject() bool { + if o != nil && o.Object != nil { + return true + } + + return false +} + +// SetObject gets a reference to the given string and assigns it to the Object field. +func (o *PostCheckPermissionBody) SetObject(v string) { + o.Object = &v +} + +// GetRelation returns the Relation field value if set, zero value otherwise. +func (o *PostCheckPermissionBody) GetRelation() string { + if o == nil || o.Relation == nil { + var ret string + return ret + } + return *o.Relation +} + +// GetRelationOk returns a tuple with the Relation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PostCheckPermissionBody) GetRelationOk() (*string, bool) { + if o == nil || o.Relation == nil { + return nil, false + } + return o.Relation, true +} + +// HasRelation returns a boolean if a field has been set. +func (o *PostCheckPermissionBody) HasRelation() bool { + if o != nil && o.Relation != nil { + return true + } + + return false +} + +// SetRelation gets a reference to the given string and assigns it to the Relation field. +func (o *PostCheckPermissionBody) SetRelation(v string) { + o.Relation = &v +} + +// GetSubjectId returns the SubjectId field value if set, zero value otherwise. +func (o *PostCheckPermissionBody) GetSubjectId() string { + if o == nil || o.SubjectId == nil { + var ret string + return ret + } + return *o.SubjectId +} + +// GetSubjectIdOk returns a tuple with the SubjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PostCheckPermissionBody) GetSubjectIdOk() (*string, bool) { + if o == nil || o.SubjectId == nil { + return nil, false + } + return o.SubjectId, true +} + +// HasSubjectId returns a boolean if a field has been set. +func (o *PostCheckPermissionBody) HasSubjectId() bool { + if o != nil && o.SubjectId != nil { + return true + } + + return false +} + +// SetSubjectId gets a reference to the given string and assigns it to the SubjectId field. +func (o *PostCheckPermissionBody) SetSubjectId(v string) { + o.SubjectId = &v +} + +// GetSubjectSet returns the SubjectSet field value if set, zero value otherwise. +func (o *PostCheckPermissionBody) GetSubjectSet() SubjectSet { + if o == nil || o.SubjectSet == nil { + var ret SubjectSet + return ret + } + return *o.SubjectSet +} + +// GetSubjectSetOk returns a tuple with the SubjectSet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PostCheckPermissionBody) GetSubjectSetOk() (*SubjectSet, bool) { + if o == nil || o.SubjectSet == nil { + return nil, false + } + return o.SubjectSet, true +} + +// HasSubjectSet returns a boolean if a field has been set. +func (o *PostCheckPermissionBody) HasSubjectSet() bool { + if o != nil && o.SubjectSet != nil { + return true + } + + return false +} + +// SetSubjectSet gets a reference to the given SubjectSet and assigns it to the SubjectSet field. +func (o *PostCheckPermissionBody) SetSubjectSet(v SubjectSet) { + o.SubjectSet = &v +} + +func (o PostCheckPermissionBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Namespace != nil { + toSerialize["namespace"] = o.Namespace + } + if o.Object != nil { + toSerialize["object"] = o.Object + } + if o.Relation != nil { + toSerialize["relation"] = o.Relation + } + if o.SubjectId != nil { + toSerialize["subject_id"] = o.SubjectId + } + if o.SubjectSet != nil { + toSerialize["subject_set"] = o.SubjectSet + } + return json.Marshal(toSerialize) +} + +type NullablePostCheckPermissionBody struct { + value *PostCheckPermissionBody + isSet bool +} + +func (v NullablePostCheckPermissionBody) Get() *PostCheckPermissionBody { + return v.value +} + +func (v *NullablePostCheckPermissionBody) Set(val *PostCheckPermissionBody) { + v.value = val + v.isSet = true +} + +func (v NullablePostCheckPermissionBody) IsSet() bool { + return v.isSet +} + +func (v *NullablePostCheckPermissionBody) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePostCheckPermissionBody(val *PostCheckPermissionBody) *NullablePostCheckPermissionBody { + return &NullablePostCheckPermissionBody{value: val, isSet: true} +} + +func (v NullablePostCheckPermissionBody) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePostCheckPermissionBody) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/httpclient/model_post_check_permission_or_error_body.go b/internal/httpclient/model_post_check_permission_or_error_body.go new file mode 100644 index 000000000..4db64e541 --- /dev/null +++ b/internal/httpclient/model_post_check_permission_or_error_body.go @@ -0,0 +1,262 @@ +/* + * Ory Keto API + * + * Documentation for all of Ory Keto's REST APIs. gRPC is documented separately. + * + * API version: 1.0.0 + * Contact: hi@ory.sh + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// PostCheckPermissionOrErrorBody Post Check Permission Or Error Body +type PostCheckPermissionOrErrorBody struct { + // Namespace to query + Namespace *string `json:"namespace,omitempty"` + // Object to query + Object *string `json:"object,omitempty"` + // Relation to query + Relation *string `json:"relation,omitempty"` + // SubjectID to query Either SubjectSet or SubjectID can be provided. + SubjectId *string `json:"subject_id,omitempty"` + SubjectSet *SubjectSet `json:"subject_set,omitempty"` +} + +// NewPostCheckPermissionOrErrorBody instantiates a new PostCheckPermissionOrErrorBody object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPostCheckPermissionOrErrorBody() *PostCheckPermissionOrErrorBody { + this := PostCheckPermissionOrErrorBody{} + return &this +} + +// NewPostCheckPermissionOrErrorBodyWithDefaults instantiates a new PostCheckPermissionOrErrorBody object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPostCheckPermissionOrErrorBodyWithDefaults() *PostCheckPermissionOrErrorBody { + this := PostCheckPermissionOrErrorBody{} + return &this +} + +// GetNamespace returns the Namespace field value if set, zero value otherwise. +func (o *PostCheckPermissionOrErrorBody) GetNamespace() string { + if o == nil || o.Namespace == nil { + var ret string + return ret + } + return *o.Namespace +} + +// GetNamespaceOk returns a tuple with the Namespace field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PostCheckPermissionOrErrorBody) GetNamespaceOk() (*string, bool) { + if o == nil || o.Namespace == nil { + return nil, false + } + return o.Namespace, true +} + +// HasNamespace returns a boolean if a field has been set. +func (o *PostCheckPermissionOrErrorBody) HasNamespace() bool { + if o != nil && o.Namespace != nil { + return true + } + + return false +} + +// SetNamespace gets a reference to the given string and assigns it to the Namespace field. +func (o *PostCheckPermissionOrErrorBody) SetNamespace(v string) { + o.Namespace = &v +} + +// GetObject returns the Object field value if set, zero value otherwise. +func (o *PostCheckPermissionOrErrorBody) GetObject() string { + if o == nil || o.Object == nil { + var ret string + return ret + } + return *o.Object +} + +// GetObjectOk returns a tuple with the Object field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PostCheckPermissionOrErrorBody) GetObjectOk() (*string, bool) { + if o == nil || o.Object == nil { + return nil, false + } + return o.Object, true +} + +// HasObject returns a boolean if a field has been set. +func (o *PostCheckPermissionOrErrorBody) HasObject() bool { + if o != nil && o.Object != nil { + return true + } + + return false +} + +// SetObject gets a reference to the given string and assigns it to the Object field. +func (o *PostCheckPermissionOrErrorBody) SetObject(v string) { + o.Object = &v +} + +// GetRelation returns the Relation field value if set, zero value otherwise. +func (o *PostCheckPermissionOrErrorBody) GetRelation() string { + if o == nil || o.Relation == nil { + var ret string + return ret + } + return *o.Relation +} + +// GetRelationOk returns a tuple with the Relation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PostCheckPermissionOrErrorBody) GetRelationOk() (*string, bool) { + if o == nil || o.Relation == nil { + return nil, false + } + return o.Relation, true +} + +// HasRelation returns a boolean if a field has been set. +func (o *PostCheckPermissionOrErrorBody) HasRelation() bool { + if o != nil && o.Relation != nil { + return true + } + + return false +} + +// SetRelation gets a reference to the given string and assigns it to the Relation field. +func (o *PostCheckPermissionOrErrorBody) SetRelation(v string) { + o.Relation = &v +} + +// GetSubjectId returns the SubjectId field value if set, zero value otherwise. +func (o *PostCheckPermissionOrErrorBody) GetSubjectId() string { + if o == nil || o.SubjectId == nil { + var ret string + return ret + } + return *o.SubjectId +} + +// GetSubjectIdOk returns a tuple with the SubjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PostCheckPermissionOrErrorBody) GetSubjectIdOk() (*string, bool) { + if o == nil || o.SubjectId == nil { + return nil, false + } + return o.SubjectId, true +} + +// HasSubjectId returns a boolean if a field has been set. +func (o *PostCheckPermissionOrErrorBody) HasSubjectId() bool { + if o != nil && o.SubjectId != nil { + return true + } + + return false +} + +// SetSubjectId gets a reference to the given string and assigns it to the SubjectId field. +func (o *PostCheckPermissionOrErrorBody) SetSubjectId(v string) { + o.SubjectId = &v +} + +// GetSubjectSet returns the SubjectSet field value if set, zero value otherwise. +func (o *PostCheckPermissionOrErrorBody) GetSubjectSet() SubjectSet { + if o == nil || o.SubjectSet == nil { + var ret SubjectSet + return ret + } + return *o.SubjectSet +} + +// GetSubjectSetOk returns a tuple with the SubjectSet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PostCheckPermissionOrErrorBody) GetSubjectSetOk() (*SubjectSet, bool) { + if o == nil || o.SubjectSet == nil { + return nil, false + } + return o.SubjectSet, true +} + +// HasSubjectSet returns a boolean if a field has been set. +func (o *PostCheckPermissionOrErrorBody) HasSubjectSet() bool { + if o != nil && o.SubjectSet != nil { + return true + } + + return false +} + +// SetSubjectSet gets a reference to the given SubjectSet and assigns it to the SubjectSet field. +func (o *PostCheckPermissionOrErrorBody) SetSubjectSet(v SubjectSet) { + o.SubjectSet = &v +} + +func (o PostCheckPermissionOrErrorBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Namespace != nil { + toSerialize["namespace"] = o.Namespace + } + if o.Object != nil { + toSerialize["object"] = o.Object + } + if o.Relation != nil { + toSerialize["relation"] = o.Relation + } + if o.SubjectId != nil { + toSerialize["subject_id"] = o.SubjectId + } + if o.SubjectSet != nil { + toSerialize["subject_set"] = o.SubjectSet + } + return json.Marshal(toSerialize) +} + +type NullablePostCheckPermissionOrErrorBody struct { + value *PostCheckPermissionOrErrorBody + isSet bool +} + +func (v NullablePostCheckPermissionOrErrorBody) Get() *PostCheckPermissionOrErrorBody { + return v.value +} + +func (v *NullablePostCheckPermissionOrErrorBody) Set(val *PostCheckPermissionOrErrorBody) { + v.value = val + v.isSet = true +} + +func (v NullablePostCheckPermissionOrErrorBody) IsSet() bool { + return v.isSet +} + +func (v *NullablePostCheckPermissionOrErrorBody) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePostCheckPermissionOrErrorBody(val *PostCheckPermissionOrErrorBody) *NullablePostCheckPermissionOrErrorBody { + return &NullablePostCheckPermissionOrErrorBody{value: val, isSet: true} +} + +func (v NullablePostCheckPermissionOrErrorBody) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePostCheckPermissionOrErrorBody) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/httpclient/model_relation_query.go b/internal/httpclient/model_relation_query.go index b85040931..79c7aa36f 100644 --- a/internal/httpclient/model_relation_query.go +++ b/internal/httpclient/model_relation_query.go @@ -15,7 +15,7 @@ import ( "encoding/json" ) -// RelationQuery struct for RelationQuery +// RelationQuery Relation Query type RelationQuery struct { // Namespace to query Namespace *string `json:"namespace,omitempty"` diff --git a/internal/httpclient/model_relation_tuple.go b/internal/httpclient/model_relationship.go similarity index 69% rename from internal/httpclient/model_relation_tuple.go rename to internal/httpclient/model_relationship.go index dad3008fb..b34f88696 100644 --- a/internal/httpclient/model_relation_tuple.go +++ b/internal/httpclient/model_relationship.go @@ -15,8 +15,8 @@ import ( "encoding/json" ) -// RelationTuple struct for RelationTuple -type RelationTuple struct { +// Relationship Relationship +type Relationship struct { // Namespace of the Relation Tuple Namespace string `json:"namespace"` // Object of the Relation Tuple @@ -28,28 +28,28 @@ type RelationTuple struct { SubjectSet *SubjectSet `json:"subject_set,omitempty"` } -// NewRelationTuple instantiates a new RelationTuple object +// NewRelationship instantiates a new Relationship object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewRelationTuple(namespace string, object string, relation string) *RelationTuple { - this := RelationTuple{} +func NewRelationship(namespace string, object string, relation string) *Relationship { + this := Relationship{} this.Namespace = namespace this.Object = object this.Relation = relation return &this } -// NewRelationTupleWithDefaults instantiates a new RelationTuple object +// NewRelationshipWithDefaults instantiates a new Relationship object // This constructor will only assign default values to properties that have it defined, // but it doesn't guarantee that properties required by API are set -func NewRelationTupleWithDefaults() *RelationTuple { - this := RelationTuple{} +func NewRelationshipWithDefaults() *Relationship { + this := Relationship{} return &this } // GetNamespace returns the Namespace field value -func (o *RelationTuple) GetNamespace() string { +func (o *Relationship) GetNamespace() string { if o == nil { var ret string return ret @@ -60,7 +60,7 @@ func (o *RelationTuple) GetNamespace() string { // GetNamespaceOk returns a tuple with the Namespace field value // and a boolean to check if the value has been set. -func (o *RelationTuple) GetNamespaceOk() (*string, bool) { +func (o *Relationship) GetNamespaceOk() (*string, bool) { if o == nil { return nil, false } @@ -68,12 +68,12 @@ func (o *RelationTuple) GetNamespaceOk() (*string, bool) { } // SetNamespace sets field value -func (o *RelationTuple) SetNamespace(v string) { +func (o *Relationship) SetNamespace(v string) { o.Namespace = v } // GetObject returns the Object field value -func (o *RelationTuple) GetObject() string { +func (o *Relationship) GetObject() string { if o == nil { var ret string return ret @@ -84,7 +84,7 @@ func (o *RelationTuple) GetObject() string { // GetObjectOk returns a tuple with the Object field value // and a boolean to check if the value has been set. -func (o *RelationTuple) GetObjectOk() (*string, bool) { +func (o *Relationship) GetObjectOk() (*string, bool) { if o == nil { return nil, false } @@ -92,12 +92,12 @@ func (o *RelationTuple) GetObjectOk() (*string, bool) { } // SetObject sets field value -func (o *RelationTuple) SetObject(v string) { +func (o *Relationship) SetObject(v string) { o.Object = v } // GetRelation returns the Relation field value -func (o *RelationTuple) GetRelation() string { +func (o *Relationship) GetRelation() string { if o == nil { var ret string return ret @@ -108,7 +108,7 @@ func (o *RelationTuple) GetRelation() string { // GetRelationOk returns a tuple with the Relation field value // and a boolean to check if the value has been set. -func (o *RelationTuple) GetRelationOk() (*string, bool) { +func (o *Relationship) GetRelationOk() (*string, bool) { if o == nil { return nil, false } @@ -116,12 +116,12 @@ func (o *RelationTuple) GetRelationOk() (*string, bool) { } // SetRelation sets field value -func (o *RelationTuple) SetRelation(v string) { +func (o *Relationship) SetRelation(v string) { o.Relation = v } // GetSubjectId returns the SubjectId field value if set, zero value otherwise. -func (o *RelationTuple) GetSubjectId() string { +func (o *Relationship) GetSubjectId() string { if o == nil || o.SubjectId == nil { var ret string return ret @@ -131,7 +131,7 @@ func (o *RelationTuple) GetSubjectId() string { // GetSubjectIdOk returns a tuple with the SubjectId field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *RelationTuple) GetSubjectIdOk() (*string, bool) { +func (o *Relationship) GetSubjectIdOk() (*string, bool) { if o == nil || o.SubjectId == nil { return nil, false } @@ -139,7 +139,7 @@ func (o *RelationTuple) GetSubjectIdOk() (*string, bool) { } // HasSubjectId returns a boolean if a field has been set. -func (o *RelationTuple) HasSubjectId() bool { +func (o *Relationship) HasSubjectId() bool { if o != nil && o.SubjectId != nil { return true } @@ -148,12 +148,12 @@ func (o *RelationTuple) HasSubjectId() bool { } // SetSubjectId gets a reference to the given string and assigns it to the SubjectId field. -func (o *RelationTuple) SetSubjectId(v string) { +func (o *Relationship) SetSubjectId(v string) { o.SubjectId = &v } // GetSubjectSet returns the SubjectSet field value if set, zero value otherwise. -func (o *RelationTuple) GetSubjectSet() SubjectSet { +func (o *Relationship) GetSubjectSet() SubjectSet { if o == nil || o.SubjectSet == nil { var ret SubjectSet return ret @@ -163,7 +163,7 @@ func (o *RelationTuple) GetSubjectSet() SubjectSet { // GetSubjectSetOk returns a tuple with the SubjectSet field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *RelationTuple) GetSubjectSetOk() (*SubjectSet, bool) { +func (o *Relationship) GetSubjectSetOk() (*SubjectSet, bool) { if o == nil || o.SubjectSet == nil { return nil, false } @@ -171,7 +171,7 @@ func (o *RelationTuple) GetSubjectSetOk() (*SubjectSet, bool) { } // HasSubjectSet returns a boolean if a field has been set. -func (o *RelationTuple) HasSubjectSet() bool { +func (o *Relationship) HasSubjectSet() bool { if o != nil && o.SubjectSet != nil { return true } @@ -180,11 +180,11 @@ func (o *RelationTuple) HasSubjectSet() bool { } // SetSubjectSet gets a reference to the given SubjectSet and assigns it to the SubjectSet field. -func (o *RelationTuple) SetSubjectSet(v SubjectSet) { +func (o *Relationship) SetSubjectSet(v SubjectSet) { o.SubjectSet = &v } -func (o RelationTuple) MarshalJSON() ([]byte, error) { +func (o Relationship) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if true { toSerialize["namespace"] = o.Namespace @@ -204,38 +204,38 @@ func (o RelationTuple) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableRelationTuple struct { - value *RelationTuple +type NullableRelationship struct { + value *Relationship isSet bool } -func (v NullableRelationTuple) Get() *RelationTuple { +func (v NullableRelationship) Get() *Relationship { return v.value } -func (v *NullableRelationTuple) Set(val *RelationTuple) { +func (v *NullableRelationship) Set(val *Relationship) { v.value = val v.isSet = true } -func (v NullableRelationTuple) IsSet() bool { +func (v NullableRelationship) IsSet() bool { return v.isSet } -func (v *NullableRelationTuple) Unset() { +func (v *NullableRelationship) Unset() { v.value = nil v.isSet = false } -func NewNullableRelationTuple(val *RelationTuple) *NullableRelationTuple { - return &NullableRelationTuple{value: val, isSet: true} +func NewNullableRelationship(val *Relationship) *NullableRelationship { + return &NullableRelationship{value: val, isSet: true} } -func (v NullableRelationTuple) MarshalJSON() ([]byte, error) { +func (v NullableRelationship) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableRelationTuple) UnmarshalJSON(src []byte) error { +func (v *NullableRelationship) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/internal/httpclient/model_get_namespaces_response.go b/internal/httpclient/model_relationship_namespaces.go similarity index 55% rename from internal/httpclient/model_get_namespaces_response.go rename to internal/httpclient/model_relationship_namespaces.go index cb5b99d19..762388a09 100644 --- a/internal/httpclient/model_get_namespaces_response.go +++ b/internal/httpclient/model_relationship_namespaces.go @@ -15,30 +15,30 @@ import ( "encoding/json" ) -// GetNamespacesResponse struct for GetNamespacesResponse -type GetNamespacesResponse struct { +// RelationshipNamespaces Relationship Namespace List +type RelationshipNamespaces struct { Namespaces []Namespace `json:"namespaces,omitempty"` } -// NewGetNamespacesResponse instantiates a new GetNamespacesResponse object +// NewRelationshipNamespaces instantiates a new RelationshipNamespaces object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewGetNamespacesResponse() *GetNamespacesResponse { - this := GetNamespacesResponse{} +func NewRelationshipNamespaces() *RelationshipNamespaces { + this := RelationshipNamespaces{} return &this } -// NewGetNamespacesResponseWithDefaults instantiates a new GetNamespacesResponse object +// NewRelationshipNamespacesWithDefaults instantiates a new RelationshipNamespaces object // This constructor will only assign default values to properties that have it defined, // but it doesn't guarantee that properties required by API are set -func NewGetNamespacesResponseWithDefaults() *GetNamespacesResponse { - this := GetNamespacesResponse{} +func NewRelationshipNamespacesWithDefaults() *RelationshipNamespaces { + this := RelationshipNamespaces{} return &this } // GetNamespaces returns the Namespaces field value if set, zero value otherwise. -func (o *GetNamespacesResponse) GetNamespaces() []Namespace { +func (o *RelationshipNamespaces) GetNamespaces() []Namespace { if o == nil || o.Namespaces == nil { var ret []Namespace return ret @@ -48,7 +48,7 @@ func (o *GetNamespacesResponse) GetNamespaces() []Namespace { // GetNamespacesOk returns a tuple with the Namespaces field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *GetNamespacesResponse) GetNamespacesOk() ([]Namespace, bool) { +func (o *RelationshipNamespaces) GetNamespacesOk() ([]Namespace, bool) { if o == nil || o.Namespaces == nil { return nil, false } @@ -56,7 +56,7 @@ func (o *GetNamespacesResponse) GetNamespacesOk() ([]Namespace, bool) { } // HasNamespaces returns a boolean if a field has been set. -func (o *GetNamespacesResponse) HasNamespaces() bool { +func (o *RelationshipNamespaces) HasNamespaces() bool { if o != nil && o.Namespaces != nil { return true } @@ -65,11 +65,11 @@ func (o *GetNamespacesResponse) HasNamespaces() bool { } // SetNamespaces gets a reference to the given []Namespace and assigns it to the Namespaces field. -func (o *GetNamespacesResponse) SetNamespaces(v []Namespace) { +func (o *RelationshipNamespaces) SetNamespaces(v []Namespace) { o.Namespaces = v } -func (o GetNamespacesResponse) MarshalJSON() ([]byte, error) { +func (o RelationshipNamespaces) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Namespaces != nil { toSerialize["namespaces"] = o.Namespaces @@ -77,38 +77,38 @@ func (o GetNamespacesResponse) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableGetNamespacesResponse struct { - value *GetNamespacesResponse +type NullableRelationshipNamespaces struct { + value *RelationshipNamespaces isSet bool } -func (v NullableGetNamespacesResponse) Get() *GetNamespacesResponse { +func (v NullableRelationshipNamespaces) Get() *RelationshipNamespaces { return v.value } -func (v *NullableGetNamespacesResponse) Set(val *GetNamespacesResponse) { +func (v *NullableRelationshipNamespaces) Set(val *RelationshipNamespaces) { v.value = val v.isSet = true } -func (v NullableGetNamespacesResponse) IsSet() bool { +func (v NullableRelationshipNamespaces) IsSet() bool { return v.isSet } -func (v *NullableGetNamespacesResponse) Unset() { +func (v *NullableRelationshipNamespaces) Unset() { v.value = nil v.isSet = false } -func NewNullableGetNamespacesResponse(val *GetNamespacesResponse) *NullableGetNamespacesResponse { - return &NullableGetNamespacesResponse{value: val, isSet: true} +func NewNullableRelationshipNamespaces(val *RelationshipNamespaces) *NullableRelationshipNamespaces { + return &NullableRelationshipNamespaces{value: val, isSet: true} } -func (v NullableGetNamespacesResponse) MarshalJSON() ([]byte, error) { +func (v NullableRelationshipNamespaces) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableGetNamespacesResponse) UnmarshalJSON(src []byte) error { +func (v *NullableRelationshipNamespaces) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/internal/httpclient/model_patch_delta.go b/internal/httpclient/model_relationship_patch.go similarity index 57% rename from internal/httpclient/model_patch_delta.go rename to internal/httpclient/model_relationship_patch.go index 49ee97289..a4d3db854 100644 --- a/internal/httpclient/model_patch_delta.go +++ b/internal/httpclient/model_relationship_patch.go @@ -15,31 +15,31 @@ import ( "encoding/json" ) -// PatchDelta struct for PatchDelta -type PatchDelta struct { - Action *string `json:"action,omitempty"` - RelationTuple *RelationTuple `json:"relation_tuple,omitempty"` +// RelationshipPatch Payload for patching a relationship +type RelationshipPatch struct { + Action *string `json:"action,omitempty"` + RelationTuple *Relationship `json:"relation_tuple,omitempty"` } -// NewPatchDelta instantiates a new PatchDelta object +// NewRelationshipPatch instantiates a new RelationshipPatch object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewPatchDelta() *PatchDelta { - this := PatchDelta{} +func NewRelationshipPatch() *RelationshipPatch { + this := RelationshipPatch{} return &this } -// NewPatchDeltaWithDefaults instantiates a new PatchDelta object +// NewRelationshipPatchWithDefaults instantiates a new RelationshipPatch object // This constructor will only assign default values to properties that have it defined, // but it doesn't guarantee that properties required by API are set -func NewPatchDeltaWithDefaults() *PatchDelta { - this := PatchDelta{} +func NewRelationshipPatchWithDefaults() *RelationshipPatch { + this := RelationshipPatch{} return &this } // GetAction returns the Action field value if set, zero value otherwise. -func (o *PatchDelta) GetAction() string { +func (o *RelationshipPatch) GetAction() string { if o == nil || o.Action == nil { var ret string return ret @@ -49,7 +49,7 @@ func (o *PatchDelta) GetAction() string { // GetActionOk returns a tuple with the Action field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *PatchDelta) GetActionOk() (*string, bool) { +func (o *RelationshipPatch) GetActionOk() (*string, bool) { if o == nil || o.Action == nil { return nil, false } @@ -57,7 +57,7 @@ func (o *PatchDelta) GetActionOk() (*string, bool) { } // HasAction returns a boolean if a field has been set. -func (o *PatchDelta) HasAction() bool { +func (o *RelationshipPatch) HasAction() bool { if o != nil && o.Action != nil { return true } @@ -66,14 +66,14 @@ func (o *PatchDelta) HasAction() bool { } // SetAction gets a reference to the given string and assigns it to the Action field. -func (o *PatchDelta) SetAction(v string) { +func (o *RelationshipPatch) SetAction(v string) { o.Action = &v } // GetRelationTuple returns the RelationTuple field value if set, zero value otherwise. -func (o *PatchDelta) GetRelationTuple() RelationTuple { +func (o *RelationshipPatch) GetRelationTuple() Relationship { if o == nil || o.RelationTuple == nil { - var ret RelationTuple + var ret Relationship return ret } return *o.RelationTuple @@ -81,7 +81,7 @@ func (o *PatchDelta) GetRelationTuple() RelationTuple { // GetRelationTupleOk returns a tuple with the RelationTuple field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *PatchDelta) GetRelationTupleOk() (*RelationTuple, bool) { +func (o *RelationshipPatch) GetRelationTupleOk() (*Relationship, bool) { if o == nil || o.RelationTuple == nil { return nil, false } @@ -89,7 +89,7 @@ func (o *PatchDelta) GetRelationTupleOk() (*RelationTuple, bool) { } // HasRelationTuple returns a boolean if a field has been set. -func (o *PatchDelta) HasRelationTuple() bool { +func (o *RelationshipPatch) HasRelationTuple() bool { if o != nil && o.RelationTuple != nil { return true } @@ -97,12 +97,12 @@ func (o *PatchDelta) HasRelationTuple() bool { return false } -// SetRelationTuple gets a reference to the given RelationTuple and assigns it to the RelationTuple field. -func (o *PatchDelta) SetRelationTuple(v RelationTuple) { +// SetRelationTuple gets a reference to the given Relationship and assigns it to the RelationTuple field. +func (o *RelationshipPatch) SetRelationTuple(v Relationship) { o.RelationTuple = &v } -func (o PatchDelta) MarshalJSON() ([]byte, error) { +func (o RelationshipPatch) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Action != nil { toSerialize["action"] = o.Action @@ -113,38 +113,38 @@ func (o PatchDelta) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullablePatchDelta struct { - value *PatchDelta +type NullableRelationshipPatch struct { + value *RelationshipPatch isSet bool } -func (v NullablePatchDelta) Get() *PatchDelta { +func (v NullableRelationshipPatch) Get() *RelationshipPatch { return v.value } -func (v *NullablePatchDelta) Set(val *PatchDelta) { +func (v *NullableRelationshipPatch) Set(val *RelationshipPatch) { v.value = val v.isSet = true } -func (v NullablePatchDelta) IsSet() bool { +func (v NullableRelationshipPatch) IsSet() bool { return v.isSet } -func (v *NullablePatchDelta) Unset() { +func (v *NullableRelationshipPatch) Unset() { v.value = nil v.isSet = false } -func NewNullablePatchDelta(val *PatchDelta) *NullablePatchDelta { - return &NullablePatchDelta{value: val, isSet: true} +func NewNullableRelationshipPatch(val *RelationshipPatch) *NullableRelationshipPatch { + return &NullableRelationshipPatch{value: val, isSet: true} } -func (v NullablePatchDelta) MarshalJSON() ([]byte, error) { +func (v NullableRelationshipPatch) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullablePatchDelta) UnmarshalJSON(src []byte) error { +func (v *NullableRelationshipPatch) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/internal/httpclient/model_get_relation_tuples_response.go b/internal/httpclient/model_relationships.go similarity index 55% rename from internal/httpclient/model_get_relation_tuples_response.go rename to internal/httpclient/model_relationships.go index 360f47f03..bfd972cfc 100644 --- a/internal/httpclient/model_get_relation_tuples_response.go +++ b/internal/httpclient/model_relationships.go @@ -15,32 +15,32 @@ import ( "encoding/json" ) -// GetRelationTuplesResponse struct for GetRelationTuplesResponse -type GetRelationTuplesResponse struct { +// Relationships Paginated Relationship List +type Relationships struct { // The opaque token to provide in a subsequent request to get the next page. It is the empty string iff this is the last page. - NextPageToken *string `json:"next_page_token,omitempty"` - RelationTuples []RelationTuple `json:"relation_tuples,omitempty"` + NextPageToken *string `json:"next_page_token,omitempty"` + RelationTuples []Relationship `json:"relation_tuples,omitempty"` } -// NewGetRelationTuplesResponse instantiates a new GetRelationTuplesResponse object +// NewRelationships instantiates a new Relationships object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewGetRelationTuplesResponse() *GetRelationTuplesResponse { - this := GetRelationTuplesResponse{} +func NewRelationships() *Relationships { + this := Relationships{} return &this } -// NewGetRelationTuplesResponseWithDefaults instantiates a new GetRelationTuplesResponse object +// NewRelationshipsWithDefaults instantiates a new Relationships object // This constructor will only assign default values to properties that have it defined, // but it doesn't guarantee that properties required by API are set -func NewGetRelationTuplesResponseWithDefaults() *GetRelationTuplesResponse { - this := GetRelationTuplesResponse{} +func NewRelationshipsWithDefaults() *Relationships { + this := Relationships{} return &this } // GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. -func (o *GetRelationTuplesResponse) GetNextPageToken() string { +func (o *Relationships) GetNextPageToken() string { if o == nil || o.NextPageToken == nil { var ret string return ret @@ -50,7 +50,7 @@ func (o *GetRelationTuplesResponse) GetNextPageToken() string { // GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *GetRelationTuplesResponse) GetNextPageTokenOk() (*string, bool) { +func (o *Relationships) GetNextPageTokenOk() (*string, bool) { if o == nil || o.NextPageToken == nil { return nil, false } @@ -58,7 +58,7 @@ func (o *GetRelationTuplesResponse) GetNextPageTokenOk() (*string, bool) { } // HasNextPageToken returns a boolean if a field has been set. -func (o *GetRelationTuplesResponse) HasNextPageToken() bool { +func (o *Relationships) HasNextPageToken() bool { if o != nil && o.NextPageToken != nil { return true } @@ -67,14 +67,14 @@ func (o *GetRelationTuplesResponse) HasNextPageToken() bool { } // SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. -func (o *GetRelationTuplesResponse) SetNextPageToken(v string) { +func (o *Relationships) SetNextPageToken(v string) { o.NextPageToken = &v } // GetRelationTuples returns the RelationTuples field value if set, zero value otherwise. -func (o *GetRelationTuplesResponse) GetRelationTuples() []RelationTuple { +func (o *Relationships) GetRelationTuples() []Relationship { if o == nil || o.RelationTuples == nil { - var ret []RelationTuple + var ret []Relationship return ret } return o.RelationTuples @@ -82,7 +82,7 @@ func (o *GetRelationTuplesResponse) GetRelationTuples() []RelationTuple { // GetRelationTuplesOk returns a tuple with the RelationTuples field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *GetRelationTuplesResponse) GetRelationTuplesOk() ([]RelationTuple, bool) { +func (o *Relationships) GetRelationTuplesOk() ([]Relationship, bool) { if o == nil || o.RelationTuples == nil { return nil, false } @@ -90,7 +90,7 @@ func (o *GetRelationTuplesResponse) GetRelationTuplesOk() ([]RelationTuple, bool } // HasRelationTuples returns a boolean if a field has been set. -func (o *GetRelationTuplesResponse) HasRelationTuples() bool { +func (o *Relationships) HasRelationTuples() bool { if o != nil && o.RelationTuples != nil { return true } @@ -98,12 +98,12 @@ func (o *GetRelationTuplesResponse) HasRelationTuples() bool { return false } -// SetRelationTuples gets a reference to the given []RelationTuple and assigns it to the RelationTuples field. -func (o *GetRelationTuplesResponse) SetRelationTuples(v []RelationTuple) { +// SetRelationTuples gets a reference to the given []Relationship and assigns it to the RelationTuples field. +func (o *Relationships) SetRelationTuples(v []Relationship) { o.RelationTuples = v } -func (o GetRelationTuplesResponse) MarshalJSON() ([]byte, error) { +func (o Relationships) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.NextPageToken != nil { toSerialize["next_page_token"] = o.NextPageToken @@ -114,38 +114,38 @@ func (o GetRelationTuplesResponse) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableGetRelationTuplesResponse struct { - value *GetRelationTuplesResponse +type NullableRelationships struct { + value *Relationships isSet bool } -func (v NullableGetRelationTuplesResponse) Get() *GetRelationTuplesResponse { +func (v NullableRelationships) Get() *Relationships { return v.value } -func (v *NullableGetRelationTuplesResponse) Set(val *GetRelationTuplesResponse) { +func (v *NullableRelationships) Set(val *Relationships) { v.value = val v.isSet = true } -func (v NullableGetRelationTuplesResponse) IsSet() bool { +func (v NullableRelationships) IsSet() bool { return v.isSet } -func (v *NullableGetRelationTuplesResponse) Unset() { +func (v *NullableRelationships) Unset() { v.value = nil v.isSet = false } -func NewNullableGetRelationTuplesResponse(val *GetRelationTuplesResponse) *NullableGetRelationTuplesResponse { - return &NullableGetRelationTuplesResponse{value: val, isSet: true} +func NewNullableRelationships(val *Relationships) *NullableRelationships { + return &NullableRelationships{value: val, isSet: true} } -func (v NullableGetRelationTuplesResponse) MarshalJSON() ([]byte, error) { +func (v NullableRelationships) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableGetRelationTuplesResponse) UnmarshalJSON(src []byte) error { +func (v *NullableRelationships) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/internal/namespace/namespacehandler/handler.go b/internal/namespace/namespacehandler/handler.go index 315fab3d9..66e1adabb 100644 --- a/internal/namespace/namespacehandler/handler.go +++ b/internal/namespace/namespacehandler/handler.go @@ -64,7 +64,7 @@ func (h *handler) ListNamespaces(ctx context.Context, _ *rts.ListNamespacesReque return &rts.ListNamespacesResponse{Namespaces: apiNamespaces}, nil } -// swagger:route GET /namespaces namespaces getNamespaces +// swagger:route GET /namespaces relationship listRelationshipNamespaces // // # Query namespaces // @@ -76,8 +76,8 @@ func (h *handler) ListNamespaces(ctx context.Context, _ *rts.ListNamespacesReque // Schemes: http, https // // Responses: -// 200: getNamespacesResponse -// 500: genericError +// 200: relationshipNamespaces +// default: errorGeneric func (h *handler) getNamespaces(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { res, err := h.ListNamespaces(r.Context(), nil) if err != nil { diff --git a/internal/persistence/sql/migrations/migratest/migration_test.go b/internal/persistence/sql/migrations/migratest/migration_test.go index 09e202eb4..3d67a60fb 100644 --- a/internal/persistence/sql/migrations/migratest/migration_test.go +++ b/internal/persistence/sql/migrations/migratest/migration_test.go @@ -98,7 +98,7 @@ func TestMigrations(t *testing.T) { ).Exec()), sqlcon.ErrNoSuchTable) }) - t.Run("table=relation tuples", func(t *testing.T) { + t.Run("table=relationships", func(t *testing.T) { actualRts, next, err := p.GetRelationTuples(ctx, &relationtuple.RelationQuery{Namespace: &namespaces[0].Name}) require.NoError(t, err) assert.Equal(t, "", next) diff --git a/internal/persistence/sql/migrations/uuidmapping/uuid_mapping_migrator.go b/internal/persistence/sql/migrations/uuidmapping/uuid_mapping_migrator.go index e4db40c64..1ff99350f 100644 --- a/internal/persistence/sql/migrations/uuidmapping/uuid_mapping_migrator.go +++ b/internal/persistence/sql/migrations/uuidmapping/uuid_mapping_migrator.go @@ -199,7 +199,7 @@ var ( for { relationTuples, err = GetRelationTuples[OldRelationTuple](conn, lastID) if err != nil { - return fmt.Errorf("could not get old relation tuples: %w", err) + return fmt.Errorf("could not get old relationships: %w", err) } if len(relationTuples) == 0 { break @@ -244,7 +244,7 @@ var ( for { relationTuples, err = GetRelationTuples[NewRelationTuple](conn, lastID) if err != nil { - return fmt.Errorf("could not get new relation tuples: %w", err) + return fmt.Errorf("could not get new relationships: %w", err) } if len(relationTuples) == 0 { break diff --git a/internal/relationtuple/read_server.go b/internal/relationtuple/read_server.go index 51da7c5a4..bb4e3b915 100644 --- a/internal/relationtuple/read_server.go +++ b/internal/relationtuple/read_server.go @@ -106,11 +106,11 @@ func (h *handler) ListRelationTuples(ctx context.Context, req *rts.ListRelationT return resp, nil } -// swagger:route GET /relation-tuples read getRelationTuples +// swagger:route GET /relation-tuples relationship getRelationships // -// # Query relation tuples +// # Query relationships // -// Get all relation tuples that match the query. Only the namespace field is required. +// Get all relationships that match the query. Only the namespace field is required. // // Consumes: // - application/x-www-form-urlencoded @@ -121,9 +121,9 @@ func (h *handler) ListRelationTuples(ctx context.Context, req *rts.ListRelationT // Schemes: http, https // // Responses: -// 200: getRelationTuplesResponse -// 404: genericError -// 500: genericError +// 200: relationships +// 404: errorGeneric +// default: errorGeneric func (h *handler) getRelations(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { ctx := r.Context() @@ -138,7 +138,7 @@ func (h *handler) getRelations(w http.ResponseWriter, r *http.Request, _ httprou for k := range q { l = l.WithField(k, q.Get(k)) } - l.Debug("querying relation tuples") + l.Debug("querying relationships") var paginationOpts []x.PaginationOptionSetter if pageToken := q.Get("page_token"); pageToken != "" { diff --git a/internal/relationtuple/swagger_definitions.go b/internal/relationtuple/swagger_definitions.go index 4127b0c21..f8abccda0 100644 --- a/internal/relationtuple/swagger_definitions.go +++ b/internal/relationtuple/swagger_definitions.go @@ -9,38 +9,39 @@ import ( ) var ( - _ = (*patchPayload)(nil) - _ = (*getRelationsParams)(nil) - _ = (*bodyRelationTuple)(nil) - _ = (*queryRelationTuple)(nil) + _ = (*patchRelationships)(nil) + _ = (*getRelationships)(nil) + _ = (*relationshipInQuery)(nil) ) -// The patch request payload +// Patch Relationships Request Parameters // -// swagger:parameters patchRelationTuples -type patchPayload struct { +// swagger:parameters patchRelationships +type patchRelationships struct { // in:body - Payload []*ketoapi.PatchDelta + Body []*ketoapi.PatchDelta } -// swagger:parameters getRelationTuples -type getRelationsParams struct { - // Namespace of the Relation Tuple +// Get Relationships Request Parameters +// +// swagger:parameters getRelationships +type getRelationships struct { + // Namespace of the Relationship // // in: query Namespace string `json:"namespace"` - // Object of the Relation Tuple + // Object of the Relationship // // in: query Object string `json:"object"` - // Relation of the Relation Tuple + // Relation of the Relationship // // in: query Relation string `json:"relation"` - // SubjectID of the Relation Tuple + // SubjectID of the Relationship // // in: query // Either subject_set.* or subject_id are required. @@ -68,34 +69,26 @@ type getRelationsParams struct { x.PaginationOptions } -// The basic ACL relation tuple -// -// swagger:parameters postCheck createRelationTuple -type bodyRelationTuple struct { - // in: body - Payload ketoapi.RelationQuery -} - -// The basic ACL relation tuple +// The relationship parameters in the URL query. // -// swagger:parameters getCheck deleteRelationTuples -type queryRelationTuple struct { - // Namespace of the Relation Tuple +// swagger:parameters checkPermission checkPermissionOrError deleteRelationships +type relationshipInQuery struct { + // Namespace of the Relationship // // in: query Namespace string `json:"namespace"` - // Object of the Relation Tuple + // Object of the Relationship // // in: query Object string `json:"object"` - // Relation of the Relation Tuple + // Relation of the Relationship // // in: query Relation string `json:"relation"` - // SubjectID of the Relation Tuple + // SubjectID of the Relationship // // in: query // Either subject_set.* or subject_id are required. diff --git a/internal/relationtuple/test_helper.go b/internal/relationtuple/test_helper.go index 9e68f9a90..71fa85d00 100644 --- a/internal/relationtuple/test_helper.go +++ b/internal/relationtuple/test_helper.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" ) -// MapAndWriteTuples is a test helper to write relation tuples to the database +// MapAndWriteTuples is a test helper to write relationships to the database // while mapping all strings to UUIDs. func MapAndWriteTuples(t *testing.T, m interface { MapperProvider diff --git a/internal/relationtuple/transact_server.go b/internal/relationtuple/transact_server.go index 330155869..9100db6ef 100644 --- a/internal/relationtuple/transact_server.go +++ b/internal/relationtuple/transact_server.go @@ -87,11 +87,26 @@ func (h *handler) DeleteRelationTuples(ctx context.Context, req *rts.DeleteRelat return &rts.DeleteRelationTuplesResponse{}, nil } -// swagger:route PUT /admin/relation-tuples write createRelationTuple +// Create Relationship Request Parameters // -// # Create a Relation Tuple +// swagger:parameters createRelationship +type createRelationship struct { + // in: body + Body createRelationshipBody +} + +// Create Relationship Request Body +// +// swagger:model createRelationshipBody +type createRelationshipBody struct { + ketoapi.RelationQuery +} + +// swagger:route PUT /admin/relation-tuples relationship createRelationship +// +// # Create a Relationship // -// Use this endpoint to create a relation tuple. +// Use this endpoint to create a relationship. // // Consumes: // - application/json @@ -102,9 +117,9 @@ func (h *handler) DeleteRelationTuples(ctx context.Context, req *rts.DeleteRelat // Schemes: http, https // // Responses: -// 201: relationQuery -// 400: genericError -// 500: genericError +// 201: relationship +// 400: errorGeneric +// default: errorGeneric func (h *handler) createRelation(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { ctx := r.Context() @@ -139,11 +154,11 @@ func (h *handler) createRelation(w http.ResponseWriter, r *http.Request, _ httpr ) } -// swagger:route DELETE /admin/relation-tuples write deleteRelationTuples +// swagger:route DELETE /admin/relation-tuples relationship deleteRelationships // -// # Delete Relation Tuples +// # Delete Relationships // -// Use this endpoint to delete relation tuples +// Use this endpoint to delete relationships // // Consumes: // - application/x-www-form-urlencoded @@ -155,8 +170,8 @@ func (h *handler) createRelation(w http.ResponseWriter, r *http.Request, _ httpr // // Responses: // 204: emptyResponse -// 400: genericError -// 500: genericError +// 400: errorGeneric +// default: errorGeneric func (h *handler) deleteRelations(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { ctx := r.Context() @@ -171,7 +186,7 @@ func (h *handler) deleteRelations(w http.ResponseWriter, r *http.Request, _ http for k := range q { l = l.WithField(k, q.Get(k)) } - l.Debug("deleting relation tuples") + l.Debug("deleting relationships") iq, err := h.d.Mapper().FromQuery(ctx, query) if err != nil { @@ -180,7 +195,7 @@ func (h *handler) deleteRelations(w http.ResponseWriter, r *http.Request, _ http return } if err := h.d.RelationTupleManager().DeleteAllRelationTuples(ctx, iq); err != nil { - l.WithError(err).Errorf("got an error while deleting relation tuples") + l.WithError(err).Errorf("got an error while deleting relationships") h.d.Writer().WriteError(w, r, herodot.ErrInternalServerError.WithError(err.Error())) return } @@ -197,11 +212,11 @@ func internalTuplesWithAction(deltas []*ketoapi.PatchDelta, action ketoapi.Patch return } -// swagger:route PATCH /admin/relation-tuples write patchRelationTuples +// swagger:route PATCH /admin/relation-tuples relationship patchRelationships // -// # Patch Multiple Relation Tuples +// # Patch Multiple Relationships // -// Use this endpoint to patch one or more relation tuples. +// Use this endpoint to patch one or more relationships. // // Consumes: // - application/json @@ -213,9 +228,9 @@ func internalTuplesWithAction(deltas []*ketoapi.PatchDelta, action ketoapi.Patch // // Responses: // 204: emptyResponse -// 400: genericError -// 404: genericError -// 500: genericError +// 400: errorGeneric +// 404: errorGeneric +// default: errorGeneric func (h *handler) patchRelationTuples(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { ctx := r.Context() diff --git a/internal/relationtuple/uuid_mapping_test.go b/internal/relationtuple/uuid_mapping_test.go index 5f2c757e5..7100568cd 100644 --- a/internal/relationtuple/uuid_mapping_test.go +++ b/internal/relationtuple/uuid_mapping_test.go @@ -29,14 +29,14 @@ func TestMapper(t *testing.T) { } require.NoError(t, reg.Config(ctx).Set(config.KeyNamespaces, []*namespace.Namespace{&nspace})) - t.Run("items=relation tuples", func(t *testing.T) { + t.Run("items=relationships", func(t *testing.T) { for _, tc := range []struct { name string rts []*ketoapi.RelationTuple err error }{ { - name: "no relation tuples", + name: "no relationships", rts: []*ketoapi.RelationTuple{}, }, { @@ -62,7 +62,7 @@ func TestMapper(t *testing.T) { err: ketoapi.ErrNilSubject, }, { - name: "many relation tuples", + name: "many relationships", rts: func() []*ketoapi.RelationTuple { rts := make([]*ketoapi.RelationTuple, 10) for i := range rts { diff --git a/internal/schema/handler.go b/internal/schema/handler.go index 841cc85ff..bc155b03c 100644 --- a/internal/schema/handler.go +++ b/internal/schema/handler.go @@ -51,31 +51,37 @@ func (h *Handler) Check(_ context.Context, request *opl.CheckRequest) (*opl.Chec return &opl.CheckResponse{ParseErrors: apiErrors}, nil } -// swagger:route POST /opl/syntax/check syntax checkOplSyntax +// Check OPL Syntax Request Parameters +// +// swagger:parameters checkOplSyntax +type checkOplSyntax struct { + // in: body + Body checkOplSyntaxBody +} + +// Ory Permission Language Document +// +// swagger:model checkOplSyntaxBody +type checkOplSyntaxBody string + +// swagger:route POST /opl/syntax/check relationship checkOplSyntax // // # Check the syntax of an OPL file // // The OPL file is expected in the body of the request. // -// Consumes: -// - text/plain -// -// Produces: -// - application/json +// Consumes: +// - text/plain // -// Schemes: http, https +// Produces: +// - application/json // -// Parameters: -// + name: content -// in: body -// description: the OPL content to check -// required: true -// type: string +// Schemes: http, https // -// Responses: -// 200: postCheckOplSyntaxResponse -// 400: genericError -// 500: genericError +// Responses: +// 200: checkOplSyntaxResult +// 400: errorGeneric +// default: errorGeneric func (h *Handler) postCheckOplSyntax(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { data, err := io.ReadAll(r.Body) if err != nil { diff --git a/ketoapi/public_api_definitions.go b/ketoapi/public_api_definitions.go index 902f4f5f8..dd8d9e785 100644 --- a/ketoapi/public_api_definitions.go +++ b/ketoapi/public_api_definitions.go @@ -29,7 +29,9 @@ type Namespace struct { Name string `json:"name"` } -// swagger:model relationTuple +// Relationship +// +// swagger:model relationship type RelationTuple struct { // Namespace of the Relation Tuple // @@ -50,6 +52,7 @@ type RelationTuple struct { // // Either SubjectSet or SubjectID can be provided. SubjectID *string `json:"subject_id,omitempty"` + // SubjectSet of the Relation Tuple // // Either SubjectSet or SubjectID can be provided. @@ -76,6 +79,8 @@ type SubjectSet struct { Relation string `json:"relation"` } +// Relation Query +// // swagger:model relationQuery type RelationQuery struct { // Namespace to query @@ -99,7 +104,9 @@ type RelationQuery struct { SubjectSet *SubjectSet `json:"subject_set,omitempty"` } -// swagger:model patchDelta +// Payload for patching a relationship +// +// swagger:model relationshipPatch type PatchDelta struct { Action PatchAction `json:"action"` RelationTuple *RelationTuple `json:"relation_tuple"` @@ -120,7 +127,9 @@ const ( SubjectSetRelationKey = "subject_set.relation" ) -// swagger:model getRelationTuplesResponse +// Paginated Relationship List +// +// swagger:model relationships type GetResponse struct { RelationTuples []*RelationTuple `json:"relation_tuples"` // The opaque token to provide in a subsequent request @@ -129,7 +138,9 @@ type GetResponse struct { NextPageToken string `json:"next_page_token"` } -// swagger:model getNamespacesResponse +// Relationship Namespace List +// +// swagger:model relationshipNamespaces type GetNamespacesResponse struct { Namespaces []Namespace `json:"namespaces"` } @@ -187,8 +198,8 @@ type tuple[T any] interface { FromProto(*rts.RelationTuple) T } -// Tree is a generic tree of either internal relation tuples (with UUIDs for -// objects, etc.) or API relation tuples (with strings for objects, etc.). +// Tree is a generic tree of either internal relationships (with UUIDs for +// objects, etc.) or API relationships (with strings for objects, etc.). type Tree[T tuple[T]] struct { // Propagate all struct changes to `swaggerOnlyExpandTree` as well. // The type of the node. @@ -207,7 +218,7 @@ type Tree[T tuple[T]] struct { // OpenAPI spec, since go-swagger does not understand generics :(. // This can be fixed by using grpc-gateway. -// swagger:model expandTree +// swagger:model expandedPermissionTree type swaggerOnlyExpandTree struct { // nolint // The type of the node. // @@ -233,7 +244,7 @@ type SourcePosition struct { // CheckOPLSyntaxResponse represents the response for an OPL syntax check request. // -// swagger:model postCheckOplSyntaxResponse +// swagger:model checkOplSyntaxResult type CheckOPLSyntaxResponse struct { // The list of syntax errors // diff --git a/proto/ory/keto/relation_tuples/v1alpha2/read_service.proto b/proto/ory/keto/relation_tuples/v1alpha2/read_service.proto index d6c20efc0..55380299d 100644 --- a/proto/ory/keto/relation_tuples/v1alpha2/read_service.proto +++ b/proto/ory/keto/relation_tuples/v1alpha2/read_service.proto @@ -12,20 +12,20 @@ option java_outer_classname = "ReadServiceProto"; option java_package = "sh.ory.keto.relation_tuples.v1alpha2"; option php_namespace = "Ory\\Keto\\RelationTuples\\v1alpha2"; -// The service to query relation tuples. +// The service to query relationships. // // This service is part of the [read-APIs](../concepts/api-overview.mdx#read-apis). service ReadService { - // Lists ACL relation tuples. + // Lists ACL relationships. rpc ListRelationTuples(ListRelationTuplesRequest) returns (ListRelationTuplesResponse); } // Request for ReadService.ListRelationTuples RPC. // See `ListRelationTuplesRequest_Query` for how to filter the query. message ListRelationTuplesRequest { - // The query for listing relation tuples. + // The query for listing relationships. // Clients can specify any optional field to - // partially filter for specific relation tuples. + // partially filter for specific relationships. // // Example use cases (namespace is always required): // - object only: display a list of all permissions referring to a specific object @@ -85,7 +85,7 @@ message ListRelationTuplesRequest { // The response of a ReadService.ListRelationTuples RPC. message ListRelationTuplesResponse { - // The relation tuples matching the list request. + // The relationships matching the list request. repeated RelationTuple relation_tuples = 1; // The token required to get the next page. // If this is the last page, the token will be the empty string. diff --git a/proto/ory/keto/relation_tuples/v1alpha2/relation_tuples.proto b/proto/ory/keto/relation_tuples/v1alpha2/relation_tuples.proto index 441804ec9..7cd1d17e0 100644 --- a/proto/ory/keto/relation_tuples/v1alpha2/relation_tuples.proto +++ b/proto/ory/keto/relation_tuples/v1alpha2/relation_tuples.proto @@ -24,9 +24,9 @@ message RelationTuple { Subject subject = 4; } -// The query for listing relation tuples. +// The query for listing relationships. // Clients can specify any optional field to -// partially filter for specific relation tuples. +// partially filter for specific relationships. // // Example use cases (namespace is always required): // - object only: display a list of all permissions referring to a specific object diff --git a/proto/ory/keto/relation_tuples/v1alpha2/write_service.proto b/proto/ory/keto/relation_tuples/v1alpha2/write_service.proto index 20c2387ed..f29e94937 100644 --- a/proto/ory/keto/relation_tuples/v1alpha2/write_service.proto +++ b/proto/ory/keto/relation_tuples/v1alpha2/write_service.proto @@ -15,15 +15,15 @@ option php_namespace = "Ory\\Keto\\RelationTuples\\v1alpha2"; // // This service is part of the [write-APIs](../concepts/api-overview.mdx#write-apis). service WriteService { - // Writes one or more relation tuples in a single transaction. + // Writes one or more relationships in a single transaction. rpc TransactRelationTuples(TransactRelationTuplesRequest) returns (TransactRelationTuplesResponse); - // Deletes relation tuples based on relation query + // Deletes relationships based on relation query rpc DeleteRelationTuples(DeleteRelationTuplesRequest) returns (DeleteRelationTuplesResponse); } // The request of a WriteService.TransactRelationTuples RPC. message TransactRelationTuplesRequest { - // The write delta for the relation tuples operated in one single transaction. + // The write delta for the relationships operated in one single transaction. // Either all actions succeed or no change takes effect on error. repeated RelationTupleDelta relation_tuple_deltas = 1; } @@ -65,7 +65,7 @@ message TransactRelationTuplesResponse { } message DeleteRelationTuplesRequest { - // The query for deleting relation tuples + // The query for deleting relationships message Query { // Optional. The namespace to query. string namespace = 1; diff --git a/scripts/install-swagger.sh b/scripts/install-swagger.sh deleted file mode 100755 index 610f7d608..000000000 --- a/scripts/install-swagger.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/env bash -set -euo pipefail - -source ./scripts/install-helpers.sh - -SWAGGER_VERSION=0.30.3 - -usage() { - cat <