List all configured policies.

        Supported methods:
            GET: /sys/policy. Produces: 200 application/json

        :return: The JSON response of the request.
        :rtype: dict
329493
def list_policies(self):
        
        api_path = '/v1/sys/policy'
        response = self._adapter.get(
            url=api_path,
        )
        return response.json()
571537
def get_all_user_policies(user_name, marker=None, max_items=None, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    try:
        info = conn.get_all_user_policies(user_name, marker, max_items)
        if not info:
            return False
        _list = info.list_user_policies_response.list_user_policies_result
        return _list.policy_names
    except boto.exception.BotoServerError as e:
        log.debug(e)
        log.error('Failed to get policies for user %s.', user_name)
        return False
1151916
def info(self):
        
        ddoc_info = self.r_session.get(
            '/'.join([self.document_url, '_info']))
        ddoc_info.raise_for_status()
        return response_to_json_dict(ddoc_info)
1119959
def settings_system(self):
        
        response = self._get(url.settings_system)
        self._check_response(response, 200)
        return self._create_response(response)
887782
def get_iam_policy(self):
        """"""
        checker = AwsLimitChecker()
        policy = checker.get_required_iam_policy()
        return json.dumps(policy, sort_keys=True, indent=2)
602691
def list_key_policies(key_id, limit=None, marker=None, region=None, key=None,
                      keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if key_id.startswith('alias/'):
        key_id = _get_key_id(key_id)
    r = {}
    try:
        key_policies = conn.list_key_policies(
            key_id,
            limit=limit,
            marker=marker
        )
        # TODO: handle limit, marker and truncation automatically.
        r['key_policies'] = key_policies['PolicyNames']
    except boto.exception.BotoServerError as e:
        r['error'] = __utils__['boto.get_error'](e)
    return r
218921
def json(self):
        
        return {
            "status": self.status,
            "criteria_name": self.criteria_name,
            "warnings": [w.json() for w in self.warnings],
            "settings": self.settings,
        }
20056
def list_entities_for_policy(policy_name, path_prefix=None, entity_filter=None,
                  region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    retries = 30

    params = {}
    for arg in ('path_prefix', 'entity_filter'):
        if locals()[arg] is not None:
            params[arg] = locals()[arg]

    policy_arn = _get_policy_arn(policy_name, region, key, keyid, profile)
    while retries:
        try:
            allret = {
              'policy_groups': [],
              'policy_users': [],
              'policy_roles': [],
            }
            for ret in __utils__['boto.paged_call'](conn.list_entities_for_policy, policy_arn=policy_arn, **params):
                for k, v in six.iteritems(allret):
                    v.extend(ret.get('list_entities_for_policy_response', {}).get('list_entities_for_policy_result', {}).get(k))
            return allret
        except boto.exception.BotoServerError as e:
            if e.error_code == 'Throttling':
                log.debug("Throttled by AWS API, will retry in 5 seconds...")
                time.sleep(5)
                retries -= 1
                continue
            log.error('Failed to list entities for IAM policy %s: %s', policy_name, e.message)
            return {}
    return {}
1032253
def get_policy_for_vhost(self, vhost, name):
        
        return self._api_get('/api/policies/{0}/{1}'.format(
            urllib.parse.quote_plus(vhost),
            urllib.parse.quote_plus(name),
        ))
1115629
def describe_policy(policyName,
             region=None, key=None, keyid=None, profile=None):
    '''
    

    '''

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        policy = conn.get_policy(policyName=policyName)
        if policy:
            keys = ('policyName', 'policyArn', 'policyDocument',
                    'defaultVersionId')
            return {'policy': dict([(k, policy.get(k)) for k in keys])}
        else:
            return {'policy': None}
    except ClientError as e:
        err = __utils__['boto3.get_error'](e)
        if e.response.get('Error', {}).get('Code') == 'ResourceNotFoundException':
            return {'policy': None}
        return {'error': __utils__['boto3.get_error'](e)}
108062
def slas_policy_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/slas/policies/{id}"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
1049720
def list_firewall_policies(self, retrieve_all=True, **_params):
        """"""
        # Pass filters in "params" argument to do_request

        return self.list('firewall_policies', self.firewall_policies_path,
                         retrieve_all, **_params)
28023
def to_json(self):
        

        result = super(Role, self).to_json()
        result.update({
            'name': self.name,
            'description': self.description,
            'permissions': self.permissions,
            'policies': self.policies
        })
        return result
563368
def list_qos_policies(self, retrieve_all=True, **_params):
        """"""
        # Pass filters in "params" argument to do_request
        return self.list('policies', self.qos_policies_path,
                         retrieve_all, **_params)
1271434
def issues_stats(self):
        
        response = self.requester.get(
            '/{endpoint}/{id}/issues_stats',
            endpoint=self.endpoint, id=self.id
        )
        return response.json()
1180103
def get_fw_dict(self):
        
        fw_dict = {}
        if self.fw_id is None:
            return fw_dict
        fw_dict = {'rules': {}, 'tenant_name': self.tenant_name,
                   'tenant_id': self.tenant_id, 'fw_id': self.fw_id,
                   'fw_name': self.fw_name,
                   'firewall_policy_id': self.active_pol_id,
                   'fw_type': self.fw_type, 'router_id': self.router_id}
        # When Firewall and Policy are both deleted and the SM is doing a
        # retry (maybe DCNM Out partition could not be deleted) during
        # which without this check, it throws an exception since
        # self.policies is empty. This is also an issue during restart.
        if self.active_pol_id not in self.policies:
            return fw_dict
        pol_dict = self.policies[self.active_pol_id]
        for rule in pol_dict['rule_dict']:
            fw_dict['rules'][rule] = self.rules[rule]
        return fw_dict
463829
def rbac_policy_list(request, **kwargs):
    """"""
    policies = neutronclient(request).list_rbac_policies(
        **kwargs).get('rbac_policies')
    return [RBACPolicy(p) for p in policies]