GetPolicy

Use this data source to access information about an existing Storage Management Policy.

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleAccount = Output.Create(Azure.Storage.GetAccount.InvokeAsync(new Azure.Storage.GetAccountArgs
        {
            Name = "storageaccountname",
            ResourceGroupName = "resourcegroupname",
        }));
        var examplePolicy = Output.Create(Azure.Storage.GetPolicy.InvokeAsync(new Azure.Storage.GetPolicyArgs
        {
            StorageAccountId = azurerm_storage_account.Example.Id,
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/storage"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := "resourcegroupname"
        _, err := storage.LookupAccount(ctx, &storage.LookupAccountArgs{
            Name:              "storageaccountname",
            ResourceGroupName: &opt0,
        }, nil)
        if err != nil {
            return err
        }
        _, err := storage.GetPolicy(ctx, &storage.GetPolicyArgs{
            StorageAccountId: azurerm_storage_account.Example.Id,
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_azure as azure

example_account = azure.storage.get_account(name="storageaccountname",
    resource_group_name="resourcegroupname")
example_policy = azure.storage.get_policy(storage_account_id=azurerm_storage_account["example"]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleAccount = azure.storage.getAccount({
    name: "storageaccountname",
    resourceGroupName: "resourcegroupname",
});
const examplePolicy = azure.storage.getPolicy({
    storageAccountId: azurerm_storage_account.example.id,
});

Using GetPolicy

function getPolicy(args: GetPolicyArgs, opts?: InvokeOptions): Promise<GetPolicyResult>
function  get_policy(storage_account_id=None, opts=None)
func GetPolicy(ctx *Context, args *GetPolicyArgs, opts ...InvokeOption) (*GetPolicyResult, error)
public static class GetPolicy {
    public static Task<GetPolicyResult> InvokeAsync(GetPolicyArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

StorageAccountId string

Specifies the id of the storage account to retrieve the management policy for.

StorageAccountId string

Specifies the id of the storage account to retrieve the management policy for.

storageAccountId string

Specifies the id of the storage account to retrieve the management policy for.

storage_account_id str

Specifies the id of the storage account to retrieve the management policy for.

GetPolicy Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Rules List<GetPolicyRule>

A rule block as documented below.

StorageAccountId string
Id string

The provider-assigned unique ID for this managed resource.

Rules []GetPolicyRule

A rule block as documented below.

StorageAccountId string
id string

The provider-assigned unique ID for this managed resource.

rules GetPolicyRule[]

A rule block as documented below.

storageAccountId string
id str

The provider-assigned unique ID for this managed resource.

rules List[GetPolicyRule]

A rule block as documented below.

storage_account_id str

Supporting Types

GetPolicyRule

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Actions List<GetPolicyRuleActionArgs>

An actions block as documented below.

Enabled bool

Boolean to specify whether the rule is enabled.

Filters List<GetPolicyRuleFilterArgs>

A filter block as documented below.

Name string

A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be unique within a policy.

Actions []GetPolicyRuleAction

An actions block as documented below.

Enabled bool

Boolean to specify whether the rule is enabled.

Filters []GetPolicyRuleFilter

A filter block as documented below.

Name string

A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be unique within a policy.

actions GetPolicyRuleAction[]

An actions block as documented below.

enabled boolean

Boolean to specify whether the rule is enabled.

filters GetPolicyRuleFilter[]

A filter block as documented below.

name string

A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be unique within a policy.

actions List[GetPolicyRuleAction]

An actions block as documented below.

enabled bool

Boolean to specify whether the rule is enabled.

filters List[GetPolicyRuleFilter]

A filter block as documented below.

name str

A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be unique within a policy.

GetPolicyRuleAction

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

BaseBlobs List<GetPolicyRuleActionBaseBlobArgs>

A base_blob block as documented below.

Snapshots List<GetPolicyRuleActionSnapshotArgs>

A snapshot block as documented below.

BaseBlobs []GetPolicyRuleActionBaseBlob

A base_blob block as documented below.

Snapshots []GetPolicyRuleActionSnapshot

A snapshot block as documented below.

baseBlobs GetPolicyRuleActionBaseBlob[]

A base_blob block as documented below.

snapshots GetPolicyRuleActionSnapshot[]

A snapshot block as documented below.

baseBlobs List[GetPolicyRuleActionBaseBlob]

A base_blob block as documented below.

snapshots List[GetPolicyRuleActionSnapshot]

A snapshot block as documented below.

GetPolicyRuleActionBaseBlob

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

DeleteAfterDaysSinceModificationGreaterThan int

The age in days after last modification to delete the blob.

TierToArchiveAfterDaysSinceModificationGreaterThan int

The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

TierToCoolAfterDaysSinceModificationGreaterThan int

The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.

DeleteAfterDaysSinceModificationGreaterThan int

The age in days after last modification to delete the blob.

TierToArchiveAfterDaysSinceModificationGreaterThan int

The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

TierToCoolAfterDaysSinceModificationGreaterThan int

The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.

deleteAfterDaysSinceModificationGreaterThan number

The age in days after last modification to delete the blob.

tierToArchiveAfterDaysSinceModificationGreaterThan number

The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

tierToCoolAfterDaysSinceModificationGreaterThan number

The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.

deleteAfterDaysSinceModificationGreaterThan float

The age in days after last modification to delete the blob.

tierToArchiveAfterDaysSinceModificationGreaterThan float

The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

tierToCoolAfterDaysSinceModificationGreaterThan float

The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.

GetPolicyRuleActionSnapshot

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

DeleteAfterDaysSinceCreationGreaterThan int

The age in days after create to delete the snaphot.

DeleteAfterDaysSinceCreationGreaterThan int

The age in days after create to delete the snaphot.

deleteAfterDaysSinceCreationGreaterThan number

The age in days after create to delete the snaphot.

deleteAfterDaysSinceCreationGreaterThan float

The age in days after create to delete the snaphot.

GetPolicyRuleFilter

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

BlobTypes List<string>

An array of predefined values. Only blockBlob is supported.

PrefixMatches List<string>

An array of strings for prefixes to be matched.

BlobTypes []string

An array of predefined values. Only blockBlob is supported.

PrefixMatches []string

An array of strings for prefixes to be matched.

blobTypes string[]

An array of predefined values. Only blockBlob is supported.

prefixMatches string[]

An array of strings for prefixes to be matched.

blobTypes List[str]

An array of predefined values. Only blockBlob is supported.

prefixMatches List[str]

An array of strings for prefixes to be matched.

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.