Skip to content

Commit 7dd3b8b

Browse files
author
SDKAuto
committed
CodeGen from PR 15540 in Azure/azure-rest-api-specs
Merge 3c943fe10854a1fe6f67a91b7f51913274b05893 into 57e30b5
1 parent 927c622 commit 7dd3b8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2794
-2309
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"azext.minCliCoreVersion": "2.11.0"
2+
"azext.isExperimental": true,
3+
"azext.minCliCoreVersion": "2.15.0"
34
}

src/securityinsight/azext_sentinel/generated/_client_factory.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,34 @@
1111

1212
def cf_sentinel_cl(cli_ctx, *_):
1313
from azure.cli.core.commands.client_factory import get_mgmt_service_client
14-
from ..vendored_sdks.securityinsight import SecurityInsights
14+
from azext_sentinel.vendored_sdks.securityinsight import SecurityInsights
1515
return get_mgmt_service_client(cli_ctx,
1616
SecurityInsights)
1717

1818

1919
def cf_alert_rule(cli_ctx, *_):
20-
return cf_sentinel_cl(cli_ctx).alert_rule
20+
return cf_sentinel_cl(cli_ctx).alert_rules
2121

2222

2323
def cf_action(cli_ctx, *_):
24-
return cf_sentinel_cl(cli_ctx).action
24+
return cf_sentinel_cl(cli_ctx).actions
2525

2626

2727
def cf_alert_rule_template(cli_ctx, *_):
28-
return cf_sentinel_cl(cli_ctx).alert_rule_template
28+
return cf_sentinel_cl(cli_ctx).alert_rule_templates
2929

3030

3131
def cf_bookmark(cli_ctx, *_):
32-
return cf_sentinel_cl(cli_ctx).bookmark
32+
return cf_sentinel_cl(cli_ctx).bookmarks
3333

3434

3535
def cf_data_connector(cli_ctx, *_):
36-
return cf_sentinel_cl(cli_ctx).data_connector
36+
return cf_sentinel_cl(cli_ctx).data_connectors
3737

3838

3939
def cf_incident(cli_ctx, *_):
40-
return cf_sentinel_cl(cli_ctx).incident
40+
return cf_sentinel_cl(cli_ctx).incidents
4141

4242

4343
def cf_incident_comment(cli_ctx, *_):
44-
return cf_sentinel_cl(cli_ctx).incident_comment
44+
return cf_sentinel_cl(cli_ctx).incident_comments

src/securityinsight/azext_sentinel/generated/_help.py

Lines changed: 169 additions & 99 deletions
Large diffs are not rendered by default.

src/securityinsight/azext_sentinel/generated/_params.py

Lines changed: 83 additions & 53 deletions
Large diffs are not rendered by default.

src/securityinsight/azext_sentinel/generated/action.py

Lines changed: 70 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
3737
d['enabled'] = v[0]
3838
elif kl == 'etag':
3939
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))
4043
d['kind'] = 'Fusion'
4144
return d
4245

@@ -76,6 +79,11 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
7679
d['enabled'] = v[0]
7780
elif kl == 'etag':
7881
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))
7987
d['kind'] = 'MicrosoftSecurityIncidentCreation'
8088
return d
8189

@@ -125,6 +133,11 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
125133
d['tactics'] = v
126134
elif kl == 'etag':
127135
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))
128141
d['kind'] = 'Scheduled'
129142
return d
130143

@@ -154,6 +167,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
154167
d['title'] = v[0]
155168
elif kl == 'relation-name':
156169
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))
157173
return d
158174

159175

@@ -180,6 +196,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
180196
d['state'] = v[0]
181197
elif kl == 'etag':
182198
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))
183202
d['kind'] = 'AzureActiveDirectory'
184203
return d
185204

@@ -207,6 +226,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
207226
d['state'] = v[0]
208227
elif kl == 'etag':
209228
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))
210232
d['kind'] = 'AzureAdvancedThreatProtection'
211233
return d
212234

@@ -234,6 +256,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
234256
d['state'] = v[0]
235257
elif kl == 'etag':
236258
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))
237262
d['kind'] = 'AzureSecurityCenter'
238263
return d
239264

@@ -261,6 +286,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
261286
d['state'] = v[0]
262287
elif kl == 'etag':
263288
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))
264292
d['kind'] = 'AmazonWebServicesCloudTrail'
265293
return d
266294

@@ -284,12 +312,16 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
284312
v = properties[k]
285313
if kl == 'tenant-id':
286314
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]
291319
elif kl == 'etag':
292320
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))
293325
d['kind'] = 'MicrosoftCloudAppSecurity'
294326
return d
295327

