a0037730d337eb8855af413ae2d7f8f8ac51b3d3
[plcapi.git] / PLC / Methods / GetRoutes.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.Routes import Route, Routes
8 from PLC.Auth import Auth
9
10 class GetRoutes(Method):
11     """
12     Returns an array of structs containing details about routes.
13     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(Route.fields['route_id'])],
26               Parameter (int, "route id"),
27               Filter(Route.fields)),
28         Parameter([str], "List of fields to return", nullok = True)
29         ]
30
31     returns = [Route.fields]
32
33     def call(self, auth, route_filter = None, return_fields = None):
34         return Routes(self.api, route_filter, return_fields)