Skip to content

Commit 0a34be5

Browse files
Update AddMember.java comments (#9886)
Includes changing "member" to "principal" and linking to principal identifiers page instead of specifying recommended format.
1 parent 60f2a2b commit 0a34be5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

iam/snippets/src/main/java/AddMember.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ public static void main(String[] args) {
2626
Policy policy = Policy.newBuilder().build();
2727
// TODO: Replace with your role.
2828
String role = "roles/existing-role";
29-
// TODO: Replace with your member.
30-
String member = "user:member-to-add@example.com";
29+
// TODO: Replace with your principal.
30+
// For examples, see https://cloud.google.com/iam/docs/principal-identifiers
31+
String member = "principal-id";
3132

3233
addMember(policy, role, member);
3334
}
3435

35-
// Adds a member to a pre-existing role.
36+
// Adds a principal to a pre-existing role.
3637
public static Policy addMember(Policy policy, String role, String member) {
3738
List<Binding> newBindingsList = new ArrayList<>();
3839

@@ -44,7 +45,7 @@ public static Policy addMember(Policy policy, String role, String member) {
4445
}
4546
}
4647

47-
// Update the policy to add the member.
48+
// Update the policy to add the principal.
4849
Policy updatedPolicy = policy.toBuilder()
4950
.clearBindings()
5051
.addAllBindings(newBindingsList)

0 commit comments

Comments
 (0)