-
Notifications
You must be signed in to change notification settings - Fork 2.9k
docs(compute-samples): adding machine type update and regional disk samples #7707
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
Conversation
Here is the summary of changes. You are about to add 5 region tags.
This comment is generated by snippet-bot.
|
compute/cloud-client/src/main/java/compute/disks/AttachDisk.java
Outdated
Show resolved
Hide resolved
compute/cloud-client/src/main/java/compute/disks/AttachDisk.java
Outdated
Show resolved
Hide resolved
compute/cloud-client/src/main/java/compute/disks/AttachDisk.java
Outdated
Show resolved
Hide resolved
compute/cloud-client/src/main/java/compute/disks/ResizeDisk.java
Outdated
Show resolved
Hide resolved
compute/cloud-client/src/main/java/compute/disks/ResizeRegionalDisk.java
Outdated
Show resolved
Hide resolved
compute/cloud-client/src/main/java/compute/disks/ResizeRegionalDisk.java
Outdated
Show resolved
Hide resolved
|
||
Operation response = instancesClient | ||
.setMachineTypeAsync(projectId, zone, instanceName, machineTypeRequest) | ||
.get(3, TimeUnit.MINUTES); |
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.
Any reason to set 3 minutes for the timeout?
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.
Followed the same pattern from the other compute samples. No specific reason.
.get(3, TimeUnit.MINUTES); | ||
|
||
if (response.hasError()) { | ||
System.out.println("Machine type update failed! " + response); |
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.
What types of errors do we expect that wouldn't be thrown during the operation? Can we show users how to handle them?
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.
ditto, Followed the same pattern from the other compute samples.
Python Reference: https://github.com/GoogleCloudPlatform/python-docs-samples/pull/8992/files#diff-9dcee92af6eb54e1cd2c96bbdc292fc4857452f209215aa0204e461c7ee49d9bR62-R69
But AFAIK, I haven't encountered any errors that were not raised as exceptions.
.setDisksResizeRequestResource(DisksResizeRequest.newBuilder() | ||
.setSizeGb(newSizeGb) | ||
.build()) | ||
.setDisk(match[5]) |
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.
This doesn't take the full disk resource path? This seems unnecessarily hard. Is there another way to achieve this? If not You should add more comments to why you are using the matcher.
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.
Yes, I believe this is due to multiple formats being accepted. See: https://github.com/GoogleCloudPlatform/python-docs-samples/pull/8992/files#diff-00f22f3a9fa3fb85b7b4340eaeb0aefece4b60556f7efd7e7bf58d684b496f2bR88-R91
I'll double check this and update the sample. Thanks for calling this out.
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.
Updated the code to simplify. This will result in code discrepancy between the Java and Python versions. But using matcher is an over-kill for this situation and hence added additional params.
Adding samples needed for this page.