# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables

class GetPolicyResult:
    """
    A collection of values returned by getPolicy.
    """
    def __init__(__self__, id=None, rules=None, storage_account_id=None):
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        __self__.id = id
        """
        The provider-assigned unique ID for this managed resource.
        """
        if rules and not isinstance(rules, list):
            raise TypeError("Expected argument 'rules' to be a list")
        __self__.rules = rules
        """
        A `rule` block as documented below.
        """
        if storage_account_id and not isinstance(storage_account_id, str):
            raise TypeError("Expected argument 'storage_account_id' to be a str")
        __self__.storage_account_id = storage_account_id
class AwaitableGetPolicyResult(GetPolicyResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetPolicyResult(
            id=self.id,
            rules=self.rules,
            storage_account_id=self.storage_account_id)

def get_policy(storage_account_id=None,opts=None):
    """
    Use this data source to access information about an existing Storage Management Policy.

    ## Example Usage

    ```python
    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"])
    ```


    :param str storage_account_id: Specifies the id of the storage account to retrieve the management policy for.
    """
    __args__ = dict()


    __args__['storageAccountId'] = storage_account_id
    if opts is None:
        opts = pulumi.InvokeOptions()
    if opts.version is None:
        opts.version = utilities.get_version()
    __ret__ = pulumi.runtime.invoke('azure:storage/getPolicy:getPolicy', __args__, opts=opts).value

    return AwaitableGetPolicyResult(
        id=__ret__.get('id'),
        rules=__ret__.get('rules'),
        storage_account_id=__ret__.get('storageAccountId'))
