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

chore(sessions): add UserAgentExtras method to Provider #4347

Merged

Conversation

efekarakus
Copy link
Contributor

@efekarakus efekarakus commented Jan 10, 2023

I couldn't find a way to write a unit test that ensures the user-agent will have the extras on new requests.
However, I tested the method manually in copilot app show and I can see the new extras added on requests.

Related #4208

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.

@efekarakus efekarakus requested a review from a team as a code owner January 10, 2023 19:28
@efekarakus efekarakus requested review from dannyrandall and removed request for a team January 10, 2023 19:28
@github-actions
Copy link

github-actions bot commented Jan 10, 2023

🍕 Here are the new binary sizes!

Name New size (kiB) size (kiB) Delta (%)
macOS (amd) 48432 47904 🥺 +1.10
macOS (arm) 49108 48576 🥺 +1.10
linux (amd) 42600 42124 🥺 +1.13
linux (arm) 41924 41472 🥺 +1.09
windows (amd) 39360 38940 🥺 +1.08

@@ -70,6 +70,14 @@ func UserAgentExtras(extras ...string) func(*Provider) {
}
}

// UserAgentExtras adds additional User-Agent extras to cached sessions and any new sessions.
func (p *Provider) UserAgentExtras(extras ...string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What extra things happens here in addition to existing UserAgentExtras function? Can't we use existing UserAgentExtras function for adding overrides cdk or overrides cfnpatch agents?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The UserAgentExtras function can only be used in the constructor, the method is so that you can add any extras at any point.

So we can start with a provider that's like this for a command:

provider := sessions.NewProvider(sessions.UserAgentExtras("svc package"))

....
if override.IsCDK() {
   provider.UserAgentExtras("cdk override")
}

@mergify mergify bot merged commit 208ecd9 into aws:mainline Jan 11, 2023
Sprint 🏃‍♀️ automation moved this from In review to Pending release Jan 11, 2023
@efekarakus efekarakus deleted the chore/sessions-enable-additional-useragent branch January 11, 2023 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Sprint 🏃‍♀️
  
Pending release
Development

Successfully merging this pull request may close these issues.

None yet

3 participants