Implement policy in code (3)

This commit will move all default policies to code for:
- telemetry:get_alarm_state
- telemetry:change_alarm_state
- telemetry:alarm_history
- telemetry:query_alarm_history

Change-Id: I78f7d723240a50cd9bb56b7a53dad7eb945c0850
Co-authored-By: Hieu LE <hieulq@vn.fujitsu.com>
This commit is contained in:
Dai Dang Van 2017-10-19 11:40:28 +07:00
parent 84f27adcb8
commit 93d322c7c7
2 changed files with 44 additions and 7 deletions

View File

@ -100,6 +100,50 @@ rules = [
'method': 'DELETE'
}
]
),
policy.DocumentedRuleDefault(
name="telemetry:get_alarm_state",
check_str=RULE_ADMIN_OR_OWNER,
description='Get the state of this alarm.',
operations=[
{
'path': '/v2/alarms/{alarm_id}/state',
'method': 'GET'
}
]
),
policy.DocumentedRuleDefault(
name="telemetry:change_alarm_state",
check_str=RULE_ADMIN_OR_OWNER,
description='Set the state of this alarm.',
operations=[
{
'path': '/v2/alarms/{alarm_id}/state',
'method': 'PUT'
}
]
),
policy.DocumentedRuleDefault(
name="telemetry:alarm_history",
check_str=RULE_ADMIN_OR_OWNER,
description='Assembles the alarm history requested.',
operations=[
{
'path': '/v2/alarms/{alarm_id}/history',
'method': 'GET'
}
]
),
policy.DocumentedRuleDefault(
name="telemetry:query_alarm_history",
check_str=RULE_ADMIN_OR_OWNER,
description='Define query for retrieving AlarmChange data.',
operations=[
{
'path': '/v2/query/alarms/history',
'method': 'POST'
}
]
)
]

View File

@ -1,7 +0,0 @@
{
"telemetry:get_alarm_state": "rule:admin_or_owner",
"telemetry:change_alarm_state": "rule:admin_or_owner",
"telemetry:alarm_history": "rule:admin_or_owner",
"telemetry:query_alarm_history": "rule:admin_or_owner"
}