public PolicyRule.Update.IUpdate WithBlobTypeToFilterForRemoved(BlobTypes blobType) { List <String> blobTypesToFilterFor = this.inner.Definition.Filters.BlobTypes as List <String>; blobTypesToFilterFor.Remove(blobType.ToString()); this.inner.Definition.Filters.BlobTypes = blobTypesToFilterFor; return(this); }
public IReadOnlyList <Microsoft.Azure.Management.Storage.Fluent.BlobTypes> BlobTypesToFilterFor() { List <BlobTypes> blobTypes = new List <BlobTypes>(); foreach (String blobTypeString in this.inner.Definition.Filters.BlobTypes) { blobTypes.Add(BlobTypes.Parse(blobTypeString)); } return(blobTypes.AsReadOnly()); }
public IReadOnlyList <Microsoft.Azure.Management.Storage.Fluent.IPolicyRule> Rules() { List <ManagementPolicyRule> originalRules = this.Inner.Policy.Rules as List <ManagementPolicyRule>; List <IPolicyRule> returnRules = new List <IPolicyRule>(); foreach (ManagementPolicyRule originalRule in originalRules) { List <String> originalBlobTypes = originalRule.Definition.Filters.BlobTypes as List <String>; List <BlobTypes> returnBlobTypes = new List <BlobTypes>(); foreach (String originalBlobType in originalBlobTypes) { returnBlobTypes.Add(BlobTypes.Parse(originalBlobType)); } IPolicyRule returnRule = new PolicyRuleImpl(originalRule.Name) .WithLifecycleRuleType() .WithBlobTypesToFilterFor(returnBlobTypes); // building up prefixes to filter on if (originalRule.Definition.Filters.PrefixMatch != null) { ((PolicyRuleImpl)returnRule).WithPrefixesToFilterFor(originalRule.Definition.Filters.PrefixMatch); } // building up actions on base blob ManagementPolicyBaseBlob originalBaseBlobActions = originalRule.Definition.Actions.BaseBlob; if (originalBaseBlobActions != null) { if (originalBaseBlobActions.TierToCool != null) { ((PolicyRuleImpl)returnRule).WithTierToCoolActionOnBaseBlob(originalBaseBlobActions.TierToCool.DaysAfterModificationGreaterThan); } if (originalBaseBlobActions.TierToArchive != null) { ((PolicyRuleImpl)returnRule).WithTierToArchiveActionOnBaseBlob(originalBaseBlobActions.TierToArchive.DaysAfterModificationGreaterThan); } if (originalBaseBlobActions.Delete != null) { ((PolicyRuleImpl)returnRule).WithDeleteActionOnBaseBlob(originalBaseBlobActions.Delete.DaysAfterModificationGreaterThan); } } // build up actions on snapshot ManagementPolicySnapShot originalSnapshotActions = originalRule.Definition.Actions.Snapshot; if (originalSnapshotActions != null) { if (originalSnapshotActions.Delete != null) { ((PolicyRuleImpl)returnRule).WithDeleteActionOnSnapShot(originalSnapshotActions.Delete.DaysAfterCreationGreaterThan); } } returnRules.Add(returnRule); } return(returnRules.AsReadOnly()); }
public PolicyRuleImpl WithBlobTypeToFilterFor(BlobTypes blobType) { List <String> blobTypesToFilterFor = this.inner.Definition.Filters.BlobTypes as List <String>; if (blobTypesToFilterFor == null) { blobTypesToFilterFor = new List <String>(); } if (blobTypesToFilterFor.Contains(blobType.ToString())) { return(this); } blobTypesToFilterFor.Add(blobType.ToString()); this.inner.Definition.Filters.BlobTypes = blobTypesToFilterFor; return(this); }
/// <summary> /// The function that specifies to remove a blob type that the rule will apply to. /// </summary> /// <param name="blobType">The blob type that you wish the rule to no longer apply to.</param> /// <return>The next stage of the management policy rule update.</return> PolicyRule.Update.IUpdate PolicyRule.Update.IWithBlobTypesToFilterFor.WithBlobTypeToFilterForRemoved(BlobTypes blobType) { return(this.WithBlobTypeToFilterForRemoved(blobType)); }
/// <summary> /// The function that specifies a blob type that the rule will apply to. /// </summary> /// <param name="blobType">A blob type that the rule will apply to.</param> /// <return>The next stage of the management policy rule definition.</return> PolicyRule.Definition.IPrefixActionFork PolicyRule.Definition.IWithBlobTypesToFilterFor.WithBlobTypeToFilterFor(BlobTypes blobType) { return(this.WithBlobTypeToFilterFor(blobType)); }