Skip to content

Migrate ACS to sdk-go-v2 #4534

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

Merged
merged 6 commits into from
Mar 31, 2025
Merged

Migrate ACS to sdk-go-v2 #4534

merged 6 commits into from
Mar 31, 2025

Conversation

TheanLim
Copy link
Contributor

@TheanLim TheanLim commented Mar 14, 2025

Summary

This PR will look to migrate our ACS implementations and corresponding files over to AWS SDK Go V2.

Note: There are some overlapping files that both ACS and TCS consumes. To just migrate ACS over to V2, temporary changes that still uses AWS SDK Go V1 will be made for TCS and should be removed/modified when it's ready to be migrated to V2.

AWS SDK Go V2 Migration Public Doc: https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/migrate-gosdk.html

Implementation details

  • Modified ClientServerImpl struct from wsclient with a new field called CredentialCache of type aws.CredentialsCache from AWS SDK Go V2. If CredentialProvider has been set then it continue to use AWS SDK Go V1 to sign the HTTP requests, otherwise use AWS SDK Go V2 to sign the HTTP requests.
  • Modified ClientFactory interface from wsclientto also use aws.CredentialsCache as part of New(...) functionality
  • Update ACS clients within ecs-agent to use credentialCache of type CredentialsCache from AWS SDK Go V2 instead of Credentials from AWS SDK Go V1.
  • Updated SignHTTPRequest in ecs-agent/utils/sign_http_request.go to use aws.CredentialsCache instead of Credentials as well as SignHTTP() from aws-sdk-go-v2/aws/signer/v4. We will also need to pass in a hex encoded SHA-256 hash of the request body now.
  • Renamed the old SIgnHTTPRequest that still uses AWS SDK Go V1 to SignHTTPRequestV1 so that TCS isn't affected from this change
  • Updated TCS client in ecs-agent/ to use SignHTTPRequestV1 for now until we've migrated over to V2
  • Lots of replacement of aws.*Value() to aws.To*()
  • Other replacements of aws-sdk-go/ to aws-sdk-go-v2/

Testing

  • Updated units tests to also use V2
  • For ecs-agent/wsclient/client_test.go specifically, added two separate test cases for most of the tests where both V1 and V2 can be used
  • Manual testing
level=info time=2025-03-26T22:08:10Z msg="Websocket connection established." URL="https://ecs-a-12.us-west-2.amazonaws.com/ws?agentHash=a6e1e423&agentVersion=1.91.2&clusterArn=default&containerInstanceArn=arn%3Aaws%3Aecs%3Aus-west-2%3A113424923516%3Acontainer-instance%2Fdefault%2F7781c93546f045ddaf2e6feb2527ef59&dockerVersion=DockerVersion%3A+25.0.8&protocolVersion=2&sendCredentials=true&seqNum=1" ConnectTime="2025-03-26 22:08:10" maxConnectionDuration=34m14.522532859s ExpectedDisconnectTime="2025-03-26 22:38:10"
level=info time=2025-03-26T22:08:10Z msg="Connected to ACS endpoint" containerInstanceARN="arn:aws:ecs:us-west-2:113424923516:container-instance/default/7781c93546f045ddaf2e6feb2527ef59" lastConnectedTime=2025-03-26 22:08:10.035189417 +0000 UTC m=+0.565000837
level=debug time=2025-03-26T22:08:10Z msg="ACS client starting websocket poll loop"
level=debug time=2025-03-26T22:08:13Z msg="Received message of type: TaskManifestMessage" URL="https://ecs-a-12.us-west-2.amazonaws.com/ws?agentHash=a6e1e423&agentVersion=1.91.2&clusterArn=default&containerInstanceArn=arn%3Aaws%3Aecs%3Aus-west-2%3A113424923516%3Acontainer-instance%2Fdefault%2F7781c93546f045ddaf2e6feb2527ef59&dockerVersion=DockerVersion%3A+25.0.8&protocolVersion=2&sendCredentials=true&seqNum=1"
level=debug time=2025-03-26T22:08:13Z msg="ACS activity occurred"
level=debug time=2025-03-26T22:08:13Z msg="Processing TaskManifestMessage" messageID="49f10d45-0b94-4d68-b419-9a4bb8ce66c6"
level=debug time=2025-03-26T22:08:13Z msg="acknowledging TaskManifestMessage" messageID="49f10d45-0b94-4d68-b419-9a4bb8ce66c6"
level=debug time=2025-03-26T22:08:13Z msg="Sending response to ACS" Name="task manifest responder" Response={
  Cluster: "arn:aws:ecs:us-west-2:113424923516:cluster/default",
  ContainerInstance: "arn:aws:ecs:us-west-2:113424923516:container-instance/default/7781c93546f045ddaf2e6feb2527ef59",
  MessageId: "49f10d45-0b94-4d68-b419-9a4bb8ce66c6"
}

