42359cea6998e1df7c6582bef5d99c82f44502f9
[plcapi.git] / trunk / PLC / Methods / GetNodeNetworkSettings.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.Persons import Person, Persons
11 from PLC.Auth import Auth
12
13 from PLC.NodeNetworkSettings import NodeNetworkSetting, NodeNetworkSettings
14 from PLC.Sites import Site, Sites
15 from PLC.NodeNetworks import NodeNetwork, NodeNetworks
16
17 class GetNodeNetworkSettings(Method):
18     """
19     Returns an array of structs containing details about
20     nodenetworks and related settings.
21
22     If nodenetwork_setting_filter is specified and is an array of
23     nodenetwork setting identifiers, only nodenetwork settings matching
24     the filter will be returned. If return_fields is specified, only
25     the specified details will be returned.
26     """
27
28     roles = ['admin', 'pi', 'user', 'node']
29
30     accepts = [
31         Auth(),
32         Mixed([NodeNetworkSetting.fields['nodenetwork_setting_id']],
33               Parameter(int,"Nodenetwork setting id"),
34               Filter(NodeNetworkSetting.fields)),
35         Parameter([str], "List of fields to return", nullok = True)
36         ]
37
38     returns = [NodeNetworkSetting.fields]
39     
40
41     def call(self, auth, nodenetwork_setting_filter = None, return_fields = None):
42
43         nodenetwork_settings = NodeNetworkSettings(self.api, nodenetwork_setting_filter, return_fields)
44
45         return nodenetwork_settings