Skip to content

Commit 60f2a2b

Browse files
Update Quickstart.java comments
Includes changing "member" to "principal" and linking to principal identifiers page instead of specifying recommended format.
1 parent 772c39c commit 60f2a2b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

iam/snippets/src/main/java/Quickstart.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ public static void main(String[] args) throws IOException {
3434
String projectId = "your-project";
3535
// TODO: Replace with your service account name.
3636
String serviceAccount = "your-service-account";
37-
// TODO: Replace with the ID of your member in the form "user:member@example.com"
38-
String member = "your-member";
37+
// TODO: Replace with the ID of your principal.
38+
// For examples, see https://cloud.google.com/iam/docs/principal-identifiers
39+
String member = "your-principal";
3940
// The role to be granted.
4041
String role = "roles/logging.logWriter";
4142

@@ -56,10 +57,10 @@ public static void quickstart(String projectId, String serviceAccount,
5657
// This client only needs to be created once, and can be reused for multiple requests.
5758
try (IAMClient iamClient = IAMClient.create()) {
5859

59-
// Grants your member the "Log writer" role for your project.
60+
// Grants your principal the "Log writer" role for your project.
6061
addBinding(iamClient, projectId, serviceAccount, member, role);
6162

62-
// Get the project's policy and print all members with the "Log Writer" role
63+
// Get the project's policy and print all principals with the "Log Writer" role
6364
Policy policy = getPolicy(iamClient, projectId, serviceAccount);
6465

6566
Binding binding = null;
@@ -80,7 +81,7 @@ public static void quickstart(String projectId, String serviceAccount,
8081
}
8182
System.out.println();
8283

83-
// Removes member from the "Log writer" role.
84+
// Removes principal from the "Log writer" role.
8485
removeMember(iamClient, projectId, serviceAccount, member, role);
8586
}
8687
}
@@ -107,7 +108,7 @@ public static void addBinding(IAMClient iamClient, String projectId, String serv
107108
}
108109

109110
if (binding != null) {
110-
// If binding already exists, adds member to binding.
111+
// If binding already exists, adds principal to binding.
111112
binding.getMembersList().add(member);
112113
} else {
113114
// If binding does not exist, adds binding to policy.
@@ -127,7 +128,7 @@ public static void removeMember(IAMClient iamClient, String projectId, String se
127128
// Gets the project's policy.
128129
Policy.Builder policy = getPolicy(iamClient, projectId, serviceAccount).toBuilder();
129130

130-
// Removes the member from the role.
131+
// Removes the principal from the role.
131132
Binding binding = null;
132133
for (Binding b : policy.getBindingsList()) {
133134
if (b.getRole().equals(role)) {

0 commit comments

Comments
 (0)