svn keywords
[plcapi.git] / PLC / Methods / GetAddresses.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.Addresses import Address, Addresses
8 from PLC.Auth import Auth
9
10 class GetAddresses(Method):
11     """
12     Returns an array of structs containing details about addresses. If
13     address_filter is specified and is an array of address
14     identifiers, or a struct of address attributes, only addresses
15     matching the filter will be returned. If return_fields is
16     specified, only the specified details will be returned.
17     """
18
19     roles = ['admin', 'pi', 'user', 'tech', 'node']
20
21     accepts = [
22         Auth(),
23         Mixed([Address.fields['address_id']],
24               Filter(Address.fields)),
25         Parameter([str], "List of fields to return", nullok = True)
26         ]
27
28     returns = [Address.fields]
29     
30
31     def call(self, auth, address_filter = None, return_fields = None):
32         return Addresses(self.api, address_filter, return_fields)