Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

feat: add vm.update() method #478

Merged
merged 2 commits into from
Aug 10, 2020

Conversation

stephenplusplus
Copy link
Contributor

Fixes #477

We currently have a "setMetadata()" method on our VM class. Unlike our other methods by the same name, the VM's will not update the remote resource as a whole-- instead, it only updates the metadata object within the resource. In other words, a VM's structure looks like:

{
  "name": "...",
  "deletionProtection": false,
  "metadata": {
    "myCustomProperty": true
  }
}

vm.setMetadata() will only change the "metadata" object. This PR adds vm.update(), which has control of the whole thing.

Things to note:

  • vm.getMetadata() returns the whole record, not just the embedded "metadata" object.
  • vm.update() is not atomic. It pulls the latest metadata, merges with the new, then sends the update in another call.

@stephenplusplus stephenplusplus requested a review from a team as a code owner August 5, 2020 19:24
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 5, 2020
@memyselfandm
Copy link

This is exactly what I was looking for, thanks for the quick add.

@stephenplusplus stephenplusplus added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 10, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 10, 2020
@codecov
Copy link

codecov bot commented Aug 10, 2020

Codecov Report

Merging #478 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #478   +/-   ##
=======================================
  Coverage   99.60%   99.61%           
=======================================
  Files          22       22           
  Lines       11781    11840   +59     
=======================================
+ Hits        11735    11794   +59     
  Misses         46       46           
Impacted Files Coverage Δ
src/vm.js 99.56% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d3a41a...f7b0efd. Read the comment docs.

@stephenplusplus stephenplusplus merged commit 7bcb79c into googleapis:master Aug 10, 2020
@stephenplusplus stephenplusplus deleted the spp--477 branch August 10, 2020 14:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update a VM's deletion protection flag
5 participants