New tests cover the changes:

Description for the changelog

Enhancement - Migrate ACS over to AWS SDK Go V2

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

Does this PR include the addition of new environment variables in the README?

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@TheanLim TheanLim requested a review from a team as a code owner March 14, 2025 02:24
@TheanLim TheanLim force-pushed the migrate-acs branch 2 times, most recently from 5d4eab1 to f3cae1d Compare March 14, 2025 02:51
@TheanLim TheanLim changed the title [WIP] Migrate acs - testing dev rebase [WIP] Migrate ACS to sdk-go-v2 Mar 14, 2025
@TheanLim TheanLim force-pushed the migrate-acs branch 17 times, most recently from fc35da9 to ba2579f Compare March 17, 2025 23:44
@mye956 mye956 force-pushed the migrate-acs branch 3 times, most recently from a8dc5bb to 59f5fc5 Compare March 25, 2025 23:20
@mye956 mye956 changed the title [WIP] Migrate ACS to sdk-go-v2 Migrate ACS to sdk-go-v2 Mar 26, 2025
Thean Lim and others added 6 commits March 28, 2025 15:54
Update credential manager to use v2 aws

Update eni to use v2 aws

Update acs client test to use v2 aws

Update netlib to use v2 aws

Update ecs-agent/acs session to use v2 aws and aws arn

Update taskresource to use v2 aws

Update appmesh api to use v2 aws

Update serviceconnect api to use v2 aws

Update task api to use v2 aws

Update acs updater to use v2 aws

Update acs session to use v2 aws

Add ACS model and generate client

Replace acs model to the generated acs client

Migrate ACS Error Types and Input/Message

Migrate HeartbeatMessage/HeartbeatInput and HeartbeatAckRequest/HeartbeatOutput

Migrate IAMRoleCredentialsMessage/RefreshTaskIAMRoleCredentialsInput and IAMRoleCredentialsAckRequest/RefreshTaskIAMRoleCredentialsOutput

The main differences for RefreshTaskIAMRoleCredentialsInput are:
- RoleType is now a string (not string pointer) enum
- RoleCredentials is now acstypes.IAMRoleCredentials

RefreshTaskIAMRoleCredentialsOutput stays the same.

Migrate TaskStopVerificationMessage/TaskStopVerificationInput and TaskStopVerificationAck/TaskStopVerificationOutput

- TaskStopVerificationMessage/TaskStopVerificationInput changed StopCandidates from []*TaskIdentifier to []types.TaskIdentifier
- TaskStopVerificationAck/TaskStopVerificationOutput changed StopTasks from []*TaskIdentifier to []types.TaskIdentifier
- TaskIdentifier itself remains unchanged but need to update import

Migrate CloseMessage to PollOutput
- Not seeing CloseMessage is being used somewhere elses so this is a simple name change
- Both have the same structs anyway

Migrate NackRequest to UpdateFailureInput
- Struct types are the same for both
- Rename helper function use for updater_test

Update PerformUpdateMessage to PerformUpdateInput
- Same Struct Types
- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use PerformUpdateOutput

Update StageUpdateMessage to StageUpdateInput
- Same Struct Types
- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use StageUpdateOutput

Migrate AttachTaskNetworkInterfacesMessage to AttachTaskNetworkInterfacesInput
- ElasticNetworkInterfaces []*ElasticNetworkInterface  -> []types.ElasticNetworkInterface
- ElasticNetworkInterfaces
  - DomainName []*string ->  []string
  - DomainNameServers []*string ->  []string
  - Index *int64 -> *int32
  - InterfaceAssociationProtocol *string ->  NetworkInterfaceAssociationProtocol (string enum)
  - Ipv4Addresses []*IPv4AddressAssignment -> []IPv4AddressAssignment
  - Ipv6Addresses []*IPv6AddressAssignment  -> []IPv6AddressAssignment

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use AttachTaskNetworkInterfacesOutput

Migrate ElasticNetworkInterfaces
  - DomainName []*string ->  []string
  - DomainNameServers []*string ->  []string
  - Index *int64 -> *int32
  - InterfaceAssociationProtocol *string ->  NetworkInterfaceAssociationProtocol (string enum)
  - Ipv4Addresses []*IPv4AddressAssignment -> []IPv4AddressAssignment
  - Ipv6Addresses []*IPv6AddressAssignment  -> []IPv6AddressAssignment

Migrate AttachInstanceNetworkInterfacesMessage to AttachInstanceNetworkInterfacesInput
- ElasticNetworkInterfaces []*ElasticNetworkInterface  -> []types.ElasticNetworkInterface

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use AttachInstanceNetworkInterfacesOutput

Migrate ConfirmAttachmentMessage to ConfirmAttachmentInput
- *types.Attachment
  - AttachmentProperties []*AttachmentProperty → []AttachmentProperty

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use ConfirmAttachmentOutput

Migrate Attachment to types.Attachment
- AttachmentProperties []*AttachmentProperty → []AttachmentProperty

Migrate TaskManifestMessage to TaskManifestInput
- Tasks []*TaskIdentifier → [] types.TaskIdentifier

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use TaskManifestOutput

Migrate ecsacs.Task's Attachments

Migrate PayloadMessage to PayloadInput
- Also migrate underlying structs like Task, Container,...

Migrate ecsacs.UpdateInfo to types.UpdateInfo

Remove v1 acs model. Introduce AckRequest as a generic struct.

Refactor: update acs import path to avoid conflict with ecsacs model

Introduce Prettify util function; Migrate struct.String to Prettify(struct)
- It's important to redact sensitive information
- There's no longer "sensitive" tags in sdk v2

Migrate LinuxParameters and KernelCapabilities to use ecs types
- Use the predefined ecs types instead of manually defining ones

Fix: go staticcheck

Fix: change the TaskVolume keynames to starting with uppercase

Replace jsonutils.BuildJSON/json.Marshal, jsonutil.UnmarshalJSON/json.Unmarshal, and Message_/Message
- inlcluded task api and wsclient
- exclude tcs client (out of scope)

Fix: cast AuthenticationType and FirelensConfigurationType to string before asserting equality

Fix: Check against an empty string as the default value for PortMapping's Protocol
- PortMapping's Protocol changed from *string -> TransportProtocol (string enum)
- The zero value is thus updated from null -> `""` empty string

go mod tidy && go mod vendor

make gogenerate

go mod tidy && go mod vendor

Fix: change field names starting with Uppercase

Fix: Handle pointer referencing error from AttachmentProperties Migration

Fix: handle pointer error for ecs-agent netlib test

Fix: misc type fixes

Migrate Websocket and TCS to v2 credentials

go mod tidy, go mod vendor, gogenerate, go mod tidy, go mod vendor

Fix: Alias ACS types
This reverts commit 1ddf21e.

Revert "go mod tidy, go mod vendor, gogenerate, go mod tidy, go mod vendor"

This reverts commit d736279.

Revert "Migrate Websocket and TCS to v2 credentials"

This reverts commit 5eeec98.

Revert "Fix: misc type fixes"

This reverts commit d1d87e2.

Revert "Fix: handle pointer error for ecs-agent netlib test"

This reverts commit 080d85d.

Revert "Fix: Handle pointer referencing error from AttachmentProperties Migration"

This reverts commit f2b2dfd.

Revert "Fix: change field names starting with Uppercase"

This reverts commit ad9e2f8.

Revert "go mod tidy && go mod vendor"

This reverts commit 7fe7b77.

Revert "make gogenerate"

This reverts commit 4144e5e.

Revert "go mod tidy && go mod vendor"

This reverts commit 36dde8b.

Revert "Fix: Check against an empty string as the default value for PortMapping's Protocol"

This reverts commit 23c8c44.

Revert "Fix: cast AuthenticationType and FirelensConfigurationType to string before asserting equality"

This reverts commit 14436be.

Revert "Replace jsonutils.BuildJSON/json.Marshal, jsonutil.UnmarshalJSON/json.Unmarshal, and Message_/Message"

This reverts commit 3c70e74.

Revert "Fix: change the TaskVolume keynames to starting with uppercase"

This reverts commit 4055255.

Revert "Fix: go staticcheck"

This reverts commit 9bc7255.

Revert "Migrate LinuxParameters and KernelCapabilities to use ecs types"

This reverts commit 0927318.

Revert "Introduce Prettify util function; Migrate struct.String to Prettify(struct)"

This reverts commit 1bb4bbb.

Revert "Refactor: update acs import path to avoid conflict with ecsacs model"

This reverts commit c0fcae0.

Revert "Remove v1 acs model. Introduce AckRequest as a generic struct."

This reverts commit d924b17.

Revert "Migrate ecsacs.UpdateInfo to types.UpdateInfo"

This reverts commit d2e19f2.

Revert "Migrate PayloadMessage to PayloadInput"

This reverts commit 7d3282b.

Revert "Migrate ecsacs.Task's Attachments"

This reverts commit 3452c4a.

Revert "Migrate TaskManifestMessage to TaskManifestInput"

This reverts commit 0a51a28.

