Skip to content

Commit f70ac32

Browse files
author
Phil Rzewski
committed
Add get_notification_channel and update_notification_channel (needed so Kubewatcher can modify email recipient list)
1 parent 65d47a2 commit f70ac32

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

sdcclient/_client.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,24 @@ def create_email_notification_channel(self, channel_name, email_recipients):
228228
return [False, self.lasterr]
229229
return [True, res.json()]
230230

231+
def get_notification_channel(self, id):
232+
233+
res = requests.get(self.url + '/api/notificationChannels/' + str(id), headers=self.hdrs)
234+
if not self.__checkResponse(res):
235+
return [False, self.lasterr]
236+
237+
return [True, res.json()['notificationChannel']]
238+
239+
def update_notification_channel(self, channel):
240+
if 'id' not in channel:
241+
return [False, "Invalid channel format"]
242+
243+
res = requests.put(self.url + '/api/notificationChannels/' + str(channel['id']), headers=self.hdrs, data=json.dumps({ "notificationChannel": channel }))
244+
if not self.__checkResponse(res):
245+
return [False, self.lasterr]
246+
247+
return [True, res.json()]
248+
231249
def delete_notification_channel(self, channel):
232250
if 'id' not in channel:
233251
return [False, "Invalid channel format"]

0 commit comments

Comments
 (0)