Add ability to create event and query acl rules for a given acl token (#2076)
This commit is contained in:
parent
277a2b5df1
commit
4af591daef
1 changed files with 6 additions and 2 deletions
|
@ -236,8 +236,12 @@ def yml_to_rules(module, yml_rules):
|
||||||
rules.add_rule('key', Rule(rule['key'], rule['policy']))
|
rules.add_rule('key', Rule(rule['key'], rule['policy']))
|
||||||
elif ('service' in rule and 'policy' in rule):
|
elif ('service' in rule and 'policy' in rule):
|
||||||
rules.add_rule('service', Rule(rule['service'], rule['policy']))
|
rules.add_rule('service', Rule(rule['service'], rule['policy']))
|
||||||
|
elif ('event' in rule and 'policy' in rule):
|
||||||
|
rules.add_rule('event', Rule(rule['event'], rule['policy']))
|
||||||
|
elif ('query' in rule and 'policy' in rule):
|
||||||
|
rules.add_rule('query', Rule(rule['query'], rule['policy']))
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg="a rule requires a key/service and a policy.")
|
module.fail_json(msg="a rule requires a key/service/event or query and a policy.")
|
||||||
return rules
|
return rules
|
||||||
|
|
||||||
template = '''%s "%s" {
|
template = '''%s "%s" {
|
||||||
|
@ -245,7 +249,7 @@ template = '''%s "%s" {
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RULE_TYPES = ['key', 'service']
|
RULE_TYPES = ['key', 'service', 'event', 'query']
|
||||||
|
|
||||||
class Rules:
|
class Rules:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue