From 37330a4b05eb6309d32b74627767d5aaff56888f Mon Sep 17 00:00:00 2001 From: wscalf Date: Mon, 3 Jun 2024 14:47:22 -0400 Subject: [PATCH] PR feedback/proto adjustments --- api/relations/v0/common.pb.go | 203 ++++++++++++++++---- api/relations/v0/common.proto | 9 + api/relations/v0/lookup.pb.go | 116 ++++++------ api/relations/v0/lookup.proto | 9 +- api/relations/v0/relation_tuples.pb.go | 244 ++++++++++++------------- api/relations/v0/relation_tuples.proto | 5 +- internal/biz/lookup.go | 22 ++- internal/biz/relationships.go | 15 +- internal/service/lookup.go | 4 +- internal/service/relationships.go | 4 +- openapi.yaml | 117 ++++++------ 11 files changed, 453 insertions(+), 295 deletions(-) diff --git a/api/relations/v0/common.pb.go b/api/relations/v0/common.pb.go index 7cdd266..54806b5 100644 --- a/api/relations/v0/common.pb.go +++ b/api/relations/v0/common.pb.go @@ -150,6 +150,108 @@ func (x *SubjectReference) GetSubject() *ObjectReference { return nil } +type RequestPagination struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Limit uint32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` + ContinuationToken *string `protobuf:"bytes,2,opt,name=continuation_token,json=continuationToken,proto3,oneof" json:"continuation_token,omitempty"` +} + +func (x *RequestPagination) Reset() { + *x = RequestPagination{} + if protoimpl.UnsafeEnabled { + mi := &file_relations_v0_common_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RequestPagination) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestPagination) ProtoMessage() {} + +func (x *RequestPagination) ProtoReflect() protoreflect.Message { + mi := &file_relations_v0_common_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RequestPagination.ProtoReflect.Descriptor instead. +func (*RequestPagination) Descriptor() ([]byte, []int) { + return file_relations_v0_common_proto_rawDescGZIP(), []int{2} +} + +func (x *RequestPagination) GetLimit() uint32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *RequestPagination) GetContinuationToken() string { + if x != nil && x.ContinuationToken != nil { + return *x.ContinuationToken + } + return "" +} + +type ResponsePagination struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ContinuationToken string `protobuf:"bytes,1,opt,name=continuation_token,json=continuationToken,proto3" json:"continuation_token,omitempty"` +} + +func (x *ResponsePagination) Reset() { + *x = ResponsePagination{} + if protoimpl.UnsafeEnabled { + mi := &file_relations_v0_common_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResponsePagination) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResponsePagination) ProtoMessage() {} + +func (x *ResponsePagination) ProtoReflect() protoreflect.Message { + mi := &file_relations_v0_common_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResponsePagination.ProtoReflect.Descriptor instead. +func (*ResponsePagination) Descriptor() ([]byte, []int) { + return file_relations_v0_common_proto_rawDescGZIP(), []int{3} +} + +func (x *ResponsePagination) GetContinuationToken() string { + if x != nil { + return x.ContinuationToken + } + return "" +} + type ObjectReference struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -162,7 +264,7 @@ type ObjectReference struct { func (x *ObjectReference) Reset() { *x = ObjectReference{} if protoimpl.UnsafeEnabled { - mi := &file_relations_v0_common_proto_msgTypes[2] + mi := &file_relations_v0_common_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -175,7 +277,7 @@ func (x *ObjectReference) String() string { func (*ObjectReference) ProtoMessage() {} func (x *ObjectReference) ProtoReflect() protoreflect.Message { - mi := &file_relations_v0_common_proto_msgTypes[2] + mi := &file_relations_v0_common_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -188,7 +290,7 @@ func (x *ObjectReference) ProtoReflect() protoreflect.Message { // Deprecated: Use ObjectReference.ProtoReflect.Descriptor instead. func (*ObjectReference) Descriptor() ([]byte, []int) { - return file_relations_v0_common_proto_rawDescGZIP(), []int{2} + return file_relations_v0_common_proto_rawDescGZIP(), []int{4} } func (x *ObjectReference) GetType() *ObjectType { @@ -217,7 +319,7 @@ type ObjectType struct { func (x *ObjectType) Reset() { *x = ObjectType{} if protoimpl.UnsafeEnabled { - mi := &file_relations_v0_common_proto_msgTypes[3] + mi := &file_relations_v0_common_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -230,7 +332,7 @@ func (x *ObjectType) String() string { func (*ObjectType) ProtoMessage() {} func (x *ObjectType) ProtoReflect() protoreflect.Message { - mi := &file_relations_v0_common_proto_msgTypes[3] + mi := &file_relations_v0_common_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -243,7 +345,7 @@ func (x *ObjectType) ProtoReflect() protoreflect.Message { // Deprecated: Use ObjectType.ProtoReflect.Descriptor instead. func (*ObjectType) Descriptor() ([]byte, []int) { - return file_relations_v0_common_proto_rawDescGZIP(), []int{3} + return file_relations_v0_common_proto_rawDescGZIP(), []int{5} } func (x *ObjectType) GetNamespace() string { @@ -285,21 +387,33 @@ var file_relations_v0_common_proto_rawDesc = []byte{ 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x56, 0x0a, 0x0f, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x3e, 0x0a, 0x0a, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x47, 0x0a, 0x23, 0x6f, - 0x72, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6b, 0x65, 0x73, 0x73, 0x65, - 0x6c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x76, 0x30, 0x50, 0x01, 0x5a, 0x1e, 0x63, 0x69, 0x61, 0x6d, 0x2d, 0x72, 0x65, 0x62, 0x61, 0x63, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, - 0x30, 0x3b, 0x76, 0x30, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6f, 0x6e, 0x22, 0x74, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x50, 0x61, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x32, + 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x11, 0x63, 0x6f, + 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x88, + 0x01, 0x01, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x43, 0x0a, 0x12, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, + 0x74, 0x69, 0x6e, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x56, + 0x0a, 0x0f, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x12, 0x33, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1f, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x3e, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x47, 0x0a, 0x23, 0x6f, 0x72, 0x67, 0x2e, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x50, 0x01, 0x5a, + 0x1e, 0x63, 0x69, 0x61, 0x6d, 0x2d, 0x72, 0x65, 0x62, 0x61, 0x63, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x30, 0x3b, 0x76, 0x30, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -314,18 +428,20 @@ func file_relations_v0_common_proto_rawDescGZIP() []byte { return file_relations_v0_common_proto_rawDescData } -var file_relations_v0_common_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_relations_v0_common_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_relations_v0_common_proto_goTypes = []interface{}{ - (*Relationship)(nil), // 0: kessel.relations.v0.Relationship - (*SubjectReference)(nil), // 1: kessel.relations.v0.SubjectReference - (*ObjectReference)(nil), // 2: kessel.relations.v0.ObjectReference - (*ObjectType)(nil), // 3: kessel.relations.v0.ObjectType + (*Relationship)(nil), // 0: kessel.relations.v0.Relationship + (*SubjectReference)(nil), // 1: kessel.relations.v0.SubjectReference + (*RequestPagination)(nil), // 2: kessel.relations.v0.RequestPagination + (*ResponsePagination)(nil), // 3: kessel.relations.v0.ResponsePagination + (*ObjectReference)(nil), // 4: kessel.relations.v0.ObjectReference + (*ObjectType)(nil), // 5: kessel.relations.v0.ObjectType } var file_relations_v0_common_proto_depIdxs = []int32{ - 2, // 0: kessel.relations.v0.Relationship.resource:type_name -> kessel.relations.v0.ObjectReference + 4, // 0: kessel.relations.v0.Relationship.resource:type_name -> kessel.relations.v0.ObjectReference 1, // 1: kessel.relations.v0.Relationship.subject:type_name -> kessel.relations.v0.SubjectReference - 2, // 2: kessel.relations.v0.SubjectReference.subject:type_name -> kessel.relations.v0.ObjectReference - 3, // 3: kessel.relations.v0.ObjectReference.type:type_name -> kessel.relations.v0.ObjectType + 4, // 2: kessel.relations.v0.SubjectReference.subject:type_name -> kessel.relations.v0.ObjectReference + 5, // 3: kessel.relations.v0.ObjectReference.type:type_name -> kessel.relations.v0.ObjectType 4, // [4:4] is the sub-list for method output_type 4, // [4:4] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name @@ -364,7 +480,7 @@ func file_relations_v0_common_proto_init() { } } file_relations_v0_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ObjectReference); i { + switch v := v.(*RequestPagination); i { case 0: return &v.state case 1: @@ -376,6 +492,30 @@ func file_relations_v0_common_proto_init() { } } file_relations_v0_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResponsePagination); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_relations_v0_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ObjectReference); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_relations_v0_common_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ObjectType); i { case 0: return &v.state @@ -389,13 +529,14 @@ func file_relations_v0_common_proto_init() { } } file_relations_v0_common_proto_msgTypes[1].OneofWrappers = []interface{}{} + file_relations_v0_common_proto_msgTypes[2].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_relations_v0_common_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/api/relations/v0/common.proto b/api/relations/v0/common.proto index 5570caa..7590fdb 100644 --- a/api/relations/v0/common.proto +++ b/api/relations/v0/common.proto @@ -29,6 +29,15 @@ message SubjectReference { ObjectReference subject = 2; } +message RequestPagination { + uint32 limit = 1; + optional string continuation_token = 2; +} + +message ResponsePagination { + string continuation_token = 1; +} + message ObjectReference { ObjectType type = 1; string id = 2; diff --git a/api/relations/v0/lookup.pb.go b/api/relations/v0/lookup.pb.go index 5f30444..dce6d19 100644 --- a/api/relations/v0/lookup.pb.go +++ b/api/relations/v0/lookup.pb.go @@ -26,12 +26,11 @@ type LookupSubjectsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SubjectType *ObjectType `protobuf:"bytes,1,opt,name=subject_type,json=subjectType,proto3" json:"subject_type,omitempty"` - SubjectRelation string `protobuf:"bytes,2,opt,name=subject_relation,json=subjectRelation,proto3" json:"subject_relation,omitempty"` - Relation string `protobuf:"bytes,3,opt,name=relation,proto3" json:"relation,omitempty"` - Resource *ObjectReference `protobuf:"bytes,4,opt,name=resource,proto3" json:"resource,omitempty"` - Limit *uint32 `protobuf:"varint,5,opt,name=limit,proto3,oneof" json:"limit,omitempty"` - ContinuationToken *string `protobuf:"bytes,6,opt,name=continuation_token,json=continuationToken,proto3,oneof" json:"continuation_token,omitempty"` + SubjectType *ObjectType `protobuf:"bytes,1,opt,name=subject_type,json=subjectType,proto3" json:"subject_type,omitempty"` + SubjectRelation *string `protobuf:"bytes,2,opt,name=subject_relation,json=subjectRelation,proto3,oneof" json:"subject_relation,omitempty"` + Relation string `protobuf:"bytes,3,opt,name=relation,proto3" json:"relation,omitempty"` + Resource *ObjectReference `protobuf:"bytes,4,opt,name=resource,proto3" json:"resource,omitempty"` + Pagination *RequestPagination `protobuf:"bytes,5,opt,name=pagination,proto3,oneof" json:"pagination,omitempty"` } func (x *LookupSubjectsRequest) Reset() { @@ -74,8 +73,8 @@ func (x *LookupSubjectsRequest) GetSubjectType() *ObjectType { } func (x *LookupSubjectsRequest) GetSubjectRelation() string { - if x != nil { - return x.SubjectRelation + if x != nil && x.SubjectRelation != nil { + return *x.SubjectRelation } return "" } @@ -94,18 +93,11 @@ func (x *LookupSubjectsRequest) GetResource() *ObjectReference { return nil } -func (x *LookupSubjectsRequest) GetLimit() uint32 { - if x != nil && x.Limit != nil { - return *x.Limit - } - return 0 -} - -func (x *LookupSubjectsRequest) GetContinuationToken() string { - if x != nil && x.ContinuationToken != nil { - return *x.ContinuationToken +func (x *LookupSubjectsRequest) GetPagination() *RequestPagination { + if x != nil { + return x.Pagination } - return "" + return nil } type LookupSubjectsResponse struct { @@ -113,8 +105,8 @@ type LookupSubjectsResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Subject *SubjectReference `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` - ContinuationToken string `protobuf:"bytes,2,opt,name=continuation_token,json=continuationToken,proto3" json:"continuation_token,omitempty"` + Subject *SubjectReference `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"` + Pagination *ResponsePagination `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (x *LookupSubjectsResponse) Reset() { @@ -156,11 +148,11 @@ func (x *LookupSubjectsResponse) GetSubject() *SubjectReference { return nil } -func (x *LookupSubjectsResponse) GetContinuationToken() string { +func (x *LookupSubjectsResponse) GetPagination() *ResponsePagination { if x != nil { - return x.ContinuationToken + return x.Pagination } - return "" + return nil } var File_relations_v0_lookup_proto protoreflect.FileDescriptor @@ -172,37 +164,39 @@ var file_relations_v0_lookup_proto_rawDesc = []byte{ 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x30, 0x2f, 0x63, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd4, 0x02, 0x0a, 0x15, 0x4c, 0x6f, + 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xda, 0x02, 0x0a, 0x15, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, + 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2e, 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x40, - 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x24, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x66, - 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x12, 0x19, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x88, 0x01, 0x01, 0x12, 0x32, 0x0a, 0x12, 0x63, - 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x69, - 0x6e, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x63, 0x6f, - 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x22, 0x88, 0x01, 0x0a, 0x16, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x07, 0x73, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6b, - 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x76, 0x30, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x2d, 0x0a, 0x12, - 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, - 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0x99, 0x01, 0x0a, 0x13, + 0x09, 0x48, 0x00, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x6c, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, + 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x4b, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6b, 0x65, 0x73, 0x73, + 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x48, 0x01, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, + 0x01, 0x01, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x72, + 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x70, 0x61, 0x67, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa2, 0x01, 0x0a, 0x16, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, + 0x70, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x3f, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, + 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x99, 0x01, 0x0a, 0x13, 0x4b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x81, 0x01, 0x0a, 0x0e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x2a, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, @@ -211,7 +205,7 @@ var file_relations_v0_lookup_proto_rawDesc = []byte{ 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x75, 0x62, + 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x30, 0x2f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x30, 0x01, 0x42, 0x47, 0x0a, 0x23, 0x6f, 0x72, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x50, 0x01, @@ -238,19 +232,23 @@ var file_relations_v0_lookup_proto_goTypes = []interface{}{ (*LookupSubjectsResponse)(nil), // 1: kessel.relations.v0.LookupSubjectsResponse (*ObjectType)(nil), // 2: kessel.relations.v0.ObjectType (*ObjectReference)(nil), // 3: kessel.relations.v0.ObjectReference - (*SubjectReference)(nil), // 4: kessel.relations.v0.SubjectReference + (*RequestPagination)(nil), // 4: kessel.relations.v0.RequestPagination + (*SubjectReference)(nil), // 5: kessel.relations.v0.SubjectReference + (*ResponsePagination)(nil), // 6: kessel.relations.v0.ResponsePagination } var file_relations_v0_lookup_proto_depIdxs = []int32{ 2, // 0: kessel.relations.v0.LookupSubjectsRequest.subject_type:type_name -> kessel.relations.v0.ObjectType 3, // 1: kessel.relations.v0.LookupSubjectsRequest.resource:type_name -> kessel.relations.v0.ObjectReference - 4, // 2: kessel.relations.v0.LookupSubjectsResponse.subject:type_name -> kessel.relations.v0.SubjectReference - 0, // 3: kessel.relations.v0.KesselLookupService.LookupSubjects:input_type -> kessel.relations.v0.LookupSubjectsRequest - 1, // 4: kessel.relations.v0.KesselLookupService.LookupSubjects:output_type -> kessel.relations.v0.LookupSubjectsResponse - 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 + 4, // 2: kessel.relations.v0.LookupSubjectsRequest.pagination:type_name -> kessel.relations.v0.RequestPagination + 5, // 3: kessel.relations.v0.LookupSubjectsResponse.subject:type_name -> kessel.relations.v0.SubjectReference + 6, // 4: kessel.relations.v0.LookupSubjectsResponse.pagination:type_name -> kessel.relations.v0.ResponsePagination + 0, // 5: kessel.relations.v0.KesselLookupService.LookupSubjects:input_type -> kessel.relations.v0.LookupSubjectsRequest + 1, // 6: kessel.relations.v0.KesselLookupService.LookupSubjects:output_type -> kessel.relations.v0.LookupSubjectsResponse + 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_relations_v0_lookup_proto_init() } diff --git a/api/relations/v0/lookup.proto b/api/relations/v0/lookup.proto index 51d0e56..24477d3 100644 --- a/api/relations/v0/lookup.proto +++ b/api/relations/v0/lookup.proto @@ -12,21 +12,20 @@ option java_package = "org.project_kessel.api.relations.v0"; service KesselLookupService { rpc LookupSubjects(LookupSubjectsRequest) returns (stream LookupSubjectsResponse) { option (google.api.http) = { - get: "/v1/subjects" + get: "/v0/subjects" }; }; } message LookupSubjectsRequest { ObjectType subject_type = 1; - string subject_relation = 2; + optional string subject_relation = 2; string relation = 3; ObjectReference resource = 4; - optional uint32 limit = 5; - optional string continuation_token = 6; + optional RequestPagination pagination = 5; } message LookupSubjectsResponse { SubjectReference subject = 1; - string continuation_token = 2; + ResponsePagination pagination = 2; } \ No newline at end of file diff --git a/api/relations/v0/relation_tuples.pb.go b/api/relations/v0/relation_tuples.pb.go index fec63fc..64bb311 100644 --- a/api/relations/v0/relation_tuples.pb.go +++ b/api/relations/v0/relation_tuples.pb.go @@ -123,9 +123,8 @@ type ReadTuplesRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Filter *RelationTupleFilter `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` - Limit *uint32 `protobuf:"varint,2,opt,name=limit,proto3,oneof" json:"limit,omitempty"` - ContinuationToken *string `protobuf:"bytes,3,opt,name=continuation_token,json=continuationToken,proto3,oneof" json:"continuation_token,omitempty"` + Filter *RelationTupleFilter `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` + Pagination *RequestPagination `protobuf:"bytes,2,opt,name=pagination,proto3,oneof" json:"pagination,omitempty"` } func (x *ReadTuplesRequest) Reset() { @@ -167,18 +166,11 @@ func (x *ReadTuplesRequest) GetFilter() *RelationTupleFilter { return nil } -func (x *ReadTuplesRequest) GetLimit() uint32 { - if x != nil && x.Limit != nil { - return *x.Limit - } - return 0 -} - -func (x *ReadTuplesRequest) GetContinuationToken() string { - if x != nil && x.ContinuationToken != nil { - return *x.ContinuationToken +func (x *ReadTuplesRequest) GetPagination() *RequestPagination { + if x != nil { + return x.Pagination } - return "" + return nil } type ReadTuplesResponse struct { @@ -186,8 +178,8 @@ type ReadTuplesResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Tuple *Relationship `protobuf:"bytes,1,opt,name=tuple,proto3" json:"tuple,omitempty"` - ContinuationToken string `protobuf:"bytes,2,opt,name=continuation_token,json=continuationToken,proto3" json:"continuation_token,omitempty"` + Tuple *Relationship `protobuf:"bytes,1,opt,name=tuple,proto3" json:"tuple,omitempty"` + Pagination *ResponsePagination `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (x *ReadTuplesResponse) Reset() { @@ -229,11 +221,11 @@ func (x *ReadTuplesResponse) GetTuple() *Relationship { return nil } -func (x *ReadTuplesResponse) GetContinuationToken() string { +func (x *ReadTuplesResponse) GetPagination() *ResponsePagination { if x != nil { - return x.ContinuationToken + return x.Pagination } - return "" + return nil } type DeleteTuplesRequest struct { @@ -492,101 +484,101 @@ var file_relations_v0_relation_tuples_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x52, 0x06, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x22, 0x16, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xc5, 0x01, 0x0a, 0x11, 0x52, 0x65, 0x61, 0x64, 0x54, 0x75, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xb1, 0x01, 0x0a, 0x11, 0x52, 0x65, 0x61, 0x64, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, - 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x6c, - 0x69, 0x6d, 0x69, 0x74, 0x88, 0x01, 0x01, 0x12, 0x32, 0x0a, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x69, - 0x6e, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, - 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x7c, 0x0a, 0x12, - 0x52, 0x65, 0x61, 0x64, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x37, 0x0a, 0x05, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x21, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x68, 0x69, 0x70, 0x52, 0x05, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x12, 0x2d, 0x0a, 0x12, 0x63, - 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x57, 0x0a, 0x13, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x40, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x28, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x75, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x70, - 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe3, 0x02, 0x0a, 0x13, - 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x12, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x28, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, - 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x24, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x08, 0x72, 0x65, 0x6c, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x4e, 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x22, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x48, 0x04, 0x52, 0x0d, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x88, 0x01, 0x01, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, - 0x10, 0x0a, 0x0e, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, - 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, - 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x11, - 0x0a, 0x0f, 0x5f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x22, 0xf1, 0x01, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x11, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x26, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0b, 0x73, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x12, 0x22, 0x0a, - 0x0a, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x02, 0x52, 0x09, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x88, 0x01, - 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, - 0x01, 0x01, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x73, 0x75, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x65, 0x6c, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xfe, 0x02, 0x0a, 0x12, 0x4b, 0x65, 0x73, 0x73, 0x65, 0x6c, - 0x54, 0x75, 0x70, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7a, 0x0a, 0x0c, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x28, 0x2e, 0x6b, - 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x76, 0x30, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, - 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a, 0x22, 0x0a, 0x2f, 0x76, - 0x30, 0x2f, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x73, 0x0a, 0x0a, 0x52, 0x65, 0x61, 0x64, - 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x26, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, - 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, - 0x64, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, + 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x0a, + 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x50, 0x61, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x70, 0x61, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x96, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x61, + 0x64, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x37, 0x0a, 0x05, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x12, - 0x0a, 0x2f, 0x76, 0x30, 0x2f, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x30, 0x01, 0x12, 0x77, 0x0a, - 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x28, 0x2e, - 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, - 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, + 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, + 0x70, 0x52, 0x05, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6b, + 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x76, 0x30, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x50, 0x61, 0x67, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0x57, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, + 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, + 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x2a, 0x0a, 0x2f, 0x76, 0x30, 0x2f, - 0x74, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x42, 0x47, 0x0a, 0x23, 0x6f, 0x72, 0x67, 0x2e, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x50, 0x01, 0x5a, - 0x1e, 0x63, 0x69, 0x61, 0x6d, 0x2d, 0x72, 0x65, 0x62, 0x61, 0x63, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x30, 0x3b, 0x76, 0x30, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x65, 0x22, 0xe3, 0x02, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, + 0x75, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x12, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x11, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x28, + 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x88, 0x01, 0x01, 0x12, 0x24, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, + 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1f, + 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x03, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, + 0x4e, 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, + 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x53, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x48, 0x04, 0x52, 0x0d, 0x73, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x88, 0x01, 0x01, 0x42, + 0x15, 0x0a, 0x13, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x65, 0x6c, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0xf1, 0x01, 0x0a, 0x0d, 0x53, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x11, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x26, 0x0a, 0x0c, + 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x01, 0x52, 0x0b, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x22, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x09, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x08, 0x72, 0x65, + 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, + 0x0f, 0x0a, 0x0d, 0x5f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x42, + 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xfe, 0x02, 0x0a, + 0x12, 0x4b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x7a, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x70, + 0x6c, 0x65, 0x73, 0x12, 0x28, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, + 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x76, 0x30, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, + 0x3a, 0x01, 0x2a, 0x22, 0x0a, 0x2f, 0x76, 0x30, 0x2f, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x12, + 0x73, 0x0a, 0x0a, 0x52, 0x65, 0x61, 0x64, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x26, 0x2e, + 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, + 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x52, 0x65, 0x61, 0x64, + 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x12, 0x0a, 0x2f, 0x76, 0x30, 0x2f, 0x74, 0x75, 0x70, 0x6c, + 0x65, 0x73, 0x30, 0x01, 0x12, 0x77, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, + 0x70, 0x6c, 0x65, 0x73, 0x12, 0x28, 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, + 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, + 0x2e, 0x6b, 0x65, 0x73, 0x73, 0x65, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x76, 0x30, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x75, 0x70, 0x6c, 0x65, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x0c, 0x2a, 0x0a, 0x2f, 0x76, 0x30, 0x2f, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x73, 0x42, 0x47, 0x0a, + 0x23, 0x6f, 0x72, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6b, 0x65, 0x73, + 0x73, 0x65, 0x6c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x76, 0x30, 0x50, 0x01, 0x5a, 0x1e, 0x63, 0x69, 0x61, 0x6d, 0x2d, 0x72, 0x65, 0x62, + 0x61, 0x63, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x76, 0x30, 0x3b, 0x76, 0x30, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -612,24 +604,28 @@ var file_relations_v0_relation_tuples_proto_goTypes = []interface{}{ (*RelationTupleFilter)(nil), // 6: kessel.relations.v0.RelationTupleFilter (*SubjectFilter)(nil), // 7: kessel.relations.v0.SubjectFilter (*Relationship)(nil), // 8: kessel.relations.v0.Relationship + (*RequestPagination)(nil), // 9: kessel.relations.v0.RequestPagination + (*ResponsePagination)(nil), // 10: kessel.relations.v0.ResponsePagination } var file_relations_v0_relation_tuples_proto_depIdxs = []int32{ - 8, // 0: kessel.relations.v0.CreateTuplesRequest.tuples:type_name -> kessel.relations.v0.Relationship - 6, // 1: kessel.relations.v0.ReadTuplesRequest.filter:type_name -> kessel.relations.v0.RelationTupleFilter - 8, // 2: kessel.relations.v0.ReadTuplesResponse.tuple:type_name -> kessel.relations.v0.Relationship - 6, // 3: kessel.relations.v0.DeleteTuplesRequest.filter:type_name -> kessel.relations.v0.RelationTupleFilter - 7, // 4: kessel.relations.v0.RelationTupleFilter.subject_filter:type_name -> kessel.relations.v0.SubjectFilter - 0, // 5: kessel.relations.v0.KesselTupleService.CreateTuples:input_type -> kessel.relations.v0.CreateTuplesRequest - 2, // 6: kessel.relations.v0.KesselTupleService.ReadTuples:input_type -> kessel.relations.v0.ReadTuplesRequest - 4, // 7: kessel.relations.v0.KesselTupleService.DeleteTuples:input_type -> kessel.relations.v0.DeleteTuplesRequest - 1, // 8: kessel.relations.v0.KesselTupleService.CreateTuples:output_type -> kessel.relations.v0.CreateTuplesResponse - 3, // 9: kessel.relations.v0.KesselTupleService.ReadTuples:output_type -> kessel.relations.v0.ReadTuplesResponse - 5, // 10: kessel.relations.v0.KesselTupleService.DeleteTuples:output_type -> kessel.relations.v0.DeleteTuplesResponse - 8, // [8:11] is the sub-list for method output_type - 5, // [5:8] 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 + 8, // 0: kessel.relations.v0.CreateTuplesRequest.tuples:type_name -> kessel.relations.v0.Relationship + 6, // 1: kessel.relations.v0.ReadTuplesRequest.filter:type_name -> kessel.relations.v0.RelationTupleFilter + 9, // 2: kessel.relations.v0.ReadTuplesRequest.pagination:type_name -> kessel.relations.v0.RequestPagination + 8, // 3: kessel.relations.v0.ReadTuplesResponse.tuple:type_name -> kessel.relations.v0.Relationship + 10, // 4: kessel.relations.v0.ReadTuplesResponse.pagination:type_name -> kessel.relations.v0.ResponsePagination + 6, // 5: kessel.relations.v0.DeleteTuplesRequest.filter:type_name -> kessel.relations.v0.RelationTupleFilter + 7, // 6: kessel.relations.v0.RelationTupleFilter.subject_filter:type_name -> kessel.relations.v0.SubjectFilter + 0, // 7: kessel.relations.v0.KesselTupleService.CreateTuples:input_type -> kessel.relations.v0.CreateTuplesRequest + 2, // 8: kessel.relations.v0.KesselTupleService.ReadTuples:input_type -> kessel.relations.v0.ReadTuplesRequest + 4, // 9: kessel.relations.v0.KesselTupleService.DeleteTuples:input_type -> kessel.relations.v0.DeleteTuplesRequest + 1, // 10: kessel.relations.v0.KesselTupleService.CreateTuples:output_type -> kessel.relations.v0.CreateTuplesResponse + 3, // 11: kessel.relations.v0.KesselTupleService.ReadTuples:output_type -> kessel.relations.v0.ReadTuplesResponse + 5, // 12: kessel.relations.v0.KesselTupleService.DeleteTuples:output_type -> kessel.relations.v0.DeleteTuplesResponse + 10, // [10:13] is the sub-list for method output_type + 7, // [7:10] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_relations_v0_relation_tuples_proto_init() } diff --git a/api/relations/v0/relation_tuples.proto b/api/relations/v0/relation_tuples.proto index 5d7c440..1ffc439 100644 --- a/api/relations/v0/relation_tuples.proto +++ b/api/relations/v0/relation_tuples.proto @@ -47,12 +47,11 @@ message CreateTuplesResponse {} message ReadTuplesRequest { RelationTupleFilter filter = 1; - optional uint32 limit = 2; - optional string continuation_token = 3; + optional RequestPagination pagination = 2; } message ReadTuplesResponse { Relationship tuple = 1; - string continuation_token = 2; + ResponsePagination pagination = 2; } message DeleteTuplesRequest { diff --git a/internal/biz/lookup.go b/internal/biz/lookup.go index 0ef6f0d..0b85b05 100644 --- a/internal/biz/lookup.go +++ b/internal/biz/lookup.go @@ -23,20 +23,28 @@ func NewGetSubjectsUseCase(repo ZanzibarRepository, logger log.Logger) *GetSubje func (s *GetSubjectsUsecase) Get(ctx context.Context, req *v0.LookupSubjectsRequest) (chan *SubjectResult, chan error, error) { limit := uint32(MaxStreamingCount) - if req.Limit != nil && *req.Limit < limit { - limit = *req.Limit - } - continuation := ContinuationToken("") - if req.ContinuationToken != nil { - continuation = ContinuationToken(*req.ContinuationToken) + subjectRelation := "" + + if req.Pagination != nil { + if req.Pagination.Limit < limit { + limit = req.Pagination.Limit + } + + if req.Pagination.ContinuationToken != nil { + continuation = ContinuationToken(*req.Pagination.ContinuationToken) + } } if req.Resource == nil { return nil, nil, errors.BadRequest("Invalid request", "Object is required") } - subs, errs, err := s.repo.LookupSubjects(ctx, req.SubjectType, req.SubjectRelation, req.Relation, &v0.ObjectReference{ + if req.SubjectRelation != nil { + subjectRelation = *req.SubjectRelation + } + + subs, errs, err := s.repo.LookupSubjects(ctx, req.SubjectType, subjectRelation, req.Relation, &v0.ObjectReference{ Type: req.Resource.Type, //Need null check Id: req.Resource.Id, }, limit, continuation) diff --git a/internal/biz/relationships.go b/internal/biz/relationships.go index 0f7a442..ffae798 100644 --- a/internal/biz/relationships.go +++ b/internal/biz/relationships.go @@ -69,13 +69,16 @@ func (rc *ReadRelationshipsUsecase) ReadRelationships(ctx context.Context, req * rc.log.WithContext(ctx).Infof("ReadRelationships: %v", req) limit := uint32(MaxStreamingCount) - if req.Limit != nil && *req.Limit < limit { - limit = *req.Limit - } - continuation := ContinuationToken("") - if req.ContinuationToken != nil { - continuation = ContinuationToken(*req.ContinuationToken) + + if req.Pagination != nil { + if req.Pagination.Limit < limit { + limit = req.Pagination.Limit + } + + if req.Pagination.ContinuationToken != nil { + continuation = ContinuationToken(*req.Pagination.ContinuationToken) + } } relationships, errs, err := rc.repo.ReadRelationships(ctx, req.Filter, limit, continuation) diff --git a/internal/service/lookup.go b/internal/service/lookup.go index 627acc5..93c74df 100644 --- a/internal/service/lookup.go +++ b/internal/service/lookup.go @@ -28,8 +28,8 @@ func (s *LookupService) LookupSubjects(req *pb.LookupSubjectsRequest, conn pb.Ke for sub := range subs { err = conn.Send(&pb.LookupSubjectsResponse{ - Subject: sub.Subject, - ContinuationToken: string(sub.Continuation), + Subject: sub.Subject, + Pagination: &pb.ResponsePagination{ContinuationToken: string(sub.Continuation)}, }) if err != nil { return err diff --git a/internal/service/relationships.go b/internal/service/relationships.go index 393d18e..07df2ad 100644 --- a/internal/service/relationships.go +++ b/internal/service/relationships.go @@ -48,8 +48,8 @@ func (s *RelationshipsService) ReadRelationships(req *pb.ReadTuplesRequest, conn for rel := range relationships { err = conn.Send(&pb.ReadTuplesResponse{ - Tuple: rel.Relationship, - ContinuationToken: string(rel.Continuation), + Tuple: rel.Relationship, + Pagination: &pb.ResponsePagination{ContinuationToken: string(rel.Continuation)}, }) if err != nil { return err diff --git a/openapi.yaml b/openapi.yaml index 1c2def4..7e75ba4 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -49,6 +49,56 @@ paths: application/json: schema: $ref: '#/components/schemas/kessel.relations.v0.CheckResponse' + /v0/subjects: + get: + tags: + - KesselLookupService + operationId: KesselLookupService_LookupSubjects + parameters: + - name: subjectType.namespace + in: query + schema: + type: string + - name: subjectType.type + in: query + schema: + type: string + - name: subjectRelation + in: query + schema: + type: string + - name: relation + in: query + schema: + type: string + - name: resource.type.namespace + in: query + schema: + type: string + - name: resource.type.type + in: query + schema: + type: string + - name: resource.id + in: query + schema: + type: string + - name: pagination.limit + in: query + schema: + type: integer + format: uint32 + - name: pagination.continuationToken + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/kessel.relations.v0.LookupSubjectsResponse' /v0/tuples: get: tags: @@ -87,12 +137,12 @@ paths: in: query schema: type: string - - name: limit + - name: pagination.limit in: query schema: type: integer format: uint32 - - name: continuationToken + - name: pagination.continuationToken in: query schema: type: string @@ -164,56 +214,6 @@ paths: application/json: schema: $ref: '#/components/schemas/kessel.relations.v0.DeleteTuplesResponse' - /v1/subjects: - get: - tags: - - KesselLookupService - operationId: KesselLookupService_LookupSubjects - parameters: - - name: subjectType.namespace - in: query - schema: - type: string - - name: subjectType.type - in: query - schema: - type: string - - name: subjectRelation - in: query - schema: - type: string - - name: relation - in: query - schema: - type: string - - name: resource.type.namespace - in: query - schema: - type: string - - name: resource.type.type - in: query - schema: - type: string - - name: resource.id - in: query - schema: - type: string - - name: limit - in: query - schema: - type: integer - format: uint32 - - name: continuationToken - in: query - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/kessel.relations.v0.LookupSubjectsResponse' components: schemas: kessel.relations.v0.CheckRequest: @@ -252,8 +252,8 @@ components: properties: subject: $ref: '#/components/schemas/kessel.relations.v0.SubjectReference' - continuationToken: - type: string + pagination: + $ref: '#/components/schemas/kessel.relations.v0.ResponsePagination' kessel.relations.v0.ObjectReference: type: object properties: @@ -273,8 +273,8 @@ components: properties: tuple: $ref: '#/components/schemas/kessel.relations.v0.Relationship' - continuationToken: - type: string + pagination: + $ref: '#/components/schemas/kessel.relations.v0.ResponsePagination' kessel.relations.v0.Relationship: type: object properties: @@ -285,6 +285,11 @@ components: subject: $ref: '#/components/schemas/kessel.relations.v0.SubjectReference' description: "A _Relationship_ is the realization of a _Relation_ (a string) \n between a _Resource_ and a _Subject_ or a _Subject Set_ (known as a Userset in Zanzibar).\n\n All Relationships are object-object relations.\n \"Resource\" and \"Subject\" are relative terms which define the direction of a Relation.\n That is, Relations are unidirectional.\n If you reverse the Subject and Resource, it is a different Relation and a different Relationship.\n Conventionally, we generally refer to the Resource first, then Subject,\n following the direction of typical graph traversal (Resource to Subject)." + kessel.relations.v0.ResponsePagination: + type: object + properties: + continuationToken: + type: string kessel.relations.v0.SubjectReference: type: object properties: