Oleksiy Petrenko | 5013e68 | 2018-11-16 14:26:36 +0200 | [diff] [blame] | 1 | from aodhv2.common import send |
| 2 | from aodhv2.arg_converter import get_by_name_or_uuid_multiple |
| 3 | |
| 4 | |
| 5 | @send('post') |
| 6 | def alarm_create(**kwargs): |
| 7 | url = '/alarms' |
| 8 | return url, kwargs |
| 9 | |
| 10 | |
| 11 | @get_by_name_or_uuid_multiple([('alarm', 'alarm_id')]) |
| 12 | @send('get') |
| 13 | def alarm_get_details(alarm_id, **kwargs): |
| 14 | url = '/alarms/{}'.format(alarm_id) |
| 15 | return url, None |
| 16 | |
| 17 | |
| 18 | @get_by_name_or_uuid_multiple([('alarm', 'alarm_id')]) |
| 19 | @send('put') |
| 20 | def alarm_update(alarm_id, **kwargs): |
| 21 | url = '/alarms/{}'.format(alarm_id) |
| 22 | return url, kwargs |
| 23 | |
| 24 | |
| 25 | @get_by_name_or_uuid_multiple([('alarm', 'alarm_id')]) |
| 26 | @send('delete') |
| 27 | def alarm_delete(alarm_id, **kwargs): |
| 28 | url = '/alarms/{}'.format(alarm_id) |
| 29 | return url, None |
| 30 | |
| 31 | |
| 32 | @get_by_name_or_uuid_multiple([('alarm', 'alarm_id')]) |
| 33 | @send('get') |
| 34 | def alarm_history_get(alarm_id, **kwargs): |
| 35 | url = '/alarms/{}/history'.format(alarm_id) |
| 36 | return url, None |
| 37 | |
| 38 | |
| 39 | @get_by_name_or_uuid_multiple([('alarm', 'alarm_id')]) |
| 40 | @send('put') |
| 41 | def alarm_state_set(alarm_id, state, **kwargs): |
| 42 | url = '/alarms/{}/state'.format(alarm_id) |
| 43 | return url, {'state': state} |
| 44 | |
| 45 | |
| 46 | @get_by_name_or_uuid_multiple([('alarm', 'alarm_id')]) |
| 47 | @send('get') |
| 48 | def alarm_state_get(alarm_id, **kwargs): |
| 49 | url = '/alarms/{}/state'.format(alarm_id) |
| 50 | return url, None |