c88fb7b1939e19f09b182de3085eda20e74ed707
[plcapi.git] / PLC / Methods / GetKeyTypes.py
1 # $Id$
2 from PLC.Faults import *
3 from PLC.Method import Method
4 from PLC.Parameter import Parameter, Mixed
5 from PLC.KeyTypes import KeyType, KeyTypes
6 from PLC.Auth import Auth
7
8 class GetKeyTypes(Method):
9     """
10     Returns an array of all valid key types.
11     """
12
13     roles = ['admin', 'pi', 'user', 'tech', 'node']
14
15     accepts = [
16         Auth()
17         ]
18
19     returns = [KeyType.fields['key_type']]
20
21
22     def call(self, auth):
23         return [key_type['key_type'] for key_type in KeyTypes(self.api)]