-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
deepcopy.go
128 lines (126 loc) · 3.01 KB
/
deepcopy.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
package testing
// TODO: get rid of this by enabling gengo with nested maps
func (in *MockF5State) DeepCopyInto(out *MockF5State) {
*out = *in
if in.Policies != nil {
in, out := &in.Policies, &out.Policies
*out = make(map[string]map[string]PolicyRule, len(*in))
for key, val := range *in {
if val == nil {
continue
}
(*out)[key] = map[string]PolicyRule{}
for k, v := range val {
(*out)[key][k] = *v.DeepCopy()
}
}
}
if in.VserverPolicies != nil {
in, out := &in.VserverPolicies, &out.VserverPolicies
*out = make(map[string]map[string]bool, len(*in))
for key, val := range *in {
if val == nil {
continue
}
(*out)[key] = map[string]bool{}
for k, v := range val {
(*out)[key][k] = v
}
}
}
if in.Certs != nil {
in, out := &in.Certs, &out.Certs
*out = make(map[string]bool, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Keys != nil {
in, out := &in.Keys, &out.Keys
*out = make(map[string]bool, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.ServerSslProfiles != nil {
in, out := &in.ServerSslProfiles, &out.ServerSslProfiles
*out = make(map[string]bool, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.ClientSslProfiles != nil {
in, out := &in.ClientSslProfiles, &out.ClientSslProfiles
*out = make(map[string]bool, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.VserverProfiles != nil {
in, out := &in.VserverProfiles, &out.VserverProfiles
*out = make(map[string]map[string]bool, len(*in))
for key, val := range *in {
if val == nil {
continue
}
(*out)[key] = map[string]bool{}
for k, v := range val {
(*out)[key][k] = v
}
}
}
if in.Datagroups != nil {
in, out := &in.Datagroups, &out.Datagroups
*out = make(map[string]Datagroup, len(*in))
for key, val := range *in {
newVal := new(Datagroup)
val.DeepCopyInto(newVal)
(*out)[key] = *newVal
}
}
if in.IRules != nil {
in, out := &in.IRules, &out.IRules
*out = make(map[string]IRule, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.VserverIRules != nil {
in, out := &in.VserverIRules, &out.VserverIRules
*out = make(map[string][]string, len(*in))
for key, val := range *in {
if val == nil {
(*out)[key] = nil
} else {
(*out)[key] = make([]string, len(val))
copy((*out)[key], val)
}
}
}
if in.PartitionPaths != nil {
in, out := &in.PartitionPaths, &out.PartitionPaths
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Pools != nil {
in, out := &in.Pools, &out.Pools
*out = make(map[string]Pool, len(*in))
for key, val := range *in {
newVal := new(Pool)
val.DeepCopyInto(newVal)
(*out)[key] = *newVal
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MockF5State.
func (in *MockF5State) DeepCopy() *MockF5State {
if in == nil {
return nil
}
out := new(MockF5State)
in.DeepCopyInto(out)
return out
}