-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: New Consistency group Samples : Add Disk, List Disks, Remove Disk #12796
base: main
Are you sure you want to change the base?
Conversation
project_id: str, | ||
disk_name: str, | ||
disk_location: str, | ||
disk_region_flag: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if replacing the disk_region_flag
with disk_region_flag = disk_location[-1].isdigit()
would make the sample more readable or easier to use? I personally always like when the code I want to use is able to automatically detect what kind of values I pass.
On the other hand, that is less explicit and introduces a very slight chance that the code will fail one day, if Google decides to change the region and zone naming schema.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your thoughts. I'm quite certain that if Google ever decides to change the naming policy for regions and zones, this code will break. In fact, I imagine many things would need fixing if such a change happens! 😅😬 But will it happen anytime soon? I don't think so :)
I also appreciate when code takes care of things for me automatically. Requiring users to explicitly set a disk_region_flag
could lead to more errors on their part.
So, I'll make adjustments to the sample by modifying the disk creation and removing logic to make these functions more user-friendly 🙌
Description
New Consistency Group Samples for doc.page :
compute_consistency_group_add_disk
compute_consistency_group_disks_list
compute_consistency_group_remove_disk
Checklist
nox -s py-3.9
(see Test Environment Setup)nox -s lint
(see Test Environment Setup)