@@ -317,14 +349,17 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
317349
d['state'] = v[0]
318350
elif kl == 'etag':
319351
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))
320355
d['kind'] = 'MicrosoftDefenderAdvancedThreatProtection'
321356
return d
322357

323358

324-
class AddOfficeDataConnector(argparse.Action):
359+
class AddTiDataConnector(argparse.Action):
325360
def __call__(self, parser, namespace, values, option_string=None):
326361
action = self.get_action(values, option_string)
327-
namespace.office_data_connector = action
362+
namespace.ti_data_connector = action
328363

329364
def get_action(self, values, option_string): # pylint: disable=no-self-use
330365
try:
@@ -334,32 +369,29 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
334369
properties = dict(properties)
335370
except ValueError:
336371
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 = {}
343373
for k in properties:
344374
kl = k.lower()
345375
v = properties[k]
346376
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]
352382
elif kl == 'etag':
353383
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'
356388
return d
357389

358390

359-
class AddTiDataConnector(argparse.Action):
391+
class AddOfficeDataConnector(argparse.Action):
360392
def __call__(self, parser, namespace, values, option_string=None):
361393
action = self.get_action(values, option_string)
362-
namespace.ti_data_connector = action
394+
namespace.office_data_connector = action
363395

364396
def get_action(self, values, option_string): # pylint: disable=no-self-use
365397
try:
@@ -375,11 +407,20 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
375407
v = properties[k]
376408
if kl == 'tenant-id':
377409
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':
379415
d['state'] = v[0]
380416
elif kl == 'etag':
381417
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'
383424
return d
384425

385426

@@ -402,6 +443,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
402443
v = properties[k]
403444
if kl == 'label-name':
404445
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))
405449
return d
406450

407451

@@ -430,4 +474,7 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
430474
d['object_id'] = v[0]
431475
elif kl == 'user-principal-name':
432476
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))
433480
return d

src/securityinsight/azext_sentinel/generated/commands.py

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,84 +17,85 @@ def load_command_table(self, _):
1717

1818
from azext_sentinel.generated._client_factory import cf_alert_rule
1919
sentinel_alert_rule = CliCommandType(
20-
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._alert_rule_operations#AlertRuleOperat'
21-
'ions.{}',
20+
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._alert_rules_operations#AlertRulesOper'
21+
'ations.{}',
2222
client_factory=cf_alert_rule)
23-
with self.command_group('sentinel alert-rule', sentinel_alert_rule, client_factory=cf_alert_rule,
24-
is_experimental=True) as g:
23+
with self.command_group('sentinel alert-rule', sentinel_alert_rule, client_factory=cf_alert_rule) as g:
2524
g.custom_command('list', 'sentinel_alert_rule_list')
2625
g.custom_show_command('show', 'sentinel_alert_rule_show')
2726
g.custom_command('create', 'sentinel_alert_rule_create')
28-
g.generic_update_command('update', setter_arg_name='alert_rule',
29-
custom_func_name='sentinel_alert_rule_update')
27+
g.custom_command('update', 'sentinel_alert_rule_update')
3028
g.custom_command('delete', 'sentinel_alert_rule_delete', confirmation=True)
31-
g.custom_command('get-action', 'sentinel_alert_rule_get_action')
3229

3330
from azext_sentinel.generated._client_factory import cf_action
3431
sentinel_action = CliCommandType(
35-
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._action_operations#ActionOperations.{}'
36-
'',
32+
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._actions_operations#ActionsOperations.'
33+
'{}',
3734
client_factory=cf_action)
38-
with self.command_group('sentinel action', sentinel_action, client_factory=cf_action, is_experimental=True) as g:
35+
with self.command_group('sentinel action', sentinel_action, client_factory=cf_action) as g:
3936
g.custom_command('list', 'sentinel_action_list')
37+
g.custom_show_command('show', 'sentinel_action_show')
38+
g.custom_command('create', 'sentinel_action_create')
39+
g.custom_command('update', 'sentinel_action_update')
40+
g.custom_command('delete', 'sentinel_action_delete', confirmation=True)
4041

4142
from azext_sentinel.generated._client_factory import cf_alert_rule_template
4243
sentinel_alert_rule_template = CliCommandType(
43-
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._alert_rule_template_operations#AlertR'
44-
'uleTemplateOperations.{}',
44+
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._alert_rule_templates_operations#Alert'
45+
'RuleTemplatesOperations.{}',
4546
client_factory=cf_alert_rule_template)
4647
with self.command_group('sentinel alert-rule-template', sentinel_alert_rule_template,
47-
client_factory=cf_alert_rule_template, is_experimental=True) as g:
48+
client_factory=cf_alert_rule_template) as g:
4849
g.custom_command('list', 'sentinel_alert_rule_template_list')
4950
g.custom_show_command('show', 'sentinel_alert_rule_template_show')
5051

