-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[IAM] Update quickstart samples #2829
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
I just realized that I needed to change this flow--the testIamPermissions method tests the permissions of the caller (in this case, whatever service account the user has created) and not the member. I updated the sample to instruct the user to grant the role to the service account used to run the quickstart. This adds a complication in that the service account used in quickstarts by default is usually granted the owner role, so the testPermissions call would always succeed, regardless of whether or not the role grant was successful. We're hoping to downscope the permissions granted to quickstart service accounts in the future, so this may become a non-issue, though the date of that work is uncertain. If you have a better solution, please let me know. |
Update: I decided to try and refactor the code to remove the testIamPermissions call, instead just printing out the binding that was added to the policy. I'll comment here when I've updated the code. |
The thread isn't updating with the new commit for some reason, but I did push the new version to the quickstart branch. Hopefully github will catch up soon? |
Looks like it's updated now. |
Melanie, please join the org at |
Done |
Hi Melanie, You have one checkstyle violation which I've posted below, if you could fix your PR, that's all that's needed. There are also a bunch of suggestions from the linter that are optional, but it would be good if you at least took a look at. I've posted them below the checkstyle issue. Java 8
Linter issues:
|
iam/api-client/src/main/java/com/google/iam/snippets/QuickstartV2.java
Outdated
Show resolved
Hide resolved
iam/api-client/src/main/java/com/google/iam/snippets/QuickstartV2.java
Outdated
Show resolved
Hide resolved
iam/api-client/src/test/java/com/google/iam/snippets/QuickstartV2Tests.java
Outdated
Show resolved
Hide resolved
Your PR has attempted to merge for 3 hours. Please check that all required checks have passed, you have an automerge label, and that all your reviewers have approved the PR |
Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, or one of your required reviews was not approved. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot. |
iam/api-client/src/main/java/com/google/iam/snippets/QuickstartV2.java
Outdated
Show resolved
Hide resolved
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 rename the package to iam.snippets
Can you explain why? All of the other samples have com.google.iam.snippets. |
Someone didn't catch it. They aren't supposed to ever use Please read our Sample format guidelines |
Gotcha. Done. |
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 - consider the comment on the test before merging. (you may wish to fix it, we typically use a UUID instead)
Thank you for changing the package everywhere. That will change the path in the docs you'll wan't let a TW know or prep a CL yourself to fix the docs for the updated paths, before merging.
iam/api-client/src/test/java/iam/snippets/QuickstartV2Tests.java
Outdated
Show resolved
Hide resolved
Ah, didn't realize you are a TW, then you'll want to do a code search for include code usage. Feel free to IM me for more info. Also, feel free to ping one of us when you want to merge. |
Adding new quickstart samples to support the new quickstart flow (staged: https://cloud.devsite.corp.google.com/iam/docs/quickstart-client-libraries#iam_quickstart-csharp). The new flow better demonstrates the core functionality of IAM.
The old samples will need to stay around until the doc update is completed. After that, I can put in a separate PR to remove them.