snapshot of https://github.com/ory/keto.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
CI / Run lints and checks (push) Failing after 47s
CI / Run tests (push) Failing after 1s
CI / Run race tests (push) Failing after 5s
CI / Build CLI docs (push) Has been skipped
CI / Run buf actions (push) Failing after 5s
CodeQL / Analyze (go) (push) Failing after 3s
CodeQL / Analyze (javascript) (push) Failing after 2s
Docker Image Scanners / scanners (push) Failing after 3s
Format / format (push) Failing after 3s
Synchronize Issue Labels / Synchronize Issue Labels (push) Has been skipped
CI / Generate release (push) Has been skipped
CI / Draft newsletter (push) Has been skipped
CI / Pending approval Slack notification (push) Has been skipped
CI / Send newsletter (push) Has been skipped

This commit is contained in:
upstream-mirror
2026-09-16 01:08:34 +05:00
commit 9456a4e922
2560 changed files with 120911 additions and 0 deletions

10
proto/README.md Normal file
View File

@@ -0,0 +1,10 @@
# Ory Keto gRPC Client
This package provides the generated gRPC client for
[Ory Keto](https://ory.com/keto). Go to
[the documentation](https://ory.com/keto/docs) to learn more
The protocol buffer compiler, `protoc`, is used to compile `.proto` files, which
contain service and message definitions. Go to
[the gRPC documentation](https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os)
for installation instructions.

25
proto/go.mod Normal file
View File

@@ -0,0 +1,25 @@
// Deprecated: This module is replaced by github.com/ory/keto/gen/go. Please update your imports to use the new module path.
module github.com/ory/keto/proto
go 1.26
require (
github.com/stretchr/testify v1.10.0
google.golang.org/grpc v1.82.1
google.golang.org/protobuf v1.36.11
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
golang.org/x/net v0.55.0 // indirect
golang.org/x/sys v0.45.0 // indirect
golang.org/x/text v0.39.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
retract v0.9.0-alpha.0.pre.0

61
proto/go.sum Normal file
View File

@@ -0,0 +1,61 @@
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
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/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
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=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=
go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM=
go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY=
go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg=
go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg=
go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw=
go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A=
go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A=
go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0=
golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8=
golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus=
golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 h1:RmoJA1ujG+/lRGNfUnOMfhCy5EipVMyvUE+KNbPbTlw=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE=
google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

107
proto/markdown.tmpl Normal file
View File

@@ -0,0 +1,107 @@
<!-- This file is automatically generated. DO NOT EDIT! -->
<!-- Needed because of https://github.com/pseudomuto/protoc-gen-doc/issues/274 -->
# Protocol Documentation
<a name="top"></a>
## Table of Contents
{{range .Files}}
{{$file_name := .Name}}- [{{.Name}}](#{{.Name | anchor}})
{{- if .Messages }}
{{range .Messages}} - [{{.LongName}}](#{{.FullName | anchor}})
{{end}}
{{- end -}}
{{- if .Enums }}
{{range .Enums}} - [{{.LongName}}](#{{.FullName | anchor}})
{{end}}
{{- end -}}
{{- if .Extensions }}
{{range .Extensions}} - [File-level Extensions](#{{$file_name | anchor}}-extensions)
{{end}}
{{- end -}}
{{- if .Services }}
{{range .Services}} - [{{.Name}}](#{{.FullName | anchor}})
{{end}}
{{- end -}}
{{end}}
- [Scalar Value Types](#scalar-value-types)
{{range .Files}}
{{$file_name := .Name}}
<a name="{{.Name | anchor}}"></a>
<p align="right"><a href="#top">Top</a></p>
## {{.Name}}
{{.Description}}
{{range .Messages}}
<a name="{{.FullName | anchor}}"></a>
### {{.LongName}}
{{.Description}}
{{if .HasFields}}
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
{{range .Fields -}}
| {{.Name}} | [{{.LongType}}](#{{.FullType | anchor}}) | {{.Label}} | {{if (index .Options "deprecated"|default false)}}**Deprecated.** {{end}}{{.Description | replace "\n" "<br/>" | nobr}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} |
{{end}}
{{end}}
{{if .HasExtensions}}
| Extension | Type | Base | Number | Description |
| --------- | ---- | ---- | ------ | ----------- |
{{range .Extensions -}}
| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{.Description | replace "\n" "<br/>" | nobr}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} |
{{end}}
{{end}}
{{end}}<!-- end messages -->
{{range .Enums}}
<a name="{{.FullName | anchor}}"></a>
### {{.LongName}}
{{.Description}}
| Name | Number | Description |
| ---- | ------ | ----------- |
{{range .Values -}}
| {{.Name}} | {{.Number}} | {{.Description | replace "\n" "<br/>" | nobr}} |
{{end}}
{{end}}<!-- end enums -->
{{if .HasExtensions}}
<a name="{{$file_name | anchor}}-extensions"></a>
### File-level Extensions
| Extension | Type | Base | Number | Description |
| --------- | ---- | ---- | ------ | ----------- |
{{range .Extensions -}}
| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{.Description | replace "\n" "<br/>" | nobr}}{{if .DefaultValue}} Default: `{{.DefaultValue}}`{{end}} |
{{end}}
{{end}}<!-- end HasExtensions -->
{{range .Services}}
<a name="{{.FullName | anchor}}"></a>
### {{.Name}}
{{.Description}}
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
{{range .Methods -}}
| {{.Name}} | [{{.RequestLongType}}](#{{.RequestFullType | anchor}}){{if .RequestStreaming}} stream{{end}} | [{{.ResponseLongType}}](#{{.ResponseFullType | anchor}}){{if .ResponseStreaming}} stream{{end}} | {{.Description | replace "\n" "<br/>" | nobr}} |
{{end}}
{{end}}<!-- end services -->
{{end}}
## Scalar Value Types
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- |
{{range .Scalars -}}
| <a name="{{.ProtoType | anchor}}" /> {{.ProtoType}} | {{.Notes}} | {{.CppType}} | {{.JavaType}} | {{.PythonType}} | {{.GoType}} | {{.CSharp}} | {{.PhpType}} | {{.RubyType}} |
{{end}}

View File

@@ -0,0 +1,299 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: ory/keto/opl/v1alpha1/syntax_service.proto
package opl
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type CheckRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Content []byte `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CheckRequest) Reset() {
*x = CheckRequest{}
mi := &file_ory_keto_opl_v1alpha1_syntax_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CheckRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckRequest) ProtoMessage() {}
func (x *CheckRequest) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_opl_v1alpha1_syntax_service_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CheckRequest.ProtoReflect.Descriptor instead.
func (*CheckRequest) Descriptor() ([]byte, []int) {
return file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDescGZIP(), []int{0}
}
func (x *CheckRequest) GetContent() []byte {
if x != nil {
return x.Content
}
return nil
}
type CheckResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
ParseErrors []*ParseError `protobuf:"bytes,1,rep,name=parse_errors,json=parseErrors,proto3" json:"parse_errors,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CheckResponse) Reset() {
*x = CheckResponse{}
mi := &file_ory_keto_opl_v1alpha1_syntax_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CheckResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckResponse) ProtoMessage() {}
func (x *CheckResponse) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_opl_v1alpha1_syntax_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CheckResponse.ProtoReflect.Descriptor instead.
func (*CheckResponse) Descriptor() ([]byte, []int) {
return file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDescGZIP(), []int{1}
}
func (x *CheckResponse) GetParseErrors() []*ParseError {
if x != nil {
return x.ParseErrors
}
return nil
}
type ParseError struct {
state protoimpl.MessageState `protogen:"open.v1"`
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
Start *SourcePosition `protobuf:"bytes,2,opt,name=start,proto3" json:"start,omitempty"`
End *SourcePosition `protobuf:"bytes,3,opt,name=end,proto3" json:"end,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ParseError) Reset() {
*x = ParseError{}
mi := &file_ory_keto_opl_v1alpha1_syntax_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ParseError) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ParseError) ProtoMessage() {}
func (x *ParseError) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_opl_v1alpha1_syntax_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ParseError.ProtoReflect.Descriptor instead.
func (*ParseError) Descriptor() ([]byte, []int) {
return file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDescGZIP(), []int{2}
}
func (x *ParseError) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *ParseError) GetStart() *SourcePosition {
if x != nil {
return x.Start
}
return nil
}
func (x *ParseError) GetEnd() *SourcePosition {
if x != nil {
return x.End
}
return nil
}
type SourcePosition struct {
state protoimpl.MessageState `protogen:"open.v1"`
Line uint32 `protobuf:"varint,1,opt,name=line,proto3" json:"line,omitempty"`
Column uint32 `protobuf:"varint,2,opt,name=column,proto3" json:"column,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SourcePosition) Reset() {
*x = SourcePosition{}
mi := &file_ory_keto_opl_v1alpha1_syntax_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SourcePosition) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SourcePosition) ProtoMessage() {}
func (x *SourcePosition) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_opl_v1alpha1_syntax_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SourcePosition.ProtoReflect.Descriptor instead.
func (*SourcePosition) Descriptor() ([]byte, []int) {
return file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDescGZIP(), []int{3}
}
func (x *SourcePosition) GetLine() uint32 {
if x != nil {
return x.Line
}
return 0
}
func (x *SourcePosition) GetColumn() uint32 {
if x != nil {
return x.Column
}
return 0
}
var File_ory_keto_opl_v1alpha1_syntax_service_proto protoreflect.FileDescriptor
const file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDesc = "" +
"\n" +
"*ory/keto/opl/v1alpha1/syntax_service.proto\x12\x15ory.keto.opl.v1alpha1\"(\n" +
"\fCheckRequest\x12\x18\n" +
"\acontent\x18\x01 \x01(\fR\acontent\"U\n" +
"\rCheckResponse\x12D\n" +
"\fparse_errors\x18\x01 \x03(\v2!.ory.keto.opl.v1alpha1.ParseErrorR\vparseErrors\"\x9c\x01\n" +
"\n" +
"ParseError\x12\x18\n" +
"\amessage\x18\x01 \x01(\tR\amessage\x12;\n" +
"\x05start\x18\x02 \x01(\v2%.ory.keto.opl.v1alpha1.SourcePositionR\x05start\x127\n" +
"\x03end\x18\x03 \x01(\v2%.ory.keto.opl.v1alpha1.SourcePositionR\x03end\"<\n" +
"\x0eSourcePosition\x12\x12\n" +
"\x04line\x18\x01 \x01(\rR\x04line\x12\x16\n" +
"\x06column\x18\x02 \x01(\rR\x06column2c\n" +
"\rSyntaxService\x12R\n" +
"\x05Check\x12#.ory.keto.opl.v1alpha1.CheckRequest\x1a$.ory.keto.opl.v1alpha1.CheckResponseB\xdc\x01\n" +
"\x19com.ory.keto.opl.v1alpha1B\x12SyntaxServiceProtoP\x01Z4github.com/ory/keto/gen/go/ory/keto/opl/v1alpha1;opl\xa2\x02\x03OKO\xaa\x02\x15Ory.Keto.Opl.V1alpha1\xca\x02\x15Ory\\Keto\\Opl\\V1alpha1\xe2\x02!Ory\\Keto\\Opl\\V1alpha1\\GPBMetadata\xea\x02\x18Ory::Keto::Opl::V1alpha1b\x06proto3"
var (
file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDescOnce sync.Once
file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDescData []byte
)
func file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDescGZIP() []byte {
file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDescOnce.Do(func() {
file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDesc), len(file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDesc)))
})
return file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDescData
}
var file_ory_keto_opl_v1alpha1_syntax_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_ory_keto_opl_v1alpha1_syntax_service_proto_goTypes = []any{
(*CheckRequest)(nil), // 0: ory.keto.opl.v1alpha1.CheckRequest
(*CheckResponse)(nil), // 1: ory.keto.opl.v1alpha1.CheckResponse
(*ParseError)(nil), // 2: ory.keto.opl.v1alpha1.ParseError
(*SourcePosition)(nil), // 3: ory.keto.opl.v1alpha1.SourcePosition
}
var file_ory_keto_opl_v1alpha1_syntax_service_proto_depIdxs = []int32{
2, // 0: ory.keto.opl.v1alpha1.CheckResponse.parse_errors:type_name -> ory.keto.opl.v1alpha1.ParseError
3, // 1: ory.keto.opl.v1alpha1.ParseError.start:type_name -> ory.keto.opl.v1alpha1.SourcePosition
3, // 2: ory.keto.opl.v1alpha1.ParseError.end:type_name -> ory.keto.opl.v1alpha1.SourcePosition
0, // 3: ory.keto.opl.v1alpha1.SyntaxService.Check:input_type -> ory.keto.opl.v1alpha1.CheckRequest
1, // 4: ory.keto.opl.v1alpha1.SyntaxService.Check:output_type -> ory.keto.opl.v1alpha1.CheckResponse
4, // [4:5] is the sub-list for method output_type
3, // [3:4] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_ory_keto_opl_v1alpha1_syntax_service_proto_init() }
func file_ory_keto_opl_v1alpha1_syntax_service_proto_init() {
if File_ory_keto_opl_v1alpha1_syntax_service_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDesc), len(file_ory_keto_opl_v1alpha1_syntax_service_proto_rawDesc)),
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ory_keto_opl_v1alpha1_syntax_service_proto_goTypes,
DependencyIndexes: file_ory_keto_opl_v1alpha1_syntax_service_proto_depIdxs,
MessageInfos: file_ory_keto_opl_v1alpha1_syntax_service_proto_msgTypes,
}.Build()
File_ory_keto_opl_v1alpha1_syntax_service_proto = out.File
file_ory_keto_opl_v1alpha1_syntax_service_proto_goTypes = nil
file_ory_keto_opl_v1alpha1_syntax_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,28 @@
syntax = "proto3";
package ory.keto.opl.v1alpha1;
// The service that checks the syntax of an OPL file.
service SyntaxService {
// Performs a syntax check request.
rpc Check(CheckRequest) returns (CheckResponse);
}
message CheckRequest {
bytes content = 1;
}
message CheckResponse {
repeated ParseError parse_errors = 1;
}
message ParseError {
string message = 1;
SourcePosition start = 2;
SourcePosition end = 3;
}
message SourcePosition {
uint32 line = 1;
uint32 column = 2;
}

View File

@@ -0,0 +1,127 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: ory/keto/opl/v1alpha1/syntax_service.proto
package opl
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
SyntaxService_Check_FullMethodName = "/ory.keto.opl.v1alpha1.SyntaxService/Check"
)
// SyntaxServiceClient is the client API for SyntaxService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// The service that checks the syntax of an OPL file.
type SyntaxServiceClient interface {
// Performs a syntax check request.
Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error)
}
type syntaxServiceClient struct {
cc grpc.ClientConnInterface
}
func NewSyntaxServiceClient(cc grpc.ClientConnInterface) SyntaxServiceClient {
return &syntaxServiceClient{cc}
}
func (c *syntaxServiceClient) Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckResponse)
err := c.cc.Invoke(ctx, SyntaxService_Check_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// SyntaxServiceServer is the server API for SyntaxService service.
// All implementations must embed UnimplementedSyntaxServiceServer
// for forward compatibility.
//
// The service that checks the syntax of an OPL file.
type SyntaxServiceServer interface {
// Performs a syntax check request.
Check(context.Context, *CheckRequest) (*CheckResponse, error)
mustEmbedUnimplementedSyntaxServiceServer()
}
// UnimplementedSyntaxServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedSyntaxServiceServer struct{}
func (UnimplementedSyntaxServiceServer) Check(context.Context, *CheckRequest) (*CheckResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Check not implemented")
}
func (UnimplementedSyntaxServiceServer) mustEmbedUnimplementedSyntaxServiceServer() {}
func (UnimplementedSyntaxServiceServer) testEmbeddedByValue() {}
// UnsafeSyntaxServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SyntaxServiceServer will
// result in compilation errors.
type UnsafeSyntaxServiceServer interface {
mustEmbedUnimplementedSyntaxServiceServer()
}
func RegisterSyntaxServiceServer(s grpc.ServiceRegistrar, srv SyntaxServiceServer) {
// If the following call panics, it indicates UnimplementedSyntaxServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&SyntaxService_ServiceDesc, srv)
}
func _SyntaxService_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SyntaxServiceServer).Check(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SyntaxService_Check_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SyntaxServiceServer).Check(ctx, req.(*CheckRequest))
}
return interceptor(ctx, in, info, handler)
}
// SyntaxService_ServiceDesc is the grpc.ServiceDesc for SyntaxService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var SyntaxService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ory.keto.opl.v1alpha1.SyntaxService",
HandlerType: (*SyntaxServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Check",
Handler: _SyntaxService_Check_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ory/keto/opl/v1alpha1/syntax_service.proto",
}

View File

@@ -0,0 +1,591 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/check_service.proto
package relationtuples
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// The request for a CheckService.Check RPC.
// Checks whether a specific subject is related to an object.
type CheckRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// 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.
//
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/check_service.proto.
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
// The related object in this check.
//
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/check_service.proto.
Object string `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"`
// The relation between the Object and the Subject.
//
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/check_service.proto.
Relation string `protobuf:"bytes,3,opt,name=relation,proto3" json:"relation,omitempty"`
// The related subject in this check.
//
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/check_service.proto.
Subject *Subject `protobuf:"bytes,4,opt,name=subject,proto3" json:"subject,omitempty"`
Tuple *RelationTuple `protobuf:"bytes,8,opt,name=tuple,proto3" json:"tuple,omitempty"`
// This field is not implemented yet and has no effect.
// <!--
// Set this field to `true` in case your application
// needs to authorize depending on up to date ACLs,
// also called a "content-change check".
//
// If set to `true` the `snaptoken` field is ignored,
// the check is evaluated at the latest snapshot
// (globally consistent) and the response includes a
// snaptoken for clients to store along with object
// contents that can be used for subsequent checks
// of the same content version.
//
// Example use case:
// - You need to authorize a user to modify/delete some resource
// and it is unacceptable that if the permission to do that had
// just been revoked some seconds ago so that the change had not
// yet been fully replicated to all availability zones.
//
// -->
Latest bool `protobuf:"varint,5,opt,name=latest,proto3" json:"latest,omitempty"`
// This field is not implemented yet and has no effect.
// <!--
// Optional. Like reads, a check is always evaluated at a
// consistent snapshot no earlier than the given snaptoken.
//
// Leave this field blank if you want to evaluate the check
// based on eventually consistent ACLs, benefiting from very
// low latency, but possibly slightly stale results.
//
// If the specified token is too old and no longer known,
// the server falls back as if no snaptoken had been specified.
//
// If not specified the server tries to evaluate the check
// on the best snapshot version where it is very likely that
// ACLs had already been replicated to all availability zones.
// -->
Snaptoken string `protobuf:"bytes,6,opt,name=snaptoken,proto3" json:"snaptoken,omitempty"`
// 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.
MaxDepth int32 `protobuf:"varint,7,opt,name=max_depth,json=maxDepth,proto3" json:"max_depth,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CheckRequest) Reset() {
*x = CheckRequest{}
mi := &file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CheckRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckRequest) ProtoMessage() {}
func (x *CheckRequest) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CheckRequest.ProtoReflect.Descriptor instead.
func (*CheckRequest) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDescGZIP(), []int{0}
}
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/check_service.proto.
func (x *CheckRequest) GetNamespace() string {
if x != nil {
return x.Namespace
}
return ""
}
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/check_service.proto.
func (x *CheckRequest) GetObject() string {
if x != nil {
return x.Object
}
return ""
}
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/check_service.proto.
func (x *CheckRequest) GetRelation() string {
if x != nil {
return x.Relation
}
return ""
}
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/check_service.proto.
func (x *CheckRequest) GetSubject() *Subject {
if x != nil {
return x.Subject
}
return nil
}
func (x *CheckRequest) GetTuple() *RelationTuple {
if x != nil {
return x.Tuple
}
return nil
}
func (x *CheckRequest) GetLatest() bool {
if x != nil {
return x.Latest
}
return false
}
func (x *CheckRequest) GetSnaptoken() string {
if x != nil {
return x.Snaptoken
}
return ""
}
func (x *CheckRequest) GetMaxDepth() int32 {
if x != nil {
return x.MaxDepth
}
return 0
}
// The response for a CheckService.Check rpc.
type CheckResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Whether the specified subject (id)
// is related to the requested object.
//
// It is false by default if no ACL matches.
Allowed bool `protobuf:"varint,1,opt,name=allowed,proto3" json:"allowed,omitempty"`
// This field is not implemented yet and has no effect.
// <!--
// The last known snapshot token ONLY specified if
// the request had not specified a snaptoken,
// since this performed a "content-change request"
// and consistently fetched the last known snapshot token.
//
// This field is not set if the request had specified a snaptoken!
//
// If set, clients should cache and use this token
// for subsequent requests to have minimal latency,
// but allow slightly stale responses (only some milliseconds or seconds).
// -->
Snaptoken string `protobuf:"bytes,2,opt,name=snaptoken,proto3" json:"snaptoken,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CheckResponse) Reset() {
*x = CheckResponse{}
mi := &file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CheckResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckResponse) ProtoMessage() {}
func (x *CheckResponse) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CheckResponse.ProtoReflect.Descriptor instead.
func (*CheckResponse) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDescGZIP(), []int{1}
}
func (x *CheckResponse) GetAllowed() bool {
if x != nil {
return x.Allowed
}
return false
}
func (x *CheckResponse) GetSnaptoken() string {
if x != nil {
return x.Snaptoken
}
return ""
}
// The response for an individual check in the CheckService.BatchCheck rpc.
type CheckResponseWithError struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Whether the specified subject (id)
// is related to the requested object.
//
// It is false by default if no ACL matches.
Allowed bool `protobuf:"varint,1,opt,name=allowed,proto3" json:"allowed,omitempty"`
// If there was an error checking the tuple,
// this will contain the error message.
//
// If the check was performed successfully, this will be empty.
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
// This field is not implemented yet and has no effect.
// <!--
// The last known snapshot token ONLY specified if
// the request had not specified a snaptoken,
// since this performed a "content-change request"
// and consistently fetched the last known snapshot token.
//
// This field is not set if the request had specified a snaptoken!
//
// If set, clients should cache and use this token
// for subsequent requests to have minimal latency,
// but allow slightly stale responses (only some milliseconds or seconds).
// -->
Snaptoken string `protobuf:"bytes,3,opt,name=snaptoken,proto3" json:"snaptoken,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CheckResponseWithError) Reset() {
*x = CheckResponseWithError{}
mi := &file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CheckResponseWithError) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckResponseWithError) ProtoMessage() {}
func (x *CheckResponseWithError) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CheckResponseWithError.ProtoReflect.Descriptor instead.
func (*CheckResponseWithError) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDescGZIP(), []int{2}
}
func (x *CheckResponseWithError) GetAllowed() bool {
if x != nil {
return x.Allowed
}
return false
}
func (x *CheckResponseWithError) GetError() string {
if x != nil {
return x.Error
}
return ""
}
func (x *CheckResponseWithError) GetSnaptoken() string {
if x != nil {
return x.Snaptoken
}
return ""
}
// The request for a CheckService.BatchCheck RPC.
// Checks a batch of relations.
type BatchCheckRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Tuples []*RelationTuple `protobuf:"bytes,1,rep,name=tuples,proto3" json:"tuples,omitempty"`
// This field is not implemented yet and has no effect.
// <!--
// Set this field to `true` in case your application
// needs to authorize depending on up to date ACLs,
// also called a "content-change check".
//
// If set to `true` the `snaptoken` field is ignored,
// the check is evaluated at the latest snapshot
// (globally consistent) and the response includes a
// snaptoken for clients to store along with object
// contents that can be used for subsequent checks
// of the same content version.
//
// Example use case:
// - You need to authorize a user to modify/delete some resource
// and it is unacceptable that if the permission to do that had
// just been revoked some seconds ago so that the change had not
// yet been fully replicated to all availability zones.
//
// -->
Latest bool `protobuf:"varint,2,opt,name=latest,proto3" json:"latest,omitempty"`
// This field is not implemented yet and has no effect.
// <!--
// Optional. Like reads, a check is always evaluated at a
// consistent snapshot no earlier than the given snaptoken.
//
// Leave this field blank if you want to evaluate the check
// based on eventually consistent ACLs, benefiting from very
// low latency, but possibly slightly stale results.
//
// If the specified token is too old and no longer known,
// the server falls back as if no snaptoken had been specified.
//
// If not specified the server tries to evaluate the check
// on the best snapshot version where it is very likely that
// ACLs had already been replicated to all availability zones.
// -->
Snaptoken string `protobuf:"bytes,3,opt,name=snaptoken,proto3" json:"snaptoken,omitempty"`
// 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.
MaxDepth int32 `protobuf:"varint,4,opt,name=max_depth,json=maxDepth,proto3" json:"max_depth,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BatchCheckRequest) Reset() {
*x = BatchCheckRequest{}
mi := &file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BatchCheckRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BatchCheckRequest) ProtoMessage() {}
func (x *BatchCheckRequest) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BatchCheckRequest.ProtoReflect.Descriptor instead.
func (*BatchCheckRequest) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDescGZIP(), []int{3}
}
func (x *BatchCheckRequest) GetTuples() []*RelationTuple {
if x != nil {
return x.Tuples
}
return nil
}
func (x *BatchCheckRequest) GetLatest() bool {
if x != nil {
return x.Latest
}
return false
}
func (x *BatchCheckRequest) GetSnaptoken() string {
if x != nil {
return x.Snaptoken
}
return ""
}
func (x *BatchCheckRequest) GetMaxDepth() int32 {
if x != nil {
return x.MaxDepth
}
return 0
}
// The response for a CheckService.BatchCheck rpc.
type BatchCheckResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The results of the batch check. The order of these
// results will match the order of the input.
Results []*CheckResponseWithError `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BatchCheckResponse) Reset() {
*x = BatchCheckResponse{}
mi := &file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BatchCheckResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BatchCheckResponse) ProtoMessage() {}
func (x *BatchCheckResponse) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BatchCheckResponse.ProtoReflect.Descriptor instead.
func (*BatchCheckResponse) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDescGZIP(), []int{4}
}
func (x *BatchCheckResponse) GetResults() []*CheckResponseWithError {
if x != nil {
return x.Results
}
return nil
}
var File_ory_keto_relation_tuples_v1alpha2_check_service_proto protoreflect.FileDescriptor
const file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDesc = "" +
"\n" +
"5ory/keto/relation_tuples/v1alpha2/check_service.proto\x12!ory.keto.relation_tuples.v1alpha2\x1a7ory/keto/relation_tuples/v1alpha2/relation_tuples.proto\"\xd1\x02\n" +
"\fCheckRequest\x12 \n" +
"\tnamespace\x18\x01 \x01(\tB\x02\x18\x01R\tnamespace\x12\x1a\n" +
"\x06object\x18\x02 \x01(\tB\x02\x18\x01R\x06object\x12\x1e\n" +
"\brelation\x18\x03 \x01(\tB\x02\x18\x01R\brelation\x12H\n" +
"\asubject\x18\x04 \x01(\v2*.ory.keto.relation_tuples.v1alpha2.SubjectB\x02\x18\x01R\asubject\x12F\n" +
"\x05tuple\x18\b \x01(\v20.ory.keto.relation_tuples.v1alpha2.RelationTupleR\x05tuple\x12\x16\n" +
"\x06latest\x18\x05 \x01(\bR\x06latest\x12\x1c\n" +
"\tsnaptoken\x18\x06 \x01(\tR\tsnaptoken\x12\x1b\n" +
"\tmax_depth\x18\a \x01(\x05R\bmaxDepth\"G\n" +
"\rCheckResponse\x12\x18\n" +
"\aallowed\x18\x01 \x01(\bR\aallowed\x12\x1c\n" +
"\tsnaptoken\x18\x02 \x01(\tR\tsnaptoken\"f\n" +
"\x16CheckResponseWithError\x12\x18\n" +
"\aallowed\x18\x01 \x01(\bR\aallowed\x12\x14\n" +
"\x05error\x18\x02 \x01(\tR\x05error\x12\x1c\n" +
"\tsnaptoken\x18\x03 \x01(\tR\tsnaptoken\"\xb0\x01\n" +
"\x11BatchCheckRequest\x12H\n" +
"\x06tuples\x18\x01 \x03(\v20.ory.keto.relation_tuples.v1alpha2.RelationTupleR\x06tuples\x12\x16\n" +
"\x06latest\x18\x02 \x01(\bR\x06latest\x12\x1c\n" +
"\tsnaptoken\x18\x03 \x01(\tR\tsnaptoken\x12\x1b\n" +
"\tmax_depth\x18\x04 \x01(\x05R\bmaxDepth\"i\n" +
"\x12BatchCheckResponse\x12S\n" +
"\aresults\x18\x01 \x03(\v29.ory.keto.relation_tuples.v1alpha2.CheckResponseWithErrorR\aresults2\xf5\x01\n" +
"\fCheckService\x12j\n" +
"\x05Check\x12/.ory.keto.relation_tuples.v1alpha2.CheckRequest\x1a0.ory.keto.relation_tuples.v1alpha2.CheckResponse\x12y\n" +
"\n" +
"BatchCheck\x124.ory.keto.relation_tuples.v1alpha2.BatchCheckRequest\x1a5.ory.keto.relation_tuples.v1alpha2.BatchCheckResponseB\xaa\x02\n" +
"%com.ory.keto.relation_tuples.v1alpha2B\x11CheckServiceProtoP\x01ZKgithub.com/ory/keto/gen/go/ory/keto/relation_tuples/v1alpha2;relationtuples\xa2\x02\x03OKR\xaa\x02 Ory.Keto.RelationTuples.V1alpha2\xca\x02 Ory\\Keto\\RelationTuples\\V1alpha2\xe2\x02,Ory\\Keto\\RelationTuples\\V1alpha2\\GPBMetadata\xea\x02#Ory::Keto::RelationTuples::V1alpha2b\x06proto3"
var (
file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDescOnce sync.Once
file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDescData []byte
)
func file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDescGZIP() []byte {
file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDescOnce.Do(func() {
file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDesc)))
})
return file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDescData
}
var file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_ory_keto_relation_tuples_v1alpha2_check_service_proto_goTypes = []any{
(*CheckRequest)(nil), // 0: ory.keto.relation_tuples.v1alpha2.CheckRequest
(*CheckResponse)(nil), // 1: ory.keto.relation_tuples.v1alpha2.CheckResponse
(*CheckResponseWithError)(nil), // 2: ory.keto.relation_tuples.v1alpha2.CheckResponseWithError
(*BatchCheckRequest)(nil), // 3: ory.keto.relation_tuples.v1alpha2.BatchCheckRequest
(*BatchCheckResponse)(nil), // 4: ory.keto.relation_tuples.v1alpha2.BatchCheckResponse
(*Subject)(nil), // 5: ory.keto.relation_tuples.v1alpha2.Subject
(*RelationTuple)(nil), // 6: ory.keto.relation_tuples.v1alpha2.RelationTuple
}
var file_ory_keto_relation_tuples_v1alpha2_check_service_proto_depIdxs = []int32{
5, // 0: ory.keto.relation_tuples.v1alpha2.CheckRequest.subject:type_name -> ory.keto.relation_tuples.v1alpha2.Subject
6, // 1: ory.keto.relation_tuples.v1alpha2.CheckRequest.tuple:type_name -> ory.keto.relation_tuples.v1alpha2.RelationTuple
6, // 2: ory.keto.relation_tuples.v1alpha2.BatchCheckRequest.tuples:type_name -> ory.keto.relation_tuples.v1alpha2.RelationTuple
2, // 3: ory.keto.relation_tuples.v1alpha2.BatchCheckResponse.results:type_name -> ory.keto.relation_tuples.v1alpha2.CheckResponseWithError
0, // 4: ory.keto.relation_tuples.v1alpha2.CheckService.Check:input_type -> ory.keto.relation_tuples.v1alpha2.CheckRequest
3, // 5: ory.keto.relation_tuples.v1alpha2.CheckService.BatchCheck:input_type -> ory.keto.relation_tuples.v1alpha2.BatchCheckRequest
1, // 6: ory.keto.relation_tuples.v1alpha2.CheckService.Check:output_type -> ory.keto.relation_tuples.v1alpha2.CheckResponse
4, // 7: ory.keto.relation_tuples.v1alpha2.CheckService.BatchCheck:output_type -> ory.keto.relation_tuples.v1alpha2.BatchCheckResponse
6, // [6:8] is the sub-list for method output_type
4, // [4:6] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_ory_keto_relation_tuples_v1alpha2_check_service_proto_init() }
func file_ory_keto_relation_tuples_v1alpha2_check_service_proto_init() {
if File_ory_keto_relation_tuples_v1alpha2_check_service_proto != nil {
return
}
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_check_service_proto_rawDesc)),
NumEnums: 0,
NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ory_keto_relation_tuples_v1alpha2_check_service_proto_goTypes,
DependencyIndexes: file_ory_keto_relation_tuples_v1alpha2_check_service_proto_depIdxs,
MessageInfos: file_ory_keto_relation_tuples_v1alpha2_check_service_proto_msgTypes,
}.Build()
File_ory_keto_relation_tuples_v1alpha2_check_service_proto = out.File
file_ory_keto_relation_tuples_v1alpha2_check_service_proto_goTypes = nil
file_ory_keto_relation_tuples_v1alpha2_check_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,185 @@
syntax = "proto3";
package ory.keto.relation_tuples.v1alpha2;
import "ory/keto/relation_tuples/v1alpha2/relation_tuples.proto";
// The service that performs authorization checks
// based on the stored Access Control Lists.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
service CheckService {
// Performs an authorization check.
rpc Check(CheckRequest) returns (CheckResponse);
rpc BatchCheck(BatchCheckRequest) returns (BatchCheckResponse);
}
// The request for a CheckService.Check RPC.
// Checks whether a specific subject is related to an object.
message CheckRequest {
// 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.
string namespace = 1 [deprecated = true];
// The related object in this check.
string object = 2 [deprecated = true];
// The relation between the Object and the Subject.
string relation = 3 [deprecated = true];
// The related subject in this check.
Subject subject = 4 [deprecated = true];
RelationTuple tuple = 8;
// This field is not implemented yet and has no effect.
// <!--
// Set this field to `true` in case your application
// needs to authorize depending on up to date ACLs,
// also called a "content-change check".
//
// If set to `true` the `snaptoken` field is ignored,
// the check is evaluated at the latest snapshot
// (globally consistent) and the response includes a
// snaptoken for clients to store along with object
// contents that can be used for subsequent checks
// of the same content version.
//
// Example use case:
// - You need to authorize a user to modify/delete some resource
// and it is unacceptable that if the permission to do that had
// just been revoked some seconds ago so that the change had not
// yet been fully replicated to all availability zones.
// -->
bool latest = 5;
// This field is not implemented yet and has no effect.
// <!--
// Optional. Like reads, a check is always evaluated at a
// consistent snapshot no earlier than the given snaptoken.
//
// Leave this field blank if you want to evaluate the check
// based on eventually consistent ACLs, benefiting from very
// low latency, but possibly slightly stale results.
//
// If the specified token is too old and no longer known,
// the server falls back as if no snaptoken had been specified.
//
// If not specified the server tries to evaluate the check
// on the best snapshot version where it is very likely that
// ACLs had already been replicated to all availability zones.
// -->
string snaptoken = 6;
// 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.
int32 max_depth = 7;
}
// The response for a CheckService.Check rpc.
message CheckResponse {
// Whether the specified subject (id)
// is related to the requested object.
//
// It is false by default if no ACL matches.
bool allowed = 1;
// This field is not implemented yet and has no effect.
// <!--
// The last known snapshot token ONLY specified if
// the request had not specified a snaptoken,
// since this performed a "content-change request"
// and consistently fetched the last known snapshot token.
//
// This field is not set if the request had specified a snaptoken!
//
// If set, clients should cache and use this token
// for subsequent requests to have minimal latency,
// but allow slightly stale responses (only some milliseconds or seconds).
// -->
string snaptoken = 2;
}
// The response for an individual check in the CheckService.BatchCheck rpc.
message CheckResponseWithError {
// Whether the specified subject (id)
// is related to the requested object.
//
// It is false by default if no ACL matches.
bool allowed = 1;
// If there was an error checking the tuple,
// this will contain the error message.
//
// If the check was performed successfully, this will be empty.
string error = 2;
// This field is not implemented yet and has no effect.
// <!--
// The last known snapshot token ONLY specified if
// the request had not specified a snaptoken,
// since this performed a "content-change request"
// and consistently fetched the last known snapshot token.
//
// This field is not set if the request had specified a snaptoken!
//
// If set, clients should cache and use this token
// for subsequent requests to have minimal latency,
// but allow slightly stale responses (only some milliseconds or seconds).
// -->
string snaptoken = 3;
}
// The request for a CheckService.BatchCheck RPC.
// Checks a batch of relations.
message BatchCheckRequest {
repeated RelationTuple tuples = 1;
// This field is not implemented yet and has no effect.
// <!--
// Set this field to `true` in case your application
// needs to authorize depending on up to date ACLs,
// also called a "content-change check".
//
// If set to `true` the `snaptoken` field is ignored,
// the check is evaluated at the latest snapshot
// (globally consistent) and the response includes a
// snaptoken for clients to store along with object
// contents that can be used for subsequent checks
// of the same content version.
//
// Example use case:
// - You need to authorize a user to modify/delete some resource
// and it is unacceptable that if the permission to do that had
// just been revoked some seconds ago so that the change had not
// yet been fully replicated to all availability zones.
// -->
bool latest = 2;
// This field is not implemented yet and has no effect.
// <!--
// Optional. Like reads, a check is always evaluated at a
// consistent snapshot no earlier than the given snaptoken.
//
// Leave this field blank if you want to evaluate the check
// based on eventually consistent ACLs, benefiting from very
// low latency, but possibly slightly stale results.
//
// If the specified token is too old and no longer known,
// the server falls back as if no snaptoken had been specified.
//
// If not specified the server tries to evaluate the check
// on the best snapshot version where it is very likely that
// ACLs had already been replicated to all availability zones.
// -->
string snaptoken = 3;
// 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.
int32 max_depth = 4;
}
// The response for a CheckService.BatchCheck rpc.
message BatchCheckResponse {
// The results of the batch check. The order of these
// results will match the order of the input.
repeated CheckResponseWithError results = 1;
}

View File

@@ -0,0 +1,171 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/check_service.proto
package relationtuples
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
CheckService_Check_FullMethodName = "/ory.keto.relation_tuples.v1alpha2.CheckService/Check"
CheckService_BatchCheck_FullMethodName = "/ory.keto.relation_tuples.v1alpha2.CheckService/BatchCheck"
)
// CheckServiceClient is the client API for CheckService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// The service that performs authorization checks
// based on the stored Access Control Lists.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
type CheckServiceClient interface {
// Performs an authorization check.
Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error)
BatchCheck(ctx context.Context, in *BatchCheckRequest, opts ...grpc.CallOption) (*BatchCheckResponse, error)
}
type checkServiceClient struct {
cc grpc.ClientConnInterface
}
func NewCheckServiceClient(cc grpc.ClientConnInterface) CheckServiceClient {
return &checkServiceClient{cc}
}
func (c *checkServiceClient) Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckResponse)
err := c.cc.Invoke(ctx, CheckService_Check_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *checkServiceClient) BatchCheck(ctx context.Context, in *BatchCheckRequest, opts ...grpc.CallOption) (*BatchCheckResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(BatchCheckResponse)
err := c.cc.Invoke(ctx, CheckService_BatchCheck_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// CheckServiceServer is the server API for CheckService service.
// All implementations must embed UnimplementedCheckServiceServer
// for forward compatibility.
//
// The service that performs authorization checks
// based on the stored Access Control Lists.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
type CheckServiceServer interface {
// Performs an authorization check.
Check(context.Context, *CheckRequest) (*CheckResponse, error)
BatchCheck(context.Context, *BatchCheckRequest) (*BatchCheckResponse, error)
mustEmbedUnimplementedCheckServiceServer()
}
// UnimplementedCheckServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedCheckServiceServer struct{}
func (UnimplementedCheckServiceServer) Check(context.Context, *CheckRequest) (*CheckResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Check not implemented")
}
func (UnimplementedCheckServiceServer) BatchCheck(context.Context, *BatchCheckRequest) (*BatchCheckResponse, error) {
return nil, status.Error(codes.Unimplemented, "method BatchCheck not implemented")
}
func (UnimplementedCheckServiceServer) mustEmbedUnimplementedCheckServiceServer() {}
func (UnimplementedCheckServiceServer) testEmbeddedByValue() {}
// UnsafeCheckServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CheckServiceServer will
// result in compilation errors.
type UnsafeCheckServiceServer interface {
mustEmbedUnimplementedCheckServiceServer()
}
func RegisterCheckServiceServer(s grpc.ServiceRegistrar, srv CheckServiceServer) {
// If the following call panics, it indicates UnimplementedCheckServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&CheckService_ServiceDesc, srv)
}
func _CheckService_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CheckServiceServer).Check(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: CheckService_Check_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CheckServiceServer).Check(ctx, req.(*CheckRequest))
}
return interceptor(ctx, in, info, handler)
}
func _CheckService_BatchCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BatchCheckRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CheckServiceServer).BatchCheck(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: CheckService_BatchCheck_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CheckServiceServer).BatchCheck(ctx, req.(*BatchCheckRequest))
}
return interceptor(ctx, in, info, handler)
}
// CheckService_ServiceDesc is the grpc.ServiceDesc for CheckService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var CheckService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ory.keto.relation_tuples.v1alpha2.CheckService",
HandlerType: (*CheckServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Check",
Handler: _CheckService_Check_Handler,
},
{
MethodName: "BatchCheck",
Handler: _CheckService_BatchCheck_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ory/keto/relation_tuples/v1alpha2/check_service.proto",
}

View File

@@ -0,0 +1,385 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/expand_service.proto
package relationtuples
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type NodeType int32
const (
NodeType_NODE_TYPE_UNSPECIFIED NodeType = 0
// This node expands to a union of all children.
NodeType_NODE_TYPE_UNION NodeType = 1
// Not implemented yet.
NodeType_NODE_TYPE_EXCLUSION NodeType = 2
// Not implemented yet.
NodeType_NODE_TYPE_INTERSECTION NodeType = 3
// This node is a leaf and contains no children.
// Its subject is a `SubjectID` unless `max_depth` was reached.
NodeType_NODE_TYPE_LEAF NodeType = 4
)
// Enum value maps for NodeType.
var (
NodeType_name = map[int32]string{
0: "NODE_TYPE_UNSPECIFIED",
1: "NODE_TYPE_UNION",
2: "NODE_TYPE_EXCLUSION",
3: "NODE_TYPE_INTERSECTION",
4: "NODE_TYPE_LEAF",
}
NodeType_value = map[string]int32{
"NODE_TYPE_UNSPECIFIED": 0,
"NODE_TYPE_UNION": 1,
"NODE_TYPE_EXCLUSION": 2,
"NODE_TYPE_INTERSECTION": 3,
"NODE_TYPE_LEAF": 4,
}
)
func (x NodeType) Enum() *NodeType {
p := new(NodeType)
*p = x
return p
}
func (x NodeType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (NodeType) Descriptor() protoreflect.EnumDescriptor {
return file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_enumTypes[0].Descriptor()
}
func (NodeType) Type() protoreflect.EnumType {
return &file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_enumTypes[0]
}
func (x NodeType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use NodeType.Descriptor instead.
func (NodeType) EnumDescriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDescGZIP(), []int{0}
}
// The request for an ExpandService.Expand RPC.
// Expands the given subject set.
type ExpandRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The subject to expand.
Subject *Subject `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
// 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.
MaxDepth int32 `protobuf:"varint,2,opt,name=max_depth,json=maxDepth,proto3" json:"max_depth,omitempty"`
// This field is not implemented yet and has no effect.
// <!--
// Optional. Like reads, a expand is always evaluated at a
// consistent snapshot no earlier than the given snaptoken.
//
// Leave this field blank if you want to expand
// based on eventually consistent ACLs, benefiting from very
// low latency, but possibly slightly stale results.
//
// If the specified token is too old and no longer known,
// the server falls back as if no snaptoken had been specified.
//
// If not specified the server tries to build the tree
// on the best snapshot version where it is very likely that
// ACLs had already been replicated to all availability zones.
// -->
Snaptoken string `protobuf:"bytes,3,opt,name=snaptoken,proto3" json:"snaptoken,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ExpandRequest) Reset() {
*x = ExpandRequest{}
mi := &file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ExpandRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ExpandRequest) ProtoMessage() {}
func (x *ExpandRequest) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ExpandRequest.ProtoReflect.Descriptor instead.
func (*ExpandRequest) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDescGZIP(), []int{0}
}
func (x *ExpandRequest) GetSubject() *Subject {
if x != nil {
return x.Subject
}
return nil
}
func (x *ExpandRequest) GetMaxDepth() int32 {
if x != nil {
return x.MaxDepth
}
return 0
}
func (x *ExpandRequest) GetSnaptoken() string {
if x != nil {
return x.Snaptoken
}
return ""
}
// The response for a ExpandService.Expand RPC.
type ExpandResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// 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.
Tree *SubjectTree `protobuf:"bytes,1,opt,name=tree,proto3" json:"tree,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ExpandResponse) Reset() {
*x = ExpandResponse{}
mi := &file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ExpandResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ExpandResponse) ProtoMessage() {}
func (x *ExpandResponse) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ExpandResponse.ProtoReflect.Descriptor instead.
func (*ExpandResponse) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDescGZIP(), []int{1}
}
func (x *ExpandResponse) GetTree() *SubjectTree {
if x != nil {
return x.Tree
}
return nil
}
type SubjectTree struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The type of the node.
NodeType NodeType `protobuf:"varint,1,opt,name=node_type,json=nodeType,proto3,enum=ory.keto.relation_tuples.v1alpha2.NodeType" json:"node_type,omitempty"`
// The subject this node represents.
// Deprecated: More information is now available in the tuple field.
//
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/expand_service.proto.
Subject *Subject `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"`
// The relation tuple this node represents.
Tuple *RelationTuple `protobuf:"bytes,4,opt,name=tuple,proto3" json:"tuple,omitempty"`
// The children of this node.
//
// This is never set if `node_type` == `NODE_TYPE_LEAF`.
Children []*SubjectTree `protobuf:"bytes,3,rep,name=children,proto3" json:"children,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SubjectTree) Reset() {
*x = SubjectTree{}
mi := &file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SubjectTree) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SubjectTree) ProtoMessage() {}
func (x *SubjectTree) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SubjectTree.ProtoReflect.Descriptor instead.
func (*SubjectTree) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDescGZIP(), []int{2}
}
func (x *SubjectTree) GetNodeType() NodeType {
if x != nil {
return x.NodeType
}
return NodeType_NODE_TYPE_UNSPECIFIED
}
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/expand_service.proto.
func (x *SubjectTree) GetSubject() *Subject {
if x != nil {
return x.Subject
}
return nil
}
func (x *SubjectTree) GetTuple() *RelationTuple {
if x != nil {
return x.Tuple
}
return nil
}
func (x *SubjectTree) GetChildren() []*SubjectTree {
if x != nil {
return x.Children
}
return nil
}
var File_ory_keto_relation_tuples_v1alpha2_expand_service_proto protoreflect.FileDescriptor
const file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDesc = "" +
"\n" +
"6ory/keto/relation_tuples/v1alpha2/expand_service.proto\x12!ory.keto.relation_tuples.v1alpha2\x1a7ory/keto/relation_tuples/v1alpha2/relation_tuples.proto\"\x90\x01\n" +
"\rExpandRequest\x12D\n" +
"\asubject\x18\x01 \x01(\v2*.ory.keto.relation_tuples.v1alpha2.SubjectR\asubject\x12\x1b\n" +
"\tmax_depth\x18\x02 \x01(\x05R\bmaxDepth\x12\x1c\n" +
"\tsnaptoken\x18\x03 \x01(\tR\tsnaptoken\"T\n" +
"\x0eExpandResponse\x12B\n" +
"\x04tree\x18\x01 \x01(\v2..ory.keto.relation_tuples.v1alpha2.SubjectTreeR\x04tree\"\xb5\x02\n" +
"\vSubjectTree\x12H\n" +
"\tnode_type\x18\x01 \x01(\x0e2+.ory.keto.relation_tuples.v1alpha2.NodeTypeR\bnodeType\x12H\n" +
"\asubject\x18\x02 \x01(\v2*.ory.keto.relation_tuples.v1alpha2.SubjectB\x02\x18\x01R\asubject\x12F\n" +
"\x05tuple\x18\x04 \x01(\v20.ory.keto.relation_tuples.v1alpha2.RelationTupleR\x05tuple\x12J\n" +
"\bchildren\x18\x03 \x03(\v2..ory.keto.relation_tuples.v1alpha2.SubjectTreeR\bchildren*\x83\x01\n" +
"\bNodeType\x12\x19\n" +
"\x15NODE_TYPE_UNSPECIFIED\x10\x00\x12\x13\n" +
"\x0fNODE_TYPE_UNION\x10\x01\x12\x17\n" +
"\x13NODE_TYPE_EXCLUSION\x10\x02\x12\x1a\n" +
"\x16NODE_TYPE_INTERSECTION\x10\x03\x12\x12\n" +
"\x0eNODE_TYPE_LEAF\x10\x042~\n" +
"\rExpandService\x12m\n" +
"\x06Expand\x120.ory.keto.relation_tuples.v1alpha2.ExpandRequest\x1a1.ory.keto.relation_tuples.v1alpha2.ExpandResponseB\xab\x02\n" +
"%com.ory.keto.relation_tuples.v1alpha2B\x12ExpandServiceProtoP\x01ZKgithub.com/ory/keto/gen/go/ory/keto/relation_tuples/v1alpha2;relationtuples\xa2\x02\x03OKR\xaa\x02 Ory.Keto.RelationTuples.V1alpha2\xca\x02 Ory\\Keto\\RelationTuples\\V1alpha2\xe2\x02,Ory\\Keto\\RelationTuples\\V1alpha2\\GPBMetadata\xea\x02#Ory::Keto::RelationTuples::V1alpha2b\x06proto3"
var (
file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDescOnce sync.Once
file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDescData []byte
)
func file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDescGZIP() []byte {
file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDescOnce.Do(func() {
file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDesc)))
})
return file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDescData
}
var file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_goTypes = []any{
(NodeType)(0), // 0: ory.keto.relation_tuples.v1alpha2.NodeType
(*ExpandRequest)(nil), // 1: ory.keto.relation_tuples.v1alpha2.ExpandRequest
(*ExpandResponse)(nil), // 2: ory.keto.relation_tuples.v1alpha2.ExpandResponse
(*SubjectTree)(nil), // 3: ory.keto.relation_tuples.v1alpha2.SubjectTree
(*Subject)(nil), // 4: ory.keto.relation_tuples.v1alpha2.Subject
(*RelationTuple)(nil), // 5: ory.keto.relation_tuples.v1alpha2.RelationTuple
}
var file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_depIdxs = []int32{
4, // 0: ory.keto.relation_tuples.v1alpha2.ExpandRequest.subject:type_name -> ory.keto.relation_tuples.v1alpha2.Subject
3, // 1: ory.keto.relation_tuples.v1alpha2.ExpandResponse.tree:type_name -> ory.keto.relation_tuples.v1alpha2.SubjectTree
0, // 2: ory.keto.relation_tuples.v1alpha2.SubjectTree.node_type:type_name -> ory.keto.relation_tuples.v1alpha2.NodeType
4, // 3: ory.keto.relation_tuples.v1alpha2.SubjectTree.subject:type_name -> ory.keto.relation_tuples.v1alpha2.Subject
5, // 4: ory.keto.relation_tuples.v1alpha2.SubjectTree.tuple:type_name -> ory.keto.relation_tuples.v1alpha2.RelationTuple
3, // 5: ory.keto.relation_tuples.v1alpha2.SubjectTree.children:type_name -> ory.keto.relation_tuples.v1alpha2.SubjectTree
1, // 6: ory.keto.relation_tuples.v1alpha2.ExpandService.Expand:input_type -> ory.keto.relation_tuples.v1alpha2.ExpandRequest
2, // 7: ory.keto.relation_tuples.v1alpha2.ExpandService.Expand:output_type -> ory.keto.relation_tuples.v1alpha2.ExpandResponse
7, // [7:8] is the sub-list for method output_type
6, // [6:7] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_init() }
func file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_init() {
if File_ory_keto_relation_tuples_v1alpha2_expand_service_proto != nil {
return
}
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_rawDesc)),
NumEnums: 1,
NumMessages: 3,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_goTypes,
DependencyIndexes: file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_depIdxs,
EnumInfos: file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_enumTypes,
MessageInfos: file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_msgTypes,
}.Build()
File_ory_keto_relation_tuples_v1alpha2_expand_service_proto = out.File
file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_goTypes = nil
file_ory_keto_relation_tuples_v1alpha2_expand_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,85 @@
syntax = "proto3";
package ory.keto.relation_tuples.v1alpha2;
import "ory/keto/relation_tuples/v1alpha2/relation_tuples.proto";
// The service that performs subject set expansion
// based on the stored Access Control Lists.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
service ExpandService {
// Expands the subject set into a tree of subjects.
rpc Expand(ExpandRequest) returns (ExpandResponse);
}
// The request for an ExpandService.Expand RPC.
// Expands the given subject set.
message ExpandRequest {
// The subject to expand.
Subject subject = 1;
// 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.
int32 max_depth = 2;
// This field is not implemented yet and has no effect.
// <!--
// Optional. Like reads, a expand is always evaluated at a
// consistent snapshot no earlier than the given snaptoken.
//
// Leave this field blank if you want to expand
// based on eventually consistent ACLs, benefiting from very
// low latency, but possibly slightly stale results.
//
// If the specified token is too old and no longer known,
// the server falls back as if no snaptoken had been specified.
//
// If not specified the server tries to build the tree
// on the best snapshot version where it is very likely that
// ACLs had already been replicated to all availability zones.
// -->
string snaptoken = 3;
}
// The response for a ExpandService.Expand RPC.
message ExpandResponse {
// 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 tree = 1;
}
enum NodeType {
NODE_TYPE_UNSPECIFIED = 0;
// This node expands to a union of all children.
NODE_TYPE_UNION = 1;
// Not implemented yet.
NODE_TYPE_EXCLUSION = 2;
// Not implemented yet.
NODE_TYPE_INTERSECTION = 3;
// This node is a leaf and contains no children.
// Its subject is a `SubjectID` unless `max_depth` was reached.
NODE_TYPE_LEAF = 4;
}
message SubjectTree {
// The type of the node.
NodeType node_type = 1;
// The subject this node represents.
// Deprecated: More information is now available in the tuple field.
Subject subject = 2 [deprecated = true];
// The relation tuple this node represents.
RelationTuple tuple = 4;
// The children of this node.
//
// This is never set if `node_type` == `NODE_TYPE_LEAF`.
repeated SubjectTree children = 3;
}

View File

@@ -0,0 +1,133 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/expand_service.proto
package relationtuples
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
ExpandService_Expand_FullMethodName = "/ory.keto.relation_tuples.v1alpha2.ExpandService/Expand"
)
// ExpandServiceClient is the client API for ExpandService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// The service that performs subject set expansion
// based on the stored Access Control Lists.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
type ExpandServiceClient interface {
// Expands the subject set into a tree of subjects.
Expand(ctx context.Context, in *ExpandRequest, opts ...grpc.CallOption) (*ExpandResponse, error)
}
type expandServiceClient struct {
cc grpc.ClientConnInterface
}
func NewExpandServiceClient(cc grpc.ClientConnInterface) ExpandServiceClient {
return &expandServiceClient{cc}
}
func (c *expandServiceClient) Expand(ctx context.Context, in *ExpandRequest, opts ...grpc.CallOption) (*ExpandResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ExpandResponse)
err := c.cc.Invoke(ctx, ExpandService_Expand_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ExpandServiceServer is the server API for ExpandService service.
// All implementations must embed UnimplementedExpandServiceServer
// for forward compatibility.
//
// The service that performs subject set expansion
// based on the stored Access Control Lists.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
type ExpandServiceServer interface {
// Expands the subject set into a tree of subjects.
Expand(context.Context, *ExpandRequest) (*ExpandResponse, error)
mustEmbedUnimplementedExpandServiceServer()
}
// UnimplementedExpandServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedExpandServiceServer struct{}
func (UnimplementedExpandServiceServer) Expand(context.Context, *ExpandRequest) (*ExpandResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Expand not implemented")
}
func (UnimplementedExpandServiceServer) mustEmbedUnimplementedExpandServiceServer() {}
func (UnimplementedExpandServiceServer) testEmbeddedByValue() {}
// UnsafeExpandServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ExpandServiceServer will
// result in compilation errors.
type UnsafeExpandServiceServer interface {
mustEmbedUnimplementedExpandServiceServer()
}
func RegisterExpandServiceServer(s grpc.ServiceRegistrar, srv ExpandServiceServer) {
// If the following call panics, it indicates UnimplementedExpandServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&ExpandService_ServiceDesc, srv)
}
func _ExpandService_Expand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ExpandRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ExpandServiceServer).Expand(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ExpandService_Expand_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ExpandServiceServer).Expand(ctx, req.(*ExpandRequest))
}
return interceptor(ctx, in, info, handler)
}
// ExpandService_ServiceDesc is the grpc.ServiceDesc for ExpandService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ExpandService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ory.keto.relation_tuples.v1alpha2.ExpandService",
HandlerType: (*ExpandServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Expand",
Handler: _ExpandService_Expand_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ory/keto/relation_tuples/v1alpha2/expand_service.proto",
}

View File

@@ -0,0 +1,216 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/namespaces_service.proto
package relationtuples
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Request for ReadService.ListNamespaces RPC.
type ListNamespacesRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListNamespacesRequest) Reset() {
*x = ListNamespacesRequest{}
mi := &file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListNamespacesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListNamespacesRequest) ProtoMessage() {}
func (x *ListNamespacesRequest) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListNamespacesRequest.ProtoReflect.Descriptor instead.
func (*ListNamespacesRequest) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDescGZIP(), []int{0}
}
type ListNamespacesResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Namespaces []*Namespace `protobuf:"bytes,1,rep,name=namespaces,proto3" json:"namespaces,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListNamespacesResponse) Reset() {
*x = ListNamespacesResponse{}
mi := &file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListNamespacesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListNamespacesResponse) ProtoMessage() {}
func (x *ListNamespacesResponse) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListNamespacesResponse.ProtoReflect.Descriptor instead.
func (*ListNamespacesResponse) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDescGZIP(), []int{1}
}
func (x *ListNamespacesResponse) GetNamespaces() []*Namespace {
if x != nil {
return x.Namespaces
}
return nil
}
type Namespace struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Namespace) Reset() {
*x = Namespace{}
mi := &file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Namespace) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Namespace) ProtoMessage() {}
func (x *Namespace) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Namespace.ProtoReflect.Descriptor instead.
func (*Namespace) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDescGZIP(), []int{2}
}
func (x *Namespace) GetName() string {
if x != nil {
return x.Name
}
return ""
}
var File_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto protoreflect.FileDescriptor
const file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDesc = "" +
"\n" +
":ory/keto/relation_tuples/v1alpha2/namespaces_service.proto\x12!ory.keto.relation_tuples.v1alpha2\"\x17\n" +
"\x15ListNamespacesRequest\"f\n" +
"\x16ListNamespacesResponse\x12L\n" +
"\n" +
"namespaces\x18\x01 \x03(\v2,.ory.keto.relation_tuples.v1alpha2.NamespaceR\n" +
"namespaces\"\x1f\n" +
"\tNamespace\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name2\x9b\x01\n" +
"\x11NamespacesService\x12\x85\x01\n" +
"\x0eListNamespaces\x128.ory.keto.relation_tuples.v1alpha2.ListNamespacesRequest\x1a9.ory.keto.relation_tuples.v1alpha2.ListNamespacesResponseB\xaf\x02\n" +
"%com.ory.keto.relation_tuples.v1alpha2B\x16NamespacesServiceProtoP\x01ZKgithub.com/ory/keto/gen/go/ory/keto/relation_tuples/v1alpha2;relationtuples\xa2\x02\x03OKR\xaa\x02 Ory.Keto.RelationTuples.V1alpha2\xca\x02 Ory\\Keto\\RelationTuples\\V1alpha2\xe2\x02,Ory\\Keto\\RelationTuples\\V1alpha2\\GPBMetadata\xea\x02#Ory::Keto::RelationTuples::V1alpha2b\x06proto3"
var (
file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDescOnce sync.Once
file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDescData []byte
)
func file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDescGZIP() []byte {
file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDescOnce.Do(func() {
file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDesc)))
})
return file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDescData
}
var file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_goTypes = []any{
(*ListNamespacesRequest)(nil), // 0: ory.keto.relation_tuples.v1alpha2.ListNamespacesRequest
(*ListNamespacesResponse)(nil), // 1: ory.keto.relation_tuples.v1alpha2.ListNamespacesResponse
(*Namespace)(nil), // 2: ory.keto.relation_tuples.v1alpha2.Namespace
}
var file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_depIdxs = []int32{
2, // 0: ory.keto.relation_tuples.v1alpha2.ListNamespacesResponse.namespaces:type_name -> ory.keto.relation_tuples.v1alpha2.Namespace
0, // 1: ory.keto.relation_tuples.v1alpha2.NamespacesService.ListNamespaces:input_type -> ory.keto.relation_tuples.v1alpha2.ListNamespacesRequest
1, // 2: ory.keto.relation_tuples.v1alpha2.NamespacesService.ListNamespaces:output_type -> ory.keto.relation_tuples.v1alpha2.ListNamespacesResponse
2, // [2:3] is the sub-list for method output_type
1, // [1:2] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_init() }
func file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_init() {
if File_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_rawDesc)),
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_goTypes,
DependencyIndexes: file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_depIdxs,
MessageInfos: file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_msgTypes,
}.Build()
File_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto = out.File
file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_goTypes = nil
file_ory_keto_relation_tuples_v1alpha2_namespaces_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,22 @@
syntax = "proto3";
package ory.keto.relation_tuples.v1alpha2;
// The service to query namespaces.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
service NamespacesService {
// Lists Namespaces
rpc ListNamespaces(ListNamespacesRequest) returns (ListNamespacesResponse);
}
// Request for ReadService.ListNamespaces RPC.
message ListNamespacesRequest { }
message ListNamespacesResponse {
repeated Namespace namespaces = 1;
}
message Namespace {
string name = 1;
}

