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