-
Notifications
You must be signed in to change notification settings - Fork 1k
PHP Bucketlock samples and tests #692
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
Conversation
frankyn
left a comment
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.
A few nits, but overall lgtm! Thanks @billyjacobson!
| $bucket = $storage->bucket($bucketName); | ||
| $bucket->update([ | ||
| 'retentionPolicy' => [ | ||
| ]]); |
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.
Could you move up the closing bracket?
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.
Done
storage/storage.php
Outdated
| }); | ||
|
|
||
|
|
||
| // Create Buckets command |
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'm guessing this was copied over from another file.
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.
Fixed
|
|
||
| // Create Buckets command | ||
| $application->add(new Command('bucketlock')) | ||
| ->setDescription('Manage Cloud Storage retention policies') |
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.
Manage Cloud Storage object retention.
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.
Done
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.
Generalizing for buckets/objects. Update to Manage Cloud Storage retention policies and holds
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.
Should the entire command set be labeled "retention-policy" then? or is it fine to keep it as bucket-lock
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.
bucketlock is okay.
storage/storage.php
Outdated
| ) | ||
| ->addArgument('bucket', InputArgument::REQUIRED, 'The Cloud Storage bucket name') | ||
| ->addArgument('object', InputArgument::OPTIONAL, 'The Cloud Storage object name') | ||
| ->addArgument('retention-period', InputArgument::OPTIONAL, 'The length of the retention period') |
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.
suffix it with " in seconds"
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.
Done
Adding conditional for removing retention policy
frankyn
left a comment
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
bshaffer
left a comment
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.
Fixed some code styles but otherwise this is great once the tests pass!
frankyn
left a comment
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.
Small nits
|
@grayside could you help review these PHP samples? |
|
@grayside there is also version difficulties with the composer.lock file. We aren't sure how to fix this issue. Any tips would be awesome. |
|
cc: @chingor13 will help review. |
chingor13
left a comment
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.
@return voidshould be removed from the phpdoc. There's novoidtype in PHP.- It's unlikely users will want to call
updatewithout checking the return value
| * | ||
| * @param string $bucketName the name of your Cloud Storage bucket. | ||
| * | ||
| * @return void |
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.
We can skip @return void
| $bucket = $storage->bucket($bucketName); | ||
| $bucket->reload(); | ||
|
|
||
| if ($bucket->info()['retentionPolicy']['isLocked']) { |
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.
Do we not surface these attributes in a cleaner way? If they're well known, we should probably consider trying to expose them in a better way than nested associative arrays.
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.
It could be a feature request at this point. It currently follows how metadata is handled by the library.
|
@chingor13 do you have input on how to fix the composer.lock? There's a mismatch of versions. |
|
@frankyn It looks like |
79e4a42 to
d2fb8bf
Compare
|
Something is up with travis. |
|
Chatted with @bshaffer, looks like Travis CI requirement is a bug. He was trying to remove Travis CI but he's no longer able to remove it (I tried as well). We are technically blocked until this is resolved. |
|
Nvm, unblocked. |
Uh oh!
There was an error while loading. Please reload this page.