Conversation

athakor

Fixes #344

@googlebotgooglebot added the cla: yesThis human has signed the Contributor License Agreement.label Jun 5, 2020
@athakorathakor requested a review from frankyn June 5, 2020 15:54
@codecov

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 FilesCoverage ΔComplexity Δ
...rc/main/java/com/google/cloud/storage/Storage.java80.90% <ø> (ø)0.00 <0.00> (ø)
...main/java/com/google/cloud/storage/BucketInfo.java81.34% <85.71%> (+0.29%)83.00 <2.00> (-1.00)⬆️
...src/main/java/com/google/cloud/storage/Bucket.java81.36% <100.00%> (+0.13%)34.00 <0.00> (ø)
...ogle/cloud/storage/testing/StorageRpcTestBase.java97.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.

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 BucketInfoclass next to List<? extends BucketInfo.LifecycleRule> getLifecycleRules() method?

cc: @frankyn

@athakorathakor added the kokoro:force-runAdd this label to force Kokoro to re-run the tests.label Jun 8, 2020
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests.label Jun 8, 2020
@frankyn

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

@athakor

@frankyn @dmitry-fa PTAL

@athakor

@frankyn PTAL

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.

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
Contributor

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

@athakorathakor added the kokoro:force-runAdd this label to force Kokoro to re-run the tests.label Jun 16, 2020
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests.label Jun 16, 2020
@athakor

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

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

@dmitry-fa all the comments have been addressed PTAL

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.

@frankynfrankyn 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 . Already have an account? Sign in to comment
cla: yesThis human has signed the Contributor License Agreement.
None yet

Successfully merging this pull request may close these issues.

Deleting the bucket OLM rules