@@ -17,8 +17,6 @@ limitations under the License.
17
17
package ec2
18
18
19
19
import (
20
- "sort"
21
-
22
20
"github.com/aws/aws-sdk-go-v2/aws"
23
21
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
24
22
@@ -47,30 +45,11 @@ func GenerateEC2TagsV1Beta1(tags []svcapitypes.Tag) []ec2types.Tag {
47
45
return res
48
46
}
49
47
50
- // CompareTags compares arrays of v1beta1.Tag and ec2type .Tag
51
- func CompareTagsV1Beta1 ( tags []svcapitypes.Tag , ec2Tags []ec2types.Tag ) bool {
52
- if len (tags ) != len (ec2Tags ) {
48
+ // CompareTags compares arrays of v1beta1.Tag and ec2types .Tag
49
+ func CompareTags ( spec []svcapitypes.Tag , current []ec2types.Tag ) bool {
50
+ if len (spec ) != len (current ) {
53
51
return false
54
52
}
55
-
56
- SortTagsV1Beta1 (tags , ec2Tags )
57
-
58
- for i , t := range tags {
59
- if t .Key != * ec2Tags [i ].Key || t .Value != * ec2Tags [i ].Value {
60
- return false
61
- }
62
- }
63
-
64
- return true
65
- }
66
-
67
- // SortTags sorts array of v1beta1.Tag and ec2type.Tag on 'Key'
68
- func SortTagsV1Beta1 (tags []svcapitypes.Tag , ec2Tags []ec2types.Tag ) {
69
- sort .Slice (tags , func (i , j int ) bool {
70
- return tags [i ].Key < tags [j ].Key
71
- })
72
-
73
- sort .Slice (ec2Tags , func (i , j int ) bool {
74
- return * ec2Tags [i ].Key < * ec2Tags [j ].Key
75
- })
53
+ toAdd , toRemove := DiffEC2Tags (GenerateEC2TagsV1Beta1 (spec ), current )
54
+ return len (toAdd ) == 0 && len (toRemove ) == 0
76
55
}
0 commit comments