-
Notifications
You must be signed in to change notification settings - Fork 440
feat: resolve ambiguous ServiceAccountConfig constructors (#15886) #16076
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,13 +142,22 @@ class ImpersonateServiceAccountConfig : public Credentials { | |
| Options options_; | ||
| }; | ||
|
|
||
| struct ServiceAccountFilePath { | ||
| std::string value; | ||
| explicit ServiceAccountFilePath(std::string p) : value(std::move(p)) {} | ||
| }; | ||
|
|
||
| struct ServiceAccountJsonObject { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Google C++ Style Guide requires a comment for every class and struct describing its purpose. This struct is used to disambiguate the /// A wrapper for a service account JSON object string.
struct ServiceAccountJsonObject {References
|
||
| std::string value; | ||
| explicit ServiceAccountJsonObject(std::string j) : value(std::move(j)) {} | ||
| }; | ||
|
|
||
| class ServiceAccountConfig : public Credentials { | ||
| public: | ||
| // Only one of json_object or file_path should have a value. | ||
| // TODO(#15886): Use the C++ type system to make better constructors that | ||
| // enforces this comment. | ||
| ServiceAccountConfig(absl::optional<std::string> json_object, | ||
| absl::optional<std::string> file_path, Options opts); | ||
| // Just declarations ending with a semicolon | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| explicit ServiceAccountConfig(ServiceAccountFilePath path, Options opts); | ||
|
|
||
| explicit ServiceAccountConfig(ServiceAccountJsonObject json, Options opts); | ||
|
|
||
| absl::optional<std::string> const& json_object() const { | ||
| return json_object_; | ||
|
|
||
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.
The Google C++ Style Guide requires a comment for every class and struct describing its purpose. This struct is used to disambiguate the
ServiceAccountConfigconstructors.References