Revert "Migrate Attachment to types.Attachment"

This reverts commit 78d779f.

Revert "Migrate ConfirmAttachmentMessage to ConfirmAttachmentInput"

This reverts commit 884d99f.

Revert "Migrate AttachInstanceNetworkInterfacesMessage to AttachInstanceNetworkInterfacesInput"

This reverts commit fc7adc2.

Revert "Migrate ElasticNetworkInterfaces"

This reverts commit b123368.

Revert "Migrate AttachTaskNetworkInterfacesMessage to AttachTaskNetworkInterfacesInput"

This reverts commit b0663ce.

Revert "Update StageUpdateMessage to StageUpdateInput"

This reverts commit 7c704cf.

Revert "Update PerformUpdateMessage to PerformUpdateInput"

This reverts commit c47d6be.

Revert "Migrate NackRequest to UpdateFailureInput"

This reverts commit 2f38c52.

Revert "Migrate CloseMessage to PollOutput"

This reverts commit d35c5e1.

Revert "Migrate TaskStopVerificationMessage/TaskStopVerificationInput and TaskStopVerificationAck/TaskStopVerificationOutput"

This reverts commit fd1f79f.

Revert "Migrate IAMRoleCredentialsMessage/RefreshTaskIAMRoleCredentialsInput and IAMRoleCredentialsAckRequest/RefreshTaskIAMRoleCredentialsOutput"

This reverts commit 2b91941.

Revert "Migrate HeartbeatMessage/HeartbeatInput and HeartbeatAckRequest/HeartbeatOutput"

This reverts commit 2fa86ca.

Revert "Migrate ACS Error Types and Input/Message"

This reverts commit 29e7332.

Revert "Replace acs model to the generated acs client"

This reverts commit 9db9b92.

Revert "Add ACS model and generate client"

This reverts commit cea3f80.
Copy link
Contributor

@ShelbyZ ShelbyZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment, LGTM

