I have created a lifecycle policy for azure storage account with the help of following piece of code.
StorageManager manager = StorageManager.authenticate(credential, subId); //credentilas and subscription iD manager.managementPolicies() .define("testprefix") .withExistingStorageAccount(resourceGroup, storageAcc) .defineRule("testprefixrulenew") .withLifecycleRuleType() .withBlobTypeToFilterFor(BlobTypes.BLOCK_BLOB) .withPrefixToFilterFor("prefix1") .withDeleteActionOnBaseBlob(1) .attach() .create();
when I run this, all the existing lifecycle rules for the storage account get deleted and only the newly created one is present .
1) How to avoid this deletion of existing lifecycle rules for azure storage account using java?
also , when I try to get the existing lifecycle policies by using following code snippet.
ManagementPolicyInner managementPolicy1 = manager2 .inner() .managementPolicies() .getAsync(resourceGroup, storageAcc) .toBlocking() .last();
I am able to get only the last modified/created policy. and if we remove "last()", it gives Observable value, so.
2) How to get the existing policies, iterate them , and update one of it if required using java???
https://stackoverflow.com/questions/65769510/how-to-get-and-update-azure-lifecycle-rules-in-java January 18, 2021 at 01:59PM
没有评论:
发表评论