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

Use PATCH semantics by default to set custom metadata #171

Merged
merged 6 commits into from
Oct 18, 2018

Conversation

pickypg
Copy link
Contributor

@pickypg pickypg commented Oct 2, 2018

This changes the default behavior from POST to PATCH so that the custom metadata passed into VM#setMetadata augments what is already set.

Fixes #168

  • Tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 2, 2018
@pickypg
Copy link
Contributor Author

pickypg commented Oct 2, 2018

As was suggested in #168, switching to PATCH semantics may be more appropriate. However, it's unclear to me if this is what was intended by the comment or perhaps this plus some other work.

Specifically, by defaulting to PATCH semantics, it would make it impossible to use VM#setMetadata to delete custom metadata (which is fine for my use case, but I suspect it wouldn't be fine for everyone else's use case).

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@ghost ghost assigned stephenplusplus Oct 3, 2018
@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Oct 3, 2018
@stephenplusplus
Copy link
Contributor

Thank you for this! Unfortunately, the upstream API only accepts POST. When I said PATCH semantics, I just meant what you were proposing was spot on (doing the merging within our library for the user). Sorry for the confusion!

Specifically, by defaulting to PATCH semantics, it would make it impossible to use VM#setMetadata to delete custom metadata (which is fine for my use case, but I suspect it wouldn't be fine for everyone else's use case).

Great point. I added some flare to the code to support removing and updating values.

Let me know what you think!

Copy link
Contributor Author

@pickypg pickypg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, the upstream API only accepts POST.

That's what I was afraid of. I figured it was easier to do the PR to get this going. This is exactly what I had in mind. Thanks!

src/vm.js Outdated Show resolved Hide resolved
src/vm.js Outdated Show resolved Hide resolved
src/vm.js Outdated Show resolved Hide resolved
@ghost ghost assigned fhinkel Oct 12, 2018
@fhinkel fhinkel added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Oct 12, 2018
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

@fhinkel
Copy link
Contributor

fhinkel commented Oct 12, 2018

@pickypg Thanks for the PR! Could you have a look at the failing lint job?

@pickypg
Copy link
Contributor Author

pickypg commented Oct 12, 2018

@fhinkel sure, but I think it’s best to wait for @stephenplusplus (or you) to comment on the feedback to his modifications.

pickypg and others added 6 commits October 18, 2018 11:34
This changes the default behavior from `POST` to `PATCH` so that the
custom metadata passed into `VM#setMetadata` augments what is already
set.
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Oct 18, 2018
@JustinBeckwith JustinBeckwith added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Oct 18, 2018
@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

@JustinBeckwith
Copy link
Contributor

@stephenplusplus this one is ready for you to review :)

@stephenplusplus
Copy link
Contributor

LGTM! @pickypg thank you for this! 🥇

@stephenplusplus stephenplusplus merged commit a721bdc into googleapis:master Oct 18, 2018
@pickypg pickypg deleted the setMetadata/use-patch branch October 18, 2018 15:43
@pickypg
Copy link
Contributor Author

pickypg commented Oct 18, 2018

Thanks for the handling everyone. I'm excited to see this get into the library so that I can remove the code in my GCF that was doing this manually!

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.

5 participants