@@ -25,10 +25,11 @@ import (
2525 "text/template"
2626 "time"
2727
28- "github.com/aws/aws-sdk-go/aws"
28+ "github.com/aws/aws-sdk-go-v2/aws"
29+ ssmv2 "github.com/aws/aws-sdk-go-v2/service/ssm"
2930 "github.com/aws/aws-sdk-go/service/ec2"
3031 "github.com/aws/aws-sdk-go/service/ec2/ec2iface"
31- "github.com/aws/aws-sdk-go/service/ssm"
32+
3233 "github.com/blang/semver"
3334 "github.com/pkg/errors"
3435
@@ -224,8 +225,8 @@ func (s *Service) defaultAMIIDLookup(amiNameFormat, ownerID, baseOS, architectur
224225 return "" , errors .Wrapf (err , "failed to find ami" )
225226 }
226227
227- s .scope .Debug ("Found and using an existing AMI" , "ami-id" , aws . StringValue ( latestImage .ImageId ) )
228- return aws .StringValue (latestImage .ImageId ), nil
228+ s .scope .Debug ("Found and using an existing AMI" , "ami-id" , latestImage .ImageId )
229+ return aws .ToString (latestImage .ImageId ), nil
229230}
230231
231232type images []* ec2.Image
@@ -239,8 +240,8 @@ func (i images) Len() int {
239240// index i should sort before the element with index j.
240241// At this point all CreationDates have been checked for errors so ignoring the error is ok.
241242func (i images ) Less (k , j int ) bool {
242- firstTime , _ := time .Parse (createDateTimestampFormat , aws .StringValue (i [k ].CreationDate ))
243- secondTime , _ := time .Parse (createDateTimestampFormat , aws .StringValue (i [j ].CreationDate ))
243+ firstTime , _ := time .Parse (createDateTimestampFormat , aws .ToString (i [k ].CreationDate ))
244+ secondTime , _ := time .Parse (createDateTimestampFormat , aws .ToString (i [j ].CreationDate ))
244245 return firstTime .Before (secondTime )
245246}
246247
@@ -252,7 +253,7 @@ func (i images) Swap(k, j int) {
252253// GetLatestImage assumes imgs is not empty. Responsibility of the caller to check.
253254func GetLatestImage (imgs []* ec2.Image ) (* ec2.Image , error ) {
254255 for _ , img := range imgs {
255- if _ , err := time .Parse (createDateTimestampFormat , aws .StringValue (img .CreationDate )); err != nil {
256+ if _ , err := time .Parse (createDateTimestampFormat , aws .ToString (img .CreationDate )); err != nil {
256257 return nil , err
257258 }
258259 }
@@ -336,11 +337,11 @@ func (s *Service) eksAMILookup(kubernetesVersion string, architecture string, am
336337 }
337338 }
338339
339- input := & ssm .GetParameterInput {
340+ input := & ssmv2 .GetParameterInput {
340341 Name : aws .String (paramName ),
341342 }
342343
343- out , err := s .SSMClient .GetParameter (input )
344+ out , err := s .SSMClient .GetParameter (context . TODO (), input )
344345 if err != nil {
345346 record .Eventf (s .scope .InfraCluster (), "FailedGetParameter" , "Failed to get ami SSM parameter %q: %v" , paramName , err )
346347
@@ -351,7 +352,7 @@ func (s *Service) eksAMILookup(kubernetesVersion string, architecture string, am
351352 return "" , errors .Errorf ("SSM parameter returned with nil value: %q" , paramName )
352353 }
353354
354- id := aws .StringValue (out .Parameter .Value )
355+ id := aws .ToString (out .Parameter .Value )
355356 s .scope .Info ("found AMI" , "id" , id , "version" , formattedVersion )
356357
357358 return id , nil
0 commit comments