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

credentials/alts: Update ALTS "New" APIs #1921

Merged
merged 2 commits into from
Mar 19, 2018

Conversation

cesarghali
Copy link
Contributor

@cesarghali cesarghali commented Mar 16, 2018

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 and alts.NewServer to alts.NewClientCreds and alts.NewServerCreds, respectively.

This API is only used by the interop/alts/client/client.go.

@cesarghali cesarghali added the Type: API Change Breaking API changes (experimental APIs only!) label Mar 16, 2018
Copy link
Member

@dfawley dfawley left a 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.

}

// DefaultClientOptions creates a default (empty) ClientOptions.
func DefaultClientOptions() *ClientOptions {
Copy link
Member

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).

Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Contributor Author

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.

@cesarghali cesarghali changed the title credentials/alts: Make NewClient API more flexible credentials/alts: Update ALTS "New" APIs Mar 17, 2018
@cesarghali
Copy link
Contributor Author

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.

@dfawley dfawley merged commit 211a7b7 into grpc:master Mar 19, 2018
@cesarghali cesarghali deleted the alts_new_client_api branch March 19, 2018 17:35
@menghanl menghanl added this to the 1.11 Release milestone Mar 27, 2018
lyuxuan pushed a commit to lyuxuan/grpc-go that referenced this pull request Apr 2, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Sep 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: API Change Breaking API changes (experimental APIs only!)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants