@@ -45,13 +45,15 @@ def default_deflector_is_up(self):
4545
4646 def create_notification (self , single_message = False , log_body = _DEFAULT_LOG_BODY , description = '' , title = 'N' ):
4747 notification_configuration = {
48- 'config' : {
49- 'log_body' : log_body ,
50- 'single_notification' : single_message ,
51- 'type' : 'logging-alert-notification'
52- },
53- 'description' : description ,
54- 'title' : title
48+ 'entity' : {
49+ 'config' : {
50+ 'log_body' : log_body ,
51+ 'single_notification' : single_message ,
52+ 'type' : 'logging-alert-notification'
53+ },
54+ 'description' : description ,
55+ 'title' : title
56+ }
5557 }
5658 response = self ._post ('events/notifications' , notification_configuration )
5759 notification = response .json ()
@@ -66,34 +68,37 @@ def create_event_definition(self, notification_identifier, streams=None, backlog
6668 if streams is None :
6769 streams = []
6870 events_definition_configuration = {
69- 'alert' : True ,
70- 'config' : {
71- 'conditions' : conditions ,
72- 'event_limit' : 100 ,
73- 'execute_every_ms' : period * 1000 ,
74- 'filters' : [],
75- 'group_by' : [],
76- 'query' : '' ,
77- 'query_parameters' : [],
78- 'search_within_ms' : period * 1000 ,
79- 'series' : series ,
80- 'streams' : streams ,
81- 'type' : 'aggregation-v1'
82- },
83- 'description' : '' ,
84- 'field_spec' : {},
85- 'key_spec' : [],
86- 'notification_settings' : {
87- 'backlog_size' : backlog_size ,
88- 'grace_period_ms' : 0
71+ 'entity' : {
72+ 'alert' : True ,
73+ 'config' : {
74+ 'conditions' : conditions ,
75+ 'event_limit' : 100 ,
76+ 'execute_every_ms' : period * 1000 ,
77+ 'filters' : [],
78+ 'group_by' : [],
79+ 'query' : '' ,
80+ 'query_parameters' : [],
81+ 'search_within_ms' : period * 1000 ,
82+ 'series' : series ,
83+ 'streams' : streams ,
84+ 'type' : 'aggregation-v1'
85+ },
86+ 'description' : '' ,
87+ 'field_spec' : {},
88+ 'key_spec' : [],
89+ 'notification_settings' : {
90+ 'backlog_size' : backlog_size ,
91+ 'grace_period_ms' : 0
92+ },
93+ 'notifications' : [{
94+ 'notification_id' : notification_identifier
95+ }],
96+ 'priority' : 2 ,
97+ 'title' : 'E'
8998 },
90- 'notifications' : [{
91- 'notification_id' : notification_identifier
92- }],
93- 'priority' : 2 ,
94- 'title' : 'E'
99+ 'share_request' : {}
95100 }
96- self ._post ('events/definitions' , events_definition_configuration )
101+ self ._post ('events/definitions?schedule=true ' , events_definition_configuration )
97102
98103 def gelf_input_is_running (self , identifier ):
99104 response = self ._get ('system/inputstates/' )
@@ -135,10 +140,12 @@ def create_stream_with_rule(self, title, field, value):
135140 response = self ._get ('system/indices/index_sets' )
136141 default_index_set_identifier = response .json ()['index_sets' ][0 ]['id' ]
137142 stream = {
138- 'description' : title ,
139- 'index_set_id' : default_index_set_identifier ,
140- 'remove_matches_from_default_stream' : False ,
141- 'title' : title
143+ 'entity' : {
144+ 'description' : title ,
145+ 'index_set_id' : default_index_set_identifier ,
146+ 'remove_matches_from_default_stream' : False ,
147+ 'title' : title },
148+ 'share_request' : {}
142149 }
143150 response = self ._post ('streams' , stream )
144151 stream_identifier = response .json ()['stream_id' ]
0 commit comments