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