c1ced07b134cb7dc2ab78fca3ed2b2c261a72ba0
[plcapi.git] / PLC / Methods / GetNetworkTypes.py
1 # $Id$
2 # $URL$
3 from PLC.Faults import *
4 from PLC.Method import Method
5 from PLC.Parameter import Parameter, Mixed
6 from PLC.NetworkTypes import NetworkType, NetworkTypes
7 from PLC.Auth import Auth
8
9 class GetNetworkTypes(Method):
10     """
11     Returns a list of all valid network types.
12     """
13
14     roles = ['admin', 'pi', 'user', 'tech', 'node']
15
16     accepts = [
17         Auth()
18         ]
19
20     returns = [NetworkType.fields['type']]
21
22
23     def call(self, auth):
24         return [network_type['type'] for network_type in NetworkTypes(self.api)]