.. versionadded:: 2019.2.0

    List all policy definitions for a subscription.

    :param hide_builtin: Boolean which will filter out BuiltIn policy definitions from the result.

    CLI Example:

    .. code-block:: bash

        salt-call azurearm_resource.policy_definitions_list

def policy_definitions_list(hide_builtin=False, **kwargs):
    '''
    .. versionadded:: 2019.2.0

    List all policy definitions for a subscription.

    :param hide_builtin: Boolean which will filter out BuiltIn policy definitions from the result.

    CLI Example:

    .. code-block:: bash

        salt-call azurearm_resource.policy_definitions_list

    '''
    result = {}
    polconn = __utils__['azurearm.get_client']('policy', **kwargs)
    try:
        policy_defs = __utils__['azurearm.paged_object_to_list'](polconn.policy_definitions.list())

        for policy in policy_defs:
            if not (hide_builtin and policy['policy_type'] == 'BuiltIn'):
                result[policy['name']] = policy
    except CloudError as exc:
        __utils__['azurearm.log_cloud_error']('resource', str(exc), **kwargs)
        result = {'error': str(exc)}

    return result