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