View File

@@ -0,0 +1,131 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/namespaces_service.proto
package relationtuples
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
NamespacesService_ListNamespaces_FullMethodName = "/ory.keto.relation_tuples.v1alpha2.NamespacesService/ListNamespaces"
)
// NamespacesServiceClient is the client API for NamespacesService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// The service to query namespaces.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
type NamespacesServiceClient interface {
// Lists Namespaces
ListNamespaces(ctx context.Context, in *ListNamespacesRequest, opts ...grpc.CallOption) (*ListNamespacesResponse, error)
}
type namespacesServiceClient struct {
cc grpc.ClientConnInterface
}
func NewNamespacesServiceClient(cc grpc.ClientConnInterface) NamespacesServiceClient {
return &namespacesServiceClient{cc}
}
func (c *namespacesServiceClient) ListNamespaces(ctx context.Context, in *ListNamespacesRequest, opts ...grpc.CallOption) (*ListNamespacesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListNamespacesResponse)
err := c.cc.Invoke(ctx, NamespacesService_ListNamespaces_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// NamespacesServiceServer is the server API for NamespacesService service.
// All implementations must embed UnimplementedNamespacesServiceServer
// for forward compatibility.
//
// The service to query namespaces.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
type NamespacesServiceServer interface {
// Lists Namespaces
ListNamespaces(context.Context, *ListNamespacesRequest) (*ListNamespacesResponse, error)
mustEmbedUnimplementedNamespacesServiceServer()
}
// UnimplementedNamespacesServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedNamespacesServiceServer struct{}
func (UnimplementedNamespacesServiceServer) ListNamespaces(context.Context, *ListNamespacesRequest) (*ListNamespacesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListNamespaces not implemented")
}
func (UnimplementedNamespacesServiceServer) mustEmbedUnimplementedNamespacesServiceServer() {}
func (UnimplementedNamespacesServiceServer) testEmbeddedByValue() {}
// UnsafeNamespacesServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to NamespacesServiceServer will
// result in compilation errors.
type UnsafeNamespacesServiceServer interface {
mustEmbedUnimplementedNamespacesServiceServer()
}
func RegisterNamespacesServiceServer(s grpc.ServiceRegistrar, srv NamespacesServiceServer) {
// If the following call panics, it indicates UnimplementedNamespacesServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&NamespacesService_ServiceDesc, srv)
}
func _NamespacesService_ListNamespaces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListNamespacesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NamespacesServiceServer).ListNamespaces(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: NamespacesService_ListNamespaces_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NamespacesServiceServer).ListNamespaces(ctx, req.(*ListNamespacesRequest))
}
return interceptor(ctx, in, info, handler)
}
// NamespacesService_ServiceDesc is the grpc.ServiceDesc for NamespacesService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var NamespacesService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ory.keto.relation_tuples.v1alpha2.NamespacesService",
HandlerType: (*NamespacesServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ListNamespaces",
Handler: _NamespacesService_ListNamespaces_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ory/keto/relation_tuples/v1alpha2/namespaces_service.proto",
}

