aws-fsx-csi-driver icon indicating copy to clipboard operation
aws-fsx-csi-driver copied to clipboard

Migrate to aws sdk v2

Open michael-diggin opened this issue 4 months ago • 11 comments

Is this a bug fix or adding new feature? Neither, changes all uses of aws-sdk-go to aws-sdk-go-v2 - resolves #385.

What is this PR about? / Why do we need it? As mentioned in #385, aws-sdk-go-v1 won't be receiving any more updates. Migrating to v2 allows for using newer features from FSx (eg AutoExportPolicy as mentioned in #255, this is something I need and is my motivation for this PR).

What testing is done? make test

I've aimed to make as few changes to the interfaces as possible, hoping it's just a 'drop-in' replacement, following https://aws.github.io/aws-sdk-go-v2/docs/migrating/ Summary of changes

  1. aws-sdk-go -> aws-sdk-go-v2 and added aws-sdk-go-v2/config, aws-sdk-go-v2/service/fsx, aws-sdk-go-v2/feature/ec2/imds to go.mod.
  2. Session is replaced by Config
  3. FSx types moved to aws-sdk-go-v2/service/fsx/types, and enums are now used rather than strings in many of the structs.
  4. Many FSx fields were changed from int64 to int32. (This did mean I've changed the types of some of the fields in some of the public APIs eg pkg/cloud/cloud.go FileSystem, alternatively they could be kept as int64 and the uses could be converted to int32 where needed.)
  5. ec2metadata is replaced by ec2/imds
  6. ec2/imds in v2 doesn't have an Available() function, however in v1 all that did was check GetMetadata, so I've implemented Available() here following the same logic.

michael-diggin avatar Oct 20 '24 07:10 michael-diggin