github.com/cloudwan/edgelq-sdk@v1.15.4/limits/resources/v1alpha2/common/common.pb.object_ext.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/limits/proto/v1alpha2/common.proto 3 // DO NOT EDIT!!! 4 5 package common 6 7 import ( 8 "fmt" 9 "sort" 10 11 "google.golang.org/protobuf/proto" 12 googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 13 14 gotenobject "github.com/cloudwan/goten-sdk/runtime/object" 15 ) 16 17 // proto imports 18 import ( 19 meta_resource "github.com/cloudwan/edgelq-sdk/meta/resources/v1alpha2/resource" 20 ) 21 22 // ensure the imports are used 23 var ( 24 _ = new(fmt.Stringer) 25 _ = new(sort.Interface) 26 27 _ = new(proto.Message) 28 _ = googlefieldmaskpb.FieldMask{} 29 30 _ = new(gotenobject.FieldPath) 31 ) 32 33 // make sure we're using proto imports 34 var ( 35 _ = &meta_resource.Resource{} 36 ) 37 38 func (o *Allowance) GotenObjectExt() {} 39 40 func (o *Allowance) MakeFullFieldMask() *Allowance_FieldMask { 41 return FullAllowance_FieldMask() 42 } 43 44 func (o *Allowance) MakeRawFullFieldMask() gotenobject.FieldMask { 45 return FullAllowance_FieldMask() 46 } 47 48 func (o *Allowance) MakeDiffFieldMask(other *Allowance) *Allowance_FieldMask { 49 if o == nil && other == nil { 50 return &Allowance_FieldMask{} 51 } 52 if o == nil || other == nil { 53 return FullAllowance_FieldMask() 54 } 55 56 res := &Allowance_FieldMask{} 57 if o.GetResource().String() != other.GetResource().String() { 58 res.Paths = append(res.Paths, &Allowance_FieldTerminalPath{selector: Allowance_FieldPathSelectorResource}) 59 } 60 if o.GetValue() != other.GetValue() { 61 res.Paths = append(res.Paths, &Allowance_FieldTerminalPath{selector: Allowance_FieldPathSelectorValue}) 62 } 63 return res 64 } 65 66 func (o *Allowance) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 67 return o.MakeDiffFieldMask(other.(*Allowance)) 68 } 69 70 func (o *Allowance) Clone() *Allowance { 71 if o == nil { 72 return nil 73 } 74 result := &Allowance{} 75 if o.Resource == nil { 76 result.Resource = nil 77 } else if data, err := o.Resource.ProtoString(); err != nil { 78 panic(err) 79 } else { 80 result.Resource = &meta_resource.Reference{} 81 if err := result.Resource.ParseProtoString(data); err != nil { 82 panic(err) 83 } 84 } 85 result.Value = o.Value 86 return result 87 } 88 89 func (o *Allowance) CloneRaw() gotenobject.GotenObjectExt { 90 return o.Clone() 91 } 92 93 func (o *Allowance) Merge(source *Allowance) { 94 if source.GetResource() != nil { 95 if data, err := source.GetResource().ProtoString(); err != nil { 96 panic(err) 97 } else { 98 o.Resource = &meta_resource.Reference{} 99 if err := o.Resource.ParseProtoString(data); err != nil { 100 panic(err) 101 } 102 } 103 } else { 104 o.Resource = nil 105 } 106 o.Value = source.GetValue() 107 } 108 109 func (o *Allowance) MergeRaw(source gotenobject.GotenObjectExt) { 110 o.Merge(source.(*Allowance)) 111 } 112 113 func (o *RegionalDistribution) GotenObjectExt() {} 114 115 func (o *RegionalDistribution) MakeFullFieldMask() *RegionalDistribution_FieldMask { 116 return FullRegionalDistribution_FieldMask() 117 } 118 119 func (o *RegionalDistribution) MakeRawFullFieldMask() gotenobject.FieldMask { 120 return FullRegionalDistribution_FieldMask() 121 } 122 123 func (o *RegionalDistribution) MakeDiffFieldMask(other *RegionalDistribution) *RegionalDistribution_FieldMask { 124 if o == nil && other == nil { 125 return &RegionalDistribution_FieldMask{} 126 } 127 if o == nil || other == nil { 128 return FullRegionalDistribution_FieldMask() 129 } 130 131 res := &RegionalDistribution_FieldMask{} 132 if o.GetResource().String() != other.GetResource().String() { 133 res.Paths = append(res.Paths, &RegionalDistribution_FieldTerminalPath{selector: RegionalDistribution_FieldPathSelectorResource}) 134 } 135 136 if len(o.GetLimitsByRegion()) == len(other.GetLimitsByRegion()) { 137 for i, lValue := range o.GetLimitsByRegion() { 138 rValue := other.GetLimitsByRegion()[i] 139 if lValue != rValue { 140 res.Paths = append(res.Paths, &RegionalDistribution_FieldTerminalPath{selector: RegionalDistribution_FieldPathSelectorLimitsByRegion}) 141 break 142 } 143 } 144 } else { 145 res.Paths = append(res.Paths, &RegionalDistribution_FieldTerminalPath{selector: RegionalDistribution_FieldPathSelectorLimitsByRegion}) 146 } 147 return res 148 } 149 150 func (o *RegionalDistribution) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask { 151 return o.MakeDiffFieldMask(other.(*RegionalDistribution)) 152 } 153 154 func (o *RegionalDistribution) Clone() *RegionalDistribution { 155 if o == nil { 156 return nil 157 } 158 result := &RegionalDistribution{} 159 if o.Resource == nil { 160 result.Resource = nil 161 } else if data, err := o.Resource.ProtoString(); err != nil { 162 panic(err) 163 } else { 164 result.Resource = &meta_resource.Reference{} 165 if err := result.Resource.ParseProtoString(data); err != nil { 166 panic(err) 167 } 168 } 169 result.LimitsByRegion = map[string]int64{} 170 for key, sourceValue := range o.LimitsByRegion { 171 result.LimitsByRegion[key] = sourceValue 172 } 173 return result 174 } 175 176 func (o *RegionalDistribution) CloneRaw() gotenobject.GotenObjectExt { 177 return o.Clone() 178 } 179 180 func (o *RegionalDistribution) Merge(source *RegionalDistribution) { 181 if source.GetResource() != nil { 182 if data, err := source.GetResource().ProtoString(); err != nil { 183 panic(err) 184 } else { 185 o.Resource = &meta_resource.Reference{} 186 if err := o.Resource.ParseProtoString(data); err != nil { 187 panic(err) 188 } 189 } 190 } else { 191 o.Resource = nil 192 } 193 if source.GetLimitsByRegion() != nil { 194 if o.LimitsByRegion == nil { 195 o.LimitsByRegion = make(map[string]int64, len(source.GetLimitsByRegion())) 196 } 197 for key, sourceValue := range source.GetLimitsByRegion() { 198 o.LimitsByRegion[key] = sourceValue 199 } 200 } 201 } 202 203 func (o *RegionalDistribution) MergeRaw(source gotenobject.GotenObjectExt) { 204 o.Merge(source.(*RegionalDistribution)) 205 }