Update modify_policy_add_member.py#13070
Conversation
ghost
left a comment
There was a problem hiding this comment.
Hi team,
I'm currently reviewing this pull request and will provide my feedback shortly. In the meantime, here's a summary for you and other reviewers to quickly get up to speed:
This pull request updates the modify_policy_add_member.py sample script. The intent is to improve the clarity and accuracy of the code by renaming the member parameter to principal.
Here's a breakdown of the changes:
- File Changed:
iam/cloud-client/snippets/modify_policy_add_member.py - Changes: The parameter
memberin themodify_policy_add_memberfunction and its usage in the example code snippet has been renamed toprincipal. This change aligns the parameter name with the more accurate and widely used term for identifying IAM principals. The change is reflected in both the function definition (lines 21-23 and 37) and the example usage (lines 52-55).
The updated parameter name enhances readability and consistency with Google Cloud IAM documentation, making the sample code easier to understand and use.
I'll be providing a more detailed review shortly.
A little haiku to brighten your day:
Code flows like a stream,
Clarity found in each change,
Bugs flee in the night.
ghost
left a comment
There was a problem hiding this comment.
This pull request renames the member parameter to principal in the modify_policy_add_member function and its usage. This change improves clarity by using a more accurate term for the entity being granted access. However, there's a minor issue in the test case that needs to be addressed. I've also included some suggestions based on the Google Python Style Guide to enhance code readability and maintainability.
|
|
||
| def modify_policy_add_member( | ||
| project_id: str, role: str, member: str | ||
| project_id: str, role: str, principal: str |
| 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.
Description
Fixes #
Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.
Checklist
nox -s py-3.9(see Test Environment Setup)nox -s lint(see Test Environment Setup)