-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add IAM doc code snippets #1172
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
Conversation
roles/iam.securityReviewer
"message" : "You don't have permission to query grantable roles for //cloudresourcemanager.googleapis.com/projects/null.", |
|
The "GOOGLE_CLOUD_PROJECT" environment variable is set with the project ID during tests in this package. |
| @@ -0,0 +1,59 @@ | |||
| // Copyright 2018 Google Inc. | |||
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.
Please use "LLC", as well as javadoc style comments in this and all other java files, i.e.
/** Copyright 2018 Google LLC
*
- Licensed...
*/
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 -- however, this now causes the tests to fail:
RegexpHeader: Line does not match expected header line of '^\W+*?\W*Copyright 20\d\d Google Inc.$'.
Seems like the test needs to be updated to use LLC...
iam/api-client/pom.xml
Outdated
| <parent> | ||
| <groupId>com.google.cloud.samples</groupId> | ||
| <artifactId>shared-configuration</artifactId> | ||
| <version>1.0.9</version> |
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.
Please update this to version 1.0.11.
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 results in an error. Also the root pom.xml and many of the other samples I looked at use 1.0.9 so I'm not sure why this change is needed?
Failure to find com.google.cloud.samples:shared-configuration:pom:1.0.11 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
| String project = System.getenv("GOOGLE_CLOUD_PROJECT"); | ||
| String resource = "//cloudresourcemanager.googleapis.com/projects/" + project; | ||
|
|
||
| GrantableRoles.main(new String[] {resource}); |
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.
Can you intercept the output of the program running and then verify that the output is what you'd expect? There are several examples of doing this in other IT's in this repo, just search for "bout" and you'll find one.
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
|
|
||
| @Test | ||
| public void testQuickstart() throws Exception { | ||
| Quickstart.main(new String[0]); |
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.
Here as well, please verify the output matches what is expected when this runs. We don't just want to catch exceptions, we want the tests to verify that the output hasn't changed. Some calls will return error messages without actually throwing any exceptions.
| @Test | ||
| public void testServiceAccounts() throws Exception { | ||
|
|
||
| String projectId = System.getenv("GOOGLE_CLOUD_PROJECT"); |
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.
Same
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
|
Addressed all feedback. |
|
Ah, I thought 1.0.11 was available, but try 1.0.10. If the tests still fail with that LLC/Inc change, then you can change them back and hopefully 1.0.11 will address it. |
|
10.0.10 worked |
|
@dpebot Merge when green |
|
Okay! I'll merge when all statuses are green and all reviewers approve. |
|
It looks like all statuses are green and a reviewer has approved -- what else needs to happen to trigger dpebot? |
Snippets for: