-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Making all Blob/Bucket getters fail gracefully if keys don't exist. #793
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
Making all Blob/Bucket getters fail gracefully if keys don't exist. #793
Conversation
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
ISTM that returning None from the getters breaks their contract a bit: we could either change the |
|
@tseaver I imagine a future where people use their own blob.reload(fields=['generation', 'metageneration'])and then all other values are unset. I think changing the |
Also - replacing uses of dict.copy() (shallow) with copy.deepcopy(). - Making getters honor contracts (e.g. return an integer if supposed to). This is necessary because int64 -> JSON becomes a string, even though we want an integer. This is due to only one numeric type "number" in JavaScript.
873ec53 to
2971484
Compare
|
@tseaver I updated the docstrings and pushed again. I also coerced some values to ints, since I also wanted to convert the timestamps to datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%S.%fZ')would be insufficient for values returned by the backend (AFAIK the only contract is that they will be valid RFC3339). |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Aside from the worry about PATCH w/ None, LGTM. |
|
PATCH with None effectively "unsets" the property. But we would only send None if it was explicitly set by the user. I'm AFK now but would like to test out what happens if None is sent for a required property. |
|
@tseaver What is the implication of my answer? How to move forward? |
|
We should figure out what happens when |
|
@tseaver I was already pretty sure what happened, but I verified via https://developers.google.com/apis-explorer/#p/storage/v1/storage.objects.patch by sending "metadata: null" after previously setting |
|
OK. ISTM we can just mirror that, then (the |
|
Yep, we get it for free. Remaining hangups? |
|
Nope. |
…orage Making all Blob/Bucket getters fail gracefully if keys don't exist.
* chore(python): use python 3.10 for docs build Source-Link: googleapis/synthtool@9ae0785 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:52210e0e0559f5ea8c52be148b33504022e1faef4e95fbe4b32d68022af2fa7e * use python 3.10 for docs build --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Lingqing Gan <[email protected]> Co-authored-by: Anthonios Partheniou <[email protected]>
…p/templates/python_library/.kokoro (#793) Source-Link: googleapis/synthtool@d0f51a0 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:240b5bcc2bafd450912d2da2be15e62bc6de2cf839823ae4bf94d4f392b451dc Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
🤖 I have created a release \*beep\* \*boop\* --- ### [0.40.12](https://www.github.com/googleapis/gapic-generator-python/compare/v0.40.11...v0.40.12) (2021-02-26) ### Bug Fixes * exclude 'input' from reserved names list ([#788](https://www.github.com/googleapis/gapic-generator-python/issues/788)) ([da2ff71](https://www.github.com/googleapis/gapic-generator-python/commit/da2ff717b82357359baeeafad9a3e48a70e194cb)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
* feat: retry generates backoff value after completing on_error callbacks * added comment * use single sleep iterator for retries * fix tests * update variable name * adjusted docstring * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fixed mypy issues * added comment * added unit tests for dynamic backoff --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
Defines the following classes: - `google.auth.downscoped.CredentialAccessBoundary` - `google.auth.downscoped.AccessBoundaryRule` - `google.auth.downscoped.AvailabilityCondition` This is based on [Downscoping with Credential Access Boundaries](https://cloud.google.com/iam/docs/downscoping-short-lived-credentials). These classes help define the list of access boundary rules, each of which contains information on the resource that the rule applies to, the upper bound of the permissions that are available on that resource and an optional condition to further restrict permissions.
Also replacing uses of dict.copy() (shallow) with copy.deepcopy().