aws-fsx-csi-driver
aws-fsx-csi-driver copied to clipboard
Migrate to aws sdk v2
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
-
aws-sdk-go
->aws-sdk-go-v2
and addedaws-sdk-go-v2/config
,aws-sdk-go-v2/service/fsx
,aws-sdk-go-v2/feature/ec2/imds
to go.mod. - Session is replaced by Config
- FSx types moved to
aws-sdk-go-v2/service/fsx/types
, and enums are now used rather than strings in many of the structs. - Many FSx fields were changed from
int64
toint32
. (This did mean I've changed the types of some of the fields in some of the public APIs egpkg/cloud/cloud.go FileSystem
, alternatively they could be kept as int64 and the uses could be converted to int32 where needed.) -
ec2metadata
is replaced byec2/imds
-
ec2/imds
in v2 doesn't have anAvailable()
function, however in v1 all that did was checkGetMetadata
, so I've implementedAvailable()
here following the same logic.