diff --git a/pkg/aws/validations/iam_helpers.go b/pkg/aws/validations/iam_helpers.go index 24621ce..9b2bcba 100644 --- a/pkg/aws/validations/iam_helpers.go +++ b/pkg/aws/validations/iam_helpers.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/aws" - semver "github.com/hashicorp/go-version" "github.com/openshift-online/ocm-common/pkg" ) @@ -26,32 +25,6 @@ func IsManagedRole(roleTags []*iam.Tag) bool { return false } -func HasCompatibleVersionTags(iamTags []*iam.Tag, version string) (bool, error) { - if len(iamTags) == 0 { - return false, nil - } - - wantedVersion, err := semver.NewVersion(version) - if err != nil { - return false, err - } - - for _, tag := range iamTags { - if aws.StringValue(tag.Key) == OpenShiftVersion { - if version == aws.StringValue(tag.Value) { - return true, nil - } - - currentVersion, err := semver.NewVersion(aws.StringValue(tag.Value)) - if err != nil { - return false, err - } - return currentVersion.GreaterThanOrEqual(wantedVersion), nil - } - } - return false, nil -} - func IamResourceHasTag(iamTags []*iam.Tag, tagKey string, tagValue string) bool { for _, tag := range iamTags { if aws.StringValue(tag.Key) == tagKey && aws.StringValue(tag.Value) == tagValue { diff --git a/pkg/aws/validations/iam_helpers_test.go b/pkg/aws/validations/iam_helpers_test.go index 7001b12..cb797c6 100644 --- a/pkg/aws/validations/iam_helpers_test.go +++ b/pkg/aws/validations/iam_helpers_test.go @@ -64,56 +64,6 @@ var _ = Describe("AWS IAM Functions", func() { }) }) - var _ = Describe("HasCompatibleVersionTags", func() { - var iamTags []*iam.Tag - - BeforeEach(func() { - iamTags = []*iam.Tag{ - {Key: aws.String(OpenShiftVersion), Value: aws.String("1.2.3")}, - {Key: aws.String("SomeOtherTag"), Value: aws.String("value")}, - } - }) - - It("should return true if the version tag matches the provided version", func() { - version := "1.2.3" - - result, err := HasCompatibleVersionTags(iamTags, version) - - Expect(result).To(BeTrue()) - Expect(err).To(BeNil()) - }) - - It("should return false if the version tag does not match the provided version", func() { - version := "2.0.0" - - result, err := HasCompatibleVersionTags(iamTags, version) - - Expect(result).To(BeFalse()) - Expect(err).To(BeNil()) - }) - - It("should return false if the version tag is not present", func() { - version := "1.2.3" - iamTags = []*iam.Tag{ - {Key: aws.String("SomeOtherTag"), Value: aws.String("value")}, - } - - result, err := HasCompatibleVersionTags(iamTags, version) - - Expect(result).To(BeFalse()) - Expect(err).To(BeNil()) - }) - - It("should return an error if the provided version is not a valid semantic version", func() { - version := "invalid-version" - - result, err := HasCompatibleVersionTags(iamTags, version) - - Expect(result).To(BeFalse()) - Expect(err).ToNot(BeNil()) - }) - }) - var _ = Describe("IamResourceHasTag", func() { It("should return true if the tag with the specified key and value exists", func() { iamTags := []*iam.Tag{