github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/internal/grpcwrapper/rawtopic/alter_topic.go (about) 1 package rawtopic 2 3 import ( 4 "github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Topic" 5 6 "github.com/ydb-platform/ydb-go-sdk/v3/internal/grpcwrapper/rawoptional" 7 "github.com/ydb-platform/ydb-go-sdk/v3/internal/grpcwrapper/rawtopic/rawtopiccommon" 8 "github.com/ydb-platform/ydb-go-sdk/v3/internal/grpcwrapper/rawydb" 9 ) 10 11 type AlterTopicRequest struct { 12 OperationParams rawydb.OperationParams 13 14 Path string 15 16 AlterPartitionSettings AlterPartitioningSettings 17 SetRetentionPeriod rawoptional.Duration 18 SetRetentionStorageMB rawoptional.Int64 19 SetSupportedCodecs bool 20 SetSupportedCodecsValue rawtopiccommon.SupportedCodecs 21 SetPartitionWriteSpeedBytesPerSecond rawoptional.Int64 22 SetPartitionWriteBurstBytes rawoptional.Int64 23 AlterAttributes map[string]string 24 AddConsumers []Consumer 25 DropConsumers []string 26 AlterConsumers []AlterConsumer 27 SetMeteringMode MeteringMode 28 } 29 30 func (req *AlterTopicRequest) ToProto() *Ydb_Topic.AlterTopicRequest { 31 res := &Ydb_Topic.AlterTopicRequest{ 32 OperationParams: req.OperationParams.ToProto(), 33 Path: req.Path, 34 AlterPartitioningSettings: req.AlterPartitionSettings.ToProto(), 35 SetRetentionPeriod: req.SetRetentionPeriod.ToProto(), 36 SetRetentionStorageMb: req.SetRetentionStorageMB.ToProto(), 37 SetPartitionWriteSpeedBytesPerSecond: req.SetPartitionWriteSpeedBytesPerSecond.ToProto(), 38 SetPartitionWriteBurstBytes: req.SetPartitionWriteBurstBytes.ToProto(), 39 AlterAttributes: req.AlterAttributes, 40 SetMeteringMode: Ydb_Topic.MeteringMode(req.SetMeteringMode), 41 } 42 43 if req.SetSupportedCodecs { 44 res.SetSupportedCodecs = req.SetSupportedCodecsValue.ToProto() 45 } 46 47 res.AddConsumers = make([]*Ydb_Topic.Consumer, len(req.AddConsumers)) 48 for i := range req.AddConsumers { 49 res.AddConsumers[i] = req.AddConsumers[i].ToProto() 50 } 51 52 res.DropConsumers = req.DropConsumers 53 54 res.AlterConsumers = make([]*Ydb_Topic.AlterConsumer, len(req.AlterConsumers)) 55 for i := range req.AlterConsumers { 56 res.AlterConsumers[i] = req.AlterConsumers[i].ToProto() 57 } 58 59 return res 60 } 61 62 type AlterTopicResult struct { 63 Operation rawydb.Operation 64 } 65 66 func (r *AlterTopicResult) FromProto(proto *Ydb_Topic.AlterTopicResponse) error { 67 return r.Operation.FromProtoWithStatusCheck(proto.GetOperation()) 68 } 69 70 type AlterConsumer struct { 71 Name string 72 SetImportant rawoptional.Bool 73 SetReadFrom rawoptional.Time 74 SetSupportedCodecs rawtopiccommon.SupportedCodecs 75 AlterAttributes map[string]string 76 } 77 78 func (c *AlterConsumer) ToProto() *Ydb_Topic.AlterConsumer { 79 return &Ydb_Topic.AlterConsumer{ 80 Name: c.Name, 81 SetImportant: c.SetImportant.ToProto(), 82 SetReadFrom: c.SetReadFrom.ToProto(), 83 SetSupportedCodecs: c.SetSupportedCodecs.ToProto(), 84 AlterAttributes: c.AlterAttributes, 85 } 86 }