-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
credentials/alts: Update ALTS "New" APIs #1921
Conversation
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.
This seems fine in general, and provides a good way of extending the API in the future without breaking existing users.
I just noticed there is a flag defined in this package. Flags in a non-main package are to be avoided if at all possible. I would recommend removing it ASAP.
credentials/alts/alts.go
Outdated
} | ||
|
||
// DefaultClientOptions creates a default (empty) ClientOptions. | ||
func DefaultClientOptions() *ClientOptions { |
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.
This should not be necessary; your zero-value defaults should all be sane (and I see you do end up with the zero value, so this is true).
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.
Done!
type ClientOptions struct { | ||
// TargetServiceAccounts contains a list of expected target service | ||
// accounts. | ||
TargetServiceAccounts []string |
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.
Is this always (or nearly always) supposed to be non-empty? Or is it common to omit it?
If it's commonly used, it probably should be left as a parameter.
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.
This is not commonly used. I'm expecting callers will set this in very few situations.
7b15bb1
to
0faf247
Compare
Thanks for the comments Doug. Regarding the flag, there was a discussion about it in #1865. I'm happy to discuss it more offline and we do further changes in a separate PR. |
Change the
alts.NewClient
API to take a struct containing all client-side options instead of passing them using parameters. This allows adding more options in the future without breaking the existing API or having to create a new one.This API also changes
alts.NewClient
andalts.NewServer
toalts.NewClientCreds
andalts.NewServerCreds
, respectively.This API is only used by the
interop/alts/client/client.go
.