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