1c9afc3ec863eea4295c59b8bb19ae60f3726e2b
[plcapi.git] / PLC / Methods / GetBootStates.py
1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.BootStates import BootState, BootStates
5 from PLC.Auth import Auth
6
7 class GetBootStates(Method):
8     """
9     Returns an array of all valid node boot states.
10     """
11
12     roles = ['admin', 'pi', 'user', 'tech']
13
14     accepts = [
15         Auth()
16         ]
17
18     returns = [BootState.fields['boot_state']]
19     
20     event_type = 'Get'
21     object_type = 'BootState'
22
23     def call(self, auth):
24         return [boot_state['boot_state'] for boot_state in BootStates(self.api)]