Skip to content
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

feat: delete bucket OLM rules #352

Merged
merged 11 commits into from Jun 16, 2020
Merged

Conversation

athakor
Copy link
Contributor

@athakor athakor commented Jun 5, 2020

Fixes #344

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 5, 2020
@athakor athakor requested a review from frankyn June 5, 2020 15:54
@codecov
Copy link

codecov bot commented Jun 5, 2020

Codecov Report

Merging #352 into master will increase coverage by 0.40%.
The diff coverage is 88.88%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #352      +/-   ##
============================================
+ Coverage     62.73%   63.13%   +0.40%     
- Complexity      554      601      +47     
============================================
  Files            31       32       +1     
  Lines          5023     5078      +55     
  Branches        480      481       +1     
============================================
+ Hits           3151     3206      +55     
- Misses         1707     1708       +1     
+ Partials        165      164       -1     
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/com/google/cloud/storage/Storage.java 80.90% <ø> (ø) 0.00 <0.00> (ø)
...main/java/com/google/cloud/storage/BucketInfo.java 81.34% <85.71%> (+0.29%) 83.00 <2.00> (-1.00) ⬆️
...src/main/java/com/google/cloud/storage/Bucket.java 81.36% <100.00%> (+0.13%) 34.00 <0.00> (ø)
...ogle/cloud/storage/testing/StorageRpcTestBase.java 97.95% <0.00%> (ø) 48.00% <0.00%> (?%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3b04dd...0a574ba. Read the comment docs.

Copy link
Contributor

@dmitry-fa dmitry-fa left a comment

Choose a reason for hiding this comment

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

List<LifecycleRule> deleteLifecycleRules(String bucket, LifecycleRule... rulesToDelete);

Neither Storage nor Bucket defines methods to deal with LifecycleRules. Adding a method to them to delete that rules doesn't look logical. Would it make sense to implement this functionality in the BucketInfo class next to List<? extends BucketInfo.LifecycleRule> getLifecycleRules() method?

cc: @frankyn

@athakor athakor added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 8, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 8, 2020
@frankyn
Copy link
Member

frankyn commented Jun 8, 2020

+1 to @dmitry-fa, it would be better to define this in the BlobInfo builder because that's how metadata is mutated.

@athakor
Copy link
Contributor Author

athakor commented Jun 10, 2020

@frankyn @dmitry-fa PTAL

@athakor
Copy link
Contributor Author

athakor commented Jun 15, 2020

@frankyn PTAL

Copy link
Contributor

@dmitry-fa dmitry-fa left a comment

Choose a reason for hiding this comment

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

The new implementation is much better than the previous one. Could you fix a few nits, please.

Copy link
Member

@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

I think you're super close, but I may have been too short on my surface expectations. Provided an example of what I would expect.

* boolean rulesDeleted = bucket.deleteLifecycleRules();
* if (rulesDeleted) {
* // the lifecycle rules were deleted
* }
Copy link
Member

Choose a reason for hiding this comment

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

I'm expecting the following surface:

String bucketName = "my-unique-bucket";
Bucket bucket = storage.get(bucketName);

updatedBucketMetdata = bucket.toBuilder().deleteLifecycleRules().build().update();
if (updatedBucketMetadata.getLifecycleRules().size() == 0) {
    // the lifecycle rules were deleted
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@athakor athakor added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 16, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 16, 2020
@athakor
Copy link
Contributor Author

athakor commented Jun 16, 2020

@frankyn @dmitry-fa implemented in the same manner as other methods updating Bucket's properties. PTAL when you get chance

Copy link
Contributor

@dmitry-fa dmitry-fa left a comment

Choose a reason for hiding this comment

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

Overall looks good to me. A few nits to address just left.

@athakor
Copy link
Contributor Author

athakor commented Jun 16, 2020

@dmitry-fa all the comments have been addressed PTAL

Copy link
Contributor

@dmitry-fa dmitry-fa left a comment

Choose a reason for hiding this comment

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

Looks good to me know, thanks for addressing my comments.

@frankyn frankyn merged commit 0a528c6 into googleapis:master Jun 16, 2020
gcf-merge-on-green bot pushed a commit that referenced this pull request Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting the bucket OLM rules
5 participants