GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add support for 'Blob.custom_time' and lifecycle rules by HemangChothani · Pull Request #199 · googleapis/python-storage

This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Conversation

@HemangChothani

@HemangChothani HemangChothani commented Jul 1, 2020

Copy link
Copy Markdown
Contributor

Fixes #196

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
HemangChothani added 2 commits July 1, 2020 18:31
@HemangChothani
feat(storage): add support of custom time metadata and timestamp
c03d6ae
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-storage …
7347cf2
…into storage_issue_196
@HemangChothani
HemangChothani requested review from frankyn and jkwlui July 1, 2020 13:04
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 1, 2020
@HemangChothani HemangChothani changed the title Storage issue 196 feat(storage): add support of custom time metadata and timestamp Jul 1, 2020
jkwlui
jkwlui approved these changes Jul 13, 2020
View reviewed changes

@jkwlui jkwlui left a comment

Copy link
Copy Markdown
Contributor

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.

Thanks @HemangChothani! Please hold until product is ready to move forward.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
jkwlui and others added 2 commits July 13, 2020 15:46
@jkwlui
Merge branch 'master' into storage_issue_196
ef32ca2
@HemangChothani
feat(storage): change the return type of custom_time_before
0212ca4
tseaver
tseaver suggested changes Jul 21, 2020
View reviewed changes
Comment thread google/cloud/storage/blob.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

HemangChothani added 2 commits July 24, 2020 12:03
@HemangChothani
feat(storage): add setter method
a6c830c
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-storage …
3dbda6a
…into storage_issue_196
@tseaver tseaver added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 24, 2020
@tseaver

tseaver commented Jul 24, 2020

Copy link
Copy Markdown
Contributor

I have marked this PR as do not merge per @jkwlui .

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tseaver
tseaver previously requested changes Jul 24, 2020
View reviewed changes
Comment thread google/cloud/storage/blob.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/test_blob.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/blob.py Outdated
See https://cloud.google.com/storage/docs/json_api/v1/objects

:type value: :class:`datetime.datetime`
:param value: (Optional) Set the custom time of blob. Datetime object parsed

@tseaver tseaver Jul 24, 2020

Copy link
Copy Markdown
Contributor

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.

Document the semantics of None value (which should be to clear any existing property value).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tseaver and others added 4 commits July 24, 2020 13:28
@tseaver
Merge branch 'master' into storage_issue_196
04e3a10
@HemangChothani
feat(storage): add test for None value
75e6067
@HemangChothani
Merge branch 'storage_issue_196' of https://github.com/q-logic/python…
7ee2796
…-storage into storage_issue_196
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-storage …
e2793ce
…into storage_issue_196

Y
@HemangChothani HemangChothani added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 28, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 28, 2020
@busunkim96 busunkim96 closed this Jul 31, 2020
@busunkim96 busunkim96 reopened this Jul 31, 2020
@tseaver tseaver changed the title feat(storage): add support of custom time metadata and timestamp feat: add support for 'Blob.custom_time' and lifecyccle rules. Aug 4, 2020
@tseaver tseaver changed the title feat: add support for 'Blob.custom_time' and lifecyccle rules. feat: add support for 'Blob.custom_time' and lifecyccle rules Aug 4, 2020
tseaver
tseaver reviewed Aug 4, 2020
View reviewed changes
Comment thread tests/unit/test_blob.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

HemangChothani added 2 commits August 5, 2020 11:12
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-storage …
43f1f5a
…into storage_issue_196
@HemangChothani
feat(storage): changes in unittest
0bd9bf4
@MaxxleLLC
MaxxleLLC force-pushed the storage_issue_196 branch from 1d96369 to 0bd9bf4 Compare August 5, 2020 05:57
@HemangChothani
feat(storage): change custom_time type to date
fee993f
frankyn
frankyn suggested changes Aug 12, 2020
View reviewed changes

@frankyn frankyn left a comment

Copy link
Copy Markdown
Contributor

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.

Thanks for your patience @HemangChothani,

