@@ -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