@@ -7,7 +7,7 @@ toolchain go1.23.7
require (
github.com/aws/amazon-ecs-agent/ecs-agent v0.0.0
github.com/aws/aws-sdk-go v1.51.3
github.com/aws/aws-sdk-go-v2 v1.32.6
github.com/aws/aws-sdk-go-v2 v1.36.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to move backward here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm we've bumped up the version instead of downgrading. Could you clarify what you mean by "moving backwards"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I misread this it seems. I was seeing v1.36.6 and not v1.32.6

@mye956 mye956 merged commit cc5cc2c into aws:dev Mar 31, 2025
40 checks passed
@TheanLim TheanLim mentioned this pull request Apr 9, 2025
xxx0624 pushed a commit to xxx0624/amazon-ecs-agent that referenced this pull request Apr 17, 2025
* Update wsclient to use v2 aws

Update credential manager to use v2 aws

Update eni to use v2 aws

Update acs client test to use v2 aws

Update netlib to use v2 aws

Update ecs-agent/acs session to use v2 aws and aws arn

Update taskresource to use v2 aws

Update appmesh api to use v2 aws

Update serviceconnect api to use v2 aws

Update task api to use v2 aws

Update acs updater to use v2 aws

Update acs session to use v2 aws

Add ACS model and generate client

Replace acs model to the generated acs client

Migrate ACS Error Types and Input/Message

Migrate HeartbeatMessage/HeartbeatInput and HeartbeatAckRequest/HeartbeatOutput

Migrate IAMRoleCredentialsMessage/RefreshTaskIAMRoleCredentialsInput and IAMRoleCredentialsAckRequest/RefreshTaskIAMRoleCredentialsOutput

The main differences for RefreshTaskIAMRoleCredentialsInput are:
- RoleType is now a string (not string pointer) enum
- RoleCredentials is now acstypes.IAMRoleCredentials

RefreshTaskIAMRoleCredentialsOutput stays the same.

Migrate TaskStopVerificationMessage/TaskStopVerificationInput and TaskStopVerificationAck/TaskStopVerificationOutput

- TaskStopVerificationMessage/TaskStopVerificationInput changed StopCandidates from []*TaskIdentifier to []types.TaskIdentifier
- TaskStopVerificationAck/TaskStopVerificationOutput changed StopTasks from []*TaskIdentifier to []types.TaskIdentifier
- TaskIdentifier itself remains unchanged but need to update import

Migrate CloseMessage to PollOutput
- Not seeing CloseMessage is being used somewhere elses so this is a simple name change
- Both have the same structs anyway

Migrate NackRequest to UpdateFailureInput
- Struct types are the same for both
- Rename helper function use for updater_test

Update PerformUpdateMessage to PerformUpdateInput
- Same Struct Types
- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use PerformUpdateOutput

Update StageUpdateMessage to StageUpdateInput
- Same Struct Types
- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use StageUpdateOutput

Migrate AttachTaskNetworkInterfacesMessage to AttachTaskNetworkInterfacesInput
- ElasticNetworkInterfaces []*ElasticNetworkInterface  -> []types.ElasticNetworkInterface
- ElasticNetworkInterfaces
  - DomainName []*string ->  []string
  - DomainNameServers []*string ->  []string
  - Index *int64 -> *int32
  - InterfaceAssociationProtocol *string ->  NetworkInterfaceAssociationProtocol (string enum)
  - Ipv4Addresses []*IPv4AddressAssignment -> []IPv4AddressAssignment
  - Ipv6Addresses []*IPv6AddressAssignment  -> []IPv6AddressAssignment

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use AttachTaskNetworkInterfacesOutput

Migrate ElasticNetworkInterfaces
  - DomainName []*string ->  []string
  - DomainNameServers []*string ->  []string
  - Index *int64 -> *int32
  - InterfaceAssociationProtocol *string ->  NetworkInterfaceAssociationProtocol (string enum)
  - Ipv4Addresses []*IPv4AddressAssignment -> []IPv4AddressAssignment
  - Ipv6Addresses []*IPv6AddressAssignment  -> []IPv6AddressAssignment

Migrate AttachInstanceNetworkInterfacesMessage to AttachInstanceNetworkInterfacesInput
- ElasticNetworkInterfaces []*ElasticNetworkInterface  -> []types.ElasticNetworkInterface

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use AttachInstanceNetworkInterfacesOutput

Migrate ConfirmAttachmentMessage to ConfirmAttachmentInput
- *types.Attachment
  - AttachmentProperties []*AttachmentProperty → []AttachmentProperty

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use ConfirmAttachmentOutput

Migrate Attachment to types.Attachment
- AttachmentProperties []*AttachmentProperty → []AttachmentProperty

Migrate TaskManifestMessage to TaskManifestInput
- Tasks []*TaskIdentifier → [] types.TaskIdentifier

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use TaskManifestOutput

Migrate ecsacs.Task's Attachments

Migrate PayloadMessage to PayloadInput
- Also migrate underlying structs like Task, Container,...

Migrate ecsacs.UpdateInfo to types.UpdateInfo

Remove v1 acs model. Introduce AckRequest as a generic struct.

Refactor: update acs import path to avoid conflict with ecsacs model

Introduce Prettify util function; Migrate struct.String to Prettify(struct)
- It's important to redact sensitive information
- There's no longer "sensitive" tags in sdk v2

Migrate LinuxParameters and KernelCapabilities to use ecs types
- Use the predefined ecs types instead of manually defining ones

Fix: go staticcheck

Fix: change the TaskVolume keynames to starting with uppercase

Replace jsonutils.BuildJSON/json.Marshal, jsonutil.UnmarshalJSON/json.Unmarshal, and Message_/Message
- inlcluded task api and wsclient
- exclude tcs client (out of scope)

Fix: cast AuthenticationType and FirelensConfigurationType to string before asserting equality

Fix: Check against an empty string as the default value for PortMapping's Protocol
- PortMapping's Protocol changed from *string -> TransportProtocol (string enum)
- The zero value is thus updated from null -> `""` empty string

go mod tidy && go mod vendor

make gogenerate

go mod tidy && go mod vendor

Fix: change field names starting with Uppercase

Fix: Handle pointer referencing error from AttachmentProperties Migration

Fix: handle pointer error for ecs-agent netlib test

Fix: misc type fixes

Migrate Websocket and TCS to v2 credentials

go mod tidy, go mod vendor, gogenerate, go mod tidy, go mod vendor

Fix: Alias ACS types

* Revert "Fix: Alias ACS types"

This reverts commit 1ddf21e.

Revert "go mod tidy, go mod vendor, gogenerate, go mod tidy, go mod vendor"

This reverts commit d736279.

Revert "Migrate Websocket and TCS to v2 credentials"

This reverts commit 5eeec98.

Revert "Fix: misc type fixes"

This reverts commit d1d87e2.

Revert "Fix: handle pointer error for ecs-agent netlib test"

This reverts commit 080d85d.

Revert "Fix: Handle pointer referencing error from AttachmentProperties Migration"

This reverts commit f2b2dfd.

Revert "Fix: change field names starting with Uppercase"

This reverts commit ad9e2f8.

Revert "go mod tidy && go mod vendor"

This reverts commit 7fe7b77.

Revert "make gogenerate"

This reverts commit 4144e5e.

Revert "go mod tidy && go mod vendor"

This reverts commit 36dde8b.

Revert "Fix: Check against an empty string as the default value for PortMapping's Protocol"

This reverts commit 23c8c44.

Revert "Fix: cast AuthenticationType and FirelensConfigurationType to string before asserting equality"

This reverts commit 14436be.

Revert "Replace jsonutils.BuildJSON/json.Marshal, jsonutil.UnmarshalJSON/json.Unmarshal, and Message_/Message"

This reverts commit 3c70e74.

Revert "Fix: change the TaskVolume keynames to starting with uppercase"

This reverts commit 4055255.

Revert "Fix: go staticcheck"

This reverts commit 9bc7255.

Revert "Migrate LinuxParameters and KernelCapabilities to use ecs types"

This reverts commit 0927318.

Revert "Introduce Prettify util function; Migrate struct.String to Prettify(struct)"

This reverts commit 1bb4bbb.

Revert "Refactor: update acs import path to avoid conflict with ecsacs model"

This reverts commit c0fcae0.

Revert "Remove v1 acs model. Introduce AckRequest as a generic struct."

This reverts commit d924b17.

Revert "Migrate ecsacs.UpdateInfo to types.UpdateInfo"

This reverts commit d2e19f2.

Revert "Migrate PayloadMessage to PayloadInput"

This reverts commit 7d3282b.

Revert "Migrate ecsacs.Task's Attachments"

This reverts commit 3452c4a.

Revert "Migrate TaskManifestMessage to TaskManifestInput"

This reverts commit 0a51a28.

Revert "Migrate Attachment to types.Attachment"

This reverts commit 78d779f.

Revert "Migrate ConfirmAttachmentMessage to ConfirmAttachmentInput"

This reverts commit 884d99f.

Revert "Migrate AttachInstanceNetworkInterfacesMessage to AttachInstanceNetworkInterfacesInput"

This reverts commit fc7adc2.

Revert "Migrate ElasticNetworkInterfaces"

This reverts commit b123368.

Revert "Migrate AttachTaskNetworkInterfacesMessage to AttachTaskNetworkInterfacesInput"

This reverts commit b0663ce.

Revert "Update StageUpdateMessage to StageUpdateInput"

This reverts commit 7c704cf.

Revert "Update PerformUpdateMessage to PerformUpdateInput"

This reverts commit c47d6be.

Revert "Migrate NackRequest to UpdateFailureInput"

This reverts commit 2f38c52.

Revert "Migrate CloseMessage to PollOutput"

This reverts commit d35c5e1.

Revert "Migrate TaskStopVerificationMessage/TaskStopVerificationInput and TaskStopVerificationAck/TaskStopVerificationOutput"

This reverts commit fd1f79f.

Revert "Migrate IAMRoleCredentialsMessage/RefreshTaskIAMRoleCredentialsInput and IAMRoleCredentialsAckRequest/RefreshTaskIAMRoleCredentialsOutput"

This reverts commit 2b91941.

Revert "Migrate HeartbeatMessage/HeartbeatInput and HeartbeatAckRequest/HeartbeatOutput"

This reverts commit 2fa86ca.

Revert "Migrate ACS Error Types and Input/Message"

This reverts commit 29e7332.

Revert "Replace acs model to the generated acs client"

This reverts commit 9db9b92.

Revert "Add ACS model and generate client"

This reverts commit cea3f80.

* Update ACS and websocket clients to use V2. Keep TCS client to V1

* fixing unit tests in ecs-agent/

* Consuming V2 for ACS in agent/

* fixing go mod and vendors after rebasing

---------

Co-authored-by: Thean Lim <[email protected]>
Co-authored-by: mye956 <[email protected]>
timj-hh pushed a commit to timj-hh/amazon-ecs-agent that referenced this pull request Jul 19, 2025
* Update wsclient to use v2 aws

Update credential manager to use v2 aws

Update eni to use v2 aws

Update acs client test to use v2 aws

Update netlib to use v2 aws

Update ecs-agent/acs session to use v2 aws and aws arn

Update taskresource to use v2 aws

Update appmesh api to use v2 aws

Update serviceconnect api to use v2 aws

Update task api to use v2 aws

Update acs updater to use v2 aws

Update acs session to use v2 aws

Add ACS model and generate client

Replace acs model to the generated acs client

Migrate ACS Error Types and Input/Message

Migrate HeartbeatMessage/HeartbeatInput and HeartbeatAckRequest/HeartbeatOutput

Migrate IAMRoleCredentialsMessage/RefreshTaskIAMRoleCredentialsInput and IAMRoleCredentialsAckRequest/RefreshTaskIAMRoleCredentialsOutput

The main differences for RefreshTaskIAMRoleCredentialsInput are:
- RoleType is now a string (not string pointer) enum
- RoleCredentials is now acstypes.IAMRoleCredentials

RefreshTaskIAMRoleCredentialsOutput stays the same.

Migrate TaskStopVerificationMessage/TaskStopVerificationInput and TaskStopVerificationAck/TaskStopVerificationOutput

- TaskStopVerificationMessage/TaskStopVerificationInput changed StopCandidates from []*TaskIdentifier to []types.TaskIdentifier
- TaskStopVerificationAck/TaskStopVerificationOutput changed StopTasks from []*TaskIdentifier to []types.TaskIdentifier
- TaskIdentifier itself remains unchanged but need to update import

Migrate CloseMessage to PollOutput
- Not seeing CloseMessage is being used somewhere elses so this is a simple name change
- Both have the same structs anyway

Migrate NackRequest to UpdateFailureInput
- Struct types are the same for both
- Rename helper function use for updater_test

Update PerformUpdateMessage to PerformUpdateInput
- Same Struct Types
- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use PerformUpdateOutput

Update StageUpdateMessage to StageUpdateInput
- Same Struct Types
- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use StageUpdateOutput

Migrate AttachTaskNetworkInterfacesMessage to AttachTaskNetworkInterfacesInput
- ElasticNetworkInterfaces []*ElasticNetworkInterface  -> []types.ElasticNetworkInterface
- ElasticNetworkInterfaces
  - DomainName []*string ->  []string
  - DomainNameServers []*string ->  []string
  - Index *int64 -> *int32
  - InterfaceAssociationProtocol *string ->  NetworkInterfaceAssociationProtocol (string enum)
  - Ipv4Addresses []*IPv4AddressAssignment -> []IPv4AddressAssignment
  - Ipv6Addresses []*IPv6AddressAssignment  -> []IPv6AddressAssignment

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use AttachTaskNetworkInterfacesOutput

Migrate ElasticNetworkInterfaces
  - DomainName []*string ->  []string
  - DomainNameServers []*string ->  []string
  - Index *int64 -> *int32
  - InterfaceAssociationProtocol *string ->  NetworkInterfaceAssociationProtocol (string enum)
  - Ipv4Addresses []*IPv4AddressAssignment -> []IPv4AddressAssignment
  - Ipv6Addresses []*IPv6AddressAssignment  -> []IPv6AddressAssignment

Migrate AttachInstanceNetworkInterfacesMessage to AttachInstanceNetworkInterfacesInput
- ElasticNetworkInterfaces []*ElasticNetworkInterface  -> []types.ElasticNetworkInterface

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use AttachInstanceNetworkInterfacesOutput

Migrate ConfirmAttachmentMessage to ConfirmAttachmentInput
- *types.Attachment
  - AttachmentProperties []*AttachmentProperty → []AttachmentProperty

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use ConfirmAttachmentOutput

Migrate Attachment to types.Attachment
- AttachmentProperties []*AttachmentProperty → []AttachmentProperty

Migrate TaskManifestMessage to TaskManifestInput
- Tasks []*TaskIdentifier → [] types.TaskIdentifier

- TODO: handle AckRequest (not a type in V2) so either create a AckRequest type or use TaskManifestOutput

Migrate ecsacs.Task's Attachments

Migrate PayloadMessage to PayloadInput
- Also migrate underlying structs like Task, Container,...

Migrate ecsacs.UpdateInfo to types.UpdateInfo

Remove v1 acs model. Introduce AckRequest as a generic struct.

Refactor: update acs import path to avoid conflict with ecsacs model

Introduce Prettify util function; Migrate struct.String to Prettify(struct)
- It's important to redact sensitive information
- There's no longer "sensitive" tags in sdk v2

Migrate LinuxParameters and KernelCapabilities to use ecs types
- Use the predefined ecs types instead of manually defining ones

Fix: go staticcheck

Fix: change the TaskVolume keynames to starting with uppercase

Replace jsonutils.BuildJSON/json.Marshal, jsonutil.UnmarshalJSON/json.Unmarshal, and Message_/Message
- inlcluded task api and wsclient
- exclude tcs client (out of scope)

Fix: cast AuthenticationType and FirelensConfigurationType to string before asserting equality

Fix: Check against an empty string as the default value for PortMapping's Protocol
- PortMapping's Protocol changed from *string -> TransportProtocol (string enum)
- The zero value is thus updated from null -> `""` empty string

go mod tidy && go mod vendor

make gogenerate

go mod tidy && go mod vendor

Fix: change field names starting with Uppercase

Fix: Handle pointer referencing error from AttachmentProperties Migration

Fix: handle pointer error for ecs-agent netlib test

Fix: misc type fixes

Migrate Websocket and TCS to v2 credentials

go mod tidy, go mod vendor, gogenerate, go mod tidy, go mod vendor

Fix: Alias ACS types

* Revert "Fix: Alias ACS types"

This reverts commit 1ddf21e.

Revert "go mod tidy, go mod vendor, gogenerate, go mod tidy, go mod vendor"

This reverts commit d736279.

Revert "Migrate Websocket and TCS to v2 credentials"

This reverts commit 5eeec98.

Revert "Fix: misc type fixes"

This reverts commit d1d87e2.

Revert "Fix: handle pointer error for ecs-agent netlib test"

This reverts commit 080d85d.

Revert "Fix: Handle pointer referencing error from AttachmentProperties Migration"

This reverts commit f2b2dfd.

Revert "Fix: change field names starting with Uppercase"

This reverts commit ad9e2f8.

Revert "go mod tidy && go mod vendor"

This reverts commit 7fe7b77.

Revert "make gogenerate"

This reverts commit 4144e5e.

Revert "go mod tidy && go mod vendor"

This reverts commit 36dde8b.

Revert "Fix: Check against an empty string as the default value for PortMapping's Protocol"

This reverts commit 23c8c44.

Revert "Fix: cast AuthenticationType and FirelensConfigurationType to string before asserting equality"

This reverts commit 14436be.

Revert "Replace jsonutils.BuildJSON/json.Marshal, jsonutil.UnmarshalJSON/json.Unmarshal, and Message_/Message"

This reverts commit 3c70e74.

Revert "Fix: change the TaskVolume keynames to starting with uppercase"

This reverts commit 4055255.

Revert "Fix: go staticcheck"

This reverts commit 9bc7255.

Revert "Migrate LinuxParameters and KernelCapabilities to use ecs types"

This reverts commit 0927318.

Revert "Introduce Prettify util function; Migrate struct.String to Prettify(struct)"

This reverts commit 1bb4bbb.

Revert "Refactor: update acs import path to avoid conflict with ecsacs model"

This reverts commit c0fcae0.

Revert "Remove v1 acs model. Introduce AckRequest as a generic struct."

This reverts commit d924b17.

Revert "Migrate ecsacs.UpdateInfo to types.UpdateInfo"

This reverts commit d2e19f2.

Revert "Migrate PayloadMessage to PayloadInput"

This reverts commit 7d3282b.

Revert "Migrate ecsacs.Task's Attachments"

This reverts commit 3452c4a.

Revert "Migrate TaskManifestMessage to TaskManifestInput"

This reverts commit 0a51a28.

Revert "Migrate Attachment to types.Attachment"

This reverts commit 78d779f.

Revert "Migrate ConfirmAttachmentMessage to ConfirmAttachmentInput"

This reverts commit 884d99f.

Revert "Migrate AttachInstanceNetworkInterfacesMessage to AttachInstanceNetworkInterfacesInput"

This reverts commit fc7adc2.

Revert "Migrate ElasticNetworkInterfaces"

This reverts commit b123368.

Revert "Migrate AttachTaskNetworkInterfacesMessage to AttachTaskNetworkInterfacesInput"

This reverts commit b0663ce.

Revert "Update StageUpdateMessage to StageUpdateInput"

This reverts commit 7c704cf.

Revert "Update PerformUpdateMessage to PerformUpdateInput"

This reverts commit c47d6be.

Revert "Migrate NackRequest to UpdateFailureInput"

This reverts commit 2f38c52.

Revert "Migrate CloseMessage to PollOutput"

This reverts commit d35c5e1.

Revert "Migrate TaskStopVerificationMessage/TaskStopVerificationInput and TaskStopVerificationAck/TaskStopVerificationOutput"

This reverts commit fd1f79f.

Revert "Migrate IAMRoleCredentialsMessage/RefreshTaskIAMRoleCredentialsInput and IAMRoleCredentialsAckRequest/RefreshTaskIAMRoleCredentialsOutput"

This reverts commit 2b91941.

Revert "Migrate HeartbeatMessage/HeartbeatInput and HeartbeatAckRequest/HeartbeatOutput"

This reverts commit 2fa86ca.

Revert "Migrate ACS Error Types and Input/Message"

This reverts commit 29e7332.

Revert "Replace acs model to the generated acs client"

This reverts commit 9db9b92.

Revert "Add ACS model and generate client"

This reverts commit cea3f80.

* Update ACS and websocket clients to use V2. Keep TCS client to V1

* fixing unit tests in ecs-agent/

* Consuming V2 for ACS in agent/

* fixing go mod and vendors after rebasing

---------

Co-authored-by: Thean Lim <[email protected]>
Co-authored-by: mye956 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants