Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 93
feat: integrate disable Lifecycle rule api for to remove lifecycle rule of bucket#28
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
a73af3e22351d82332a13e1bc3ab42c932cf635369bd15eed32a716e1e4b71caffa5e108e5c395918c7e398a771d48d6b69e4d3fe57045a3dd3a276f722f704d273fec3b1e816a9da63File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -75,6 +75,7 @@ | ||
| import com.google.cloud.storage.Storage.BlobField; | ||
| import com.google.cloud.storage.Storage.BlobWriteOption; | ||
| import com.google.cloud.storage.Storage.BucketField; | ||
| import com.google.cloud.storage.Storage.BucketGetOption; | ||
| import com.google.cloud.storage.StorageBatch; | ||
| import com.google.cloud.storage.StorageBatchResult; | ||
| import com.google.cloud.storage.StorageClass; | ||
| @@ -3273,4 +3274,36 @@ public void testBlobReload() throws Exception { | ||
| updated.delete(); | ||
| assertNull(updated.reload()); | ||
| } | ||
| @Test | ||
| public void testDeleteLifecycleRules() throws ExecutionException, InterruptedException { | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following up, did you try deleting a single lifecycle rule?
| ||
| String lifeCycleRuleBucket = RemoteStorageHelper.generateBucketName(); | ||
| List<LifecycleRule> lifecycleRules = | ||
| ImmutableList.of( | ||
| new LifecycleRule( | ||
| LifecycleAction.newDeleteAction(), | ||
| LifecycleCondition.newBuilder().setAge(2).setIsLive(Boolean.TRUE).build())); | ||
| try { | ||
| Bucket bucket = | ||
| storage.create( | ||
| BucketInfo.newBuilder(lifeCycleRuleBucket) | ||
| .setStorageClass(StorageClass.COLDLINE) | ||
| .setLocation("us-central1") | ||
| .setLifecycleRules(lifecycleRules) | ||
| .build()); | ||
| assertEquals(lifeCycleRuleBucket, bucket.getName()); | ||
| assertEquals(StorageClass.COLDLINE, bucket.getStorageClass()); | ||
| assertEquals(lifecycleRules, bucket.getLifecycleRules()); | ||
| assertNotNull(bucket.getLifecycleRules()); | ||
| boolean rulesDeleted = bucket.deleteLifecycleRules(); | ||
| assertTrue(rulesDeleted); | ||
| bucket = | ||
| storage.get(lifeCycleRuleBucket, BucketGetOption.fields(Storage.BucketField.values())); | ||
| assertNull(bucket.getLifecycleRules()); | ||
| } catch (StorageException ex) { | ||
| throw ex; | ||
| } finally { | ||
| RemoteStorageHelper.forceDelete(storage, lifeCycleRuleBucket, 5, TimeUnit.SECONDS); | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.