Update: The Cloud Storage team has updated type of noncurrent_time_before and custom_time to be a Date format (YYYY-mm-dd) instead of DateTime.

Discovery document with updated documentation with respect to these fields:
https://www.googleapis.com/discovery/v1/apis/storage/v1/rest

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@HemangChothani

HemangChothani commented Aug 13, 2020

Copy link
Copy Markdown
Contributor Author

Update: The Cloud Storage team has updated type of noncurrent_time_before and custom_time to be a Date format (YYYY-mm-dd) instead of DateTime.

@frankyn That change has been already done.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-storage …
76457b1
…into storage_issue_196
frankyn
frankyn suggested changes Aug 14, 2020
View reviewed changes
Comment thread google/cloud/storage/blob.py Outdated
See https://cloud.google.com/storage/docs/json_api/v1/objects

:rtype: :class:`datetime.date` or ``NoneType``
:returns: Date object parsed from iso8601 valid date, or

@frankyn frankyn Aug 14, 2020

Copy link
Copy Markdown
Contributor

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 should be dateTime

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
HemangChothani added 2 commits August 17, 2020 11:47
@HemangChothani
feat: change custom_time to datetime
ae71f29
@HemangChothani
Merge branch 'master' of https://github.com/googleapis/python-storage …
d99fcb9
…into storage_issue_196
frankyn
frankyn suggested changes Aug 24, 2020
View reviewed changes

@frankyn frankyn left a comment

Copy link
Copy Markdown
Contributor

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.

Have two nits for documentation, otherwise LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/storage/blob.py Outdated

See https://cloud.google.com/storage/docs/json_api/v1/objects

:type value: :class:`datetime.datetime` or ``NoneType``

@frankyn frankyn Aug 24, 2020

Copy link
Copy Markdown
Contributor

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.

Once set it can't be unset and only changed to a custom datetime in the future. If the custom_time must be unset, you must either perform a rewrite operation or upload the data again.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@frankyn frankyn Aug 25, 2020

Copy link
Copy Markdown
Contributor

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'd state that setter can only be datetime.datetime to not confuse folks.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/storage/bucket.py Outdated

:type custom_time_before: :class:`datetime.date`
:param custom_time_before: (Optional) Apply rule action to items whose custom time is before this
date. This condition is relevant only for versioned objects.

@frankyn frankyn Aug 24, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

Please include similar text to noncurrent_time_before with RFC3339 and an example.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@frankyn frankyn removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 24, 2020
frankyn and others added 4 commits August 24, 2020 14:05
@frankyn
Merge branch 'master' into storage_issue_196
62781a3
@frankyn
Merge branch 'master' into storage_issue_196
0fcf160
@HemangChothani
feat: nit
39a12f0
@HemangChothani
Merge branch 'storage_issue_196' of https://github.com/q-logic/python…
285e15b
…-storage into storage_issue_196
frankyn
frankyn suggested changes Aug 25, 2020
View reviewed changes

@frankyn frankyn left a comment

Copy link
Copy Markdown
Contributor

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.

1 nit, thanks @HemangChothani

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/storage/blob.py Outdated

See https://cloud.google.com/storage/docs/json_api/v1/objects

:type value: :class:`datetime.datetime` or ``NoneType``

@frankyn frankyn Aug 25, 2020

Copy link
Copy Markdown
Contributor

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'd state that setter can only be datetime.datetime to not confuse folks.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@HemangChothani
feat: resolve conflict and nit
780a616
frankyn
frankyn approved these changes Aug 26, 2020
View reviewed changes
@frankyn
frankyn requested a review from tseaver August 26, 2020 17:19
@frankyn frankyn changed the title feat: add support for 'Blob.custom_time' and lifecyccle rules feat: add support for 'Blob.custom_time' and lifecycle rules Aug 26, 2020
@frankyn
Merge branch 'master' into storage_issue_196
e76b8bb
@frankyn
frankyn dismissed tseaver’s stale review August 26, 2020 18:00

tseaver's feedback was addressed and dismissing as the PR LGTM.

