-
Notifications
You must be signed in to change notification settings - Fork 20
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
client: functional opts for constructor #54
Conversation
Co-Authored-By: Brian Chen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of functional options! I have a comment about NewAuthClient
but otherwise it looks good.
I was also wondering if the new token client config should be in cmd/config
instead, for consistency? And calling it defaultclient
might be a bit misleading?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I just have a small comment.
v2/client/idtoken.go
Outdated
@@ -1,25 +1,22 @@ | |||
package main | |||
package client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nitpick, but it might be possible to confuse Google's idtoken library used by WithIDTokenAuth
with this file. Maybe it should be called default_idtoken
/default_token
to match it with WithDefaultTokenAuth
?
8a91a18
to
2e2e7d5
Compare
Update the
client
package to preferNewClient()
with functional options.This removes the need for multiple constructors (we were up to 3):
NewAuthClient
is marked deprecatedNewCustomClient
, which was recently introduced by Add support for ADC using voucher_client #53 , is removed.This removes the need for
SetFooBar()
post-construction intializers (we were up to 2):SetBasicAuth
is marked deprecatedSetUserAgent
, which was recently added by voucher-client: send User-Agent #52 , is removed.The highest risk change here is to the
voucher-client
binary, wheregetVoucherClient()
is refactored to build[]client.Options
and fall-through.Related