-
Notifications
You must be signed in to change notification settings - Fork 1
/
config_map.pb.object_ext.go
178 lines (157 loc) · 4.61 KB
/
config_map.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
// Code generated by protoc-gen-goten-object
// File: edgelq/applications/proto/v1alpha/config_map.proto
// DO NOT EDIT!!!
package config_map
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 (
project "github.com/cloudwan/edgelq-sdk/applications/resources/v1alpha/project"
ntt_meta "github.com/cloudwan/edgelq-sdk/common/types/meta"
)
// 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 (
_ = &project.Project{}
_ = &ntt_meta.Meta{}
)
func (o *ConfigMap) GotenObjectExt() {}
func (o *ConfigMap) MakeFullFieldMask() *ConfigMap_FieldMask {
return FullConfigMap_FieldMask()
}
func (o *ConfigMap) MakeRawFullFieldMask() gotenobject.FieldMask {
return FullConfigMap_FieldMask()
}
func (o *ConfigMap) MakeDiffFieldMask(other *ConfigMap) *ConfigMap_FieldMask {
if o == nil && other == nil {
return &ConfigMap_FieldMask{}
}
if o == nil || other == nil {
return FullConfigMap_FieldMask()
}
res := &ConfigMap_FieldMask{}
if o.GetName().String() != other.GetName().String() {
res.Paths = append(res.Paths, &ConfigMap_FieldTerminalPath{selector: ConfigMap_FieldPathSelectorName})
}
if o.GetDisplayName() != other.GetDisplayName() {
res.Paths = append(res.Paths, &ConfigMap_FieldTerminalPath{selector: ConfigMap_FieldPathSelectorDisplayName})
}
{
subMask := o.GetMetadata().MakeDiffFieldMask(other.GetMetadata())
if subMask.IsFull() {
res.Paths = append(res.Paths, &ConfigMap_FieldTerminalPath{selector: ConfigMap_FieldPathSelectorMetadata})
} else {
for _, subpath := range subMask.Paths {
res.Paths = append(res.Paths, &ConfigMap_FieldSubPath{selector: ConfigMap_FieldPathSelectorMetadata, subPath: subpath})
}
}
}
if len(o.GetData()) == len(other.GetData()) {
for i, lValue := range o.GetData() {
rValue := other.GetData()[i]
if lValue != rValue {
res.Paths = append(res.Paths, &ConfigMap_FieldTerminalPath{selector: ConfigMap_FieldPathSelectorData})
break
}
}
} else {
res.Paths = append(res.Paths, &ConfigMap_FieldTerminalPath{selector: ConfigMap_FieldPathSelectorData})
}
if len(o.GetBinaryData()) == len(other.GetBinaryData()) {
for i, lValue := range o.GetBinaryData() {
rValue := other.GetBinaryData()[i]
if string(lValue) != string(rValue) {
res.Paths = append(res.Paths, &ConfigMap_FieldTerminalPath{selector: ConfigMap_FieldPathSelectorBinaryData})
break
}
}
} else {
res.Paths = append(res.Paths, &ConfigMap_FieldTerminalPath{selector: ConfigMap_FieldPathSelectorBinaryData})
}
return res
}
func (o *ConfigMap) MakeRawDiffFieldMask(other gotenobject.GotenObjectExt) gotenobject.FieldMask {
return o.MakeDiffFieldMask(other.(*ConfigMap))
}
func (o *ConfigMap) Clone() *ConfigMap {
if o == nil {
return nil
}
result := &ConfigMap{}
if o.Name == nil {
result.Name = nil
} else if data, err := o.Name.ProtoString(); err != nil {
panic(err)
} else {
result.Name = &Name{}
if err := result.Name.ParseProtoString(data); err != nil {
panic(err)
}
}
result.DisplayName = o.DisplayName
result.Metadata = o.Metadata.Clone()
result.Data = map[string]string{}
for key, sourceValue := range o.Data {
result.Data[key] = sourceValue
}
result.BinaryData = map[string][]byte{}
for key, sourceValue := range o.BinaryData {
result.BinaryData[key] = sourceValue
}
return result
}
func (o *ConfigMap) CloneRaw() gotenobject.GotenObjectExt {
return o.Clone()
}
func (o *ConfigMap) Merge(source *ConfigMap) {
if source.GetName() != nil {
if data, err := source.GetName().ProtoString(); err != nil {
panic(err)
} else {
o.Name = &Name{}
if err := o.Name.ParseProtoString(data); err != nil {
panic(err)
}
}
} else {
o.Name = nil
}
o.DisplayName = source.GetDisplayName()
if source.GetMetadata() != nil {
if o.Metadata == nil {
o.Metadata = new(ntt_meta.Meta)
}
o.Metadata.Merge(source.GetMetadata())
}
if source.GetData() != nil {
if o.Data == nil {
o.Data = make(map[string]string, len(source.GetData()))
}
for key, sourceValue := range source.GetData() {
o.Data[key] = sourceValue
}
}
if source.GetBinaryData() != nil {
if o.BinaryData == nil {
o.BinaryData = make(map[string][]byte, len(source.GetBinaryData()))
}
for key, sourceValue := range source.GetBinaryData() {
o.BinaryData[key] = sourceValue
}
}
}
func (o *ConfigMap) MergeRaw(source gotenobject.GotenObjectExt) {
o.Merge(source.(*ConfigMap))
}