@frankyn
frankyn merged commit 180873d into googleapis:master Aug 26, 2020
tseaver
tseaver reviewed Aug 26, 2020
View reviewed changes
Comment thread google/cloud/storage/blob.py

@custom_time.setter
def custom_time(self, value):
"""Set the custom time for the object. Once set it can't be unset

@tseaver tseaver Aug 26, 2020

Copy link
Copy Markdown
Contributor

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.

Please follow PEP 257 for Multi-line docstrings, i.e., move the non-summary down below.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/storage/blob.py
"""Set the custom time for the object. Once set it can't be unset
and only changed to a custom datetime in the future. If the
custom_time must be unset, you must either perform a rewrite operation
or upload the data again.

@tseaver tseaver Aug 26, 2020

Copy link
Copy Markdown
Contributor

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.

These semantics are not enforced by the method.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/storage/bucket.py
@property
def days_since_custom_time(self):
"""Conditon's 'days_since_custom_time' value."""
return self.get("daysSinceCustomTime")

@tseaver tseaver Aug 26, 2020

Copy link
Copy Markdown
Contributor

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.

Setter for this property?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/storage/bucket.py
"""Conditon's 'custom_time_before' value."""
before = self.get("customTimeBefore")
if before is not None:
return datetime_helpers.from_iso8601_date(before)

@tseaver tseaver Aug 26, 2020

Copy link
Copy Markdown
Contributor

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.

Setter for this property?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@HemangChothani HemangChothani Aug 27, 2020

Copy link
Copy Markdown
Contributor Author

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.

Not sure about the setter method for all this properties, because we don't have a method for other properties as well which defined before. Please let me know if needed, so need to create setter method for all the properties of LifecycleRuleConditions class.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@frankyn frankyn Aug 27, 2020

Copy link
Copy Markdown
Contributor

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.

Thanks both, looks like setters weren't defined at this level. It will be filed as a feature request for now. It doesn't block customers from using the feature.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tseaver tseaver mentioned this pull request Aug 26, 2020
fix: repair mal-formed docstring #255
Merged
@frankyn frankyn mentioned this pull request Mar 2, 2026
Add Lifecycle Rule Property Setters googleapis/google-cloud-python#15989
Closed
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
@HemangChothani @jkwlui
@tseaver @frankyn @cojenco
feat: add support for 'Blob.custom_time' and lifecycle rules (googlea…
671afaf
…pis#199)

* feat(storage): add support of custom time metadata and timestamp

* feat(storage): change the return type of custom_time_before

* feat(storage): add setter method

* feat(storage): add test for None value

* feat(storage): changes in unittest

* feat(storage): change custom_time type to date

* feat: change custom_time to datetime

* feat: nit

Co-authored-by: Jonathan Lui <[email protected]>
Co-authored-by: Tres Seaver <[email protected]>
Co-authored-by: Frank Natividad <[email protected]>
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
@HemangChothani @jkwlui
@tseaver @frankyn @cojenco
feat: add support for 'Blob.custom_time' and lifecycle rules (googlea…
cfaf395
…pis#199)

* feat(storage): add support of custom time metadata and timestamp

* feat(storage): change the return type of custom_time_before

* feat(storage): add setter method

* feat(storage): add test for None value

* feat(storage): changes in unittest

* feat(storage): change custom_time type to date

* feat: change custom_time to datetime

* feat: nit

Co-authored-by: Jonathan Lui <[email protected]>
Co-authored-by: Tres Seaver <[email protected]>
Co-authored-by: Frank Natividad <[email protected]>
@release-please release-please Bot mentioned this pull request Jan 12, 2022
chore(main): release 3.0.0 #688
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

3 more reviewers
@tseaver tseaver tseaver left review comments
@frankyn frankyn frankyn approved these changes
@jkwlui jkwlui jkwlui approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Support customTime metadata and custom timestamp based OLM

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@HemangChothani @tseaver @frankyn @jkwlui @googlebot @busunkim96 @yoshi-kokoro
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.