X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=trunk%2FPLC%2FMethods%2FGetKeyTypes.py;fp=trunk%2FPLC%2FMethods%2FGetKeyTypes.py;h=32bb6580608e35eda234337cee0e1599dd9acf85;hb=5a4c1b1278ffa01e630fde47f7c54888ed20a576;hp=0000000000000000000000000000000000000000;hpb=cee5ab52df1c9f38b6eaff2dd354cb22f59028c7;p=plcapi.git diff --git a/trunk/PLC/Methods/GetKeyTypes.py b/trunk/PLC/Methods/GetKeyTypes.py new file mode 100644 index 0000000..32bb658 --- /dev/null +++ b/trunk/PLC/Methods/GetKeyTypes.py @@ -0,0 +1,22 @@ +from PLC.Faults import * +from PLC.Method import Method +from PLC.Parameter import Parameter, Mixed +from PLC.KeyTypes import KeyType, KeyTypes +from PLC.Auth import Auth + +class GetKeyTypes(Method): + """ + Returns an array of all valid key types. + """ + + roles = ['admin', 'pi', 'user', 'tech', 'node'] + + accepts = [ + Auth() + ] + + returns = [KeyType.fields['key_type']] + + + def call(self, auth): + return [key_type['key_type'] for key_type in KeyTypes(self.api)]