blob: 9d8a6dc1ac83c28b41f1e697366b40c2572cb156 [file] [log] [blame]
Oleksiy Petrenko5013e682018-11-16 14:26:36 +02001from aodhv2.common import send
2from aodhv2.arg_converter import get_by_name_or_uuid_multiple
3
4
5@send('post')
6def 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')
13def 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')
20def 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')
27def 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')
34def 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')
41def 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')
48def alarm_state_get(alarm_id, **kwargs):
49 url = '/alarms/{}/state'.format(alarm_id)
50 return url, None