2bd7f7c087868694d815b53a9bdb2da33c9bc510
[plcapi.git] / PLC / Methods / GetInterfaces.py
1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Filter import Filter
5 from PLC.Interfaces import Interface, Interfaces
6 from PLC.Auth import Auth
7
8 class GetInterfaces(Method):
9     """
10     Returns an array of structs containing details about node network
11     interfacess. If interfaces_filter is specified and is an array
12     of node network identifiers, or a struct of node network
13     fields and values, only node network interfaces matching the filter
14     will be returned.
15
16     If return_fields is given, only the specified details will be returned.
17     """
18
19     roles = ['admin', 'pi', 'user', 'tech', 'node', 'anonymous']
20
21     accepts = [
22         Auth(),
23         Mixed([Interface.fields['interface_id']],
24               Parameter (int, "interface id"),
25               Filter(Interface.fields)),
26         Parameter([str], "List of fields to return", nullok = True)
27         ]
28
29     returns = [Interface.fields]
30     
31     def call(self, auth, interface_filter = None, return_fields = None):
32         return Interfaces(self.api, interface_filter, return_fields)