@@ -108,6 +108,19 @@ def get_n_connected_agents(self):
108
108
data = res .json ()
109
109
return [True , data ['total' ]]
110
110
111
+ def list_notification_channels (self ):
112
+ '''**Description**
113
+ List all configured Notification Channels
114
+
115
+ **Arguments**
116
+ none
117
+
118
+ **Success Return Value**
119
+ A JSON representation of all the notification channels
120
+ '''
121
+ res = requests .get (self .url + '/api/notificationChannels' , headers = self .hdrs , verify = self .ssl_verify )
122
+ return self ._request_result (res )
123
+
111
124
def get_notification_ids (self , channels = None ):
112
125
'''**Description**
113
126
Get an array of all configured Notification Channel IDs, or a filtered subset of them.
@@ -126,7 +139,7 @@ def get_notification_ids(self, channels=None):
126
139
res = requests .get (self .url + '/api/notificationChannels' , headers = self .hdrs , verify = self .ssl_verify )
127
140
128
141
if not self ._checkResponse (res ):
129
- return [ False , self .lasterr ]
142
+ return False , self .lasterr
130
143
131
144
ids = []
132
145
@@ -184,9 +197,9 @@ def get_notification_ids(self, channels=None):
184
197
found = True
185
198
ids .append (ch ['id' ])
186
199
if not found :
187
- return [ False , "Channel not found: " + str (c )]
200
+ return False , "Channel not found: " + str (c )
188
201
189
- return [ True , ids ]
202
+ return True , ids
190
203
191
204
def create_email_notification_channel (self , channel_name , email_recipients ):
192
205
channel_json = {
@@ -203,13 +216,26 @@ def create_email_notification_channel(self, channel_name, email_recipients):
203
216
res = requests .post (self .url + '/api/notificationChannels' , headers = self .hdrs , data = json .dumps (channel_json ), verify = self .ssl_verify )
204
217
return self ._request_result (res )
205
218
219
+ def create_notification_channel (self , channel ):
220
+ channel ["id" ] = None
221
+ channel ["version" ] = None
222
+ channel ["createdOn" ] = None
223
+ channel ["modifiedOn" ] = None
224
+ channel_json = {
225
+ 'notificationChannel' : channel
226
+ }
227
+
228
+ res = requests .post (self .url + '/api/notificationChannels' , headers = self .hdrs , data = json .dumps (channel_json ),
229
+ verify = self .ssl_verify )
230
+ return self ._request_result (res )
231
+
206
232
def get_notification_channel (self , id ):
207
233
208
234
res = requests .get (self .url + '/api/notificationChannels/' + str (id ), headers = self .hdrs , verify = self .ssl_verify )
209
235
if not self ._checkResponse (res ):
210
- return [ False , self .lasterr ]
236
+ return False , self .lasterr
211
237
212
- return [ True , res .json ()['notificationChannel' ] ]
238
+ return True , res .json ()['notificationChannel' ]
213
239
214
240
def update_notification_channel (self , channel ):
215
241
if 'id' not in channel :
@@ -224,8 +250,8 @@ def delete_notification_channel(self, channel):
224
250
225
251
res = requests .delete (self .url + '/api/notificationChannels/' + str (channel ['id' ]), headers = self .hdrs , verify = self .ssl_verify )
226
252
if not self ._checkResponse (res ):
227
- return [ False , self .lasterr ]
228
- return [ True , None ]
253
+ return False , self .lasterr
254
+ return True , None
229
255
230
256
def get_data_retention_info (self ):
231
257
'''**Description**
0 commit comments