-
Notifications
You must be signed in to change notification settings - Fork 619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate ECS client to aws-sdk-go-v2 #4447
base: dev
Are you sure you want to change the base?
Conversation
6b18859
to
a1a9480
Compare
1c2d4b8
to
7d2a689
Compare
7d2a689
to
0d3c3a7
Compare
874dc29
to
447b0eb
Compare
agent/utils/utils.go
Outdated
} | ||
|
||
var re *awshttp.ResponseError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might not be the correct error type. for context, we seem to only use GetRequestFailureStatusCode
whenever we try to use IMDS to get the metadata of the instance. (ref)
In AWS SDK Go V2, it looks like GetMetadata
(and probably all of the other calls) ends up returning a smithy.OperationError
-> https://github.com/aws/aws-sdk-go-v2/blob/21ec8a2702f18c177c1a2f2d24dda340eef5bed4/feature/ec2/imds/api_client.go#L259
97dc857
to
232c822
Compare
232c822
to
7c8ebf0
Compare
Summary
Migrate ECS client to
aws-sdk-go-v2
.#4406 added our bespoke codegen'd
aws-sdk-go-v2
ECS client. This PR integrates the v2 ECS client with Agent and removes all uses of our v1 ECS client.Implementation details
In
go.mod
for theagent
andecs-agent
modules,github.com/aws/aws-sdk-go-v2/service/ecs
Update ECS client construction per the docs.
Replace all uses of our v1 ECS client with the v2 ECS client.
aws/aws-sdk-go/service/ecs
is now split betweenaws/aws-sdk-go-v2/service/ecs
andaws/aws-sdk-go-v2/service/ecs/types
.ContainerStateChange.NetworkBindings
changed from[]*NetworkBinding
to[]NetworkBinding
). See the docs for more info.int64
types are nowint32
(e.g.NetworkBinding.ContainerPort
andNetworkBinding.HostPort
changed from*int64
to*int32
).string
constants now have their own enum types aliased tostring
(e.g. theAgentUpdateStatus*
constants changed fromstring
to typeAgentUpdateStatus
.ErrCode*Exception
string constants have been replaced with Exception types (e.g.ErrCodeAccessDeniedException
("AccessDeniedException") now corresponds to theAccessDeniedException
type).Update error handling to handle SDKv1 and SDKv2 errors. v1 error handling can be removed after all clients have been migrated to
aws-sdk-go-v2
. See the docs for more info on error handling in v2.aws.Error
is analogous tosmithy.APIError
.string
error codes now have modeled error types (compare this v1 example with this v2 example).aws.RequestFailure
, which includes the request ID, is analogous tohttp.ResponseError
(see the docs for more info).Rewrite the
oneDayRetrier
to be compatible withaws-sdk-go-v2
per the docs.Testing
GitHub checks pass.
New tests cover the changes: no
Description for the changelog
Migrate ECS client to
aws-sdk-go-v2
.Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.