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