Skip to content

Commit

Permalink
Merge pull request #16444 from rifelpet/aws-sdk-go-v2-aws
Browse files Browse the repository at this point in the history
Migrate aws-sdk-go/aws to aws-sdk-go-v2/aws
  • Loading branch information
k8s-ci-robot authored Apr 1, 2024
2 parents 1dfc5b5 + 3d4ba32 commit f3b2159
Show file tree
Hide file tree
Showing 63 changed files with 298 additions and 299 deletions.
2 changes: 1 addition & 1 deletion cmd/kops/create_cluster_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"testing"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go/service/ec2"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
route53testing "k8s.io/kops/dnsprovider/pkg/dnsprovider/providers/aws/route53/stubs"
"k8s.io/kops/dnsprovider/pkg/dnsprovider/rrstype"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go/service/route53"
"k8s.io/kops/dnsprovider/pkg/dnsprovider/tests"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"context"
"fmt"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go/service/route53"
"k8s.io/klog/v2"
"k8s.io/kops/dnsprovider/pkg/dnsprovider"
Expand Down Expand Up @@ -142,7 +142,7 @@ func (c *ResourceRecordChangeset) Apply(ctx context.Context) error {
if klog.V(8).Enabled() {
var sb bytes.Buffer
for _, change := range batch {
sb.WriteString(fmt.Sprintf("\t%s %s %s\n", aws.StringValue(change.Action), aws.StringValue(change.ResourceRecordSet.Type), aws.StringValue(change.ResourceRecordSet.Name)))
sb.WriteString(fmt.Sprintf("\t%s %s %s\n", aws.ToString(change.Action), aws.ToString(change.ResourceRecordSet.Type), aws.ToString(change.ResourceRecordSet.Name)))
}

klog.V(8).Infof("Route53 MaxBatchSize: %v\n", MaxBatchSize)
Expand Down
10 changes: 5 additions & 5 deletions dnsprovider/pkg/dnsprovider/providers/aws/route53/rrset.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"k8s.io/kops/dnsprovider/pkg/dnsprovider"
"k8s.io/kops/dnsprovider/pkg/dnsprovider/rrstype"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go/service/route53"
)

Expand All @@ -33,24 +33,24 @@ type ResourceRecordSet struct {
}

func (rrset ResourceRecordSet) Name() string {
return aws.StringValue(rrset.impl.Name)
return aws.ToString(rrset.impl.Name)
}

func (rrset ResourceRecordSet) Rrdatas() []string {
// Sigh - need to unpack the strings out of the route53 ResourceRecords
result := make([]string, len(rrset.impl.ResourceRecords))
for i, record := range rrset.impl.ResourceRecords {
result[i] = aws.StringValue(record.Value)
result[i] = aws.ToString(record.Value)
}
return result
}

func (rrset ResourceRecordSet) Ttl() int64 {
return aws.Int64Value(rrset.impl.TTL)
return aws.ToInt64(rrset.impl.TTL)
}

func (rrset ResourceRecordSet) Type() rrstype.RrsType {
return rrstype.RrsType(aws.StringValue(rrset.impl.Type))
return rrstype.RrsType(aws.ToString(rrset.impl.Type))
}

// Route53ResourceRecordSet returns the route53 ResourceRecordSet object for the ResourceRecordSet
Expand Down
4 changes: 2 additions & 2 deletions dnsprovider/pkg/dnsprovider/providers/aws/route53/rrsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package route53

import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go/service/route53"
"k8s.io/kops/dnsprovider/pkg/dnsprovider"
"k8s.io/kops/dnsprovider/pkg/dnsprovider/rrstype"
Expand Down Expand Up @@ -60,7 +60,7 @@ func (rrsets ResourceRecordSets) Get(name string) ([]dnsprovider.ResourceRecordS
var list []dnsprovider.ResourceRecordSet
err := rrsets.zone.zones.interface_.service.ListResourceRecordSetsPages(&input, func(page *route53.ListResourceRecordSetsOutput, lastPage bool) bool {
for _, rrset := range page.ResourceRecordSets {
if aws.StringValue(rrset.Name) != name {
if aws.ToString(rrset.Name) != name {
return false
}
list = append(list, &ResourceRecordSet{rrset, &rrsets})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package stubs
import (
"fmt"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go/service/route53"
)

Expand Down Expand Up @@ -107,7 +107,7 @@ func (r *Route53APIStub) ListHostedZonesPages(input *route53.ListHostedZonesInpu
}

func (r *Route53APIStub) CreateHostedZone(input *route53.CreateHostedZoneInput) (*route53.CreateHostedZoneOutput, error) {
name := aws.StringValue(input.Name)
name := aws.ToString(input.Name)
id := "/hostedzone/" + name
if _, ok := r.zones[id]; ok {
return nil, fmt.Errorf("error creating hosted DNS zone: %s already exists", id)
Expand Down
6 changes: 3 additions & 3 deletions dnsprovider/pkg/dnsprovider/providers/aws/route53/zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package route53
import (
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go/service/route53"
"k8s.io/kops/dnsprovider/pkg/dnsprovider"
)
Expand All @@ -33,11 +33,11 @@ type Zone struct {
}

func (zone *Zone) Name() string {
return aws.StringValue(zone.impl.Name)
return aws.ToString(zone.impl.Name)
}

func (zone *Zone) ID() string {
id := aws.StringValue(zone.impl.Id)
id := aws.ToString(zone.impl.Id)
id = strings.TrimPrefix(id, "/hostedzone/")
return id
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/kops/validation/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kops/cloudmock/aws/mockec2"
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/nodeup/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package nodeup
import (
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go-v2/aws"
"k8s.io/kops/pkg/apis/kops"
"k8s.io/kops/pkg/apis/kops/model"
"k8s.io/kops/util/pkg/architectures"
Expand Down
2 changes: 1 addition & 1 deletion pkg/model/awsmodel/autoscalinggroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"sort"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/klog/v2"
Expand Down
Loading

0 comments on commit f3b2159

Please sign in to comment.