only log errors if logging is enabled
[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     Returns an array of structs containing details about slice
10     attribute types. If attribute_type_filter is specified and
11     is an array of slice attribute type identifiers, or a
12     struct of slice attribute type attributes, only slice attribute
13     types matching the filter will be returned. If return_fields is
14     specified, only the specified details will be returned.
15     """
16
17     roles = ['admin', 'pi', 'user', 'tech', 'node']
18
19     accepts = [
20         Auth(),
21         Mixed([Mixed(SliceAttributeType.fields['attribute_type_id'],
22                      SliceAttributeType.fields['name'])],
23               Filter(SliceAttributeType.fields)),
24         Parameter([str], "List of fields to return", nullok = True)
25         ]
26
27     returns = [SliceAttributeType.fields]
28
29     def call(self, auth, attribute_type_filter = None, return_fields = None):
30         return SliceAttributeTypes(self.api, attribute_type_filter, return_fields)