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