Uh oh!
There was an error while loading. Please reload this page.
feat: integrate disable Lifecycle rule api for to remove lifecycle rule of bucket - #28
feat: integrate disable Lifecycle rule api for to remove lifecycle rule of bucket#28athakor wants to merge 21 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
JesseLovelace
commented
Jan 3, 2020
Does this API remove all lifecycle rules? if so, it should be named disableLifecycleRules rather than rule, and if not there should be documentation on which rule specifically would be removed and how to control it |
athakor
commented
Jan 6, 2020
@JesseLovelace yes,this API remove all lifecycle rules. so you are right we should named it as |
There was a problem hiding this comment.
Few notes:
- Let's avoid confusing/ambiguous language like "disabled or deleted". I say we go with "deleted," change all references to "disabled or deleted" to just say "deleted," and update the method to deleteLifecycleRules.
- It's Lifecycle, not LifeCycle
- Make sure to run the style checker even in commented out code to catch things like spaces after commas
athakor
commented
Jan 9, 2020
@JesseLovelace PTAL |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
JesseLovelace
commented
Jan 16, 2020
Also, your IT is failing because you aren't using a real service account email |
JesseLovelace
commented
Jan 17, 2020
Try using storage.getServiceAccount(projectId) instead of extracting it from the json like you're doing now |
athakor
commented
Jan 23, 2020
done @JesseLovelace PTAL |
athakor
commented
Feb 7, 2020
@JesseLovelace PTAL |
athakor
commented
Feb 14, 2020
@frankyn@JesseLovelace gentle ping. |
frankyn
commented
Feb 14, 2020
@JesseLovelace is on point for this one. I'll bring it up in our meeting early next week (Tuesday). Thank you for your patience @athakor |
athakor
commented
Mar 31, 2020
@frankyn@JesseLovelace here, how we can move ahead with above situation? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| @Test | ||
| public void testDeleteLifecycleRules() throws ExecutionException, InterruptedException { |
There was a problem hiding this comment.
Following up, did you try deleting a single lifecycle rule?
There was a problem hiding this comment.
I have tried to find the feasible way to delete a single lifecycle rule but its look like there is no possible way to do that and also found that across all the languages have same behavior which we have currently implemented.
Suggestion
I think we should have to update the method name like
clearLifecycleRulesordisableLifecycleRulesinstead ofdeleteLifecycleRulesto be more clear,deleteLifecycleRulesmight confused to user.we can also place a
Notethere like delete individual rules through the console because currently this library have limited support to delete rule.
There was a problem hiding this comment.
Hi @athakor, apologies for the delay.
StringlifecycleTestBucketName = RemoteStorageHelper.generateBucketName();
storage.create(
BucketInfo.newBuilder(lifecycleTestBucketName)
.setLocation("us")
.setLifecycleRules(
ImmutableList.of(
newLifecycleRule(
LifecycleAction.newSetStorageClassAction(StorageClass.COLDLINE),
LifecycleCondition.newBuilder()
.setAge(1)
.setNumberOfNewerVersions(3)
.setIsLive(false)
.setCreatedBefore(newDateTime(System.currentTimeMillis()))
.setMatchesStorageClass(ImmutableList.of(StorageClass.COLDLINE))
.build()),
newLifecycleRule(
LifecycleAction.newDeleteAction(),
LifecycleCondition.newBuilder()
.setAge(1)
.build()
)))
.build());
// Delete OLM rule.BucketremoteBucket =
storage.get(lifecycleTestBucketName, Storage.BucketGetOption.fields(BucketField.LIFECYCLE));
intpriorSize = remoteBucket.getLifecycleRules().size();
ArrayList<LifecycleRule> lifecycleRules = newArrayList(remoteBucket.getLifecycleRules());
Iterator<LifecycleRule> iterator = lifecycleRules.iterator();
while(iterator.hasNext()) {
LifecycleRulerule = iterator.next();
if (rule.getAction().getActionType().equals(LifecycleRule.DeleteLifecycleAction.TYPE)) {
iterator.remove();
}
}
remoteBucket.toBuilder().setLifecycleRules(lifecycleRules).build().update();There was a problem hiding this comment.
Did this help? I think we can merge this change once you add a helper to Storage interface but no change is required for StorageRpc.java.
There was a problem hiding this comment.
@frankyn thanks for this, I tried your sample code but its not working please check the below response.
[LifecycleRule{
lifecycleAction=DeleteLifecycleAction{actionType=Delete},lifecycleCondition=LifecycleCondition{
age=1,
createBefore=null,
numberofNewerVersions=null,
isLive=null,
matchesStorageClass=null}},LifecycleRule{
lifecycleAction=SetStorageClassLifecycleAction{actionType=SetStorageClass,
storageClass=COLDLINE},lifecycleCondition=LifecycleCondition{
age=1,
createBefore=2020-05-15,
numberofNewerVersions=3,
isLive=false,
matchesStorageClass=[COLDLINE]}}]does it works on your end? i think bucket lifecycle rule's not updated properly.
There was a problem hiding this comment.
storage.delete(bucketName) is clean up for the example and not required by remove lifecycle rule.
Please let me know if there is still confusion with the workaround. In short, the library should not require the workaround.
There was a problem hiding this comment.
@frankyn thanks for the clarification. It's works i will raise separate PR by adding these helper to Storage interface.
Thank you for your help.
There was a problem hiding this comment.
Thank you! I appreciate your patience.
There was a problem hiding this comment.
@athakor I might be confused, you're going to close this PR and make another right?
There was a problem hiding this comment.
yes, will close this once newly created PR gets Approved
…ete lifecycle rules
Fixes#20