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