Apply code review suggestions to replace "member" with "principal" in additional places#13071
Conversation
Per code review suggestions, replace additional instances of "member" with "principal"
ghost
left a comment
There was a problem hiding this comment.
Hi @melaniedejong and reviewers,
I'm currently reviewing this pull request and will provide my feedback shortly. In the meantime, here's a summary to help everyone quickly understand the changes:
This pull request addresses code review suggestions by replacing instances of the term "member" with "principal" for improved clarity and consistency. The changes are focused on enhancing the accuracy of the terminology used in relation to IAM roles and permissions.
Here's a breakdown of the changes:
-
Files Modified:
iam/cloud-client/snippets/modify_policy_add_member.py- The parameter
memberin themodify_policy_add_memberfunction was renamed toprincipal(lines 21-22, 55). The function's docstring was also updated to reflect this change (lines 28-29).
- The parameter
iam/cloud-client/snippets/modify_policy_remove_member.py- The parameter
memberin themodify_policy_remove_memberfunction was renamed toprincipal(lines 21-22, 55). The function's docstring was updated (lines 28-29). The line removing the member from the list was also updated to useprincipalinstead ofmember(line 38).
- The parameter
-
Overall Intent: To improve the accuracy and consistency of terminology related to IAM principals within the code snippets.
This small change makes a big difference,
In clarity and precision, it's a win.
No more confusion, a smoother flow,
Code's elegance, now starts to show.
ghost
left a comment
There was a problem hiding this comment.
This pull request replaces instances of "member" with "principal" in modify_policy_add_member.py and modify_policy_remove_member.py files, which improves clarity and consistency with IAM terminology. However, there's a minor issue in modify_policy_add_member.py where the variable principal is not defined in the if __name__ == "__main__" block. Also, the variable member is still used in modify_policy_remove_member.py.
| member = f"serviceAccount:test-service-account@{project_id}.iam.gserviceaccount.com" | ||
|
|
||
| modify_policy_add_member(project_id, role, member) | ||
| modify_policy_add_member(project_id, role, principal) |
There was a problem hiding this comment.
The variable principal is not defined. Should this be using the member variable defined on line 53? Or should we rename that variable to principal to match the function parameter?
| modify_policy_add_member(project_id, role, principal) | |
| modify_policy_add_member(project_id, role, member) |
| if member in bind.members: | ||
| bind.members.remove(member) | ||
| bind.members.remove(principal) |
There was a problem hiding this comment.
The variable member is still used here. To maintain consistency, should this be changed to principal to match the function parameter and docstring?
| if member in bind.members: | |
| bind.members.remove(member) | |
| bind.members.remove(principal) | |
| if principal in bind.members: | |
| bind.members.remove(principal) |
No description provided.