Skip to content

Conversation

Hweinstock
Copy link
Contributor

@Hweinstock Hweinstock commented Dec 3, 2024

Problem

There is a lot of duplicate code across the sdk clients. Additionally, we want to only construct the clients once (per wrapper), and have these clients call destroy.

Solution

Note: the line changes are mostly the added dependency of an @aws-sdk client and its hundreds of dependencies.

  • create abstract class ClientWrapper to minimize code dupe.
  • cache sdk clients on creation within the wrappers.
  • migrate ssm client to sdkv3, using new common wrapper class.

Alternative Solution

  • Make all wrappers singletons so clients are created once for the toolkit lifetime.
  • Pro: Makes it impossible for a client to be re-created.
  • Con: Zero flexibility when it comes to client lifetime. All sdk clients would be created whenever their wrapper is referenced. Without being very careful, we could create many SDK clients up front that we never use and can't delete.

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.

License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Hweinstock Hweinstock changed the base branch from master to feature/sdkv3 December 3, 2024 22:18
@Hweinstock Hweinstock changed the title refactor(sdkv3): migrate ssm client refactor(sdkv3): migrate ssm client (WIP) Dec 3, 2024
Hweinstock added a commit that referenced this pull request Jan 27, 2025
## Problem
Start the transition to sdkv3. This PR is just a start and is still
missing a lot of features (see future work).
Originally part of #5940,
but decided to split it up.

## Solution
- Do not overwrite existing builder to allow for incremental transition
to V3.
- A barebones working model, with the telemetry middleware implemented.
- Expansion of testing for client construction.

## Future Work
- Implement middleware for other relevant pieces (custom endpoints,
logging, etc.). Hweinstock#4
- Increase testing coverage, specifically with credentials refreshing.
(Hweinstock#3)
- Migrate clients. (ssm:
#6137)
- Reduce boilerplate for client wrappers and have all clients call
destroy.
- Avoid recreating clients on each request, use singleton instead. 
- replace hand-made mocks with those from sdk mocking library:
https://aws.amazon.com/blogs/developer/mocking-modular-aws-sdk-for-javascript-v3-in-unit-tests/
---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
@Hweinstock Hweinstock changed the title refactor(sdkv3): migrate ssm client (WIP) refactor(sdkv3): migrate ssm client Jan 27, 2025
@Hweinstock Hweinstock marked this pull request as ready for review January 27, 2025 20:46
@Hweinstock Hweinstock requested a review from a team as a code owner January 27, 2025 20:46
@Hweinstock Hweinstock merged commit eeda867 into aws:feature/sdkv3 Feb 11, 2025
17 checks passed
@Hweinstock Hweinstock deleted the sdkv3/migrateSSM branch February 11, 2025 19:22
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.

3 participants