step2 : basic functions for handling nodetags and nodegroups - still highly volatile
[plcapi.git] / PLC / Methods / GetInterfaceSettings.py
1 #
2 # Thierry Parmentelat - INRIA
3 #
4 # $Revision$
5 #
6 from PLC.Faults import *
7 from PLC.Method import Method
8 from PLC.Parameter import Parameter, Mixed
9 from PLC.Filter import Filter
10 from PLC.Auth import Auth
11
12 from PLC.InterfaceSettings import InterfaceSetting, InterfaceSettings
13 from PLC.Sites import Site, Sites
14 from PLC.Interfaces import Interface, Interfaces
15
16 class GetInterfaceSettings(Method):
17     """
18     Returns an array of structs containing details about
19     interfaces and related settings.
20
21     If interface_setting_filter is specified and is an array of
22     interface setting identifiers, only interface settings matching
23     the filter will be returned. If return_fields is specified, only
24     the specified details will be returned.
25     """
26
27     roles = ['admin', 'pi', 'user', 'node']
28
29     accepts = [
30         Auth(),
31         Mixed([InterfaceSetting.fields['interface_setting_id']],
32               Parameter(int,"Interface setting id"),
33               Filter(InterfaceSetting.fields)),
34         Parameter([str], "List of fields to return", nullok = True)
35         ]
36
37     returns = [InterfaceSetting.fields]
38     
39
40     def call(self, auth, interface_setting_filter = None, return_fields = None):
41
42         interface_settings = InterfaceSettings(self.api, interface_setting_filter, return_fields)
43
44         return interface_settings