ManagementPolicyArgs

data class ManagementPolicyArgs(val rules: Output<List<ManagementPolicyRuleArgs>>? = null, val storageAccountId: Output<String>? = null) : ConvertibleToJava<ManagementPolicyArgs>

Manages an Azure Storage Account Management Policy.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.storage.ManagementPolicy;
import com.pulumi.azure.storage.ManagementPolicyArgs;
import com.pulumi.azure.storage.inputs.ManagementPolicyRuleArgs;
import com.pulumi.azure.storage.inputs.ManagementPolicyRuleFiltersArgs;
import com.pulumi.azure.storage.inputs.ManagementPolicyRuleActionsArgs;
import com.pulumi.azure.storage.inputs.ManagementPolicyRuleActionsBaseBlobArgs;
import com.pulumi.azure.storage.inputs.ManagementPolicyRuleActionsSnapshotArgs;
import com.pulumi.azure.storage.inputs.ManagementPolicyRuleActionsVersionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.accountTier("Standard")
.accountReplicationType("LRS")
.accountKind("BlobStorage")
.build());
var exampleManagementPolicy = new ManagementPolicy("exampleManagementPolicy", ManagementPolicyArgs.builder()
.storageAccountId(exampleAccount.id())
.rules(
ManagementPolicyRuleArgs.builder()
.name("rule1")
.enabled(true)
.filters(ManagementPolicyRuleFiltersArgs.builder()
.prefixMatches("container1/prefix1")
.blobTypes("blockBlob")
.matchBlobIndexTags(ManagementPolicyRuleFiltersMatchBlobIndexTagArgs.builder()
.name("tag1")
.operation("==")
.value("val1")
.build())
.build())
.actions(ManagementPolicyRuleActionsArgs.builder()
.baseBlob(ManagementPolicyRuleActionsBaseBlobArgs.builder()
.tierToCoolAfterDaysSinceModificationGreaterThan(10)
.tierToArchiveAfterDaysSinceModificationGreaterThan(50)
.deleteAfterDaysSinceModificationGreaterThan(100)
.build())
.snapshot(ManagementPolicyRuleActionsSnapshotArgs.builder()
.deleteAfterDaysSinceCreationGreaterThan(30)
.build())
.build())
.build(),
ManagementPolicyRuleArgs.builder()
.name("rule2")
.enabled(false)
.filters(ManagementPolicyRuleFiltersArgs.builder()
.prefixMatches(
"container2/prefix1",
"container2/prefix2")
.blobTypes("blockBlob")
.build())
.actions(ManagementPolicyRuleActionsArgs.builder()
.baseBlob(ManagementPolicyRuleActionsBaseBlobArgs.builder()
.tierToCoolAfterDaysSinceModificationGreaterThan(11)
.tierToArchiveAfterDaysSinceModificationGreaterThan(51)
.deleteAfterDaysSinceModificationGreaterThan(101)
.build())
.snapshot(ManagementPolicyRuleActionsSnapshotArgs.builder()
.changeTierToArchiveAfterDaysSinceCreation(90)
.changeTierToCoolAfterDaysSinceCreation(23)
.deleteAfterDaysSinceCreationGreaterThan(31)
.build())
.version(ManagementPolicyRuleActionsVersionArgs.builder()
.changeTierToArchiveAfterDaysSinceCreation(9)
.changeTierToCoolAfterDaysSinceCreation(90)
.deleteAfterDaysSinceCreation(3)
.build())
.build())
.build())
.build());
}
}

Import

Storage Account Management Policies can be imported using the resource id, e.g.

$ pulumi import azure:storage/managementPolicy:ManagementPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Storage/storageAccounts/myaccountname/managementPolicies/default

Constructors

Link copied to clipboard
fun ManagementPolicyArgs(rules: Output<List<ManagementPolicyRuleArgs>>? = null, storageAccountId: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): ManagementPolicyArgs

Properties

Link copied to clipboard
val rules: Output<List<ManagementPolicyRuleArgs>>? = null

A rule block as documented below.

Link copied to clipboard
val storageAccountId: Output<String>? = null

Specifies the id of the storage account to apply the management policy to. Changing this forces a new resource to be created.