Skip to content

Add user agent #179

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 9 commits into from
Jan 24, 2019
Merged

Add user agent #179

merged 9 commits into from
Jan 24, 2019

Conversation

AllanZhengYP
Copy link
Contributor

@AllanZhengYP AllanZhengYP commented Jan 22, 2019

I added 2 packages: util-user-agent-node and util-user-agent-browser, which will be imported accordingly when generating node and browser service clients. The 2 packages will provide default user-agent value by a middleware in the service client.

The last commit is regenerating service clients. When reviewing you can ignore the changes from the laster commit. But the genrated service clients give you the idea of how user-agent is preserved.

@@ -0,0 +1 @@
# @aws-sdk/util-user-agent-node
Copy link
Contributor

Choose a reason for hiding this comment

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

Need a more flushed out Readme

@@ -0,0 +1 @@
# @aws-sdk/util-user-agent-browser
Copy link
Contributor

Choose a reason for hiding this comment

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

Need a more flushed out Readme

"@aws-sdk/config-resolver": "^0.1.0-preview.1",
"@aws-sdk/core-handler": "^0.1.0-preview.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you revert this? Going from Alpha to some unordered list does not seem to add value and makes it hard to see what changed

@@ -23,32 +23,34 @@
},
"license": "Apache-2.0",
"dependencies": {
"tslib": "^1.8.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, what is the value in the shuffle?

@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

2019

@@ -24,7 +24,7 @@ export class ClientGenerator {
constructor(
model: TreeModel,
target: RuntimeTarget,
customizations: Array<CustomizationDefinition> = []
customizations: Array<CustomizationDefinition> = [],
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove , Either we are moving to aways trailing or we should stick to never...

@@ -10,7 +10,7 @@ export class Configuration {
constructor(
private readonly prefix: string,
private readonly target: RuntimeTarget,
private readonly config: ConfigurationDefinition
private readonly config: ConfigurationDefinition,
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove , Either we are moving to aways trailing or we should stick to never...

@@ -62,6 +62,7 @@ export class Client {
${configurationImports.toString()}
import {InputTypesUnion} from './types/InputTypesUnion';
import {OutputTypesUnion} from './types/OutputTypesUnion';
import {clientVersion, ServiceMetadata} from './model/ServiceMetadata';
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we importing something we don't use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These will be used in the client for adding user-agent header. If you see the generated service clients you will see these imports are always referred.

@@ -63,6 +64,7 @@ export function customizationsFromModel(
],
commands: {},
},
signatureCustomizations(model, target)
signatureCustomizations(model, target),
userAgentCustomization(target),
Copy link
Contributor

Choose a reason for hiding this comment

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

Trailing ,

step: 'build',
priority: 0,
imports,
expression: `${packageNameToVariable('@aws-sdk/middleware-header-default')}.headerDefault({'${runtime === 'node' ? 'User-Agent' : 'X-Amz-User-Agent'}': ${packageNameToVariable(defaultValuePackageName)}.defaultUserAgent(ServiceMetadata.serviceId || ServiceMetadata.endpointPrefix, clientVersion)})`,
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems overly complicated and long for a single line.

@srchase
Copy link
Contributor

srchase commented Jan 24, 2019

The additional changes on this look good!

@AllanZhengYP AllanZhengYP merged commit 587c533 into aws:master Jan 24, 2019
@lock
Copy link

lock bot commented May 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants