allow filters to be specified in most Get() calls
[plcapi.git] / PLC / Methods / GetSliceAttributeTypes.py
1 from PLC.Method import Method
2 from PLC.Parameter import Parameter, Mixed
3 from PLC.Filter import Filter
4 from PLC.Auth import Auth
5 from PLC.SliceAttributeTypes import SliceAttributeType, SliceAttributeTypes
6
7 class GetSliceAttributeTypes(Method):
8     """
9     Return an array of structs containing details about all possible
10     slice and node attributes. If attribute_id_or_name_list is
11     specified, only the specified attributes will be queried.
12     """
13
14     roles = ['admin', 'pi', 'user', 'tech']
15
16     accepts = [
17         Auth(),
18         Mixed([Mixed(SliceAttributeType.fields['attribute_type_id'],
19                      SliceAttributeType.fields['name'])],
20               Filter(SliceAttributeType.fields))
21         ]
22
23     returns = [SliceAttributeType.fields]
24
25     def call(self, auth, attribute_type_filter = None):
26         return SliceAttributeTypes(self.api, attribute_type_filter).values()