@@ -236,40 +236,6 @@ def delete_ws_folder(ws, dir_name):
236
236
else :
237
237
loggr .info (f"Error creating alert: { (response .json ())} " )
238
238
239
- if alert_id is not None :
240
- response = requests .get (
241
- 'https://%s/api/2.0/preview/scim/v2/Users?filter=userName+eq+%s' % (DOMAIN ,ws_to_load .alert_subscriber_user_id ),
242
- headers = {'Authorization' : 'Bearer %s' % TOKEN },
243
- json = None ,
244
- timeout = 60
245
- )
246
-
247
- result = json .loads (response .text )
248
- if result ['totalResults' ] != 0 :
249
- resources = result ['Resources' ]
250
- for resource in resources :
251
- user_id = resource ["id" ]
252
-
253
- if user_id is not None :
254
- response = session .post (
255
- 'https://%s/api/2.0/preview/sql/alerts/%s/subscriptions' % (DOMAIN , alert_id ),
256
- headers = {'Authorization' : 'Bearer %s' % TOKEN },
257
- json = {
258
- "alert_id" :alert_id ,
259
- "user_id" :user_id
260
- },
261
- timeout = 60
262
- )
263
-
264
- if response .status_code == 200 :
265
- loggr .info (f"Alert subscription is successfuly associated to user { response .json ()['user' ]} !" )
266
- else :
267
- loggr .info (f"Error creating alert subscription: { (response .json ())} " )
268
- dbutils .notebook .exit ("Error creating alert subscription" )
269
- else :
270
- loggr .info (f"User not found with login : { ws_to_load .alert_subscriber_user_id } " )
271
- dbutils .notebook .exit ("Error creating alert subscription, Configured user not found " + user_id )
272
-
273
239
# COMMAND ----------
274
240
275
241
dbutils .notebook .exit ('OK' )
0 commit comments