@@ -25,10 +25,11 @@ import (
25
25
"text/template"
26
26
"time"
27
27
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"
29
30
"github.com/aws/aws-sdk-go/service/ec2"
30
31
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
31
- "github.com/aws/aws-sdk-go/service/ssm"
32
+
32
33
"github.com/blang/semver"
33
34
"github.com/pkg/errors"
34
35
@@ -224,8 +225,8 @@ func (s *Service) defaultAMIIDLookup(amiNameFormat, ownerID, baseOS, architectur
224
225
return "" , errors .Wrapf (err , "failed to find ami" )
225
226
}
226
227
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
229
230
}
230
231
231
232
type images []* ec2.Image
@@ -239,8 +240,8 @@ func (i images) Len() int {
239
240
// index i should sort before the element with index j.
240
241
// At this point all CreationDates have been checked for errors so ignoring the error is ok.
241
242
func (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 ))
244
245
return firstTime .Before (secondTime )
245
246
}
246
247
@@ -252,7 +253,7 @@ func (i images) Swap(k, j int) {
252
253
// GetLatestImage assumes imgs is not empty. Responsibility of the caller to check.
253
254
func GetLatestImage (imgs []* ec2.Image ) (* ec2.Image , error ) {
254
255
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 {
256
257
return nil , err
257
258
}
258
259
}
@@ -336,11 +337,11 @@ func (s *Service) eksAMILookup(kubernetesVersion string, architecture string, am
336
337
}
337
338
}
338
339
339
- input := & ssm .GetParameterInput {
340
+ input := & ssmv2 .GetParameterInput {
340
341
Name : aws .String (paramName ),
341
342
}
342
343
343
- out , err := s .SSMClient .GetParameter (input )
344
+ out , err := s .SSMClient .GetParameter (context . TODO (), input )
344
345
if err != nil {
345
346
record .Eventf (s .scope .InfraCluster (), "FailedGetParameter" , "Failed to get ami SSM parameter %q: %v" , paramName , err )
346
347
@@ -351,7 +352,7 @@ func (s *Service) eksAMILookup(kubernetesVersion string, architecture string, am
351
352
return "" , errors .Errorf ("SSM parameter returned with nil value: %q" , paramName )
352
353
}
353
354
354
- id := aws .StringValue (out .Parameter .Value )
355
+ id := aws .ToString (out .Parameter .Value )
355
356
s .scope .Info ("found AMI" , "id" , id , "version" , formattedVersion )
356
357
357
358
return id , nil
0 commit comments