1414 See the License for the specific language governing permissions and
1515 limitations under the License.
1616"""
17- from hawkular .client import ApiOject , HawkularBaseClient
17+ from hawkular .client import ApiObject , HawkularBaseClient
1818
19- class Trigger (ApiOject ):
19+ class Trigger (ApiObject ):
2020 __slots__ = [
2121 'id' , 'name' , 'description' , 'type' , 'event_type' , 'event_category' ,
2222 'event_text' , 'event_category' , 'event_text' , 'severity' , 'context' ,
@@ -25,8 +25,7 @@ class Trigger(ApiOject):
2525 'enabled' , 'firing_match' , 'source'
2626 ]
2727
28-
29- class Condition (ApiOject ):
28+ class Condition (ApiObject ):
3029 __slots__ = [
3130 'trigger_id' , 'trigger_mode' , 'type' , 'condition_set_size' ,
3231 'condition_set_index' , 'condition_id' , 'context' , 'data_id' ,
@@ -36,14 +35,13 @@ class Condition(ApiOject):
3635 ]
3736
3837
39- class Dampening (ApiOject ):
38+ class Dampening (ApiObject ):
4039 __slots__ = [
4140 'trigger_id' , 'trigger_mode' , 'type' , 'eval_true_setting' ,
4241 'eval_total_setting' , 'eval_time_setting' , 'dampening_id'
4342 ]
4443
45-
46- class FullTrigger (ApiOject ):
44+ class FullTrigger (ApiObject ):
4745 defaults = {
4846 'conditions' : [],
4947 'dampenings' : []
@@ -59,20 +57,20 @@ def __init__(self, dictionary=dict()):
5957 self .conditions = Condition .list_to_object_list (udict .get ('conditions' ))
6058
6159
62- class GroupMemberInfo (ApiOject ):
60+ class GroupMemberInfo (ApiObject ):
6361 __slots__ = [
6462 'group_id' , 'member_id' , 'member_name' , 'member_description' , 'member_context' ,
6563 'member_tags' , 'data_id_map'
6664 ]
6765
6866
69- class GroupConditionsInfo (ApiOject ):
67+ class GroupConditionsInfo (ApiObject ):
7068 __slots__ = [
7169 'conditions' , 'data_id_member_map'
7270 ]
7371
7472 def __init__ (self , dictionary = dict ()):
75- ApiOject .__init__ (self , dictionary )
73+ ApiObject .__init__ (self , dictionary )
7674 udict = self .transform_dict_to_underscore (dictionary )
7775 self .conditions = Condition .list_to_object_list (udict .get ('conditions' ))
7876
@@ -192,6 +190,12 @@ def create_group_member(self, member):
192190 data = self ._serialize_object (member )
193191 return Trigger (self ._post (self ._service_url (['triggers' , 'groups' , 'members' ]), data ))
194192
193+ def put_trigger_conditions (self , trigger_id , trigger_mode , conditions ):
194+ data = self ._serialize_object (conditions )
195+ url = self ._service_url (['triggers' , trigger_id , 'conditions' , trigger_mode ])
196+ response = self ._put (url , data )
197+ return Condition .list_to_object_list (response )
198+
195199 def get_trigger_conditions (self , trigger_id ):
196200 """
197201 Get all conditions for a specific trigger
0 commit comments