-
Notifications
You must be signed in to change notification settings - Fork 438
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
Add more in-depth support for object lifecycle management #1318
Conversation
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.
just one documentation suggestion. looks really nice!
* providing a callable you may define a custom route for how you | ||
* would like to remove rules. The provided callable will be run | ||
* through | ||
* [array_filter](http://php.net/manual/en/function.array-filter.php). |
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.
@@ -779,7 +779,7 @@ public function delete(array $options = []) | |||
* configuration. | |||
* @type array $defaultObjectAcl Default access controls to apply to new | |||
* objects when no ACL is provided. | |||
* @type array $lifecycle The bucket's lifecycle configuration. | |||
* @type array|Lifecycle $lifecycle The bucket's lifecycle configuration. |
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.
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.
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.
@@ -779,7 +779,7 @@ public function delete(array $options = []) | |||
* configuration. | |||
* @type array $defaultObjectAcl Default access controls to apply to new | |||
* objects when no ACL is provided. | |||
* @type array $lifecycle The bucket's lifecycle configuration. | |||
* @type array|Lifecycle $lifecycle The bucket's lifecycle configuration. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
} | ||
|
||
/** | ||
* @access private |
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.
* ->addDeleteRule([ | ||
* 'age' => 50, | ||
* 'isLive' => true | ||
* ]); |
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.
Storage/src/Lifecycle.php
Outdated
* @throws \InvalidArgumentException If a type other than a string or | ||
* callabe is provided. | ||
*/ | ||
public function clearRules($condition = null) |
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.
Storage/src/Lifecycle.php
Outdated
} | ||
|
||
/** | ||
* Adds a delete rule. |
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.
Storage/src/Lifecycle.php
Outdated
* @throws \InvalidArgumentException If a type other than a string or | ||
* callabe is provided. | ||
*/ | ||
public function clearRules($condition = null) |
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.
Storage/src/Lifecycle.php
Outdated
} | ||
|
||
/** | ||
* Adds a set storage class rule. |
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.
Storage/src/Lifecycle.php
Outdated
} | ||
|
||
/** | ||
* Clears out rules based on the provided condition. |
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.
Storage/src/Lifecycle.php
Outdated
* | ||
* @see https://cloud.google.com/storage/docs/lifecycle Object Lifecycle Management API Documentation | ||
*/ | ||
class Lifecycle |
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.
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.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Thank you for the review @frankyn. I touched on your feedback, PTAL. |
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.
LG, with some minor comments
* @param string $offset | ||
* @param mixed $value | ||
*/ | ||
public function offsetSet($offset, $value) |
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.
* @param string $offset | ||
* @return mixed | ||
*/ | ||
public function offsetGet($offset) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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 like the update, pending follow-up discussions in comments and some minor nits.
* @param array $options [optional] Configuration options. | ||
* @return Lifecycle | ||
*/ | ||
public function currentLifecycle(array $options = []) |
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.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* | ||
* $storage = new StorageClient(); | ||
* $bucket = $storage->bucket('my-bucket'); | ||
* $lifecycle = $bucket->currentLifecycle(); |
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.
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.
LGTM
With this change set
Google\Cloud\Storage\StorageClient::createBucket()
andGoogle\Cloud\Storage\Bucket::update()
can now both accept an instance ofGoogle\Cloud\Storage\Lifecycle
as opposed to a raw array.Sample usage:
/cc @frankyn