[#85] apemanager: Generate protobufs for ape package

* Regenerate protobufs as APE specific type are defined
  as separate package;
* Move `ape` package related utils methods from `apemanager`.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-05-28 11:04:07 +03:00
parent 0803bc6ded
commit 9789b79b1d
16 changed files with 661 additions and 624 deletions

132
ape/convert.go Normal file
View file

@ -0,0 +1,132 @@
package ape
import (
"fmt"
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
)
func TargetTypeToGRPCField(typ TargetType) ape.TargetType {
switch typ {
case TargetTypeNamespace:
return ape.TargetType_NAMESPACE
case TargetTypeContainer:
return ape.TargetType_CONTAINER
case TargetTypeUser:
return ape.TargetType_USER
case TargetTypeGroup:
return ape.TargetType_GROUP
default:
return ape.TargetType_UNDEFINED
}
}
func TargetTypeFromGRPCField(typ ape.TargetType) TargetType {
switch typ {
case ape.TargetType_NAMESPACE:
return TargetTypeNamespace
case ape.TargetType_CONTAINER:
return TargetTypeContainer
case ape.TargetType_USER:
return TargetTypeUser
case ape.TargetType_GROUP:
return TargetTypeGroup
default:
return TargetTypeUndefined
}
}
func TargetTypeToGRPC(typ TargetType) ape.TargetType {
return ape.TargetType(typ)
}
func TargetTypeFromGRPC(typ ape.TargetType) TargetType {
return TargetType(typ)
}
func (v2 *ChainTarget) ToGRPCMessage() grpc.Message {
var mgrpc *ape.ChainTarget
if v2 != nil {
mgrpc = new(ape.ChainTarget)
mgrpc.SetType(TargetTypeToGRPC(v2.GetTargetType()))
mgrpc.SetName(v2.GetName())
}
return mgrpc
}
func (v2 *ChainTarget) FromGRPCMessage(m grpc.Message) error {
mgrpc, ok := m.(*ape.ChainTarget)
if !ok {
return message.NewUnexpectedMessageType(m, mgrpc)
}
v2.SetTargetType(TargetTypeFromGRPC(mgrpc.GetType()))
v2.SetName(mgrpc.GetName())
return nil
}
func (v2 *ChainRaw) ToGRPCMessage() grpc.Message {
var mgrpc *ape.Chain_Raw
if v2 != nil {
mgrpc = new(ape.Chain_Raw)
mgrpc.SetRaw(v2.GetRaw())
}
return mgrpc
}
func (v2 *ChainRaw) FromGRPCMessage(m grpc.Message) error {
mgrpc, ok := m.(*ape.Chain_Raw)
if !ok {
return message.NewUnexpectedMessageType(m, mgrpc)
}
v2.SetRaw(mgrpc.GetRaw())
return nil
}
func (v2 *Chain) ToGRPCMessage() grpc.Message {
var mgrpc *ape.Chain
if v2 != nil {
mgrpc = new(ape.Chain)
switch chainKind := v2.GetKind().(type) {
default:
panic(fmt.Sprintf("unsupported chain kind: %T", chainKind))
case *ChainRaw:
mgrpc.SetKind(chainKind.ToGRPCMessage().(*ape.Chain_Raw))
}
}
return mgrpc
}
func (v2 *Chain) FromGRPCMessage(m grpc.Message) error {
mgrpc, ok := m.(*ape.Chain)
if !ok {
return message.NewUnexpectedMessageType(m, mgrpc)
}
switch chainKind := mgrpc.GetKind().(type) {
default:
return fmt.Errorf("unsupported chain kind: %T", chainKind)
case *ape.Chain_Raw:
chainRaw := new(ChainRaw)
if err := chainRaw.FromGRPCMessage(chainKind); err != nil {
return err
}
v2.SetKind(chainRaw)
}
return nil
}

View file

@ -1,4 +1,4 @@
package apemanager
package ape
func (t *ChainTarget) SetType(typ TargetType) {
t.Type = typ

View file

@ -2,9 +2,9 @@
// versions:
// protoc-gen-go v1.33.0
// protoc v4.25.3
// source: apemanager/grpc/types.proto
// source: ape/grpc/types.proto
package apemanager
package ape
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
@ -60,11 +60,11 @@ func (x TargetType) String() string {
}
func (TargetType) Descriptor() protoreflect.EnumDescriptor {
return file_apemanager_grpc_types_proto_enumTypes[0].Descriptor()
return file_ape_grpc_types_proto_enumTypes[0].Descriptor()
}
func (TargetType) Type() protoreflect.EnumType {
return &file_apemanager_grpc_types_proto_enumTypes[0]
return &file_ape_grpc_types_proto_enumTypes[0]
}
func (x TargetType) Number() protoreflect.EnumNumber {
@ -73,7 +73,7 @@ func (x TargetType) Number() protoreflect.EnumNumber {
// Deprecated: Use TargetType.Descriptor instead.
func (TargetType) EnumDescriptor() ([]byte, []int) {
return file_apemanager_grpc_types_proto_rawDescGZIP(), []int{0}
return file_ape_grpc_types_proto_rawDescGZIP(), []int{0}
}
// ChainTarget is an object to which a rule chain is defined.
@ -82,14 +82,14 @@ type ChainTarget struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Type TargetType `protobuf:"varint,1,opt,name=type,proto3,enum=frostfs.v2.apemanager.TargetType" json:"type,omitempty"`
Type TargetType `protobuf:"varint,1,opt,name=type,proto3,enum=frostfs.v2.ape.TargetType" json:"type,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
}
func (x *ChainTarget) Reset() {
*x = ChainTarget{}
if protoimpl.UnsafeEnabled {
mi := &file_apemanager_grpc_types_proto_msgTypes[0]
mi := &file_ape_grpc_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -102,7 +102,7 @@ func (x *ChainTarget) String() string {
func (*ChainTarget) ProtoMessage() {}
func (x *ChainTarget) ProtoReflect() protoreflect.Message {
mi := &file_apemanager_grpc_types_proto_msgTypes[0]
mi := &file_ape_grpc_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -115,7 +115,7 @@ func (x *ChainTarget) ProtoReflect() protoreflect.Message {
// Deprecated: Use ChainTarget.ProtoReflect.Descriptor instead.
func (*ChainTarget) Descriptor() ([]byte, []int) {
return file_apemanager_grpc_types_proto_rawDescGZIP(), []int{0}
return file_ape_grpc_types_proto_rawDescGZIP(), []int{0}
}
func (x *ChainTarget) GetType() TargetType {
@ -147,7 +147,7 @@ type Chain struct {
func (x *Chain) Reset() {
*x = Chain{}
if protoimpl.UnsafeEnabled {
mi := &file_apemanager_grpc_types_proto_msgTypes[1]
mi := &file_ape_grpc_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -160,7 +160,7 @@ func (x *Chain) String() string {
func (*Chain) ProtoMessage() {}
func (x *Chain) ProtoReflect() protoreflect.Message {
mi := &file_apemanager_grpc_types_proto_msgTypes[1]
mi := &file_ape_grpc_types_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -173,7 +173,7 @@ func (x *Chain) ProtoReflect() protoreflect.Message {
// Deprecated: Use Chain.ProtoReflect.Descriptor instead.
func (*Chain) Descriptor() ([]byte, []int) {
return file_apemanager_grpc_types_proto_rawDescGZIP(), []int{1}
return file_ape_grpc_types_proto_rawDescGZIP(), []int{1}
}
func (m *Chain) GetKind() isChain_Kind {
@ -201,54 +201,52 @@ type Chain_Raw struct {
func (*Chain_Raw) isChain_Kind() {}
var File_apemanager_grpc_types_proto protoreflect.FileDescriptor
var File_ape_grpc_types_proto protoreflect.FileDescriptor
var file_apemanager_grpc_types_proto_rawDesc = []byte{
0x0a, 0x1b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70,
0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x66,
0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e,
0x61, 0x67, 0x65, 0x72, 0x22, 0x58, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72,
0x67, 0x65, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0e, 0x32, 0x21, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61,
0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74,
0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x23,
0x0a, 0x05, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x03, 0x72, 0x61, 0x77, 0x42, 0x06, 0x0a, 0x04, 0x6b,
0x69, 0x6e, 0x64, 0x2a, 0x4e, 0x0a, 0x0a, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70,
0x65, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00,
0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x41, 0x4d, 0x45, 0x53, 0x50, 0x41, 0x43, 0x45, 0x10, 0x01, 0x12,
0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x02, 0x12, 0x08,
0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x4f, 0x55,
0x50, 0x10, 0x04, 0x42, 0x4c, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74,
0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75,
0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69,
0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65,
0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65,
0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
var file_ape_grpc_types_proto_rawDesc = []byte{
0x0a, 0x14, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e,
0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x22, 0x51, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54,
0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x61, 0x70, 0x65, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52,
0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x23, 0x0a, 0x05, 0x43, 0x68, 0x61,
0x69, 0x6e, 0x12, 0x12, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x48,
0x00, 0x52, 0x03, 0x72, 0x61, 0x77, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x2a, 0x4e,
0x0a, 0x0a, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09,
0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4e,
0x41, 0x4d, 0x45, 0x53, 0x50, 0x41, 0x43, 0x45, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f,
0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45,
0x52, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x04, 0x42, 0x3e,
0x5a, 0x3c, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e,
0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f,
0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76,
0x32, 0x2f, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x70, 0x65, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_apemanager_grpc_types_proto_rawDescOnce sync.Once
file_apemanager_grpc_types_proto_rawDescData = file_apemanager_grpc_types_proto_rawDesc
file_ape_grpc_types_proto_rawDescOnce sync.Once
file_ape_grpc_types_proto_rawDescData = file_ape_grpc_types_proto_rawDesc
)
func file_apemanager_grpc_types_proto_rawDescGZIP() []byte {
file_apemanager_grpc_types_proto_rawDescOnce.Do(func() {
file_apemanager_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_apemanager_grpc_types_proto_rawDescData)
func file_ape_grpc_types_proto_rawDescGZIP() []byte {
file_ape_grpc_types_proto_rawDescOnce.Do(func() {
file_ape_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_ape_grpc_types_proto_rawDescData)
})
return file_apemanager_grpc_types_proto_rawDescData
return file_ape_grpc_types_proto_rawDescData
}
var file_apemanager_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_apemanager_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_apemanager_grpc_types_proto_goTypes = []interface{}{
(TargetType)(0), // 0: frostfs.v2.apemanager.TargetType
(*ChainTarget)(nil), // 1: frostfs.v2.apemanager.ChainTarget
(*Chain)(nil), // 2: frostfs.v2.apemanager.Chain
var file_ape_grpc_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_ape_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_ape_grpc_types_proto_goTypes = []interface{}{
(TargetType)(0), // 0: frostfs.v2.ape.TargetType
(*ChainTarget)(nil), // 1: frostfs.v2.ape.ChainTarget
(*Chain)(nil), // 2: frostfs.v2.ape.Chain
}
var file_apemanager_grpc_types_proto_depIdxs = []int32{
0, // 0: frostfs.v2.apemanager.ChainTarget.type:type_name -> frostfs.v2.apemanager.TargetType
var file_ape_grpc_types_proto_depIdxs = []int32{
0, // 0: frostfs.v2.ape.ChainTarget.type:type_name -> frostfs.v2.ape.TargetType
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
@ -256,13 +254,13 @@ var file_apemanager_grpc_types_proto_depIdxs = []int32{
0, // [0:1] is the sub-list for field type_name
}
func init() { file_apemanager_grpc_types_proto_init() }
func file_apemanager_grpc_types_proto_init() {
if File_apemanager_grpc_types_proto != nil {
func init() { file_ape_grpc_types_proto_init() }
func file_ape_grpc_types_proto_init() {
if File_ape_grpc_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_apemanager_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_ape_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ChainTarget); i {
case 0:
return &v.state
@ -274,7 +272,7 @@ func file_apemanager_grpc_types_proto_init() {
return nil
}
}
file_apemanager_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_ape_grpc_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Chain); i {
case 0:
return &v.state
@ -287,26 +285,26 @@ func file_apemanager_grpc_types_proto_init() {
}
}
}
file_apemanager_grpc_types_proto_msgTypes[1].OneofWrappers = []interface{}{
file_ape_grpc_types_proto_msgTypes[1].OneofWrappers = []interface{}{
(*Chain_Raw)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_apemanager_grpc_types_proto_rawDesc,
RawDescriptor: file_ape_grpc_types_proto_rawDesc,
NumEnums: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_apemanager_grpc_types_proto_goTypes,
DependencyIndexes: file_apemanager_grpc_types_proto_depIdxs,
EnumInfos: file_apemanager_grpc_types_proto_enumTypes,
MessageInfos: file_apemanager_grpc_types_proto_msgTypes,
GoTypes: file_ape_grpc_types_proto_goTypes,
DependencyIndexes: file_ape_grpc_types_proto_depIdxs,
EnumInfos: file_ape_grpc_types_proto_enumTypes,
MessageInfos: file_ape_grpc_types_proto_msgTypes,
}.Build()
File_apemanager_grpc_types_proto = out.File
file_apemanager_grpc_types_proto_rawDesc = nil
file_apemanager_grpc_types_proto_goTypes = nil
file_apemanager_grpc_types_proto_depIdxs = nil
File_ape_grpc_types_proto = out.File
file_ape_grpc_types_proto_rawDesc = nil
file_ape_grpc_types_proto_goTypes = nil
file_ape_grpc_types_proto_depIdxs = nil
}

View file

@ -1,7 +1,7 @@
package apemanager
package ape
import (
apemanager_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc"
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
)
@ -10,5 +10,5 @@ func (t *ChainTarget) MarshalJSON() ([]byte, error) {
}
func (t *ChainTarget) UnmarshalJSON(data []byte) error {
return message.UnmarshalJSON(t, data, new(apemanager_grpc.ChainTarget))
return message.UnmarshalJSON(t, data, new(ape.ChainTarget))
}

92
ape/marshal.go Normal file
View file

@ -0,0 +1,92 @@
package ape
import (
"fmt"
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
)
const (
chainTargetTargetTypeField = 1
chainTargetNameField = 2
chainRawField = 1
)
func (t *ChainTarget) StableSize() (size int) {
if t == nil {
return 0
}
size += proto.EnumSize(chainTargetTargetTypeField, int32(t.targeType))
size += proto.StringSize(chainTargetNameField, t.name)
return size
}
func (t *ChainTarget) StableMarshal(buf []byte) []byte {
if t == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, t.StableSize())
}
var offset int
offset += proto.EnumMarshal(chainTargetTargetTypeField, buf[offset:], int32(t.targeType))
proto.StringMarshal(chainTargetNameField, buf[offset:], t.name)
return buf
}
func (t *ChainTarget) Unmarshal(data []byte) error {
return message.Unmarshal(t, data, new(ape.ChainTarget))
}
func (c *Chain) StableSize() (size int) {
if c == nil {
return 0
}
switch v := c.GetKind().(type) {
case *ChainRaw:
if v != nil {
size += proto.BytesSize(chainRawField, v.GetRaw())
}
default:
panic(fmt.Sprintf("unsupported chain kind: %T", v))
}
return size
}
func (c *Chain) StableMarshal(buf []byte) []byte {
if c == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, c.StableSize())
}
var offset int
switch v := c.GetKind().(type) {
case *ChainRaw:
if v != nil {
proto.BytesMarshal(chainRawField, buf[offset:], v.GetRaw())
}
default:
panic(fmt.Sprintf("unsupported chain kind: %T", v))
}
return buf
}
func (c *Chain) Unmarshal(data []byte) error {
return message.Unmarshal(c, data, new(ape.Chain))
}

15
ape/message_test.go Normal file
View file

@ -0,0 +1,15 @@
package ape_test
import (
"testing"
apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
messagetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message/test"
)
func TestMessageConvert(t *testing.T) {
messagetest.TestRPCMessage(t,
func(empty bool) message.Message { return apetest.GenerateChainTarget(empty) },
)
}

View file

@ -1,7 +1,7 @@
package apemanager
package ape
import (
apemanager_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc"
apegrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
)
func (tt TargetType) String() string {
@ -9,7 +9,7 @@ func (tt TargetType) String() string {
}
func (tt *TargetType) FromString(s string) bool {
i, ok := apemanager_grpc.TargetType_value[s]
i, ok := apegrpc.TargetType_value[s]
if ok {
*tt = TargetType(i)
}

71
ape/test/generate.go Normal file
View file

@ -0,0 +1,71 @@
package test
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
)
func GenerateRawChains(empty bool, n int) []*ape.Chain {
if empty {
return []*ape.Chain{}
}
res := make([]*ape.Chain, n)
for i := range res {
res[i] = GenerateRawChain(empty)
}
return res
}
func GenerateRawChain(empty bool) *ape.Chain {
chRaw := new(ape.ChainRaw)
if empty {
chRaw.SetRaw([]byte("{}"))
} else {
chRaw.SetRaw([]byte(`{
"ID": "",
"Rules": [
{
"Status": "Allow",
"Actions": {
"Inverted": false,
"Names": [
"GetObject"
]
},
"Resources": {
"Inverted": false,
"Names": [
"native:object/*"
]
},
"Any": false,
"Condition": [
{
"Op": "StringEquals",
"Object": "Resource",
"Key": "Department",
"Value": "HR"
}
]
}
],
"MatchType": "DenyPriority"
}`))
}
ch := new(ape.Chain)
ch.SetKind(chRaw)
return ch
}
func GenerateChainTarget(empty bool) *ape.ChainTarget {
m := new(ape.ChainTarget)
if !empty {
m.SetTargetType(ape.TargetTypeContainer)
m.SetName("BzQw5HH3feoxFDD5tCT87Y1726qzgLfxEE7wgtoRzB3R")
}
return m
}

71
ape/types.go Normal file
View file

@ -0,0 +1,71 @@
package ape
type TargetType uint32
const (
TargetTypeUndefined TargetType = iota
TargetTypeNamespace
TargetTypeContainer
TargetTypeUser
TargetTypeGroup
)
type ChainTarget struct {
targeType TargetType
name string
}
func (ct *ChainTarget) SetTargetType(targeType TargetType) {
ct.targeType = targeType
}
func (ct *ChainTarget) SetName(name string) {
ct.name = name
}
func (ct *ChainTarget) GetTargetType() TargetType {
if ct != nil {
return ct.targeType
}
return 0
}
func (ct *ChainTarget) GetName() string {
if ct != nil {
return ct.name
}
return ""
}
type chainKind interface {
isChainKind()
}
type Chain struct {
kind chainKind
}
func (c *Chain) SetKind(kind chainKind) {
c.kind = kind
}
func (c *Chain) GetKind() chainKind {
return c.kind
}
type ChainRaw struct {
Raw []byte
}
func (*ChainRaw) isChainKind() {}
func (c *ChainRaw) SetRaw(raw []byte) {
c.Raw = raw
}
func (c *ChainRaw) GetRaw() []byte {
return c.Raw
}

View file

@ -1,144 +1,21 @@
package apemanager
import (
"fmt"
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
apeGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
apemanager "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
)
func TargetTypeToGRPCField(typ TargetType) apemanager.TargetType {
switch typ {
case TargetTypeNamespace:
return apemanager.TargetType_NAMESPACE
case TargetTypeContainer:
return apemanager.TargetType_CONTAINER
case TargetTypeUser:
return apemanager.TargetType_USER
case TargetTypeGroup:
return apemanager.TargetType_GROUP
default:
return apemanager.TargetType_UNDEFINED
}
}
func TargetTypeFromGRPCField(typ apemanager.TargetType) TargetType {
switch typ {
case apemanager.TargetType_NAMESPACE:
return TargetTypeNamespace
case apemanager.TargetType_CONTAINER:
return TargetTypeContainer
case apemanager.TargetType_USER:
return TargetTypeUser
case apemanager.TargetType_GROUP:
return TargetTypeGroup
default:
return TargetTypeUndefined
}
}
func TargetTypeToGRPC(typ TargetType) apemanager.TargetType {
return apemanager.TargetType(typ)
}
func TargetTypeFromGRPC(typ apemanager.TargetType) TargetType {
return TargetType(typ)
}
func (v2 *ChainTarget) ToGRPCMessage() grpc.Message {
var mgrpc *apemanager.ChainTarget
if v2 != nil {
mgrpc = new(apemanager.ChainTarget)
mgrpc.SetType(TargetTypeToGRPC(v2.GetTargetType()))
mgrpc.SetName(v2.GetName())
}
return mgrpc
}
func (v2 *ChainTarget) FromGRPCMessage(m grpc.Message) error {
mgrpc, ok := m.(*apemanager.ChainTarget)
if !ok {
return message.NewUnexpectedMessageType(m, mgrpc)
}
v2.SetTargetType(TargetTypeFromGRPC(mgrpc.GetType()))
v2.SetName(mgrpc.GetName())
return nil
}
func (v2 *ChainRaw) ToGRPCMessage() grpc.Message {
var mgrpc *apemanager.Chain_Raw
if v2 != nil {
mgrpc = new(apemanager.Chain_Raw)
mgrpc.SetRaw(v2.GetRaw())
}
return mgrpc
}
func (v2 *ChainRaw) FromGRPCMessage(m grpc.Message) error {
mgrpc, ok := m.(*apemanager.Chain_Raw)
if !ok {
return message.NewUnexpectedMessageType(m, mgrpc)
}
v2.SetRaw(mgrpc.GetRaw())
return nil
}
func (v2 *Chain) ToGRPCMessage() grpc.Message {
var mgrpc *apemanager.Chain
if v2 != nil {
mgrpc = new(apemanager.Chain)
switch chainKind := v2.GetKind().(type) {
default:
panic(fmt.Sprintf("unsupported chain kind: %T", chainKind))
case *ChainRaw:
mgrpc.SetKind(chainKind.ToGRPCMessage().(*apemanager.Chain_Raw))
}
}
return mgrpc
}
func (v2 *Chain) FromGRPCMessage(m grpc.Message) error {
mgrpc, ok := m.(*apemanager.Chain)
if !ok {
return message.NewUnexpectedMessageType(m, mgrpc)
}
switch chainKind := mgrpc.GetKind().(type) {
default:
return fmt.Errorf("unsupported chain kind: %T", chainKind)
case *apemanager.Chain_Raw:
chainRaw := new(ChainRaw)
if err := chainRaw.FromGRPCMessage(chainKind); err != nil {
return err
}
v2.SetKind(chainRaw)
}
return nil
}
func (reqBody *AddChainRequestBody) ToGRPCMessage() grpc.Message {
var reqBodygrpc *apemanager.AddChainRequest_Body
if reqBody != nil {
reqBodygrpc = new(apemanager.AddChainRequest_Body)
reqBodygrpc.SetTarget(reqBody.GetTarget().ToGRPCMessage().(*apemanager.ChainTarget))
reqBodygrpc.SetChain(reqBody.GetChain().ToGRPCMessage().(*apemanager.Chain))
reqBodygrpc.SetTarget(reqBody.GetTarget().ToGRPCMessage().(*apeGRPC.ChainTarget))
reqBodygrpc.SetChain(reqBody.GetChain().ToGRPCMessage().(*apeGRPC.Chain))
}
return reqBodygrpc
@ -151,14 +28,14 @@ func (reqBody *AddChainRequestBody) FromGRPCMessage(m grpc.Message) error {
}
if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil {
reqBody.target = new(ChainTarget)
reqBody.target = new(ape.ChainTarget)
if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil {
return err
}
}
if chaingrpc := reqBodygrpc.GetChain(); chaingrpc != nil {
reqBody.chain = new(Chain)
reqBody.chain = new(ape.Chain)
if err := reqBody.GetChain().FromGRPCMessage(chaingrpc); err != nil {
return err
}
@ -254,7 +131,7 @@ func (reqBody *RemoveChainRequestBody) ToGRPCMessage() grpc.Message {
if reqBody != nil {
reqBodygrpc = new(apemanager.RemoveChainRequest_Body)
reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apemanager.ChainTarget))
reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
reqBodygrpc.SetChainId(reqBody.GetChainID())
}
@ -268,7 +145,7 @@ func (reqBody *RemoveChainRequestBody) FromGRPCMessage(m grpc.Message) error {
}
if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil {
reqBody.target = new(ChainTarget)
reqBody.target = new(ape.ChainTarget)
if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil {
return err
}
@ -362,7 +239,7 @@ func (reqBody *ListChainsRequestBody) ToGRPCMessage() grpc.Message {
if reqBody != nil {
reqBodygrpc = new(apemanager.ListChainsRequest_Body)
reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apemanager.ChainTarget))
reqBodygrpc.SetTarget(reqBody.target.ToGRPCMessage().(*apeGRPC.ChainTarget))
}
return reqBodygrpc
@ -375,7 +252,7 @@ func (reqBody *ListChainsRequestBody) FromGRPCMessage(m grpc.Message) error {
}
if targetgrpc := reqBodygrpc.GetTarget(); targetgrpc != nil {
reqBody.target = new(ChainTarget)
reqBody.target = new(ape.ChainTarget)
if err := reqBody.target.FromGRPCMessage(targetgrpc); err != nil {
return err
}
@ -419,9 +296,9 @@ func (respBody *ListChainsResponseBody) ToGRPCMessage() grpc.Message {
if respBody != nil {
respBodygrpc = new(apemanager.ListChainsResponse_Body)
chainsgrpc := make([]*apemanager.Chain, 0, len(respBody.GetChains()))
chainsgrpc := make([]*apeGRPC.Chain, 0, len(respBody.GetChains()))
for _, chain := range respBody.GetChains() {
chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apemanager.Chain))
chainsgrpc = append(chainsgrpc, chain.ToGRPCMessage().(*apeGRPC.Chain))
}
respBodygrpc.SetChains(chainsgrpc)
@ -436,10 +313,10 @@ func (respBody *ListChainsResponseBody) FromGRPCMessage(m grpc.Message) error {
return message.NewUnexpectedMessageType(m, respBodygrpc)
}
chains := make([]*Chain, 0, len(respBodygrpc.GetChains()))
chains := make([]*ape.Chain, 0, len(respBodygrpc.GetChains()))
for _, chaingrpc := range respBodygrpc.GetChains() {
chain := new(Chain)
chain := new(ape.Chain)
if err := chain.FromGRPCMessage(chaingrpc); err != nil {
return err
}

View file

@ -1,14 +1,15 @@
package apemanager
import (
session_grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
ape "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
)
func (rb *AddChainRequest_Body) SetTarget(t *ChainTarget) {
func (rb *AddChainRequest_Body) SetTarget(t *ape.ChainTarget) {
rb.Target = t
}
func (rb *AddChainRequest_Body) SetChain(chain *Chain) {
func (rb *AddChainRequest_Body) SetChain(chain *ape.Chain) {
rb.Chain = chain
}
@ -16,11 +17,11 @@ func (r *AddChainRequest) SetBody(rb *AddChainRequest_Body) {
r.Body = rb
}
func (r *AddChainRequest) SetMetaHeader(mh *session_grpc.RequestMetaHeader) {
func (r *AddChainRequest) SetMetaHeader(mh *session.RequestMetaHeader) {
r.MetaHeader = mh
}
func (r *AddChainRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHeader) {
func (r *AddChainRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) {
r.VerifyHeader = vh
}
@ -32,15 +33,15 @@ func (r *AddChainResponse) SetBody(rb *AddChainResponse_Body) {
r.Body = rb
}
func (r *AddChainResponse) SetMetaHeader(mh *session_grpc.ResponseMetaHeader) {
func (r *AddChainResponse) SetMetaHeader(mh *session.ResponseMetaHeader) {
r.MetaHeader = mh
}
func (r *AddChainResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) {
func (r *AddChainResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) {
r.VerifyHeader = vh
}
func (rb *RemoveChainRequest_Body) SetTarget(t *ChainTarget) {
func (rb *RemoveChainRequest_Body) SetTarget(t *ape.ChainTarget) {
rb.Target = t
}
@ -52,11 +53,11 @@ func (r *RemoveChainRequest) SetBody(rb *RemoveChainRequest_Body) {
r.Body = rb
}
func (r *RemoveChainRequest) SetMetaHeader(mh *session_grpc.RequestMetaHeader) {
func (r *RemoveChainRequest) SetMetaHeader(mh *session.RequestMetaHeader) {
r.MetaHeader = mh
}
func (r *RemoveChainRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHeader) {
func (r *RemoveChainRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) {
r.VerifyHeader = vh
}
@ -64,15 +65,15 @@ func (r *RemoveChainResponse) SetBody(rb *RemoveChainResponse_Body) {
r.Body = rb
}
func (r *RemoveChainResponse) SetMetaHeader(mh *session_grpc.ResponseMetaHeader) {
func (r *RemoveChainResponse) SetMetaHeader(mh *session.ResponseMetaHeader) {
r.MetaHeader = mh
}
func (r *RemoveChainResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) {
func (r *RemoveChainResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) {
r.VerifyHeader = vh
}
func (r *ListChainsRequest_Body) SetTarget(t *ChainTarget) {
func (r *ListChainsRequest_Body) SetTarget(t *ape.ChainTarget) {
r.Target = t
}
@ -80,15 +81,15 @@ func (r *ListChainsRequest) SetBody(rb *ListChainsRequest_Body) {
r.Body = rb
}
func (r *ListChainsRequest) SetMetaHeader(mh *session_grpc.RequestMetaHeader) {
func (r *ListChainsRequest) SetMetaHeader(mh *session.RequestMetaHeader) {
r.MetaHeader = mh
}
func (r *ListChainsRequest) SetVerifyHeader(vh *session_grpc.RequestVerificationHeader) {
func (r *ListChainsRequest) SetVerifyHeader(vh *session.RequestVerificationHeader) {
r.VerifyHeader = vh
}
func (rb *ListChainsResponse_Body) SetChains(chains []*Chain) {
func (rb *ListChainsResponse_Body) SetChains(chains []*ape.Chain) {
rb.Chains = chains
}
@ -96,10 +97,10 @@ func (r *ListChainsResponse) SetBody(rb *ListChainsResponse_Body) {
r.Body = rb
}
func (r *ListChainsResponse) SetMetaHeader(mh *session_grpc.ResponseMetaHeader) {
func (r *ListChainsResponse) SetMetaHeader(mh *session.ResponseMetaHeader) {
r.MetaHeader = mh
}
func (r *ListChainsResponse) SetVerifyHeader(vh *session_grpc.ResponseVerificationHeader) {
func (r *ListChainsResponse) SetVerifyHeader(vh *session.ResponseVerificationHeader) {
r.VerifyHeader = vh
}

View file

@ -7,6 +7,7 @@
package apemanager
import (
grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/grpc"
grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
@ -441,9 +442,9 @@ type AddChainRequest_Body struct {
unknownFields protoimpl.UnknownFields
// A target for which a rule chain is added.
Target *ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
// The chain to set for the target.
Chain *Chain `protobuf:"bytes,2,opt,name=chain,proto3" json:"chain,omitempty"`
Chain *grpc1.Chain `protobuf:"bytes,2,opt,name=chain,proto3" json:"chain,omitempty"`
}
func (x *AddChainRequest_Body) Reset() {
@ -478,14 +479,14 @@ func (*AddChainRequest_Body) Descriptor() ([]byte, []int) {
return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{0, 0}
}
func (x *AddChainRequest_Body) GetTarget() *ChainTarget {
func (x *AddChainRequest_Body) GetTarget() *grpc1.ChainTarget {
if x != nil {
return x.Target
}
return nil
}
func (x *AddChainRequest_Body) GetChain() *Chain {
func (x *AddChainRequest_Body) GetChain() *grpc1.Chain {
if x != nil {
return x.Chain
}
@ -548,7 +549,7 @@ type RemoveChainRequest_Body struct {
unknownFields protoimpl.UnknownFields
// Target for which a rule chain is removed.
Target *ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
// Chain ID assigned for the rule chain.
ChainId []byte `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
}
@ -585,7 +586,7 @@ func (*RemoveChainRequest_Body) Descriptor() ([]byte, []int) {
return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{2, 0}
}
func (x *RemoveChainRequest_Body) GetTarget() *ChainTarget {
func (x *RemoveChainRequest_Body) GetTarget() *grpc1.ChainTarget {
if x != nil {
return x.Target
}
@ -645,7 +646,7 @@ type ListChainsRequest_Body struct {
unknownFields protoimpl.UnknownFields
// Target for which rule chains are listed.
Target *ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
Target *grpc1.ChainTarget `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
}
func (x *ListChainsRequest_Body) Reset() {
@ -680,7 +681,7 @@ func (*ListChainsRequest_Body) Descriptor() ([]byte, []int) {
return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{4, 0}
}
func (x *ListChainsRequest_Body) GetTarget() *ChainTarget {
func (x *ListChainsRequest_Body) GetTarget() *grpc1.ChainTarget {
if x != nil {
return x.Target
}
@ -693,7 +694,7 @@ type ListChainsResponse_Body struct {
unknownFields protoimpl.UnknownFields
// The list of chains defined for the reqeusted target.
Chains []*Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"`
Chains []*grpc1.Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"`
}
func (x *ListChainsResponse_Body) Reset() {
@ -728,7 +729,7 @@ func (*ListChainsResponse_Body) Descriptor() ([]byte, []int) {
return file_apemanager_grpc_service_proto_rawDescGZIP(), []int{5, 0}
}
func (x *ListChainsResponse_Body) GetChains() []*Chain {
func (x *ListChainsResponse_Body) GetChains() []*grpc1.Chain {
if x != nil {
return x.Chains
}
@ -741,151 +742,149 @@ var file_apemanager_grpc_service_proto_rawDesc = []byte{
0x0a, 0x1d, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70,
0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x15, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d,
0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x1a, 0x1b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67,
0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70,
0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe4, 0x02,
0x0a, 0x0f, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x2b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65,
0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f,
0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65,
0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73,
0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d,
0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72,
0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69,
0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c,
0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x76, 0x0a, 0x04,
0x42, 0x6f, 0x64, 0x79, 0x12, 0x3a, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76,
0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61,
0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
0x12, 0x32, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x1c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65,
0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x05, 0x63,
0x68, 0x61, 0x69, 0x6e, 0x22, 0x93, 0x02, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69,
0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66,
0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e,
0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d,
0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x1a, 0x14, 0x61, 0x70, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63,
0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x73, 0x65,
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd6, 0x02, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x43, 0x68,
0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, 0x04, 0x62, 0x6f,
0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72,
0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d,
0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74,
0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61,
0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65,
0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66,
0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x21, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12,
0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xd1, 0x02, 0x0a, 0x12, 0x52,
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x42, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x2e, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65,
0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68,
0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52,
0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65,
0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72,
0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d,
0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56,
0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65,
0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a,
0x5d, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3a, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65,
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66,
0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e,
0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72,
0x67, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xfe,
0x01, 0x0a, 0x13, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76,
0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d,
0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d,
0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74,
0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61,
0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65,
0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66,
0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22,
0xb4, 0x02, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74,
0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f,
0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61,
0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e,
0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61,
0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12,
0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e,
0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65,
0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61,
0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64,
0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61,
0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f, 0x2e,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48,
0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x68, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33, 0x0a,
0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e,
0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e, 0x43,
0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67,
0x65, 0x74, 0x12, 0x2b, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x15, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61,
0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22,
0x93, 0x02, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68,
0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79,
0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68,
0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65,
0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64,
0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52,
0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18,
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76,
0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65,
0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64,
0x65, 0x72, 0x1a, 0x42, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x3a, 0x0a, 0x06, 0x74, 0x61,
0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x66, 0x72, 0x6f,
0x65, 0x72, 0x1a, 0x21, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68,
0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68,
0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xca, 0x02, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65,
0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x04,
0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, 0x6f,
0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67,
0x65, 0x72, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06,
0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0xb2, 0x02, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x43,
0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a,
0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72,
0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61,
0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64,
0x79, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e,
0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d,
0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72,
0x69, 0x66, 0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x2d, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72,
0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52,
0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3c, 0x0a,
0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x34, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e,
0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, 0x68,
0x61, 0x69, 0x6e, 0x52, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x32, 0xb9, 0x02, 0x0a, 0x11,
0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x5b, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x26, 0x2e,
0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61,
0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e,
0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64,
0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64,
0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x29, 0x2e,
0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61,
0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69,
0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74,
0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79,
0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76,
0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74,
0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66,
0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c,
0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65,
0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x56, 0x0a, 0x04, 0x42, 0x6f,
0x64, 0x79, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52,
0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e,
0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e,
0x49, 0x64, 0x22, 0xfe, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61,
0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x62, 0x6f,
0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72,
0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69,
0x6e, 0x73, 0x12, 0x28, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12,
0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74,
0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66,
0x79, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d,
0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69,
0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66,
0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76,
0x65, 0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x06, 0x0a, 0x04, 0x42,
0x6f, 0x64, 0x79, 0x22, 0xad, 0x02, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69,
0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x04, 0x62, 0x6f, 0x64,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66,
0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e,
0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x45, 0x0a, 0x0b,
0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65,
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x74,
0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61,
0x64, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x68, 0x65,
0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6e, 0x65, 0x6f,
0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79,
0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x3b, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x33,
0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b,
0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x2e,
0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, 0x74, 0x61, 0x72,
0x67, 0x65, 0x74, 0x22, 0xab, 0x02, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69,
0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x04, 0x62, 0x6f,
0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72,
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x46,
0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x4d, 0x65, 0x74, 0x61, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61,
0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x52, 0x0a, 0x0d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79,
0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e,
0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x76, 0x65,
0x72, 0x69, 0x66, 0x79, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x1a, 0x35, 0x0a, 0x04, 0x42, 0x6f,
0x64, 0x79, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
0x61, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x06, 0x63, 0x68, 0x61, 0x69, 0x6e,
0x73, 0x32, 0xb9, 0x02, 0x0a, 0x11, 0x41, 0x50, 0x45, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5b, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x43, 0x68,
0x61, 0x69, 0x6e, 0x12, 0x26, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43,
0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x66, 0x72,
0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61,
0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68,
0x61, 0x69, 0x6e, 0x12, 0x29, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32,
0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f,
0x76, 0x65, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a,
0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d,
0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x43, 0x68, 0x61,
0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0a, 0x4c, 0x69,
0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x28, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74,
0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72,
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x29, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e,
0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43,
0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x66,
0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e,
0x61, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4c, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x2e, 0x66,
0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65,
0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73,
0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x65, 0x6d, 0x61,
0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x70, 0x65, 0x6d, 0x61,
0x6e, 0x61, 0x67, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x68, 0x61, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x4c, 0x5a,
0x4a, 0x67, 0x69, 0x74, 0x2e, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2e, 0x69, 0x6e, 0x66,
0x6f, 0x2f, 0x54, 0x72, 0x75, 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x61, 0x62, 0x2f, 0x66,
0x72, 0x6f, 0x73, 0x74, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32,
0x2f, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63,
0x3b, 0x61, 0x70, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
@ -918,8 +917,8 @@ var file_apemanager_grpc_service_proto_goTypes = []interface{}{
(*grpc.RequestVerificationHeader)(nil), // 13: neo.fs.v2.session.RequestVerificationHeader
(*grpc.ResponseMetaHeader)(nil), // 14: neo.fs.v2.session.ResponseMetaHeader
(*grpc.ResponseVerificationHeader)(nil), // 15: neo.fs.v2.session.ResponseVerificationHeader
(*ChainTarget)(nil), // 16: frostfs.v2.apemanager.ChainTarget
(*Chain)(nil), // 17: frostfs.v2.apemanager.Chain
(*grpc1.ChainTarget)(nil), // 16: frostfs.v2.ape.ChainTarget
(*grpc1.Chain)(nil), // 17: frostfs.v2.ape.Chain
}
var file_apemanager_grpc_service_proto_depIdxs = []int32{
6, // 0: frostfs.v2.apemanager.AddChainRequest.body:type_name -> frostfs.v2.apemanager.AddChainRequest.Body
@ -940,11 +939,11 @@ var file_apemanager_grpc_service_proto_depIdxs = []int32{
11, // 15: frostfs.v2.apemanager.ListChainsResponse.body:type_name -> frostfs.v2.apemanager.ListChainsResponse.Body
14, // 16: frostfs.v2.apemanager.ListChainsResponse.meta_header:type_name -> neo.fs.v2.session.ResponseMetaHeader
15, // 17: frostfs.v2.apemanager.ListChainsResponse.verify_header:type_name -> neo.fs.v2.session.ResponseVerificationHeader
16, // 18: frostfs.v2.apemanager.AddChainRequest.Body.target:type_name -> frostfs.v2.apemanager.ChainTarget
17, // 19: frostfs.v2.apemanager.AddChainRequest.Body.chain:type_name -> frostfs.v2.apemanager.Chain
16, // 20: frostfs.v2.apemanager.RemoveChainRequest.Body.target:type_name -> frostfs.v2.apemanager.ChainTarget
16, // 21: frostfs.v2.apemanager.ListChainsRequest.Body.target:type_name -> frostfs.v2.apemanager.ChainTarget
17, // 22: frostfs.v2.apemanager.ListChainsResponse.Body.chains:type_name -> frostfs.v2.apemanager.Chain
16, // 18: frostfs.v2.apemanager.AddChainRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget
17, // 19: frostfs.v2.apemanager.AddChainRequest.Body.chain:type_name -> frostfs.v2.ape.Chain
16, // 20: frostfs.v2.apemanager.RemoveChainRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget
16, // 21: frostfs.v2.apemanager.ListChainsRequest.Body.target:type_name -> frostfs.v2.ape.ChainTarget
17, // 22: frostfs.v2.apemanager.ListChainsResponse.Body.chains:type_name -> frostfs.v2.ape.Chain
0, // 23: frostfs.v2.apemanager.APEManagerService.AddChain:input_type -> frostfs.v2.apemanager.AddChainRequest
2, // 24: frostfs.v2.apemanager.APEManagerService.RemoveChain:input_type -> frostfs.v2.apemanager.RemoveChainRequest
4, // 25: frostfs.v2.apemanager.APEManagerService.ListChains:input_type -> frostfs.v2.apemanager.ListChainsRequest
@ -963,7 +962,6 @@ func file_apemanager_grpc_service_proto_init() {
if File_apemanager_grpc_service_proto != nil {
return
}
file_apemanager_grpc_types_proto_init()
if !protoimpl.UnsafeEnabled {
file_apemanager_grpc_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddChainRequest); i {

View file

@ -1,19 +1,12 @@
package apemanager
import (
"fmt"
apemanager "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
)
const (
chainTargetTargetTypeField = 1
chainTargetNameField = 2
chainRawField = 1
addChainReqBodyTargetField = 1
addChainReqBodyChainField = 2
@ -31,82 +24,6 @@ const (
listChainsRespBodyChainsField = 1
)
func (t *ChainTarget) StableSize() (size int) {
if t == nil {
return 0
}
size += proto.EnumSize(chainTargetTargetTypeField, int32(t.targeType))
size += proto.StringSize(chainTargetNameField, t.name)
return size
}
func (t *ChainTarget) StableMarshal(buf []byte) []byte {
if t == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, t.StableSize())
}
var offset int
offset += proto.EnumMarshal(chainTargetTargetTypeField, buf[offset:], int32(t.targeType))
proto.StringMarshal(chainTargetNameField, buf[offset:], t.name)
return buf
}
func (t *ChainTarget) Unmarshal(data []byte) error {
return message.Unmarshal(t, data, new(apemanager.ChainTarget))
}
func (c *Chain) StableSize() (size int) {
if c == nil {
return 0
}
switch v := c.GetKind().(type) {
case *ChainRaw:
if v != nil {
size += proto.BytesSize(chainRawField, v.GetRaw())
}
default:
panic(fmt.Sprintf("unsupported chain kind: %T", v))
}
return size
}
func (c *Chain) StableMarshal(buf []byte) []byte {
if c == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, c.StableSize())
}
var offset int
switch v := c.GetKind().(type) {
case *ChainRaw:
if v != nil {
proto.BytesMarshal(chainRawField, buf[offset:], v.GetRaw())
}
default:
panic(fmt.Sprintf("unsupported chain kind: %T", v))
}
return buf
}
func (c *Chain) Unmarshal(data []byte) error {
return message.Unmarshal(c, data, new(apemanager.Chain))
}
func (rb *AddChainRequestBody) StableSize() (size int) {
if rb == nil {
return 0

View file

@ -10,7 +10,6 @@ import (
func TestMessageConvert(t *testing.T) {
messagetest.TestRPCMessage(t,
func(empty bool) message.Message { return apemanagertest.GenerateChainTarget(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequestBody(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateAddChainRequest(empty) },
func(empty bool) message.Message { return apemanagertest.GenerateAddChainResponseBody(empty) },

View file

@ -1,6 +1,7 @@
package apemanagertest
import (
apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager"
sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test"
)
@ -13,78 +14,12 @@ func generateChainID(empty bool) []byte {
return []byte("616c6c6f774f626a476574436e72")
}
func generateRawChains(empty bool, n int) []*apemanager.Chain {
if empty {
return []*apemanager.Chain{}
}
res := make([]*apemanager.Chain, n)
for i := range res {
res[i] = generateRawChain(empty)
}
return res
}
func generateRawChain(empty bool) *apemanager.Chain {
chRaw := new(apemanager.ChainRaw)
if empty {
chRaw.SetRaw([]byte("{}"))
} else {
chRaw.SetRaw([]byte(`{
"ID": "",
"Rules": [
{
"Status": "Allow",
"Actions": {
"Inverted": false,
"Names": [
"GetObject"
]
},
"Resources": {
"Inverted": false,
"Names": [
"native:object/*"
]
},
"Any": false,
"Condition": [
{
"Op": "StringEquals",
"Object": "Resource",
"Key": "Department",
"Value": "HR"
}
]
}
],
"MatchType": "DenyPriority"
}`))
}
ch := new(apemanager.Chain)
ch.SetKind(chRaw)
return ch
}
func GenerateChainTarget(empty bool) *apemanager.ChainTarget {
m := new(apemanager.ChainTarget)
if !empty {
m.SetTargetType(apemanager.TargetTypeContainer)
m.SetName("BzQw5HH3feoxFDD5tCT87Y1726qzgLfxEE7wgtoRzB3R")
}
return m
}
func GenerateAddChainRequestBody(empty bool) *apemanager.AddChainRequestBody {
m := new(apemanager.AddChainRequestBody)
if !empty {
m.SetTarget(GenerateChainTarget(empty))
m.SetChain(generateRawChain(empty))
m.SetTarget(apetest.GenerateChainTarget(empty))
m.SetChain(apetest.GenerateRawChain(empty))
}
return m
@ -129,7 +64,7 @@ func GenerateRemoveChainRequestBody(empty bool) *apemanager.RemoveChainRequestBo
if !empty {
m.SetChainID(generateChainID(empty))
m.SetTarget(GenerateChainTarget(empty))
m.SetTarget(apetest.GenerateChainTarget(empty))
}
return m
@ -167,7 +102,7 @@ func GenerateListChainsRequestBody(empty bool) *apemanager.ListChainsRequestBody
m := new(apemanager.ListChainsRequestBody)
if !empty {
m.SetTarget(GenerateChainTarget(empty))
m.SetTarget(apetest.GenerateChainTarget(empty))
}
return m
@ -189,7 +124,7 @@ func GenerateListChainsResponseBody(empty bool) *apemanager.ListChainsResponseBo
m := new(apemanager.ListChainsResponseBody)
if !empty {
m.SetChains(generateRawChains(empty, 10))
m.SetChains(apetest.GenerateRawChains(empty, 10))
}
return m

View file

@ -1,49 +1,10 @@
package apemanager
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
)
type TargetType uint32
const (
TargetTypeUndefined TargetType = iota
TargetTypeNamespace
TargetTypeContainer
TargetTypeUser
TargetTypeGroup
)
type ChainTarget struct {
targeType TargetType
name string
}
func (ct *ChainTarget) SetTargetType(targeType TargetType) {
ct.targeType = targeType
}
func (ct *ChainTarget) SetName(name string) {
ct.name = name
}
func (ct *ChainTarget) GetTargetType() TargetType {
if ct != nil {
return ct.targeType
}
return 0
}
func (ct *ChainTarget) GetName() string {
if ct != nil {
return ct.name
}
return ""
}
type AddChainRequest struct {
body *AddChainRequestBody
@ -58,55 +19,25 @@ func (r *AddChainRequest) GetBody() *AddChainRequestBody {
return r.body
}
type chainKind interface {
isChainKind()
}
type Chain struct {
kind chainKind
}
func (c *Chain) SetKind(kind chainKind) {
c.kind = kind
}
func (c *Chain) GetKind() chainKind {
return c.kind
}
type ChainRaw struct {
Raw []byte
}
func (*ChainRaw) isChainKind() {}
func (c *ChainRaw) SetRaw(raw []byte) {
c.Raw = raw
}
func (c *ChainRaw) GetRaw() []byte {
return c.Raw
}
type AddChainRequestBody struct {
target *ChainTarget
target *ape.ChainTarget
chain *Chain
chain *ape.Chain
}
func (rb *AddChainRequestBody) SetTarget(target *ChainTarget) {
func (rb *AddChainRequestBody) SetTarget(target *ape.ChainTarget) {
rb.target = target
}
func (rb *AddChainRequestBody) GetTarget() *ChainTarget {
func (rb *AddChainRequestBody) GetTarget() *ape.ChainTarget {
return rb.target
}
func (rb *AddChainRequestBody) SetChain(chain *Chain) {
func (rb *AddChainRequestBody) SetChain(chain *ape.Chain) {
rb.chain = chain
}
func (rb *AddChainRequestBody) GetChain() *Chain {
func (rb *AddChainRequestBody) GetChain() *ape.Chain {
return rb.chain
}
@ -151,16 +82,16 @@ func (r *RemoveChainRequest) GetBody() *RemoveChainRequestBody {
}
type RemoveChainRequestBody struct {
target *ChainTarget
target *ape.ChainTarget
chainID []byte
}
func (rb *RemoveChainRequestBody) SetTarget(target *ChainTarget) {
func (rb *RemoveChainRequestBody) SetTarget(target *ape.ChainTarget) {
rb.target = target
}
func (rb *RemoveChainRequestBody) GetTarget() *ChainTarget {
func (rb *RemoveChainRequestBody) GetTarget() *ape.ChainTarget {
return rb.target
}
@ -204,14 +135,14 @@ func (r *ListChainsRequest) GetBody() *ListChainsRequestBody {
}
type ListChainsRequestBody struct {
target *ChainTarget
target *ape.ChainTarget
}
func (rb *ListChainsRequestBody) SetTarget(target *ChainTarget) {
func (rb *ListChainsRequestBody) SetTarget(target *ape.ChainTarget) {
rb.target = target
}
func (rb *ListChainsRequestBody) GetTarget() *ChainTarget {
func (rb *ListChainsRequestBody) GetTarget() *ape.ChainTarget {
return rb.target
}
@ -230,15 +161,15 @@ func (r *ListChainsResponse) GetBody() *ListChainsResponseBody {
}
type ListChainsResponseBody struct {
chains []*Chain
chains []*ape.Chain
session.RequestHeaders
}
func (r *ListChainsResponseBody) SetChains(chains []*Chain) {
func (r *ListChainsResponseBody) SetChains(chains []*ape.Chain) {
r.chains = chains
}
func (r *ListChainsResponseBody) GetChains() []*Chain {
func (r *ListChainsResponseBody) GetChains() []*ape.Chain {
return r.chains
}