Return an instance of the ``_Policy`` class given the filters config.
167840
def _get_policy_object(platform,
                       filters=None,
                       pillar_key='acl',
                       pillarenv=None,
                       saltenv=None,
                       merge_pillar=True):
    '''
    
    '''
    policy = _Policy()
    policy_filters = []
    if not filters:
        filters = []
    for filter_ in filters:
        if not filter_ or not isinstance(filter_, dict):
            continue  # go to the next filter
        filter_name = filter_.keys()[0]
        filter_config = filter_.values()[0]
        header = capirca.lib.policy.Header()  # same header everywhere
        target_opts = [
            platform,
            filter_name
        ]
        filter_options = filter_config.pop('options', None)
        if filter_options:
            filter_options = _make_it_list({}, filter_name, filter_options)
            # make sure the filter options are sent as list
            target_opts.extend(filter_options)
        target = capirca.lib.policy.Target(target_opts)
        header.AddObject(target)
        filter_terms = []
        for term_ in filter_config.get('terms', []):
            if term_ and isinstance(term_, dict):
                term_name = term_.keys()[0]
                term_fields = term_.values()[0]
                term = _get_term_object(filter_name,
                                        term_name,
                                        pillar_key=pillar_key,
                                        pillarenv=pillarenv,
                                        saltenv=saltenv,
                                        merge_pillar=merge_pillar,
                                        **term_fields)
            filter_terms.append(term)
        policy_filters.append(
            (header, filter_terms)
        )
    policy.filters = policy_filters
    log.debug('Policy config:')
    log.debug(six.text_type(policy))
    platform_generator = _import_platform_generator(platform)
    policy_config = platform_generator(policy, 2)
    log.debug('Generating policy config for %s:', platform)
    log.debug(six.text_type(policy_config))
    return policy_config
252930
public static filterpolicy_binding get(nitro_service service, String name) throws Exception{
		filterpolicy_binding obj = new filterpolicy_binding();
		obj.set_name(name);
		filterpolicy_binding response = (filterpolicy_binding) obj.get_resource(service);
		return response;
	}
137420
def get_policy(self, name):
        

        address = _create_policy_address(name)
        policy_list_bytes = None

        try:
            policy_list_bytes = self._state_view.get(address=address)
        except KeyError:
            return None

        if policy_list_bytes is not None:
            policy_list = _create_from_bytes(policy_list_bytes,
                                             identity_pb2.PolicyList)
            for policy in policy_list.policies:
                if policy.name == name:
                    return policy
        return None
592135
def replace_policy(self, scaling_group, policy, name,
            policy_type, cooldown, change=None, is_percent=False,
            desired_capacity=None, args=None):
        
        policy_id = utils.get_id(policy)
        group_id = utils.get_id(scaling_group)
        uri = "/%s/%s/policies/%s" % (self.uri_base, group_id, policy_id)
        body = self._create_policy_body(name=name, policy_type=policy_type,
                cooldown=cooldown, change=change, is_percent=is_percent,
                desired_capacity=desired_capacity, args=args)
        resp, resp_body = self.api.method_put(uri, body=body)
683054
def create_filter(self):
        """"""
        return Filter(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
1243509
def verify_policy(opts)
      result = policy.constantize.call(opts)
    rescue NameError
      result = true
    ensure
      return result
    end
400281
def resource_types(self):
        """"""
        rtypes = set()
        for p in self.policies:
            rtypes.add(p.resource_type)
        return rtypes
882739
def _filter_config(self, config, fields=None):
        
        filter_fields_default = [
            'bind_password',
            'connection'
            ]

        filter_fields = fields or filter_fields_default
        return dict(
            map(
                lambda key: (key, '<hidden>' if key in filter_fields else config[key]),
                config.keys()
                )
            )
1062972
def auto_filters(cls):
    
    msg = 'Viewset must have auto_filters_fields or auto_filters_exclude attribute when using auto_filters decorator'
    if not hasattr(cls, 'auto_filters_fields') and not hasattr(cls, 'auto_filters_exclude'):
        raise AssertionError(msg)
    dict_ = {}

    view_model = get_view_model(cls)
    auto_filters_fields = get_auto_filters_fields(cls, view_model)

    for auto_filter in auto_filters_fields:
        dict_[auto_filter] = AutoFilters(name=auto_filter)

    # create the inner Meta class and then the filter class
    dict_['Meta'] = type('Meta', (object, ), {'model': view_model, 'fields': ()})
    filter_class = type('DynamicFilterClass', (FilterSet, ), dict_)
    cls.filter_class = filter_class
    return cls
982442
public static transformpolicylabel[] get_filtered(nitro_service service, String filter) throws Exception{
		transformpolicylabel obj = new transformpolicylabel();
		options option = new options();
		option.set_filter(filter);
		transformpolicylabel[] response = (transformpolicylabel[]) obj.getfiltered(service, option);
		return response;
	}
900707
def policy(self, observations):
        
        input_data = self.input_block(observations)
        policy_base_output = self.policy_backbone(input_data)
        policy_params = self.action_head(policy_base_output)
        return policy_params
223235
def get_policy(policy_name,
               region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    try:
        ret = conn.get_policy(_get_policy_arn(policy_name,
                            region=region, key=key, keyid=keyid, profile=profile))
        return ret.get('get_policy_response', {}).get('get_policy_result', {})
    except boto.exception.BotoServerError:
        return None
1216418
def policy_definition_get(name, **kwargs):
    '''
    

    '''
    polconn = __utils__['azurearm.get_client']('policy', **kwargs)
    try:
        policy_def = polconn.policy_definitions.get(
            policy_definition_name=name
        )
        result = policy_def.as_dict()
    except CloudError as exc:
        __utils__['azurearm.log_cloud_error']('resource', str(exc), **kwargs)
        result = {'error': str(exc)}

    return result
758024
def get_filter_options(cls):
        
        attr = '_filter_options_%s' % id(cls)

        options = getattr(cls, attr, {})
        if options:
            return options

        for key in dir(cls):
            val = getattr(cls, key)
            if isinstance(val, FilterOpt):
                options[key] = val

        setattr(cls, attr, options)
        return options
1260096
public static policymap[] get_filtered(nitro_service service, String filter) throws Exception{
		policymap obj = new policymap();
		options option = new options();
		option.set_filter(filter);
		policymap[] response = (policymap[]) obj.getfiltered(service, option);
		return response;
	}
887782
def get_iam_policy(self):
        """"""
        checker = AwsLimitChecker()
        policy = checker.get_required_iam_policy()
        return json.dumps(policy, sort_keys=True, indent=2)
71438
def filters(self):
        """"""
        if self._filters is None:
            self._filters, self._attributes = self._fetch_configuration()
        return self._filters