diff --git a/src/securityinsight/HISTORY.rst b/src/securityinsight/HISTORY.rst new file mode 100644 index 00000000000..27f152061e8 --- /dev/null +++ b/src/securityinsight/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/securityinsight/README.md b/src/securityinsight/README.md new file mode 100644 index 00000000000..e8a96719d21 --- /dev/null +++ b/src/securityinsight/README.md @@ -0,0 +1,5 @@ +Microsoft Azure CLI 'sentinel' Extension +========================================== + +This package is for the 'sentinel' extension. +i.e. 'az sentinel' diff --git a/src/securityinsight/azext_sentinel/__init__.py b/src/securityinsight/azext_sentinel/__init__.py new file mode 100644 index 00000000000..ff36aeb8c75 --- /dev/null +++ b/src/securityinsight/azext_sentinel/__init__.py @@ -0,0 +1,46 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_sentinel.generated._help import helps # pylint: disable=unused-import + + +class SecurityInsightsCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_sentinel.generated._client_factory import cf_sentinel + sentinel_custom = CliCommandType( + operations_tmpl='azext_sentinel.custom#{}', + client_factory=cf_sentinel) + super(SecurityInsightsCommandsLoader, self).__init__(cli_ctx=cli_ctx, + custom_command_type=sentinel_custom) + + def load_command_table(self, args): + from azext_sentinel.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_sentinel.manual.commands import load_command_table as load_command_table_manual + load_command_table_manual(self, args) + except ImportError: + pass + return self.command_table + + def load_arguments(self, command): + from azext_sentinel.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_sentinel.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = SecurityInsightsCommandsLoader diff --git a/src/securityinsight/azext_sentinel/action.py b/src/securityinsight/azext_sentinel/action.py new file mode 100644 index 00000000000..a846b2766c4 --- /dev/null +++ b/src/securityinsight/azext_sentinel/action.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/securityinsight/azext_sentinel/azext_metadata.json b/src/securityinsight/azext_sentinel/azext_metadata.json new file mode 100644 index 00000000000..7b56fb1e11a --- /dev/null +++ b/src/securityinsight/azext_sentinel/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.3.1" +} \ No newline at end of file diff --git a/src/securityinsight/azext_sentinel/custom.py b/src/securityinsight/azext_sentinel/custom.py new file mode 100644 index 00000000000..7f31674ce96 --- /dev/null +++ b/src/securityinsight/azext_sentinel/custom.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/securityinsight/azext_sentinel/generated/__init__.py b/src/securityinsight/azext_sentinel/generated/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/securityinsight/azext_sentinel/generated/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/securityinsight/azext_sentinel/generated/_client_factory.py b/src/securityinsight/azext_sentinel/generated/_client_factory.py new file mode 100644 index 00000000000..4143b95ccfd --- /dev/null +++ b/src/securityinsight/azext_sentinel/generated/_client_factory.py @@ -0,0 +1,43 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + + +def cf_sentinel(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from ..vendored_sdks.securityinsight import SecurityInsights + return get_mgmt_service_client(cli_ctx, SecurityInsights) + + +def cf_alert_rule(cli_ctx, *_): + return cf_sentinel(cli_ctx).alert_rule + + +def cf_action(cli_ctx, *_): + return cf_sentinel(cli_ctx).action + + +def cf_alert_rule_template(cli_ctx, *_): + return cf_sentinel(cli_ctx).alert_rule_template + + +def cf_bookmark(cli_ctx, *_): + return cf_sentinel(cli_ctx).bookmark + + +def cf_data_connector(cli_ctx, *_): + return cf_sentinel(cli_ctx).data_connector + + +def cf_incident(cli_ctx, *_): + return cf_sentinel(cli_ctx).incident + + +def cf_incident_comment(cli_ctx, *_): + return cf_sentinel(cli_ctx).incident_comment diff --git a/src/securityinsight/azext_sentinel/generated/_help.py b/src/securityinsight/azext_sentinel/generated/_help.py new file mode 100644 index 00000000000..fe7cc7eddbf --- /dev/null +++ b/src/securityinsight/azext_sentinel/generated/_help.py @@ -0,0 +1,341 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['sentinel alert-rule'] = """ + type: group + short-summary: sentinel alert-rule +""" + +helps['sentinel alert-rule list'] = """ + type: command + short-summary: Gets all alert rules. + examples: + - name: Get all alert rules. + text: |- + az sentinel alert-rule list --resource-group "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel alert-rule show'] = """ + type: command + short-summary: Gets the alert rule. + examples: + - name: Get an action of alert rule. + text: |- + az sentinel alert-rule show --action-id "912bec42-cb66-4c03-ac63-1761b6898c3e" --resource-group "myRg" -\ +-rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --workspace-name "myWorkspace" +""" + +helps['sentinel alert-rule create'] = """ + type: command + short-summary: Creates or updates the alert rule. + examples: + - name: Creates or updates an action of alert rule. + text: |- + az sentinel alert-rule create --etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" --logic-app-resource-i\ +d "/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/MyAlerts\ +" --trigger-uri "https://prod-31.northcentralus.logic.azure.com:443/workflows/cd3765391efd48549fd7681ded1d48d7/triggers\ +/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=signature" --action-id "912bec42-c\ +b66-4c03-ac63-1761b6898c3e" --resource-group "myRg" --rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --workspace-name "\ +myWorkspace" +""" + +helps['sentinel alert-rule delete'] = """ + type: command + short-summary: Delete the alert rule. + examples: + - name: Delete an action of alert rule. + text: |- + az sentinel alert-rule delete --action-id "912bec42-cb66-4c03-ac63-1761b6898c3e" --resource-group "myRg"\ + --rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --workspace-name "myWorkspace" +""" + +helps['sentinel action'] = """ + type: group + short-summary: sentinel action +""" + +helps['sentinel action list'] = """ + type: command + short-summary: Gets all actions of alert rule. + examples: + - name: Get all actions of alert rule. + text: |- + az sentinel action list --resource-group "myRg" --rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --works\ +pace-name "myWorkspace" +""" + +helps['sentinel alert-rule-template'] = """ + type: group + short-summary: sentinel alert-rule-template +""" + +helps['sentinel alert-rule-template list'] = """ + type: command + short-summary: Gets all alert rule templates. + examples: + - name: Get all alert rule templates. + text: |- + az sentinel alert-rule-template list --resource-group "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel alert-rule-template show'] = """ + type: command + short-summary: Gets the alert rule template. + examples: + - name: Get alert rule template by Id. + text: |- + az sentinel alert-rule-template show --alert-rule-template-id "65360bb0-8986-4ade-a89d-af3cf44d28aa" --r\ +esource-group "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel bookmark'] = """ + type: group + short-summary: sentinel bookmark +""" + +helps['sentinel bookmark list'] = """ + type: command + short-summary: Gets all bookmarks. + examples: + - name: Get all bookmarks. + text: |- + az sentinel bookmark list --resource-group "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel bookmark show'] = """ + type: command + short-summary: Gets a bookmark. + examples: + - name: Get a bookmark. + text: |- + az sentinel bookmark show --bookmark-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" -\ +-workspace-name "myWorkspace" +""" + +helps['sentinel bookmark create'] = """ + type: command + short-summary: Creates or updates the bookmark. + examples: + - name: Creates or updates a bookmark. + text: |- + az sentinel bookmark create --etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" --created "2019-01-01T13\ +:15:30Z" --created-by name="john doe" email="john@contoso.com" object-id="2046feea-040d-4a46-9e2b-91c2941bfa70" --displ\ +ay-name "My bookmark" --labels "[\\"Tag1\\",\\"Tag2\\"]" --notes "Found a suspicious activity" --query "SecurityEvent |\ + where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)" --query-result "Security Event query result" --updated "201\ +9-01-01T13:15:30Z" --updated-by name="john doe" email="john@contoso.com" object-id="2046feea-040d-4a46-9e2b-91c2941bfa7\ +0" --bookmark-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel bookmark update'] = """ + type: command + short-summary: Creates or updates the bookmark. + examples: + - name: Creates or updates a bookmark. + text: |- + az sentinel bookmark update --etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" --created "2019-01-01T13\ +:15:30Z" --created-by name="john doe" email="john@contoso.com" object-id="2046feea-040d-4a46-9e2b-91c2941bfa70" --displ\ +ay-name "My bookmark" --labels "[\\"Tag1\\",\\"Tag2\\"]" --notes "Found a suspicious activity" --query "SecurityEvent |\ + where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)" --query-result "Security Event query result" --updated "201\ +9-01-01T13:15:30Z" --updated-by name="john doe" email="john@contoso.com" object-id="2046feea-040d-4a46-9e2b-91c2941bfa7\ +0" --bookmark-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel bookmark delete'] = """ + type: command + short-summary: Delete the bookmark. + examples: + - name: Delete a bookmark. + text: |- + az sentinel bookmark delete --bookmark-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg"\ + --workspace-name "myWorkspace" +""" + +helps['sentinel data-connector'] = """ + type: group + short-summary: sentinel data-connector +""" + +helps['sentinel data-connector list'] = """ + type: command + short-summary: Gets all data connectors. + examples: + - name: Get all data connectors. + text: |- + az sentinel data-connector list --resource-group "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel data-connector show'] = """ + type: command + short-summary: Gets a data connector. + examples: + - name: Get a ASC data connector. + text: |- + az sentinel data-connector show --data-connector-id "763f9fa1-c2d3-4fa2-93e9-bccd4899aa12" --resource-gr\ +oup "myRg" --workspace-name "myWorkspace" + - name: Get a MCAS data connector. + text: |- + az sentinel data-connector show --data-connector-id "b96d014d-b5c2-4a01-9aba-a8058f629d42" --resource-gr\ +oup "myRg" --workspace-name "myWorkspace" + - name: Get a MDATP data connector + text: |- + az sentinel data-connector show --data-connector-id "06b3ccb8-1384-4bcc-aec7-852f6d57161b" --resource-gr\ +oup "myRg" --workspace-name "myWorkspace" + - name: Get a TI data connector. + text: |- + az sentinel data-connector show --data-connector-id "c345bf40-8509-4ed2-b947-50cb773aaf04" --resource-gr\ +oup "myRg" --workspace-name "myWorkspace" + - name: Get an AAD data connector. + text: |- + az sentinel data-connector show --data-connector-id "f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d" --resource-gr\ +oup "myRg" --workspace-name "myWorkspace" + - name: Get an AATP data connector. + text: |- + az sentinel data-connector show --data-connector-id "07e42cb3-e658-4e90-801c-efa0f29d3d44" --resource-gr\ +oup "myRg" --workspace-name "myWorkspace" + - name: Get an AwsCloudTrail data connector. + text: |- + az sentinel data-connector show --data-connector-id "c345bf40-8509-4ed2-b947-50cb773aaf04" --resource-gr\ +oup "myRg" --workspace-name "myWorkspace" + - name: Get an Office365 data connector. + text: |- + az sentinel data-connector show --data-connector-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-gr\ +oup "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel data-connector create'] = """ + type: command + short-summary: Creates or updates the data connector. + examples: + - name: Creates or updates an Office365 data connector. + text: |- + az sentinel data-connector create --etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" --kind "Office365"\ + --data-connector-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel data-connector update'] = """ + type: command + short-summary: Creates or updates the data connector. + examples: + - name: Creates or updates an Office365 data connector. + text: |- + az sentinel data-connector update --etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" --kind "Office365"\ + --data-connector-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel data-connector delete'] = """ + type: command + short-summary: Delete the data connector. + examples: + - name: Delete an Office365 data connector. + text: |- + az sentinel data-connector delete --data-connector-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-\ +group "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel incident'] = """ + type: group + short-summary: sentinel incident +""" + +helps['sentinel incident list'] = """ + type: command + short-summary: Gets all incidents. + examples: + - name: Get all incidents. + text: |- + az sentinel incident list --orderby "properties/createdTimeUtc desc" --top 1 --resource-group "myRg" --w\ +orkspace-name "myWorkspace" +""" + +helps['sentinel incident show'] = """ + type: command + short-summary: Gets an incident. + examples: + - name: Get an incident. + text: |- + az sentinel incident show --incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" -\ +-workspace-name "myWorkspace" +""" + +helps['sentinel incident create'] = """ + type: command + short-summary: Creates or updates the incident. + examples: + - name: Creates or updates an incident. + text: |- + az sentinel incident create --etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" --description "This is a\ + demo incident" --classification "FalsePositive" --first-activity-time-utc "2019-01-01T13:00:30Z" --last-activity-time-\ +utc "2019-01-01T13:05:30Z" --owner object-id="2046feea-040d-4a46-9e2b-91c2941bfa70" --severity "High" --status "Closed"\ + --title "My incident" --incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" --workspace-name "m\ +yWorkspace" +""" + +helps['sentinel incident update'] = """ + type: command + short-summary: Creates or updates the incident. + examples: + - name: Creates or updates an incident. + text: |- + az sentinel incident update --etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" --description "This is a\ + demo incident" --classification "FalsePositive" --first-activity-time-utc "2019-01-01T13:00:30Z" --last-activity-time-\ +utc "2019-01-01T13:05:30Z" --owner object-id="2046feea-040d-4a46-9e2b-91c2941bfa70" --severity "High" --status "Closed"\ + --title "My incident" --incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" --workspace-name "m\ +yWorkspace" +""" + +helps['sentinel incident delete'] = """ + type: command + short-summary: Delete the incident. + examples: + - name: Delete an incident. + text: |- + az sentinel incident delete --incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg"\ + --workspace-name "myWorkspace" +""" + +helps['sentinel incident-comment'] = """ + type: group + short-summary: sentinel incident-comment +""" + +helps['sentinel incident-comment list'] = """ + type: command + short-summary: Gets all incident comments. + examples: + - name: Get all incident comments. + text: |- + az sentinel incident-comment list --incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group \ +"myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel incident-comment show'] = """ + type: command + short-summary: Gets an incident comment. + examples: + - name: Get an incident comment. + text: |- + az sentinel incident-comment show --incident-comment-id "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014" --inciden\ +t-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" --workspace-name "myWorkspace" +""" + +helps['sentinel incident-comment create'] = """ + type: command + short-summary: Creates the incident comment. + examples: + - name: Creates an incident comment. + text: |- + az sentinel incident-comment create --message "Some message" --incident-comment-id "4bb36b7b-26ff-4d1c-9\ +cbe-0d8ab3da0014" --incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" --resource-group "myRg" --workspace-name "myWork\ +space" +""" diff --git a/src/securityinsight/azext_sentinel/generated/_params.py b/src/securityinsight/azext_sentinel/generated/_params.py new file mode 100644 index 00000000000..552f62cb436 --- /dev/null +++ b/src/securityinsight/azext_sentinel/generated/_params.py @@ -0,0 +1,240 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.arguments import CLIArgumentType +from azure.cli.core.commands.parameters import ( + get_enum_type, + resource_group_name_type +) +from azext_sentinel.action import ( + AddCreatedBy, + AddIncidentInfo, + AddLabels, + AddOwner +) + + +def load_arguments(self, _): + + with self.argument_context('sentinel alert-rule list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + + with self.argument_context('sentinel alert-rule show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('rule_id', help='Alert rule ID') + c.argument('action_id', help='Action ID') + + with self.argument_context('sentinel alert-rule create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('rule_id', help='Alert rule ID') + c.argument('action_id', help='Action ID') + c.argument('etag', help='Etag of the azure resource') + c.argument('logic_app_resource_id', help='Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroup' + 's/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}.') + c.argument('trigger_uri', help='Logic App Callback URL for this specific workflow.') + c.argument('kind', arg_type=get_enum_type(['Scheduled', 'MicrosoftSecurityIncidentCreation', 'Fusion']), help= + 'The kind of the alert rule') + + with self.argument_context('sentinel alert-rule delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('rule_id', help='Alert rule ID') + c.argument('action_id', help='Action ID') + + with self.argument_context('sentinel action list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('rule_id', help='Alert rule ID') + + with self.argument_context('sentinel alert-rule-template list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + + with self.argument_context('sentinel alert-rule-template show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('alert_rule_template_id', help='Alert rule template ID') + + with self.argument_context('sentinel bookmark list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + + with self.argument_context('sentinel bookmark show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('bookmark_id', help='Bookmark ID') + + with self.argument_context('sentinel bookmark create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('bookmark_id', help='Bookmark ID') + c.argument('etag', help='Etag of the azure resource') + c.argument('created', help='The time the bookmark was created') + c.argument('created_by', action=AddCreatedBy, nargs='+', help='Describes a user that created the bookmark Expec' + 't value: object-id=xx.') + c.argument('display_name', help='The display name of the bookmark') + c.argument('labels', nargs='+', help='List of labels relevant to this bookmark Expected value: json-string/@jso' + 'n-file.') + c.argument('notes', help='The notes of the bookmark') + c.argument('query', help='The query of the bookmark.') + c.argument('query_result', help='The query result of the bookmark.') + c.argument('updated', help='The last time the bookmark was updated') + c.argument('updated_by', action=AddCreatedBy, nargs='+', help='Describes a user that updated the bookmark Expec' + 't value: object-id=xx.') + c.argument('incident_info', action=AddIncidentInfo, nargs='+', help='Describes an incident that relates to book' + 'mark Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: incident-id, severity, title, ' + 'relation-name.') + + with self.argument_context('sentinel bookmark update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('bookmark_id', help='Bookmark ID') + c.argument('etag', help='Etag of the azure resource') + c.argument('created', help='The time the bookmark was created') + c.argument('created_by', action=AddCreatedBy, nargs='+', help='Describes a user that created the bookmark Expec' + 't value: object-id=xx.') + c.argument('display_name', help='The display name of the bookmark') + c.argument('labels', nargs='+', help='List of labels relevant to this bookmark Expected value: json-string/@jso' + 'n-file.') + c.argument('notes', help='The notes of the bookmark') + c.argument('query', help='The query of the bookmark.') + c.argument('query_result', help='The query result of the bookmark.') + c.argument('updated', help='The last time the bookmark was updated') + c.argument('updated_by', action=AddCreatedBy, nargs='+', help='Describes a user that updated the bookmark Expec' + 't value: object-id=xx.') + c.argument('incident_info', action=AddIncidentInfo, nargs='+', help='Describes an incident that relates to book' + 'mark Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: incident-id, severity, title, ' + 'relation-name.') + + with self.argument_context('sentinel bookmark delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('bookmark_id', help='Bookmark ID') + + with self.argument_context('sentinel data-connector list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + + with self.argument_context('sentinel data-connector show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('data_connector_id', help='Connector ID') + + with self.argument_context('sentinel data-connector create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('data_connector_id', help='Connector ID') + c.argument('etag', help='Etag of the azure resource') + c.argument('kind', arg_type=get_enum_type(['AzureActiveDirectory', 'AzureSecurityCenter', 'MicrosoftCloudAppSec' + 'urity', 'ThreatIntelligence', 'Office365', 'AmazonWebServicesCloudTrail', 'AzureAdvancedThreatProte' + 'ction', 'MicrosoftDefenderAdvancedThreatProtection']), help='The kind of the data connector') + + with self.argument_context('sentinel data-connector update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('data_connector_id', help='Connector ID') + c.argument('etag', help='Etag of the azure resource') + c.argument('kind', arg_type=get_enum_type(['AzureActiveDirectory', 'AzureSecurityCenter', 'MicrosoftCloudAppSec' + 'urity', 'ThreatIntelligence', 'Office365', 'AmazonWebServicesCloudTrail', 'AzureAdvancedThreatProte' + 'ction', 'MicrosoftDefenderAdvancedThreatProtection']), help='The kind of the data connector') + + with self.argument_context('sentinel data-connector delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('data_connector_id', help='Connector ID') + + with self.argument_context('sentinel incident list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('filter', help='Filters the results, based on a Boolean condition. Optional.') + c.argument('orderby', help='Sorts the results. Optional.') + c.argument('top', help='Returns only the first n results. Optional.') + c.argument('skip_token', help='Skiptoken is only used if a previous operation returned a partial result. If a p' + 'revious response contains a nextLink element, the value of the nextLink element will include a skip' + 'token parameter that specifies a starting point to use for subsequent calls. Optional.') + + with self.argument_context('sentinel incident show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('incident_id', help='Incident ID') + + with self.argument_context('sentinel incident create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('incident_id', help='Incident ID') + c.argument('etag', help='Etag of the azure resource') + c.argument('classification', arg_type=get_enum_type(['Undetermined', 'TruePositive', 'BenignPositive', 'FalsePo' + 'sitive']), help='The reason the incident was closed') + c.argument('description', help='The description of the incident') + c.argument('first_activity_time_utc', help='The time of the first activity in the incident') + c.argument('labels', action=AddLabels, nargs='+', help='List of labels relevant to this incident Expect value: ' + 'label-name=xx.') + c.argument('last_activity_time_utc', help='The time of the last activity in the incident') + c.argument('owner', action=AddOwner, nargs='+', help='Describes a user that the incident is assigned to Expect ' + 'value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: email, assigned-to, object-id, user-princi' + 'pal-name.') + c.argument('severity', arg_type=get_enum_type(['High', 'Medium', 'Low', 'Informational']), help='The severity o' + 'f the incident') + c.argument('status', arg_type=get_enum_type(['New', 'Active', 'Closed']), help='The status of the incident') + c.argument('title', help='The title of the incident') + + with self.argument_context('sentinel incident update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('incident_id', help='Incident ID') + c.argument('etag', help='Etag of the azure resource') + c.argument('classification', arg_type=get_enum_type(['Undetermined', 'TruePositive', 'BenignPositive', 'FalsePo' + 'sitive']), help='The reason the incident was closed') + c.argument('description', help='The description of the incident') + c.argument('first_activity_time_utc', help='The time of the first activity in the incident') + c.argument('labels', action=AddLabels, nargs='+', help='List of labels relevant to this incident Expect value: ' + 'label-name=xx.') + c.argument('last_activity_time_utc', help='The time of the last activity in the incident') + c.argument('owner', action=AddOwner, nargs='+', help='Describes a user that the incident is assigned to Expect ' + 'value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: email, assigned-to, object-id, user-princi' + 'pal-name.') + c.argument('severity', arg_type=get_enum_type(['High', 'Medium', 'Low', 'Informational']), help='The severity o' + 'f the incident') + c.argument('status', arg_type=get_enum_type(['New', 'Active', 'Closed']), help='The status of the incident') + c.argument('title', help='The title of the incident') + + with self.argument_context('sentinel incident delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('incident_id', help='Incident ID') + + with self.argument_context('sentinel incident-comment list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('incident_id', help='Incident ID') + c.argument('filter', help='Filters the results, based on a Boolean condition. Optional.') + c.argument('orderby', help='Sorts the results. Optional.') + c.argument('top', help='Returns only the first n results. Optional.') + c.argument('skip_token', help='Skiptoken is only used if a previous operation returned a partial result. If a p' + 'revious response contains a nextLink element, the value of the nextLink element will include a skip' + 'token parameter that specifies a starting point to use for subsequent calls. Optional.') + + with self.argument_context('sentinel incident-comment show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('incident_id', help='Incident ID') + c.argument('incident_comment_id', help='Incident comment ID') + + with self.argument_context('sentinel incident-comment create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace.') + c.argument('incident_id', help='Incident ID') + c.argument('incident_comment_id', help='Incident comment ID') + c.argument('message', help='The comment message') diff --git a/src/securityinsight/azext_sentinel/generated/_validators.py b/src/securityinsight/azext_sentinel/generated/_validators.py new file mode 100644 index 00000000000..7536d0531ea --- /dev/null +++ b/src/securityinsight/azext_sentinel/generated/_validators.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + + +def example_name_or_id_validator(cmd, namespace): + from azure.cli.core.commands.client_factory import get_subscription_id + from msrestazure.tools import is_valid_resource_id, resource_id + if namespace.storage_account: + if not is_valid_resource_id(namespace.RESOURCE): + namespace.storage_account = resource_id( + subscription=get_subscription_id(cmd.cli_ctx), + resource_group=namespace.resource_group_name, + namespace='Microsoft.Storage', + type='storageAccounts', + name=namespace.storage_account + ) diff --git a/src/securityinsight/azext_sentinel/generated/action.py b/src/securityinsight/azext_sentinel/generated/action.py new file mode 100644 index 00000000000..d3b5093fd50 --- /dev/null +++ b/src/securityinsight/azext_sentinel/generated/action.py @@ -0,0 +1,118 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from knack.util import CLIError +from collections import defaultdict + + +class AddCreatedBy(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.created_by = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'object-id': + d['object_id'] = v[0] + return d + + +class AddIncidentInfo(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.incident_info = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'incident-id': + d['incident_id'] = v[0] + elif kl == 'severity': + d['severity'] = v[0] + elif kl == 'title': + d['title'] = v[0] + elif kl == 'relation-name': + d['relation_name'] = v[0] + return d + + +class AddLabels(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddLabels, self).__call__(parser, namespace, action, option_string) + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'label-name': + d['label_name'] = v[0] + return d + + +class AddOwner(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.owner = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'email': + d['email'] = v[0] + elif kl == 'assigned-to': + d['assigned_to'] = v[0] + elif kl == 'object-id': + d['object_id'] = v[0] + elif kl == 'user-principal-name': + d['user_principal_name'] = v[0] + return d diff --git a/src/securityinsight/azext_sentinel/generated/commands.py b/src/securityinsight/azext_sentinel/generated/commands.py new file mode 100644 index 00000000000..47be52dd213 --- /dev/null +++ b/src/securityinsight/azext_sentinel/generated/commands.py @@ -0,0 +1,94 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_sentinel.generated._client_factory import cf_alert_rule + sentinel_alert_rule = CliCommandType( + operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._alert_rule_operations#AlertRuleOperat' + 'ions.{}', + client_factory=cf_alert_rule) + with self.command_group('sentinel alert-rule', sentinel_alert_rule, client_factory=cf_alert_rule, + is_experimental=True) as g: + g.custom_command('list', 'sentinel_alert_rule_list') + g.custom_show_command('show', 'sentinel_alert_rule_show') + g.custom_command('create', 'sentinel_alert_rule_create') + g.custom_command('delete', 'sentinel_alert_rule_delete') + + from azext_sentinel.generated._client_factory import cf_action + sentinel_action = CliCommandType( + operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._action_operations#ActionOperations.{}' + '', + client_factory=cf_action) + with self.command_group('sentinel action', sentinel_action, client_factory=cf_action, is_experimental=True) as g: + g.custom_command('list', 'sentinel_action_list') + + from azext_sentinel.generated._client_factory import cf_alert_rule_template + sentinel_alert_rule_template = CliCommandType( + operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._alert_rule_template_operations#AlertR' + 'uleTemplateOperations.{}', + client_factory=cf_alert_rule_template) + with self.command_group('sentinel alert-rule-template', sentinel_alert_rule_template, + client_factory=cf_alert_rule_template, is_experimental=True) as g: + g.custom_command('list', 'sentinel_alert_rule_template_list') + g.custom_show_command('show', 'sentinel_alert_rule_template_show') + + from azext_sentinel.generated._client_factory import cf_bookmark + sentinel_bookmark = CliCommandType( + operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._bookmark_operations#BookmarkOperation' + 's.{}', + client_factory=cf_bookmark) + with self.command_group('sentinel bookmark', sentinel_bookmark, client_factory=cf_bookmark, + is_experimental=True) as g: + g.custom_command('list', 'sentinel_bookmark_list') + g.custom_show_command('show', 'sentinel_bookmark_show') + g.custom_command('create', 'sentinel_bookmark_create') + g.custom_command('update', 'sentinel_bookmark_update') + g.custom_command('delete', 'sentinel_bookmark_delete') + + from azext_sentinel.generated._client_factory import cf_data_connector + sentinel_data_connector = CliCommandType( + operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._data_connector_operations#DataConnect' + 'orOperations.{}', + client_factory=cf_data_connector) + with self.command_group('sentinel data-connector', sentinel_data_connector, client_factory=cf_data_connector, + is_experimental=True) as g: + g.custom_command('list', 'sentinel_data_connector_list') + g.custom_show_command('show', 'sentinel_data_connector_show') + g.custom_command('create', 'sentinel_data_connector_create') + g.custom_command('update', 'sentinel_data_connector_update') + g.custom_command('delete', 'sentinel_data_connector_delete') + + from azext_sentinel.generated._client_factory import cf_incident + sentinel_incident = CliCommandType( + operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._incident_operations#IncidentOperation' + 's.{}', + client_factory=cf_incident) + with self.command_group('sentinel incident', sentinel_incident, client_factory=cf_incident, + is_experimental=True) as g: + g.custom_command('list', 'sentinel_incident_list') + g.custom_show_command('show', 'sentinel_incident_show') + g.custom_command('create', 'sentinel_incident_create') + g.custom_command('update', 'sentinel_incident_update') + g.custom_command('delete', 'sentinel_incident_delete') + + from azext_sentinel.generated._client_factory import cf_incident_comment + sentinel_incident_comment = CliCommandType( + operations_tmpl='azext_sentinel.vendored_sdks.securityinsight.operations._incident_comment_operations#IncidentC' + 'ommentOperations.{}', + client_factory=cf_incident_comment) + with self.command_group('sentinel incident-comment', sentinel_incident_comment, client_factory=cf_incident_comment, + is_experimental=True) as g: + g.custom_command('list', 'sentinel_incident_comment_list') + g.custom_show_command('show', 'sentinel_incident_comment_show') + g.custom_command('create', 'sentinel_incident_comment_create') diff --git a/src/securityinsight/azext_sentinel/generated/custom.py b/src/securityinsight/azext_sentinel/generated/custom.py new file mode 100644 index 00000000000..12ff86e0453 --- /dev/null +++ b/src/securityinsight/azext_sentinel/generated/custom.py @@ -0,0 +1,373 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +import json + + +def sentinel_alert_rule_list(cmd, client, + resource_group_name, + workspace_name): + return client.list(resource_group_name=resource_group_name, + workspace_name=workspace_name) + + +def sentinel_alert_rule_show(cmd, client, + resource_group_name, + workspace_name, + rule_id, + action_id=None): + if resource_group_name is not None and workspace_name is not None and rule_id is not None and action_id is not None: + return client.get_action(resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + action_id=action_id) + return client.get(resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id) + + +def sentinel_alert_rule_create(cmd, client, + resource_group_name, + workspace_name, + rule_id, + action_id=None, + etag=None, + logic_app_resource_id=None, + trigger_uri=None, + kind=None): + if resource_group_name is not None and workspace_name is not None and rule_id is not None and action_id is not None and _action is not None: + return client.create_or_update_action(resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + action_id=action_id, + etag=etag, + logic_app_resource_id=logic_app_resource_id, + trigger_uri=trigger_uri) + return client.create_or_update(resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + etag=etag, + kind=kind) + + +def sentinel_alert_rule_delete(cmd, client, + resource_group_name, + workspace_name, + rule_id, + action_id=None): + if resource_group_name is not None and workspace_name is not None and rule_id is not None and action_id is not None: + return client.delete_action(resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + action_id=action_id) + return client.delete(resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id) + + +def sentinel_action_list(cmd, client, + resource_group_name, + workspace_name, + rule_id): + return client.list_by_alert_rule(resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id) + + +def sentinel_alert_rule_template_list(cmd, client, + resource_group_name, + workspace_name): + return client.list(resource_group_name=resource_group_name, + workspace_name=workspace_name) + + +def sentinel_alert_rule_template_show(cmd, client, + resource_group_name, + workspace_name, + alert_rule_template_id): + return client.get(resource_group_name=resource_group_name, + workspace_name=workspace_name, + alert_rule_template_id=alert_rule_template_id) + + +def sentinel_bookmark_list(cmd, client, + resource_group_name, + workspace_name): + return client.list(resource_group_name=resource_group_name, + workspace_name=workspace_name) + + +def sentinel_bookmark_show(cmd, client, + resource_group_name, + workspace_name, + bookmark_id): + return client.get(resource_group_name=resource_group_name, + workspace_name=workspace_name, + bookmark_id=bookmark_id) + + +def sentinel_bookmark_create(cmd, client, + resource_group_name, + workspace_name, + bookmark_id, + etag=None, + created=None, + created_by=None, + display_name=None, + labels=None, + notes=None, + query=None, + query_result=None, + updated=None, + updated_by=None, + incident_info=None): + if isinstance(labels, str): + labels = json.loads(labels) + return client.create_or_update(resource_group_name=resource_group_name, + workspace_name=workspace_name, + bookmark_id=bookmark_id, + etag=etag, + created=created, + created_by=created_by, + display_name=display_name, + labels=labels, + notes=notes, + query=query, + query_result=query_result, + updated=updated, + updated_by=updated_by, + incident_info=incident_info) + + +def sentinel_bookmark_update(cmd, client, + resource_group_name, + workspace_name, + bookmark_id, + etag=None, + created=None, + created_by=None, + display_name=None, + labels=None, + notes=None, + query=None, + query_result=None, + updated=None, + updated_by=None, + incident_info=None): + if isinstance(labels, str): + labels = json.loads(labels) + return client.create_or_update(resource_group_name=resource_group_name, + workspace_name=workspace_name, + bookmark_id=bookmark_id, + etag=etag, + created=created, + created_by=created_by, + display_name=display_name, + labels=labels, + notes=notes, + query=query, + query_result=query_result, + updated=updated, + updated_by=updated_by, + incident_info=incident_info) + + +def sentinel_bookmark_delete(cmd, client, + resource_group_name, + workspace_name, + bookmark_id): + return client.delete(resource_group_name=resource_group_name, + workspace_name=workspace_name, + bookmark_id=bookmark_id) + + +def sentinel_data_connector_list(cmd, client, + resource_group_name, + workspace_name): + return client.list(resource_group_name=resource_group_name, + workspace_name=workspace_name) + + +def sentinel_data_connector_show(cmd, client, + resource_group_name, + workspace_name, + data_connector_id): + return client.get(resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_id=data_connector_id) + + +def sentinel_data_connector_create(cmd, client, + resource_group_name, + workspace_name, + data_connector_id, + etag=None, + kind=None): + return client.create_or_update(resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_id=data_connector_id, + etag=etag, + kind=kind) + + +def sentinel_data_connector_update(cmd, client, + resource_group_name, + workspace_name, + data_connector_id, + etag=None, + kind=None): + return client.create_or_update(resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_id=data_connector_id, + etag=etag, + kind=kind) + + +def sentinel_data_connector_delete(cmd, client, + resource_group_name, + workspace_name, + data_connector_id): + return client.delete(resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_id=data_connector_id) + + +def sentinel_incident_list(cmd, client, + resource_group_name, + workspace_name, + filter=None, + orderby=None, + top=None, + skip_token=None): + return client.list(resource_group_name=resource_group_name, + workspace_name=workspace_name, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token) + + +def sentinel_incident_show(cmd, client, + resource_group_name, + workspace_name, + incident_id): + return client.get(resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id) + + +def sentinel_incident_create(cmd, client, + resource_group_name, + workspace_name, + incident_id, + etag=None, + classification=None, + description=None, + first_activity_time_utc=None, + labels=None, + last_activity_time_utc=None, + owner=None, + severity=None, + status=None, + title=None): + return client.create_or_update(resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + etag=etag, + classification=classification, + description=description, + first_activity_time_utc=first_activity_time_utc, + labels=labels, + last_activity_time_utc=last_activity_time_utc, + owner=owner, + severity=severity, + status=status, + title=title) + + +def sentinel_incident_update(cmd, client, + resource_group_name, + workspace_name, + incident_id, + etag=None, + classification=None, + description=None, + first_activity_time_utc=None, + labels=None, + last_activity_time_utc=None, + owner=None, + severity=None, + status=None, + title=None): + return client.create_or_update(resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + etag=etag, + classification=classification, + description=description, + first_activity_time_utc=first_activity_time_utc, + labels=labels, + last_activity_time_utc=last_activity_time_utc, + owner=owner, + severity=severity, + status=status, + title=title) + + +def sentinel_incident_delete(cmd, client, + resource_group_name, + workspace_name, + incident_id): + return client.delete(resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id) + + +def sentinel_incident_comment_list(cmd, client, + resource_group_name, + workspace_name, + incident_id, + filter=None, + orderby=None, + top=None, + skip_token=None): + return client.list_by_incident(resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token) + + +def sentinel_incident_comment_show(cmd, client, + resource_group_name, + workspace_name, + incident_id, + incident_comment_id): + return client.get_comment(resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + incident_comment_id=incident_comment_id) + + +def sentinel_incident_comment_create(cmd, client, + resource_group_name, + workspace_name, + incident_id, + incident_comment_id, + message=None): + return client.create_comment(resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + incident_comment_id=incident_comment_id, + message=message) diff --git a/src/securityinsight/azext_sentinel/manual/__init__.py b/src/securityinsight/azext_sentinel/manual/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/securityinsight/azext_sentinel/manual/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/securityinsight/azext_sentinel/tests/__init__.py b/src/securityinsight/azext_sentinel/tests/__init__.py new file mode 100644 index 00000000000..fe1bd438b46 --- /dev/null +++ b/src/securityinsight/azext_sentinel/tests/__init__.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +import inspect +import os + + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func) + module_path = __path__[0] + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + print("running {}()...".format(func.__name__)) + return func_to_call(*args, **kwargs) + + if inspect.isclass(func): + return get_func_to_call() + else: + return wrapper diff --git a/src/securityinsight/azext_sentinel/tests/latest/__init__.py b/src/securityinsight/azext_sentinel/tests/latest/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/securityinsight/azext_sentinel/tests/latest/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/securityinsight/azext_sentinel/tests/latest/preparers.py b/src/securityinsight/azext_sentinel/tests/latest/preparers.py new file mode 100644 index 00000000000..3d6672de64f --- /dev/null +++ b/src/securityinsight/azext_sentinel/tests/latest/preparers.py @@ -0,0 +1,116 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +from datetime import datetime +from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer +from azure_devtools.scenario_tests import SingleValueReplacer +from azure.cli.testsdk.exceptions import CliTestError +from azure.cli.testsdk.reverse_dependency import get_dummy_cli + + +KEY_RESOURCE_GROUP = 'rg' +KEY_VIRTUAL_NETWORK = 'vnet' +KEY_VNET_SUBNET = 'subnet' + + +class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='virtual_network', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME', + random_name_length=24, key=KEY_VIRTUAL_NETWORK): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VirtualNetworkPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + + tags = {'product': 'azurecli', 'cause': 'automation', + 'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')} + if 'ENV_JOB_NAME' in os.environ: + tags['job'] = os.environ['ENV_JOB_NAME'] + tags = ' '.join(['{}={}'.format(key, value) + for key, value in tags.items()]) + template = 'az network vnet create --resource-group {} --name {} --tag ' + tags + self.live_only_execute(self.cli_ctx, template.format( + self.resource_group_name, name)) + + self.test_class_instance.kwargs[self.key] = name + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + # delete vnet if test is being recorded and if the vnet is not a dev rg + if not self.dev_setting_name: + self.live_only_execute( + self.cli_ctx, 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) + + +class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='subnet', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + vnet_name=None, + vnet_key=KEY_VIRTUAL_NETWORK, + address_prefixes="11.0.0.0/24", + dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', + random_name_length=24, key=KEY_VNET_SUBNET): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VnetSubnetPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.vnet_name = vnet_name + self.vnet_key = vnet_key + self.address_prefixes = address_prefixes + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + if not self.vnet_name: + self.vnet_name = self.test_class_instance.kwargs.get(self.vnet_key) + if not self.vnet_name: + raise CliTestError("Error: No vnet configured!") + + self.test_class_instance.kwargs[self.key] = 'default' + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + pass diff --git a/src/securityinsight/azext_sentinel/tests/latest/test_sentinel_scenario.py b/src/securityinsight/azext_sentinel/tests/latest/test_sentinel_scenario.py new file mode 100644 index 00000000000..282d7d85496 --- /dev/null +++ b/src/securityinsight/azext_sentinel/tests/latest/test_sentinel_scenario.py @@ -0,0 +1,481 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +import unittest + +from azure_devtools.scenario_tests import AllowLargeResponse +from azure.cli.testsdk import ScenarioTest +from .. import try_manual +from azure.cli.testsdk import ResourceGroupPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +@try_manual +def setup(test, rg): + pass + + +# EXAMPLE: /Actions/get/Get all actions of alert rule. +@try_manual +def step__actions_get_get_all_actions_of_alert_rule_(test, rg): + test.cmd('az sentinel action list ' + '--resource-group "{rg}" ' + '--rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRuleTemplates/get/Get alert rule template by Id. +@try_manual +def step__alertruletemplates_get_get_alert_rule_template_by_id_(test, rg): + test.cmd('az sentinel alert-rule-template show ' + '--alert-rule-template-id "65360bb0-8986-4ade-a89d-af3cf44d28aa" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRuleTemplates/get/Get all alert rule templates. +@try_manual +def step__alertruletemplates_get_get_all_alert_rule_templates_(test, rg): + test.cmd('az sentinel alert-rule-template list ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRules/put/Creates or updates a Fusion alert rule. +@try_manual +def step__alertrules_put_creates_or_updates_a_fusion_alert_rule_(test, rg): + test.cmd('az sentinel alert-rule create ' + '--etag "3d00c3ca-0000-0100-0000-5d42d5010000" ' + '--kind "Fusion" ' + '--resource-group "{rg}" ' + '--rule-id "myFirstFusionRule" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRules/put/Creates or updates a MicrosoftSecurityIncidentCreation rule. +@try_manual +def step__alertrules_put_creates_or_updates_a_microsoftsecurityincidentcreation_rule_(test, rg): + test.cmd('az sentinel alert-rule create ' + '--etag "\\"260097e0-0000-0d00-0000-5d6fa88f0000\\"" ' + '--kind "MicrosoftSecurityIncidentCreation" ' + '--resource-group "{rg}" ' + '--rule-id "microsoftSecurityIncidentCreationRuleExample" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRules/put/Creates or updates a Scheduled alert rule. +@try_manual +def step__alertrules_put_creates_or_updates_a_scheduled_alert_rule_(test, rg): + test.cmd('az sentinel alert-rule create ' + '--etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" ' + '--kind "Scheduled" ' + '--resource-group "{rg}" ' + '--rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRules/put/Creates or updates an action of alert rule. +@try_manual +def step__alertrules_put_creates_or_updates_an_action_of_alert_rule_(test, rg): + test.cmd('az sentinel alert-rule create ' + '--etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" ' + '--logic-app-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Logic/w' + 'orkflows/MyAlerts" ' + '--trigger-uri "https://prod-31.northcentralus.logic.azure.com:443/workflows/cd3765391efd48549fd7681ded1d4' + '8d7/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=signatur' + 'e" ' + '--action-id "912bec42-cb66-4c03-ac63-1761b6898c3e" ' + '--resource-group "{rg}" ' + '--rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRules/get/Get a Fusion alert rule. +@try_manual +def step__alertrules_get_get_a_fusion_alert_rule_(test, rg): + test.cmd('az sentinel alert-rule show ' + '--resource-group "{rg}" ' + '--rule-id "myFirstFusionRule" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRules/get/Get a MicrosoftSecurityIncidentCreation rule. +@try_manual +def step__alertrules_get_get_a_microsoftsecurityincidentcreation_rule_(test, rg): + test.cmd('az sentinel alert-rule show ' + '--resource-group "{rg}" ' + '--rule-id "microsoftSecurityIncidentCreationRuleExample" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRules/get/Get a Scheduled alert rule. +@try_manual +def step__alertrules_get_get_a_scheduled_alert_rule_(test, rg): + test.cmd('az sentinel alert-rule show ' + '--resource-group "{rg}" ' + '--rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRules/get/Get all alert rules. +@try_manual +def step__alertrules_get_get_all_alert_rules_(test, rg): + test.cmd('az sentinel alert-rule list ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRules/get/Get an action of alert rule. +@try_manual +def step__alertrules_get_get_an_action_of_alert_rule_(test, rg): + test.cmd('az sentinel alert-rule show ' + '--action-id "912bec42-cb66-4c03-ac63-1761b6898c3e" ' + '--resource-group "{rg}" ' + '--rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /Bookmarks/put/Creates or updates a bookmark. +@try_manual +def step__bookmarks_put_creates_or_updates_a_bookmark_(test, rg): + test.cmd('az sentinel bookmark create ' + '--etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" ' + '--created "2019-01-01T13:15:30Z" ' + '--created-by name="john doe" email="john@contoso.com" object-id="2046feea-040d-4a46-9e2b-91c2941bfa70" ' + '--display-name "My bookmark" ' + '--labels "[\\"Tag1\\",\\"Tag2\\"]" ' + '--notes "Found a suspicious activity" ' + '--query "SecurityEvent | where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)" ' + '--query-result "Security Event query result" ' + '--updated "2019-01-01T13:15:30Z" ' + '--updated-by name="john doe" email="john@contoso.com" object-id="2046feea-040d-4a46-9e2b-91c2941bfa70" ' + '--bookmark-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /Bookmarks/get/Get a bookmark. +@try_manual +def step__bookmarks_get_get_a_bookmark_(test, rg): + test.cmd('az sentinel bookmark show ' + '--bookmark-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /Bookmarks/get/Get all bookmarks. +@try_manual +def step__bookmarks_get_get_all_bookmarks_(test, rg): + test.cmd('az sentinel bookmark list ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /DataConnectors/put/Creates or updates an Office365 data connector. +@try_manual +def step__dataconnectors_put_creates_or_updates_an_office365_data_connector_(test, rg): + test.cmd('az sentinel data-connector create ' + '--etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" ' + '--kind "Office365" ' + '--data-connector-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /DataConnectors/get/Get a ASC data connector. +@try_manual +def step__dataconnectors_get_get_a_asc_data_connector_(test, rg): + test.cmd('az sentinel data-connector show ' + '--data-connector-id "763f9fa1-c2d3-4fa2-93e9-bccd4899aa12" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /DataConnectors/get/Get a MCAS data connector. +@try_manual +def step__dataconnectors_get_get_a_mcas_data_connector_(test, rg): + test.cmd('az sentinel data-connector show ' + '--data-connector-id "b96d014d-b5c2-4a01-9aba-a8058f629d42" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /DataConnectors/get/Get a MDATP data connector +@try_manual +def step__dataconnectors_get_get_a_mdatp_data_connector(test, rg): + test.cmd('az sentinel data-connector show ' + '--data-connector-id "06b3ccb8-1384-4bcc-aec7-852f6d57161b" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /DataConnectors/get/Get a TI data connector. +@try_manual +def step__dataconnectors_get_get_a_ti_data_connector_(test, rg): + test.cmd('az sentinel data-connector show ' + '--data-connector-id "c345bf40-8509-4ed2-b947-50cb773aaf04" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /DataConnectors/get/Get all data connectors. +@try_manual +def step__dataconnectors_get_get_all_data_connectors_(test, rg): + test.cmd('az sentinel data-connector list ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /DataConnectors/get/Get an AAD data connector. +@try_manual +def step__dataconnectors_get_get_an_aad_data_connector_(test, rg): + test.cmd('az sentinel data-connector show ' + '--data-connector-id "f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /DataConnectors/get/Get an AATP data connector. +@try_manual +def step__dataconnectors_get_get_an_aatp_data_connector_(test, rg): + test.cmd('az sentinel data-connector show ' + '--data-connector-id "07e42cb3-e658-4e90-801c-efa0f29d3d44" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /DataConnectors/get/Get an AwsCloudTrail data connector. +@try_manual +def step__dataconnectors_get_get_an_awscloudtrail_data_connector_(test, rg): + test.cmd('az sentinel data-connector show ' + '--data-connector-id "c345bf40-8509-4ed2-b947-50cb773aaf04" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /DataConnectors/get/Get an Office365 data connector. +@try_manual +def step__dataconnectors_get_get_an_office365_data_connector_(test, rg): + test.cmd('az sentinel data-connector show ' + '--data-connector-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /IncidentComments/put/Creates an incident comment. +@try_manual +def step__incidentcomments_put_creates_an_incident_comment_(test, rg): + test.cmd('az sentinel incident-comment create ' + '--message "Some message" ' + '--incident-comment-id "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014" ' + '--incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /IncidentComments/get/Get all incident comments. +@try_manual +def step__incidentcomments_get_get_all_incident_comments_(test, rg): + test.cmd('az sentinel incident-comment list ' + '--incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /IncidentComments/get/Get an incident comment. +@try_manual +def step__incidentcomments_get_get_an_incident_comment_(test, rg): + test.cmd('az sentinel incident-comment show ' + '--incident-comment-id "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014" ' + '--incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /Incidents/put/Creates or updates an incident. +@try_manual +def step__incidents_put_creates_or_updates_an_incident_(test, rg): + test.cmd('az sentinel incident create ' + '--etag "\\"0300bf09-0000-0000-0000-5c37296e0000\\"" ' + '--description "This is a demo incident" ' + '--classification "FalsePositive" ' + '--first-activity-time-utc "2019-01-01T13:00:30Z" ' + '--last-activity-time-utc "2019-01-01T13:05:30Z" ' + '--owner object-id="2046feea-040d-4a46-9e2b-91c2941bfa70" ' + '--severity "High" ' + '--status "Closed" ' + '--title "My incident" ' + '--incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /Incidents/get/Get all incidents. +@try_manual +def step__incidents_get_get_all_incidents_(test, rg): + test.cmd('az sentinel incident list ' + '--orderby "properties/createdTimeUtc desc" ' + '--top 1 ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /Incidents/get/Get an incident. +@try_manual +def step__incidents_get_get_an_incident_(test, rg): + test.cmd('az sentinel incident show ' + '--incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRules/delete/Delete an alert rule. +@try_manual +def step__alertrules_delete_delete_an_alert_rule_(test, rg): + test.cmd('az sentinel alert-rule delete ' + '--resource-group "{rg}" ' + '--rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /AlertRules/delete/Delete an action of alert rule. +@try_manual +def step__alertrules_delete_delete_an_action_of_alert_rule_(test, rg): + test.cmd('az sentinel alert-rule delete ' + '--action-id "912bec42-cb66-4c03-ac63-1761b6898c3e" ' + '--resource-group "{rg}" ' + '--rule-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /Bookmarks/delete/Delete a bookmark. +@try_manual +def step__bookmarks_delete_delete_a_bookmark_(test, rg): + test.cmd('az sentinel bookmark delete ' + '--bookmark-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /DataConnectors/delete/Delete an Office365 data connector. +@try_manual +def step__dataconnectors_delete_delete_an_office365_data_connector_(test, rg): + test.cmd('az sentinel data-connector delete ' + '--data-connector-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +# EXAMPLE: /Incidents/delete/Delete an incident. +@try_manual +def step__incidents_delete_delete_an_incident_(test, rg): + test.cmd('az sentinel incident delete ' + '--incident-id "73e01a99-5cd7-4139-a149-9f2736ff2ab5" ' + '--resource-group "{rg}" ' + '--workspace-name "myWorkspace"', + checks=[]) + + +@try_manual +def cleanup(test, rg): + pass + + +@try_manual +def call_scenario(test, rg): + setup(test, rg) + step__actions_get_get_all_actions_of_alert_rule_(test, rg) + step__alertruletemplates_get_get_alert_rule_template_by_id_(test, rg) + step__alertruletemplates_get_get_all_alert_rule_templates_(test, rg) + step__alertrules_put_creates_or_updates_a_fusion_alert_rule_(test, rg) + step__alertrules_put_creates_or_updates_a_microsoftsecurityincidentcreation_rule_(test, rg) + step__alertrules_put_creates_or_updates_a_scheduled_alert_rule_(test, rg) + step__alertrules_put_creates_or_updates_an_action_of_alert_rule_(test, rg) + step__alertrules_get_get_a_fusion_alert_rule_(test, rg) + step__alertrules_get_get_a_microsoftsecurityincidentcreation_rule_(test, rg) + step__alertrules_get_get_a_scheduled_alert_rule_(test, rg) + step__alertrules_get_get_all_alert_rules_(test, rg) + step__alertrules_get_get_an_action_of_alert_rule_(test, rg) + step__bookmarks_put_creates_or_updates_a_bookmark_(test, rg) + step__bookmarks_get_get_a_bookmark_(test, rg) + step__bookmarks_get_get_all_bookmarks_(test, rg) + step__dataconnectors_put_creates_or_updates_an_office365_data_connector_(test, rg) + step__dataconnectors_get_get_a_asc_data_connector_(test, rg) + step__dataconnectors_get_get_a_mcas_data_connector_(test, rg) + step__dataconnectors_get_get_a_mdatp_data_connector(test, rg) + step__dataconnectors_get_get_a_ti_data_connector_(test, rg) + step__dataconnectors_get_get_all_data_connectors_(test, rg) + step__dataconnectors_get_get_an_aad_data_connector_(test, rg) + step__dataconnectors_get_get_an_aatp_data_connector_(test, rg) + step__dataconnectors_get_get_an_awscloudtrail_data_connector_(test, rg) + step__dataconnectors_get_get_an_office365_data_connector_(test, rg) + step__incidentcomments_put_creates_an_incident_comment_(test, rg) + step__incidentcomments_get_get_all_incident_comments_(test, rg) + step__incidentcomments_get_get_an_incident_comment_(test, rg) + step__incidents_put_creates_or_updates_an_incident_(test, rg) + step__incidents_get_get_all_incidents_(test, rg) + step__incidents_get_get_an_incident_(test, rg) + step__alertrules_delete_delete_an_alert_rule_(test, rg) + step__alertrules_delete_delete_an_action_of_alert_rule_(test, rg) + step__bookmarks_delete_delete_a_bookmark_(test, rg) + step__dataconnectors_delete_delete_an_office365_data_connector_(test, rg) + step__incidents_delete_delete_an_incident_(test, rg) + cleanup(test, rg) + + +@try_manual +class SecurityInsightsScenarioTest(ScenarioTest): + + @ResourceGroupPreparer(name_prefix='clitestsentinel_myRg'[:7], key='rg', parameter_name='rg') + def test_sentinel(self, rg): + + self.kwargs.update({ + 'subscription_id': self.get_subscription_id() + }) + + call_scenario(self, rg) diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/__init__.py b/src/securityinsight/azext_sentinel/vendored_sdks/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/__init__.py @@ -0,0 +1,12 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/__init__.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/__init__.py new file mode 100644 index 00000000000..917de69fcdc --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._security_insights import SecurityInsights +from ._version import VERSION + +__version__ = VERSION +__all__ = ['SecurityInsights'] + +try: + from .patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/_configuration.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/_configuration.py new file mode 100644 index 00000000000..6e9fe325582 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/_configuration.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class SecurityInsightsConfiguration(Configuration): + """Configuration for SecurityInsights. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Azure subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(SecurityInsightsConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-01-01" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-securityinsight/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/_security_insights.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/_security_insights.py new file mode 100644 index 00000000000..f589a21b79d --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/_security_insights.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + +from ._configuration import SecurityInsightsConfiguration +from .operations import OperationOperations +from .operations import AlertRuleOperations +from .operations import ActionOperations +from .operations import AlertRuleTemplateOperations +from .operations import BookmarkOperations +from .operations import DataConnectorOperations +from .operations import IncidentOperations +from .operations import IncidentCommentOperations +from . import models + + +class SecurityInsights(object): + """API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. + + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.securityinsight.operations.OperationOperations + :ivar alert_rule: AlertRuleOperations operations + :vartype alert_rule: azure.mgmt.securityinsight.operations.AlertRuleOperations + :ivar action: ActionOperations operations + :vartype action: azure.mgmt.securityinsight.operations.ActionOperations + :ivar alert_rule_template: AlertRuleTemplateOperations operations + :vartype alert_rule_template: azure.mgmt.securityinsight.operations.AlertRuleTemplateOperations + :ivar bookmark: BookmarkOperations operations + :vartype bookmark: azure.mgmt.securityinsight.operations.BookmarkOperations + :ivar data_connector: DataConnectorOperations operations + :vartype data_connector: azure.mgmt.securityinsight.operations.DataConnectorOperations + :ivar incident: IncidentOperations operations + :vartype incident: azure.mgmt.securityinsight.operations.IncidentOperations + :ivar incident_comment: IncidentCommentOperations operations + :vartype incident_comment: azure.mgmt.securityinsight.operations.IncidentCommentOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = SecurityInsightsConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.alert_rule = AlertRuleOperations( + self._client, self._config, self._serialize, self._deserialize) + self.action = ActionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.alert_rule_template = AlertRuleTemplateOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bookmark = BookmarkOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data_connector = DataConnectorOperations( + self._client, self._config, self._serialize, self._deserialize) + self.incident = IncidentOperations( + self._client, self._config, self._serialize, self._deserialize) + self.incident_comment = IncidentCommentOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> SecurityInsights + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/_version.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/_version.py new file mode 100644 index 00000000000..eae7c95b6fb --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/__init__.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/__init__.py new file mode 100644 index 00000000000..3f1f9829e61 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._security_insights_async import SecurityInsights +__all__ = ['SecurityInsights'] diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/_configuration_async.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/_configuration_async.py new file mode 100644 index 00000000000..48c151e8865 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/_configuration_async.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class SecurityInsightsConfiguration(Configuration): + """Configuration for SecurityInsights. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Azure subscription ID. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(SecurityInsightsConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-01-01" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-securityinsight/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/_security_insights_async.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/_security_insights_async.py new file mode 100644 index 00000000000..1a1347c6fb7 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/_security_insights_async.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import SecurityInsightsConfiguration +from .operations_async import OperationOperations +from .operations_async import AlertRuleOperations +from .operations_async import ActionOperations +from .operations_async import AlertRuleTemplateOperations +from .operations_async import BookmarkOperations +from .operations_async import DataConnectorOperations +from .operations_async import IncidentOperations +from .operations_async import IncidentCommentOperations +from .. import models + + +class SecurityInsights(object): + """API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. + + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.securityinsight.aio.operations_async.OperationOperations + :ivar alert_rule: AlertRuleOperations operations + :vartype alert_rule: azure.mgmt.securityinsight.aio.operations_async.AlertRuleOperations + :ivar action: ActionOperations operations + :vartype action: azure.mgmt.securityinsight.aio.operations_async.ActionOperations + :ivar alert_rule_template: AlertRuleTemplateOperations operations + :vartype alert_rule_template: azure.mgmt.securityinsight.aio.operations_async.AlertRuleTemplateOperations + :ivar bookmark: BookmarkOperations operations + :vartype bookmark: azure.mgmt.securityinsight.aio.operations_async.BookmarkOperations + :ivar data_connector: DataConnectorOperations operations + :vartype data_connector: azure.mgmt.securityinsight.aio.operations_async.DataConnectorOperations + :ivar incident: IncidentOperations operations + :vartype incident: azure.mgmt.securityinsight.aio.operations_async.IncidentOperations + :ivar incident_comment: IncidentCommentOperations operations + :vartype incident_comment: azure.mgmt.securityinsight.aio.operations_async.IncidentCommentOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Azure subscription ID. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = SecurityInsightsConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.alert_rule = AlertRuleOperations( + self._client, self._config, self._serialize, self._deserialize) + self.action = ActionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.alert_rule_template = AlertRuleTemplateOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bookmark = BookmarkOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data_connector = DataConnectorOperations( + self._client, self._config, self._serialize, self._deserialize) + self.incident = IncidentOperations( + self._client, self._config, self._serialize, self._deserialize) + self.incident_comment = IncidentCommentOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "SecurityInsights": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/__init__.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/__init__.py new file mode 100644 index 00000000000..0d2fb1ec8ad --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/__init__.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operation_operations_async import OperationOperations +from ._alert_rule_operations_async import AlertRuleOperations +from ._action_operations_async import ActionOperations +from ._alert_rule_template_operations_async import AlertRuleTemplateOperations +from ._bookmark_operations_async import BookmarkOperations +from ._data_connector_operations_async import DataConnectorOperations +from ._incident_operations_async import IncidentOperations +from ._incident_comment_operations_async import IncidentCommentOperations + +__all__ = [ + 'OperationOperations', + 'AlertRuleOperations', + 'ActionOperations', + 'AlertRuleTemplateOperations', + 'BookmarkOperations', + 'DataConnectorOperations', + 'IncidentOperations', + 'IncidentCommentOperations', +] diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_action_operations_async.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_action_operations_async.py new file mode 100644 index 00000000000..35a1eaae38f --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_action_operations_async.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ActionOperations: + """ActionOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_alert_rule( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + **kwargs + ) -> "models.ActionsList": + """Gets all actions of alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActionsList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.ActionsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ActionsList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_alert_rule.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ActionsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_alert_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_alert_rule_operations_async.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_alert_rule_operations_async.py new file mode 100644 index 00000000000..6f145c9ebc0 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_alert_rule_operations_async.py @@ -0,0 +1,520 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AlertRuleOperations: + """AlertRuleOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> "models.AlertRulesList": + """Gets all alert rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRulesList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.AlertRulesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRulesList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRulesList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules'} + + async def get( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + **kwargs + ) -> "models.AlertRule": + """Gets the alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRule or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.AlertRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRule"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + kind: Union[str, "models.AlertRuleKindEnum"], + etag: Optional[str] = None, + **kwargs + ) -> "models.AlertRule": + """Creates or updates the alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :param kind: The kind of the alert rule. + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param etag: Etag of the azure resource. + :type etag: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRule or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.AlertRule or ~azure.mgmt.securityinsight.models.AlertRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRule"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _alert_rule = models.AlertRule(etag=etag, kind=kind) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_alert_rule, 'AlertRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AlertRule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AlertRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + **kwargs + ) -> None: + """Delete the alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} + + async def get_action( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + **kwargs + ) -> "models.ActionResponse": + """Gets the action of alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :param action_id: Action ID. + :type action_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActionResponse or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.ActionResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ActionResponse"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get_action.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'actionId': self._serialize.url("action_id", action_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActionResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} + + async def create_or_update_action( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + etag: Optional[str] = None, + logic_app_resource_id: Optional[str] = None, + trigger_uri: Optional[str] = None, + **kwargs + ) -> "models.ActionResponse": + """Creates or updates the action of alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :param action_id: Action ID. + :type action_id: str + :param etag: Etag of the azure resource. + :type etag: str + :param logic_app_resource_id: Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + :param trigger_uri: Logic App Callback URL for this specific workflow. + :type trigger_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActionResponse or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.ActionResponse or ~azure.mgmt.securityinsight.models.ActionResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ActionResponse"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _action = models.ActionRequest(etag=etag, logic_app_resource_id=logic_app_resource_id, trigger_uri=trigger_uri) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_action.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'actionId': self._serialize.url("action_id", action_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_action, 'ActionRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionResponse', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ActionResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} + + async def delete_action( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + **kwargs + ) -> None: + """Delete the action of alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :param action_id: Action ID. + :type action_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.delete_action.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'actionId': self._serialize.url("action_id", action_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_alert_rule_template_operations_async.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_alert_rule_template_operations_async.py new file mode 100644 index 00000000000..d57fb29f400 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_alert_rule_template_operations_async.py @@ -0,0 +1,173 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AlertRuleTemplateOperations: + """AlertRuleTemplateOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> "models.AlertRuleTemplatesList": + """Gets all alert rule templates. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleTemplatesList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.AlertRuleTemplatesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleTemplatesList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleTemplatesList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates'} + + async def get( + self, + resource_group_name: str, + workspace_name: str, + alert_rule_template_id: str, + **kwargs + ) -> "models.AlertRuleTemplate": + """Gets the alert rule template. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param alert_rule_template_id: Alert rule template ID. + :type alert_rule_template_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleTemplate or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.AlertRuleTemplate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleTemplate"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'alertRuleTemplateId': self._serialize.url("alert_rule_template_id", alert_rule_template_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertRuleTemplate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_bookmark_operations_async.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_bookmark_operations_async.py new file mode 100644 index 00000000000..d6156f07bf9 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_bookmark_operations_async.py @@ -0,0 +1,336 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BookmarkOperations: + """BookmarkOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> "models.BookmarkList": + """Gets all bookmarks. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BookmarkList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.BookmarkList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BookmarkList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BookmarkList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks'} + + async def get( + self, + resource_group_name: str, + workspace_name: str, + bookmark_id: str, + **kwargs + ) -> "models.Bookmark": + """Gets a bookmark. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param bookmark_id: Bookmark ID. + :type bookmark_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Bookmark or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Bookmark + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Bookmark"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'bookmarkId': self._serialize.url("bookmark_id", bookmark_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Bookmark', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + bookmark_id: str, + etag: Optional[str] = None, + created: Optional[datetime.datetime] = None, + created_by: Optional["models.UserInfo"] = None, + display_name: Optional[str] = None, + labels: Optional[List[str]] = None, + notes: Optional[str] = None, + query: Optional[str] = None, + query_result: Optional[str] = None, + updated: Optional[datetime.datetime] = None, + updated_by: Optional["models.UserInfo"] = None, + incident_info: Optional["models.IncidentInfo"] = None, + **kwargs + ) -> "models.Bookmark": + """Creates or updates the bookmark. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param bookmark_id: Bookmark ID. + :type bookmark_id: str + :param etag: Etag of the azure resource. + :type etag: str + :param created: The time the bookmark was created. + :type created: ~datetime.datetime + :param created_by: Describes a user that created the bookmark. + :type created_by: ~azure.mgmt.securityinsight.models.UserInfo + :param display_name: The display name of the bookmark. + :type display_name: str + :param labels: List of labels relevant to this bookmark. + :type labels: list[str] + :param notes: The notes of the bookmark. + :type notes: str + :param query: The query of the bookmark. + :type query: str + :param query_result: The query result of the bookmark. + :type query_result: str + :param updated: The last time the bookmark was updated. + :type updated: ~datetime.datetime + :param updated_by: Describes a user that updated the bookmark. + :type updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :param incident_info: Describes an incident that relates to bookmark. + :type incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Bookmark or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Bookmark or ~azure.mgmt.securityinsight.models.Bookmark + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Bookmark"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _bookmark = models.Bookmark(etag=etag, created=created, created_by=created_by, display_name=display_name, labels=labels, notes=notes, query=query, query_result=query_result, updated=updated, updated_by=updated_by, incident_info=incident_info) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'bookmarkId': self._serialize.url("bookmark_id", bookmark_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_bookmark, 'Bookmark') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Bookmark', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Bookmark', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + bookmark_id: str, + **kwargs + ) -> None: + """Delete the bookmark. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param bookmark_id: Bookmark ID. + :type bookmark_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'bookmarkId': self._serialize.url("bookmark_id", bookmark_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_data_connector_operations_async.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_data_connector_operations_async.py new file mode 100644 index 00000000000..7ea18e5a090 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_data_connector_operations_async.py @@ -0,0 +1,308 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataConnectorOperations: + """DataConnectorOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> "models.DataConnectorList": + """Gets all data connectors. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnectorList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnectorList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectorList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataConnectorList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors'} + + async def get( + self, + resource_group_name: str, + workspace_name: str, + data_connector_id: str, + **kwargs + ) -> "models.DataConnector": + """Gets a data connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param data_connector_id: Connector ID. + :type data_connector_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnector or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnector + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnector"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'dataConnectorId': self._serialize.url("data_connector_id", data_connector_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataConnector', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + data_connector_id: str, + etag: Optional[str] = None, + kind: Optional[Union[str, "models.DataConnectorKindEnum"]] = None, + **kwargs + ) -> "models.DataConnector": + """Creates or updates the data connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param data_connector_id: Connector ID. + :type data_connector_id: str + :param etag: Etag of the azure resource. + :type etag: str + :param kind: The kind of the data connector. + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnector or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnector or ~azure.mgmt.securityinsight.models.DataConnector + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnector"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _data_connector = models.DataConnector(etag=etag, kind=kind) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'dataConnectorId': self._serialize.url("data_connector_id", data_connector_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_data_connector, 'DataConnector') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DataConnector', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataConnector', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + data_connector_id: str, + **kwargs + ) -> None: + """Delete the data connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param data_connector_id: Connector ID. + :type data_connector_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'dataConnectorId': self._serialize.url("data_connector_id", data_connector_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_incident_comment_operations_async.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_incident_comment_operations_async.py new file mode 100644 index 00000000000..f955a7d49af --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_incident_comment_operations_async.py @@ -0,0 +1,278 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IncidentCommentOperations: + """IncidentCommentOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_incident( + self, + resource_group_name: str, + workspace_name: str, + incident_id: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> "models.IncidentCommentList": + """Gets all incident comments. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :param filter: Filters the results, based on a Boolean condition. Optional. + :type filter: str + :param orderby: Sorts the results. Optional. + :type orderby: str + :param top: Returns only the first n results. Optional. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IncidentCommentList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.IncidentCommentList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentCommentList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_incident.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IncidentCommentList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_incident.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments'} + + async def get_comment( + self, + resource_group_name: str, + workspace_name: str, + incident_id: str, + incident_comment_id: str, + **kwargs + ) -> "models.IncidentComment": + """Gets an incident comment. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :param incident_comment_id: Incident comment ID. + :type incident_comment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IncidentComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.IncidentComment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentComment"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get_comment.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + 'incidentCommentId': self._serialize.url("incident_comment_id", incident_comment_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IncidentComment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_comment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} + + async def create_comment( + self, + resource_group_name: str, + workspace_name: str, + incident_id: str, + incident_comment_id: str, + message: Optional[str] = None, + **kwargs + ) -> "models.IncidentComment": + """Creates the incident comment. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :param incident_comment_id: Incident comment ID. + :type incident_comment_id: str + :param message: The comment message. + :type message: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IncidentComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.IncidentComment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentComment"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _incident_comment = models.IncidentComment(message=message) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_comment.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + 'incidentCommentId': self._serialize.url("incident_comment_id", incident_comment_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_incident_comment, 'IncidentComment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IncidentComment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_comment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_incident_operations_async.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_incident_operations_async.py new file mode 100644 index 00000000000..13eb496e93c --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_incident_operations_async.py @@ -0,0 +1,355 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IncidentOperations: + """IncidentOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + filter: Optional[str] = None, + orderby: Optional[str] = None, + top: Optional[int] = None, + skip_token: Optional[str] = None, + **kwargs + ) -> "models.IncidentList": + """Gets all incidents. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. + :type filter: str + :param orderby: Sorts the results. Optional. + :type orderby: str + :param top: Returns only the first n results. Optional. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IncidentList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.IncidentList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IncidentList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents'} + + async def get( + self, + resource_group_name: str, + workspace_name: str, + incident_id: str, + **kwargs + ) -> "models.Incident": + """Gets an incident. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Incident or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Incident + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Incident"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Incident', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + incident_id: str, + etag: Optional[str] = None, + classification: Optional[Union[str, "models.IncidentClassification"]] = None, + description: Optional[str] = None, + first_activity_time_utc: Optional[datetime.datetime] = None, + labels: Optional[List["IncidentLabel"]] = None, + last_activity_time_utc: Optional[datetime.datetime] = None, + owner: Optional["models.IncidentOwnerInfo"] = None, + severity: Optional[Union[str, "models.IncidentSeverity"]] = None, + status: Optional[Union[str, "models.IncidentStatus"]] = None, + title: Optional[str] = None, + **kwargs + ) -> "models.Incident": + """Creates or updates the incident. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :param etag: Etag of the azure resource. + :type etag: str + :param classification: The reason the incident was closed. + :type classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification + :param description: The description of the incident. + :type description: str + :param first_activity_time_utc: The time of the first activity in the incident. + :type first_activity_time_utc: ~datetime.datetime + :param labels: List of labels relevant to this incident. + :type labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + :param last_activity_time_utc: The time of the last activity in the incident. + :type last_activity_time_utc: ~datetime.datetime + :param owner: Describes a user that the incident is assigned to. + :type owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo + :param severity: The severity of the incident. + :type severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :param status: The status of the incident. + :type status: str or ~azure.mgmt.securityinsight.models.IncidentStatus + :param title: The title of the incident. + :type title: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Incident or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Incident or ~azure.mgmt.securityinsight.models.Incident + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Incident"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _incident = models.Incident(etag=etag, classification=classification, description=description, first_activity_time_utc=first_activity_time_utc, labels=labels, last_activity_time_utc=last_activity_time_utc, owner=owner, severity=severity, status=status, title=title) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_incident, 'Incident') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Incident', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Incident', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + incident_id: str, + **kwargs + ) -> None: + """Delete the incident. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_operation_operations_async.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_operation_operations_async.py new file mode 100644 index 00000000000..77dde3c8103 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/aio/operations_async/_operation_operations_async.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations: + """OperationOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> "models.OperationsList": + """Lists all operations available Azure Security Insights Resource Provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationsList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.OperationsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationsList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.SecurityInsights/operations'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/__init__.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/__init__.py new file mode 100644 index 00000000000..50e3833d1f3 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/__init__.py @@ -0,0 +1,324 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AadDataConnector + from ._models_py3 import AadDataConnectorProperties + from ._models_py3 import AatpDataConnector + from ._models_py3 import AatpDataConnectorProperties + from ._models_py3 import ActionPropertiesBase + from ._models_py3 import ActionRequest + from ._models_py3 import ActionRequestProperties + from ._models_py3 import ActionResponse + from ._models_py3 import ActionResponseProperties + from ._models_py3 import ActionsList + from ._models_py3 import AlertRule + from ._models_py3 import AlertRuleKind + from ._models_py3 import AlertRuleTemplate + from ._models_py3 import AlertRuleTemplateDataSource + from ._models_py3 import AlertRuleTemplatePropertiesBase + from ._models_py3 import AlertRuleTemplatesList + from ._models_py3 import AlertRulesList + from ._models_py3 import AlertsDataTypeOfDataConnector + from ._models_py3 import AlertsDataTypeOfDataConnectorAlerts + from ._models_py3 import AscDataConnector + from ._models_py3 import AscDataConnectorProperties + from ._models_py3 import AwsCloudTrailDataConnector + from ._models_py3 import AwsCloudTrailDataConnectorDataTypes + from ._models_py3 import AwsCloudTrailDataConnectorDataTypesLogs + from ._models_py3 import Bookmark + from ._models_py3 import BookmarkExpandParameters + from ._models_py3 import BookmarkList + from ._models_py3 import ClientInfo + from ._models_py3 import DataConnector + from ._models_py3 import DataConnectorDataTypeCommon + from ._models_py3 import DataConnectorKind + from ._models_py3 import DataConnectorList + from ._models_py3 import DataConnectorTenantId + from ._models_py3 import DataConnectorWithAlertsProperties + from ._models_py3 import Entity + from ._models_py3 import EntityCommonProperties + from ._models_py3 import EntityKind + from ._models_py3 import FusionAlertRule + from ._models_py3 import FusionAlertRuleTemplate + from ._models_py3 import FusionAlertRuleTemplateProperties + from ._models_py3 import GeoLocation + from ._models_py3 import GroupingConfiguration + from ._models_py3 import Incident + from ._models_py3 import IncidentAdditionalData + from ._models_py3 import IncidentComment + from ._models_py3 import IncidentCommentList + from ._models_py3 import IncidentInfo + from ._models_py3 import IncidentLabel + from ._models_py3 import IncidentList + from ._models_py3 import IncidentOwnerInfo + from ._models_py3 import IpEntity + from ._models_py3 import IpEntityProperties + from ._models_py3 import McasDataConnector + from ._models_py3 import McasDataConnectorDataTypes + from ._models_py3 import McasDataConnectorDataTypesDiscoveryLogs + from ._models_py3 import McasDataConnectorProperties + from ._models_py3 import MdatpDataConnector + from ._models_py3 import MdatpDataConnectorProperties + from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRule + from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleCommonProperties + from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleProperties + from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleTemplate + from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties + from ._models_py3 import OfficeConsent + from ._models_py3 import OfficeConsentList + from ._models_py3 import OfficeDataConnector + from ._models_py3 import OfficeDataConnectorDataTypes + from ._models_py3 import OfficeDataConnectorDataTypesExchange + from ._models_py3 import OfficeDataConnectorDataTypesSharePoint + from ._models_py3 import OfficeDataConnectorProperties + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationsList + from ._models_py3 import Resource + from ._models_py3 import ResourceWithEtag + from ._models_py3 import ScheduledAlertRule + from ._models_py3 import ScheduledAlertRuleCommonProperties + from ._models_py3 import ScheduledAlertRuleProperties + from ._models_py3 import ScheduledAlertRuleTemplate + from ._models_py3 import ScheduledAlertRuleTemplateProperties + from ._models_py3 import Settings + from ._models_py3 import SettingsKind + from ._models_py3 import ThreatIntelligence + from ._models_py3 import TiDataConnector + from ._models_py3 import TiDataConnectorDataTypes + from ._models_py3 import TiDataConnectorDataTypesIndicators + from ._models_py3 import TiDataConnectorProperties + from ._models_py3 import ToggleSettings + from ._models_py3 import UebaSettings + from ._models_py3 import UserInfo +except (SyntaxError, ImportError): + from ._models import AadDataConnector # type: ignore + from ._models import AadDataConnectorProperties # type: ignore + from ._models import AatpDataConnector # type: ignore + from ._models import AatpDataConnectorProperties # type: ignore + from ._models import ActionPropertiesBase # type: ignore + from ._models import ActionRequest # type: ignore + from ._models import ActionRequestProperties # type: ignore + from ._models import ActionResponse # type: ignore + from ._models import ActionResponseProperties # type: ignore + from ._models import ActionsList # type: ignore + from ._models import AlertRule # type: ignore + from ._models import AlertRuleKind # type: ignore + from ._models import AlertRuleTemplate # type: ignore + from ._models import AlertRuleTemplateDataSource # type: ignore + from ._models import AlertRuleTemplatePropertiesBase # type: ignore + from ._models import AlertRuleTemplatesList # type: ignore + from ._models import AlertRulesList # type: ignore + from ._models import AlertsDataTypeOfDataConnector # type: ignore + from ._models import AlertsDataTypeOfDataConnectorAlerts # type: ignore + from ._models import AscDataConnector # type: ignore + from ._models import AscDataConnectorProperties # type: ignore + from ._models import AwsCloudTrailDataConnector # type: ignore + from ._models import AwsCloudTrailDataConnectorDataTypes # type: ignore + from ._models import AwsCloudTrailDataConnectorDataTypesLogs # type: ignore + from ._models import Bookmark # type: ignore + from ._models import BookmarkExpandParameters # type: ignore + from ._models import BookmarkList # type: ignore + from ._models import ClientInfo # type: ignore + from ._models import DataConnector # type: ignore + from ._models import DataConnectorDataTypeCommon # type: ignore + from ._models import DataConnectorKind # type: ignore + from ._models import DataConnectorList # type: ignore + from ._models import DataConnectorTenantId # type: ignore + from ._models import DataConnectorWithAlertsProperties # type: ignore + from ._models import Entity # type: ignore + from ._models import EntityCommonProperties # type: ignore + from ._models import EntityKind # type: ignore + from ._models import FusionAlertRule # type: ignore + from ._models import FusionAlertRuleTemplate # type: ignore + from ._models import FusionAlertRuleTemplateProperties # type: ignore + from ._models import GeoLocation # type: ignore + from ._models import GroupingConfiguration # type: ignore + from ._models import Incident # type: ignore + from ._models import IncidentAdditionalData # type: ignore + from ._models import IncidentComment # type: ignore + from ._models import IncidentCommentList # type: ignore + from ._models import IncidentInfo # type: ignore + from ._models import IncidentLabel # type: ignore + from ._models import IncidentList # type: ignore + from ._models import IncidentOwnerInfo # type: ignore + from ._models import IpEntity # type: ignore + from ._models import IpEntityProperties # type: ignore + from ._models import McasDataConnector # type: ignore + from ._models import McasDataConnectorDataTypes # type: ignore + from ._models import McasDataConnectorDataTypesDiscoveryLogs # type: ignore + from ._models import McasDataConnectorProperties # type: ignore + from ._models import MdatpDataConnector # type: ignore + from ._models import MdatpDataConnectorProperties # type: ignore + from ._models import MicrosoftSecurityIncidentCreationAlertRule # type: ignore + from ._models import MicrosoftSecurityIncidentCreationAlertRuleCommonProperties # type: ignore + from ._models import MicrosoftSecurityIncidentCreationAlertRuleProperties # type: ignore + from ._models import MicrosoftSecurityIncidentCreationAlertRuleTemplate # type: ignore + from ._models import MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties # type: ignore + from ._models import OfficeConsent # type: ignore + from ._models import OfficeConsentList # type: ignore + from ._models import OfficeDataConnector # type: ignore + from ._models import OfficeDataConnectorDataTypes # type: ignore + from ._models import OfficeDataConnectorDataTypesExchange # type: ignore + from ._models import OfficeDataConnectorDataTypesSharePoint # type: ignore + from ._models import OfficeDataConnectorProperties # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationsList # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceWithEtag # type: ignore + from ._models import ScheduledAlertRule # type: ignore + from ._models import ScheduledAlertRuleCommonProperties # type: ignore + from ._models import ScheduledAlertRuleProperties # type: ignore + from ._models import ScheduledAlertRuleTemplate # type: ignore + from ._models import ScheduledAlertRuleTemplateProperties # type: ignore + from ._models import Settings # type: ignore + from ._models import SettingsKind # type: ignore + from ._models import ThreatIntelligence # type: ignore + from ._models import TiDataConnector # type: ignore + from ._models import TiDataConnectorDataTypes # type: ignore + from ._models import TiDataConnectorDataTypesIndicators # type: ignore + from ._models import TiDataConnectorProperties # type: ignore + from ._models import ToggleSettings # type: ignore + from ._models import UebaSettings # type: ignore + from ._models import UserInfo # type: ignore + +from ._security_insights_enums import ( + AlertRuleKindEnum, + AlertSeverity, + AttackTactic, + CaseSeverity, + DataConnectorKindEnum, + DataTypeState, + EntitiesMatchingMethod, + EntityKindEnum, + GroupingEntityType, + IncidentClassification, + IncidentLabelType, + IncidentSeverity, + IncidentStatus, + LicenseStatus, + MicrosoftSecurityProductName, + SettingKind, + StatusInMcas, + TemplateStatus, + TriggerOperator, +) + +__all__ = [ + 'AadDataConnector', + 'AadDataConnectorProperties', + 'AatpDataConnector', + 'AatpDataConnectorProperties', + 'ActionPropertiesBase', + 'ActionRequest', + 'ActionRequestProperties', + 'ActionResponse', + 'ActionResponseProperties', + 'ActionsList', + 'AlertRule', + 'AlertRuleKind', + 'AlertRuleTemplate', + 'AlertRuleTemplateDataSource', + 'AlertRuleTemplatePropertiesBase', + 'AlertRuleTemplatesList', + 'AlertRulesList', + 'AlertsDataTypeOfDataConnector', + 'AlertsDataTypeOfDataConnectorAlerts', + 'AscDataConnector', + 'AscDataConnectorProperties', + 'AwsCloudTrailDataConnector', + 'AwsCloudTrailDataConnectorDataTypes', + 'AwsCloudTrailDataConnectorDataTypesLogs', + 'Bookmark', + 'BookmarkExpandParameters', + 'BookmarkList', + 'ClientInfo', + 'DataConnector', + 'DataConnectorDataTypeCommon', + 'DataConnectorKind', + 'DataConnectorList', + 'DataConnectorTenantId', + 'DataConnectorWithAlertsProperties', + 'Entity', + 'EntityCommonProperties', + 'EntityKind', + 'FusionAlertRule', + 'FusionAlertRuleTemplate', + 'FusionAlertRuleTemplateProperties', + 'GeoLocation', + 'GroupingConfiguration', + 'Incident', + 'IncidentAdditionalData', + 'IncidentComment', + 'IncidentCommentList', + 'IncidentInfo', + 'IncidentLabel', + 'IncidentList', + 'IncidentOwnerInfo', + 'IpEntity', + 'IpEntityProperties', + 'McasDataConnector', + 'McasDataConnectorDataTypes', + 'McasDataConnectorDataTypesDiscoveryLogs', + 'McasDataConnectorProperties', + 'MdatpDataConnector', + 'MdatpDataConnectorProperties', + 'MicrosoftSecurityIncidentCreationAlertRule', + 'MicrosoftSecurityIncidentCreationAlertRuleCommonProperties', + 'MicrosoftSecurityIncidentCreationAlertRuleProperties', + 'MicrosoftSecurityIncidentCreationAlertRuleTemplate', + 'MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties', + 'OfficeConsent', + 'OfficeConsentList', + 'OfficeDataConnector', + 'OfficeDataConnectorDataTypes', + 'OfficeDataConnectorDataTypesExchange', + 'OfficeDataConnectorDataTypesSharePoint', + 'OfficeDataConnectorProperties', + 'Operation', + 'OperationDisplay', + 'OperationsList', + 'Resource', + 'ResourceWithEtag', + 'ScheduledAlertRule', + 'ScheduledAlertRuleCommonProperties', + 'ScheduledAlertRuleProperties', + 'ScheduledAlertRuleTemplate', + 'ScheduledAlertRuleTemplateProperties', + 'Settings', + 'SettingsKind', + 'ThreatIntelligence', + 'TiDataConnector', + 'TiDataConnectorDataTypes', + 'TiDataConnectorDataTypesIndicators', + 'TiDataConnectorProperties', + 'ToggleSettings', + 'UebaSettings', + 'UserInfo', + 'AlertRuleKindEnum', + 'AlertSeverity', + 'AttackTactic', + 'CaseSeverity', + 'DataConnectorKindEnum', + 'DataTypeState', + 'EntitiesMatchingMethod', + 'EntityKindEnum', + 'GroupingEntityType', + 'IncidentClassification', + 'IncidentLabelType', + 'IncidentSeverity', + 'IncidentStatus', + 'LicenseStatus', + 'MicrosoftSecurityProductName', + 'SettingKind', + 'StatusInMcas', + 'TemplateStatus', + 'TriggerOperator', +] diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/_models.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/_models.py new file mode 100644 index 00000000000..12ba40a47b8 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/_models.py @@ -0,0 +1,3185 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class DataConnectorKind(msrest.serialization.Model): + """Describes an Azure resource with kind. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataConnectorKind, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) + + +class DataConnector(DataConnectorKind): + """Data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataConnector, self).__init__(**kwargs) + + +class AadDataConnector(DataConnector): + """Represents AAD (Azure Active Directory) data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + **kwargs + ): + super(AadDataConnector, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.data_types = kwargs.get('data_types', None) + + +class DataConnectorWithAlertsProperties(msrest.serialization.Model): + """Data connector properties. + + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'data_types': {'key': 'dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + **kwargs + ): + super(DataConnectorWithAlertsProperties, self).__init__(**kwargs) + self.data_types = kwargs.get('data_types', None) + + +class AadDataConnectorProperties(DataConnectorWithAlertsProperties): + """AAD (Azure Active Directory) data connector properties. + + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'data_types': {'key': 'dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + **kwargs + ): + super(AadDataConnectorProperties, self).__init__(**kwargs) + + +class AatpDataConnector(DataConnector): + """Represents AATP (Azure Advanced Threat Protection) data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + **kwargs + ): + super(AatpDataConnector, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.data_types = kwargs.get('data_types', None) + + +class AatpDataConnectorProperties(DataConnectorWithAlertsProperties): + """AATP (Azure Advanced Threat Protection) data connector properties. + + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'data_types': {'key': 'dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + **kwargs + ): + super(AatpDataConnectorProperties, self).__init__(**kwargs) + + +class ActionPropertiesBase(msrest.serialization.Model): + """Action property bag base. + + All required parameters must be populated in order to send to Azure. + + :param logic_app_resource_id: Required. Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + """ + + _validation = { + 'logic_app_resource_id': {'required': True}, + } + + _attribute_map = { + 'logic_app_resource_id': {'key': 'logicAppResourceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActionPropertiesBase, self).__init__(**kwargs) + self.logic_app_resource_id = kwargs['logic_app_resource_id'] + + +class ResourceWithEtag(msrest.serialization.Model): + """An azure resource object with an Etag property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param etag: Etag of the azure resource. + :type etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceWithEtag, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.etag = kwargs.get('etag', None) + + +class ActionRequest(ResourceWithEtag): + """Action for alert rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param etag: Etag of the azure resource. + :type etag: str + :param logic_app_resource_id: Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + :param trigger_uri: Logic App Callback URL for this specific workflow. + :type trigger_uri: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'logic_app_resource_id': {'key': 'properties.logicAppResourceId', 'type': 'str'}, + 'trigger_uri': {'key': 'properties.triggerUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActionRequest, self).__init__(**kwargs) + self.logic_app_resource_id = kwargs.get('logic_app_resource_id', None) + self.trigger_uri = kwargs.get('trigger_uri', None) + + +class ActionRequestProperties(ActionPropertiesBase): + """Action property bag. + + All required parameters must be populated in order to send to Azure. + + :param logic_app_resource_id: Required. Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + :param trigger_uri: Logic App Callback URL for this specific workflow. + :type trigger_uri: str + """ + + _validation = { + 'logic_app_resource_id': {'required': True}, + } + + _attribute_map = { + 'logic_app_resource_id': {'key': 'logicAppResourceId', 'type': 'str'}, + 'trigger_uri': {'key': 'triggerUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActionRequestProperties, self).__init__(**kwargs) + self.trigger_uri = kwargs.get('trigger_uri', None) + + +class Resource(msrest.serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ActionResponse(Resource): + """Action for alert rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param etag: Etag of the action. + :type etag: str + :param logic_app_resource_id: Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + :param workflow_id: The name of the logic app's workflow. + :type workflow_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'logic_app_resource_id': {'key': 'properties.logicAppResourceId', 'type': 'str'}, + 'workflow_id': {'key': 'properties.workflowId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActionResponse, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.logic_app_resource_id = kwargs.get('logic_app_resource_id', None) + self.workflow_id = kwargs.get('workflow_id', None) + + +class ActionResponseProperties(ActionPropertiesBase): + """Action property bag. + + All required parameters must be populated in order to send to Azure. + + :param logic_app_resource_id: Required. Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + :param workflow_id: The name of the logic app's workflow. + :type workflow_id: str + """ + + _validation = { + 'logic_app_resource_id': {'required': True}, + } + + _attribute_map = { + 'logic_app_resource_id': {'key': 'logicAppResourceId', 'type': 'str'}, + 'workflow_id': {'key': 'workflowId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ActionResponseProperties, self).__init__(**kwargs) + self.workflow_id = kwargs.get('workflow_id', None) + + +class ActionsList(msrest.serialization.Model): + """List all the actions. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of actions. + :vartype next_link: str + :param value: Required. Array of actions. + :type value: list[~azure.mgmt.securityinsight.models.ActionResponse] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[ActionResponse]'}, + } + + def __init__( + self, + **kwargs + ): + super(ActionsList, self).__init__(**kwargs) + self.next_link = None + self.value = kwargs['value'] + + +class AlertRuleKind(msrest.serialization.Model): + """Describes an Azure resource with kind. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleKind, self).__init__(**kwargs) + self.kind = kwargs['kind'] + + +class AlertRule(AlertRuleKind): + """Alert rule. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRule, self).__init__(**kwargs) + + +class AlertRulesList(msrest.serialization.Model): + """List all the alert rules. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of alert rules. + :vartype next_link: str + :param value: Required. Array of alert rules. + :type value: list[~azure.mgmt.securityinsight.models.AlertRule] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[AlertRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRulesList, self).__init__(**kwargs) + self.next_link = None + self.value = kwargs['value'] + + +class AlertRuleTemplate(AlertRuleKind): + """Alert rule template. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleTemplate, self).__init__(**kwargs) + + +class AlertRuleTemplateDataSource(msrest.serialization.Model): + """alert rule template data sources. + + :param connector_id: The connector id that provides the following data types. + :type connector_id: str + :param data_types: The data types used by the alert rule template. + :type data_types: list[str] + """ + + _attribute_map = { + 'connector_id': {'key': 'connectorId', 'type': 'str'}, + 'data_types': {'key': 'dataTypes', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleTemplateDataSource, self).__init__(**kwargs) + self.connector_id = kwargs.get('connector_id', None) + self.data_types = kwargs.get('data_types', None) + + +class AlertRuleTemplatePropertiesBase(msrest.serialization.Model): + """Base alert rule template property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :type alert_rules_created_by_template_count: int + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :param description: The description of the alert rule template. + :type description: str + :param display_name: The display name for alert rule template. + :type display_name: str + :param required_data_connectors: The required data connectors for this template. + :type required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :param status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :type status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + """ + + _validation = { + 'created_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'alert_rules_created_by_template_count': {'key': 'alertRulesCreatedByTemplateCount', 'type': 'int'}, + 'created_date_utc': {'key': 'createdDateUTC', 'type': 'iso-8601'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'required_data_connectors': {'key': 'requiredDataConnectors', 'type': '[AlertRuleTemplateDataSource]'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleTemplatePropertiesBase, self).__init__(**kwargs) + self.alert_rules_created_by_template_count = kwargs.get('alert_rules_created_by_template_count', None) + self.created_date_utc = None + self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) + self.required_data_connectors = kwargs.get('required_data_connectors', None) + self.status = kwargs.get('status', None) + + +class AlertRuleTemplatesList(msrest.serialization.Model): + """List all the alert rule templates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of alert rule templates. + :vartype next_link: str + :param value: Required. Array of alert rule templates. + :type value: list[~azure.mgmt.securityinsight.models.AlertRuleTemplate] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[AlertRuleTemplate]'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertRuleTemplatesList, self).__init__(**kwargs) + self.next_link = None + self.value = kwargs['value'] + + +class AlertsDataTypeOfDataConnector(msrest.serialization.Model): + """Alerts data type for data connectors. + + :param alerts: Alerts data type connection. + :type alerts: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnectorAlerts + """ + + _attribute_map = { + 'alerts': {'key': 'alerts', 'type': 'AlertsDataTypeOfDataConnectorAlerts'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertsDataTypeOfDataConnector, self).__init__(**kwargs) + self.alerts = kwargs.get('alerts', None) + + +class DataConnectorDataTypeCommon(msrest.serialization.Model): + """Common field for data type in data connectors. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataConnectorDataTypeCommon, self).__init__(**kwargs) + self.state = kwargs.get('state', None) + + +class AlertsDataTypeOfDataConnectorAlerts(DataConnectorDataTypeCommon): + """Alerts data type connection. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertsDataTypeOfDataConnectorAlerts, self).__init__(**kwargs) + + +class AscDataConnector(DataConnector): + """Represents ASC (Azure Security Center) data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :param subscription_id: The subscription id to connect to, and get the data from. + :type subscription_id: str + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AscDataConnector, self).__init__(**kwargs) + self.data_types = kwargs.get('data_types', None) + self.subscription_id = kwargs.get('subscription_id', None) + + +class AscDataConnectorProperties(DataConnectorWithAlertsProperties): + """ASC (Azure Security Center) data connector properties. + + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :param subscription_id: The subscription id to connect to, and get the data from. + :type subscription_id: str + """ + + _attribute_map = { + 'data_types': {'key': 'dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AscDataConnectorProperties, self).__init__(**kwargs) + self.subscription_id = kwargs.get('subscription_id', None) + + +class AwsCloudTrailDataConnector(DataConnector): + """Represents Amazon Web Services CloudTrail data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param aws_role_arn: The Aws Role Arn (with CloudTrailReadOnly policy) that is used to access + the Aws account. + :type aws_role_arn: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AwsCloudTrailDataConnectorDataTypes + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'aws_role_arn': {'key': 'properties.awsRoleArn', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'AwsCloudTrailDataConnectorDataTypes'}, + } + + def __init__( + self, + **kwargs + ): + super(AwsCloudTrailDataConnector, self).__init__(**kwargs) + self.aws_role_arn = kwargs.get('aws_role_arn', None) + self.data_types = kwargs.get('data_types', None) + + +class AwsCloudTrailDataConnectorDataTypes(msrest.serialization.Model): + """The available data types for Amazon Web Services CloudTrail data connector. + + :param logs: Logs data type. + :type logs: ~azure.mgmt.securityinsight.models.AwsCloudTrailDataConnectorDataTypesLogs + """ + + _attribute_map = { + 'logs': {'key': 'logs', 'type': 'AwsCloudTrailDataConnectorDataTypesLogs'}, + } + + def __init__( + self, + **kwargs + ): + super(AwsCloudTrailDataConnectorDataTypes, self).__init__(**kwargs) + self.logs = kwargs.get('logs', None) + + +class AwsCloudTrailDataConnectorDataTypesLogs(DataConnectorDataTypeCommon): + """Logs data type. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AwsCloudTrailDataConnectorDataTypesLogs, self).__init__(**kwargs) + + +class Bookmark(ResourceWithEtag): + """Represents a bookmark in Azure Security Insights. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param etag: Etag of the azure resource. + :type etag: str + :param created: The time the bookmark was created. + :type created: ~datetime.datetime + :param created_by: Describes a user that created the bookmark. + :type created_by: ~azure.mgmt.securityinsight.models.UserInfo + :param display_name: The display name of the bookmark. + :type display_name: str + :param labels: List of labels relevant to this bookmark. + :type labels: list[str] + :param notes: The notes of the bookmark. + :type notes: str + :param query: The query of the bookmark. + :type query: str + :param query_result: The query result of the bookmark. + :type query_result: str + :param updated: The last time the bookmark was updated. + :type updated: ~datetime.datetime + :param updated_by: Describes a user that updated the bookmark. + :type updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :param incident_info: Describes an incident that relates to bookmark. + :type incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'created': {'key': 'properties.created', 'type': 'iso-8601'}, + 'created_by': {'key': 'properties.createdBy', 'type': 'UserInfo'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'labels': {'key': 'properties.labels', 'type': '[str]'}, + 'notes': {'key': 'properties.notes', 'type': 'str'}, + 'query': {'key': 'properties.query', 'type': 'str'}, + 'query_result': {'key': 'properties.queryResult', 'type': 'str'}, + 'updated': {'key': 'properties.updated', 'type': 'iso-8601'}, + 'updated_by': {'key': 'properties.updatedBy', 'type': 'UserInfo'}, + 'incident_info': {'key': 'properties.incidentInfo', 'type': 'IncidentInfo'}, + } + + def __init__( + self, + **kwargs + ): + super(Bookmark, self).__init__(**kwargs) + self.created = kwargs.get('created', None) + self.created_by = kwargs.get('created_by', None) + self.display_name = kwargs.get('display_name', None) + self.labels = kwargs.get('labels', None) + self.notes = kwargs.get('notes', None) + self.query = kwargs.get('query', None) + self.query_result = kwargs.get('query_result', None) + self.updated = kwargs.get('updated', None) + self.updated_by = kwargs.get('updated_by', None) + self.incident_info = kwargs.get('incident_info', None) + + +class BookmarkExpandParameters(msrest.serialization.Model): + """The parameters required to execute an expand operation on the given bookmark. + + :param end_time: The end date filter, so the only expansion results returned are before this + date. + :type end_time: ~datetime.datetime + :param expansion_id: The Id of the expansion to perform. + :type expansion_id: str + :param start_time: The start date filter, so the only expansion results returned are after this + date. + :type start_time: ~datetime.datetime + """ + + _attribute_map = { + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'expansion_id': {'key': 'expansionId', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(BookmarkExpandParameters, self).__init__(**kwargs) + self.end_time = kwargs.get('end_time', None) + self.expansion_id = kwargs.get('expansion_id', None) + self.start_time = kwargs.get('start_time', None) + + +class BookmarkList(msrest.serialization.Model): + """List all the bookmarks. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of cases. + :vartype next_link: str + :param value: Required. Array of bookmarks. + :type value: list[~azure.mgmt.securityinsight.models.Bookmark] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Bookmark]'}, + } + + def __init__( + self, + **kwargs + ): + super(BookmarkList, self).__init__(**kwargs) + self.next_link = None + self.value = kwargs['value'] + + +class ClientInfo(msrest.serialization.Model): + """Information on the client (user or application) that made some action. + + :param email: The email of the client. + :type email: str + :param name: The name of the client. + :type name: str + :param object_id: The object id of the client. + :type object_id: str + :param user_principal_name: The user principal name of the client. + :type user_principal_name: str + """ + + _attribute_map = { + 'email': {'key': 'email', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClientInfo, self).__init__(**kwargs) + self.email = kwargs.get('email', None) + self.name = kwargs.get('name', None) + self.object_id = kwargs.get('object_id', None) + self.user_principal_name = kwargs.get('user_principal_name', None) + + +class DataConnectorList(msrest.serialization.Model): + """List all the data connectors. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of data connectors. + :vartype next_link: str + :param value: Required. Array of data connectors. + :type value: list[~azure.mgmt.securityinsight.models.DataConnector] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[DataConnector]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataConnectorList, self).__init__(**kwargs) + self.next_link = None + self.value = kwargs['value'] + + +class DataConnectorTenantId(msrest.serialization.Model): + """Properties data connector on tenant level. + + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataConnectorTenantId, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + + +class EntityKind(msrest.serialization.Model): + """Describes an entity with kind. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the entity. Possible values include: "Account", "Host", + "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark". + :type kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EntityKind, self).__init__(**kwargs) + self.kind = kwargs['kind'] + + +class Entity(EntityKind): + """Specific entity. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the entity. Possible values include: "Account", "Host", + "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark". + :type kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Entity, self).__init__(**kwargs) + + +class EntityCommonProperties(msrest.serialization.Model): + """Entity common property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, object] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + """ + + _validation = { + 'additional_data': {'readonly': True}, + 'friendly_name': {'readonly': True}, + } + + _attribute_map = { + 'additional_data': {'key': 'additionalData', 'type': '{object}'}, + 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EntityCommonProperties, self).__init__(**kwargs) + self.additional_data = None + self.friendly_name = None + + +class FusionAlertRule(AlertRule): + """Represents Fusion alert rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param alert_rule_template_name: The Name of the alert rule template used to create this rule. + :type alert_rule_template_name: str + :ivar description: The description of the alert rule. + :vartype description: str + :ivar display_name: The display name for alerts created by this alert rule. + :vartype display_name: str + :param enabled: Determines whether this alert rule is enabled or disabled. + :type enabled: bool + :ivar last_modified_utc: The last time that this alert has been modified. + :vartype last_modified_utc: ~datetime.datetime + :ivar severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar tactics: The tactics of the alert rule. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'kind': {'required': True}, + 'description': {'readonly': True}, + 'display_name': {'readonly': True}, + 'last_modified_utc': {'readonly': True}, + 'severity': {'readonly': True}, + 'tactics': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'alert_rule_template_name': {'key': 'properties.alertRuleTemplateName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'last_modified_utc': {'key': 'properties.lastModifiedUtc', 'type': 'iso-8601'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'tactics': {'key': 'properties.tactics', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(FusionAlertRule, self).__init__(**kwargs) + self.alert_rule_template_name = kwargs.get('alert_rule_template_name', None) + self.description = None + self.display_name = None + self.enabled = kwargs.get('enabled', None) + self.last_modified_utc = None + self.severity = None + self.tactics = None + + +class FusionAlertRuleTemplate(AlertRuleTemplate): + """Represents Fusion alert rule template. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :type alert_rules_created_by_template_count: int + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :param description: The description of the alert rule template. + :type description: str + :param display_name: The display name for alert rule template. + :type display_name: str + :param required_data_connectors: The required data connectors for this template. + :type required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :param status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :type status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param tactics: The tactics of the alert rule template. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'kind': {'required': True}, + 'created_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'alert_rules_created_by_template_count': {'key': 'properties.alertRulesCreatedByTemplateCount', 'type': 'int'}, + 'created_date_utc': {'key': 'properties.createdDateUTC', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'required_data_connectors': {'key': 'properties.requiredDataConnectors', 'type': '[AlertRuleTemplateDataSource]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'tactics': {'key': 'properties.tactics', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(FusionAlertRuleTemplate, self).__init__(**kwargs) + self.alert_rules_created_by_template_count = kwargs.get('alert_rules_created_by_template_count', None) + self.created_date_utc = None + self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) + self.required_data_connectors = kwargs.get('required_data_connectors', None) + self.status = kwargs.get('status', None) + self.severity = kwargs.get('severity', None) + self.tactics = kwargs.get('tactics', None) + + +class FusionAlertRuleTemplateProperties(AlertRuleTemplatePropertiesBase): + """Fusion alert rule template properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :type alert_rules_created_by_template_count: int + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :param description: The description of the alert rule template. + :type description: str + :param display_name: The display name for alert rule template. + :type display_name: str + :param required_data_connectors: The required data connectors for this template. + :type required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :param status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :type status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :param severity: Required. The severity for alerts created by this alert rule. Possible values + include: "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param tactics: The tactics of the alert rule template. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'created_date_utc': {'readonly': True}, + 'severity': {'required': True}, + } + + _attribute_map = { + 'alert_rules_created_by_template_count': {'key': 'alertRulesCreatedByTemplateCount', 'type': 'int'}, + 'created_date_utc': {'key': 'createdDateUTC', 'type': 'iso-8601'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'required_data_connectors': {'key': 'requiredDataConnectors', 'type': '[AlertRuleTemplateDataSource]'}, + 'status': {'key': 'status', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'tactics': {'key': 'tactics', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(FusionAlertRuleTemplateProperties, self).__init__(**kwargs) + self.severity = kwargs['severity'] + self.tactics = kwargs.get('tactics', None) + + +class GeoLocation(msrest.serialization.Model): + """The geo-location context attached to the ip entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar asn: Autonomous System Number. + :vartype asn: int + :ivar city: City name. + :vartype city: str + :ivar country_code: The country code according to ISO 3166 format. + :vartype country_code: str + :ivar country_name: Country name according to ISO 3166 Alpha 2: the lowercase of the English + Short Name. + :vartype country_name: str + :ivar latitude: The longitude of the identified location, expressed as a floating point number + with range of -180 to 180, with positive numbers representing East and negative numbers + representing West. Latitude and longitude are derived from the city or postal code. + :vartype latitude: float + :ivar longitude: The latitude of the identified location, expressed as a floating point number + with range of - 90 to 90, with positive numbers representing North and negative numbers + representing South. Latitude and longitude are derived from the city or postal code. + :vartype longitude: float + :ivar state: State name. + :vartype state: str + """ + + _validation = { + 'asn': {'readonly': True}, + 'city': {'readonly': True}, + 'country_code': {'readonly': True}, + 'country_name': {'readonly': True}, + 'latitude': {'readonly': True}, + 'longitude': {'readonly': True}, + 'state': {'readonly': True}, + } + + _attribute_map = { + 'asn': {'key': 'asn', 'type': 'int'}, + 'city': {'key': 'city', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'country_name': {'key': 'countryName', 'type': 'str'}, + 'latitude': {'key': 'latitude', 'type': 'float'}, + 'longitude': {'key': 'longitude', 'type': 'float'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoLocation, self).__init__(**kwargs) + self.asn = None + self.city = None + self.country_code = None + self.country_name = None + self.latitude = None + self.longitude = None + self.state = None + + +class GroupingConfiguration(msrest.serialization.Model): + """Grouping configuration property bag. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. Grouping enabled. + :type enabled: bool + :param reopen_closed_incident: Required. Re-open closed matching incidents. + :type reopen_closed_incident: bool + :param lookback_duration: Required. Limit the group to alerts created within the lookback + duration (in ISO 8601 duration format). + :type lookback_duration: ~datetime.timedelta + :param entities_matching_method: Required. Grouping matching method. Possible values include: + "All", "None", "Custom". + :type entities_matching_method: str or + ~azure.mgmt.securityinsight.models.EntitiesMatchingMethod + :param group_by_entities: A list of entity types to group by (when entitiesMatchingMethod is + Custom). + :type group_by_entities: list[str or ~azure.mgmt.securityinsight.models.GroupingEntityType] + """ + + _validation = { + 'enabled': {'required': True}, + 'reopen_closed_incident': {'required': True}, + 'lookback_duration': {'required': True}, + 'entities_matching_method': {'required': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'reopen_closed_incident': {'key': 'reopenClosedIncident', 'type': 'bool'}, + 'lookback_duration': {'key': 'lookbackDuration', 'type': 'duration'}, + 'entities_matching_method': {'key': 'entitiesMatchingMethod', 'type': 'str'}, + 'group_by_entities': {'key': 'groupByEntities', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(GroupingConfiguration, self).__init__(**kwargs) + self.enabled = kwargs['enabled'] + self.reopen_closed_incident = kwargs['reopen_closed_incident'] + self.lookback_duration = kwargs['lookback_duration'] + self.entities_matching_method = kwargs['entities_matching_method'] + self.group_by_entities = kwargs.get('group_by_entities', None) + + +class Incident(ResourceWithEtag): + """Represents an incident in Azure Security Insights. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param etag: Etag of the azure resource. + :type etag: str + :ivar additional_data: Additional data on the incident. + :vartype additional_data: ~azure.mgmt.securityinsight.models.IncidentAdditionalData + :param classification: The reason the incident was closed. Possible values include: + "Undetermined", "TruePositive", "BenignPositive", "FalsePositive". + :type classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification + :ivar created_time_utc: The time the incident was created. + :vartype created_time_utc: ~datetime.datetime + :param description: The description of the incident. + :type description: str + :param first_activity_time_utc: The time of the first activity in the incident. + :type first_activity_time_utc: ~datetime.datetime + :ivar incident_number: A sequential number. + :vartype incident_number: int + :param labels: List of labels relevant to this incident. + :type labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + :param last_activity_time_utc: The time of the last activity in the incident. + :type last_activity_time_utc: ~datetime.datetime + :ivar last_modified_time_utc: The last time the incident was updated. + :vartype last_modified_time_utc: ~datetime.datetime + :param owner: Describes a user that the incident is assigned to. + :type owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo + :param severity: The severity of the incident. Possible values include: "High", "Medium", + "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :param status: The status of the incident. Possible values include: "New", "Active", "Closed". + :type status: str or ~azure.mgmt.securityinsight.models.IncidentStatus + :param title: The title of the incident. + :type title: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'additional_data': {'readonly': True}, + 'created_time_utc': {'readonly': True}, + 'incident_number': {'readonly': True}, + 'last_modified_time_utc': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'additional_data': {'key': 'properties.additionalData', 'type': 'IncidentAdditionalData'}, + 'classification': {'key': 'properties.classification', 'type': 'str'}, + 'created_time_utc': {'key': 'properties.createdTimeUtc', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'first_activity_time_utc': {'key': 'properties.firstActivityTimeUtc', 'type': 'iso-8601'}, + 'incident_number': {'key': 'properties.incidentNumber', 'type': 'int'}, + 'labels': {'key': 'properties.labels', 'type': '[IncidentLabel]'}, + 'last_activity_time_utc': {'key': 'properties.lastActivityTimeUtc', 'type': 'iso-8601'}, + 'last_modified_time_utc': {'key': 'properties.lastModifiedTimeUtc', 'type': 'iso-8601'}, + 'owner': {'key': 'properties.owner', 'type': 'IncidentOwnerInfo'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'title': {'key': 'properties.title', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Incident, self).__init__(**kwargs) + self.additional_data = None + self.classification = kwargs.get('classification', None) + self.created_time_utc = None + self.description = kwargs.get('description', None) + self.first_activity_time_utc = kwargs.get('first_activity_time_utc', None) + self.incident_number = None + self.labels = kwargs.get('labels', None) + self.last_activity_time_utc = kwargs.get('last_activity_time_utc', None) + self.last_modified_time_utc = None + self.owner = kwargs.get('owner', None) + self.severity = kwargs.get('severity', None) + self.status = kwargs.get('status', None) + self.title = kwargs.get('title', None) + + +class IncidentAdditionalData(msrest.serialization.Model): + """Incident additional data property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar alerts_count: The number of alerts in the incident. + :vartype alerts_count: int + :ivar bookmarks_count: The number of bookmarks in the incident. + :vartype bookmarks_count: int + :ivar comments_count: The number of comments in the incident. + :vartype comments_count: int + :ivar alert_product_names: List of product names of alerts in the incident. + :vartype alert_product_names: list[str] + :ivar tactics: The tactics associated with incident. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'alerts_count': {'readonly': True}, + 'bookmarks_count': {'readonly': True}, + 'comments_count': {'readonly': True}, + 'alert_product_names': {'readonly': True}, + 'tactics': {'readonly': True}, + } + + _attribute_map = { + 'alerts_count': {'key': 'alertsCount', 'type': 'int'}, + 'bookmarks_count': {'key': 'bookmarksCount', 'type': 'int'}, + 'comments_count': {'key': 'commentsCount', 'type': 'int'}, + 'alert_product_names': {'key': 'alertProductNames', 'type': '[str]'}, + 'tactics': {'key': 'tactics', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(IncidentAdditionalData, self).__init__(**kwargs) + self.alerts_count = None + self.bookmarks_count = None + self.comments_count = None + self.alert_product_names = None + self.tactics = None + + +class IncidentComment(Resource): + """Represents an incident comment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar created_time_utc: The time the comment was created. + :vartype created_time_utc: ~datetime.datetime + :param message: The comment message. + :type message: str + :ivar author: Describes the client that created the comment. + :vartype author: ~azure.mgmt.securityinsight.models.ClientInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_time_utc': {'readonly': True}, + 'author': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'created_time_utc': {'key': 'properties.createdTimeUtc', 'type': 'iso-8601'}, + 'message': {'key': 'properties.message', 'type': 'str'}, + 'author': {'key': 'properties.author', 'type': 'ClientInfo'}, + } + + def __init__( + self, + **kwargs + ): + super(IncidentComment, self).__init__(**kwargs) + self.created_time_utc = None + self.message = kwargs.get('message', None) + self.author = None + + +class IncidentCommentList(msrest.serialization.Model): + """List of incident comments. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of comments. + :vartype next_link: str + :param value: Required. Array of comments. + :type value: list[~azure.mgmt.securityinsight.models.IncidentComment] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[IncidentComment]'}, + } + + def __init__( + self, + **kwargs + ): + super(IncidentCommentList, self).__init__(**kwargs) + self.next_link = None + self.value = kwargs['value'] + + +class IncidentInfo(msrest.serialization.Model): + """Describes related incident information for the bookmark. + + All required parameters must be populated in order to send to Azure. + + :param incident_id: Required. Incident Id. + :type incident_id: str + :param severity: Required. The severity of the incident. Possible values include: "Critical", + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.CaseSeverity + :param title: Required. The title of the incident. + :type title: str + :param relation_name: Required. Relation Name. + :type relation_name: str + """ + + _validation = { + 'incident_id': {'required': True}, + 'severity': {'required': True}, + 'title': {'required': True}, + 'relation_name': {'required': True}, + } + + _attribute_map = { + 'incident_id': {'key': 'incidentId', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'relation_name': {'key': 'relationName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IncidentInfo, self).__init__(**kwargs) + self.incident_id = kwargs['incident_id'] + self.severity = kwargs['severity'] + self.title = kwargs['title'] + self.relation_name = kwargs['relation_name'] + + +class IncidentLabel(msrest.serialization.Model): + """Represents an incident label. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param label_name: Required. The name of the label. + :type label_name: str + :ivar label_type: The type of the label. Possible values include: "User", "System". + :vartype label_type: str or ~azure.mgmt.securityinsight.models.IncidentLabelType + """ + + _validation = { + 'label_name': {'required': True}, + 'label_type': {'readonly': True}, + } + + _attribute_map = { + 'label_name': {'key': 'labelName', 'type': 'str'}, + 'label_type': {'key': 'labelType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IncidentLabel, self).__init__(**kwargs) + self.label_name = kwargs['label_name'] + self.label_type = None + + +class IncidentList(msrest.serialization.Model): + """List all the incidents. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of incidents. + :vartype next_link: str + :param value: Required. Array of incidents. + :type value: list[~azure.mgmt.securityinsight.models.Incident] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Incident]'}, + } + + def __init__( + self, + **kwargs + ): + super(IncidentList, self).__init__(**kwargs) + self.next_link = None + self.value = kwargs['value'] + + +class IncidentOwnerInfo(msrest.serialization.Model): + """Information on the user an incident is assigned to. + + :param email: The email of the user the incident is assigned to. + :type email: str + :param assigned_to: The name of the user the incident is assigned to. + :type assigned_to: str + :param object_id: The object id of the user the incident is assigned to. + :type object_id: str + :param user_principal_name: The user principal name of the user the incident is assigned to. + :type user_principal_name: str + """ + + _attribute_map = { + 'email': {'key': 'email', 'type': 'str'}, + 'assigned_to': {'key': 'assignedTo', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IncidentOwnerInfo, self).__init__(**kwargs) + self.email = kwargs.get('email', None) + self.assigned_to = kwargs.get('assigned_to', None) + self.object_id = kwargs.get('object_id', None) + self.user_principal_name = kwargs.get('user_principal_name', None) + + +class IpEntity(Entity): + """Represents an ip entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the entity. Possible values include: "Account", "Host", + "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark". + :type kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, object] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar address: The IP address as string, e.g. 127.0.0.1 (either in Ipv4 or Ipv6). + :vartype address: str + :ivar location: The geo-location context attached to the ip entity. + :vartype location: ~azure.mgmt.securityinsight.models.GeoLocation + :ivar threat_intelligence: A list of TI contexts attached to the ip entity. + :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] + """ + + _validation = { + 'kind': {'required': True}, + 'additional_data': {'readonly': True}, + 'friendly_name': {'readonly': True}, + 'address': {'readonly': True}, + 'location': {'readonly': True}, + 'threat_intelligence': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'additional_data': {'key': 'properties.additionalData', 'type': '{object}'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'address': {'key': 'properties.address', 'type': 'str'}, + 'location': {'key': 'properties.location', 'type': 'GeoLocation'}, + 'threat_intelligence': {'key': 'properties.threatIntelligence', 'type': '[ThreatIntelligence]'}, + } + + def __init__( + self, + **kwargs + ): + super(IpEntity, self).__init__(**kwargs) + self.additional_data = None + self.friendly_name = None + self.address = None + self.location = None + self.threat_intelligence = None + + +class IpEntityProperties(EntityCommonProperties): + """Ip entity property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, object] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar address: The IP address as string, e.g. 127.0.0.1 (either in Ipv4 or Ipv6). + :vartype address: str + :ivar location: The geo-location context attached to the ip entity. + :vartype location: ~azure.mgmt.securityinsight.models.GeoLocation + :ivar threat_intelligence: A list of TI contexts attached to the ip entity. + :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] + """ + + _validation = { + 'additional_data': {'readonly': True}, + 'friendly_name': {'readonly': True}, + 'address': {'readonly': True}, + 'location': {'readonly': True}, + 'threat_intelligence': {'readonly': True}, + } + + _attribute_map = { + 'additional_data': {'key': 'additionalData', 'type': '{object}'}, + 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, + 'address': {'key': 'address', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'GeoLocation'}, + 'threat_intelligence': {'key': 'threatIntelligence', 'type': '[ThreatIntelligence]'}, + } + + def __init__( + self, + **kwargs + ): + super(IpEntityProperties, self).__init__(**kwargs) + self.address = None + self.location = None + self.threat_intelligence = None + + +class McasDataConnector(DataConnector): + """Represents MCAS (Microsoft Cloud App Security) data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.McasDataConnectorDataTypes + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'McasDataConnectorDataTypes'}, + } + + def __init__( + self, + **kwargs + ): + super(McasDataConnector, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.data_types = kwargs.get('data_types', None) + + +class McasDataConnectorDataTypes(AlertsDataTypeOfDataConnector): + """The available data types for MCAS (Microsoft Cloud App Security) data connector. + + :param alerts: Alerts data type connection. + :type alerts: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnectorAlerts + :param discovery_logs: Discovery log data type connection. + :type discovery_logs: + ~azure.mgmt.securityinsight.models.McasDataConnectorDataTypesDiscoveryLogs + """ + + _attribute_map = { + 'alerts': {'key': 'alerts', 'type': 'AlertsDataTypeOfDataConnectorAlerts'}, + 'discovery_logs': {'key': 'discoveryLogs', 'type': 'McasDataConnectorDataTypesDiscoveryLogs'}, + } + + def __init__( + self, + **kwargs + ): + super(McasDataConnectorDataTypes, self).__init__(**kwargs) + self.discovery_logs = kwargs.get('discovery_logs', None) + + +class McasDataConnectorDataTypesDiscoveryLogs(DataConnectorDataTypeCommon): + """Discovery log data type connection. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(McasDataConnectorDataTypesDiscoveryLogs, self).__init__(**kwargs) + + +class McasDataConnectorProperties(DataConnectorTenantId): + """MCAS (Microsoft Cloud App Security) data connector properties. + + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.McasDataConnectorDataTypes + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'data_types': {'key': 'dataTypes', 'type': 'McasDataConnectorDataTypes'}, + } + + def __init__( + self, + **kwargs + ): + super(McasDataConnectorProperties, self).__init__(**kwargs) + self.data_types = kwargs.get('data_types', None) + + +class MdatpDataConnector(DataConnector): + """Represents MDATP (Microsoft Defender Advanced Threat Protection) data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + **kwargs + ): + super(MdatpDataConnector, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.data_types = kwargs.get('data_types', None) + + +class MdatpDataConnectorProperties(DataConnectorWithAlertsProperties): + """MDATP (Microsoft Defender Advanced Threat Protection) data connector properties. + + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'data_types': {'key': 'dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + **kwargs + ): + super(MdatpDataConnectorProperties, self).__init__(**kwargs) + + +class MicrosoftSecurityIncidentCreationAlertRule(AlertRule): + """Represents MicrosoftSecurityIncidentCreation rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param display_names_filter: the alerts' displayNames on which the cases will be generated. + :type display_names_filter: list[str] + :param display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :type display_names_exclude_filter: list[str] + :param product_filter: The alerts' productName on which the cases will be generated. Possible + values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT". + :type product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :param severities_filter: the alerts' severities on which the cases will be generated. + :type severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :param alert_rule_template_name: The Name of the alert rule template used to create this rule. + :type alert_rule_template_name: str + :param description: The description of the alert rule. + :type description: str + :param display_name: The display name for alerts created by this alert rule. + :type display_name: str + :param enabled: Determines whether this alert rule is enabled or disabled. + :type enabled: bool + :ivar last_modified_utc: The last time that this alert has been modified. + :vartype last_modified_utc: ~datetime.datetime + """ + + _validation = { + 'kind': {'required': True}, + 'last_modified_utc': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_names_filter': {'key': 'properties.displayNamesFilter', 'type': '[str]'}, + 'display_names_exclude_filter': {'key': 'properties.displayNamesExcludeFilter', 'type': '[str]'}, + 'product_filter': {'key': 'properties.productFilter', 'type': 'str'}, + 'severities_filter': {'key': 'properties.severitiesFilter', 'type': '[str]'}, + 'alert_rule_template_name': {'key': 'properties.alertRuleTemplateName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'last_modified_utc': {'key': 'properties.lastModifiedUtc', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(MicrosoftSecurityIncidentCreationAlertRule, self).__init__(**kwargs) + self.display_names_filter = kwargs.get('display_names_filter', None) + self.display_names_exclude_filter = kwargs.get('display_names_exclude_filter', None) + self.product_filter = kwargs.get('product_filter', None) + self.severities_filter = kwargs.get('severities_filter', None) + self.alert_rule_template_name = kwargs.get('alert_rule_template_name', None) + self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) + self.enabled = kwargs.get('enabled', None) + self.last_modified_utc = None + + +class MicrosoftSecurityIncidentCreationAlertRuleCommonProperties(msrest.serialization.Model): + """MicrosoftSecurityIncidentCreation rule common property bag. + + All required parameters must be populated in order to send to Azure. + + :param display_names_filter: the alerts' displayNames on which the cases will be generated. + :type display_names_filter: list[str] + :param display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :type display_names_exclude_filter: list[str] + :param product_filter: Required. The alerts' productName on which the cases will be generated. + Possible values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure + Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security + Center for IoT". + :type product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :param severities_filter: the alerts' severities on which the cases will be generated. + :type severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + + _validation = { + 'product_filter': {'required': True}, + } + + _attribute_map = { + 'display_names_filter': {'key': 'displayNamesFilter', 'type': '[str]'}, + 'display_names_exclude_filter': {'key': 'displayNamesExcludeFilter', 'type': '[str]'}, + 'product_filter': {'key': 'productFilter', 'type': 'str'}, + 'severities_filter': {'key': 'severitiesFilter', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(MicrosoftSecurityIncidentCreationAlertRuleCommonProperties, self).__init__(**kwargs) + self.display_names_filter = kwargs.get('display_names_filter', None) + self.display_names_exclude_filter = kwargs.get('display_names_exclude_filter', None) + self.product_filter = kwargs['product_filter'] + self.severities_filter = kwargs.get('severities_filter', None) + + +class MicrosoftSecurityIncidentCreationAlertRuleProperties(MicrosoftSecurityIncidentCreationAlertRuleCommonProperties): + """MicrosoftSecurityIncidentCreation rule property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param display_names_filter: the alerts' displayNames on which the cases will be generated. + :type display_names_filter: list[str] + :param display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :type display_names_exclude_filter: list[str] + :param product_filter: Required. The alerts' productName on which the cases will be generated. + Possible values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure + Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security + Center for IoT". + :type product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :param severities_filter: the alerts' severities on which the cases will be generated. + :type severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :param alert_rule_template_name: The Name of the alert rule template used to create this rule. + :type alert_rule_template_name: str + :param description: The description of the alert rule. + :type description: str + :param display_name: Required. The display name for alerts created by this alert rule. + :type display_name: str + :param enabled: Required. Determines whether this alert rule is enabled or disabled. + :type enabled: bool + :ivar last_modified_utc: The last time that this alert has been modified. + :vartype last_modified_utc: ~datetime.datetime + """ + + _validation = { + 'product_filter': {'required': True}, + 'display_name': {'required': True}, + 'enabled': {'required': True}, + 'last_modified_utc': {'readonly': True}, + } + + _attribute_map = { + 'display_names_filter': {'key': 'displayNamesFilter', 'type': '[str]'}, + 'display_names_exclude_filter': {'key': 'displayNamesExcludeFilter', 'type': '[str]'}, + 'product_filter': {'key': 'productFilter', 'type': 'str'}, + 'severities_filter': {'key': 'severitiesFilter', 'type': '[str]'}, + 'alert_rule_template_name': {'key': 'alertRuleTemplateName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'last_modified_utc': {'key': 'lastModifiedUtc', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(MicrosoftSecurityIncidentCreationAlertRuleProperties, self).__init__(**kwargs) + self.alert_rule_template_name = kwargs.get('alert_rule_template_name', None) + self.description = kwargs.get('description', None) + self.display_name = kwargs['display_name'] + self.enabled = kwargs['enabled'] + self.last_modified_utc = None + + +class MicrosoftSecurityIncidentCreationAlertRuleTemplate(AlertRuleTemplate): + """Represents MicrosoftSecurityIncidentCreation rule template. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :type alert_rules_created_by_template_count: int + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :param description: The description of the alert rule template. + :type description: str + :param display_name: The display name for alert rule template. + :type display_name: str + :param required_data_connectors: The required data connectors for this template. + :type required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :param status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :type status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :param display_names_filter: the alerts' displayNames on which the cases will be generated. + :type display_names_filter: list[str] + :param display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :type display_names_exclude_filter: list[str] + :param product_filter: The alerts' productName on which the cases will be generated. Possible + values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT". + :type product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :param severities_filter: the alerts' severities on which the cases will be generated. + :type severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + + _validation = { + 'kind': {'required': True}, + 'created_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'alert_rules_created_by_template_count': {'key': 'properties.alertRulesCreatedByTemplateCount', 'type': 'int'}, + 'created_date_utc': {'key': 'properties.createdDateUTC', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'required_data_connectors': {'key': 'properties.requiredDataConnectors', 'type': '[AlertRuleTemplateDataSource]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'display_names_filter': {'key': 'properties.displayNamesFilter', 'type': '[str]'}, + 'display_names_exclude_filter': {'key': 'properties.displayNamesExcludeFilter', 'type': '[str]'}, + 'product_filter': {'key': 'properties.productFilter', 'type': 'str'}, + 'severities_filter': {'key': 'properties.severitiesFilter', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(MicrosoftSecurityIncidentCreationAlertRuleTemplate, self).__init__(**kwargs) + self.alert_rules_created_by_template_count = kwargs.get('alert_rules_created_by_template_count', None) + self.created_date_utc = None + self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) + self.required_data_connectors = kwargs.get('required_data_connectors', None) + self.status = kwargs.get('status', None) + self.display_names_filter = kwargs.get('display_names_filter', None) + self.display_names_exclude_filter = kwargs.get('display_names_exclude_filter', None) + self.product_filter = kwargs.get('product_filter', None) + self.severities_filter = kwargs.get('severities_filter', None) + + +class MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(MicrosoftSecurityIncidentCreationAlertRuleCommonProperties): + """MicrosoftSecurityIncidentCreation rule template properties. + + All required parameters must be populated in order to send to Azure. + + :param display_names_filter: the alerts' displayNames on which the cases will be generated. + :type display_names_filter: list[str] + :param display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :type display_names_exclude_filter: list[str] + :param product_filter: Required. The alerts' productName on which the cases will be generated. + Possible values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure + Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security + Center for IoT". + :type product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :param severities_filter: the alerts' severities on which the cases will be generated. + :type severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + + _validation = { + 'product_filter': {'required': True}, + } + + _attribute_map = { + 'display_names_filter': {'key': 'displayNamesFilter', 'type': '[str]'}, + 'display_names_exclude_filter': {'key': 'displayNamesExcludeFilter', 'type': '[str]'}, + 'product_filter': {'key': 'productFilter', 'type': 'str'}, + 'severities_filter': {'key': 'severitiesFilter', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties, self).__init__(**kwargs) + + +class OfficeConsent(Resource): + """Consent for Office365 tenant that already made. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param tenant_id: The tenantId of the Office365 with the consent. + :type tenant_id: str + :ivar tenant_name: The tenant name of the Office365 with the consent. + :vartype tenant_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tenant_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OfficeConsent, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.tenant_name = None + + +class OfficeConsentList(msrest.serialization.Model): + """List of all the office365 consents. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of office consents. + :vartype next_link: str + :param value: Required. Array of the consents. + :type value: list[~azure.mgmt.securityinsight.models.OfficeConsent] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[OfficeConsent]'}, + } + + def __init__( + self, + **kwargs + ): + super(OfficeConsentList, self).__init__(**kwargs) + self.next_link = None + self.value = kwargs['value'] + + +class OfficeDataConnector(DataConnector): + """Represents office data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'OfficeDataConnectorDataTypes'}, + } + + def __init__( + self, + **kwargs + ): + super(OfficeDataConnector, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.data_types = kwargs.get('data_types', None) + + +class OfficeDataConnectorDataTypes(msrest.serialization.Model): + """The available data types for office data connector. + + :param exchange: Exchange data type connection. + :type exchange: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesExchange + :param share_point: SharePoint data type connection. + :type share_point: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesSharePoint + """ + + _attribute_map = { + 'exchange': {'key': 'exchange', 'type': 'OfficeDataConnectorDataTypesExchange'}, + 'share_point': {'key': 'sharePoint', 'type': 'OfficeDataConnectorDataTypesSharePoint'}, + } + + def __init__( + self, + **kwargs + ): + super(OfficeDataConnectorDataTypes, self).__init__(**kwargs) + self.exchange = kwargs.get('exchange', None) + self.share_point = kwargs.get('share_point', None) + + +class OfficeDataConnectorDataTypesExchange(DataConnectorDataTypeCommon): + """Exchange data type connection. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OfficeDataConnectorDataTypesExchange, self).__init__(**kwargs) + + +class OfficeDataConnectorDataTypesSharePoint(DataConnectorDataTypeCommon): + """SharePoint data type connection. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OfficeDataConnectorDataTypesSharePoint, self).__init__(**kwargs) + + +class OfficeDataConnectorProperties(DataConnectorTenantId): + """Office data connector properties. + + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'data_types': {'key': 'dataTypes', 'type': 'OfficeDataConnectorDataTypes'}, + } + + def __init__( + self, + **kwargs + ): + super(OfficeDataConnectorProperties, self).__init__(**kwargs) + self.data_types = kwargs.get('data_types', None) + + +class Operation(msrest.serialization.Model): + """Operation provided by provider. + + :param display: Properties of the operation. + :type display: ~azure.mgmt.securityinsight.models.OperationDisplay + :param name: Name of the operation. + :type name: str + """ + + _attribute_map = { + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.display = kwargs.get('display', None) + self.name = kwargs.get('name', None) + + +class OperationDisplay(msrest.serialization.Model): + """Properties of the operation. + + :param description: Description of the operation. + :type description: str + :param operation: Operation name. + :type operation: str + :param provider: Provider name. + :type provider: str + :param resource: Resource name. + :type resource: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.operation = kwargs.get('operation', None) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + + +class OperationsList(msrest.serialization.Model): + """Lists the operations available in the SecurityInsights RP. + + All required parameters must be populated in order to send to Azure. + + :param next_link: URL to fetch the next set of operations. + :type next_link: str + :param value: Required. Array of operations. + :type value: list[~azure.mgmt.securityinsight.models.Operation] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationsList, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs['value'] + + +class ScheduledAlertRule(AlertRule): + """Represents scheduled alert rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param query: The query that creates alerts for this rule. + :type query: str + :param query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :type query_frequency: ~datetime.timedelta + :param query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :type query_period: ~datetime.timedelta + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param trigger_operator: The operation against the threshold that triggers alert rule. Possible + values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :type trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :param trigger_threshold: The threshold triggers this alert rule. + :type trigger_threshold: int + :param alert_rule_template_name: The Name of the alert rule template used to create this rule. + :type alert_rule_template_name: str + :param description: The description of the alert rule. + :type description: str + :param display_name: The display name for alerts created by this alert rule. + :type display_name: str + :param enabled: Determines whether this alert rule is enabled or disabled. + :type enabled: bool + :ivar last_modified_utc: The last time that this alert rule has been modified. + :vartype last_modified_utc: ~datetime.datetime + :param suppression_duration: The suppression (in ISO 8601 duration format) to wait since last + time this alert rule been triggered. + :type suppression_duration: ~datetime.timedelta + :param suppression_enabled: Determines whether the suppression for this alert rule is enabled + or disabled. + :type suppression_enabled: bool + :param tactics: The tactics of the alert rule. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'kind': {'required': True}, + 'last_modified_utc': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'query': {'key': 'properties.query', 'type': 'str'}, + 'query_frequency': {'key': 'properties.queryFrequency', 'type': 'duration'}, + 'query_period': {'key': 'properties.queryPeriod', 'type': 'duration'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'trigger_operator': {'key': 'properties.triggerOperator', 'type': 'str'}, + 'trigger_threshold': {'key': 'properties.triggerThreshold', 'type': 'int'}, + 'alert_rule_template_name': {'key': 'properties.alertRuleTemplateName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'last_modified_utc': {'key': 'properties.lastModifiedUtc', 'type': 'iso-8601'}, + 'suppression_duration': {'key': 'properties.suppressionDuration', 'type': 'duration'}, + 'suppression_enabled': {'key': 'properties.suppressionEnabled', 'type': 'bool'}, + 'tactics': {'key': 'properties.tactics', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScheduledAlertRule, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + self.query_frequency = kwargs.get('query_frequency', None) + self.query_period = kwargs.get('query_period', None) + self.severity = kwargs.get('severity', None) + self.trigger_operator = kwargs.get('trigger_operator', None) + self.trigger_threshold = kwargs.get('trigger_threshold', None) + self.alert_rule_template_name = kwargs.get('alert_rule_template_name', None) + self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) + self.enabled = kwargs.get('enabled', None) + self.last_modified_utc = None + self.suppression_duration = kwargs.get('suppression_duration', None) + self.suppression_enabled = kwargs.get('suppression_enabled', None) + self.tactics = kwargs.get('tactics', None) + + +class ScheduledAlertRuleCommonProperties(msrest.serialization.Model): + """Schedule alert rule template property bag. + + :param query: The query that creates alerts for this rule. + :type query: str + :param query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :type query_frequency: ~datetime.timedelta + :param query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :type query_period: ~datetime.timedelta + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param trigger_operator: The operation against the threshold that triggers alert rule. Possible + values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :type trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :param trigger_threshold: The threshold triggers this alert rule. + :type trigger_threshold: int + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'query_frequency': {'key': 'queryFrequency', 'type': 'duration'}, + 'query_period': {'key': 'queryPeriod', 'type': 'duration'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'trigger_operator': {'key': 'triggerOperator', 'type': 'str'}, + 'trigger_threshold': {'key': 'triggerThreshold', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(ScheduledAlertRuleCommonProperties, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + self.query_frequency = kwargs.get('query_frequency', None) + self.query_period = kwargs.get('query_period', None) + self.severity = kwargs.get('severity', None) + self.trigger_operator = kwargs.get('trigger_operator', None) + self.trigger_threshold = kwargs.get('trigger_threshold', None) + + +class ScheduledAlertRuleProperties(ScheduledAlertRuleCommonProperties): + """Scheduled alert rule base property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param query: The query that creates alerts for this rule. + :type query: str + :param query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :type query_frequency: ~datetime.timedelta + :param query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :type query_period: ~datetime.timedelta + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param trigger_operator: The operation against the threshold that triggers alert rule. Possible + values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :type trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :param trigger_threshold: The threshold triggers this alert rule. + :type trigger_threshold: int + :param alert_rule_template_name: The Name of the alert rule template used to create this rule. + :type alert_rule_template_name: str + :param description: The description of the alert rule. + :type description: str + :param display_name: Required. The display name for alerts created by this alert rule. + :type display_name: str + :param enabled: Required. Determines whether this alert rule is enabled or disabled. + :type enabled: bool + :ivar last_modified_utc: The last time that this alert rule has been modified. + :vartype last_modified_utc: ~datetime.datetime + :param suppression_duration: Required. The suppression (in ISO 8601 duration format) to wait + since last time this alert rule been triggered. + :type suppression_duration: ~datetime.timedelta + :param suppression_enabled: Required. Determines whether the suppression for this alert rule is + enabled or disabled. + :type suppression_enabled: bool + :param tactics: The tactics of the alert rule. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'display_name': {'required': True}, + 'enabled': {'required': True}, + 'last_modified_utc': {'readonly': True}, + 'suppression_duration': {'required': True}, + 'suppression_enabled': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'query_frequency': {'key': 'queryFrequency', 'type': 'duration'}, + 'query_period': {'key': 'queryPeriod', 'type': 'duration'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'trigger_operator': {'key': 'triggerOperator', 'type': 'str'}, + 'trigger_threshold': {'key': 'triggerThreshold', 'type': 'int'}, + 'alert_rule_template_name': {'key': 'alertRuleTemplateName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'last_modified_utc': {'key': 'lastModifiedUtc', 'type': 'iso-8601'}, + 'suppression_duration': {'key': 'suppressionDuration', 'type': 'duration'}, + 'suppression_enabled': {'key': 'suppressionEnabled', 'type': 'bool'}, + 'tactics': {'key': 'tactics', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScheduledAlertRuleProperties, self).__init__(**kwargs) + self.alert_rule_template_name = kwargs.get('alert_rule_template_name', None) + self.description = kwargs.get('description', None) + self.display_name = kwargs['display_name'] + self.enabled = kwargs['enabled'] + self.last_modified_utc = None + self.suppression_duration = kwargs['suppression_duration'] + self.suppression_enabled = kwargs['suppression_enabled'] + self.tactics = kwargs.get('tactics', None) + + +class ScheduledAlertRuleTemplate(AlertRuleTemplate): + """Represents scheduled alert rule template. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :type alert_rules_created_by_template_count: int + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :param description: The description of the alert rule template. + :type description: str + :param display_name: The display name for alert rule template. + :type display_name: str + :param required_data_connectors: The required data connectors for this template. + :type required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :param status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :type status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :param query: The query that creates alerts for this rule. + :type query: str + :param query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :type query_frequency: ~datetime.timedelta + :param query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :type query_period: ~datetime.timedelta + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param trigger_operator: The operation against the threshold that triggers alert rule. Possible + values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :type trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :param trigger_threshold: The threshold triggers this alert rule. + :type trigger_threshold: int + :param tactics: The tactics of the alert rule template. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'kind': {'required': True}, + 'created_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'alert_rules_created_by_template_count': {'key': 'properties.alertRulesCreatedByTemplateCount', 'type': 'int'}, + 'created_date_utc': {'key': 'properties.createdDateUTC', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'required_data_connectors': {'key': 'properties.requiredDataConnectors', 'type': '[AlertRuleTemplateDataSource]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'query': {'key': 'properties.query', 'type': 'str'}, + 'query_frequency': {'key': 'properties.queryFrequency', 'type': 'duration'}, + 'query_period': {'key': 'properties.queryPeriod', 'type': 'duration'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'trigger_operator': {'key': 'properties.triggerOperator', 'type': 'str'}, + 'trigger_threshold': {'key': 'properties.triggerThreshold', 'type': 'int'}, + 'tactics': {'key': 'properties.tactics', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScheduledAlertRuleTemplate, self).__init__(**kwargs) + self.alert_rules_created_by_template_count = kwargs.get('alert_rules_created_by_template_count', None) + self.created_date_utc = None + self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) + self.required_data_connectors = kwargs.get('required_data_connectors', None) + self.status = kwargs.get('status', None) + self.query = kwargs.get('query', None) + self.query_frequency = kwargs.get('query_frequency', None) + self.query_period = kwargs.get('query_period', None) + self.severity = kwargs.get('severity', None) + self.trigger_operator = kwargs.get('trigger_operator', None) + self.trigger_threshold = kwargs.get('trigger_threshold', None) + self.tactics = kwargs.get('tactics', None) + + +class ScheduledAlertRuleTemplateProperties(ScheduledAlertRuleCommonProperties): + """Scheduled alert rule template properties. + + :param query: The query that creates alerts for this rule. + :type query: str + :param query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :type query_frequency: ~datetime.timedelta + :param query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :type query_period: ~datetime.timedelta + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param trigger_operator: The operation against the threshold that triggers alert rule. Possible + values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :type trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :param trigger_threshold: The threshold triggers this alert rule. + :type trigger_threshold: int + :param tactics: The tactics of the alert rule template. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'query_frequency': {'key': 'queryFrequency', 'type': 'duration'}, + 'query_period': {'key': 'queryPeriod', 'type': 'duration'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'trigger_operator': {'key': 'triggerOperator', 'type': 'str'}, + 'trigger_threshold': {'key': 'triggerThreshold', 'type': 'int'}, + 'tactics': {'key': 'tactics', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScheduledAlertRuleTemplateProperties, self).__init__(**kwargs) + self.tactics = kwargs.get('tactics', None) + + +class SettingsKind(msrest.serialization.Model): + """Describes an Azure resource with kind. + + :param kind: The kind of the setting. Possible values include: "UebaSettings", + "ToggleSettings". + :type kind: str or ~azure.mgmt.securityinsight.models.SettingKind + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SettingsKind, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) + + +class Settings(SettingsKind): + """The Setting. + + :param kind: The kind of the setting. Possible values include: "UebaSettings", + "ToggleSettings". + :type kind: str or ~azure.mgmt.securityinsight.models.SettingKind + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Settings, self).__init__(**kwargs) + + +class ThreatIntelligence(msrest.serialization.Model): + """ThreatIntelligence property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar confidence: Confidence (must be between 0 and 1). + :vartype confidence: float + :ivar provider_name: Name of the provider from whom this Threat Intelligence information was + received. + :vartype provider_name: str + :ivar report_link: Report link. + :vartype report_link: str + :ivar threat_description: Threat description (free text). + :vartype threat_description: str + :ivar threat_name: Threat name (e.g. "Jedobot malware"). + :vartype threat_name: str + :ivar threat_type: Threat type (e.g. "Botnet"). + :vartype threat_type: str + """ + + _validation = { + 'confidence': {'readonly': True}, + 'provider_name': {'readonly': True}, + 'report_link': {'readonly': True}, + 'threat_description': {'readonly': True}, + 'threat_name': {'readonly': True}, + 'threat_type': {'readonly': True}, + } + + _attribute_map = { + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'provider_name': {'key': 'providerName', 'type': 'str'}, + 'report_link': {'key': 'reportLink', 'type': 'str'}, + 'threat_description': {'key': 'threatDescription', 'type': 'str'}, + 'threat_name': {'key': 'threatName', 'type': 'str'}, + 'threat_type': {'key': 'threatType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ThreatIntelligence, self).__init__(**kwargs) + self.confidence = None + self.provider_name = None + self.report_link = None + self.threat_description = None + self.threat_name = None + self.threat_type = None + + +class TiDataConnector(DataConnector): + """Represents threat intelligence data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.TiDataConnectorDataTypes + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'TiDataConnectorDataTypes'}, + } + + def __init__( + self, + **kwargs + ): + super(TiDataConnector, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.data_types = kwargs.get('data_types', None) + + +class TiDataConnectorDataTypes(msrest.serialization.Model): + """The available data types for TI (Threat Intelligence) data connector. + + :param indicators: Data type for indicators connection. + :type indicators: ~azure.mgmt.securityinsight.models.TiDataConnectorDataTypesIndicators + """ + + _attribute_map = { + 'indicators': {'key': 'indicators', 'type': 'TiDataConnectorDataTypesIndicators'}, + } + + def __init__( + self, + **kwargs + ): + super(TiDataConnectorDataTypes, self).__init__(**kwargs) + self.indicators = kwargs.get('indicators', None) + + +class TiDataConnectorDataTypesIndicators(DataConnectorDataTypeCommon): + """Data type for indicators connection. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TiDataConnectorDataTypesIndicators, self).__init__(**kwargs) + + +class TiDataConnectorProperties(DataConnectorTenantId): + """TI (Threat Intelligence) data connector properties. + + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.TiDataConnectorDataTypes + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'data_types': {'key': 'dataTypes', 'type': 'TiDataConnectorDataTypes'}, + } + + def __init__( + self, + **kwargs + ): + super(TiDataConnectorProperties, self).__init__(**kwargs) + self.data_types = kwargs.get('data_types', None) + + +class ToggleSettings(Settings): + """Settings with single toggle. + + :param kind: The kind of the setting. Possible values include: "UebaSettings", + "ToggleSettings". + :type kind: str or ~azure.mgmt.securityinsight.models.SettingKind + :param is_enabled: Determines whether the setting is enable or disabled. + :type is_enabled: bool + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ToggleSettings, self).__init__(**kwargs) + self.is_enabled = kwargs.get('is_enabled', None) + + +class UebaSettings(Settings): + """Represents settings for User and Entity Behavior Analytics enablement. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param kind: The kind of the setting. Possible values include: "UebaSettings", + "ToggleSettings". + :type kind: str or ~azure.mgmt.securityinsight.models.SettingKind + :ivar atp_license_status: Determines whether the tenant has ATP (Advanced Threat Protection) + license. Possible values include: "Enabled", "Disabled". + :vartype atp_license_status: str or ~azure.mgmt.securityinsight.models.LicenseStatus + :param is_enabled: Determines whether User and Entity Behavior Analytics is enabled for this + workspace. + :type is_enabled: bool + :ivar status_in_mcas: Determines whether User and Entity Behavior Analytics is enabled from + MCAS (Microsoft Cloud App Security). Possible values include: "Enabled", "Disabled". + :vartype status_in_mcas: str or ~azure.mgmt.securityinsight.models.StatusInMcas + """ + + _validation = { + 'atp_license_status': {'readonly': True}, + 'status_in_mcas': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'atp_license_status': {'key': 'properties.atpLicenseStatus', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'status_in_mcas': {'key': 'properties.statusInMcas', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UebaSettings, self).__init__(**kwargs) + self.atp_license_status = None + self.is_enabled = kwargs.get('is_enabled', None) + self.status_in_mcas = None + + +class UserInfo(msrest.serialization.Model): + """User information that made some action. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar email: The email of the user. + :vartype email: str + :ivar name: The name of the user. + :vartype name: str + :param object_id: Required. The object id of the user. + :type object_id: str + """ + + _validation = { + 'email': {'readonly': True}, + 'name': {'readonly': True}, + 'object_id': {'required': True}, + } + + _attribute_map = { + 'email': {'key': 'email', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserInfo, self).__init__(**kwargs) + self.email = None + self.name = None + self.object_id = kwargs['object_id'] diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/_models_py3.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/_models_py3.py new file mode 100644 index 00000000000..1c7dc0607fa --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/_models_py3.py @@ -0,0 +1,3523 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import List, Optional, Union + +import msrest.serialization + + +class DataConnectorKind(msrest.serialization.Model): + """Describes an Azure resource with kind. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "DataConnectorKindEnum"]] = None, + **kwargs + ): + super(DataConnectorKind, self).__init__(**kwargs) + self.kind = kind + + +class DataConnector(DataConnectorKind): + """Data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "DataConnectorKindEnum"]] = None, + **kwargs + ): + super(DataConnector, self).__init__(kind=kind, **kwargs) + + +class AadDataConnector(DataConnector): + """Represents AAD (Azure Active Directory) data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "DataConnectorKindEnum"]] = None, + tenant_id: Optional[str] = None, + data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + **kwargs + ): + super(AadDataConnector, self).__init__(kind=kind, **kwargs) + self.tenant_id = tenant_id + self.data_types = data_types + + +class DataConnectorWithAlertsProperties(msrest.serialization.Model): + """Data connector properties. + + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'data_types': {'key': 'dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + *, + data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + **kwargs + ): + super(DataConnectorWithAlertsProperties, self).__init__(**kwargs) + self.data_types = data_types + + +class AadDataConnectorProperties(DataConnectorWithAlertsProperties): + """AAD (Azure Active Directory) data connector properties. + + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'data_types': {'key': 'dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + *, + data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + **kwargs + ): + super(AadDataConnectorProperties, self).__init__(data_types=data_types, **kwargs) + + +class AatpDataConnector(DataConnector): + """Represents AATP (Azure Advanced Threat Protection) data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "DataConnectorKindEnum"]] = None, + tenant_id: Optional[str] = None, + data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + **kwargs + ): + super(AatpDataConnector, self).__init__(kind=kind, **kwargs) + self.tenant_id = tenant_id + self.data_types = data_types + + +class AatpDataConnectorProperties(DataConnectorWithAlertsProperties): + """AATP (Azure Advanced Threat Protection) data connector properties. + + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'data_types': {'key': 'dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + *, + data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + **kwargs + ): + super(AatpDataConnectorProperties, self).__init__(data_types=data_types, **kwargs) + + +class ActionPropertiesBase(msrest.serialization.Model): + """Action property bag base. + + All required parameters must be populated in order to send to Azure. + + :param logic_app_resource_id: Required. Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + """ + + _validation = { + 'logic_app_resource_id': {'required': True}, + } + + _attribute_map = { + 'logic_app_resource_id': {'key': 'logicAppResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + logic_app_resource_id: str, + **kwargs + ): + super(ActionPropertiesBase, self).__init__(**kwargs) + self.logic_app_resource_id = logic_app_resource_id + + +class ResourceWithEtag(msrest.serialization.Model): + """An azure resource object with an Etag property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param etag: Etag of the azure resource. + :type etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + **kwargs + ): + super(ResourceWithEtag, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.etag = etag + + +class ActionRequest(ResourceWithEtag): + """Action for alert rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param etag: Etag of the azure resource. + :type etag: str + :param logic_app_resource_id: Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + :param trigger_uri: Logic App Callback URL for this specific workflow. + :type trigger_uri: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'logic_app_resource_id': {'key': 'properties.logicAppResourceId', 'type': 'str'}, + 'trigger_uri': {'key': 'properties.triggerUri', 'type': 'str'}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + logic_app_resource_id: Optional[str] = None, + trigger_uri: Optional[str] = None, + **kwargs + ): + super(ActionRequest, self).__init__(etag=etag, **kwargs) + self.logic_app_resource_id = logic_app_resource_id + self.trigger_uri = trigger_uri + + +class ActionRequestProperties(ActionPropertiesBase): + """Action property bag. + + All required parameters must be populated in order to send to Azure. + + :param logic_app_resource_id: Required. Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + :param trigger_uri: Logic App Callback URL for this specific workflow. + :type trigger_uri: str + """ + + _validation = { + 'logic_app_resource_id': {'required': True}, + } + + _attribute_map = { + 'logic_app_resource_id': {'key': 'logicAppResourceId', 'type': 'str'}, + 'trigger_uri': {'key': 'triggerUri', 'type': 'str'}, + } + + def __init__( + self, + *, + logic_app_resource_id: str, + trigger_uri: Optional[str] = None, + **kwargs + ): + super(ActionRequestProperties, self).__init__(logic_app_resource_id=logic_app_resource_id, **kwargs) + self.trigger_uri = trigger_uri + + +class Resource(msrest.serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ActionResponse(Resource): + """Action for alert rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param etag: Etag of the action. + :type etag: str + :param logic_app_resource_id: Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + :param workflow_id: The name of the logic app's workflow. + :type workflow_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'logic_app_resource_id': {'key': 'properties.logicAppResourceId', 'type': 'str'}, + 'workflow_id': {'key': 'properties.workflowId', 'type': 'str'}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + logic_app_resource_id: Optional[str] = None, + workflow_id: Optional[str] = None, + **kwargs + ): + super(ActionResponse, self).__init__(**kwargs) + self.etag = etag + self.logic_app_resource_id = logic_app_resource_id + self.workflow_id = workflow_id + + +class ActionResponseProperties(ActionPropertiesBase): + """Action property bag. + + All required parameters must be populated in order to send to Azure. + + :param logic_app_resource_id: Required. Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + :param workflow_id: The name of the logic app's workflow. + :type workflow_id: str + """ + + _validation = { + 'logic_app_resource_id': {'required': True}, + } + + _attribute_map = { + 'logic_app_resource_id': {'key': 'logicAppResourceId', 'type': 'str'}, + 'workflow_id': {'key': 'workflowId', 'type': 'str'}, + } + + def __init__( + self, + *, + logic_app_resource_id: str, + workflow_id: Optional[str] = None, + **kwargs + ): + super(ActionResponseProperties, self).__init__(logic_app_resource_id=logic_app_resource_id, **kwargs) + self.workflow_id = workflow_id + + +class ActionsList(msrest.serialization.Model): + """List all the actions. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of actions. + :vartype next_link: str + :param value: Required. Array of actions. + :type value: list[~azure.mgmt.securityinsight.models.ActionResponse] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[ActionResponse]'}, + } + + def __init__( + self, + *, + value: List["ActionResponse"], + **kwargs + ): + super(ActionsList, self).__init__(**kwargs) + self.next_link = None + self.value = value + + +class AlertRuleKind(msrest.serialization.Model): + """Describes an Azure resource with kind. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Union[str, "AlertRuleKindEnum"], + **kwargs + ): + super(AlertRuleKind, self).__init__(**kwargs) + self.kind = kind + + +class AlertRule(AlertRuleKind): + """Alert rule. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Union[str, "AlertRuleKindEnum"], + **kwargs + ): + super(AlertRule, self).__init__(kind=kind, **kwargs) + + +class AlertRulesList(msrest.serialization.Model): + """List all the alert rules. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of alert rules. + :vartype next_link: str + :param value: Required. Array of alert rules. + :type value: list[~azure.mgmt.securityinsight.models.AlertRule] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[AlertRule]'}, + } + + def __init__( + self, + *, + value: List["AlertRule"], + **kwargs + ): + super(AlertRulesList, self).__init__(**kwargs) + self.next_link = None + self.value = value + + +class AlertRuleTemplate(AlertRuleKind): + """Alert rule template. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Union[str, "AlertRuleKindEnum"], + **kwargs + ): + super(AlertRuleTemplate, self).__init__(kind=kind, **kwargs) + + +class AlertRuleTemplateDataSource(msrest.serialization.Model): + """alert rule template data sources. + + :param connector_id: The connector id that provides the following data types. + :type connector_id: str + :param data_types: The data types used by the alert rule template. + :type data_types: list[str] + """ + + _attribute_map = { + 'connector_id': {'key': 'connectorId', 'type': 'str'}, + 'data_types': {'key': 'dataTypes', 'type': '[str]'}, + } + + def __init__( + self, + *, + connector_id: Optional[str] = None, + data_types: Optional[List[str]] = None, + **kwargs + ): + super(AlertRuleTemplateDataSource, self).__init__(**kwargs) + self.connector_id = connector_id + self.data_types = data_types + + +class AlertRuleTemplatePropertiesBase(msrest.serialization.Model): + """Base alert rule template property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :type alert_rules_created_by_template_count: int + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :param description: The description of the alert rule template. + :type description: str + :param display_name: The display name for alert rule template. + :type display_name: str + :param required_data_connectors: The required data connectors for this template. + :type required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :param status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :type status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + """ + + _validation = { + 'created_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'alert_rules_created_by_template_count': {'key': 'alertRulesCreatedByTemplateCount', 'type': 'int'}, + 'created_date_utc': {'key': 'createdDateUTC', 'type': 'iso-8601'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'required_data_connectors': {'key': 'requiredDataConnectors', 'type': '[AlertRuleTemplateDataSource]'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + alert_rules_created_by_template_count: Optional[int] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "TemplateStatus"]] = None, + **kwargs + ): + super(AlertRuleTemplatePropertiesBase, self).__init__(**kwargs) + self.alert_rules_created_by_template_count = alert_rules_created_by_template_count + self.created_date_utc = None + self.description = description + self.display_name = display_name + self.required_data_connectors = required_data_connectors + self.status = status + + +class AlertRuleTemplatesList(msrest.serialization.Model): + """List all the alert rule templates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of alert rule templates. + :vartype next_link: str + :param value: Required. Array of alert rule templates. + :type value: list[~azure.mgmt.securityinsight.models.AlertRuleTemplate] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[AlertRuleTemplate]'}, + } + + def __init__( + self, + *, + value: List["AlertRuleTemplate"], + **kwargs + ): + super(AlertRuleTemplatesList, self).__init__(**kwargs) + self.next_link = None + self.value = value + + +class AlertsDataTypeOfDataConnector(msrest.serialization.Model): + """Alerts data type for data connectors. + + :param alerts: Alerts data type connection. + :type alerts: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnectorAlerts + """ + + _attribute_map = { + 'alerts': {'key': 'alerts', 'type': 'AlertsDataTypeOfDataConnectorAlerts'}, + } + + def __init__( + self, + *, + alerts: Optional["AlertsDataTypeOfDataConnectorAlerts"] = None, + **kwargs + ): + super(AlertsDataTypeOfDataConnector, self).__init__(**kwargs) + self.alerts = alerts + + +class DataConnectorDataTypeCommon(msrest.serialization.Model): + """Common field for data type in data connectors. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "DataTypeState"]] = None, + **kwargs + ): + super(DataConnectorDataTypeCommon, self).__init__(**kwargs) + self.state = state + + +class AlertsDataTypeOfDataConnectorAlerts(DataConnectorDataTypeCommon): + """Alerts data type connection. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "DataTypeState"]] = None, + **kwargs + ): + super(AlertsDataTypeOfDataConnectorAlerts, self).__init__(state=state, **kwargs) + + +class AscDataConnector(DataConnector): + """Represents ASC (Azure Security Center) data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :param subscription_id: The subscription id to connect to, and get the data from. + :type subscription_id: str + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + 'subscription_id': {'key': 'properties.subscriptionId', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "DataConnectorKindEnum"]] = None, + data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + subscription_id: Optional[str] = None, + **kwargs + ): + super(AscDataConnector, self).__init__(kind=kind, **kwargs) + self.data_types = data_types + self.subscription_id = subscription_id + + +class AscDataConnectorProperties(DataConnectorWithAlertsProperties): + """ASC (Azure Security Center) data connector properties. + + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :param subscription_id: The subscription id to connect to, and get the data from. + :type subscription_id: str + """ + + _attribute_map = { + 'data_types': {'key': 'dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + } + + def __init__( + self, + *, + data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + subscription_id: Optional[str] = None, + **kwargs + ): + super(AscDataConnectorProperties, self).__init__(data_types=data_types, **kwargs) + self.subscription_id = subscription_id + + +class AwsCloudTrailDataConnector(DataConnector): + """Represents Amazon Web Services CloudTrail data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param aws_role_arn: The Aws Role Arn (with CloudTrailReadOnly policy) that is used to access + the Aws account. + :type aws_role_arn: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AwsCloudTrailDataConnectorDataTypes + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'aws_role_arn': {'key': 'properties.awsRoleArn', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'AwsCloudTrailDataConnectorDataTypes'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "DataConnectorKindEnum"]] = None, + aws_role_arn: Optional[str] = None, + data_types: Optional["AwsCloudTrailDataConnectorDataTypes"] = None, + **kwargs + ): + super(AwsCloudTrailDataConnector, self).__init__(kind=kind, **kwargs) + self.aws_role_arn = aws_role_arn + self.data_types = data_types + + +class AwsCloudTrailDataConnectorDataTypes(msrest.serialization.Model): + """The available data types for Amazon Web Services CloudTrail data connector. + + :param logs: Logs data type. + :type logs: ~azure.mgmt.securityinsight.models.AwsCloudTrailDataConnectorDataTypesLogs + """ + + _attribute_map = { + 'logs': {'key': 'logs', 'type': 'AwsCloudTrailDataConnectorDataTypesLogs'}, + } + + def __init__( + self, + *, + logs: Optional["AwsCloudTrailDataConnectorDataTypesLogs"] = None, + **kwargs + ): + super(AwsCloudTrailDataConnectorDataTypes, self).__init__(**kwargs) + self.logs = logs + + +class AwsCloudTrailDataConnectorDataTypesLogs(DataConnectorDataTypeCommon): + """Logs data type. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "DataTypeState"]] = None, + **kwargs + ): + super(AwsCloudTrailDataConnectorDataTypesLogs, self).__init__(state=state, **kwargs) + + +class Bookmark(ResourceWithEtag): + """Represents a bookmark in Azure Security Insights. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param etag: Etag of the azure resource. + :type etag: str + :param created: The time the bookmark was created. + :type created: ~datetime.datetime + :param created_by: Describes a user that created the bookmark. + :type created_by: ~azure.mgmt.securityinsight.models.UserInfo + :param display_name: The display name of the bookmark. + :type display_name: str + :param labels: List of labels relevant to this bookmark. + :type labels: list[str] + :param notes: The notes of the bookmark. + :type notes: str + :param query: The query of the bookmark. + :type query: str + :param query_result: The query result of the bookmark. + :type query_result: str + :param updated: The last time the bookmark was updated. + :type updated: ~datetime.datetime + :param updated_by: Describes a user that updated the bookmark. + :type updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :param incident_info: Describes an incident that relates to bookmark. + :type incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'created': {'key': 'properties.created', 'type': 'iso-8601'}, + 'created_by': {'key': 'properties.createdBy', 'type': 'UserInfo'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'labels': {'key': 'properties.labels', 'type': '[str]'}, + 'notes': {'key': 'properties.notes', 'type': 'str'}, + 'query': {'key': 'properties.query', 'type': 'str'}, + 'query_result': {'key': 'properties.queryResult', 'type': 'str'}, + 'updated': {'key': 'properties.updated', 'type': 'iso-8601'}, + 'updated_by': {'key': 'properties.updatedBy', 'type': 'UserInfo'}, + 'incident_info': {'key': 'properties.incidentInfo', 'type': 'IncidentInfo'}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + created: Optional[datetime.datetime] = None, + created_by: Optional["UserInfo"] = None, + display_name: Optional[str] = None, + labels: Optional[List[str]] = None, + notes: Optional[str] = None, + query: Optional[str] = None, + query_result: Optional[str] = None, + updated: Optional[datetime.datetime] = None, + updated_by: Optional["UserInfo"] = None, + incident_info: Optional["IncidentInfo"] = None, + **kwargs + ): + super(Bookmark, self).__init__(etag=etag, **kwargs) + self.created = created + self.created_by = created_by + self.display_name = display_name + self.labels = labels + self.notes = notes + self.query = query + self.query_result = query_result + self.updated = updated + self.updated_by = updated_by + self.incident_info = incident_info + + +class BookmarkExpandParameters(msrest.serialization.Model): + """The parameters required to execute an expand operation on the given bookmark. + + :param end_time: The end date filter, so the only expansion results returned are before this + date. + :type end_time: ~datetime.datetime + :param expansion_id: The Id of the expansion to perform. + :type expansion_id: str + :param start_time: The start date filter, so the only expansion results returned are after this + date. + :type start_time: ~datetime.datetime + """ + + _attribute_map = { + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'expansion_id': {'key': 'expansionId', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + end_time: Optional[datetime.datetime] = None, + expansion_id: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + **kwargs + ): + super(BookmarkExpandParameters, self).__init__(**kwargs) + self.end_time = end_time + self.expansion_id = expansion_id + self.start_time = start_time + + +class BookmarkList(msrest.serialization.Model): + """List all the bookmarks. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of cases. + :vartype next_link: str + :param value: Required. Array of bookmarks. + :type value: list[~azure.mgmt.securityinsight.models.Bookmark] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Bookmark]'}, + } + + def __init__( + self, + *, + value: List["Bookmark"], + **kwargs + ): + super(BookmarkList, self).__init__(**kwargs) + self.next_link = None + self.value = value + + +class ClientInfo(msrest.serialization.Model): + """Information on the client (user or application) that made some action. + + :param email: The email of the client. + :type email: str + :param name: The name of the client. + :type name: str + :param object_id: The object id of the client. + :type object_id: str + :param user_principal_name: The user principal name of the client. + :type user_principal_name: str + """ + + _attribute_map = { + 'email': {'key': 'email', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + } + + def __init__( + self, + *, + email: Optional[str] = None, + name: Optional[str] = None, + object_id: Optional[str] = None, + user_principal_name: Optional[str] = None, + **kwargs + ): + super(ClientInfo, self).__init__(**kwargs) + self.email = email + self.name = name + self.object_id = object_id + self.user_principal_name = user_principal_name + + +class DataConnectorList(msrest.serialization.Model): + """List all the data connectors. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of data connectors. + :vartype next_link: str + :param value: Required. Array of data connectors. + :type value: list[~azure.mgmt.securityinsight.models.DataConnector] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[DataConnector]'}, + } + + def __init__( + self, + *, + value: List["DataConnector"], + **kwargs + ): + super(DataConnectorList, self).__init__(**kwargs) + self.next_link = None + self.value = value + + +class DataConnectorTenantId(msrest.serialization.Model): + """Properties data connector on tenant level. + + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + **kwargs + ): + super(DataConnectorTenantId, self).__init__(**kwargs) + self.tenant_id = tenant_id + + +class EntityKind(msrest.serialization.Model): + """Describes an entity with kind. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the entity. Possible values include: "Account", "Host", + "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark". + :type kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Union[str, "EntityKindEnum"], + **kwargs + ): + super(EntityKind, self).__init__(**kwargs) + self.kind = kind + + +class Entity(EntityKind): + """Specific entity. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the entity. Possible values include: "Account", "Host", + "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark". + :type kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Union[str, "EntityKindEnum"], + **kwargs + ): + super(Entity, self).__init__(kind=kind, **kwargs) + + +class EntityCommonProperties(msrest.serialization.Model): + """Entity common property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, object] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + """ + + _validation = { + 'additional_data': {'readonly': True}, + 'friendly_name': {'readonly': True}, + } + + _attribute_map = { + 'additional_data': {'key': 'additionalData', 'type': '{object}'}, + 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EntityCommonProperties, self).__init__(**kwargs) + self.additional_data = None + self.friendly_name = None + + +class FusionAlertRule(AlertRule): + """Represents Fusion alert rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param alert_rule_template_name: The Name of the alert rule template used to create this rule. + :type alert_rule_template_name: str + :ivar description: The description of the alert rule. + :vartype description: str + :ivar display_name: The display name for alerts created by this alert rule. + :vartype display_name: str + :param enabled: Determines whether this alert rule is enabled or disabled. + :type enabled: bool + :ivar last_modified_utc: The last time that this alert has been modified. + :vartype last_modified_utc: ~datetime.datetime + :ivar severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar tactics: The tactics of the alert rule. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'kind': {'required': True}, + 'description': {'readonly': True}, + 'display_name': {'readonly': True}, + 'last_modified_utc': {'readonly': True}, + 'severity': {'readonly': True}, + 'tactics': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'alert_rule_template_name': {'key': 'properties.alertRuleTemplateName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'last_modified_utc': {'key': 'properties.lastModifiedUtc', 'type': 'iso-8601'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'tactics': {'key': 'properties.tactics', 'type': '[str]'}, + } + + def __init__( + self, + *, + kind: Union[str, "AlertRuleKindEnum"], + alert_rule_template_name: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs + ): + super(FusionAlertRule, self).__init__(kind=kind, **kwargs) + self.alert_rule_template_name = alert_rule_template_name + self.description = None + self.display_name = None + self.enabled = enabled + self.last_modified_utc = None + self.severity = None + self.tactics = None + + +class FusionAlertRuleTemplate(AlertRuleTemplate): + """Represents Fusion alert rule template. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :type alert_rules_created_by_template_count: int + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :param description: The description of the alert rule template. + :type description: str + :param display_name: The display name for alert rule template. + :type display_name: str + :param required_data_connectors: The required data connectors for this template. + :type required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :param status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :type status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param tactics: The tactics of the alert rule template. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'kind': {'required': True}, + 'created_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'alert_rules_created_by_template_count': {'key': 'properties.alertRulesCreatedByTemplateCount', 'type': 'int'}, + 'created_date_utc': {'key': 'properties.createdDateUTC', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'required_data_connectors': {'key': 'properties.requiredDataConnectors', 'type': '[AlertRuleTemplateDataSource]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'tactics': {'key': 'properties.tactics', 'type': '[str]'}, + } + + def __init__( + self, + *, + kind: Union[str, "AlertRuleKindEnum"], + alert_rules_created_by_template_count: Optional[int] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "TemplateStatus"]] = None, + severity: Optional[Union[str, "AlertSeverity"]] = None, + tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + **kwargs + ): + super(FusionAlertRuleTemplate, self).__init__(kind=kind, **kwargs) + self.alert_rules_created_by_template_count = alert_rules_created_by_template_count + self.created_date_utc = None + self.description = description + self.display_name = display_name + self.required_data_connectors = required_data_connectors + self.status = status + self.severity = severity + self.tactics = tactics + + +class FusionAlertRuleTemplateProperties(AlertRuleTemplatePropertiesBase): + """Fusion alert rule template properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :type alert_rules_created_by_template_count: int + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :param description: The description of the alert rule template. + :type description: str + :param display_name: The display name for alert rule template. + :type display_name: str + :param required_data_connectors: The required data connectors for this template. + :type required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :param status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :type status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :param severity: Required. The severity for alerts created by this alert rule. Possible values + include: "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param tactics: The tactics of the alert rule template. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'created_date_utc': {'readonly': True}, + 'severity': {'required': True}, + } + + _attribute_map = { + 'alert_rules_created_by_template_count': {'key': 'alertRulesCreatedByTemplateCount', 'type': 'int'}, + 'created_date_utc': {'key': 'createdDateUTC', 'type': 'iso-8601'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'required_data_connectors': {'key': 'requiredDataConnectors', 'type': '[AlertRuleTemplateDataSource]'}, + 'status': {'key': 'status', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'tactics': {'key': 'tactics', 'type': '[str]'}, + } + + def __init__( + self, + *, + severity: Union[str, "AlertSeverity"], + alert_rules_created_by_template_count: Optional[int] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "TemplateStatus"]] = None, + tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + **kwargs + ): + super(FusionAlertRuleTemplateProperties, self).__init__(alert_rules_created_by_template_count=alert_rules_created_by_template_count, description=description, display_name=display_name, required_data_connectors=required_data_connectors, status=status, **kwargs) + self.severity = severity + self.tactics = tactics + + +class GeoLocation(msrest.serialization.Model): + """The geo-location context attached to the ip entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar asn: Autonomous System Number. + :vartype asn: int + :ivar city: City name. + :vartype city: str + :ivar country_code: The country code according to ISO 3166 format. + :vartype country_code: str + :ivar country_name: Country name according to ISO 3166 Alpha 2: the lowercase of the English + Short Name. + :vartype country_name: str + :ivar latitude: The longitude of the identified location, expressed as a floating point number + with range of -180 to 180, with positive numbers representing East and negative numbers + representing West. Latitude and longitude are derived from the city or postal code. + :vartype latitude: float + :ivar longitude: The latitude of the identified location, expressed as a floating point number + with range of - 90 to 90, with positive numbers representing North and negative numbers + representing South. Latitude and longitude are derived from the city or postal code. + :vartype longitude: float + :ivar state: State name. + :vartype state: str + """ + + _validation = { + 'asn': {'readonly': True}, + 'city': {'readonly': True}, + 'country_code': {'readonly': True}, + 'country_name': {'readonly': True}, + 'latitude': {'readonly': True}, + 'longitude': {'readonly': True}, + 'state': {'readonly': True}, + } + + _attribute_map = { + 'asn': {'key': 'asn', 'type': 'int'}, + 'city': {'key': 'city', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'country_name': {'key': 'countryName', 'type': 'str'}, + 'latitude': {'key': 'latitude', 'type': 'float'}, + 'longitude': {'key': 'longitude', 'type': 'float'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoLocation, self).__init__(**kwargs) + self.asn = None + self.city = None + self.country_code = None + self.country_name = None + self.latitude = None + self.longitude = None + self.state = None + + +class GroupingConfiguration(msrest.serialization.Model): + """Grouping configuration property bag. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. Grouping enabled. + :type enabled: bool + :param reopen_closed_incident: Required. Re-open closed matching incidents. + :type reopen_closed_incident: bool + :param lookback_duration: Required. Limit the group to alerts created within the lookback + duration (in ISO 8601 duration format). + :type lookback_duration: ~datetime.timedelta + :param entities_matching_method: Required. Grouping matching method. Possible values include: + "All", "None", "Custom". + :type entities_matching_method: str or + ~azure.mgmt.securityinsight.models.EntitiesMatchingMethod + :param group_by_entities: A list of entity types to group by (when entitiesMatchingMethod is + Custom). + :type group_by_entities: list[str or ~azure.mgmt.securityinsight.models.GroupingEntityType] + """ + + _validation = { + 'enabled': {'required': True}, + 'reopen_closed_incident': {'required': True}, + 'lookback_duration': {'required': True}, + 'entities_matching_method': {'required': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'reopen_closed_incident': {'key': 'reopenClosedIncident', 'type': 'bool'}, + 'lookback_duration': {'key': 'lookbackDuration', 'type': 'duration'}, + 'entities_matching_method': {'key': 'entitiesMatchingMethod', 'type': 'str'}, + 'group_by_entities': {'key': 'groupByEntities', 'type': '[str]'}, + } + + def __init__( + self, + *, + enabled: bool, + reopen_closed_incident: bool, + lookback_duration: datetime.timedelta, + entities_matching_method: Union[str, "EntitiesMatchingMethod"], + group_by_entities: Optional[List[Union[str, "GroupingEntityType"]]] = None, + **kwargs + ): + super(GroupingConfiguration, self).__init__(**kwargs) + self.enabled = enabled + self.reopen_closed_incident = reopen_closed_incident + self.lookback_duration = lookback_duration + self.entities_matching_method = entities_matching_method + self.group_by_entities = group_by_entities + + +class Incident(ResourceWithEtag): + """Represents an incident in Azure Security Insights. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param etag: Etag of the azure resource. + :type etag: str + :ivar additional_data: Additional data on the incident. + :vartype additional_data: ~azure.mgmt.securityinsight.models.IncidentAdditionalData + :param classification: The reason the incident was closed. Possible values include: + "Undetermined", "TruePositive", "BenignPositive", "FalsePositive". + :type classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification + :ivar created_time_utc: The time the incident was created. + :vartype created_time_utc: ~datetime.datetime + :param description: The description of the incident. + :type description: str + :param first_activity_time_utc: The time of the first activity in the incident. + :type first_activity_time_utc: ~datetime.datetime + :ivar incident_number: A sequential number. + :vartype incident_number: int + :param labels: List of labels relevant to this incident. + :type labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + :param last_activity_time_utc: The time of the last activity in the incident. + :type last_activity_time_utc: ~datetime.datetime + :ivar last_modified_time_utc: The last time the incident was updated. + :vartype last_modified_time_utc: ~datetime.datetime + :param owner: Describes a user that the incident is assigned to. + :type owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo + :param severity: The severity of the incident. Possible values include: "High", "Medium", + "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :param status: The status of the incident. Possible values include: "New", "Active", "Closed". + :type status: str or ~azure.mgmt.securityinsight.models.IncidentStatus + :param title: The title of the incident. + :type title: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'additional_data': {'readonly': True}, + 'created_time_utc': {'readonly': True}, + 'incident_number': {'readonly': True}, + 'last_modified_time_utc': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'additional_data': {'key': 'properties.additionalData', 'type': 'IncidentAdditionalData'}, + 'classification': {'key': 'properties.classification', 'type': 'str'}, + 'created_time_utc': {'key': 'properties.createdTimeUtc', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'first_activity_time_utc': {'key': 'properties.firstActivityTimeUtc', 'type': 'iso-8601'}, + 'incident_number': {'key': 'properties.incidentNumber', 'type': 'int'}, + 'labels': {'key': 'properties.labels', 'type': '[IncidentLabel]'}, + 'last_activity_time_utc': {'key': 'properties.lastActivityTimeUtc', 'type': 'iso-8601'}, + 'last_modified_time_utc': {'key': 'properties.lastModifiedTimeUtc', 'type': 'iso-8601'}, + 'owner': {'key': 'properties.owner', 'type': 'IncidentOwnerInfo'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'title': {'key': 'properties.title', 'type': 'str'}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + classification: Optional[Union[str, "IncidentClassification"]] = None, + description: Optional[str] = None, + first_activity_time_utc: Optional[datetime.datetime] = None, + labels: Optional[List["IncidentLabel"]] = None, + last_activity_time_utc: Optional[datetime.datetime] = None, + owner: Optional["IncidentOwnerInfo"] = None, + severity: Optional[Union[str, "IncidentSeverity"]] = None, + status: Optional[Union[str, "IncidentStatus"]] = None, + title: Optional[str] = None, + **kwargs + ): + super(Incident, self).__init__(etag=etag, **kwargs) + self.additional_data = None + self.classification = classification + self.created_time_utc = None + self.description = description + self.first_activity_time_utc = first_activity_time_utc + self.incident_number = None + self.labels = labels + self.last_activity_time_utc = last_activity_time_utc + self.last_modified_time_utc = None + self.owner = owner + self.severity = severity + self.status = status + self.title = title + + +class IncidentAdditionalData(msrest.serialization.Model): + """Incident additional data property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar alerts_count: The number of alerts in the incident. + :vartype alerts_count: int + :ivar bookmarks_count: The number of bookmarks in the incident. + :vartype bookmarks_count: int + :ivar comments_count: The number of comments in the incident. + :vartype comments_count: int + :ivar alert_product_names: List of product names of alerts in the incident. + :vartype alert_product_names: list[str] + :ivar tactics: The tactics associated with incident. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'alerts_count': {'readonly': True}, + 'bookmarks_count': {'readonly': True}, + 'comments_count': {'readonly': True}, + 'alert_product_names': {'readonly': True}, + 'tactics': {'readonly': True}, + } + + _attribute_map = { + 'alerts_count': {'key': 'alertsCount', 'type': 'int'}, + 'bookmarks_count': {'key': 'bookmarksCount', 'type': 'int'}, + 'comments_count': {'key': 'commentsCount', 'type': 'int'}, + 'alert_product_names': {'key': 'alertProductNames', 'type': '[str]'}, + 'tactics': {'key': 'tactics', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(IncidentAdditionalData, self).__init__(**kwargs) + self.alerts_count = None + self.bookmarks_count = None + self.comments_count = None + self.alert_product_names = None + self.tactics = None + + +class IncidentComment(Resource): + """Represents an incident comment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar created_time_utc: The time the comment was created. + :vartype created_time_utc: ~datetime.datetime + :param message: The comment message. + :type message: str + :ivar author: Describes the client that created the comment. + :vartype author: ~azure.mgmt.securityinsight.models.ClientInfo + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_time_utc': {'readonly': True}, + 'author': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'created_time_utc': {'key': 'properties.createdTimeUtc', 'type': 'iso-8601'}, + 'message': {'key': 'properties.message', 'type': 'str'}, + 'author': {'key': 'properties.author', 'type': 'ClientInfo'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + **kwargs + ): + super(IncidentComment, self).__init__(**kwargs) + self.created_time_utc = None + self.message = message + self.author = None + + +class IncidentCommentList(msrest.serialization.Model): + """List of incident comments. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of comments. + :vartype next_link: str + :param value: Required. Array of comments. + :type value: list[~azure.mgmt.securityinsight.models.IncidentComment] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[IncidentComment]'}, + } + + def __init__( + self, + *, + value: List["IncidentComment"], + **kwargs + ): + super(IncidentCommentList, self).__init__(**kwargs) + self.next_link = None + self.value = value + + +class IncidentInfo(msrest.serialization.Model): + """Describes related incident information for the bookmark. + + All required parameters must be populated in order to send to Azure. + + :param incident_id: Required. Incident Id. + :type incident_id: str + :param severity: Required. The severity of the incident. Possible values include: "Critical", + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.CaseSeverity + :param title: Required. The title of the incident. + :type title: str + :param relation_name: Required. Relation Name. + :type relation_name: str + """ + + _validation = { + 'incident_id': {'required': True}, + 'severity': {'required': True}, + 'title': {'required': True}, + 'relation_name': {'required': True}, + } + + _attribute_map = { + 'incident_id': {'key': 'incidentId', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'relation_name': {'key': 'relationName', 'type': 'str'}, + } + + def __init__( + self, + *, + incident_id: str, + severity: Union[str, "CaseSeverity"], + title: str, + relation_name: str, + **kwargs + ): + super(IncidentInfo, self).__init__(**kwargs) + self.incident_id = incident_id + self.severity = severity + self.title = title + self.relation_name = relation_name + + +class IncidentLabel(msrest.serialization.Model): + """Represents an incident label. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param label_name: Required. The name of the label. + :type label_name: str + :ivar label_type: The type of the label. Possible values include: "User", "System". + :vartype label_type: str or ~azure.mgmt.securityinsight.models.IncidentLabelType + """ + + _validation = { + 'label_name': {'required': True}, + 'label_type': {'readonly': True}, + } + + _attribute_map = { + 'label_name': {'key': 'labelName', 'type': 'str'}, + 'label_type': {'key': 'labelType', 'type': 'str'}, + } + + def __init__( + self, + *, + label_name: str, + **kwargs + ): + super(IncidentLabel, self).__init__(**kwargs) + self.label_name = label_name + self.label_type = None + + +class IncidentList(msrest.serialization.Model): + """List all the incidents. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of incidents. + :vartype next_link: str + :param value: Required. Array of incidents. + :type value: list[~azure.mgmt.securityinsight.models.Incident] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Incident]'}, + } + + def __init__( + self, + *, + value: List["Incident"], + **kwargs + ): + super(IncidentList, self).__init__(**kwargs) + self.next_link = None + self.value = value + + +class IncidentOwnerInfo(msrest.serialization.Model): + """Information on the user an incident is assigned to. + + :param email: The email of the user the incident is assigned to. + :type email: str + :param assigned_to: The name of the user the incident is assigned to. + :type assigned_to: str + :param object_id: The object id of the user the incident is assigned to. + :type object_id: str + :param user_principal_name: The user principal name of the user the incident is assigned to. + :type user_principal_name: str + """ + + _attribute_map = { + 'email': {'key': 'email', 'type': 'str'}, + 'assigned_to': {'key': 'assignedTo', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + } + + def __init__( + self, + *, + email: Optional[str] = None, + assigned_to: Optional[str] = None, + object_id: Optional[str] = None, + user_principal_name: Optional[str] = None, + **kwargs + ): + super(IncidentOwnerInfo, self).__init__(**kwargs) + self.email = email + self.assigned_to = assigned_to + self.object_id = object_id + self.user_principal_name = user_principal_name + + +class IpEntity(Entity): + """Represents an ip entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the entity. Possible values include: "Account", "Host", + "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark". + :type kind: str or ~azure.mgmt.securityinsight.models.EntityKindEnum + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, object] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar address: The IP address as string, e.g. 127.0.0.1 (either in Ipv4 or Ipv6). + :vartype address: str + :ivar location: The geo-location context attached to the ip entity. + :vartype location: ~azure.mgmt.securityinsight.models.GeoLocation + :ivar threat_intelligence: A list of TI contexts attached to the ip entity. + :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] + """ + + _validation = { + 'kind': {'required': True}, + 'additional_data': {'readonly': True}, + 'friendly_name': {'readonly': True}, + 'address': {'readonly': True}, + 'location': {'readonly': True}, + 'threat_intelligence': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'additional_data': {'key': 'properties.additionalData', 'type': '{object}'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'address': {'key': 'properties.address', 'type': 'str'}, + 'location': {'key': 'properties.location', 'type': 'GeoLocation'}, + 'threat_intelligence': {'key': 'properties.threatIntelligence', 'type': '[ThreatIntelligence]'}, + } + + def __init__( + self, + *, + kind: Union[str, "EntityKindEnum"], + **kwargs + ): + super(IpEntity, self).__init__(kind=kind, **kwargs) + self.additional_data = None + self.friendly_name = None + self.address = None + self.location = None + self.threat_intelligence = None + + +class IpEntityProperties(EntityCommonProperties): + """Ip entity property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar additional_data: A bag of custom fields that should be part of the entity and will be + presented to the user. + :vartype additional_data: dict[str, object] + :ivar friendly_name: The graph item display name which is a short humanly readable description + of the graph item instance. This property is optional and might be system generated. + :vartype friendly_name: str + :ivar address: The IP address as string, e.g. 127.0.0.1 (either in Ipv4 or Ipv6). + :vartype address: str + :ivar location: The geo-location context attached to the ip entity. + :vartype location: ~azure.mgmt.securityinsight.models.GeoLocation + :ivar threat_intelligence: A list of TI contexts attached to the ip entity. + :vartype threat_intelligence: list[~azure.mgmt.securityinsight.models.ThreatIntelligence] + """ + + _validation = { + 'additional_data': {'readonly': True}, + 'friendly_name': {'readonly': True}, + 'address': {'readonly': True}, + 'location': {'readonly': True}, + 'threat_intelligence': {'readonly': True}, + } + + _attribute_map = { + 'additional_data': {'key': 'additionalData', 'type': '{object}'}, + 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, + 'address': {'key': 'address', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'GeoLocation'}, + 'threat_intelligence': {'key': 'threatIntelligence', 'type': '[ThreatIntelligence]'}, + } + + def __init__( + self, + **kwargs + ): + super(IpEntityProperties, self).__init__(**kwargs) + self.address = None + self.location = None + self.threat_intelligence = None + + +class McasDataConnector(DataConnector): + """Represents MCAS (Microsoft Cloud App Security) data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.McasDataConnectorDataTypes + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'McasDataConnectorDataTypes'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "DataConnectorKindEnum"]] = None, + tenant_id: Optional[str] = None, + data_types: Optional["McasDataConnectorDataTypes"] = None, + **kwargs + ): + super(McasDataConnector, self).__init__(kind=kind, **kwargs) + self.tenant_id = tenant_id + self.data_types = data_types + + +class McasDataConnectorDataTypes(AlertsDataTypeOfDataConnector): + """The available data types for MCAS (Microsoft Cloud App Security) data connector. + + :param alerts: Alerts data type connection. + :type alerts: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnectorAlerts + :param discovery_logs: Discovery log data type connection. + :type discovery_logs: + ~azure.mgmt.securityinsight.models.McasDataConnectorDataTypesDiscoveryLogs + """ + + _attribute_map = { + 'alerts': {'key': 'alerts', 'type': 'AlertsDataTypeOfDataConnectorAlerts'}, + 'discovery_logs': {'key': 'discoveryLogs', 'type': 'McasDataConnectorDataTypesDiscoveryLogs'}, + } + + def __init__( + self, + *, + alerts: Optional["AlertsDataTypeOfDataConnectorAlerts"] = None, + discovery_logs: Optional["McasDataConnectorDataTypesDiscoveryLogs"] = None, + **kwargs + ): + super(McasDataConnectorDataTypes, self).__init__(alerts=alerts, **kwargs) + self.discovery_logs = discovery_logs + + +class McasDataConnectorDataTypesDiscoveryLogs(DataConnectorDataTypeCommon): + """Discovery log data type connection. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "DataTypeState"]] = None, + **kwargs + ): + super(McasDataConnectorDataTypesDiscoveryLogs, self).__init__(state=state, **kwargs) + + +class McasDataConnectorProperties(DataConnectorTenantId): + """MCAS (Microsoft Cloud App Security) data connector properties. + + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.McasDataConnectorDataTypes + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'data_types': {'key': 'dataTypes', 'type': 'McasDataConnectorDataTypes'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + data_types: Optional["McasDataConnectorDataTypes"] = None, + **kwargs + ): + super(McasDataConnectorProperties, self).__init__(tenant_id=tenant_id, **kwargs) + self.data_types = data_types + + +class MdatpDataConnector(DataConnector): + """Represents MDATP (Microsoft Defender Advanced Threat Protection) data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "DataConnectorKindEnum"]] = None, + tenant_id: Optional[str] = None, + data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + **kwargs + ): + super(MdatpDataConnector, self).__init__(kind=kind, **kwargs) + self.tenant_id = tenant_id + self.data_types = data_types + + +class MdatpDataConnectorProperties(DataConnectorWithAlertsProperties): + """MDATP (Microsoft Defender Advanced Threat Protection) data connector properties. + + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ + + _attribute_map = { + 'data_types': {'key': 'dataTypes', 'type': 'AlertsDataTypeOfDataConnector'}, + } + + def __init__( + self, + *, + data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + **kwargs + ): + super(MdatpDataConnectorProperties, self).__init__(data_types=data_types, **kwargs) + + +class MicrosoftSecurityIncidentCreationAlertRule(AlertRule): + """Represents MicrosoftSecurityIncidentCreation rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param display_names_filter: the alerts' displayNames on which the cases will be generated. + :type display_names_filter: list[str] + :param display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :type display_names_exclude_filter: list[str] + :param product_filter: The alerts' productName on which the cases will be generated. Possible + values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT". + :type product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :param severities_filter: the alerts' severities on which the cases will be generated. + :type severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :param alert_rule_template_name: The Name of the alert rule template used to create this rule. + :type alert_rule_template_name: str + :param description: The description of the alert rule. + :type description: str + :param display_name: The display name for alerts created by this alert rule. + :type display_name: str + :param enabled: Determines whether this alert rule is enabled or disabled. + :type enabled: bool + :ivar last_modified_utc: The last time that this alert has been modified. + :vartype last_modified_utc: ~datetime.datetime + """ + + _validation = { + 'kind': {'required': True}, + 'last_modified_utc': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'display_names_filter': {'key': 'properties.displayNamesFilter', 'type': '[str]'}, + 'display_names_exclude_filter': {'key': 'properties.displayNamesExcludeFilter', 'type': '[str]'}, + 'product_filter': {'key': 'properties.productFilter', 'type': 'str'}, + 'severities_filter': {'key': 'properties.severitiesFilter', 'type': '[str]'}, + 'alert_rule_template_name': {'key': 'properties.alertRuleTemplateName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'last_modified_utc': {'key': 'properties.lastModifiedUtc', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + kind: Union[str, "AlertRuleKindEnum"], + display_names_filter: Optional[List[str]] = None, + display_names_exclude_filter: Optional[List[str]] = None, + product_filter: Optional[Union[str, "MicrosoftSecurityProductName"]] = None, + severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, + alert_rule_template_name: Optional[str] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs + ): + super(MicrosoftSecurityIncidentCreationAlertRule, self).__init__(kind=kind, **kwargs) + self.display_names_filter = display_names_filter + self.display_names_exclude_filter = display_names_exclude_filter + self.product_filter = product_filter + self.severities_filter = severities_filter + self.alert_rule_template_name = alert_rule_template_name + self.description = description + self.display_name = display_name + self.enabled = enabled + self.last_modified_utc = None + + +class MicrosoftSecurityIncidentCreationAlertRuleCommonProperties(msrest.serialization.Model): + """MicrosoftSecurityIncidentCreation rule common property bag. + + All required parameters must be populated in order to send to Azure. + + :param display_names_filter: the alerts' displayNames on which the cases will be generated. + :type display_names_filter: list[str] + :param display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :type display_names_exclude_filter: list[str] + :param product_filter: Required. The alerts' productName on which the cases will be generated. + Possible values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure + Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security + Center for IoT". + :type product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :param severities_filter: the alerts' severities on which the cases will be generated. + :type severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + + _validation = { + 'product_filter': {'required': True}, + } + + _attribute_map = { + 'display_names_filter': {'key': 'displayNamesFilter', 'type': '[str]'}, + 'display_names_exclude_filter': {'key': 'displayNamesExcludeFilter', 'type': '[str]'}, + 'product_filter': {'key': 'productFilter', 'type': 'str'}, + 'severities_filter': {'key': 'severitiesFilter', 'type': '[str]'}, + } + + def __init__( + self, + *, + product_filter: Union[str, "MicrosoftSecurityProductName"], + display_names_filter: Optional[List[str]] = None, + display_names_exclude_filter: Optional[List[str]] = None, + severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, + **kwargs + ): + super(MicrosoftSecurityIncidentCreationAlertRuleCommonProperties, self).__init__(**kwargs) + self.display_names_filter = display_names_filter + self.display_names_exclude_filter = display_names_exclude_filter + self.product_filter = product_filter + self.severities_filter = severities_filter + + +class MicrosoftSecurityIncidentCreationAlertRuleProperties(MicrosoftSecurityIncidentCreationAlertRuleCommonProperties): + """MicrosoftSecurityIncidentCreation rule property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param display_names_filter: the alerts' displayNames on which the cases will be generated. + :type display_names_filter: list[str] + :param display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :type display_names_exclude_filter: list[str] + :param product_filter: Required. The alerts' productName on which the cases will be generated. + Possible values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure + Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security + Center for IoT". + :type product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :param severities_filter: the alerts' severities on which the cases will be generated. + :type severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :param alert_rule_template_name: The Name of the alert rule template used to create this rule. + :type alert_rule_template_name: str + :param description: The description of the alert rule. + :type description: str + :param display_name: Required. The display name for alerts created by this alert rule. + :type display_name: str + :param enabled: Required. Determines whether this alert rule is enabled or disabled. + :type enabled: bool + :ivar last_modified_utc: The last time that this alert has been modified. + :vartype last_modified_utc: ~datetime.datetime + """ + + _validation = { + 'product_filter': {'required': True}, + 'display_name': {'required': True}, + 'enabled': {'required': True}, + 'last_modified_utc': {'readonly': True}, + } + + _attribute_map = { + 'display_names_filter': {'key': 'displayNamesFilter', 'type': '[str]'}, + 'display_names_exclude_filter': {'key': 'displayNamesExcludeFilter', 'type': '[str]'}, + 'product_filter': {'key': 'productFilter', 'type': 'str'}, + 'severities_filter': {'key': 'severitiesFilter', 'type': '[str]'}, + 'alert_rule_template_name': {'key': 'alertRuleTemplateName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'last_modified_utc': {'key': 'lastModifiedUtc', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + product_filter: Union[str, "MicrosoftSecurityProductName"], + display_name: str, + enabled: bool, + display_names_filter: Optional[List[str]] = None, + display_names_exclude_filter: Optional[List[str]] = None, + severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, + alert_rule_template_name: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(MicrosoftSecurityIncidentCreationAlertRuleProperties, self).__init__(display_names_filter=display_names_filter, display_names_exclude_filter=display_names_exclude_filter, product_filter=product_filter, severities_filter=severities_filter, **kwargs) + self.alert_rule_template_name = alert_rule_template_name + self.description = description + self.display_name = display_name + self.enabled = enabled + self.last_modified_utc = None + + +class MicrosoftSecurityIncidentCreationAlertRuleTemplate(AlertRuleTemplate): + """Represents MicrosoftSecurityIncidentCreation rule template. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :type alert_rules_created_by_template_count: int + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :param description: The description of the alert rule template. + :type description: str + :param display_name: The display name for alert rule template. + :type display_name: str + :param required_data_connectors: The required data connectors for this template. + :type required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :param status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :type status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :param display_names_filter: the alerts' displayNames on which the cases will be generated. + :type display_names_filter: list[str] + :param display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :type display_names_exclude_filter: list[str] + :param product_filter: The alerts' productName on which the cases will be generated. Possible + values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT". + :type product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :param severities_filter: the alerts' severities on which the cases will be generated. + :type severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + + _validation = { + 'kind': {'required': True}, + 'created_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'alert_rules_created_by_template_count': {'key': 'properties.alertRulesCreatedByTemplateCount', 'type': 'int'}, + 'created_date_utc': {'key': 'properties.createdDateUTC', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'required_data_connectors': {'key': 'properties.requiredDataConnectors', 'type': '[AlertRuleTemplateDataSource]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'display_names_filter': {'key': 'properties.displayNamesFilter', 'type': '[str]'}, + 'display_names_exclude_filter': {'key': 'properties.displayNamesExcludeFilter', 'type': '[str]'}, + 'product_filter': {'key': 'properties.productFilter', 'type': 'str'}, + 'severities_filter': {'key': 'properties.severitiesFilter', 'type': '[str]'}, + } + + def __init__( + self, + *, + kind: Union[str, "AlertRuleKindEnum"], + alert_rules_created_by_template_count: Optional[int] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "TemplateStatus"]] = None, + display_names_filter: Optional[List[str]] = None, + display_names_exclude_filter: Optional[List[str]] = None, + product_filter: Optional[Union[str, "MicrosoftSecurityProductName"]] = None, + severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, + **kwargs + ): + super(MicrosoftSecurityIncidentCreationAlertRuleTemplate, self).__init__(kind=kind, **kwargs) + self.alert_rules_created_by_template_count = alert_rules_created_by_template_count + self.created_date_utc = None + self.description = description + self.display_name = display_name + self.required_data_connectors = required_data_connectors + self.status = status + self.display_names_filter = display_names_filter + self.display_names_exclude_filter = display_names_exclude_filter + self.product_filter = product_filter + self.severities_filter = severities_filter + + +class MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(MicrosoftSecurityIncidentCreationAlertRuleCommonProperties): + """MicrosoftSecurityIncidentCreation rule template properties. + + All required parameters must be populated in order to send to Azure. + + :param display_names_filter: the alerts' displayNames on which the cases will be generated. + :type display_names_filter: list[str] + :param display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :type display_names_exclude_filter: list[str] + :param product_filter: Required. The alerts' productName on which the cases will be generated. + Possible values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure + Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security + Center for IoT". + :type product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :param severities_filter: the alerts' severities on which the cases will be generated. + :type severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ + + _validation = { + 'product_filter': {'required': True}, + } + + _attribute_map = { + 'display_names_filter': {'key': 'displayNamesFilter', 'type': '[str]'}, + 'display_names_exclude_filter': {'key': 'displayNamesExcludeFilter', 'type': '[str]'}, + 'product_filter': {'key': 'productFilter', 'type': 'str'}, + 'severities_filter': {'key': 'severitiesFilter', 'type': '[str]'}, + } + + def __init__( + self, + *, + product_filter: Union[str, "MicrosoftSecurityProductName"], + display_names_filter: Optional[List[str]] = None, + display_names_exclude_filter: Optional[List[str]] = None, + severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, + **kwargs + ): + super(MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties, self).__init__(display_names_filter=display_names_filter, display_names_exclude_filter=display_names_exclude_filter, product_filter=product_filter, severities_filter=severities_filter, **kwargs) + + +class OfficeConsent(Resource): + """Consent for Office365 tenant that already made. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :param tenant_id: The tenantId of the Office365 with the consent. + :type tenant_id: str + :ivar tenant_name: The tenant name of the Office365 with the consent. + :vartype tenant_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tenant_name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + **kwargs + ): + super(OfficeConsent, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.tenant_name = None + + +class OfficeConsentList(msrest.serialization.Model): + """List of all the office365 consents. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of office consents. + :vartype next_link: str + :param value: Required. Array of the consents. + :type value: list[~azure.mgmt.securityinsight.models.OfficeConsent] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[OfficeConsent]'}, + } + + def __init__( + self, + *, + value: List["OfficeConsent"], + **kwargs + ): + super(OfficeConsentList, self).__init__(**kwargs) + self.next_link = None + self.value = value + + +class OfficeDataConnector(DataConnector): + """Represents office data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'OfficeDataConnectorDataTypes'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "DataConnectorKindEnum"]] = None, + tenant_id: Optional[str] = None, + data_types: Optional["OfficeDataConnectorDataTypes"] = None, + **kwargs + ): + super(OfficeDataConnector, self).__init__(kind=kind, **kwargs) + self.tenant_id = tenant_id + self.data_types = data_types + + +class OfficeDataConnectorDataTypes(msrest.serialization.Model): + """The available data types for office data connector. + + :param exchange: Exchange data type connection. + :type exchange: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesExchange + :param share_point: SharePoint data type connection. + :type share_point: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesSharePoint + """ + + _attribute_map = { + 'exchange': {'key': 'exchange', 'type': 'OfficeDataConnectorDataTypesExchange'}, + 'share_point': {'key': 'sharePoint', 'type': 'OfficeDataConnectorDataTypesSharePoint'}, + } + + def __init__( + self, + *, + exchange: Optional["OfficeDataConnectorDataTypesExchange"] = None, + share_point: Optional["OfficeDataConnectorDataTypesSharePoint"] = None, + **kwargs + ): + super(OfficeDataConnectorDataTypes, self).__init__(**kwargs) + self.exchange = exchange + self.share_point = share_point + + +class OfficeDataConnectorDataTypesExchange(DataConnectorDataTypeCommon): + """Exchange data type connection. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "DataTypeState"]] = None, + **kwargs + ): + super(OfficeDataConnectorDataTypesExchange, self).__init__(state=state, **kwargs) + + +class OfficeDataConnectorDataTypesSharePoint(DataConnectorDataTypeCommon): + """SharePoint data type connection. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "DataTypeState"]] = None, + **kwargs + ): + super(OfficeDataConnectorDataTypesSharePoint, self).__init__(state=state, **kwargs) + + +class OfficeDataConnectorProperties(DataConnectorTenantId): + """Office data connector properties. + + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'data_types': {'key': 'dataTypes', 'type': 'OfficeDataConnectorDataTypes'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + data_types: Optional["OfficeDataConnectorDataTypes"] = None, + **kwargs + ): + super(OfficeDataConnectorProperties, self).__init__(tenant_id=tenant_id, **kwargs) + self.data_types = data_types + + +class Operation(msrest.serialization.Model): + """Operation provided by provider. + + :param display: Properties of the operation. + :type display: ~azure.mgmt.securityinsight.models.OperationDisplay + :param name: Name of the operation. + :type name: str + """ + + _attribute_map = { + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + name: Optional[str] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.display = display + self.name = name + + +class OperationDisplay(msrest.serialization.Model): + """Properties of the operation. + + :param description: Description of the operation. + :type description: str + :param operation: Operation name. + :type operation: str + :param provider: Provider name. + :type provider: str + :param resource: Resource name. + :type resource: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + operation: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.description = description + self.operation = operation + self.provider = provider + self.resource = resource + + +class OperationsList(msrest.serialization.Model): + """Lists the operations available in the SecurityInsights RP. + + All required parameters must be populated in order to send to Azure. + + :param next_link: URL to fetch the next set of operations. + :type next_link: str + :param value: Required. Array of operations. + :type value: list[~azure.mgmt.securityinsight.models.Operation] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + } + + def __init__( + self, + *, + value: List["Operation"], + next_link: Optional[str] = None, + **kwargs + ): + super(OperationsList, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class ScheduledAlertRule(AlertRule): + """Represents scheduled alert rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param query: The query that creates alerts for this rule. + :type query: str + :param query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :type query_frequency: ~datetime.timedelta + :param query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :type query_period: ~datetime.timedelta + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param trigger_operator: The operation against the threshold that triggers alert rule. Possible + values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :type trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :param trigger_threshold: The threshold triggers this alert rule. + :type trigger_threshold: int + :param alert_rule_template_name: The Name of the alert rule template used to create this rule. + :type alert_rule_template_name: str + :param description: The description of the alert rule. + :type description: str + :param display_name: The display name for alerts created by this alert rule. + :type display_name: str + :param enabled: Determines whether this alert rule is enabled or disabled. + :type enabled: bool + :ivar last_modified_utc: The last time that this alert rule has been modified. + :vartype last_modified_utc: ~datetime.datetime + :param suppression_duration: The suppression (in ISO 8601 duration format) to wait since last + time this alert rule been triggered. + :type suppression_duration: ~datetime.timedelta + :param suppression_enabled: Determines whether the suppression for this alert rule is enabled + or disabled. + :type suppression_enabled: bool + :param tactics: The tactics of the alert rule. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'kind': {'required': True}, + 'last_modified_utc': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'query': {'key': 'properties.query', 'type': 'str'}, + 'query_frequency': {'key': 'properties.queryFrequency', 'type': 'duration'}, + 'query_period': {'key': 'properties.queryPeriod', 'type': 'duration'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'trigger_operator': {'key': 'properties.triggerOperator', 'type': 'str'}, + 'trigger_threshold': {'key': 'properties.triggerThreshold', 'type': 'int'}, + 'alert_rule_template_name': {'key': 'properties.alertRuleTemplateName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'last_modified_utc': {'key': 'properties.lastModifiedUtc', 'type': 'iso-8601'}, + 'suppression_duration': {'key': 'properties.suppressionDuration', 'type': 'duration'}, + 'suppression_enabled': {'key': 'properties.suppressionEnabled', 'type': 'bool'}, + 'tactics': {'key': 'properties.tactics', 'type': '[str]'}, + } + + def __init__( + self, + *, + kind: Union[str, "AlertRuleKindEnum"], + query: Optional[str] = None, + query_frequency: Optional[datetime.timedelta] = None, + query_period: Optional[datetime.timedelta] = None, + severity: Optional[Union[str, "AlertSeverity"]] = None, + trigger_operator: Optional[Union[str, "TriggerOperator"]] = None, + trigger_threshold: Optional[int] = None, + alert_rule_template_name: Optional[str] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + enabled: Optional[bool] = None, + suppression_duration: Optional[datetime.timedelta] = None, + suppression_enabled: Optional[bool] = None, + tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + **kwargs + ): + super(ScheduledAlertRule, self).__init__(kind=kind, **kwargs) + self.query = query + self.query_frequency = query_frequency + self.query_period = query_period + self.severity = severity + self.trigger_operator = trigger_operator + self.trigger_threshold = trigger_threshold + self.alert_rule_template_name = alert_rule_template_name + self.description = description + self.display_name = display_name + self.enabled = enabled + self.last_modified_utc = None + self.suppression_duration = suppression_duration + self.suppression_enabled = suppression_enabled + self.tactics = tactics + + +class ScheduledAlertRuleCommonProperties(msrest.serialization.Model): + """Schedule alert rule template property bag. + + :param query: The query that creates alerts for this rule. + :type query: str + :param query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :type query_frequency: ~datetime.timedelta + :param query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :type query_period: ~datetime.timedelta + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param trigger_operator: The operation against the threshold that triggers alert rule. Possible + values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :type trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :param trigger_threshold: The threshold triggers this alert rule. + :type trigger_threshold: int + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'query_frequency': {'key': 'queryFrequency', 'type': 'duration'}, + 'query_period': {'key': 'queryPeriod', 'type': 'duration'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'trigger_operator': {'key': 'triggerOperator', 'type': 'str'}, + 'trigger_threshold': {'key': 'triggerThreshold', 'type': 'int'}, + } + + def __init__( + self, + *, + query: Optional[str] = None, + query_frequency: Optional[datetime.timedelta] = None, + query_period: Optional[datetime.timedelta] = None, + severity: Optional[Union[str, "AlertSeverity"]] = None, + trigger_operator: Optional[Union[str, "TriggerOperator"]] = None, + trigger_threshold: Optional[int] = None, + **kwargs + ): + super(ScheduledAlertRuleCommonProperties, self).__init__(**kwargs) + self.query = query + self.query_frequency = query_frequency + self.query_period = query_period + self.severity = severity + self.trigger_operator = trigger_operator + self.trigger_threshold = trigger_threshold + + +class ScheduledAlertRuleProperties(ScheduledAlertRuleCommonProperties): + """Scheduled alert rule base property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param query: The query that creates alerts for this rule. + :type query: str + :param query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :type query_frequency: ~datetime.timedelta + :param query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :type query_period: ~datetime.timedelta + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param trigger_operator: The operation against the threshold that triggers alert rule. Possible + values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :type trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :param trigger_threshold: The threshold triggers this alert rule. + :type trigger_threshold: int + :param alert_rule_template_name: The Name of the alert rule template used to create this rule. + :type alert_rule_template_name: str + :param description: The description of the alert rule. + :type description: str + :param display_name: Required. The display name for alerts created by this alert rule. + :type display_name: str + :param enabled: Required. Determines whether this alert rule is enabled or disabled. + :type enabled: bool + :ivar last_modified_utc: The last time that this alert rule has been modified. + :vartype last_modified_utc: ~datetime.datetime + :param suppression_duration: Required. The suppression (in ISO 8601 duration format) to wait + since last time this alert rule been triggered. + :type suppression_duration: ~datetime.timedelta + :param suppression_enabled: Required. Determines whether the suppression for this alert rule is + enabled or disabled. + :type suppression_enabled: bool + :param tactics: The tactics of the alert rule. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'display_name': {'required': True}, + 'enabled': {'required': True}, + 'last_modified_utc': {'readonly': True}, + 'suppression_duration': {'required': True}, + 'suppression_enabled': {'required': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'query_frequency': {'key': 'queryFrequency', 'type': 'duration'}, + 'query_period': {'key': 'queryPeriod', 'type': 'duration'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'trigger_operator': {'key': 'triggerOperator', 'type': 'str'}, + 'trigger_threshold': {'key': 'triggerThreshold', 'type': 'int'}, + 'alert_rule_template_name': {'key': 'alertRuleTemplateName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'last_modified_utc': {'key': 'lastModifiedUtc', 'type': 'iso-8601'}, + 'suppression_duration': {'key': 'suppressionDuration', 'type': 'duration'}, + 'suppression_enabled': {'key': 'suppressionEnabled', 'type': 'bool'}, + 'tactics': {'key': 'tactics', 'type': '[str]'}, + } + + def __init__( + self, + *, + display_name: str, + enabled: bool, + suppression_duration: datetime.timedelta, + suppression_enabled: bool, + query: Optional[str] = None, + query_frequency: Optional[datetime.timedelta] = None, + query_period: Optional[datetime.timedelta] = None, + severity: Optional[Union[str, "AlertSeverity"]] = None, + trigger_operator: Optional[Union[str, "TriggerOperator"]] = None, + trigger_threshold: Optional[int] = None, + alert_rule_template_name: Optional[str] = None, + description: Optional[str] = None, + tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + **kwargs + ): + super(ScheduledAlertRuleProperties, self).__init__(query=query, query_frequency=query_frequency, query_period=query_period, severity=severity, trigger_operator=trigger_operator, trigger_threshold=trigger_threshold, **kwargs) + self.alert_rule_template_name = alert_rule_template_name + self.description = description + self.display_name = display_name + self.enabled = enabled + self.last_modified_utc = None + self.suppression_duration = suppression_duration + self.suppression_enabled = suppression_enabled + self.tactics = tactics + + +class ScheduledAlertRuleTemplate(AlertRuleTemplate): + """Represents scheduled alert rule template. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. The kind of the alert rule. Possible values include: "Scheduled", + "MicrosoftSecurityIncidentCreation", "Fusion". + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :type alert_rules_created_by_template_count: int + :ivar created_date_utc: The time that this alert rule template has been added. + :vartype created_date_utc: ~datetime.datetime + :param description: The description of the alert rule template. + :type description: str + :param display_name: The display name for alert rule template. + :type display_name: str + :param required_data_connectors: The required data connectors for this template. + :type required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :param status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :type status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :param query: The query that creates alerts for this rule. + :type query: str + :param query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :type query_frequency: ~datetime.timedelta + :param query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :type query_period: ~datetime.timedelta + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param trigger_operator: The operation against the threshold that triggers alert rule. Possible + values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :type trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :param trigger_threshold: The threshold triggers this alert rule. + :type trigger_threshold: int + :param tactics: The tactics of the alert rule template. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _validation = { + 'kind': {'required': True}, + 'created_date_utc': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'alert_rules_created_by_template_count': {'key': 'properties.alertRulesCreatedByTemplateCount', 'type': 'int'}, + 'created_date_utc': {'key': 'properties.createdDateUTC', 'type': 'iso-8601'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'required_data_connectors': {'key': 'properties.requiredDataConnectors', 'type': '[AlertRuleTemplateDataSource]'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'query': {'key': 'properties.query', 'type': 'str'}, + 'query_frequency': {'key': 'properties.queryFrequency', 'type': 'duration'}, + 'query_period': {'key': 'properties.queryPeriod', 'type': 'duration'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'trigger_operator': {'key': 'properties.triggerOperator', 'type': 'str'}, + 'trigger_threshold': {'key': 'properties.triggerThreshold', 'type': 'int'}, + 'tactics': {'key': 'properties.tactics', 'type': '[str]'}, + } + + def __init__( + self, + *, + kind: Union[str, "AlertRuleKindEnum"], + alert_rules_created_by_template_count: Optional[int] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "TemplateStatus"]] = None, + query: Optional[str] = None, + query_frequency: Optional[datetime.timedelta] = None, + query_period: Optional[datetime.timedelta] = None, + severity: Optional[Union[str, "AlertSeverity"]] = None, + trigger_operator: Optional[Union[str, "TriggerOperator"]] = None, + trigger_threshold: Optional[int] = None, + tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + **kwargs + ): + super(ScheduledAlertRuleTemplate, self).__init__(kind=kind, **kwargs) + self.alert_rules_created_by_template_count = alert_rules_created_by_template_count + self.created_date_utc = None + self.description = description + self.display_name = display_name + self.required_data_connectors = required_data_connectors + self.status = status + self.query = query + self.query_frequency = query_frequency + self.query_period = query_period + self.severity = severity + self.trigger_operator = trigger_operator + self.trigger_threshold = trigger_threshold + self.tactics = tactics + + +class ScheduledAlertRuleTemplateProperties(ScheduledAlertRuleCommonProperties): + """Scheduled alert rule template properties. + + :param query: The query that creates alerts for this rule. + :type query: str + :param query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :type query_frequency: ~datetime.timedelta + :param query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :type query_period: ~datetime.timedelta + :param severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :param trigger_operator: The operation against the threshold that triggers alert rule. Possible + values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :type trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :param trigger_threshold: The threshold triggers this alert rule. + :type trigger_threshold: int + :param tactics: The tactics of the alert rule template. + :type tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'query_frequency': {'key': 'queryFrequency', 'type': 'duration'}, + 'query_period': {'key': 'queryPeriod', 'type': 'duration'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'trigger_operator': {'key': 'triggerOperator', 'type': 'str'}, + 'trigger_threshold': {'key': 'triggerThreshold', 'type': 'int'}, + 'tactics': {'key': 'tactics', 'type': '[str]'}, + } + + def __init__( + self, + *, + query: Optional[str] = None, + query_frequency: Optional[datetime.timedelta] = None, + query_period: Optional[datetime.timedelta] = None, + severity: Optional[Union[str, "AlertSeverity"]] = None, + trigger_operator: Optional[Union[str, "TriggerOperator"]] = None, + trigger_threshold: Optional[int] = None, + tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + **kwargs + ): + super(ScheduledAlertRuleTemplateProperties, self).__init__(query=query, query_frequency=query_frequency, query_period=query_period, severity=severity, trigger_operator=trigger_operator, trigger_threshold=trigger_threshold, **kwargs) + self.tactics = tactics + + +class SettingsKind(msrest.serialization.Model): + """Describes an Azure resource with kind. + + :param kind: The kind of the setting. Possible values include: "UebaSettings", + "ToggleSettings". + :type kind: str or ~azure.mgmt.securityinsight.models.SettingKind + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "SettingKind"]] = None, + **kwargs + ): + super(SettingsKind, self).__init__(**kwargs) + self.kind = kind + + +class Settings(SettingsKind): + """The Setting. + + :param kind: The kind of the setting. Possible values include: "UebaSettings", + "ToggleSettings". + :type kind: str or ~azure.mgmt.securityinsight.models.SettingKind + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "SettingKind"]] = None, + **kwargs + ): + super(Settings, self).__init__(kind=kind, **kwargs) + + +class ThreatIntelligence(msrest.serialization.Model): + """ThreatIntelligence property bag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar confidence: Confidence (must be between 0 and 1). + :vartype confidence: float + :ivar provider_name: Name of the provider from whom this Threat Intelligence information was + received. + :vartype provider_name: str + :ivar report_link: Report link. + :vartype report_link: str + :ivar threat_description: Threat description (free text). + :vartype threat_description: str + :ivar threat_name: Threat name (e.g. "Jedobot malware"). + :vartype threat_name: str + :ivar threat_type: Threat type (e.g. "Botnet"). + :vartype threat_type: str + """ + + _validation = { + 'confidence': {'readonly': True}, + 'provider_name': {'readonly': True}, + 'report_link': {'readonly': True}, + 'threat_description': {'readonly': True}, + 'threat_name': {'readonly': True}, + 'threat_type': {'readonly': True}, + } + + _attribute_map = { + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'provider_name': {'key': 'providerName', 'type': 'str'}, + 'report_link': {'key': 'reportLink', 'type': 'str'}, + 'threat_description': {'key': 'threatDescription', 'type': 'str'}, + 'threat_name': {'key': 'threatName', 'type': 'str'}, + 'threat_type': {'key': 'threatType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ThreatIntelligence, self).__init__(**kwargs) + self.confidence = None + self.provider_name = None + self.report_link = None + self.threat_description = None + self.threat_name = None + self.threat_type = None + + +class TiDataConnector(DataConnector): + """Represents threat intelligence data connector. + + :param kind: The kind of the data connector. Possible values include: "AzureActiveDirectory", + "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", + "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", + "MicrosoftDefenderAdvancedThreatProtection". + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.TiDataConnectorDataTypes + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'data_types': {'key': 'properties.dataTypes', 'type': 'TiDataConnectorDataTypes'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "DataConnectorKindEnum"]] = None, + tenant_id: Optional[str] = None, + data_types: Optional["TiDataConnectorDataTypes"] = None, + **kwargs + ): + super(TiDataConnector, self).__init__(kind=kind, **kwargs) + self.tenant_id = tenant_id + self.data_types = data_types + + +class TiDataConnectorDataTypes(msrest.serialization.Model): + """The available data types for TI (Threat Intelligence) data connector. + + :param indicators: Data type for indicators connection. + :type indicators: ~azure.mgmt.securityinsight.models.TiDataConnectorDataTypesIndicators + """ + + _attribute_map = { + 'indicators': {'key': 'indicators', 'type': 'TiDataConnectorDataTypesIndicators'}, + } + + def __init__( + self, + *, + indicators: Optional["TiDataConnectorDataTypesIndicators"] = None, + **kwargs + ): + super(TiDataConnectorDataTypes, self).__init__(**kwargs) + self.indicators = indicators + + +class TiDataConnectorDataTypesIndicators(DataConnectorDataTypeCommon): + """Data type for indicators connection. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "DataTypeState"]] = None, + **kwargs + ): + super(TiDataConnectorDataTypesIndicators, self).__init__(state=state, **kwargs) + + +class TiDataConnectorProperties(DataConnectorTenantId): + """TI (Threat Intelligence) data connector properties. + + :param tenant_id: The tenant id to connect to, and get the data from. + :type tenant_id: str + :param data_types: The available data types for the connector. + :type data_types: ~azure.mgmt.securityinsight.models.TiDataConnectorDataTypes + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'data_types': {'key': 'dataTypes', 'type': 'TiDataConnectorDataTypes'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + data_types: Optional["TiDataConnectorDataTypes"] = None, + **kwargs + ): + super(TiDataConnectorProperties, self).__init__(tenant_id=tenant_id, **kwargs) + self.data_types = data_types + + +class ToggleSettings(Settings): + """Settings with single toggle. + + :param kind: The kind of the setting. Possible values include: "UebaSettings", + "ToggleSettings". + :type kind: str or ~azure.mgmt.securityinsight.models.SettingKind + :param is_enabled: Determines whether the setting is enable or disabled. + :type is_enabled: bool + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "SettingKind"]] = None, + is_enabled: Optional[bool] = None, + **kwargs + ): + super(ToggleSettings, self).__init__(kind=kind, **kwargs) + self.is_enabled = is_enabled + + +class UebaSettings(Settings): + """Represents settings for User and Entity Behavior Analytics enablement. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param kind: The kind of the setting. Possible values include: "UebaSettings", + "ToggleSettings". + :type kind: str or ~azure.mgmt.securityinsight.models.SettingKind + :ivar atp_license_status: Determines whether the tenant has ATP (Advanced Threat Protection) + license. Possible values include: "Enabled", "Disabled". + :vartype atp_license_status: str or ~azure.mgmt.securityinsight.models.LicenseStatus + :param is_enabled: Determines whether User and Entity Behavior Analytics is enabled for this + workspace. + :type is_enabled: bool + :ivar status_in_mcas: Determines whether User and Entity Behavior Analytics is enabled from + MCAS (Microsoft Cloud App Security). Possible values include: "Enabled", "Disabled". + :vartype status_in_mcas: str or ~azure.mgmt.securityinsight.models.StatusInMcas + """ + + _validation = { + 'atp_license_status': {'readonly': True}, + 'status_in_mcas': {'readonly': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'atp_license_status': {'key': 'properties.atpLicenseStatus', 'type': 'str'}, + 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'status_in_mcas': {'key': 'properties.statusInMcas', 'type': 'str'}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "SettingKind"]] = None, + is_enabled: Optional[bool] = None, + **kwargs + ): + super(UebaSettings, self).__init__(kind=kind, **kwargs) + self.atp_license_status = None + self.is_enabled = is_enabled + self.status_in_mcas = None + + +class UserInfo(msrest.serialization.Model): + """User information that made some action. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar email: The email of the user. + :vartype email: str + :ivar name: The name of the user. + :vartype name: str + :param object_id: Required. The object id of the user. + :type object_id: str + """ + + _validation = { + 'email': {'readonly': True}, + 'name': {'readonly': True}, + 'object_id': {'required': True}, + } + + _attribute_map = { + 'email': {'key': 'email', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + } + + def __init__( + self, + *, + object_id: str, + **kwargs + ): + super(UserInfo, self).__init__(**kwargs) + self.email = None + self.name = None + self.object_id = object_id diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/_security_insights_enums.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/_security_insights_enums.py new file mode 100644 index 00000000000..330604e2bcc --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/models/_security_insights_enums.py @@ -0,0 +1,194 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + +class AlertRuleKindEnum(str, Enum): + """The kind of the alert rule + """ + + scheduled = "Scheduled" + microsoft_security_incident_creation = "MicrosoftSecurityIncidentCreation" + fusion = "Fusion" + +class AlertSeverity(str, Enum): + """The severity of the alert + """ + + high = "High" #: High severity. + medium = "Medium" #: Medium severity. + low = "Low" #: Low severity. + informational = "Informational" #: Informational severity. + +class AttackTactic(str, Enum): + """The severity for alerts created by this alert rule. + """ + + initial_access = "InitialAccess" + execution = "Execution" + persistence = "Persistence" + privilege_escalation = "PrivilegeEscalation" + defense_evasion = "DefenseEvasion" + credential_access = "CredentialAccess" + discovery = "Discovery" + lateral_movement = "LateralMovement" + collection = "Collection" + exfiltration = "Exfiltration" + command_and_control = "CommandAndControl" + impact = "Impact" + +class CaseSeverity(str, Enum): + """The severity of the incident + """ + + critical = "Critical" #: Critical severity. + high = "High" #: High severity. + medium = "Medium" #: Medium severity. + low = "Low" #: Low severity. + informational = "Informational" #: Informational severity. + +class DataConnectorKindEnum(str, Enum): + """The kind of the data connector + """ + + azure_active_directory = "AzureActiveDirectory" + azure_security_center = "AzureSecurityCenter" + microsoft_cloud_app_security = "MicrosoftCloudAppSecurity" + threat_intelligence = "ThreatIntelligence" + office365 = "Office365" + amazon_web_services_cloud_trail = "AmazonWebServicesCloudTrail" + azure_advanced_threat_protection = "AzureAdvancedThreatProtection" + microsoft_defender_advanced_threat_protection = "MicrosoftDefenderAdvancedThreatProtection" + +class DataTypeState(str, Enum): + """Describe whether this data type connection is enabled or not. + """ + + enabled = "Enabled" + disabled = "Disabled" + +class EntitiesMatchingMethod(str, Enum): + """Grouping matching method + """ + + all = "All" #: Grouping alerts into a single incident if all the entities match. + none = "None" #: Grouping all alerts triggered by this rule into a single incident. + custom = "Custom" #: Grouping alerts into a single incident if the selected entities match. + +class EntityKindEnum(str, Enum): + """The kind of the entity + """ + + account = "Account" #: Entity represents account in the system. + host = "Host" #: Entity represents host in the system. + file = "File" #: Entity represents file in the system. + azure_resource = "AzureResource" #: Entity represents azure resource in the system. + cloud_application = "CloudApplication" #: Entity represents cloud application in the system. + dns_resolution = "DnsResolution" #: Entity represents dns resolution in the system. + file_hash = "FileHash" #: Entity represents file hash in the system. + ip = "Ip" #: Entity represents ip in the system. + malware = "Malware" #: Entity represents malware in the system. + process = "Process" #: Entity represents process in the system. + registry_key = "RegistryKey" #: Entity represents registry key in the system. + registry_value = "RegistryValue" #: Entity represents registry value in the system. + security_group = "SecurityGroup" #: Entity represents security group in the system. + url = "Url" #: Entity represents url in the system. + io_t_device = "IoTDevice" #: Entity represents IoT device in the system. + security_alert = "SecurityAlert" #: Entity represents security alert in the system. + bookmark = "Bookmark" #: Entity represents bookmark in the system. + +class GroupingEntityType(str, Enum): + """Grouping entity type + """ + + account = "Account" #: Account entity. + host = "Host" #: Host entity. + ip = "Ip" #: Ip entity. + url = "Url" #: Url entity. + +class IncidentClassification(str, Enum): + """The reason the incident was closed + """ + + undetermined = "Undetermined" #: Incident classification was undetermined. + true_positive = "TruePositive" #: Incident was true positive. + benign_positive = "BenignPositive" #: Incident was benign positive. + false_positive = "FalsePositive" #: Incident was false positive. + +class IncidentLabelType(str, Enum): + """The type of the label + """ + + user = "User" #: Label manually created by a user. + system = "System" #: Label automatically created by the system. + +class IncidentSeverity(str, Enum): + """The severity of the incident + """ + + high = "High" #: High severity. + medium = "Medium" #: Medium severity. + low = "Low" #: Low severity. + informational = "Informational" #: Informational severity. + +class IncidentStatus(str, Enum): + """The status of the incident + """ + + new = "New" #: An active incident which isn't being handled currently. + active = "Active" #: An active incident which is being handled. + closed = "Closed" #: A non-active incident. + +class LicenseStatus(str, Enum): + """Determines whether the tenant has ATP (Advanced Threat Protection) license. + """ + + enabled = "Enabled" + disabled = "Disabled" + +class MicrosoftSecurityProductName(str, Enum): + """The alerts' productName on which the cases will be generated + """ + + microsoft_cloud_app_security = "Microsoft Cloud App Security" + azure_security_center = "Azure Security Center" + azure_advanced_threat_protection = "Azure Advanced Threat Protection" + azure_active_directory_identity_protection = "Azure Active Directory Identity Protection" + azure_security_center_for_io_t = "Azure Security Center for IoT" + +class SettingKind(str, Enum): + """The kind of the setting + """ + + ueba_settings = "UebaSettings" + toggle_settings = "ToggleSettings" + +class StatusInMcas(str, Enum): + """Determines whether User and Entity Behavior Analytics is enabled from MCAS (Microsoft Cloud App + Security). + """ + + enabled = "Enabled" + disabled = "Disabled" + +class TemplateStatus(str, Enum): + """The alert rule template status. + """ + + installed = "Installed" #: Alert rule template installed. and can not use more then once. + available = "Available" #: Alert rule template is available. + not_available = "NotAvailable" #: Alert rule template is not available. + +class TriggerOperator(str, Enum): + """The operation against the threshold that triggers alert rule. + """ + + greater_than = "GreaterThan" + less_than = "LessThan" + equal = "Equal" + not_equal = "NotEqual" diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/__init__.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/__init__.py new file mode 100644 index 00000000000..5e67996dcd4 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/__init__.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operation_operations import OperationOperations +from ._alert_rule_operations import AlertRuleOperations +from ._action_operations import ActionOperations +from ._alert_rule_template_operations import AlertRuleTemplateOperations +from ._bookmark_operations import BookmarkOperations +from ._data_connector_operations import DataConnectorOperations +from ._incident_operations import IncidentOperations +from ._incident_comment_operations import IncidentCommentOperations + +__all__ = [ + 'OperationOperations', + 'AlertRuleOperations', + 'ActionOperations', + 'AlertRuleTemplateOperations', + 'BookmarkOperations', + 'DataConnectorOperations', + 'IncidentOperations', + 'IncidentCommentOperations', +] diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_action_operations.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_action_operations.py new file mode 100644 index 00000000000..b444742d4d5 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_action_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ActionOperations(object): + """ActionOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_alert_rule( + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ActionsList" + """Gets all actions of alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActionsList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.ActionsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ActionsList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_alert_rule.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ActionsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_alert_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_alert_rule_operations.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_alert_rule_operations.py new file mode 100644 index 00000000000..05f4d3ab736 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_alert_rule_operations.py @@ -0,0 +1,531 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AlertRuleOperations(object): + """AlertRuleOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AlertRulesList" + """Gets all alert rules. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRulesList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.AlertRulesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRulesList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRulesList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules'} + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AlertRule" + """Gets the alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRule or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.AlertRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRule"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} + + def create_or_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_id, # type: str + kind, # type: Union[str, "models.AlertRuleKindEnum"] + etag=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.AlertRule" + """Creates or updates the alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :param kind: The kind of the alert rule. + :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKindEnum + :param etag: Etag of the azure resource. + :type etag: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRule or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.AlertRule or ~azure.mgmt.securityinsight.models.AlertRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRule"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _alert_rule = models.AlertRule(etag=etag, kind=kind) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_alert_rule, 'AlertRule') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AlertRule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AlertRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} + + def delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete the alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} + + def get_action( + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_id, # type: str + action_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ActionResponse" + """Gets the action of alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :param action_id: Action ID. + :type action_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActionResponse or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.ActionResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ActionResponse"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get_action.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'actionId': self._serialize.url("action_id", action_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActionResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} + + def create_or_update_action( + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_id, # type: str + action_id, # type: str + etag=None, # type: Optional[str] + logic_app_resource_id=None, # type: Optional[str] + trigger_uri=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.ActionResponse" + """Creates or updates the action of alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :param action_id: Action ID. + :type action_id: str + :param etag: Etag of the azure resource. + :type etag: str + :param logic_app_resource_id: Logic App Resource Id, /subscriptions/{my- + subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my- + workflow-id}. + :type logic_app_resource_id: str + :param trigger_uri: Logic App Callback URL for this specific workflow. + :type trigger_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActionResponse or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.ActionResponse or ~azure.mgmt.securityinsight.models.ActionResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ActionResponse"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _action = models.ActionRequest(etag=etag, logic_app_resource_id=logic_app_resource_id, trigger_uri=trigger_uri) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update_action.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'actionId': self._serialize.url("action_id", action_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_action, 'ActionRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ActionResponse', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ActionResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} + + def delete_action( + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_id, # type: str + action_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete the action of alert rule. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_id: Alert rule ID. + :type rule_id: str + :param action_id: Action ID. + :type action_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.delete_action.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'actionId': self._serialize.url("action_id", action_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_action.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_alert_rule_template_operations.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_alert_rule_template_operations.py new file mode 100644 index 00000000000..74ad58a85f6 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_alert_rule_template_operations.py @@ -0,0 +1,179 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AlertRuleTemplateOperations(object): + """AlertRuleTemplateOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AlertRuleTemplatesList" + """Gets all alert rule templates. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleTemplatesList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.AlertRuleTemplatesList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleTemplatesList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AlertRuleTemplatesList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates'} + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + alert_rule_template_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.AlertRuleTemplate" + """Gets the alert rule template. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param alert_rule_template_id: Alert rule template ID. + :type alert_rule_template_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AlertRuleTemplate or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.AlertRuleTemplate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleTemplate"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'alertRuleTemplateId': self._serialize.url("alert_rule_template_id", alert_rule_template_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AlertRuleTemplate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_bookmark_operations.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_bookmark_operations.py new file mode 100644 index 00000000000..2a301b32045 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_bookmark_operations.py @@ -0,0 +1,344 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class BookmarkOperations(object): + """BookmarkOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BookmarkList" + """Gets all bookmarks. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BookmarkList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.BookmarkList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BookmarkList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('BookmarkList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks'} + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + bookmark_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Bookmark" + """Gets a bookmark. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param bookmark_id: Bookmark ID. + :type bookmark_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Bookmark or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Bookmark + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Bookmark"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'bookmarkId': self._serialize.url("bookmark_id", bookmark_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Bookmark', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} + + def create_or_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + bookmark_id, # type: str + etag=None, # type: Optional[str] + created=None, # type: Optional[datetime.datetime] + created_by=None, # type: Optional["models.UserInfo"] + display_name=None, # type: Optional[str] + labels=None, # type: Optional[List[str]] + notes=None, # type: Optional[str] + query=None, # type: Optional[str] + query_result=None, # type: Optional[str] + updated=None, # type: Optional[datetime.datetime] + updated_by=None, # type: Optional["models.UserInfo"] + incident_info=None, # type: Optional["models.IncidentInfo"] + **kwargs # type: Any + ): + # type: (...) -> "models.Bookmark" + """Creates or updates the bookmark. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param bookmark_id: Bookmark ID. + :type bookmark_id: str + :param etag: Etag of the azure resource. + :type etag: str + :param created: The time the bookmark was created. + :type created: ~datetime.datetime + :param created_by: Describes a user that created the bookmark. + :type created_by: ~azure.mgmt.securityinsight.models.UserInfo + :param display_name: The display name of the bookmark. + :type display_name: str + :param labels: List of labels relevant to this bookmark. + :type labels: list[str] + :param notes: The notes of the bookmark. + :type notes: str + :param query: The query of the bookmark. + :type query: str + :param query_result: The query result of the bookmark. + :type query_result: str + :param updated: The last time the bookmark was updated. + :type updated: ~datetime.datetime + :param updated_by: Describes a user that updated the bookmark. + :type updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :param incident_info: Describes an incident that relates to bookmark. + :type incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Bookmark or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Bookmark or ~azure.mgmt.securityinsight.models.Bookmark + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Bookmark"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _bookmark = models.Bookmark(etag=etag, created=created, created_by=created_by, display_name=display_name, labels=labels, notes=notes, query=query, query_result=query_result, updated=updated, updated_by=updated_by, incident_info=incident_info) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'bookmarkId': self._serialize.url("bookmark_id", bookmark_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_bookmark, 'Bookmark') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Bookmark', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Bookmark', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} + + def delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + bookmark_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete the bookmark. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param bookmark_id: Bookmark ID. + :type bookmark_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'bookmarkId': self._serialize.url("bookmark_id", bookmark_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_data_connector_operations.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_data_connector_operations.py new file mode 100644 index 00000000000..0b9c9be3b66 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_data_connector_operations.py @@ -0,0 +1,316 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DataConnectorOperations(object): + """DataConnectorOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DataConnectorList" + """Gets all data connectors. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnectorList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnectorList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectorList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataConnectorList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors'} + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + data_connector_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DataConnector" + """Gets a data connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param data_connector_id: Connector ID. + :type data_connector_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnector or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnector + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnector"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'dataConnectorId': self._serialize.url("data_connector_id", data_connector_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataConnector', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} + + def create_or_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + data_connector_id, # type: str + etag=None, # type: Optional[str] + kind=None, # type: Optional[Union[str, "models.DataConnectorKindEnum"]] + **kwargs # type: Any + ): + # type: (...) -> "models.DataConnector" + """Creates or updates the data connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param data_connector_id: Connector ID. + :type data_connector_id: str + :param etag: Etag of the azure resource. + :type etag: str + :param kind: The kind of the data connector. + :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKindEnum + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnector or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.DataConnector or ~azure.mgmt.securityinsight.models.DataConnector + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnector"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _data_connector = models.DataConnector(etag=etag, kind=kind) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'dataConnectorId': self._serialize.url("data_connector_id", data_connector_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_data_connector, 'DataConnector') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DataConnector', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataConnector', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} + + def delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + data_connector_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete the data connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param data_connector_id: Connector ID. + :type data_connector_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'dataConnectorId': self._serialize.url("data_connector_id", data_connector_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_incident_comment_operations.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_incident_comment_operations.py new file mode 100644 index 00000000000..d87634a2530 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_incident_comment_operations.py @@ -0,0 +1,285 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class IncidentCommentOperations(object): + """IncidentCommentOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_incident( + self, + resource_group_name, # type: str + workspace_name, # type: str + incident_id, # type: str + filter=None, # type: Optional[str] + orderby=None, # type: Optional[str] + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.IncidentCommentList" + """Gets all incident comments. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :param filter: Filters the results, based on a Boolean condition. Optional. + :type filter: str + :param orderby: Sorts the results. Optional. + :type orderby: str + :param top: Returns only the first n results. Optional. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IncidentCommentList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.IncidentCommentList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentCommentList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_incident.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IncidentCommentList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_incident.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments'} + + def get_comment( + self, + resource_group_name, # type: str + workspace_name, # type: str + incident_id, # type: str + incident_comment_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.IncidentComment" + """Gets an incident comment. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :param incident_comment_id: Incident comment ID. + :type incident_comment_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IncidentComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.IncidentComment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentComment"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get_comment.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + 'incidentCommentId': self._serialize.url("incident_comment_id", incident_comment_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IncidentComment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_comment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} + + def create_comment( + self, + resource_group_name, # type: str + workspace_name, # type: str + incident_id, # type: str + incident_comment_id, # type: str + message=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.IncidentComment" + """Creates the incident comment. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :param incident_comment_id: Incident comment ID. + :type incident_comment_id: str + :param message: The comment message. + :type message: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IncidentComment or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.IncidentComment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentComment"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _incident_comment = models.IncidentComment(message=message) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_comment.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + 'incidentCommentId': self._serialize.url("incident_comment_id", incident_comment_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_incident_comment, 'IncidentComment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IncidentComment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_comment.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_incident_operations.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_incident_operations.py new file mode 100644 index 00000000000..73b3f9c59e1 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_incident_operations.py @@ -0,0 +1,363 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class IncidentOperations(object): + """IncidentOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + filter=None, # type: Optional[str] + orderby=None, # type: Optional[str] + top=None, # type: Optional[int] + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.IncidentList" + """Gets all incidents. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param filter: Filters the results, based on a Boolean condition. Optional. + :type filter: str + :param orderby: Sorts the results. Optional. + :type orderby: str + :param top: Returns only the first n results. Optional. + :type top: int + :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If + a previous response contains a nextLink element, the value of the nextLink element will include + a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IncidentList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.IncidentList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IncidentList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents'} + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + incident_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Incident" + """Gets an incident. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Incident or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Incident + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Incident"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Incident', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} + + def create_or_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + incident_id, # type: str + etag=None, # type: Optional[str] + classification=None, # type: Optional[Union[str, "models.IncidentClassification"]] + description=None, # type: Optional[str] + first_activity_time_utc=None, # type: Optional[datetime.datetime] + labels=None, # type: Optional[List["IncidentLabel"]] + last_activity_time_utc=None, # type: Optional[datetime.datetime] + owner=None, # type: Optional["models.IncidentOwnerInfo"] + severity=None, # type: Optional[Union[str, "models.IncidentSeverity"]] + status=None, # type: Optional[Union[str, "models.IncidentStatus"]] + title=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.Incident" + """Creates or updates the incident. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :param etag: Etag of the azure resource. + :type etag: str + :param classification: The reason the incident was closed. + :type classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification + :param description: The description of the incident. + :type description: str + :param first_activity_time_utc: The time of the first activity in the incident. + :type first_activity_time_utc: ~datetime.datetime + :param labels: List of labels relevant to this incident. + :type labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + :param last_activity_time_utc: The time of the last activity in the incident. + :type last_activity_time_utc: ~datetime.datetime + :param owner: Describes a user that the incident is assigned to. + :type owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo + :param severity: The severity of the incident. + :type severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :param status: The status of the incident. + :type status: str or ~azure.mgmt.securityinsight.models.IncidentStatus + :param title: The title of the incident. + :type title: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Incident or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.Incident or ~azure.mgmt.securityinsight.models.Incident + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Incident"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _incident = models.Incident(etag=etag, classification=classification, description=description, first_activity_time_utc=first_activity_time_utc, labels=labels, last_activity_time_utc=last_activity_time_utc, owner=owner, severity=severity, status=status, title=title) + api_version = "2020-01-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_incident, 'Incident') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Incident', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Incident', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} + + def delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + incident_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete the incident. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param incident_id: Incident ID. + :type incident_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + 'incidentId': self._serialize.url("incident_id", incident_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_operation_operations.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_operation_operations.py new file mode 100644 index 00000000000..74578bcddda --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/operations/_operation_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations(object): + """OperationOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.securityinsight.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.OperationsList" + """Lists all operations available Azure Security Insights Resource Provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationsList or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.OperationsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationsList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-01-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.SecurityInsights/operations'} diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/py.typed b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/setup.py b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/setup.py new file mode 100644 index 00000000000..bea0f79ea86 --- /dev/null +++ b/src/securityinsight/azext_sentinel/vendored_sdks/securityinsight/setup.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# coding: utf-8 + +from setuptools import setup, find_packages + +NAME = "securityinsights" +VERSION = "0.1.0" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["msrest>=0.6.0", "azure-core<2.0.0,>=1.2.0"] + +setup( + name=NAME, + version=VERSION, + description="SecurityInsights", + author_email="", + url="", + keywords=["Swagger", "SecurityInsights"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. + """ +) diff --git a/src/securityinsight/report.md b/src/securityinsight/report.md new file mode 100644 index 00000000000..30653dcf851 --- /dev/null +++ b/src/securityinsight/report.md @@ -0,0 +1,286 @@ +# Azure CLI Module Creation Report + +### sentinel action list + +list a sentinel action. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--rule-id**|string|Alert rule ID|rule_id| +### sentinel alert-rule create + +create a sentinel alert-rule. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--rule-id**|string|Alert rule ID|rule_id| +|**--action-id**|string|Action ID|action_id| +|**--kind**|choice|The kind of the alert rule|kind| +|**--etag**|string|Etag of the azure resource|etag| +|**--logic-app-resource-id**|string|Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}.|logic_app_resource_id| +|**--trigger-uri**|string|Logic App Callback URL for this specific workflow.|trigger_uri| +### sentinel alert-rule delete + +delete a sentinel alert-rule. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--rule-id**|string|Alert rule ID|rule_id| +|**--action-id**|string|Action ID|action_id| +### sentinel alert-rule list + +list a sentinel alert-rule. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +### sentinel alert-rule show + +show a sentinel alert-rule. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--rule-id**|string|Alert rule ID|rule_id| +|**--action-id**|string|Action ID|action_id| +### sentinel alert-rule-template list + +list a sentinel alert-rule-template. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +### sentinel alert-rule-template show + +show a sentinel alert-rule-template. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--alert-rule-template-id**|string|Alert rule template ID|alert_rule_template_id| +### sentinel bookmark create + +create a sentinel bookmark. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--bookmark-id**|string|Bookmark ID|bookmark_id| +|**--etag**|string|Etag of the azure resource|etag| +|**--created**|date-time|The time the bookmark was created|created| +|**--created-by**|object|Describes a user that created the bookmark|created_by| +|**--display-name**|string|The display name of the bookmark|display_name| +|**--labels**|array|List of labels relevant to this bookmark|labels| +|**--notes**|string|The notes of the bookmark|notes| +|**--query**|string|The query of the bookmark.|query| +|**--query-result**|string|The query result of the bookmark.|query_result| +|**--updated**|date-time|The last time the bookmark was updated|updated| +|**--updated-by**|object|Describes a user that updated the bookmark|updated_by| +|**--incident-info**|object|Describes an incident that relates to bookmark|incident_info| +### sentinel bookmark delete + +delete a sentinel bookmark. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--bookmark-id**|string|Bookmark ID|bookmark_id| +### sentinel bookmark list + +list a sentinel bookmark. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +### sentinel bookmark show + +show a sentinel bookmark. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--bookmark-id**|string|Bookmark ID|bookmark_id| +### sentinel bookmark update + +create a sentinel bookmark. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--bookmark-id**|string|Bookmark ID|bookmark_id| +|**--etag**|string|Etag of the azure resource|etag| +|**--created**|date-time|The time the bookmark was created|created| +|**--created-by**|object|Describes a user that created the bookmark|created_by| +|**--display-name**|string|The display name of the bookmark|display_name| +|**--labels**|array|List of labels relevant to this bookmark|labels| +|**--notes**|string|The notes of the bookmark|notes| +|**--query**|string|The query of the bookmark.|query| +|**--query-result**|string|The query result of the bookmark.|query_result| +|**--updated**|date-time|The last time the bookmark was updated|updated| +|**--updated-by**|object|Describes a user that updated the bookmark|updated_by| +|**--incident-info**|object|Describes an incident that relates to bookmark|incident_info| +### sentinel data-connector create + +create a sentinel data-connector. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--data-connector-id**|string|Connector ID|data_connector_id| +|**--etag**|string|Etag of the azure resource|etag| +|**--kind**|choice|The kind of the data connector|kind| +### sentinel data-connector delete + +delete a sentinel data-connector. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--data-connector-id**|string|Connector ID|data_connector_id| +### sentinel data-connector list + +list a sentinel data-connector. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +### sentinel data-connector show + +show a sentinel data-connector. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--data-connector-id**|string|Connector ID|data_connector_id| +### sentinel data-connector update + +create a sentinel data-connector. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--data-connector-id**|string|Connector ID|data_connector_id| +|**--etag**|string|Etag of the azure resource|etag| +|**--kind**|choice|The kind of the data connector|kind| +### sentinel incident create + +create a sentinel incident. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--incident-id**|string|Incident ID|incident_id| +|**--etag**|string|Etag of the azure resource|etag| +|**--classification**|choice|The reason the incident was closed|classification| +|**--description**|string|The description of the incident|description| +|**--first-activity-time-utc**|date-time|The time of the first activity in the incident|first_activity_time_utc| +|**--labels**|array|List of labels relevant to this incident|labels| +|**--last-activity-time-utc**|date-time|The time of the last activity in the incident|last_activity_time_utc| +|**--owner**|object|Describes a user that the incident is assigned to|owner| +|**--severity**|choice|The severity of the incident|severity| +|**--status**|choice|The status of the incident|status| +|**--title**|string|The title of the incident|title| +### sentinel incident delete + +delete a sentinel incident. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--incident-id**|string|Incident ID|incident_id| +### sentinel incident list + +list a sentinel incident. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--filter**|string|Filters the results, based on a Boolean condition. Optional.|filter| +|**--orderby**|string|Sorts the results. Optional.|orderby| +|**--top**|integer|Returns only the first n results. Optional.|top| +|**--skip-token**|string|Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional.|skip_token| +### sentinel incident show + +show a sentinel incident. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--incident-id**|string|Incident ID|incident_id| +### sentinel incident update + +create a sentinel incident. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--incident-id**|string|Incident ID|incident_id| +|**--etag**|string|Etag of the azure resource|etag| +|**--classification**|choice|The reason the incident was closed|classification| +|**--description**|string|The description of the incident|description| +|**--first-activity-time-utc**|date-time|The time of the first activity in the incident|first_activity_time_utc| +|**--labels**|array|List of labels relevant to this incident|labels| +|**--last-activity-time-utc**|date-time|The time of the last activity in the incident|last_activity_time_utc| +|**--owner**|object|Describes a user that the incident is assigned to|owner| +|**--severity**|choice|The severity of the incident|severity| +|**--status**|choice|The status of the incident|status| +|**--title**|string|The title of the incident|title| +### sentinel incident-comment create + +create a sentinel incident-comment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--incident-id**|string|Incident ID|incident_id| +|**--incident-comment-id**|string|Incident comment ID|incident_comment_id| +|**--message**|string|The comment message|message| +### sentinel incident-comment list + +list a sentinel incident-comment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--incident-id**|string|Incident ID|incident_id| +|**--filter**|string|Filters the results, based on a Boolean condition. Optional.|filter| +|**--orderby**|string|Sorts the results. Optional.|orderby| +|**--top**|integer|Returns only the first n results. Optional.|top| +|**--skip-token**|string|Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional.|skip_token| +### sentinel incident-comment show + +show a sentinel incident-comment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group within the user's subscription. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace.|workspace_name| +|**--incident-id**|string|Incident ID|incident_id| +|**--incident-comment-id**|string|Incident comment ID|incident_comment_id| \ No newline at end of file diff --git a/src/securityinsight/setup.cfg b/src/securityinsight/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/securityinsight/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/securityinsight/setup.py b/src/securityinsight/setup.py new file mode 100644 index 00000000000..9ef732ad40e --- /dev/null +++ b/src/securityinsight/setup.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# TODO: Confirm this is the right version number you want and it matches your +# HISTORY.rst entry. +VERSION = '0.1.0' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +# TODO: Add any additional SDK dependencies here +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='sentinel', + version=VERSION, + description='Microsoft Azure Command-Line Tools SecurityInsights Extension', + # TODO: Update author and email, if applicable + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + # TODO: consider pointing directly to your source code instead of the generic repo + url='https://github.com/Azure/azure-cli-extensions', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_sentinel': ['azext_metadata.json']}, +)