5152
from azext_sentinel.generated._client_factory import cf_bookmark
5253
sentinel_bookmark = CliCommandType(
53-
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._bookmark_operations#BookmarkOperation'
54-
's.{}',
54+
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._bookmarks_operations#BookmarksOperati'
55+
'ons.{}',
5556
client_factory=cf_bookmark)
56-
with self.command_group('sentinel bookmark', sentinel_bookmark, client_factory=cf_bookmark,
57-
is_experimental=True) as g:
57+
with self.command_group('sentinel bookmark', sentinel_bookmark, client_factory=cf_bookmark) as g:
5858
g.custom_command('list', 'sentinel_bookmark_list')
5959
g.custom_show_command('show', 'sentinel_bookmark_show')
6060
g.custom_command('create', 'sentinel_bookmark_create')
61-
g.custom_command('update', 'sentinel_bookmark_update')
61+
g.generic_update_command('update', setter_arg_name='bookmark', custom_func_name='sentinel_bookmark_update')
6262
g.custom_command('delete', 'sentinel_bookmark_delete', confirmation=True)
6363

6464
from azext_sentinel.generated._client_factory import cf_data_connector
6565
sentinel_data_connector = CliCommandType(
66-
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._data_connector_operations#DataConnect'
67-
'orOperations.{}',
66+
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._data_connectors_operations#DataConnec'
67+
'torsOperations.{}',
6868
client_factory=cf_data_connector)
69-
with self.command_group('sentinel data-connector', sentinel_data_connector, client_factory=cf_data_connector,
70-
is_experimental=True) as g:
69+
with self.command_group('sentinel data-connector', sentinel_data_connector,
70+
client_factory=cf_data_connector) as g:
7171
g.custom_command('list', 'sentinel_data_connector_list')
7272
g.custom_show_command('show', 'sentinel_data_connector_show')
7373
g.custom_command('create', 'sentinel_data_connector_create')
74-
g.generic_update_command('update', setter_arg_name='data_connector', custom_func_name=''
75-
'sentinel_data_connector_update')
74+
g.custom_command('update', 'sentinel_data_connector_update')
7675
g.custom_command('delete', 'sentinel_data_connector_delete', confirmation=True)
7776

7877
from azext_sentinel.generated._client_factory import cf_incident
7978
sentinel_incident = CliCommandType(
80-
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._incident_operations#IncidentOperation'
81-
's.{}',
79+
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._incidents_operations#IncidentsOperati'
80+
'ons.{}',
8281
client_factory=cf_incident)
83-
with self.command_group('sentinel incident', sentinel_incident, client_factory=cf_incident,
84-
is_experimental=True) as g:
82+
with self.command_group('sentinel incident', sentinel_incident, client_factory=cf_incident) as g:
8583
g.custom_command('list', 'sentinel_incident_list')
8684
g.custom_show_command('show', 'sentinel_incident_show')
8785
g.custom_command('create', 'sentinel_incident_create')
88-
g.custom_command('update', 'sentinel_incident_update')
86+
g.generic_update_command('update', setter_arg_name='incident', custom_func_name='sentinel_incident_update')
8987
g.custom_command('delete', 'sentinel_incident_delete', confirmation=True)
9088

9189
from azext_sentinel.generated._client_factory import cf_incident_comment
9290
sentinel_incident_comment = CliCommandType(
93-
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._incident_comment_operations#IncidentC'
94-
'ommentOperations.{}',
91+
operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._incident_comments_operations#Incident'
92+
'CommentsOperations.{}',
9593
client_factory=cf_incident_comment)
96-
with self.command_group('sentinel incident-comment', sentinel_incident_comment, client_factory=cf_incident_comment,
97-
is_experimental=True) as g:
94+
with self.command_group('sentinel incident-comment', sentinel_incident_comment,
95+
client_factory=cf_incident_comment) as g:
9896
g.custom_command('list', 'sentinel_incident_comment_list')
9997
g.custom_show_command('show', 'sentinel_incident_comment_show')
10098
g.custom_command('create', 'sentinel_incident_comment_create')
99+
100+
with self.command_group('sentinel', is_experimental=True):
101+
pass

0 commit comments

Comments
 (0)