View File

@@ -0,0 +1,368 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/read_service.proto
package relationtuples
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Request for ReadService.ListRelationTuples RPC.
// See `ListRelationTuplesRequest_Query` for how to filter the query.
type ListRelationTuplesRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// All query constraints are concatenated
// with a logical AND operator.
//
// The RelationTuple list from ListRelationTuplesResponse
// is ordered from the newest RelationTuple to the oldest.
//
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/read_service.proto.
Query *ListRelationTuplesRequest_Query `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
RelationQuery *RelationQuery `protobuf:"bytes,6,opt,name=relation_query,json=relationQuery,proto3" json:"relation_query,omitempty"`
// This field is not implemented yet and has no effect.
// <!--
// Optional. The list of fields to be expanded
// in the RelationTuple list returned in `ListRelationTuplesResponse`.
// Leaving this field unspecified means all fields are expanded.
//
// Available fields:
// "object", "relation", "subject",
// "namespace", "subject.id", "subject.namespace",
// "subject.object", "subject.relation"
// -->
ExpandMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=expand_mask,json=expandMask,proto3" json:"expand_mask,omitempty"`
// This field is not implemented yet and has no effect.
// <!--
// Optional. The snapshot token for this read.
// -->
Snaptoken string `protobuf:"bytes,3,opt,name=snaptoken,proto3" json:"snaptoken,omitempty"`
// Optional. The maximum number of
// RelationTuples to return in the response.
//
// Default: 100
PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
// 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.
PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListRelationTuplesRequest) Reset() {
*x = ListRelationTuplesRequest{}
mi := &file_ory_keto_relation_tuples_v1alpha2_read_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListRelationTuplesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListRelationTuplesRequest) ProtoMessage() {}
func (x *ListRelationTuplesRequest) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_read_service_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListRelationTuplesRequest.ProtoReflect.Descriptor instead.
func (*ListRelationTuplesRequest) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDescGZIP(), []int{0}
}
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/read_service.proto.
func (x *ListRelationTuplesRequest) GetQuery() *ListRelationTuplesRequest_Query {
if x != nil {
return x.Query
}
return nil
}
func (x *ListRelationTuplesRequest) GetRelationQuery() *RelationQuery {
if x != nil {
return x.RelationQuery
}
return nil
}
func (x *ListRelationTuplesRequest) GetExpandMask() *fieldmaskpb.FieldMask {
if x != nil {
return x.ExpandMask
}
return nil
}
func (x *ListRelationTuplesRequest) GetSnaptoken() string {
if x != nil {
return x.Snaptoken
}
return ""
}
func (x *ListRelationTuplesRequest) GetPageSize() int32 {
if x != nil {
return x.PageSize
}
return 0
}
func (x *ListRelationTuplesRequest) GetPageToken() string {
if x != nil {
return x.PageToken
}
return ""
}
// The response of a ReadService.ListRelationTuples RPC.
type ListRelationTuplesResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The relationships matching the list request.
RelationTuples []*RelationTuple `protobuf:"bytes,1,rep,name=relation_tuples,json=relationTuples,proto3" json:"relation_tuples,omitempty"`
// The token required to get the next page.
// If this is the last page, the token will be the empty string.
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListRelationTuplesResponse) Reset() {
*x = ListRelationTuplesResponse{}
mi := &file_ory_keto_relation_tuples_v1alpha2_read_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListRelationTuplesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListRelationTuplesResponse) ProtoMessage() {}
func (x *ListRelationTuplesResponse) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_read_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListRelationTuplesResponse.ProtoReflect.Descriptor instead.
func (*ListRelationTuplesResponse) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDescGZIP(), []int{1}
}
func (x *ListRelationTuplesResponse) GetRelationTuples() []*RelationTuple {
if x != nil {
return x.RelationTuples
}
return nil
}
func (x *ListRelationTuplesResponse) GetNextPageToken() string {
if x != nil {
return x.NextPageToken
}
return ""
}
// The query for listing relationships.
// Clients can specify any optional field to
// 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
// - 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
type ListRelationTuplesRequest_Query struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Required. The namespace to query.
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
// Optional. The object to query for.
Object string `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"`
// Optional. The relation to query for.
Relation string `protobuf:"bytes,3,opt,name=relation,proto3" json:"relation,omitempty"`
// Optional. The subject to query for.
Subject *Subject `protobuf:"bytes,4,opt,name=subject,proto3" json:"subject,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListRelationTuplesRequest_Query) Reset() {
*x = ListRelationTuplesRequest_Query{}
mi := &file_ory_keto_relation_tuples_v1alpha2_read_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListRelationTuplesRequest_Query) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListRelationTuplesRequest_Query) ProtoMessage() {}
func (x *ListRelationTuplesRequest_Query) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_read_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListRelationTuplesRequest_Query.ProtoReflect.Descriptor instead.
func (*ListRelationTuplesRequest_Query) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDescGZIP(), []int{0, 0}
}
func (x *ListRelationTuplesRequest_Query) GetNamespace() string {
if x != nil {
return x.Namespace
}
return ""
}
func (x *ListRelationTuplesRequest_Query) GetObject() string {
if x != nil {
return x.Object
}
return ""
}
func (x *ListRelationTuplesRequest_Query) GetRelation() string {
if x != nil {
return x.Relation
}
return ""
}
func (x *ListRelationTuplesRequest_Query) GetSubject() *Subject {
if x != nil {
return x.Subject
}
return nil
}
var File_ory_keto_relation_tuples_v1alpha2_read_service_proto protoreflect.FileDescriptor
const file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDesc = "" +
"\n" +
"4ory/keto/relation_tuples/v1alpha2/read_service.proto\x12!ory.keto.relation_tuples.v1alpha2\x1a7ory/keto/relation_tuples/v1alpha2/relation_tuples.proto\x1a google/protobuf/field_mask.proto\"\x8b\x04\n" +
"\x19ListRelationTuplesRequest\x12\\\n" +
"\x05query\x18\x01 \x01(\v2B.ory.keto.relation_tuples.v1alpha2.ListRelationTuplesRequest.QueryB\x02\x18\x01R\x05query\x12W\n" +
"\x0erelation_query\x18\x06 \x01(\v20.ory.keto.relation_tuples.v1alpha2.RelationQueryR\rrelationQuery\x12;\n" +
"\vexpand_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" +
"expandMask\x12\x1c\n" +
"\tsnaptoken\x18\x03 \x01(\tR\tsnaptoken\x12\x1b\n" +
"\tpage_size\x18\x04 \x01(\x05R\bpageSize\x12\x1d\n" +
"\n" +
"page_token\x18\x05 \x01(\tR\tpageToken\x1a\x9f\x01\n" +
"\x05Query\x12\x1c\n" +
"\tnamespace\x18\x01 \x01(\tR\tnamespace\x12\x16\n" +
"\x06object\x18\x02 \x01(\tR\x06object\x12\x1a\n" +
"\brelation\x18\x03 \x01(\tR\brelation\x12D\n" +
"\asubject\x18\x04 \x01(\v2*.ory.keto.relation_tuples.v1alpha2.SubjectR\asubject\"\x9f\x01\n" +
"\x1aListRelationTuplesResponse\x12Y\n" +
"\x0frelation_tuples\x18\x01 \x03(\v20.ory.keto.relation_tuples.v1alpha2.RelationTupleR\x0erelationTuples\x12&\n" +
"\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken2\xa1\x01\n" +
"\vReadService\x12\x91\x01\n" +
"\x12ListRelationTuples\x12<.ory.keto.relation_tuples.v1alpha2.ListRelationTuplesRequest\x1a=.ory.keto.relation_tuples.v1alpha2.ListRelationTuplesResponseB\xa9\x02\n" +
"%com.ory.keto.relation_tuples.v1alpha2B\x10ReadServiceProtoP\x01ZKgithub.com/ory/keto/gen/go/ory/keto/relation_tuples/v1alpha2;relationtuples\xa2\x02\x03OKR\xaa\x02 Ory.Keto.RelationTuples.V1alpha2\xca\x02 Ory\\Keto\\RelationTuples\\V1alpha2\xe2\x02,Ory\\Keto\\RelationTuples\\V1alpha2\\GPBMetadata\xea\x02#Ory::Keto::RelationTuples::V1alpha2b\x06proto3"
var (
file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDescOnce sync.Once
file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDescData []byte
)
func file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDescGZIP() []byte {
file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDescOnce.Do(func() {
file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDesc)))
})
return file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDescData
}
var file_ory_keto_relation_tuples_v1alpha2_read_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_ory_keto_relation_tuples_v1alpha2_read_service_proto_goTypes = []any{
(*ListRelationTuplesRequest)(nil), // 0: ory.keto.relation_tuples.v1alpha2.ListRelationTuplesRequest
(*ListRelationTuplesResponse)(nil), // 1: ory.keto.relation_tuples.v1alpha2.ListRelationTuplesResponse
(*ListRelationTuplesRequest_Query)(nil), // 2: ory.keto.relation_tuples.v1alpha2.ListRelationTuplesRequest.Query
(*RelationQuery)(nil), // 3: ory.keto.relation_tuples.v1alpha2.RelationQuery
(*fieldmaskpb.FieldMask)(nil), // 4: google.protobuf.FieldMask
(*RelationTuple)(nil), // 5: ory.keto.relation_tuples.v1alpha2.RelationTuple
(*Subject)(nil), // 6: ory.keto.relation_tuples.v1alpha2.Subject
}
var file_ory_keto_relation_tuples_v1alpha2_read_service_proto_depIdxs = []int32{
2, // 0: ory.keto.relation_tuples.v1alpha2.ListRelationTuplesRequest.query:type_name -> ory.keto.relation_tuples.v1alpha2.ListRelationTuplesRequest.Query
3, // 1: ory.keto.relation_tuples.v1alpha2.ListRelationTuplesRequest.relation_query:type_name -> ory.keto.relation_tuples.v1alpha2.RelationQuery
4, // 2: ory.keto.relation_tuples.v1alpha2.ListRelationTuplesRequest.expand_mask:type_name -> google.protobuf.FieldMask
5, // 3: ory.keto.relation_tuples.v1alpha2.ListRelationTuplesResponse.relation_tuples:type_name -> ory.keto.relation_tuples.v1alpha2.RelationTuple
6, // 4: ory.keto.relation_tuples.v1alpha2.ListRelationTuplesRequest.Query.subject:type_name -> ory.keto.relation_tuples.v1alpha2.Subject
0, // 5: ory.keto.relation_tuples.v1alpha2.ReadService.ListRelationTuples:input_type -> ory.keto.relation_tuples.v1alpha2.ListRelationTuplesRequest
1, // 6: ory.keto.relation_tuples.v1alpha2.ReadService.ListRelationTuples:output_type -> ory.keto.relation_tuples.v1alpha2.ListRelationTuplesResponse
6, // [6:7] is the sub-list for method output_type
5, // [5:6] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_ory_keto_relation_tuples_v1alpha2_read_service_proto_init() }
func file_ory_keto_relation_tuples_v1alpha2_read_service_proto_init() {
if File_ory_keto_relation_tuples_v1alpha2_read_service_proto != nil {
return
}
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_read_service_proto_rawDesc)),
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ory_keto_relation_tuples_v1alpha2_read_service_proto_goTypes,
DependencyIndexes: file_ory_keto_relation_tuples_v1alpha2_read_service_proto_depIdxs,
MessageInfos: file_ory_keto_relation_tuples_v1alpha2_read_service_proto_msgTypes,
}.Build()
File_ory_keto_relation_tuples_v1alpha2_read_service_proto = out.File
file_ory_keto_relation_tuples_v1alpha2_read_service_proto_goTypes = nil
file_ory_keto_relation_tuples_v1alpha2_read_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,86 @@
syntax = "proto3";
package ory.keto.relation_tuples.v1alpha2;
import "ory/keto/relation_tuples/v1alpha2/relation_tuples.proto";
import "google/protobuf/field_mask.proto";
// The service to query relationships.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
service ReadService {
// 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 relationships.
// Clients can specify any optional field to
// 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
// - 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
//
message Query {
// Required. The namespace to query.
string namespace = 1;
// Optional. The object to query for.
string object = 2;
// Optional. The relation to query for.
string relation = 3;
// Optional. The subject to query for.
Subject subject = 4;
}
// All query constraints are concatenated
// with a logical AND operator.
//
// The RelationTuple list from ListRelationTuplesResponse
// is ordered from the newest RelationTuple to the oldest.
Query query = 1 [deprecated = true];
RelationQuery relation_query = 6;
// This field is not implemented yet and has no effect.
// <!--
// Optional. The list of fields to be expanded
// in the RelationTuple list returned in `ListRelationTuplesResponse`.
// Leaving this field unspecified means all fields are expanded.
//
// Available fields:
// "object", "relation", "subject",
// "namespace", "subject.id", "subject.namespace",
// "subject.object", "subject.relation"
// -->
google.protobuf.FieldMask expand_mask = 2;
// This field is not implemented yet and has no effect.
// <!--
// Optional. The snapshot token for this read.
// -->
string snaptoken = 3;
// Optional. The maximum number of
// RelationTuples to return in the response.
//
// Default: 100
int32 page_size = 4;
// 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.
string page_token = 5;
}
// The response of a ReadService.ListRelationTuples RPC.
message ListRelationTuplesResponse {
// 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.
string next_page_token = 2;
}

View File

@@ -0,0 +1,131 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/read_service.proto
package relationtuples
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
ReadService_ListRelationTuples_FullMethodName = "/ory.keto.relation_tuples.v1alpha2.ReadService/ListRelationTuples"
)
// ReadServiceClient is the client API for ReadService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// The service to query relationships.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
type ReadServiceClient interface {
// Lists ACL relationships.
ListRelationTuples(ctx context.Context, in *ListRelationTuplesRequest, opts ...grpc.CallOption) (*ListRelationTuplesResponse, error)
}
type readServiceClient struct {
cc grpc.ClientConnInterface
}
func NewReadServiceClient(cc grpc.ClientConnInterface) ReadServiceClient {
return &readServiceClient{cc}
}
func (c *readServiceClient) ListRelationTuples(ctx context.Context, in *ListRelationTuplesRequest, opts ...grpc.CallOption) (*ListRelationTuplesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListRelationTuplesResponse)
err := c.cc.Invoke(ctx, ReadService_ListRelationTuples_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ReadServiceServer is the server API for ReadService service.
// All implementations must embed UnimplementedReadServiceServer
// for forward compatibility.
//
// The service to query relationships.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis).
type ReadServiceServer interface {
// Lists ACL relationships.
ListRelationTuples(context.Context, *ListRelationTuplesRequest) (*ListRelationTuplesResponse, error)
mustEmbedUnimplementedReadServiceServer()
}
// UnimplementedReadServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedReadServiceServer struct{}
func (UnimplementedReadServiceServer) ListRelationTuples(context.Context, *ListRelationTuplesRequest) (*ListRelationTuplesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListRelationTuples not implemented")
}
func (UnimplementedReadServiceServer) mustEmbedUnimplementedReadServiceServer() {}
func (UnimplementedReadServiceServer) testEmbeddedByValue() {}
// UnsafeReadServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ReadServiceServer will
// result in compilation errors.
type UnsafeReadServiceServer interface {
mustEmbedUnimplementedReadServiceServer()
}
func RegisterReadServiceServer(s grpc.ServiceRegistrar, srv ReadServiceServer) {
// If the following call panics, it indicates UnimplementedReadServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&ReadService_ServiceDesc, srv)
}
func _ReadService_ListRelationTuples_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListRelationTuplesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ReadServiceServer).ListRelationTuples(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ReadService_ListRelationTuples_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ReadServiceServer).ListRelationTuples(ctx, req.(*ListRelationTuplesRequest))
}
return interceptor(ctx, in, info, handler)
}
// ReadService_ServiceDesc is the grpc.ServiceDesc for ReadService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ReadService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ory.keto.relation_tuples.v1alpha2.ReadService",
HandlerType: (*ReadServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ListRelationTuples",
Handler: _ReadService_ListRelationTuples_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ory/keto/relation_tuples/v1alpha2/read_service.proto",
}

View File

@@ -0,0 +1,429 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/relation_tuples.proto
package relationtuples
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// RelationTuple defines a relation between an Object and a Subject.
type RelationTuple struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The namespace this relation tuple lives in.
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
// The object related by this tuple.
// It is an object in the namespace of the tuple.
Object string `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"`
// The relation between an Object and a Subject.
Relation string `protobuf:"bytes,3,opt,name=relation,proto3" json:"relation,omitempty"`
// The subject related by this tuple.
// A Subject either represents a concrete subject id or
// a `SubjectSet` that expands to more Subjects.
Subject *Subject `protobuf:"bytes,4,opt,name=subject,proto3" json:"subject,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *RelationTuple) Reset() {
*x = RelationTuple{}
mi := &file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *RelationTuple) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RelationTuple) ProtoMessage() {}
func (x *RelationTuple) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RelationTuple.ProtoReflect.Descriptor instead.
func (*RelationTuple) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDescGZIP(), []int{0}
}
func (x *RelationTuple) GetNamespace() string {
if x != nil {
return x.Namespace
}
return ""
}
func (x *RelationTuple) GetObject() string {
if x != nil {
return x.Object
}
return ""
}
func (x *RelationTuple) GetRelation() string {
if x != nil {
return x.Relation
}
return ""
}
func (x *RelationTuple) GetSubject() *Subject {
if x != nil {
return x.Subject
}
return nil
}
// The query for listing relationships.
// Clients can specify any optional field to
// 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
// - 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
type RelationQuery struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The namespace this relation tuple lives in.
Namespace *string `protobuf:"bytes,1,opt,name=namespace,proto3,oneof" json:"namespace,omitempty"`
// The object related by this tuple.
// It is an object in the namespace of the tuple.
Object *string `protobuf:"bytes,2,opt,name=object,proto3,oneof" json:"object,omitempty"`
// The relation between an Object and a Subject.
Relation *string `protobuf:"bytes,3,opt,name=relation,proto3,oneof" json:"relation,omitempty"`
// The subject related by this tuple.
// A Subject either represents a concrete subject id or
// a `SubjectSet` that expands to more Subjects.
Subject *Subject `protobuf:"bytes,4,opt,name=subject,proto3,oneof" json:"subject,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *RelationQuery) Reset() {
*x = RelationQuery{}
mi := &file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *RelationQuery) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RelationQuery) ProtoMessage() {}
func (x *RelationQuery) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RelationQuery.ProtoReflect.Descriptor instead.
func (*RelationQuery) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDescGZIP(), []int{1}
}
func (x *RelationQuery) GetNamespace() string {
if x != nil && x.Namespace != nil {
return *x.Namespace
}
return ""
}
func (x *RelationQuery) GetObject() string {
if x != nil && x.Object != nil {
return *x.Object
}
return ""
}
func (x *RelationQuery) GetRelation() string {
if x != nil && x.Relation != nil {
return *x.Relation
}
return ""
}
func (x *RelationQuery) GetSubject() *Subject {
if x != nil {
return x.Subject
}
return nil
}
// Subject is either a concrete subject id or
// a `SubjectSet` expanding to more Subjects.
type Subject struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The reference of this abstract subject.
//
// Types that are valid to be assigned to Ref:
//
// *Subject_Id
// *Subject_Set
Ref isSubject_Ref `protobuf_oneof:"ref"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Subject) Reset() {
*x = Subject{}
mi := &file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Subject) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Subject) ProtoMessage() {}
func (x *Subject) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Subject.ProtoReflect.Descriptor instead.
func (*Subject) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDescGZIP(), []int{2}
}
func (x *Subject) GetRef() isSubject_Ref {
if x != nil {
return x.Ref
}
return nil
}
func (x *Subject) GetId() string {
if x != nil {
if x, ok := x.Ref.(*Subject_Id); ok {
return x.Id
}
}
return ""
}
func (x *Subject) GetSet() *SubjectSet {
if x != nil {
if x, ok := x.Ref.(*Subject_Set); ok {
return x.Set
}
}
return nil
}
type isSubject_Ref interface {
isSubject_Ref()
}
type Subject_Id struct {
// A concrete id of the subject.
Id string `protobuf:"bytes,1,opt,name=id,proto3,oneof"`
}
type Subject_Set struct {
// A subject set that expands to more Subjects.
// More information are available under [concepts](../concepts/15_subjects.mdx).
Set *SubjectSet `protobuf:"bytes,2,opt,name=set,proto3,oneof"`
}
func (*Subject_Id) isSubject_Ref() {}
func (*Subject_Set) isSubject_Ref() {}
// SubjectSet refers to all subjects who have
// the same `relation` on an `object`.
type SubjectSet struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The namespace of the object and relation
// referenced in this subject set.
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
// The object related by this subject set.
Object string `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"`
// The relation between the object and the subjects.
Relation string `protobuf:"bytes,3,opt,name=relation,proto3" json:"relation,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SubjectSet) Reset() {
*x = SubjectSet{}
mi := &file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SubjectSet) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SubjectSet) ProtoMessage() {}
func (x *SubjectSet) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SubjectSet.ProtoReflect.Descriptor instead.
func (*SubjectSet) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDescGZIP(), []int{3}
}
func (x *SubjectSet) GetNamespace() string {
if x != nil {
return x.Namespace
}
return ""
}
func (x *SubjectSet) GetObject() string {
if x != nil {
return x.Object
}
return ""
}
func (x *SubjectSet) GetRelation() string {
if x != nil {
return x.Relation
}
return ""
}
var File_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto protoreflect.FileDescriptor
const file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDesc = "" +
"\n" +
"7ory/keto/relation_tuples/v1alpha2/relation_tuples.proto\x12!ory.keto.relation_tuples.v1alpha2\"\xa7\x01\n" +
"\rRelationTuple\x12\x1c\n" +
"\tnamespace\x18\x01 \x01(\tR\tnamespace\x12\x16\n" +
"\x06object\x18\x02 \x01(\tR\x06object\x12\x1a\n" +
"\brelation\x18\x03 \x01(\tR\brelation\x12D\n" +
"\asubject\x18\x04 \x01(\v2*.ory.keto.relation_tuples.v1alpha2.SubjectR\asubject\"\xed\x01\n" +
"\rRelationQuery\x12!\n" +
"\tnamespace\x18\x01 \x01(\tH\x00R\tnamespace\x88\x01\x01\x12\x1b\n" +
"\x06object\x18\x02 \x01(\tH\x01R\x06object\x88\x01\x01\x12\x1f\n" +
"\brelation\x18\x03 \x01(\tH\x02R\brelation\x88\x01\x01\x12I\n" +
"\asubject\x18\x04 \x01(\v2*.ory.keto.relation_tuples.v1alpha2.SubjectH\x03R\asubject\x88\x01\x01B\f\n" +
"\n" +
"_namespaceB\t\n" +
"\a_objectB\v\n" +
"\t_relationB\n" +
"\n" +
"\b_subject\"e\n" +
"\aSubject\x12\x10\n" +
"\x02id\x18\x01 \x01(\tH\x00R\x02id\x12A\n" +
"\x03set\x18\x02 \x01(\v2-.ory.keto.relation_tuples.v1alpha2.SubjectSetH\x00R\x03setB\x05\n" +
"\x03ref\"^\n" +
"\n" +
"SubjectSet\x12\x1c\n" +
"\tnamespace\x18\x01 \x01(\tR\tnamespace\x12\x16\n" +
"\x06object\x18\x02 \x01(\tR\x06object\x12\x1a\n" +
"\brelation\x18\x03 \x01(\tR\brelationB\xac\x02\n" +
"%com.ory.keto.relation_tuples.v1alpha2B\x13RelationTuplesProtoP\x01ZKgithub.com/ory/keto/gen/go/ory/keto/relation_tuples/v1alpha2;relationtuples\xa2\x02\x03OKR\xaa\x02 Ory.Keto.RelationTuples.V1alpha2\xca\x02 Ory\\Keto\\RelationTuples\\V1alpha2\xe2\x02,Ory\\Keto\\RelationTuples\\V1alpha2\\GPBMetadata\xea\x02#Ory::Keto::RelationTuples::V1alpha2b\x06proto3"
var (
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDescOnce sync.Once
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDescData []byte
)
func file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDescGZIP() []byte {
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDescOnce.Do(func() {
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDesc)))
})
return file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDescData
}
var file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_goTypes = []any{
(*RelationTuple)(nil), // 0: ory.keto.relation_tuples.v1alpha2.RelationTuple
(*RelationQuery)(nil), // 1: ory.keto.relation_tuples.v1alpha2.RelationQuery
(*Subject)(nil), // 2: ory.keto.relation_tuples.v1alpha2.Subject
(*SubjectSet)(nil), // 3: ory.keto.relation_tuples.v1alpha2.SubjectSet
}
var file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_depIdxs = []int32{
2, // 0: ory.keto.relation_tuples.v1alpha2.RelationTuple.subject:type_name -> ory.keto.relation_tuples.v1alpha2.Subject
2, // 1: ory.keto.relation_tuples.v1alpha2.RelationQuery.subject:type_name -> ory.keto.relation_tuples.v1alpha2.Subject
3, // 2: ory.keto.relation_tuples.v1alpha2.Subject.set:type_name -> ory.keto.relation_tuples.v1alpha2.SubjectSet
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_init() }
func file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_init() {
if File_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto != nil {
return
}
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes[1].OneofWrappers = []any{}
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes[2].OneofWrappers = []any{
(*Subject_Id)(nil),
(*Subject_Set)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_rawDesc)),
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_goTypes,
DependencyIndexes: file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_depIdxs,
MessageInfos: file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_msgTypes,
}.Build()
File_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto = out.File
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_goTypes = nil
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_depIdxs = nil
}

View File

@@ -0,0 +1,67 @@
syntax = "proto3";
package ory.keto.relation_tuples.v1alpha2;
// RelationTuple defines a relation between an Object and a Subject.
message RelationTuple {
// The namespace this relation tuple lives in.
string namespace = 1;
// The object related by this tuple.
// It is an object in the namespace of the tuple.
string object = 2;
// The relation between an Object and a Subject.
string relation = 3;
// The subject related by this tuple.
// A Subject either represents a concrete subject id or
// a `SubjectSet` that expands to more Subjects.
Subject subject = 4;
}
// The query for listing relationships.
// Clients can specify any optional field to
// 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
// - 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
message RelationQuery {
// The namespace this relation tuple lives in.
optional string namespace = 1;
// The object related by this tuple.
// It is an object in the namespace of the tuple.
optional string object = 2;
// The relation between an Object and a Subject.
optional string relation = 3;
// The subject related by this tuple.
// A Subject either represents a concrete subject id or
// a `SubjectSet` that expands to more Subjects.
optional Subject subject = 4;
}
// Subject is either a concrete subject id or
// a `SubjectSet` expanding to more Subjects.
message Subject {
// The reference of this abstract subject.
oneof ref {
// A concrete id of the subject.
string id = 1;
// A subject set that expands to more Subjects.
// More information are available under [concepts](../concepts/15_subjects.mdx).
SubjectSet set = 2;
}
}
// SubjectSet refers to all subjects who have
// the same `relation` on an `object`.
message SubjectSet {
// The namespace of the object and relation
// referenced in this subject set.
string namespace = 1;
// The object related by this subject set.
string object = 2;
// The relation between the object and the subjects.
string relation = 3;
}

View File

@@ -0,0 +1,35 @@
package relationtuples
// RelationTupleToDeltas is a helper that converts a slice of RelationTuple to a slice of RelationTupleDelta
// with the specified RelationTupleDelta_Action. This allows you to conveniently assemble a request for the
// WriteServiceClient.TransactRelationTuples operation.
//
// Example:
//
// c.TransactRelationTuples(context.Background(), &rts.TransactRelationTuplesRequest{
// RelationTupleDeltas: append(rts.RelationTupleToDeltas(insertTuples, rts.RelationTupleDelta_INSERT), rts.RelationTupleToDeltas(deleteTuples, rts.RelationTupleDelta_DELETE)...),
// })
func RelationTupleToDeltas(rs []*RelationTuple, action RelationTupleDelta_Action) []*RelationTupleDelta {
deltas := make([]*RelationTupleDelta, len(rs))
for i := range rs {
deltas[i] = &RelationTupleDelta{
RelationTuple: rs[i],
Action: action,
}
}
return deltas
}
// NewSubjectSet returns a Subject with a SubjectSet ref.
func NewSubjectSet(namespace, object, relation string) *Subject {
return &Subject{Ref: &Subject_Set{Set: &SubjectSet{
Namespace: namespace,
Object: object,
Relation: relation,
}}}
}
// NewSubjectID returns a Subject with a subject ID ref.
func NewSubjectID(id string) *Subject {
return &Subject{Ref: &Subject_Id{Id: id}}
}

View File

@@ -0,0 +1,64 @@
package relationtuples
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestRelationTupleToDeltas(t *testing.T) {
for _, tc := range []struct {
desc string
rts []*RelationTuple
action RelationTupleDelta_Action
expected []*RelationTupleDelta
}{
{
desc: "empty list",
rts: nil,
action: RelationTupleDelta_ACTION_INSERT,
expected: []*RelationTupleDelta{},
},
{
desc: "some tuples",
rts: []*RelationTuple{
{
Namespace: "n",
Object: "o1",
Relation: "r",
Subject: NewSubjectID("s"),
}, {
Namespace: "n",
Object: "o2",
Relation: "r",
Subject: NewSubjectSet("sn", "so", "sr"),
},
},
action: RelationTupleDelta_ACTION_DELETE,
expected: []*RelationTupleDelta{
{
RelationTuple: &RelationTuple{
Namespace: "n",
Object: "o1",
Relation: "r",
Subject: NewSubjectID("s"),
},
Action: RelationTupleDelta_ACTION_DELETE,
},
{
RelationTuple: &RelationTuple{
Namespace: "n",
Object: "o2",
Relation: "r",
Subject: NewSubjectSet("sn", "so", "sr"),
},
Action: RelationTupleDelta_ACTION_DELETE,
},
},
},
} {
t.Run("case="+tc.desc, func(t *testing.T) {
assert.Equal(t, tc.expected, RelationTupleToDeltas(tc.rts, tc.action))
})
}
}

View File

@@ -0,0 +1,169 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/version.proto
package relationtuples
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Request for the VersionService.GetVersion RPC.
type GetVersionRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetVersionRequest) Reset() {
*x = GetVersionRequest{}
mi := &file_ory_keto_relation_tuples_v1alpha2_version_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetVersionRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetVersionRequest) ProtoMessage() {}
func (x *GetVersionRequest) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_version_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetVersionRequest.ProtoReflect.Descriptor instead.
func (*GetVersionRequest) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDescGZIP(), []int{0}
}
// Response of the VersionService.GetVersion RPC.
type GetVersionResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The version string of the Ory Keto instance.
Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetVersionResponse) Reset() {
*x = GetVersionResponse{}
mi := &file_ory_keto_relation_tuples_v1alpha2_version_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetVersionResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetVersionResponse) ProtoMessage() {}
func (x *GetVersionResponse) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_version_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetVersionResponse.ProtoReflect.Descriptor instead.
func (*GetVersionResponse) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDescGZIP(), []int{1}
}
func (x *GetVersionResponse) GetVersion() string {
if x != nil {
return x.Version
}
return ""
}
var File_ory_keto_relation_tuples_v1alpha2_version_proto protoreflect.FileDescriptor
const file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDesc = "" +
"\n" +
"/ory/keto/relation_tuples/v1alpha2/version.proto\x12!ory.keto.relation_tuples.v1alpha2\"\x13\n" +
"\x11GetVersionRequest\".\n" +
"\x12GetVersionResponse\x12\x18\n" +
"\aversion\x18\x01 \x01(\tR\aversion2\x8b\x01\n" +
"\x0eVersionService\x12y\n" +
"\n" +
"GetVersion\x124.ory.keto.relation_tuples.v1alpha2.GetVersionRequest\x1a5.ory.keto.relation_tuples.v1alpha2.GetVersionResponseB\xa5\x02\n" +
"%com.ory.keto.relation_tuples.v1alpha2B\fVersionProtoP\x01ZKgithub.com/ory/keto/gen/go/ory/keto/relation_tuples/v1alpha2;relationtuples\xa2\x02\x03OKR\xaa\x02 Ory.Keto.RelationTuples.V1alpha2\xca\x02 Ory\\Keto\\RelationTuples\\V1alpha2\xe2\x02,Ory\\Keto\\RelationTuples\\V1alpha2\\GPBMetadata\xea\x02#Ory::Keto::RelationTuples::V1alpha2b\x06proto3"
var (
file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDescOnce sync.Once
file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDescData []byte
)
func file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDescGZIP() []byte {
file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDescOnce.Do(func() {
file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDesc)))
})
return file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDescData
}
var file_ory_keto_relation_tuples_v1alpha2_version_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_ory_keto_relation_tuples_v1alpha2_version_proto_goTypes = []any{
(*GetVersionRequest)(nil), // 0: ory.keto.relation_tuples.v1alpha2.GetVersionRequest
(*GetVersionResponse)(nil), // 1: ory.keto.relation_tuples.v1alpha2.GetVersionResponse
}
var file_ory_keto_relation_tuples_v1alpha2_version_proto_depIdxs = []int32{
0, // 0: ory.keto.relation_tuples.v1alpha2.VersionService.GetVersion:input_type -> ory.keto.relation_tuples.v1alpha2.GetVersionRequest
1, // 1: ory.keto.relation_tuples.v1alpha2.VersionService.GetVersion:output_type -> ory.keto.relation_tuples.v1alpha2.GetVersionResponse
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_ory_keto_relation_tuples_v1alpha2_version_proto_init() }
func file_ory_keto_relation_tuples_v1alpha2_version_proto_init() {
if File_ory_keto_relation_tuples_v1alpha2_version_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_version_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ory_keto_relation_tuples_v1alpha2_version_proto_goTypes,
DependencyIndexes: file_ory_keto_relation_tuples_v1alpha2_version_proto_depIdxs,
MessageInfos: file_ory_keto_relation_tuples_v1alpha2_version_proto_msgTypes,
}.Build()
File_ory_keto_relation_tuples_v1alpha2_version_proto = out.File
file_ory_keto_relation_tuples_v1alpha2_version_proto_goTypes = nil
file_ory_keto_relation_tuples_v1alpha2_version_proto_depIdxs = nil
}

View File

@@ -0,0 +1,20 @@
syntax = "proto3";
package ory.keto.relation_tuples.v1alpha2;
// The service returning the specific Ory Keto instance version.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis) and [write-APIs](../concepts/25_api-overview.mdx#write-apis).
service VersionService {
// Returns the version of the Ory Keto instance.
rpc GetVersion(GetVersionRequest) returns (GetVersionResponse);
}
// Request for the VersionService.GetVersion RPC.
message GetVersionRequest {}
// Response of the VersionService.GetVersion RPC.
message GetVersionResponse {
// The version string of the Ory Keto instance.
string version = 1;
}

View File

@@ -0,0 +1,131 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/version.proto
package relationtuples
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
VersionService_GetVersion_FullMethodName = "/ory.keto.relation_tuples.v1alpha2.VersionService/GetVersion"
)
// VersionServiceClient is the client API for VersionService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// The service returning the specific Ory Keto instance version.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis) and [write-APIs](../concepts/25_api-overview.mdx#write-apis).
type VersionServiceClient interface {
// Returns the version of the Ory Keto instance.
GetVersion(ctx context.Context, in *GetVersionRequest, opts ...grpc.CallOption) (*GetVersionResponse, error)
}
type versionServiceClient struct {
cc grpc.ClientConnInterface
}
func NewVersionServiceClient(cc grpc.ClientConnInterface) VersionServiceClient {
return &versionServiceClient{cc}
}
func (c *versionServiceClient) GetVersion(ctx context.Context, in *GetVersionRequest, opts ...grpc.CallOption) (*GetVersionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetVersionResponse)
err := c.cc.Invoke(ctx, VersionService_GetVersion_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// VersionServiceServer is the server API for VersionService service.
// All implementations must embed UnimplementedVersionServiceServer
// for forward compatibility.
//
// The service returning the specific Ory Keto instance version.
//
// This service is part of the [read-APIs](../concepts/25_api-overview.mdx#read-apis) and [write-APIs](../concepts/25_api-overview.mdx#write-apis).
type VersionServiceServer interface {
// Returns the version of the Ory Keto instance.
GetVersion(context.Context, *GetVersionRequest) (*GetVersionResponse, error)
mustEmbedUnimplementedVersionServiceServer()
}
// UnimplementedVersionServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedVersionServiceServer struct{}
func (UnimplementedVersionServiceServer) GetVersion(context.Context, *GetVersionRequest) (*GetVersionResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetVersion not implemented")
}
func (UnimplementedVersionServiceServer) mustEmbedUnimplementedVersionServiceServer() {}
func (UnimplementedVersionServiceServer) testEmbeddedByValue() {}
// UnsafeVersionServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to VersionServiceServer will
// result in compilation errors.
type UnsafeVersionServiceServer interface {
mustEmbedUnimplementedVersionServiceServer()
}
func RegisterVersionServiceServer(s grpc.ServiceRegistrar, srv VersionServiceServer) {
// If the following call panics, it indicates UnimplementedVersionServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&VersionService_ServiceDesc, srv)
}
func _VersionService_GetVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetVersionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VersionServiceServer).GetVersion(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: VersionService_GetVersion_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VersionServiceServer).GetVersion(ctx, req.(*GetVersionRequest))
}
return interceptor(ctx, in, info, handler)
}
// VersionService_ServiceDesc is the grpc.ServiceDesc for VersionService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var VersionService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ory.keto.relation_tuples.v1alpha2.VersionService",
HandlerType: (*VersionServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetVersion",
Handler: _VersionService_GetVersion_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ory/keto/relation_tuples/v1alpha2/version.proto",
}

View File

@@ -0,0 +1,499 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/write_service.proto
package relationtuples
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type RelationTupleDelta_Action int32
const (
// Unspecified.
// The `TransactRelationTuples` RPC ignores this
// RelationTupleDelta if an action was unspecified.
RelationTupleDelta_ACTION_UNSPECIFIED RelationTupleDelta_Action = 0
// Insertion of a new RelationTuple.
// It is ignored if already existing.
RelationTupleDelta_ACTION_INSERT RelationTupleDelta_Action = 1
// Deletion of the RelationTuple.
// It is ignored if it does not exist.
RelationTupleDelta_ACTION_DELETE RelationTupleDelta_Action = 2
)
// Enum value maps for RelationTupleDelta_Action.
var (
RelationTupleDelta_Action_name = map[int32]string{
0: "ACTION_UNSPECIFIED",
1: "ACTION_INSERT",
2: "ACTION_DELETE",
}
RelationTupleDelta_Action_value = map[string]int32{
"ACTION_UNSPECIFIED": 0,
"ACTION_INSERT": 1,
"ACTION_DELETE": 2,
}
)
func (x RelationTupleDelta_Action) Enum() *RelationTupleDelta_Action {
p := new(RelationTupleDelta_Action)
*p = x
return p
}
func (x RelationTupleDelta_Action) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (RelationTupleDelta_Action) Descriptor() protoreflect.EnumDescriptor {
return file_ory_keto_relation_tuples_v1alpha2_write_service_proto_enumTypes[0].Descriptor()
}
func (RelationTupleDelta_Action) Type() protoreflect.EnumType {
return &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_enumTypes[0]
}
func (x RelationTupleDelta_Action) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use RelationTupleDelta_Action.Descriptor instead.
func (RelationTupleDelta_Action) EnumDescriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescGZIP(), []int{1, 0}
}
// The request of a WriteService.TransactRelationTuples RPC.
type TransactRelationTuplesRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The write delta for the relationships operated in one single transaction.
// Either all actions succeed or no change takes effect on error.
RelationTupleDeltas []*RelationTupleDelta `protobuf:"bytes,1,rep,name=relation_tuple_deltas,json=relationTupleDeltas,proto3" json:"relation_tuple_deltas,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TransactRelationTuplesRequest) Reset() {
*x = TransactRelationTuplesRequest{}
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TransactRelationTuplesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TransactRelationTuplesRequest) ProtoMessage() {}
func (x *TransactRelationTuplesRequest) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TransactRelationTuplesRequest.ProtoReflect.Descriptor instead.
func (*TransactRelationTuplesRequest) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescGZIP(), []int{0}
}
func (x *TransactRelationTuplesRequest) GetRelationTupleDeltas() []*RelationTupleDelta {
if x != nil {
return x.RelationTupleDeltas
}
return nil
}
// Write-delta for a TransactRelationTuplesRequest.
type RelationTupleDelta struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The action to do on the RelationTuple.
Action RelationTupleDelta_Action `protobuf:"varint,1,opt,name=action,proto3,enum=ory.keto.relation_tuples.v1alpha2.RelationTupleDelta_Action" json:"action,omitempty"`
// The target RelationTuple.
RelationTuple *RelationTuple `protobuf:"bytes,2,opt,name=relation_tuple,json=relationTuple,proto3" json:"relation_tuple,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *RelationTupleDelta) Reset() {
*x = RelationTupleDelta{}
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *RelationTupleDelta) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RelationTupleDelta) ProtoMessage() {}
func (x *RelationTupleDelta) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RelationTupleDelta.ProtoReflect.Descriptor instead.
func (*RelationTupleDelta) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescGZIP(), []int{1}
}
func (x *RelationTupleDelta) GetAction() RelationTupleDelta_Action {
if x != nil {
return x.Action
}
return RelationTupleDelta_ACTION_UNSPECIFIED
}
func (x *RelationTupleDelta) GetRelationTuple() *RelationTuple {
if x != nil {
return x.RelationTuple
}
return nil
}
// The response of a WriteService.TransactRelationTuples rpc.
type TransactRelationTuplesResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
// This field is not implemented yet and has no effect.
// <!--
// The list of the new latest snapshot tokens of the affected RelationTuple,
// with the same index as specified in the `relation_tuple_deltas` field of
// the TransactRelationTuplesRequest request.
//
// If the RelationTupleDelta_Action was DELETE
// the snaptoken is empty at the same index.
// -->
Snaptokens []string `protobuf:"bytes,1,rep,name=snaptokens,proto3" json:"snaptokens,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TransactRelationTuplesResponse) Reset() {
*x = TransactRelationTuplesResponse{}
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *TransactRelationTuplesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TransactRelationTuplesResponse) ProtoMessage() {}
func (x *TransactRelationTuplesResponse) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TransactRelationTuplesResponse.ProtoReflect.Descriptor instead.
func (*TransactRelationTuplesResponse) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescGZIP(), []int{2}
}
func (x *TransactRelationTuplesResponse) GetSnaptokens() []string {
if x != nil {
return x.Snaptokens
}
return nil
}
type DeleteRelationTuplesRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/write_service.proto.
Query *DeleteRelationTuplesRequest_Query `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
RelationQuery *RelationQuery `protobuf:"bytes,2,opt,name=relation_query,json=relationQuery,proto3" json:"relation_query,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DeleteRelationTuplesRequest) Reset() {
*x = DeleteRelationTuplesRequest{}
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DeleteRelationTuplesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteRelationTuplesRequest) ProtoMessage() {}
func (x *DeleteRelationTuplesRequest) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteRelationTuplesRequest.ProtoReflect.Descriptor instead.
func (*DeleteRelationTuplesRequest) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescGZIP(), []int{3}
}
// Deprecated: Marked as deprecated in ory/keto/relation_tuples/v1alpha2/write_service.proto.
func (x *DeleteRelationTuplesRequest) GetQuery() *DeleteRelationTuplesRequest_Query {
if x != nil {
return x.Query
}
return nil
}
func (x *DeleteRelationTuplesRequest) GetRelationQuery() *RelationQuery {
if x != nil {
return x.RelationQuery
}
return nil
}
type DeleteRelationTuplesResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DeleteRelationTuplesResponse) Reset() {
*x = DeleteRelationTuplesResponse{}
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DeleteRelationTuplesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteRelationTuplesResponse) ProtoMessage() {}
func (x *DeleteRelationTuplesResponse) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteRelationTuplesResponse.ProtoReflect.Descriptor instead.
func (*DeleteRelationTuplesResponse) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescGZIP(), []int{4}
}
// The query for deleting relationships
type DeleteRelationTuplesRequest_Query struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Optional. The namespace to query.
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
// Optional. The object to query for.
Object string `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"`
// Optional. The relation to query for.
Relation string `protobuf:"bytes,3,opt,name=relation,proto3" json:"relation,omitempty"`
// Optional. The subject to query for.
Subject *Subject `protobuf:"bytes,4,opt,name=subject,proto3" json:"subject,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DeleteRelationTuplesRequest_Query) Reset() {
*x = DeleteRelationTuplesRequest_Query{}
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DeleteRelationTuplesRequest_Query) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteRelationTuplesRequest_Query) ProtoMessage() {}
func (x *DeleteRelationTuplesRequest_Query) ProtoReflect() protoreflect.Message {
mi := &file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeleteRelationTuplesRequest_Query.ProtoReflect.Descriptor instead.
func (*DeleteRelationTuplesRequest_Query) Descriptor() ([]byte, []int) {
return file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescGZIP(), []int{3, 0}
}
func (x *DeleteRelationTuplesRequest_Query) GetNamespace() string {
if x != nil {
return x.Namespace
}
return ""
}
func (x *DeleteRelationTuplesRequest_Query) GetObject() string {
if x != nil {
return x.Object
}
return ""
}
func (x *DeleteRelationTuplesRequest_Query) GetRelation() string {
if x != nil {
return x.Relation
}
return ""
}
func (x *DeleteRelationTuplesRequest_Query) GetSubject() *Subject {
if x != nil {
return x.Subject
}
return nil
}
var File_ory_keto_relation_tuples_v1alpha2_write_service_proto protoreflect.FileDescriptor
const file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDesc = "" +
"\n" +
"5ory/keto/relation_tuples/v1alpha2/write_service.proto\x12!ory.keto.relation_tuples.v1alpha2\x1a7ory/keto/relation_tuples/v1alpha2/relation_tuples.proto\"\x8a\x01\n" +
"\x1dTransactRelationTuplesRequest\x12i\n" +
"\x15relation_tuple_deltas\x18\x01 \x03(\v25.ory.keto.relation_tuples.v1alpha2.RelationTupleDeltaR\x13relationTupleDeltas\"\x8b\x02\n" +
"\x12RelationTupleDelta\x12T\n" +
"\x06action\x18\x01 \x01(\x0e2<.ory.keto.relation_tuples.v1alpha2.RelationTupleDelta.ActionR\x06action\x12W\n" +
"\x0erelation_tuple\x18\x02 \x01(\v20.ory.keto.relation_tuples.v1alpha2.RelationTupleR\rrelationTuple\"F\n" +
"\x06Action\x12\x16\n" +
"\x12ACTION_UNSPECIFIED\x10\x00\x12\x11\n" +
"\rACTION_INSERT\x10\x01\x12\x11\n" +
"\rACTION_DELETE\x10\x02\"@\n" +
"\x1eTransactRelationTuplesResponse\x12\x1e\n" +
"\n" +
"snaptokens\x18\x01 \x03(\tR\n" +
"snaptokens\"\xf8\x02\n" +
"\x1bDeleteRelationTuplesRequest\x12^\n" +
"\x05query\x18\x01 \x01(\v2D.ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesRequest.QueryB\x02\x18\x01R\x05query\x12W\n" +
"\x0erelation_query\x18\x02 \x01(\v20.ory.keto.relation_tuples.v1alpha2.RelationQueryR\rrelationQuery\x1a\x9f\x01\n" +
"\x05Query\x12\x1c\n" +
"\tnamespace\x18\x01 \x01(\tR\tnamespace\x12\x16\n" +
"\x06object\x18\x02 \x01(\tR\x06object\x12\x1a\n" +
"\brelation\x18\x03 \x01(\tR\brelation\x12D\n" +
"\asubject\x18\x04 \x01(\v2*.ory.keto.relation_tuples.v1alpha2.SubjectR\asubject\"\x1e\n" +
"\x1cDeleteRelationTuplesResponse2\xc8\x02\n" +
"\fWriteService\x12\x9d\x01\n" +
"\x16TransactRelationTuples\x12@.ory.keto.relation_tuples.v1alpha2.TransactRelationTuplesRequest\x1aA.ory.keto.relation_tuples.v1alpha2.TransactRelationTuplesResponse\x12\x97\x01\n" +
"\x14DeleteRelationTuples\x12>.ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesRequest\x1a?.ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesResponseB\xaa\x02\n" +
"%com.ory.keto.relation_tuples.v1alpha2B\x11WriteServiceProtoP\x01ZKgithub.com/ory/keto/gen/go/ory/keto/relation_tuples/v1alpha2;relationtuples\xa2\x02\x03OKR\xaa\x02 Ory.Keto.RelationTuples.V1alpha2\xca\x02 Ory\\Keto\\RelationTuples\\V1alpha2\xe2\x02,Ory\\Keto\\RelationTuples\\V1alpha2\\GPBMetadata\xea\x02#Ory::Keto::RelationTuples::V1alpha2b\x06proto3"
var (
file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescOnce sync.Once
file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescData []byte
)
func file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescGZIP() []byte {
file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescOnce.Do(func() {
file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDesc)))
})
return file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDescData
}
var file_ory_keto_relation_tuples_v1alpha2_write_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_ory_keto_relation_tuples_v1alpha2_write_service_proto_goTypes = []any{
(RelationTupleDelta_Action)(0), // 0: ory.keto.relation_tuples.v1alpha2.RelationTupleDelta.Action
(*TransactRelationTuplesRequest)(nil), // 1: ory.keto.relation_tuples.v1alpha2.TransactRelationTuplesRequest
(*RelationTupleDelta)(nil), // 2: ory.keto.relation_tuples.v1alpha2.RelationTupleDelta
(*TransactRelationTuplesResponse)(nil), // 3: ory.keto.relation_tuples.v1alpha2.TransactRelationTuplesResponse
(*DeleteRelationTuplesRequest)(nil), // 4: ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesRequest
(*DeleteRelationTuplesResponse)(nil), // 5: ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesResponse
(*DeleteRelationTuplesRequest_Query)(nil), // 6: ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesRequest.Query
(*RelationTuple)(nil), // 7: ory.keto.relation_tuples.v1alpha2.RelationTuple
(*RelationQuery)(nil), // 8: ory.keto.relation_tuples.v1alpha2.RelationQuery
(*Subject)(nil), // 9: ory.keto.relation_tuples.v1alpha2.Subject
}
var file_ory_keto_relation_tuples_v1alpha2_write_service_proto_depIdxs = []int32{
2, // 0: ory.keto.relation_tuples.v1alpha2.TransactRelationTuplesRequest.relation_tuple_deltas:type_name -> ory.keto.relation_tuples.v1alpha2.RelationTupleDelta
0, // 1: ory.keto.relation_tuples.v1alpha2.RelationTupleDelta.action:type_name -> ory.keto.relation_tuples.v1alpha2.RelationTupleDelta.Action
7, // 2: ory.keto.relation_tuples.v1alpha2.RelationTupleDelta.relation_tuple:type_name -> ory.keto.relation_tuples.v1alpha2.RelationTuple
6, // 3: ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesRequest.query:type_name -> ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesRequest.Query
8, // 4: ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesRequest.relation_query:type_name -> ory.keto.relation_tuples.v1alpha2.RelationQuery
9, // 5: ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesRequest.Query.subject:type_name -> ory.keto.relation_tuples.v1alpha2.Subject
1, // 6: ory.keto.relation_tuples.v1alpha2.WriteService.TransactRelationTuples:input_type -> ory.keto.relation_tuples.v1alpha2.TransactRelationTuplesRequest
4, // 7: ory.keto.relation_tuples.v1alpha2.WriteService.DeleteRelationTuples:input_type -> ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesRequest
3, // 8: ory.keto.relation_tuples.v1alpha2.WriteService.TransactRelationTuples:output_type -> ory.keto.relation_tuples.v1alpha2.TransactRelationTuplesResponse
5, // 9: ory.keto.relation_tuples.v1alpha2.WriteService.DeleteRelationTuples:output_type -> ory.keto.relation_tuples.v1alpha2.DeleteRelationTuplesResponse
8, // [8:10] is the sub-list for method output_type
6, // [6:8] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_ory_keto_relation_tuples_v1alpha2_write_service_proto_init() }
func file_ory_keto_relation_tuples_v1alpha2_write_service_proto_init() {
if File_ory_keto_relation_tuples_v1alpha2_write_service_proto != nil {
return
}
file_ory_keto_relation_tuples_v1alpha2_relation_tuples_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDesc), len(file_ory_keto_relation_tuples_v1alpha2_write_service_proto_rawDesc)),
NumEnums: 1,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ory_keto_relation_tuples_v1alpha2_write_service_proto_goTypes,
DependencyIndexes: file_ory_keto_relation_tuples_v1alpha2_write_service_proto_depIdxs,
EnumInfos: file_ory_keto_relation_tuples_v1alpha2_write_service_proto_enumTypes,
MessageInfos: file_ory_keto_relation_tuples_v1alpha2_write_service_proto_msgTypes,
}.Build()
File_ory_keto_relation_tuples_v1alpha2_write_service_proto = out.File
file_ory_keto_relation_tuples_v1alpha2_write_service_proto_goTypes = nil
file_ory_keto_relation_tuples_v1alpha2_write_service_proto_depIdxs = nil
}

View File

@@ -0,0 +1,79 @@
syntax = "proto3";
package ory.keto.relation_tuples.v1alpha2;
import "ory/keto/relation_tuples/v1alpha2/relation_tuples.proto";
// The write service to create and delete Access Control Lists.
//
// This service is part of the [write-APIs](../concepts/25_api-overview.mdx#write-apis).
service WriteService {
// Writes one or more relationships in a single transaction.
rpc TransactRelationTuples(TransactRelationTuplesRequest) returns (TransactRelationTuplesResponse);
// 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 relationships operated in one single transaction.
// Either all actions succeed or no change takes effect on error.
repeated RelationTupleDelta relation_tuple_deltas = 1;
}
// Write-delta for a TransactRelationTuplesRequest.
message RelationTupleDelta {
enum Action {
// Unspecified.
// The `TransactRelationTuples` RPC ignores this
// RelationTupleDelta if an action was unspecified.
ACTION_UNSPECIFIED = 0;
// Insertion of a new RelationTuple.
ACTION_INSERT = 1;
// Deletion of the RelationTuple.
// It is ignored if it does not exist.
ACTION_DELETE = 2;
}
// The action to do on the RelationTuple.
Action action = 1;
// The target RelationTuple.
RelationTuple relation_tuple = 2;
}
// The response of a WriteService.TransactRelationTuples rpc.
message TransactRelationTuplesResponse {
// This field is not implemented yet and has no effect.
// <!--
// The list of the new latest snapshot tokens of the affected RelationTuple,
// with the same index as specified in the `relation_tuple_deltas` field of
// the TransactRelationTuplesRequest request.
//
// If the RelationTupleDelta_Action was DELETE
// the snaptoken is empty at the same index.
// -->
repeated string snaptokens = 1;
}
message DeleteRelationTuplesRequest {
// The query for deleting relationships
message Query {
// Optional. The namespace to query.
string namespace = 1;
// Optional. The object to query for.
string object = 2;
// Optional. The relation to query for.
string relation = 3;
// Optional. The subject to query for.
Subject subject = 4;
}
Query query = 1 [deprecated = true];
RelationQuery relation_query = 2;
}
message DeleteRelationTuplesResponse {
}

View File

@@ -0,0 +1,171 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: ory/keto/relation_tuples/v1alpha2/write_service.proto
package relationtuples
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
WriteService_TransactRelationTuples_FullMethodName = "/ory.keto.relation_tuples.v1alpha2.WriteService/TransactRelationTuples"
WriteService_DeleteRelationTuples_FullMethodName = "/ory.keto.relation_tuples.v1alpha2.WriteService/DeleteRelationTuples"
)
// WriteServiceClient is the client API for WriteService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// The write service to create and delete Access Control Lists.
//
// This service is part of the [write-APIs](../concepts/25_api-overview.mdx#write-apis).
type WriteServiceClient interface {
// Writes one or more relationships in a single transaction.
TransactRelationTuples(ctx context.Context, in *TransactRelationTuplesRequest, opts ...grpc.CallOption) (*TransactRelationTuplesResponse, error)
// Deletes relationships based on relation query
DeleteRelationTuples(ctx context.Context, in *DeleteRelationTuplesRequest, opts ...grpc.CallOption) (*DeleteRelationTuplesResponse, error)
}
type writeServiceClient struct {
cc grpc.ClientConnInterface
}
func NewWriteServiceClient(cc grpc.ClientConnInterface) WriteServiceClient {
return &writeServiceClient{cc}
}
func (c *writeServiceClient) TransactRelationTuples(ctx context.Context, in *TransactRelationTuplesRequest, opts ...grpc.CallOption) (*TransactRelationTuplesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(TransactRelationTuplesResponse)
err := c.cc.Invoke(ctx, WriteService_TransactRelationTuples_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *writeServiceClient) DeleteRelationTuples(ctx context.Context, in *DeleteRelationTuplesRequest, opts ...grpc.CallOption) (*DeleteRelationTuplesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteRelationTuplesResponse)
err := c.cc.Invoke(ctx, WriteService_DeleteRelationTuples_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// WriteServiceServer is the server API for WriteService service.
// All implementations must embed UnimplementedWriteServiceServer
// for forward compatibility.
//
// The write service to create and delete Access Control Lists.
//
// This service is part of the [write-APIs](../concepts/25_api-overview.mdx#write-apis).
type WriteServiceServer interface {
// Writes one or more relationships in a single transaction.
TransactRelationTuples(context.Context, *TransactRelationTuplesRequest) (*TransactRelationTuplesResponse, error)
// Deletes relationships based on relation query
DeleteRelationTuples(context.Context, *DeleteRelationTuplesRequest) (*DeleteRelationTuplesResponse, error)
mustEmbedUnimplementedWriteServiceServer()
}
// UnimplementedWriteServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedWriteServiceServer struct{}
func (UnimplementedWriteServiceServer) TransactRelationTuples(context.Context, *TransactRelationTuplesRequest) (*TransactRelationTuplesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method TransactRelationTuples not implemented")
}
func (UnimplementedWriteServiceServer) DeleteRelationTuples(context.Context, *DeleteRelationTuplesRequest) (*DeleteRelationTuplesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteRelationTuples not implemented")
}
func (UnimplementedWriteServiceServer) mustEmbedUnimplementedWriteServiceServer() {}
func (UnimplementedWriteServiceServer) testEmbeddedByValue() {}
// UnsafeWriteServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to WriteServiceServer will
// result in compilation errors.
type UnsafeWriteServiceServer interface {
mustEmbedUnimplementedWriteServiceServer()
}
func RegisterWriteServiceServer(s grpc.ServiceRegistrar, srv WriteServiceServer) {
// If the following call panics, it indicates UnimplementedWriteServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&WriteService_ServiceDesc, srv)
}
func _WriteService_TransactRelationTuples_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TransactRelationTuplesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WriteServiceServer).TransactRelationTuples(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WriteService_TransactRelationTuples_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WriteServiceServer).TransactRelationTuples(ctx, req.(*TransactRelationTuplesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WriteService_DeleteRelationTuples_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteRelationTuplesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WriteServiceServer).DeleteRelationTuples(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WriteService_DeleteRelationTuples_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WriteServiceServer).DeleteRelationTuples(ctx, req.(*DeleteRelationTuplesRequest))
}
return interceptor(ctx, in, info, handler)
}
// WriteService_ServiceDesc is the grpc.ServiceDesc for WriteService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var WriteService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ory.keto.relation_tuples.v1alpha2.WriteService",
HandlerType: (*WriteServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "TransactRelationTuples",
Handler: _WriteService_TransactRelationTuples_Handler,
},
{
MethodName: "DeleteRelationTuples",
Handler: _WriteService_DeleteRelationTuples_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ory/keto/relation_tuples/v1alpha2/write_service.proto",
}