1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.SliceAttributeTypes import SliceAttributeType, SliceAttributeTypes
5 from PLC.Auth import Auth
7 can_update = lambda (field, value): field in \
8 ['name', 'description', 'min_role_id']
10 class AddSliceAttributeType(Method):
12 Adds a new type of slice attribute. Any fields specified in
13 attribute_type_fields are used, otherwise defaults are used.
15 Returns the new attribute_type_id (> 0) if successful, faults
21 attribute_type_fields = dict(filter(can_update, SliceAttributeType.fields.items()))
28 returns = Parameter(int, 'New attribute_id (> 0) if successful')
31 def call(self, auth, attribute_type_fields):
32 attribute_type_fields = dict(filter(can_update, attribute_type_fields.items()))
33 attribute_type = SliceAttributeType(self.api, attribute_type_fields)
36 self.object_ids = [attribute_type['attribute_type_id']]
38 return attribute_type['attribute_type_id']