-
Notifications
You must be signed in to change notification settings - Fork 25
/
delta.go
197 lines (189 loc) · 12.4 KB
/
delta.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
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
// Code generated by ack-generate. DO NOT EDIT.
package cluster
import (
"bytes"
"reflect"
ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare"
acktags "github.com/aws-controllers-k8s/runtime/pkg/tags"
)
// Hack to avoid import errors during build...
var (
_ = &bytes.Buffer{}
_ = &reflect.Method{}
_ = &acktags.Tags{}
)
// newResourceDelta returns a new `ackcompare.Delta` used to compare two
// resources
func newResourceDelta(
a *resource,
b *resource,
) *ackcompare.Delta {
delta := ackcompare.NewDelta()
if (a == nil && b != nil) ||
(a != nil && b == nil) {
delta.Add("", a, b)
return delta
}
if ackcompare.HasNilDifference(a.ko.Spec.AccessConfig, b.ko.Spec.AccessConfig) {
delta.Add("Spec.AccessConfig", a.ko.Spec.AccessConfig, b.ko.Spec.AccessConfig)
} else if a.ko.Spec.AccessConfig != nil && b.ko.Spec.AccessConfig != nil {
if ackcompare.HasNilDifference(a.ko.Spec.AccessConfig.AuthenticationMode, b.ko.Spec.AccessConfig.AuthenticationMode) {
delta.Add("Spec.AccessConfig.AuthenticationMode", a.ko.Spec.AccessConfig.AuthenticationMode, b.ko.Spec.AccessConfig.AuthenticationMode)
} else if a.ko.Spec.AccessConfig.AuthenticationMode != nil && b.ko.Spec.AccessConfig.AuthenticationMode != nil {
if *a.ko.Spec.AccessConfig.AuthenticationMode != *b.ko.Spec.AccessConfig.AuthenticationMode {
delta.Add("Spec.AccessConfig.AuthenticationMode", a.ko.Spec.AccessConfig.AuthenticationMode, b.ko.Spec.AccessConfig.AuthenticationMode)
}
}
}
if ackcompare.HasNilDifference(a.ko.Spec.ClientRequestToken, b.ko.Spec.ClientRequestToken) {
delta.Add("Spec.ClientRequestToken", a.ko.Spec.ClientRequestToken, b.ko.Spec.ClientRequestToken)
} else if a.ko.Spec.ClientRequestToken != nil && b.ko.Spec.ClientRequestToken != nil {
if *a.ko.Spec.ClientRequestToken != *b.ko.Spec.ClientRequestToken {
delta.Add("Spec.ClientRequestToken", a.ko.Spec.ClientRequestToken, b.ko.Spec.ClientRequestToken)
}
}
if len(a.ko.Spec.EncryptionConfig) != len(b.ko.Spec.EncryptionConfig) {
delta.Add("Spec.EncryptionConfig", a.ko.Spec.EncryptionConfig, b.ko.Spec.EncryptionConfig)
} else if len(a.ko.Spec.EncryptionConfig) > 0 {
if !reflect.DeepEqual(a.ko.Spec.EncryptionConfig, b.ko.Spec.EncryptionConfig) {
delta.Add("Spec.EncryptionConfig", a.ko.Spec.EncryptionConfig, b.ko.Spec.EncryptionConfig)
}
}
if ackcompare.HasNilDifference(a.ko.Spec.KubernetesNetworkConfig, b.ko.Spec.KubernetesNetworkConfig) {
delta.Add("Spec.KubernetesNetworkConfig", a.ko.Spec.KubernetesNetworkConfig, b.ko.Spec.KubernetesNetworkConfig)
} else if a.ko.Spec.KubernetesNetworkConfig != nil && b.ko.Spec.KubernetesNetworkConfig != nil {
if ackcompare.HasNilDifference(a.ko.Spec.KubernetesNetworkConfig.IPFamily, b.ko.Spec.KubernetesNetworkConfig.IPFamily) {
delta.Add("Spec.KubernetesNetworkConfig.IPFamily", a.ko.Spec.KubernetesNetworkConfig.IPFamily, b.ko.Spec.KubernetesNetworkConfig.IPFamily)
} else if a.ko.Spec.KubernetesNetworkConfig.IPFamily != nil && b.ko.Spec.KubernetesNetworkConfig.IPFamily != nil {
if *a.ko.Spec.KubernetesNetworkConfig.IPFamily != *b.ko.Spec.KubernetesNetworkConfig.IPFamily {
delta.Add("Spec.KubernetesNetworkConfig.IPFamily", a.ko.Spec.KubernetesNetworkConfig.IPFamily, b.ko.Spec.KubernetesNetworkConfig.IPFamily)
}
}
if ackcompare.HasNilDifference(a.ko.Spec.KubernetesNetworkConfig.ServiceIPv4CIDR, b.ko.Spec.KubernetesNetworkConfig.ServiceIPv4CIDR) {
delta.Add("Spec.KubernetesNetworkConfig.ServiceIPv4CIDR", a.ko.Spec.KubernetesNetworkConfig.ServiceIPv4CIDR, b.ko.Spec.KubernetesNetworkConfig.ServiceIPv4CIDR)
} else if a.ko.Spec.KubernetesNetworkConfig.ServiceIPv4CIDR != nil && b.ko.Spec.KubernetesNetworkConfig.ServiceIPv4CIDR != nil {
if *a.ko.Spec.KubernetesNetworkConfig.ServiceIPv4CIDR != *b.ko.Spec.KubernetesNetworkConfig.ServiceIPv4CIDR {
delta.Add("Spec.KubernetesNetworkConfig.ServiceIPv4CIDR", a.ko.Spec.KubernetesNetworkConfig.ServiceIPv4CIDR, b.ko.Spec.KubernetesNetworkConfig.ServiceIPv4CIDR)
}
}
}
if ackcompare.HasNilDifference(a.ko.Spec.Logging, b.ko.Spec.Logging) {
delta.Add("Spec.Logging", a.ko.Spec.Logging, b.ko.Spec.Logging)
} else if a.ko.Spec.Logging != nil && b.ko.Spec.Logging != nil {
if len(a.ko.Spec.Logging.ClusterLogging) != len(b.ko.Spec.Logging.ClusterLogging) {
delta.Add("Spec.Logging.ClusterLogging", a.ko.Spec.Logging.ClusterLogging, b.ko.Spec.Logging.ClusterLogging)
} else if len(a.ko.Spec.Logging.ClusterLogging) > 0 {
if !reflect.DeepEqual(a.ko.Spec.Logging.ClusterLogging, b.ko.Spec.Logging.ClusterLogging) {
delta.Add("Spec.Logging.ClusterLogging", a.ko.Spec.Logging.ClusterLogging, b.ko.Spec.Logging.ClusterLogging)
}
}
}
if ackcompare.HasNilDifference(a.ko.Spec.Name, b.ko.Spec.Name) {
delta.Add("Spec.Name", a.ko.Spec.Name, b.ko.Spec.Name)
} else if a.ko.Spec.Name != nil && b.ko.Spec.Name != nil {
if *a.ko.Spec.Name != *b.ko.Spec.Name {
delta.Add("Spec.Name", a.ko.Spec.Name, b.ko.Spec.Name)
}
}
if ackcompare.HasNilDifference(a.ko.Spec.OutpostConfig, b.ko.Spec.OutpostConfig) {
delta.Add("Spec.OutpostConfig", a.ko.Spec.OutpostConfig, b.ko.Spec.OutpostConfig)
} else if a.ko.Spec.OutpostConfig != nil && b.ko.Spec.OutpostConfig != nil {
if ackcompare.HasNilDifference(a.ko.Spec.OutpostConfig.ControlPlaneInstanceType, b.ko.Spec.OutpostConfig.ControlPlaneInstanceType) {
delta.Add("Spec.OutpostConfig.ControlPlaneInstanceType", a.ko.Spec.OutpostConfig.ControlPlaneInstanceType, b.ko.Spec.OutpostConfig.ControlPlaneInstanceType)
} else if a.ko.Spec.OutpostConfig.ControlPlaneInstanceType != nil && b.ko.Spec.OutpostConfig.ControlPlaneInstanceType != nil {
if *a.ko.Spec.OutpostConfig.ControlPlaneInstanceType != *b.ko.Spec.OutpostConfig.ControlPlaneInstanceType {
delta.Add("Spec.OutpostConfig.ControlPlaneInstanceType", a.ko.Spec.OutpostConfig.ControlPlaneInstanceType, b.ko.Spec.OutpostConfig.ControlPlaneInstanceType)
}
}
if ackcompare.HasNilDifference(a.ko.Spec.OutpostConfig.ControlPlanePlacement, b.ko.Spec.OutpostConfig.ControlPlanePlacement) {
delta.Add("Spec.OutpostConfig.ControlPlanePlacement", a.ko.Spec.OutpostConfig.ControlPlanePlacement, b.ko.Spec.OutpostConfig.ControlPlanePlacement)
} else if a.ko.Spec.OutpostConfig.ControlPlanePlacement != nil && b.ko.Spec.OutpostConfig.ControlPlanePlacement != nil {
if ackcompare.HasNilDifference(a.ko.Spec.OutpostConfig.ControlPlanePlacement.GroupName, b.ko.Spec.OutpostConfig.ControlPlanePlacement.GroupName) {
delta.Add("Spec.OutpostConfig.ControlPlanePlacement.GroupName", a.ko.Spec.OutpostConfig.ControlPlanePlacement.GroupName, b.ko.Spec.OutpostConfig.ControlPlanePlacement.GroupName)
} else if a.ko.Spec.OutpostConfig.ControlPlanePlacement.GroupName != nil && b.ko.Spec.OutpostConfig.ControlPlanePlacement.GroupName != nil {
if *a.ko.Spec.OutpostConfig.ControlPlanePlacement.GroupName != *b.ko.Spec.OutpostConfig.ControlPlanePlacement.GroupName {
delta.Add("Spec.OutpostConfig.ControlPlanePlacement.GroupName", a.ko.Spec.OutpostConfig.ControlPlanePlacement.GroupName, b.ko.Spec.OutpostConfig.ControlPlanePlacement.GroupName)
}
}
}
if len(a.ko.Spec.OutpostConfig.OutpostARNs) != len(b.ko.Spec.OutpostConfig.OutpostARNs) {
delta.Add("Spec.OutpostConfig.OutpostARNs", a.ko.Spec.OutpostConfig.OutpostARNs, b.ko.Spec.OutpostConfig.OutpostARNs)
} else if len(a.ko.Spec.OutpostConfig.OutpostARNs) > 0 {
if !ackcompare.SliceStringPEqual(a.ko.Spec.OutpostConfig.OutpostARNs, b.ko.Spec.OutpostConfig.OutpostARNs) {
delta.Add("Spec.OutpostConfig.OutpostARNs", a.ko.Spec.OutpostConfig.OutpostARNs, b.ko.Spec.OutpostConfig.OutpostARNs)
}
}
}
if ackcompare.HasNilDifference(a.ko.Spec.ResourcesVPCConfig, b.ko.Spec.ResourcesVPCConfig) {
delta.Add("Spec.ResourcesVPCConfig", a.ko.Spec.ResourcesVPCConfig, b.ko.Spec.ResourcesVPCConfig)
} else if a.ko.Spec.ResourcesVPCConfig != nil && b.ko.Spec.ResourcesVPCConfig != nil {
if ackcompare.HasNilDifference(a.ko.Spec.ResourcesVPCConfig.EndpointPrivateAccess, b.ko.Spec.ResourcesVPCConfig.EndpointPrivateAccess) {
delta.Add("Spec.ResourcesVPCConfig.EndpointPrivateAccess", a.ko.Spec.ResourcesVPCConfig.EndpointPrivateAccess, b.ko.Spec.ResourcesVPCConfig.EndpointPrivateAccess)
} else if a.ko.Spec.ResourcesVPCConfig.EndpointPrivateAccess != nil && b.ko.Spec.ResourcesVPCConfig.EndpointPrivateAccess != nil {
if *a.ko.Spec.ResourcesVPCConfig.EndpointPrivateAccess != *b.ko.Spec.ResourcesVPCConfig.EndpointPrivateAccess {
delta.Add("Spec.ResourcesVPCConfig.EndpointPrivateAccess", a.ko.Spec.ResourcesVPCConfig.EndpointPrivateAccess, b.ko.Spec.ResourcesVPCConfig.EndpointPrivateAccess)
}
}
if ackcompare.HasNilDifference(a.ko.Spec.ResourcesVPCConfig.EndpointPublicAccess, b.ko.Spec.ResourcesVPCConfig.EndpointPublicAccess) {
delta.Add("Spec.ResourcesVPCConfig.EndpointPublicAccess", a.ko.Spec.ResourcesVPCConfig.EndpointPublicAccess, b.ko.Spec.ResourcesVPCConfig.EndpointPublicAccess)
} else if a.ko.Spec.ResourcesVPCConfig.EndpointPublicAccess != nil && b.ko.Spec.ResourcesVPCConfig.EndpointPublicAccess != nil {
if *a.ko.Spec.ResourcesVPCConfig.EndpointPublicAccess != *b.ko.Spec.ResourcesVPCConfig.EndpointPublicAccess {
delta.Add("Spec.ResourcesVPCConfig.EndpointPublicAccess", a.ko.Spec.ResourcesVPCConfig.EndpointPublicAccess, b.ko.Spec.ResourcesVPCConfig.EndpointPublicAccess)
}
}
if len(a.ko.Spec.ResourcesVPCConfig.PublicAccessCIDRs) != len(b.ko.Spec.ResourcesVPCConfig.PublicAccessCIDRs) {
delta.Add("Spec.ResourcesVPCConfig.PublicAccessCIDRs", a.ko.Spec.ResourcesVPCConfig.PublicAccessCIDRs, b.ko.Spec.ResourcesVPCConfig.PublicAccessCIDRs)
} else if len(a.ko.Spec.ResourcesVPCConfig.PublicAccessCIDRs) > 0 {
if !ackcompare.SliceStringPEqual(a.ko.Spec.ResourcesVPCConfig.PublicAccessCIDRs, b.ko.Spec.ResourcesVPCConfig.PublicAccessCIDRs) {
delta.Add("Spec.ResourcesVPCConfig.PublicAccessCIDRs", a.ko.Spec.ResourcesVPCConfig.PublicAccessCIDRs, b.ko.Spec.ResourcesVPCConfig.PublicAccessCIDRs)
}
}
if len(a.ko.Spec.ResourcesVPCConfig.SecurityGroupIDs) != len(b.ko.Spec.ResourcesVPCConfig.SecurityGroupIDs) {
delta.Add("Spec.ResourcesVPCConfig.SecurityGroupIDs", a.ko.Spec.ResourcesVPCConfig.SecurityGroupIDs, b.ko.Spec.ResourcesVPCConfig.SecurityGroupIDs)
} else if len(a.ko.Spec.ResourcesVPCConfig.SecurityGroupIDs) > 0 {
if !ackcompare.SliceStringPEqual(a.ko.Spec.ResourcesVPCConfig.SecurityGroupIDs, b.ko.Spec.ResourcesVPCConfig.SecurityGroupIDs) {
delta.Add("Spec.ResourcesVPCConfig.SecurityGroupIDs", a.ko.Spec.ResourcesVPCConfig.SecurityGroupIDs, b.ko.Spec.ResourcesVPCConfig.SecurityGroupIDs)
}
}
if len(a.ko.Spec.ResourcesVPCConfig.SubnetIDs) != len(b.ko.Spec.ResourcesVPCConfig.SubnetIDs) {
delta.Add("Spec.ResourcesVPCConfig.SubnetIDs", a.ko.Spec.ResourcesVPCConfig.SubnetIDs, b.ko.Spec.ResourcesVPCConfig.SubnetIDs)
} else if len(a.ko.Spec.ResourcesVPCConfig.SubnetIDs) > 0 {
if !ackcompare.SliceStringPEqual(a.ko.Spec.ResourcesVPCConfig.SubnetIDs, b.ko.Spec.ResourcesVPCConfig.SubnetIDs) {
delta.Add("Spec.ResourcesVPCConfig.SubnetIDs", a.ko.Spec.ResourcesVPCConfig.SubnetIDs, b.ko.Spec.ResourcesVPCConfig.SubnetIDs)
}
}
}
if ackcompare.HasNilDifference(a.ko.Spec.RoleARN, b.ko.Spec.RoleARN) {
delta.Add("Spec.RoleARN", a.ko.Spec.RoleARN, b.ko.Spec.RoleARN)
} else if a.ko.Spec.RoleARN != nil && b.ko.Spec.RoleARN != nil {
if *a.ko.Spec.RoleARN != *b.ko.Spec.RoleARN {
delta.Add("Spec.RoleARN", a.ko.Spec.RoleARN, b.ko.Spec.RoleARN)
}
}
if !reflect.DeepEqual(a.ko.Spec.RoleRef, b.ko.Spec.RoleRef) {
delta.Add("Spec.RoleRef", a.ko.Spec.RoleRef, b.ko.Spec.RoleRef)
}
if !ackcompare.MapStringStringEqual(ToACKTags(a.ko.Spec.Tags), ToACKTags(b.ko.Spec.Tags)) {
delta.Add("Spec.Tags", a.ko.Spec.Tags, b.ko.Spec.Tags)
}
if ackcompare.HasNilDifference(a.ko.Spec.Version, b.ko.Spec.Version) {
delta.Add("Spec.Version", a.ko.Spec.Version, b.ko.Spec.Version)
} else if a.ko.Spec.Version != nil && b.ko.Spec.Version != nil {
if *a.ko.Spec.Version != *b.ko.Spec.Version {
delta.Add("Spec.Version", a.ko.Spec.Version, b.ko.Spec.Version)
}
}
return delta
}