aws / amazon-ecs-agent

Amazon Elastic Container Service Agent
http://aws.amazon.com/ecs/
Apache License 2.0
2.08k stars 616 forks source link

Codegen aws-sdk-go-v2 clients #4406

Closed tinnywang closed 2 weeks ago

tinnywang commented 1 month ago

Summary

Add support for generating our own bespoke ECS client that's compatible with aws-sdk-go-v2.

Implementation details

aws-sdk-go-v2 uses the Smithy Gradle plugin to generate client code.

At a high level, the SDK

  1. generates smithy-build.json files for every JSON model in the aws-models directory
  2. generates clients from the definitions in the smithy-build.json files
  3. copies the generated clients from the Smithy build directory into service directories and generates go.mod files for each service package

We simulate this process by building a Docker image with

  1. Go >= 1.20 (needed by smithy-go)
  2. Java >= 17 (needed by Gradle)
  3. the smithy-go Gradle plugin
  4. the aws-sdk-go-v2 repo

and then volume mounting the aws-sdk-go-v2/aws-models and aws-sdk-go-v2/service directories to the container. When the container runs, it reads the JSON models from aws-sdk-go-v2/aws-models and writes the generated client code and go.mod files to packages in aws-sdk-go-v2/service.

Notes

replace github.com/aws/aws-sdk-go-v2/service/ecs => ../aws-sdk-go-v2/service/ecs



### Testing
This PR only includes codegen changes and the generated ECS client. The client is not used anywhere yet.

In a separate branch, I have replaced our `aws-sdk-go` ECS client with our bespoke `aws-sdk-go-v2` ECS client and tested that everything compiles.

New tests cover the changes: no

### Licensing

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