@@ -56,31 +56,35 @@ def get_rule_group(self, folder_uid, group_uid):
56
56
"""
57
57
:param folder_uid:
58
58
:param group_uid:
59
+ :param disable_provenance:
59
60
:return:
60
61
"""
61
62
get_rule_group_path = "/v1/provisioning/folder/%s/rule-groups/%s" % (folder_uid , group_uid )
62
63
r = self .client .GET (get_rule_group_path )
63
64
return r
64
65
65
- def update_rule_group (self , folder_uid , group_uid , alertrule_group ):
66
+ def update_rule_group (self , folder_uid , group_uid , alertrule_group , disable_provenance = False ):
66
67
"""
67
68
:param folder_uid:
68
69
:param group_uid:
69
70
:param alertrule_group:
70
71
:return:
71
72
"""
72
- update_rule_group_interval_path = "/v1/provisioning/folder/%s/rule-groups/%s" % (folder_uid , group_uid )
73
- r = self .client .PUT (update_rule_group_interval_path , json = alertrule_group )
73
+ headers = {}
74
+ if disable_provenance :
75
+ headers ["X-Disable-Provenance" ] = "true"
76
+ update_rule_group_path = "/v1/provisioning/folder/%s/rule-groups/%s" % (folder_uid , group_uid )
77
+ r = self .client .PUT (update_rule_group_path , json = alertrule_group , headers = headers )
74
78
return r
75
79
76
- def update_rule_group_interval (self , folder_uid , group_uid , alertrule_group ):
80
+ def update_rule_group_interval (self , folder_uid , group_uid , alertrule_group , disable_provenance = False ):
77
81
"""
78
82
:param folder_uid:
79
83
:param group_uid:
80
84
:param alertrule_group:
81
85
:return:
82
86
"""
83
- return self .update_rule_group (folder_uid , group_uid , alertrule_group )
87
+ return self .update_rule_group (folder_uid , group_uid , alertrule_group , disable_provenance )
84
88
85
89
def delete_alertrule (self , alertrule_uid ):
86
90
"""
@@ -101,14 +105,19 @@ def get_contactpoints(self):
101
105
get_contactpoints_path = "/v1/provisioning/contact-points"
102
106
return self .client .GET (get_contactpoints_path )
103
107
104
- def create_contactpoint (self , contactpoint ):
108
+ def create_contactpoint (self , contactpoint , disable_provenance = False ):
105
109
"""
106
110
Creates single contact point
107
111
@param contactpoint:
112
+ @param disable_provenance:
108
113
@return:
109
114
"""
115
+ headers = {}
116
+ if disable_provenance :
117
+ headers ["X-Disable-Provenance" ] = "true"
118
+
110
119
create_contactpoint_path = "/v1/provisioning/contact-points"
111
- return self .client .POST (create_contactpoint_path , json = contactpoint )
120
+ return self .client .POST (create_contactpoint_path , json = contactpoint , headers = headers )
112
121
113
122
def update_contactpoint (self , contactpoint_uid , contactpoint ):
114
123
"""
@@ -137,14 +146,19 @@ def get_notification_policy_tree(self):
137
146
get_notification_policy_tree_path = "/v1/provisioning/policies"
138
147
return self .client .GET (get_notification_policy_tree_path )
139
148
140
- def set_notification_policy_tree (self , notification_policy_tree ):
149
+ def set_notification_policy_tree (self , notification_policy_tree , disable_provenance = False ):
141
150
"""
142
151
Sets notification policy tree
143
152
@param notification_policy_tree:
153
+ @param disable_provenance:
144
154
@return:
145
155
"""
156
+ headers = {}
157
+ if disable_provenance :
158
+ headers ["X-Disable-Provenance" ] = "true"
159
+
146
160
set_notification_policy_tree_path = "/v1/provisioning/policies"
147
- return self .client .PUT (set_notification_policy_tree_path , json = notification_policy_tree )
161
+ return self .client .PUT (set_notification_policy_tree_path , json = notification_policy_tree , headers = headers )
148
162
149
163
def get_mute_timings (self ):
150
164
"""
@@ -162,13 +176,18 @@ def get_mute_timing(self, mutetiming_name):
162
176
get_mute_timing_path = "/v1/provisioning/mute-timings/%s" % mutetiming_name
163
177
return self .client .GET (get_mute_timing_path )
164
178
165
- def create_mute_timing (self , mutetiming ):
179
+ def create_mute_timing (self , mutetiming , disable_provenance = False ):
166
180
"""
167
181
Creates single mute timing
182
+ @param mutetiming:
183
+ @param disable_provenance:
168
184
@return:
169
185
"""
186
+ headers = {}
187
+ if disable_provenance :
188
+ headers ["X-Disable-Provenance" ] = "true"
170
189
create_mute_timing_path = "/v1/provisioning/mute-timings"
171
- return self .client .POST (create_mute_timing_path , json = mutetiming )
190
+ return self .client .POST (create_mute_timing_path , json = mutetiming , headers = headers )
172
191
173
192
def update_mute_timing (self , mutetiming_name , mutetiming ):
174
193
"""
@@ -203,15 +222,19 @@ def get_template(self, template_name):
203
222
get_template_path = "/v1/provisioning/templates/%s" % template_name
204
223
return self .client .GET (get_template_path )
205
224
206
- def create_or_update_template (self , template_name , template ):
225
+ def create_or_update_template (self , template_name , template , disable_provenance = False ):
207
226
"""
208
227
Creates or updates (if given template_name exists) template
209
228
@param template_name:
210
229
@param template:
230
+ @param disable_provenance:
211
231
@return:
212
232
"""
233
+ headers = {}
234
+ if disable_provenance :
235
+ headers ["X-Disable-Provenance" ] = "true"
213
236
create_template_path = "/v1/provisioning/templates/%s" % template_name
214
- return self .client .PUT (create_template_path , json = template )
237
+ return self .client .PUT (create_template_path , json = template , headers = headers )
215
238
216
239
def delete_template (self , template_name ):
217
240
"""
0 commit comments