@@ -37,6 +37,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
37
37
d ['enabled' ] = v [0 ]
38
38
elif kl == 'etag' :
39
39
d ['etag' ] = v [0 ]
40
+ else :
41
+ raise CLIError ('Unsupported Key {} is provided for parameter fusion_alert_rule. All possible keys are: '
42
+ 'alert-rule-template-name, enabled, etag' .format (k ))
40
43
d ['kind' ] = 'Fusion'
41
44
return d
42
45
@@ -76,6 +79,11 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
76
79
d ['enabled' ] = v [0 ]
77
80
elif kl == 'etag' :
78
81
d ['etag' ] = v [0 ]
82
+ else :
83
+ raise CLIError ('Unsupported Key {} is provided for parameter microsoft_security_incident_creation_alert'
84
+ '_rule. All possible keys are: display-names-filter, display-names-exclude-filter, '
85
+ 'product-filter, severities-filter, alert-rule-template-name, description, '
86
+ 'display-name, enabled, etag' .format (k ))
79
87
d ['kind' ] = 'MicrosoftSecurityIncidentCreation'
80
88
return d
81
89
@@ -125,6 +133,11 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
125
133
d ['tactics' ] = v
126
134
elif kl == 'etag' :
127
135
d ['etag' ] = v [0 ]
136
+ else :
137
+ raise CLIError ('Unsupported Key {} is provided for parameter scheduled_alert_rule. All possible keys '
138
+ 'are: query, query-frequency, query-period, severity, trigger-operator, '
139
+ 'trigger-threshold, alert-rule-template-name, description, display-name, enabled, '
140
+ 'suppression-duration, suppression-enabled, tactics, etag' .format (k ))
128
141
d ['kind' ] = 'Scheduled'
129
142
return d
130
143
@@ -154,6 +167,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
154
167
d ['title' ] = v [0 ]
155
168
elif kl == 'relation-name' :
156
169
d ['relation_name' ] = v [0 ]
170
+ else :
171
+ raise CLIError ('Unsupported Key {} is provided for parameter incident_info. All possible keys are: '
172
+ 'incident-id, severity, title, relation-name' .format (k ))
157
173
return d
158
174
159
175
@@ -180,6 +196,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
180
196
d ['state' ] = v [0 ]
181
197
elif kl == 'etag' :
182
198
d ['etag' ] = v [0 ]
199
+ else :
200
+ raise CLIError ('Unsupported Key {} is provided for parameter aad_data_connector. All possible keys '
201
+ 'are: tenant-id, state, etag' .format (k ))
183
202
d ['kind' ] = 'AzureActiveDirectory'
184
203
return d
185
204
@@ -207,6 +226,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
207
226
d ['state' ] = v [0 ]
208
227
elif kl == 'etag' :
209
228
d ['etag' ] = v [0 ]
229
+ else :
230
+ raise CLIError ('Unsupported Key {} is provided for parameter aatp_data_connector. All possible keys '
231
+ 'are: tenant-id, state, etag' .format (k ))
210
232
d ['kind' ] = 'AzureAdvancedThreatProtection'
211
233
return d
212
234
@@ -234,6 +256,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
234
256
d ['state' ] = v [0 ]
235
257
elif kl == 'etag' :
236
258
d ['etag' ] = v [0 ]
259
+ else :
260
+ raise CLIError ('Unsupported Key {} is provided for parameter asc_data_connector. All possible keys '
261
+ 'are: subscription-id, state, etag' .format (k ))
237
262
d ['kind' ] = 'AzureSecurityCenter'
238
263
return d
239
264
@@ -261,6 +286,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
261
286
d ['state' ] = v [0 ]
262
287
elif kl == 'etag' :
263
288
d ['etag' ] = v [0 ]
289
+ else :
290
+ raise CLIError ('Unsupported Key {} is provided for parameter aws_cloud_trail_data_connector. All '
291
+ 'possible keys are: aws-role-arn, state, etag' .format (k ))
264
292
d ['kind' ] = 'AmazonWebServicesCloudTrail'
265
293
return d
266
294
@@ -284,12 +312,16 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
284
312
v = properties [k ]
285
313
if kl == 'tenant-id' :
286
314
d ['tenant_id' ] = v [0 ]
287
- elif kl == 'state-data-types-alerts-state' :
288
- d ['state_data_types_alerts_state ' ] = v [0 ]
289
- elif kl == 'state-data-types-discovery-logs-state' :
290
- d ['state_data_types_discovery_logs_state ' ] = v [0 ]
315
+ elif kl == 'state-properties- data-types-alerts-state' :
316
+ d ['undefined ' ] = v [0 ]
317
+ elif kl == 'state-properties- data-types-discovery-logs-state' :
318
+ d ['state ' ] = v [0 ]
291
319
elif kl == 'etag' :
292
320
d ['etag' ] = v [0 ]
321
+ else :
322
+ raise CLIError ('Unsupported Key {} is provided for parameter mcas_data_connector. All possible keys '
323
+ 'are: tenant-id, state-properties-data-types-alerts-state, '
324
+ 'state-properties-data-types-discovery-logs-state, etag' .format (k ))
293
325
d ['kind' ] = 'MicrosoftCloudAppSecurity'
294
326
return d
295
327
@@ -317,14 +349,17 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
317
349
d ['state' ] = v [0 ]
318
350
elif kl == 'etag' :
319
351
d ['etag' ] = v [0 ]
352
+ else :
353
+ raise CLIError ('Unsupported Key {} is provided for parameter mdatp_data_connector. All possible keys '
354
+ 'are: tenant-id, state, etag' .format (k ))
320
355
d ['kind' ] = 'MicrosoftDefenderAdvancedThreatProtection'
321
356
return d
322
357
323
358
324
- class AddOfficeDataConnector (argparse .Action ):
359
+ class AddTiDataConnector (argparse .Action ):
325
360
def __call__ (self , parser , namespace , values , option_string = None ):
326
361
action = self .get_action (values , option_string )
327
- namespace .office_data_connector = action
362
+ namespace .ti_data_connector = action
328
363
329
364
def get_action (self , values , option_string ): # pylint: disable=no-self-use
330
365
try :
@@ -334,32 +369,29 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
334
369
properties = dict (properties )
335
370
except ValueError :
336
371
raise CLIError ('usage error: {} [KEY=VALUE ...]' .format (option_string ))
337
- d = {
338
- 'dataTypes' : {
339
- 'sharePoint' : {'state' : 'Disabled' },
340
- 'exchange' : {'state' : 'Disabled' }
341
- }
342
- }
372
+ d = {}
343
373
for k in properties :
344
374
kl = k .lower ()
345
375
v = properties [k ]
346
376
if kl == 'tenant-id' :
347
- d ['tenantId ' ] = v [0 ]
348
- elif kl == 'sharepoint-enabled ' :
349
- d ['dataTypes' ][ 'sharePoint' ][ 'state' ] = 'Enabled'
350
- elif kl == 'exchange-enabled ' :
351
- d ['dataTypes' ][ 'exchange' ][ ' state' ] = 'Enabled'
377
+ d ['tenant_id ' ] = v [0 ]
378
+ elif kl == 'tip-lookback-period ' :
379
+ d ['tip_lookback_period' ] = v [ 0 ]
380
+ elif kl == 'state ' :
381
+ d ['state' ] = v [ 0 ]
352
382
elif kl == 'etag' :
353
383
d ['etag' ] = v [0 ]
354
- d ['kind' ] = 'Office365'
355
- print (d )
384
+ else :
385
+ raise CLIError ('Unsupported Key {} is provided for parameter ti_data_connector. All possible keys are: '
386
+ 'tenant-id, tip-lookback-period, state, etag' .format (k ))
387
+ d ['kind' ] = 'ThreatIntelligence'
356
388
return d
357
389
358
390
359
- class AddTiDataConnector (argparse .Action ):
391
+ class AddOfficeDataConnector (argparse .Action ):
360
392
def __call__ (self , parser , namespace , values , option_string = None ):
361
393
action = self .get_action (values , option_string )
362
- namespace .ti_data_connector = action
394
+ namespace .office_data_connector = action
363
395
364
396
def get_action (self , values , option_string ): # pylint: disable=no-self-use
365
397
try :
@@ -375,11 +407,20 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
375
407
v = properties [k ]
376
408
if kl == 'tenant-id' :
377
409
d ['tenant_id' ] = v [0 ]
378
- elif kl == 'state' :
410
+ elif kl == 'state-properties-data-types-teams-state' :
411
+ d ['state' ] = v [0 ]
412
+ elif kl == 'state-properties-data-types-share-point-state' :
413
+ d ['state' ] = v [0 ]
414
+ elif kl == 'state-properties-data-types-exchange-state' :
379
415
d ['state' ] = v [0 ]
380
416
elif kl == 'etag' :
381
417
d ['etag' ] = v [0 ]
382
- d ['kind' ] = 'ThreatIntelligence'
418
+ else :
419
+ raise CLIError ('Unsupported Key {} is provided for parameter office_data_connector. All possible keys '
420
+ 'are: tenant-id, state-properties-data-types-teams-state, '
421
+ 'state-properties-data-types-share-point-state, state-properties-data-types-exchange-sta'
422
+ 'te, etag' .format (k ))
423
+ d ['kind' ] = 'Office365'
383
424
return d
384
425
385
426
@@ -402,6 +443,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
402
443
v = properties [k ]
403
444
if kl == 'label-name' :
404
445
d ['label_name' ] = v [0 ]
446
+ else :
447
+ raise CLIError ('Unsupported Key {} is provided for parameter labels. All possible keys are: label-name'
448
+ .format (k ))
405
449
return d
406
450
407
451
@@ -430,4 +474,7 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
430
474
d ['object_id' ] = v [0 ]
431
475
elif kl == 'user-principal-name' :
432
476
d ['user_principal_name' ] = v [0 ]
477
+ else :
478
+ raise CLIError ('Unsupported Key {} is provided for parameter owner. All possible keys are: email, '
479
+ 'assigned-to, object-id, user-principal-name' .format (k ))
433
480
return d
0 commit comments