Skip to content
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

feat(middleware-user-agent): add client config for userAgentAppId #6524

Merged
merged 26 commits into from
Oct 3, 2024

Conversation

siddsriv
Copy link
Contributor

@siddsriv siddsriv commented Sep 26, 2024

Issue

Internal JS-5173

Description

Adds a client config field for userAgentAppId

Testing

Unit tests:

  • util-user-agent-node
 PASS  src/defaultUserAgent.spec.ts
  createDefaultUserAgentProvider
    ✓ should return basic node default user agent (5 ms)
    ✓ should set crt available key if aws-crt is available in runtime (1 ms)
    ✓ should skip api version if service id is not supplied (1 ms)
    ✓ should add AWS_EXECUTION_ENV (2 ms)
    ✓ should add app id if available (2 ms)

Test Suites: 1 passed, 1 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        2.86 s
Ran all test suites.
Done in 3.44s.
  • util-user-agent-browser
Location: /local/home/sidddsri/workspace/aws-sdk-js-v3/packages/util-user-agent-browser
.
 PASS  src/index.native.spec.ts
 PASS  src/index.spec.ts

Test Suites: 2 passed, 2 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        4.485 s
  • middleware-user-agent
 PASS  src/user-agent-middleware.spec.ts
  userAgentMiddleware
    ✓ should include appId in user agent when provided (1 ms)
    ✓ should include long appId in user agent when provided (1 ms)
  • Client config option is generated in runtimeConfig.ts:
.
.
    useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS),
    userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS),
.
.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@siddsriv siddsriv requested a review from a team as a code owner September 26, 2024 16:35
@siddsriv siddsriv marked this pull request as draft September 26, 2024 16:35
@siddsriv siddsriv marked this pull request as ready for review October 1, 2024 15:37
@siddsriv siddsriv changed the title feat: add client config for userAgentAppId feat(middleware-user-agent): add client config for userAgentAppId Oct 1, 2024
@@ -41,5 +41,6 @@ export const getRuntimeConfig = (config: EchoServiceClientConfig) => {
}),
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
streamCollector: config?.streamCollector ?? streamCollector,
userAgentAppId: config?.userAgentAppId ?? loadNodeConfig(NODE_APP_ID_CONFIG_OPTIONS),
Copy link
Member

Choose a reason for hiding this comment

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

Since defaultUserAgent is deprecated, the call on line 33 should be changed to createDefaultUserAgentProvider.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do that codegen change to clients in a separate PR

@trivikr trivikr merged commit 2990ea8 into aws:main Oct 3, 2024
6 checks passed
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