From fe6b52d3c6461da1a8cc18baf38de3612092063e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sun, 13 Feb 2022 13:39:02 +0000 Subject: [PATCH] CodeGen from PR 17830 in Azure/azure-rest-api-specs Merge 97da8877e51dbb671fdea76bd5320d87ac24b4d1 into 2e5564984af030a48082619e0551671ef14d30d5 --- .../azure-mgmt-securityinsight/_meta.json | 11 + .../azure/mgmt/securityinsight/__init__.py | 9 +- .../mgmt/securityinsight/_configuration.py | 19 +- .../azure/mgmt/securityinsight/_metadata.json | 80 +- .../azure/mgmt/securityinsight/_patch.py | 31 + .../securityinsight/_security_insights.py | 100 +- .../azure/mgmt/securityinsight/_vendor.py | 27 + .../mgmt/securityinsight/aio/__init__.py | 5 + .../securityinsight/aio/_configuration.py | 6 +- .../azure/mgmt/securityinsight/aio/_patch.py | 31 + .../securityinsight/aio/_security_insights.py | 92 +- .../aio/operations/__init__.py | 4 +- .../aio/operations/_actions_operations.py | 259 +- .../_alert_rule_templates_operations.py | 111 +- .../aio/operations/_alert_rules_operations.py | 399 +-- .../aio/operations/_bookmarks_operations.py | 191 +- .../operations/_data_connectors_operations.py | 191 +- .../_incident_comments_operations.py | 184 +- .../aio/operations/_incidents_operations.py | 207 +- .../aio/operations/_operations.py | 55 +- .../mgmt/securityinsight/models/__init__.py | 212 +- .../mgmt/securityinsight/models/_models.py | 2983 ----------------- .../securityinsight/models/_models_py3.py | 1628 ++++++--- .../models/_security_insights_enums.py | 140 +- .../securityinsight/operations/__init__.py | 4 +- .../operations/_actions_operations.py | 435 ++- .../_alert_rule_templates_operations.py | 205 +- .../operations/_alert_rules_operations.py | 596 ++-- .../operations/_bookmarks_operations.py | 385 ++- .../operations/_data_connectors_operations.py | 385 ++- .../_incident_comments_operations.py | 365 +- .../operations/_incidents_operations.py | 422 ++- .../securityinsight/operations/_operations.py | 91 +- 33 files changed, 4227 insertions(+), 5636 deletions(-) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/_meta.json create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_patch.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_vendor.py create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_patch.py delete mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models.py diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json b/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json new file mode 100644 index 000000000000..1113a3c9a20d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "dc8d276f694cad7ea4a0375679c4b1126cb8e330", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/securityinsights/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/securityinsights/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py index ae925bec6b7d..d2ae6403da99 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SecurityInsights'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py index 40de03807af3..6a877710fe77 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class SecurityInsightsConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SecurityInsightsConfiguration, self).__init__(**kwargs) 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 @@ -68,4 +65,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_metadata.json b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_metadata.json index 2c797fe0828e..f75e42915908 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_metadata.json +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_metadata.json @@ -5,35 +5,38 @@ "name": "SecurityInsights", "filename": "_security_insights", "description": "API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, - "has_lro_operations": false + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SecurityInsightsConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SecurityInsightsConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Azure subscription ID.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "Azure subscription ID.", "docstring_type": "str", "required": true @@ -41,27 +44,66 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { - "operations": "Operations", "alert_rules": "AlertRulesOperations", "actions": "ActionsOperations", "alert_rule_templates": "AlertRuleTemplatesOperations", "bookmarks": "BookmarksOperations", "data_connectors": "DataConnectorsOperations", + "operations": "Operations", "incidents": "IncidentsOperations", "incident_comments": "IncidentCommentsOperations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_patch.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py index 8dc3a1848300..686e89ea47bc 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py @@ -6,44 +6,37 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import SecurityInsightsConfiguration +from .operations import ActionsOperations, AlertRuleTemplatesOperations, AlertRulesOperations, BookmarksOperations, DataConnectorsOperations, IncidentCommentsOperations, IncidentsOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential -from ._configuration import SecurityInsightsConfiguration -from .operations import Operations -from .operations import AlertRulesOperations -from .operations import ActionsOperations -from .operations import AlertRuleTemplatesOperations -from .operations import BookmarksOperations -from .operations import DataConnectorsOperations -from .operations import IncidentsOperations -from .operations import IncidentCommentsOperations -from . import models - - -class SecurityInsights(object): +class SecurityInsights: """API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. - :ivar operations: Operations operations - :vartype operations: azure.mgmt.securityinsight.operations.Operations :ivar alert_rules: AlertRulesOperations operations :vartype alert_rules: azure.mgmt.securityinsight.operations.AlertRulesOperations :ivar actions: ActionsOperations operations :vartype actions: azure.mgmt.securityinsight.operations.ActionsOperations :ivar alert_rule_templates: AlertRuleTemplatesOperations operations - :vartype alert_rule_templates: azure.mgmt.securityinsight.operations.AlertRuleTemplatesOperations + :vartype alert_rule_templates: + azure.mgmt.securityinsight.operations.AlertRuleTemplatesOperations :ivar bookmarks: BookmarksOperations operations :vartype bookmarks: azure.mgmt.securityinsight.operations.BookmarksOperations :ivar data_connectors: DataConnectorsOperations operations :vartype data_connectors: azure.mgmt.securityinsight.operations.DataConnectorsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.securityinsight.operations.Operations :ivar incidents: IncidentsOperations operations :vartype incidents: azure.mgmt.securityinsight.operations.IncidentsOperations :ivar incident_comments: IncidentCommentsOperations operations @@ -52,42 +45,59 @@ class SecurityInsights(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ 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) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SecurityInsightsConfiguration(credential=credential, subscription_id=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._serialize.client_side_validation = False + self.alert_rules = AlertRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.actions = ActionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.alert_rule_templates = AlertRuleTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.bookmarks = BookmarksOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_connectors = DataConnectorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.incidents = IncidentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.incident_comments = IncidentCommentsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.alert_rules = AlertRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.actions = ActionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alert_rule_templates = AlertRuleTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bookmarks = BookmarksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_connectors = DataConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.incidents = IncidentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.incident_comments = IncidentCommentsOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_vendor.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py index 17980852599e..56fe86756e38 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py @@ -8,3 +8,8 @@ from ._security_insights import SecurityInsights __all__ = ['SecurityInsights'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py index ca7918b2a5ca..fa2bcbd30415 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SecurityInsightsConfiguration, self).__init__(**kwargs) 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 @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_patch.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py index 672821af5640..f62b83ef71f3 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_security_insights.py @@ -6,85 +6,99 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import SecurityInsightsConfiguration +from .operations import ActionsOperations, AlertRuleTemplatesOperations, AlertRulesOperations, BookmarksOperations, DataConnectorsOperations, IncidentCommentsOperations, IncidentsOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SecurityInsightsConfiguration -from .operations import Operations -from .operations import AlertRulesOperations -from .operations import ActionsOperations -from .operations import AlertRuleTemplatesOperations -from .operations import BookmarksOperations -from .operations import DataConnectorsOperations -from .operations import IncidentsOperations -from .operations import IncidentCommentsOperations -from .. import models - - -class SecurityInsights(object): +class SecurityInsights: """API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. - :ivar operations: Operations operations - :vartype operations: azure.mgmt.securityinsight.aio.operations.Operations :ivar alert_rules: AlertRulesOperations operations :vartype alert_rules: azure.mgmt.securityinsight.aio.operations.AlertRulesOperations :ivar actions: ActionsOperations operations :vartype actions: azure.mgmt.securityinsight.aio.operations.ActionsOperations :ivar alert_rule_templates: AlertRuleTemplatesOperations operations - :vartype alert_rule_templates: azure.mgmt.securityinsight.aio.operations.AlertRuleTemplatesOperations + :vartype alert_rule_templates: + azure.mgmt.securityinsight.aio.operations.AlertRuleTemplatesOperations :ivar bookmarks: BookmarksOperations operations :vartype bookmarks: azure.mgmt.securityinsight.aio.operations.BookmarksOperations :ivar data_connectors: DataConnectorsOperations operations :vartype data_connectors: azure.mgmt.securityinsight.aio.operations.DataConnectorsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.securityinsight.aio.operations.Operations :ivar incidents: IncidentsOperations operations :vartype incidents: azure.mgmt.securityinsight.aio.operations.IncidentsOperations :ivar incident_comments: IncidentCommentsOperations operations - :vartype incident_comments: azure.mgmt.securityinsight.aio.operations.IncidentCommentsOperations + :vartype incident_comments: + azure.mgmt.securityinsight.aio.operations.IncidentCommentsOperations :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 + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = SecurityInsightsConfiguration(credential, subscription_id, **kwargs) + self._config = SecurityInsightsConfiguration(credential=credential, subscription_id=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._serialize.client_side_validation = False + self.alert_rules = AlertRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.actions = ActionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.alert_rule_templates = AlertRuleTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.bookmarks = BookmarksOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_connectors = DataConnectorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.incidents = IncidentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.incident_comments = IncidentCommentsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.alert_rules = AlertRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.actions = ActionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.alert_rule_templates = AlertRuleTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bookmarks = BookmarksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_connectors = DataConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.incidents = IncidentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.incident_comments = IncidentCommentsOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py index f941c6be9526..e6b787caab92 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/__init__.py @@ -6,22 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import Operations from ._alert_rules_operations import AlertRulesOperations from ._actions_operations import ActionsOperations from ._alert_rule_templates_operations import AlertRuleTemplatesOperations from ._bookmarks_operations import BookmarksOperations from ._data_connectors_operations import DataConnectorsOperations +from ._operations import Operations from ._incidents_operations import IncidentsOperations from ._incident_comments_operations import IncidentCommentsOperations __all__ = [ - 'Operations', 'AlertRulesOperations', 'ActionsOperations', 'AlertRuleTemplatesOperations', 'BookmarksOperations', 'DataConnectorsOperations', + 'Operations', 'IncidentsOperations', 'IncidentCommentsOperations', ] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py index 5598d64a5155..355182b92fe7 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_actions_operations.py @@ -5,17 +5,22 @@ # 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, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models - +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._actions_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_alert_rule_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +38,7 @@ class ActionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -41,13 +46,14 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_alert_rule( self, resource_group_name: str, workspace_name: str, rule_id: str, - **kwargs - ) -> AsyncIterable["models.ActionsList"]: + **kwargs: Any + ) -> AsyncIterable["_models.ActionsList"]: """Gets all actions of alert rule. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -62,42 +68,40 @@ def list_by_alert_rule( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.ActionsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_alert_rule.metadata['url'] # type: ignore - 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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_alert_rule_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + template_url=self.list_by_alert_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_alert_rule_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ActionsList', pipeline_response) + deserialized = self._deserialize("ActionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,7 +119,196 @@ async def get_next(next_link=None): 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'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + **kwargs: Any + ) -> "_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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + action_id=action_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + action: "_models.ActionRequest", + **kwargs: Any + ) -> "_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 action: The action. + :type action: ~azure.mgmt.securityinsight.models.ActionRequest + :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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(action, 'ActionRequest') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + action_id=action_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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) + + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + **kwargs: Any + ) -> 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + action_id=action_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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}/actions/{actionId}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py index 959271568235..346e47491e08 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rule_templates_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models - +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._alert_rule_templates_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +38,7 @@ class AlertRuleTemplatesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -41,12 +46,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, workspace_name: str, - **kwargs - ) -> AsyncIterable["models.AlertRuleTemplatesList"]: + **kwargs: Any + ) -> AsyncIterable["_models.AlertRuleTemplatesList"]: """Gets all alert rule templates. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -55,45 +61,44 @@ def list( :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: An iterator like instance of either AlertRuleTemplatesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.AlertRuleTemplatesList] + :return: An iterator like instance of either AlertRuleTemplatesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.AlertRuleTemplatesList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleTemplatesList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleTemplatesList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AlertRuleTemplatesList', pipeline_response) + deserialized = self._deserialize("AlertRuleTemplatesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +116,20 @@ async def get_next(next_link=None): 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'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, alert_rule_template_id: str, - **kwargs - ) -> "models.AlertRuleTemplate": + **kwargs: Any + ) -> "_models.AlertRuleTemplate": """Gets the alert rule template. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -137,33 +144,23 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.AlertRuleTemplate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleTemplate"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleTemplate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + alert_rule_template_id=alert_rule_template_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,4 +174,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py index dc8d482b3bac..21ec7cdd3b45 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models - +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._alert_rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +38,7 @@ class AlertRulesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -41,12 +46,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, workspace_name: str, - **kwargs - ) -> AsyncIterable["models.AlertRulesList"]: + **kwargs: Any + ) -> AsyncIterable["_models.AlertRulesList"]: """Gets all alert rules. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -56,44 +62,42 @@ def list( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AlertRulesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.AlertRulesList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.AlertRulesList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRulesList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRulesList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AlertRulesList', pipeline_response) + deserialized = self._deserialize("AlertRulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +115,20 @@ async def get_next(next_link=None): 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'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, rule_id: str, - **kwargs - ) -> "models.AlertRule": + **kwargs: Any + ) -> "_models.AlertRule": """Gets the alert rule. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -137,33 +143,23 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.AlertRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,16 +173,19 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, workspace_name: str, rule_id: str, - alert_rule: "models.AlertRule", - **kwargs - ) -> "models.AlertRule": + alert_rule: "_models.AlertRule", + **kwargs: Any + ) -> "_models.AlertRule": """Creates or updates the alert rule. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -203,38 +202,28 @@ async def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.AlertRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(alert_rule, 'AlertRule') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -252,14 +241,17 @@ async def create_or_update( 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}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, workspace_name: str, rule_id: str, - **kwargs + **kwargs: Any ) -> None: """Delete the alert rule. @@ -280,28 +272,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -314,212 +296,3 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} # type: ignore - 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 = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get_action.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') - - 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}'} # type: ignore - - async def create_or_update_action( - self, - resource_group_name: str, - workspace_name: str, - rule_id: str, - action_id: str, - action: "models.ActionRequest", - **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 action: The action. - :type action: ~azure.mgmt.securityinsight.models.ActionRequest - :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 = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_action.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') - - 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) - - 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}'} # type: ignore - - 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 = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.delete_action.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') - - 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}'} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py index 618342ea869f..50756f033eea 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmarks_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models - +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._bookmarks_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +38,7 @@ class BookmarksOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -41,12 +46,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, workspace_name: str, - **kwargs - ) -> AsyncIterable["models.BookmarkList"]: + **kwargs: Any + ) -> AsyncIterable["_models.BookmarkList"]: """Gets all bookmarks. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -56,44 +62,42 @@ def list( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BookmarkList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.BookmarkList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.BookmarkList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.BookmarkList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BookmarkList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BookmarkList', pipeline_response) + deserialized = self._deserialize("BookmarkList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +115,20 @@ async def get_next(next_link=None): 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'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, bookmark_id: str, - **kwargs - ) -> "models.Bookmark": + **kwargs: Any + ) -> "_models.Bookmark": """Gets a bookmark. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -137,33 +143,23 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.Bookmark :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Bookmark"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Bookmark"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + bookmark_id=bookmark_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,16 +173,19 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, workspace_name: str, bookmark_id: str, - bookmark: "models.Bookmark", - **kwargs - ) -> "models.Bookmark": + bookmark: "_models.Bookmark", + **kwargs: Any + ) -> "_models.Bookmark": """Creates or updates the bookmark. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -203,38 +202,28 @@ async def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Bookmark :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Bookmark"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Bookmark"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(bookmark, 'Bookmark') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + bookmark_id=bookmark_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -252,14 +241,17 @@ async def create_or_update( 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}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, workspace_name: str, bookmark_id: str, - **kwargs + **kwargs: Any ) -> None: """Delete the bookmark. @@ -280,28 +272,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + bookmark_id=bookmark_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -313,3 +295,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py index e60e929f3ad2..72f442808c2d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models - +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._data_connectors_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +38,7 @@ class DataConnectorsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -41,12 +46,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, workspace_name: str, - **kwargs - ) -> AsyncIterable["models.DataConnectorList"]: + **kwargs: Any + ) -> AsyncIterable["_models.DataConnectorList"]: """Gets all data connectors. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -56,44 +62,42 @@ def list( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataConnectorList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.DataConnectorList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.DataConnectorList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectorList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectorList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataConnectorList', pipeline_response) + deserialized = self._deserialize("DataConnectorList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,18 +115,20 @@ async def get_next(next_link=None): 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'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, data_connector_id: str, - **kwargs - ) -> "models.DataConnector": + **kwargs: Any + ) -> "_models.DataConnector": """Gets a data connector. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -137,33 +143,23 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.DataConnector :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnector"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnector"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_id=data_connector_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,16 +173,19 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, workspace_name: str, data_connector_id: str, - data_connector: "models.DataConnector", - **kwargs - ) -> "models.DataConnector": + data_connector: "_models.DataConnector", + **kwargs: Any + ) -> "_models.DataConnector": """Creates or updates the data connector. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -203,38 +202,28 @@ async def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.DataConnector :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnector"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnector"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(data_connector, 'DataConnector') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_id=data_connector_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -252,14 +241,17 @@ async def create_or_update( 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}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, workspace_name: str, data_connector_id: str, - **kwargs + **kwargs: Any ) -> None: """Delete the data connector. @@ -280,28 +272,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_id=data_connector_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -313,3 +295,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py index 66801b1a0b8a..ecc24b5296d3 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models - +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._incident_comments_operations import build_create_comment_request, build_get_request, build_list_by_incident_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +38,7 @@ class IncidentCommentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_incident( self, resource_group_name: str, @@ -50,8 +56,8 @@ def list_by_incident( orderby: Optional[str] = None, top: Optional[int] = None, skip_token: Optional[str] = None, - **kwargs - ) -> AsyncIterable["models.IncidentCommentList"]: + **kwargs: Any + ) -> AsyncIterable["_models.IncidentCommentList"]: """Gets all incident comments. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -73,53 +79,52 @@ def list_by_incident( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IncidentCommentList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.IncidentCommentList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.IncidentCommentList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentCommentList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentCommentList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_incident.metadata['url'] # type: ignore - 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') - 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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_incident_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + template_url=self.list_by_incident.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_incident_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('IncidentCommentList', pipeline_response) + deserialized = self._deserialize("IncidentCommentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -137,19 +142,21 @@ async def get_next(next_link=None): 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'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, incident_id: str, incident_comment_id: str, - **kwargs - ) -> "models.IncidentComment": + **kwargs: Any + ) -> "_models.IncidentComment": """Gets an incident comment. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -166,34 +173,24 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.IncidentComment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentComment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentComment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + incident_comment_id=incident_comment_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -207,17 +204,20 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} # type: ignore + + @distributed_trace_async 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": + incident_comment: "_models.IncidentComment", + **kwargs: Any + ) -> "_models.IncidentComment": """Creates the incident comment. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -229,48 +229,36 @@ async def create_comment( :type incident_id: str :param incident_comment_id: Incident comment ID. :type incident_comment_id: str - :param message: The comment message. - :type message: str + :param incident_comment: The incident comment. + :type incident_comment: ~azure.mgmt.securityinsight.models.IncidentComment :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"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentComment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - _incident_comment = models.IncidentComment(message=message) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_comment.metadata['url'] # type: ignore - 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) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _json = self._serialize.body(incident_comment, 'IncidentComment') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_comment_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + incident_comment_id=incident_comment_id, + content_type=content_type, + json=_json, + template_url=self.create_comment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -284,4 +272,6 @@ async def create_comment( 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}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py index b807274d9d3a..7ec88cc4a217 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models - +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._incidents_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +38,7 @@ class IncidentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -49,8 +55,8 @@ def list( orderby: Optional[str] = None, top: Optional[int] = None, skip_token: Optional[str] = None, - **kwargs - ) -> AsyncIterable["models.IncidentList"]: + **kwargs: Any + ) -> AsyncIterable["_models.IncidentList"]: """Gets all incidents. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -70,52 +76,50 @@ def list( :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IncidentList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.IncidentList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.IncidentList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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) - # 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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('IncidentList', pipeline_response) + deserialized = self._deserialize("IncidentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,18 +137,20 @@ async def get_next(next_link=None): 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'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, incident_id: str, - **kwargs - ) -> "models.Incident": + **kwargs: Any + ) -> "_models.Incident": """Gets an incident. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -159,33 +165,23 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.Incident :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Incident"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Incident"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -199,16 +195,19 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, workspace_name: str, incident_id: str, - incident: "models.Incident", - **kwargs - ) -> "models.Incident": + incident: "_models.Incident", + **kwargs: Any + ) -> "_models.Incident": """Creates or updates the incident. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -225,38 +224,28 @@ async def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Incident :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Incident"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Incident"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(incident, 'Incident') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -274,14 +263,17 @@ async def create_or_update( 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}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, workspace_name: str, incident_id: str, - **kwargs + **kwargs: Any ) -> None: """Delete the incident. @@ -302,28 +294,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -335,3 +317,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py index a166ff37b8d7..b90699594bfe 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models - +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +38,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -41,46 +46,45 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs - ) -> AsyncIterable["models.OperationsList"]: + **kwargs: Any + ) -> AsyncIterable["_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: An iterator like instance of either OperationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.OperationsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py index 1bb2dbf0fa83..dd1992b9c18e 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/__init__.py @@ -6,146 +6,77 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AADDataConnector - from ._models_py3 import AATPDataConnector - from ._models_py3 import ASCDataConnector - from ._models_py3 import ASCDataConnectorProperties - 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 AlertRuleTemplate - from ._models_py3 import AlertRuleTemplateDataSource - from ._models_py3 import AlertRuleTemplatesList - from ._models_py3 import AlertRulesList - from ._models_py3 import AlertsDataTypeOfDataConnector - from ._models_py3 import AwsCloudTrailDataConnector - from ._models_py3 import AwsCloudTrailDataConnectorDataTypes - from ._models_py3 import AwsCloudTrailDataConnectorDataTypesLogs - from ._models_py3 import Bookmark - from ._models_py3 import BookmarkList - from ._models_py3 import ClientInfo - from ._models_py3 import DataConnector - from ._models_py3 import DataConnectorDataTypeCommon - from ._models_py3 import DataConnectorList - from ._models_py3 import DataConnectorTenantId - from ._models_py3 import DataConnectorWithAlertsProperties - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorResponse - from ._models_py3 import FusionAlertRule - from ._models_py3 import FusionAlertRuleTemplate - 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 MCASDataConnector - from ._models_py3 import MCASDataConnectorDataTypes - from ._models_py3 import MDATPDataConnector - from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRule - from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleCommonProperties - from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleProperties - from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleTemplate - 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 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 Settings - from ._models_py3 import TIDataConnector - from ._models_py3 import TIDataConnectorDataTypes - from ._models_py3 import TIDataConnectorDataTypesIndicators - from ._models_py3 import ThreatIntelligence - 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 AATPDataConnector # type: ignore - from ._models import ASCDataConnector # type: ignore - from ._models import ASCDataConnectorProperties # 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 AlertRuleTemplate # type: ignore - from ._models import AlertRuleTemplateDataSource # type: ignore - from ._models import AlertRuleTemplatesList # type: ignore - from ._models import AlertRulesList # type: ignore - from ._models import AlertsDataTypeOfDataConnector # 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 BookmarkList # type: ignore - from ._models import ClientInfo # type: ignore - from ._models import DataConnector # type: ignore - from ._models import DataConnectorDataTypeCommon # type: ignore - from ._models import DataConnectorList # type: ignore - from ._models import DataConnectorTenantId # type: ignore - from ._models import DataConnectorWithAlertsProperties # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import FusionAlertRule # type: ignore - from ._models import FusionAlertRuleTemplate # 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 MCASDataConnector # type: ignore - from ._models import MCASDataConnectorDataTypes # type: ignore - from ._models import MDATPDataConnector # 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 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 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 Settings # type: ignore - from ._models import TIDataConnector # type: ignore - from ._models import TIDataConnectorDataTypes # type: ignore - from ._models import TIDataConnectorDataTypesIndicators # type: ignore - from ._models import ThreatIntelligence # type: ignore - from ._models import ToggleSettings # type: ignore - from ._models import UebaSettings # type: ignore - from ._models import UserInfo # type: ignore +from ._models_py3 import AADDataConnector +from ._models_py3 import AATPDataConnector +from ._models_py3 import ASCDataConnector +from ._models_py3 import ASCDataConnectorProperties +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 AlertRuleTemplate +from ._models_py3 import AlertRuleTemplateDataSource +from ._models_py3 import AlertRuleTemplatesList +from ._models_py3 import AlertRulesList +from ._models_py3 import AlertsDataTypeOfDataConnector +from ._models_py3 import AwsCloudTrailDataConnector +from ._models_py3 import AwsCloudTrailDataConnectorDataTypes +from ._models_py3 import AwsCloudTrailDataConnectorDataTypesLogs +from ._models_py3 import Bookmark +from ._models_py3 import BookmarkList +from ._models_py3 import ClientInfo +from ._models_py3 import DataConnector +from ._models_py3 import DataConnectorDataTypeCommon +from ._models_py3 import DataConnectorList +from ._models_py3 import DataConnectorTenantId +from ._models_py3 import DataConnectorWithAlertsProperties +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorResponse +from ._models_py3 import FusionAlertRule +from ._models_py3 import FusionAlertRuleTemplate +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 MCASDataConnector +from ._models_py3 import MCASDataConnectorDataTypes +from ._models_py3 import MDATPDataConnector +from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRule +from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleCommonProperties +from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleProperties +from ._models_py3 import MicrosoftSecurityIncidentCreationAlertRuleTemplate +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 OfficeDataConnectorDataTypesTeams +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 Settings +from ._models_py3 import TIDataConnector +from ._models_py3 import TIDataConnectorDataTypes +from ._models_py3 import TIDataConnectorDataTypesIndicators +from ._models_py3 import ThreatIntelligence +from ._models_py3 import ToggleSettings +from ._models_py3 import UebaSettings +from ._models_py3 import UserInfo + from ._security_insights_enums import ( AlertRuleKind, @@ -220,6 +151,7 @@ 'OfficeDataConnectorDataTypes', 'OfficeDataConnectorDataTypesExchange', 'OfficeDataConnectorDataTypesSharePoint', + 'OfficeDataConnectorDataTypesTeams', 'Operation', 'OperationDisplay', 'OperationsList', diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models.py deleted file mode 100644 index cc96121bf59e..000000000000 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models.py +++ /dev/null @@ -1,2983 +0,0 @@ -# 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 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 DataConnector(ResourceWithEtag): - """Data connector. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AwsCloudTrailDataConnector, AADDataConnector, AATPDataConnector, ASCDataConnector, MCASDataConnector, MDATPDataConnector, OfficeDataConnector, TIDataConnector. - - 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 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 kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'AmazonWebServicesCloudTrail': 'AwsCloudTrailDataConnector', 'AzureActiveDirectory': 'AADDataConnector', 'AzureAdvancedThreatProtection': 'AATPDataConnector', 'AzureSecurityCenter': 'ASCDataConnector', 'MicrosoftCloudAppSecurity': 'MCASDataConnector', 'MicrosoftDefenderAdvancedThreatProtection': 'MDATPDataConnector', 'Office365': 'OfficeDataConnector', 'ThreatIntelligence': 'TIDataConnector'} - } - - def __init__( - self, - **kwargs - ): - super(DataConnector, self).__init__(**kwargs) - self.kind = 'DataConnector' # type: str - - -class AADDataConnector(DataConnector): - """Represents AAD (Azure Active Directory) data connector. - - 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 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 kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - '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.kind = 'AzureActiveDirectory' # type: str - self.tenant_id = kwargs.get('tenant_id', None) - self.data_types = kwargs.get('data_types', None) - - -class AATPDataConnector(DataConnector): - """Represents AATP (Azure Advanced Threat Protection) data connector. - - 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 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 kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - '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.kind = 'AzureAdvancedThreatProtection' # type: str - self.tenant_id = kwargs.get('tenant_id', None) - self.data_types = kwargs.get('data_types', None) - - -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 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 AlertRule(ResourceWithEtag): - """Alert rule. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FusionAlertRule, MicrosoftSecurityIncidentCreationAlertRule, ScheduledAlertRule. - - 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 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 kind: Required. The alert rule kind.Constant filled by server. Possible values include: - "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'Fusion': 'FusionAlertRule', 'MicrosoftSecurityIncidentCreation': 'MicrosoftSecurityIncidentCreationAlertRule', 'Scheduled': 'ScheduledAlertRule'} - } - - def __init__( - self, - **kwargs - ): - super(AlertRule, self).__init__(**kwargs) - self.kind = 'AlertRule' # type: str - - -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(Resource): - """Alert rule template. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: FusionAlertRuleTemplate, MicrosoftSecurityIncidentCreationAlertRuleTemplate, ScheduledAlertRuleTemplate. - - 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 id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param kind: Required. The alert rule kind.Constant filled by server. Possible values include: - "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'Fusion': 'FusionAlertRuleTemplate', 'MicrosoftSecurityIncidentCreation': 'MicrosoftSecurityIncidentCreationAlertRuleTemplate', 'Scheduled': 'ScheduledAlertRuleTemplate'} - } - - def __init__( - self, - **kwargs - ): - super(AlertRuleTemplate, self).__init__(**kwargs) - self.kind = 'AlertRuleTemplate' # type: str - - -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 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.DataConnectorDataTypeCommon - """ - - _attribute_map = { - 'alerts': {'key': 'alerts', 'type': 'DataConnectorDataTypeCommon'}, - } - - def __init__( - self, - **kwargs - ): - super(AlertsDataTypeOfDataConnector, self).__init__(**kwargs) - self.alerts = kwargs.get('alerts', None) - - -class ASCDataConnector(DataConnector): - """Represents ASC (Azure Security Center) data connector. - - 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 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 kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - '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.kind = 'AzureSecurityCenter' # type: str - self.data_types = kwargs.get('data_types', None) - self.subscription_id = kwargs.get('subscription_id', 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 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. - - 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 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 kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - '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.kind = 'AmazonWebServicesCloudTrail' # type: str - 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.DataConnectorDataTypeCommon - """ - - _attribute_map = { - 'logs': {'key': 'logs', 'type': 'DataConnectorDataTypeCommon'}, - } - - def __init__( - self, - **kwargs - ): - super(AwsCloudTrailDataConnectorDataTypes, self).__init__(**kwargs) - self.logs = kwargs.get('logs', 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 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 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 ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: object - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.securityinsight.models.ErrorResponse] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.securityinsight.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponse]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = 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. - - :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 kind: Required. The alert rule kind.Constant filled by server. Possible values include: - "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :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 = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'description': {'readonly': True}, - 'display_name': {'readonly': True}, - 'last_modified_utc': {'readonly': True}, - 'severity': {'readonly': True}, - 'tactics': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - '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.kind = 'Fusion' # type: str - 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. - - :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 kind: Required. The alert rule kind.Constant filled by server. Possible values include: - "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :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 = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'created_date_utc': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - '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.kind = 'Fusion' # type: str - 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 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 - :param classification_comment: Describes the reason the incident was closed. - :type classification_comment: str - :param classification_reason: The classification reason the incident was closed with. Possible - values include: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", - "InaccurateData". - :type classification_reason: str or - ~azure.mgmt.securityinsight.models.IncidentClassificationReason - :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_url: The deep-link url to the incident in Azure portal. - :vartype incident_url: str - :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 - :ivar related_analytic_rule_ids: List of resource ids of Analytic rules related to the - incident. - :vartype related_analytic_rule_ids: list[str] - :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_url': {'readonly': True}, - 'incident_number': {'readonly': True}, - 'last_modified_time_utc': {'readonly': True}, - 'related_analytic_rule_ids': {'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'}, - 'classification_comment': {'key': 'properties.classificationComment', 'type': 'str'}, - 'classification_reason': {'key': 'properties.classificationReason', '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_url': {'key': 'properties.incidentUrl', 'type': 'str'}, - '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'}, - 'related_analytic_rule_ids': {'key': 'properties.relatedAnalyticRuleIds', 'type': '[str]'}, - '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.classification_comment = kwargs.get('classification_comment', None) - self.classification_reason = kwargs.get('classification_reason', 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_url = 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.related_analytic_rule_ids = 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 MCASDataConnector(DataConnector): - """Represents MCAS (Microsoft Cloud App Security) data connector. - - 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 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 kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - '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.kind = 'MicrosoftCloudAppSecurity' # type: str - 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.DataConnectorDataTypeCommon - :param discovery_logs: Discovery log data type connection. - :type discovery_logs: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon - """ - - _attribute_map = { - 'alerts': {'key': 'alerts', 'type': 'DataConnectorDataTypeCommon'}, - 'discovery_logs': {'key': 'discoveryLogs', 'type': 'DataConnectorDataTypeCommon'}, - } - - def __init__( - self, - **kwargs - ): - super(MCASDataConnectorDataTypes, self).__init__(**kwargs) - self.discovery_logs = kwargs.get('discovery_logs', None) - - -class MDATPDataConnector(DataConnector): - """Represents MDATP (Microsoft Defender Advanced Threat Protection) data connector. - - 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 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 kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - '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.kind = 'MicrosoftDefenderAdvancedThreatProtection' # type: str - self.tenant_id = kwargs.get('tenant_id', None) - self.data_types = kwargs.get('data_types', None) - - -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. - - :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 kind: Required. The alert rule kind.Constant filled by server. Possible values include: - "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :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 = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'last_modified_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'}, - '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.kind = 'MicrosoftSecurityIncidentCreation' # type: str - 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. - - :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 kind: Required. The alert rule kind.Constant filled by server. Possible values include: - "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :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 = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'created_date_utc': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - '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.kind = 'MicrosoftSecurityIncidentCreation' # type: str - 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 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. - - 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 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 kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - '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.kind = 'Office365' # type: str - 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.DataConnectorDataTypeCommon - :param share_point: SharePoint data type connection. - :type share_point: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon - """ - - _attribute_map = { - 'exchange': {'key': 'exchange', 'type': 'DataConnectorDataTypeCommon'}, - 'share_point': {'key': 'sharePoint', 'type': 'DataConnectorDataTypeCommon'}, - } - - 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 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. - - :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 kind: Required. The alert rule kind.Constant filled by server. Possible values include: - "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :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 = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'last_modified_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'}, - '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.kind = 'Scheduled' # type: str - 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. - - :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 kind: Required. The alert rule kind.Constant filled by server. Possible values include: - "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :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 = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'created_date_utc': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - '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.kind = 'Scheduled' # type: str - 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 Settings(ResourceWithEtag): - """The Settings. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ToggleSettings, UebaSettings. - - 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 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 kind: Required. The data connector kind.Constant filled by server. Possible values - include: "UebaSettings", "ToggleSettings". - :type kind: str or ~azure.mgmt.securityinsight.models.SettingKind - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'ToggleSettings': 'ToggleSettings', 'UebaSettings': 'UebaSettings'} - } - - def __init__( - self, - **kwargs - ): - super(Settings, self).__init__(**kwargs) - self.kind = 'Settings' # type: str - - -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. - - 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 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 kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", - "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", - "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - '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.kind = 'ThreatIntelligence' # type: str - 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.DataConnectorDataTypeCommon - """ - - _attribute_map = { - 'indicators': {'key': 'indicators', 'type': 'DataConnectorDataTypeCommon'}, - } - - 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 ToggleSettings(Settings): - """Settings with single toggle. - - 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 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 kind: Required. The data connector kind.Constant filled by server. 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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ToggleSettings, self).__init__(**kwargs) - self.kind = 'ToggleSettings' # type: str - 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. - - All required parameters must be populated in order to send to Azure. - - :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 kind: Required. The data connector kind.Constant filled by server. 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 = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'atp_license_status': {'readonly': True}, - 'status_in_mcas': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - '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.kind = 'UebaSettings' # type: str - 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/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py index d160c0d2b437..b2b84c4d253a 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models_py3.py @@ -25,8 +25,8 @@ class ResourceWithEtag(msrest.serialization.Model): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str + :ivar etag: Etag of the azure resource. + :vartype etag: str """ _validation = { @@ -48,6 +48,10 @@ def __init__( etag: Optional[str] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + """ super(ResourceWithEtag, self).__init__(**kwargs) self.id = None self.name = None @@ -71,13 +75,13 @@ class DataConnector(ResourceWithEtag): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind """ _validation = { @@ -105,6 +109,10 @@ def __init__( etag: Optional[str] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + """ super(DataConnector, self).__init__(etag=etag, **kwargs) self.kind = 'DataConnector' # type: str @@ -122,17 +130,17 @@ class AADDataConnector(DataConnector): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector """ _validation = { @@ -160,6 +168,14 @@ def __init__( data_types: Optional["AlertsDataTypeOfDataConnector"] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ super(AADDataConnector, self).__init__(etag=etag, **kwargs) self.kind = 'AzureActiveDirectory' # type: str self.tenant_id = tenant_id @@ -179,17 +195,17 @@ class AATPDataConnector(DataConnector): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector """ _validation = { @@ -217,6 +233,14 @@ def __init__( data_types: Optional["AlertsDataTypeOfDataConnector"] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ super(AATPDataConnector, self).__init__(etag=etag, **kwargs) self.kind = 'AzureAdvancedThreatProtection' # type: str self.tenant_id = tenant_id @@ -228,10 +252,9 @@ class ActionPropertiesBase(msrest.serialization.Model): 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 + :ivar logic_app_resource_id: Required. Logic App Resource Id, + /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + :vartype logic_app_resource_id: str """ _validation = { @@ -248,6 +271,11 @@ def __init__( logic_app_resource_id: str, **kwargs ): + """ + :keyword logic_app_resource_id: Required. Logic App Resource Id, + /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + :paramtype logic_app_resource_id: str + """ super(ActionPropertiesBase, self).__init__(**kwargs) self.logic_app_resource_id = logic_app_resource_id @@ -263,14 +291,13 @@ class ActionRequest(ResourceWithEtag): :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 + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar logic_app_resource_id: Logic App Resource Id, + /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + :vartype logic_app_resource_id: str + :ivar trigger_uri: Logic App Callback URL for this specific workflow. + :vartype trigger_uri: str """ _validation = { @@ -296,6 +323,15 @@ def __init__( trigger_uri: Optional[str] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword logic_app_resource_id: Logic App Resource Id, + /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + :paramtype logic_app_resource_id: str + :keyword trigger_uri: Logic App Callback URL for this specific workflow. + :paramtype trigger_uri: str + """ super(ActionRequest, self).__init__(etag=etag, **kwargs) self.logic_app_resource_id = logic_app_resource_id self.trigger_uri = trigger_uri @@ -306,16 +342,16 @@ class ActionRequestProperties(ActionPropertiesBase): 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 + :ivar logic_app_resource_id: Required. Logic App Resource Id, + /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + :vartype logic_app_resource_id: str + :ivar trigger_uri: Required. Logic App Callback URL for this specific workflow. + :vartype trigger_uri: str """ _validation = { 'logic_app_resource_id': {'required': True}, + 'trigger_uri': {'required': True}, } _attribute_map = { @@ -327,9 +363,16 @@ def __init__( self, *, logic_app_resource_id: str, - trigger_uri: Optional[str] = None, + trigger_uri: str, **kwargs ): + """ + :keyword logic_app_resource_id: Required. Logic App Resource Id, + /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + :paramtype logic_app_resource_id: str + :keyword trigger_uri: Required. Logic App Callback URL for this specific workflow. + :paramtype trigger_uri: str + """ super(ActionRequestProperties, self).__init__(logic_app_resource_id=logic_app_resource_id, **kwargs) self.trigger_uri = trigger_uri @@ -363,6 +406,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -380,14 +425,13 @@ class ActionResponse(Resource): :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 + :ivar etag: Etag of the action. + :vartype etag: str + :ivar logic_app_resource_id: Logic App Resource Id, + /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + :vartype logic_app_resource_id: str + :ivar workflow_id: The name of the logic app's workflow. + :vartype workflow_id: str """ _validation = { @@ -413,6 +457,15 @@ def __init__( workflow_id: Optional[str] = None, **kwargs ): + """ + :keyword etag: Etag of the action. + :paramtype etag: str + :keyword logic_app_resource_id: Logic App Resource Id, + /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + :paramtype logic_app_resource_id: str + :keyword workflow_id: The name of the logic app's workflow. + :paramtype workflow_id: str + """ super(ActionResponse, self).__init__(**kwargs) self.etag = etag self.logic_app_resource_id = logic_app_resource_id @@ -424,12 +477,11 @@ class ActionResponseProperties(ActionPropertiesBase): 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 + :ivar logic_app_resource_id: Required. Logic App Resource Id, + /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + :vartype logic_app_resource_id: str + :ivar workflow_id: The name of the logic app's workflow. + :vartype workflow_id: str """ _validation = { @@ -448,6 +500,13 @@ def __init__( workflow_id: Optional[str] = None, **kwargs ): + """ + :keyword logic_app_resource_id: Required. Logic App Resource Id, + /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. + :paramtype logic_app_resource_id: str + :keyword workflow_id: The name of the logic app's workflow. + :paramtype workflow_id: str + """ super(ActionResponseProperties, self).__init__(logic_app_resource_id=logic_app_resource_id, **kwargs) self.workflow_id = workflow_id @@ -461,8 +520,8 @@ class ActionsList(msrest.serialization.Model): :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] + :ivar value: Required. Array of actions. + :vartype value: list[~azure.mgmt.securityinsight.models.ActionResponse] """ _validation = { @@ -481,6 +540,10 @@ def __init__( value: List["ActionResponse"], **kwargs ): + """ + :keyword value: Required. Array of actions. + :paramtype value: list[~azure.mgmt.securityinsight.models.ActionResponse] + """ super(ActionsList, self).__init__(**kwargs) self.next_link = None self.value = value @@ -502,11 +565,11 @@ class AlertRule(ResourceWithEtag): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The alert rule kind.Constant filled by server. Possible values include: + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The alert rule kind.Constant filled by server. Possible values include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind """ _validation = { @@ -534,6 +597,10 @@ def __init__( etag: Optional[str] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + """ super(AlertRule, self).__init__(etag=etag, **kwargs) self.kind = 'AlertRule' # type: str @@ -547,8 +614,8 @@ class AlertRulesList(msrest.serialization.Model): :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] + :ivar value: Required. Array of alert rules. + :vartype value: list[~azure.mgmt.securityinsight.models.AlertRule] """ _validation = { @@ -567,6 +634,10 @@ def __init__( value: List["AlertRule"], **kwargs ): + """ + :keyword value: Required. Array of alert rules. + :paramtype value: list[~azure.mgmt.securityinsight.models.AlertRule] + """ super(AlertRulesList, self).__init__(**kwargs) self.next_link = None self.value = value @@ -588,9 +659,9 @@ class AlertRuleTemplate(Resource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param kind: Required. The alert rule kind.Constant filled by server. Possible values include: + :ivar kind: Required. The alert rule kind.Constant filled by server. Possible values include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind """ _validation = { @@ -615,6 +686,8 @@ def __init__( self, **kwargs ): + """ + """ super(AlertRuleTemplate, self).__init__(**kwargs) self.kind = 'AlertRuleTemplate' # type: str @@ -622,10 +695,10 @@ def __init__( 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] + :ivar connector_id: The connector id that provides the following data types. + :vartype connector_id: str + :ivar data_types: The data types used by the alert rule template. + :vartype data_types: list[str] """ _attribute_map = { @@ -640,6 +713,12 @@ def __init__( data_types: Optional[List[str]] = None, **kwargs ): + """ + :keyword connector_id: The connector id that provides the following data types. + :paramtype connector_id: str + :keyword data_types: The data types used by the alert rule template. + :paramtype data_types: list[str] + """ super(AlertRuleTemplateDataSource, self).__init__(**kwargs) self.connector_id = connector_id self.data_types = data_types @@ -654,8 +733,8 @@ class AlertRuleTemplatesList(msrest.serialization.Model): :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] + :ivar value: Required. Array of alert rule templates. + :vartype value: list[~azure.mgmt.securityinsight.models.AlertRuleTemplate] """ _validation = { @@ -674,6 +753,10 @@ def __init__( value: List["AlertRuleTemplate"], **kwargs ): + """ + :keyword value: Required. Array of alert rule templates. + :paramtype value: list[~azure.mgmt.securityinsight.models.AlertRuleTemplate] + """ super(AlertRuleTemplatesList, self).__init__(**kwargs) self.next_link = None self.value = value @@ -682,8 +765,8 @@ def __init__( class AlertsDataTypeOfDataConnector(msrest.serialization.Model): """Alerts data type for data connectors. - :param alerts: Alerts data type connection. - :type alerts: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + :ivar alerts: Alerts data type connection. + :vartype alerts: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon """ _attribute_map = { @@ -696,6 +779,10 @@ def __init__( alerts: Optional["DataConnectorDataTypeCommon"] = None, **kwargs ): + """ + :keyword alerts: Alerts data type connection. + :paramtype alerts: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + """ super(AlertsDataTypeOfDataConnector, self).__init__(**kwargs) self.alerts = alerts @@ -713,17 +800,17 @@ class ASCDataConnector(DataConnector): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :ivar subscription_id: The subscription id to connect to, and get the data from. + :vartype subscription_id: str """ _validation = { @@ -751,6 +838,14 @@ def __init__( subscription_id: Optional[str] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :keyword subscription_id: The subscription id to connect to, and get the data from. + :paramtype subscription_id: str + """ super(ASCDataConnector, self).__init__(etag=etag, **kwargs) self.kind = 'AzureSecurityCenter' # type: str self.data_types = data_types @@ -760,8 +855,8 @@ def __init__( 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 + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector """ _attribute_map = { @@ -774,6 +869,10 @@ def __init__( data_types: Optional["AlertsDataTypeOfDataConnector"] = None, **kwargs ): + """ + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ super(DataConnectorWithAlertsProperties, self).__init__(**kwargs) self.data_types = data_types @@ -781,10 +880,10 @@ def __init__( 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 + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :ivar subscription_id: The subscription id to connect to, and get the data from. + :vartype subscription_id: str """ _attribute_map = { @@ -799,6 +898,12 @@ def __init__( subscription_id: Optional[str] = None, **kwargs ): + """ + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + :keyword subscription_id: The subscription id to connect to, and get the data from. + :paramtype subscription_id: str + """ super(ASCDataConnectorProperties, self).__init__(data_types=data_types, **kwargs) self.subscription_id = subscription_id @@ -816,18 +921,18 @@ class AwsCloudTrailDataConnector(DataConnector): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :param aws_role_arn: The Aws Role Arn (with CloudTrailReadOnly policy) that is used to access + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar 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 + :vartype aws_role_arn: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AwsCloudTrailDataConnectorDataTypes """ _validation = { @@ -855,6 +960,15 @@ def __init__( data_types: Optional["AwsCloudTrailDataConnectorDataTypes"] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword aws_role_arn: The Aws Role Arn (with CloudTrailReadOnly policy) that is used to access + the Aws account. + :paramtype aws_role_arn: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AwsCloudTrailDataConnectorDataTypes + """ super(AwsCloudTrailDataConnector, self).__init__(etag=etag, **kwargs) self.kind = 'AmazonWebServicesCloudTrail' # type: str self.aws_role_arn = aws_role_arn @@ -864,20 +978,24 @@ def __init__( 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.DataConnectorDataTypeCommon + :ivar logs: Logs data type. + :vartype logs: ~azure.mgmt.securityinsight.models.AwsCloudTrailDataConnectorDataTypesLogs """ _attribute_map = { - 'logs': {'key': 'logs', 'type': 'DataConnectorDataTypeCommon'}, + 'logs': {'key': 'logs', 'type': 'AwsCloudTrailDataConnectorDataTypesLogs'}, } def __init__( self, *, - logs: Optional["DataConnectorDataTypeCommon"] = None, + logs: Optional["AwsCloudTrailDataConnectorDataTypesLogs"] = None, **kwargs ): + """ + :keyword logs: Logs data type. + :paramtype logs: ~azure.mgmt.securityinsight.models.AwsCloudTrailDataConnectorDataTypesLogs + """ super(AwsCloudTrailDataConnectorDataTypes, self).__init__(**kwargs) self.logs = logs @@ -885,9 +1003,9 @@ def __init__( 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 + :ivar 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 + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ _attribute_map = { @@ -900,6 +1018,11 @@ def __init__( state: Optional[Union[str, "DataTypeState"]] = None, **kwargs ): + """ + :keyword state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ super(DataConnectorDataTypeCommon, self).__init__(**kwargs) self.state = state @@ -907,9 +1030,9 @@ def __init__( class AwsCloudTrailDataConnectorDataTypesLogs(DataConnectorDataTypeCommon): """Logs data type. - :param state: Describe whether this data type connection is enabled or not. Possible values + :ivar 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 + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ _attribute_map = { @@ -922,6 +1045,11 @@ def __init__( state: Optional[Union[str, "DataTypeState"]] = None, **kwargs ): + """ + :keyword state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ super(AwsCloudTrailDataConnectorDataTypesLogs, self).__init__(state=state, **kwargs) @@ -936,28 +1064,34 @@ class Bookmark(ResourceWithEtag): :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 + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar created: The time the bookmark was created. + :vartype created: ~datetime.datetime + :ivar created_by: Describes a user that created the bookmark. + :vartype created_by: ~azure.mgmt.securityinsight.models.UserInfo + :ivar display_name: The display name of the bookmark. + :vartype display_name: str + :ivar labels: List of labels relevant to this bookmark. + :vartype labels: list[str] + :ivar notes: The notes of the bookmark. + :vartype notes: str + :ivar query: The query of the bookmark. + :vartype query: str + :ivar query_result: The query result of the bookmark. + :vartype query_result: str + :ivar updated: The last time the bookmark was updated. + :vartype updated: ~datetime.datetime + :ivar updated_by: Describes a user that updated the bookmark. + :vartype updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :ivar event_time: The bookmark event time. + :vartype event_time: ~datetime.datetime + :ivar query_start_time: The start time for the query. + :vartype query_start_time: ~datetime.datetime + :ivar query_end_time: The end time for the query. + :vartype query_end_time: ~datetime.datetime + :ivar incident_info: Describes an incident that relates to bookmark. + :vartype incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo """ _validation = { @@ -980,6 +1114,9 @@ class Bookmark(ResourceWithEtag): 'query_result': {'key': 'properties.queryResult', 'type': 'str'}, 'updated': {'key': 'properties.updated', 'type': 'iso-8601'}, 'updated_by': {'key': 'properties.updatedBy', 'type': 'UserInfo'}, + 'event_time': {'key': 'properties.eventTime', 'type': 'iso-8601'}, + 'query_start_time': {'key': 'properties.queryStartTime', 'type': 'iso-8601'}, + 'query_end_time': {'key': 'properties.queryEndTime', 'type': 'iso-8601'}, 'incident_info': {'key': 'properties.incidentInfo', 'type': 'IncidentInfo'}, } @@ -996,9 +1133,42 @@ def __init__( query_result: Optional[str] = None, updated: Optional[datetime.datetime] = None, updated_by: Optional["UserInfo"] = None, + event_time: Optional[datetime.datetime] = None, + query_start_time: Optional[datetime.datetime] = None, + query_end_time: Optional[datetime.datetime] = None, incident_info: Optional["IncidentInfo"] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword created: The time the bookmark was created. + :paramtype created: ~datetime.datetime + :keyword created_by: Describes a user that created the bookmark. + :paramtype created_by: ~azure.mgmt.securityinsight.models.UserInfo + :keyword display_name: The display name of the bookmark. + :paramtype display_name: str + :keyword labels: List of labels relevant to this bookmark. + :paramtype labels: list[str] + :keyword notes: The notes of the bookmark. + :paramtype notes: str + :keyword query: The query of the bookmark. + :paramtype query: str + :keyword query_result: The query result of the bookmark. + :paramtype query_result: str + :keyword updated: The last time the bookmark was updated. + :paramtype updated: ~datetime.datetime + :keyword updated_by: Describes a user that updated the bookmark. + :paramtype updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :keyword event_time: The bookmark event time. + :paramtype event_time: ~datetime.datetime + :keyword query_start_time: The start time for the query. + :paramtype query_start_time: ~datetime.datetime + :keyword query_end_time: The end time for the query. + :paramtype query_end_time: ~datetime.datetime + :keyword incident_info: Describes an incident that relates to bookmark. + :paramtype incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo + """ super(Bookmark, self).__init__(etag=etag, **kwargs) self.created = created self.created_by = created_by @@ -1009,6 +1179,9 @@ def __init__( self.query_result = query_result self.updated = updated self.updated_by = updated_by + self.event_time = event_time + self.query_start_time = query_start_time + self.query_end_time = query_end_time self.incident_info = incident_info @@ -1021,8 +1194,8 @@ class BookmarkList(msrest.serialization.Model): :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] + :ivar value: Required. Array of bookmarks. + :vartype value: list[~azure.mgmt.securityinsight.models.Bookmark] """ _validation = { @@ -1041,6 +1214,10 @@ def __init__( value: List["Bookmark"], **kwargs ): + """ + :keyword value: Required. Array of bookmarks. + :paramtype value: list[~azure.mgmt.securityinsight.models.Bookmark] + """ super(BookmarkList, self).__init__(**kwargs) self.next_link = None self.value = value @@ -1049,14 +1226,14 @@ def __init__( 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 + :ivar email: The email of the client. + :vartype email: str + :ivar name: The name of the client. + :vartype name: str + :ivar object_id: The object id of the client. + :vartype object_id: str + :ivar user_principal_name: The user principal name of the client. + :vartype user_principal_name: str """ _attribute_map = { @@ -1075,6 +1252,16 @@ def __init__( user_principal_name: Optional[str] = None, **kwargs ): + """ + :keyword email: The email of the client. + :paramtype email: str + :keyword name: The name of the client. + :paramtype name: str + :keyword object_id: The object id of the client. + :paramtype object_id: str + :keyword user_principal_name: The user principal name of the client. + :paramtype user_principal_name: str + """ super(ClientInfo, self).__init__(**kwargs) self.email = email self.name = name @@ -1091,8 +1278,8 @@ class DataConnectorList(msrest.serialization.Model): :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] + :ivar value: Required. Array of data connectors. + :vartype value: list[~azure.mgmt.securityinsight.models.DataConnector] """ _validation = { @@ -1111,6 +1298,10 @@ def __init__( value: List["DataConnector"], **kwargs ): + """ + :keyword value: Required. Array of data connectors. + :paramtype value: list[~azure.mgmt.securityinsight.models.DataConnector] + """ super(DataConnectorList, self).__init__(**kwargs) self.next_link = None self.value = value @@ -1119,8 +1310,8 @@ def __init__( 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 + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str """ _attribute_map = { @@ -1133,6 +1324,10 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + """ super(DataConnectorTenantId, self).__init__(**kwargs) self.tenant_id = tenant_id @@ -1145,7 +1340,7 @@ class ErrorAdditionalInfo(msrest.serialization.Model): :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. - :vartype info: object + :vartype info: any """ _validation = { @@ -1162,6 +1357,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -1204,6 +1401,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponse, self).__init__(**kwargs) self.code = None self.message = None @@ -1225,19 +1424,19 @@ class FusionAlertRule(AlertRule): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The alert rule kind.Constant filled by server. Possible values include: + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The alert rule kind.Constant filled by server. Possible values include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :param alert_rule_template_name: The Name of the alert rule template used to create this rule. - :type alert_rule_template_name: str + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. + :vartype 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 enabled: Determines whether this alert rule is enabled or disabled. + :vartype 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: @@ -1282,6 +1481,15 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword alert_rule_template_name: The Name of the alert rule template used to create this + rule. + :paramtype alert_rule_template_name: str + :keyword enabled: Determines whether this alert rule is enabled or disabled. + :paramtype enabled: bool + """ super(FusionAlertRule, self).__init__(etag=etag, **kwargs) self.kind = 'Fusion' # type: str self.alert_rule_template_name = alert_rule_template_name @@ -1306,29 +1514,29 @@ class FusionAlertRuleTemplate(AlertRuleTemplate): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param kind: Required. The alert rule kind.Constant filled by server. Possible values include: + :ivar kind: Required. The alert rule kind.Constant filled by server. Possible values include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :param alert_rules_created_by_template_count: the number of alert rules that were created by + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar 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 + :vartype 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: + :ivar description: The description of the alert rule template. + :vartype description: str + :ivar display_name: The display name for alert rule template. + :vartype display_name: str + :ivar required_data_connectors: The required data connectors for this template. + :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :param status: The alert rule template status. Possible values include: "Installed", + :ivar 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: + :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :ivar 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] + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar tactics: The tactics of the alert rule template. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] """ _validation = { @@ -1366,6 +1574,26 @@ def __init__( tactics: Optional[List[Union[str, "AttackTactic"]]] = None, **kwargs ): + """ + :keyword alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :paramtype alert_rules_created_by_template_count: int + :keyword description: The description of the alert rule template. + :paramtype description: str + :keyword display_name: The display name for alert rule template. + :paramtype display_name: str + :keyword required_data_connectors: The required data connectors for this template. + :paramtype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :keyword status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :keyword severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword tactics: The tactics of the alert rule template. + :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ super(FusionAlertRuleTemplate, self).__init__(**kwargs) self.kind = 'Fusion' # type: str self.alert_rules_created_by_template_count = alert_rules_created_by_template_count @@ -1389,48 +1617,48 @@ class Incident(ResourceWithEtag): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str + :ivar etag: Etag of the azure resource. + :vartype 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: + :ivar classification: The reason the incident was closed. Possible values include: "Undetermined", "TruePositive", "BenignPositive", "FalsePositive". - :type classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification - :param classification_comment: Describes the reason the incident was closed. - :type classification_comment: str - :param classification_reason: The classification reason the incident was closed with. Possible + :vartype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification + :ivar classification_comment: Describes the reason the incident was closed. + :vartype classification_comment: str + :ivar classification_reason: The classification reason the incident was closed with. Possible values include: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", "InaccurateData". - :type classification_reason: str or + :vartype classification_reason: str or ~azure.mgmt.securityinsight.models.IncidentClassificationReason :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 description: The description of the incident. + :vartype description: str + :ivar first_activity_time_utc: The time of the first activity in the incident. + :vartype first_activity_time_utc: ~datetime.datetime :ivar incident_url: The deep-link url to the incident in Azure portal. :vartype incident_url: str :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 labels: List of labels relevant to this incident. + :vartype labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + :ivar last_activity_time_utc: The time of the last activity in the incident. + :vartype 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 + :ivar owner: Describes a user that the incident is assigned to. + :vartype owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo :ivar related_analytic_rule_ids: List of resource ids of Analytic rules related to the incident. :vartype related_analytic_rule_ids: list[str] - :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 + :ivar severity: The severity of the incident. Possible values include: "High", "Medium", "Low", + "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :ivar status: The status of the incident. Possible values include: "New", "Active", "Closed". + :vartype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus + :ivar title: The title of the incident. + :vartype title: str """ _validation = { @@ -1486,6 +1714,38 @@ def __init__( title: Optional[str] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword classification: The reason the incident was closed. Possible values include: + "Undetermined", "TruePositive", "BenignPositive", "FalsePositive". + :paramtype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification + :keyword classification_comment: Describes the reason the incident was closed. + :paramtype classification_comment: str + :keyword classification_reason: The classification reason the incident was closed with. + Possible values include: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", + "InaccurateData". + :paramtype classification_reason: str or + ~azure.mgmt.securityinsight.models.IncidentClassificationReason + :keyword description: The description of the incident. + :paramtype description: str + :keyword first_activity_time_utc: The time of the first activity in the incident. + :paramtype first_activity_time_utc: ~datetime.datetime + :keyword labels: List of labels relevant to this incident. + :paramtype labels: list[~azure.mgmt.securityinsight.models.IncidentLabel] + :keyword last_activity_time_utc: The time of the last activity in the incident. + :paramtype last_activity_time_utc: ~datetime.datetime + :keyword owner: Describes a user that the incident is assigned to. + :paramtype owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo + :keyword severity: The severity of the incident. Possible values include: "High", "Medium", + "Low", "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :keyword status: The status of the incident. Possible values include: "New", "Active", + "Closed". + :paramtype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus + :keyword title: The title of the incident. + :paramtype title: str + """ super(Incident, self).__init__(etag=etag, **kwargs) self.additional_data = None self.classification = classification @@ -1543,6 +1803,8 @@ def __init__( self, **kwargs ): + """ + """ super(IncidentAdditionalData, self).__init__(**kwargs) self.alerts_count = None self.bookmarks_count = None @@ -1564,8 +1826,8 @@ class IncidentComment(Resource): :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 message: The comment message. + :vartype message: str :ivar author: Describes the client that created the comment. :vartype author: ~azure.mgmt.securityinsight.models.ClientInfo """ @@ -1593,6 +1855,10 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword message: The comment message. + :paramtype message: str + """ super(IncidentComment, self).__init__(**kwargs) self.created_time_utc = None self.message = message @@ -1608,8 +1874,8 @@ class IncidentCommentList(msrest.serialization.Model): :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] + :ivar value: Required. Array of comments. + :vartype value: list[~azure.mgmt.securityinsight.models.IncidentComment] """ _validation = { @@ -1628,6 +1894,10 @@ def __init__( value: List["IncidentComment"], **kwargs ): + """ + :keyword value: Required. Array of comments. + :paramtype value: list[~azure.mgmt.securityinsight.models.IncidentComment] + """ super(IncidentCommentList, self).__init__(**kwargs) self.next_link = None self.value = value @@ -1636,26 +1906,17 @@ def __init__( 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 + :ivar incident_id: Incident Id. + :vartype incident_id: str + :ivar severity: The severity of the incident. Possible values include: "Critical", "High", + "Medium", "Low", "Informational". + :vartype severity: str or ~azure.mgmt.securityinsight.models.CaseSeverity + :ivar title: The title of the incident. + :vartype title: str + :ivar relation_name: Relation Name. + :vartype 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'}, @@ -1666,12 +1927,23 @@ class IncidentInfo(msrest.serialization.Model): def __init__( self, *, - incident_id: str, - severity: Union[str, "CaseSeverity"], - title: str, - relation_name: str, - **kwargs - ): + incident_id: Optional[str] = None, + severity: Optional[Union[str, "CaseSeverity"]] = None, + title: Optional[str] = None, + relation_name: Optional[str] = None, + **kwargs + ): + """ + :keyword incident_id: Incident Id. + :paramtype incident_id: str + :keyword severity: The severity of the incident. Possible values include: "Critical", "High", + "Medium", "Low", "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.CaseSeverity + :keyword title: The title of the incident. + :paramtype title: str + :keyword relation_name: Relation Name. + :paramtype relation_name: str + """ super(IncidentInfo, self).__init__(**kwargs) self.incident_id = incident_id self.severity = severity @@ -1686,8 +1958,8 @@ class IncidentLabel(msrest.serialization.Model): 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_name: Required. The name of the label. + :vartype 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 """ @@ -1708,6 +1980,10 @@ def __init__( label_name: str, **kwargs ): + """ + :keyword label_name: Required. The name of the label. + :paramtype label_name: str + """ super(IncidentLabel, self).__init__(**kwargs) self.label_name = label_name self.label_type = None @@ -1722,8 +1998,8 @@ class IncidentList(msrest.serialization.Model): :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] + :ivar value: Required. Array of incidents. + :vartype value: list[~azure.mgmt.securityinsight.models.Incident] """ _validation = { @@ -1742,6 +2018,10 @@ def __init__( value: List["Incident"], **kwargs ): + """ + :keyword value: Required. Array of incidents. + :paramtype value: list[~azure.mgmt.securityinsight.models.Incident] + """ super(IncidentList, self).__init__(**kwargs) self.next_link = None self.value = value @@ -1750,14 +2030,14 @@ def __init__( 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 + :ivar email: The email of the user the incident is assigned to. + :vartype email: str + :ivar assigned_to: The name of the user the incident is assigned to. + :vartype assigned_to: str + :ivar object_id: The object id of the user the incident is assigned to. + :vartype object_id: str + :ivar user_principal_name: The user principal name of the user the incident is assigned to. + :vartype user_principal_name: str """ _attribute_map = { @@ -1776,6 +2056,16 @@ def __init__( user_principal_name: Optional[str] = None, **kwargs ): + """ + :keyword email: The email of the user the incident is assigned to. + :paramtype email: str + :keyword assigned_to: The name of the user the incident is assigned to. + :paramtype assigned_to: str + :keyword object_id: The object id of the user the incident is assigned to. + :paramtype object_id: str + :keyword user_principal_name: The user principal name of the user the incident is assigned to. + :paramtype user_principal_name: str + """ super(IncidentOwnerInfo, self).__init__(**kwargs) self.email = email self.assigned_to = assigned_to @@ -1796,17 +2086,17 @@ class MCASDataConnector(DataConnector): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.MCASDataConnectorDataTypes """ _validation = { @@ -1834,6 +2124,14 @@ def __init__( data_types: Optional["MCASDataConnectorDataTypes"] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.MCASDataConnectorDataTypes + """ super(MCASDataConnector, self).__init__(etag=etag, **kwargs) self.kind = 'MicrosoftCloudAppSecurity' # type: str self.tenant_id = tenant_id @@ -1843,10 +2141,10 @@ def __init__( 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.DataConnectorDataTypeCommon - :param discovery_logs: Discovery log data type connection. - :type discovery_logs: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + :ivar alerts: Alerts data type connection. + :vartype alerts: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + :ivar discovery_logs: Discovery log data type connection. + :vartype discovery_logs: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon """ _attribute_map = { @@ -1861,6 +2159,12 @@ def __init__( discovery_logs: Optional["DataConnectorDataTypeCommon"] = None, **kwargs ): + """ + :keyword alerts: Alerts data type connection. + :paramtype alerts: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + :keyword discovery_logs: Discovery log data type connection. + :paramtype discovery_logs: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + """ super(MCASDataConnectorDataTypes, self).__init__(alerts=alerts, **kwargs) self.discovery_logs = discovery_logs @@ -1878,17 +2182,17 @@ class MDATPDataConnector(DataConnector): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector """ _validation = { @@ -1916,6 +2220,14 @@ def __init__( data_types: Optional["AlertsDataTypeOfDataConnector"] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.AlertsDataTypeOfDataConnector + """ super(MDATPDataConnector, self).__init__(etag=etag, **kwargs) self.kind = 'MicrosoftDefenderAdvancedThreatProtection' # type: str self.tenant_id = tenant_id @@ -1935,30 +2247,30 @@ class MicrosoftSecurityIncidentCreationAlertRule(AlertRule): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The alert rule kind.Constant filled by server. Possible values include: + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The alert rule kind.Constant filled by server. Possible values include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :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 + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. + :vartype display_names_filter: list[str] + :ivar 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 + :vartype display_names_exclude_filter: list[str] + :ivar 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 + :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :ivar severities_filter: the alerts' severities on which the cases will be generated. + :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. + :vartype 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 + :ivar enabled: Determines whether this alert rule is enabled or disabled. + :vartype enabled: bool :ivar last_modified_utc: The last time that this alert has been modified. :vartype last_modified_utc: ~datetime.datetime """ @@ -2002,6 +2314,31 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. + :paramtype display_names_filter: list[str] + :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :paramtype display_names_exclude_filter: list[str] + :keyword 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". + :paramtype product_filter: str or + ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :keyword severities_filter: the alerts' severities on which the cases will be generated. + :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :keyword alert_rule_template_name: The Name of the alert rule template used to create this + rule. + :paramtype alert_rule_template_name: str + :keyword description: The description of the alert rule. + :paramtype description: str + :keyword display_name: The display name for alerts created by this alert rule. + :paramtype display_name: str + :keyword enabled: Determines whether this alert rule is enabled or disabled. + :paramtype enabled: bool + """ super(MicrosoftSecurityIncidentCreationAlertRule, self).__init__(etag=etag, **kwargs) self.kind = 'MicrosoftSecurityIncidentCreation' # type: str self.display_names_filter = display_names_filter @@ -2020,18 +2357,18 @@ class MicrosoftSecurityIncidentCreationAlertRuleCommonProperties(msrest.serializ 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 + :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. + :vartype display_names_filter: list[str] + :ivar 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. + :vartype display_names_exclude_filter: list[str] + :ivar 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] + :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :ivar severities_filter: the alerts' severities on which the cases will be generated. + :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] """ _validation = { @@ -2054,6 +2391,21 @@ def __init__( severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, **kwargs ): + """ + :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. + :paramtype display_names_filter: list[str] + :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :paramtype display_names_exclude_filter: list[str] + :keyword 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". + :paramtype product_filter: str or + ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :keyword severities_filter: the alerts' severities on which the cases will be generated. + :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ super(MicrosoftSecurityIncidentCreationAlertRuleCommonProperties, self).__init__(**kwargs) self.display_names_filter = display_names_filter self.display_names_exclude_filter = display_names_exclude_filter @@ -2068,26 +2420,26 @@ class MicrosoftSecurityIncidentCreationAlertRuleProperties(MicrosoftSecurityInci 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 + :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. + :vartype display_names_filter: list[str] + :ivar 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. + :vartype display_names_exclude_filter: list[str] + :ivar 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 + :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :ivar severities_filter: the alerts' severities on which the cases will be generated. + :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. + :vartype alert_rule_template_name: str + :ivar description: The description of the alert rule. + :vartype description: str + :ivar display_name: Required. The display name for alerts created by this alert rule. + :vartype display_name: str + :ivar enabled: Required. Determines whether this alert rule is enabled or disabled. + :vartype enabled: bool :ivar last_modified_utc: The last time that this alert has been modified. :vartype last_modified_utc: ~datetime.datetime """ @@ -2124,6 +2476,30 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. + :paramtype display_names_filter: list[str] + :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :paramtype display_names_exclude_filter: list[str] + :keyword 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". + :paramtype product_filter: str or + ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :keyword severities_filter: the alerts' severities on which the cases will be generated. + :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + :keyword alert_rule_template_name: The Name of the alert rule template used to create this + rule. + :paramtype alert_rule_template_name: str + :keyword description: The description of the alert rule. + :paramtype description: str + :keyword display_name: Required. The display name for alerts created by this alert rule. + :paramtype display_name: str + :keyword enabled: Required. Determines whether this alert rule is enabled or disabled. + :paramtype enabled: bool + """ 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 @@ -2145,35 +2521,35 @@ class MicrosoftSecurityIncidentCreationAlertRuleTemplate(AlertRuleTemplate): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param kind: Required. The alert rule kind.Constant filled by server. Possible values include: + :ivar kind: Required. The alert rule kind.Constant filled by server. Possible values include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :param alert_rules_created_by_template_count: the number of alert rules that were created by + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar 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 + :vartype 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: + :ivar description: The description of the alert rule template. + :vartype description: str + :ivar display_name: The display name for alert rule template. + :vartype display_name: str + :ivar required_data_connectors: The required data connectors for this template. + :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :param status: The alert rule template status. Possible values include: "Installed", + :ivar 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 + :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. + :vartype display_names_filter: list[str] + :ivar 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 + :vartype display_names_exclude_filter: list[str] + :ivar 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] + :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :ivar severities_filter: the alerts' severities on which the cases will be generated. + :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] """ _validation = { @@ -2215,6 +2591,33 @@ def __init__( severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, **kwargs ): + """ + :keyword alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :paramtype alert_rules_created_by_template_count: int + :keyword description: The description of the alert rule template. + :paramtype description: str + :keyword display_name: The display name for alert rule template. + :paramtype display_name: str + :keyword required_data_connectors: The required data connectors for this template. + :paramtype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :keyword status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. + :paramtype display_names_filter: list[str] + :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be + generated. + :paramtype display_names_exclude_filter: list[str] + :keyword 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". + :paramtype product_filter: str or + ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName + :keyword severities_filter: the alerts' severities on which the cases will be generated. + :paramtype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] + """ super(MicrosoftSecurityIncidentCreationAlertRuleTemplate, self).__init__(**kwargs) self.kind = 'MicrosoftSecurityIncidentCreation' # type: str self.alert_rules_created_by_template_count = alert_rules_created_by_template_count @@ -2240,8 +2643,8 @@ class OfficeConsent(Resource): :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_id: The tenantId of the Office365 with the consent. + :vartype tenant_id: str :ivar tenant_name: The tenant name of the Office365 with the consent. :vartype tenant_name: str """ @@ -2267,6 +2670,10 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: The tenantId of the Office365 with the consent. + :paramtype tenant_id: str + """ super(OfficeConsent, self).__init__(**kwargs) self.tenant_id = tenant_id self.tenant_name = None @@ -2281,8 +2688,8 @@ class OfficeConsentList(msrest.serialization.Model): :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] + :ivar value: Required. Array of the consents. + :vartype value: list[~azure.mgmt.securityinsight.models.OfficeConsent] """ _validation = { @@ -2301,6 +2708,10 @@ def __init__( value: List["OfficeConsent"], **kwargs ): + """ + :keyword value: Required. Array of the consents. + :paramtype value: list[~azure.mgmt.securityinsight.models.OfficeConsent] + """ super(OfficeConsentList, self).__init__(**kwargs) self.next_link = None self.value = value @@ -2319,17 +2730,17 @@ class OfficeDataConnector(DataConnector): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes """ _validation = { @@ -2357,6 +2768,14 @@ def __init__( data_types: Optional["OfficeDataConnectorDataTypes"] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypes + """ super(OfficeDataConnector, self).__init__(etag=etag, **kwargs) self.kind = 'Office365' # type: str self.tenant_id = tenant_id @@ -2366,35 +2785,49 @@ def __init__( 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.DataConnectorDataTypeCommon - :param share_point: SharePoint data type connection. - :type share_point: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + :ivar exchange: Exchange data type connection. + :vartype exchange: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesExchange + :ivar share_point: SharePoint data type connection. + :vartype share_point: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesSharePoint + :ivar teams: Teams data type connection. + :vartype teams: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesTeams """ _attribute_map = { - 'exchange': {'key': 'exchange', 'type': 'DataConnectorDataTypeCommon'}, - 'share_point': {'key': 'sharePoint', 'type': 'DataConnectorDataTypeCommon'}, + 'exchange': {'key': 'exchange', 'type': 'OfficeDataConnectorDataTypesExchange'}, + 'share_point': {'key': 'sharePoint', 'type': 'OfficeDataConnectorDataTypesSharePoint'}, + 'teams': {'key': 'teams', 'type': 'OfficeDataConnectorDataTypesTeams'}, } def __init__( self, *, - exchange: Optional["DataConnectorDataTypeCommon"] = None, - share_point: Optional["DataConnectorDataTypeCommon"] = None, - **kwargs - ): + exchange: Optional["OfficeDataConnectorDataTypesExchange"] = None, + share_point: Optional["OfficeDataConnectorDataTypesSharePoint"] = None, + teams: Optional["OfficeDataConnectorDataTypesTeams"] = None, + **kwargs + ): + """ + :keyword exchange: Exchange data type connection. + :paramtype exchange: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesExchange + :keyword share_point: SharePoint data type connection. + :paramtype share_point: + ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesSharePoint + :keyword teams: Teams data type connection. + :paramtype teams: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesTeams + """ super(OfficeDataConnectorDataTypes, self).__init__(**kwargs) self.exchange = exchange self.share_point = share_point + self.teams = teams class OfficeDataConnectorDataTypesExchange(DataConnectorDataTypeCommon): """Exchange data type connection. - :param state: Describe whether this data type connection is enabled or not. Possible values + :ivar 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 + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ _attribute_map = { @@ -2407,15 +2840,20 @@ def __init__( state: Optional[Union[str, "DataTypeState"]] = None, **kwargs ): + """ + :keyword state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ 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 + :ivar 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 + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ _attribute_map = { @@ -2428,21 +2866,55 @@ def __init__( state: Optional[Union[str, "DataTypeState"]] = None, **kwargs ): + """ + :keyword state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ super(OfficeDataConnectorDataTypesSharePoint, self).__init__(state=state, **kwargs) +class OfficeDataConnectorDataTypesTeams(DataConnectorDataTypeCommon): + """Teams data type connection. + + :ivar state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :vartype 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 + ): + """ + :keyword state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + super(OfficeDataConnectorDataTypesTeams, self).__init__(state=state, **kwargs) + + 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 + :ivar display: Properties of the operation. + :vartype display: ~azure.mgmt.securityinsight.models.OperationDisplay + :ivar name: Name of the operation. + :vartype name: str + :ivar origin: The origin of the operation. + :vartype origin: str """ _attribute_map = { 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'name': {'key': 'name', 'type': 'str'}, + 'origin': {'key': 'origin', 'type': 'str'}, } def __init__( @@ -2450,24 +2922,34 @@ def __init__( *, display: Optional["OperationDisplay"] = None, name: Optional[str] = None, + origin: Optional[str] = None, **kwargs ): + """ + :keyword display: Properties of the operation. + :paramtype display: ~azure.mgmt.securityinsight.models.OperationDisplay + :keyword name: Name of the operation. + :paramtype name: str + :keyword origin: The origin of the operation. + :paramtype origin: str + """ super(Operation, self).__init__(**kwargs) self.display = display self.name = name + self.origin = origin 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 + :ivar description: Description of the operation. + :vartype description: str + :ivar operation: Operation name. + :vartype operation: str + :ivar provider: Provider name. + :vartype provider: str + :ivar resource: Resource name. + :vartype resource: str """ _attribute_map = { @@ -2486,6 +2968,16 @@ def __init__( resource: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the operation. + :paramtype description: str + :keyword operation: Operation name. + :paramtype operation: str + :keyword provider: Provider name. + :paramtype provider: str + :keyword resource: Resource name. + :paramtype resource: str + """ super(OperationDisplay, self).__init__(**kwargs) self.description = description self.operation = operation @@ -2498,10 +2990,10 @@ class OperationsList(msrest.serialization.Model): 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] + :ivar next_link: URL to fetch the next set of operations. + :vartype next_link: str + :ivar value: Required. Array of operations. + :vartype value: list[~azure.mgmt.securityinsight.models.Operation] """ _validation = { @@ -2520,6 +3012,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL to fetch the next set of operations. + :paramtype next_link: str + :keyword value: Required. Array of operations. + :paramtype value: list[~azure.mgmt.securityinsight.models.Operation] + """ super(OperationsList, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -2538,43 +3036,43 @@ class ScheduledAlertRule(AlertRule): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The alert rule kind.Constant filled by server. Possible values include: + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The alert rule kind.Constant filled by server. Possible values include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :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: + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar query: The query that creates alerts for this rule. + :vartype query: str + :ivar query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :vartype query_frequency: ~datetime.timedelta + :ivar query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :vartype query_period: ~datetime.timedelta + :ivar 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 + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar 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 + :vartype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :ivar trigger_threshold: The threshold triggers this alert rule. + :vartype trigger_threshold: int + :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. + :vartype 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 + :ivar enabled: Determines whether this alert rule is enabled or disabled. + :vartype 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 + :ivar 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] + :vartype suppression_duration: ~datetime.timedelta + :ivar suppression_enabled: Determines whether the suppression for this alert rule is enabled or + disabled. + :vartype suppression_enabled: bool + :ivar tactics: The tactics of the alert rule. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] """ _validation = { @@ -2626,6 +3124,42 @@ def __init__( tactics: Optional[List[Union[str, "AttackTactic"]]] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword query: The query that creates alerts for this rule. + :paramtype query: str + :keyword query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to + run. + :paramtype query_frequency: ~datetime.timedelta + :keyword query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :paramtype query_period: ~datetime.timedelta + :keyword severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword trigger_operator: The operation against the threshold that triggers alert rule. + Possible values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :paramtype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :keyword trigger_threshold: The threshold triggers this alert rule. + :paramtype trigger_threshold: int + :keyword alert_rule_template_name: The Name of the alert rule template used to create this + rule. + :paramtype alert_rule_template_name: str + :keyword description: The description of the alert rule. + :paramtype description: str + :keyword display_name: The display name for alerts created by this alert rule. + :paramtype display_name: str + :keyword enabled: Determines whether this alert rule is enabled or disabled. + :paramtype enabled: bool + :keyword suppression_duration: The suppression (in ISO 8601 duration format) to wait since last + time this alert rule been triggered. + :paramtype suppression_duration: ~datetime.timedelta + :keyword suppression_enabled: Determines whether the suppression for this alert rule is enabled + or disabled. + :paramtype suppression_enabled: bool + :keyword tactics: The tactics of the alert rule. + :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ super(ScheduledAlertRule, self).__init__(etag=etag, **kwargs) self.kind = 'Scheduled' # type: str self.query = query @@ -2647,20 +3181,20 @@ def __init__( 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: + :ivar query: The query that creates alerts for this rule. + :vartype query: str + :ivar query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :vartype query_frequency: ~datetime.timedelta + :ivar query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :vartype query_period: ~datetime.timedelta + :ivar 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 + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar 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 + :vartype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :ivar trigger_threshold: The threshold triggers this alert rule. + :vartype trigger_threshold: int """ _attribute_map = { @@ -2683,6 +3217,23 @@ def __init__( trigger_threshold: Optional[int] = None, **kwargs ): + """ + :keyword query: The query that creates alerts for this rule. + :paramtype query: str + :keyword query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to + run. + :paramtype query_frequency: ~datetime.timedelta + :keyword query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :paramtype query_period: ~datetime.timedelta + :keyword severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword trigger_operator: The operation against the threshold that triggers alert rule. + Possible values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :paramtype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :keyword trigger_threshold: The threshold triggers this alert rule. + :paramtype trigger_threshold: int + """ super(ScheduledAlertRuleCommonProperties, self).__init__(**kwargs) self.query = query self.query_frequency = query_frequency @@ -2699,38 +3250,38 @@ class ScheduledAlertRuleProperties(ScheduledAlertRuleCommonProperties): 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: + :ivar query: The query that creates alerts for this rule. + :vartype query: str + :ivar query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :vartype query_frequency: ~datetime.timedelta + :ivar query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :vartype query_period: ~datetime.timedelta + :ivar 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 + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar 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 + :vartype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :ivar trigger_threshold: The threshold triggers this alert rule. + :vartype trigger_threshold: int + :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. + :vartype alert_rule_template_name: str + :ivar description: The description of the alert rule. + :vartype description: str + :ivar display_name: Required. The display name for alerts created by this alert rule. + :vartype display_name: str + :ivar enabled: Required. Determines whether this alert rule is enabled or disabled. + :vartype 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 + :ivar 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 + :vartype suppression_duration: ~datetime.timedelta + :ivar 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] + :vartype suppression_enabled: bool + :ivar tactics: The tactics of the alert rule. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] """ _validation = { @@ -2776,6 +3327,40 @@ def __init__( tactics: Optional[List[Union[str, "AttackTactic"]]] = None, **kwargs ): + """ + :keyword query: The query that creates alerts for this rule. + :paramtype query: str + :keyword query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to + run. + :paramtype query_frequency: ~datetime.timedelta + :keyword query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :paramtype query_period: ~datetime.timedelta + :keyword severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword trigger_operator: The operation against the threshold that triggers alert rule. + Possible values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :paramtype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :keyword trigger_threshold: The threshold triggers this alert rule. + :paramtype trigger_threshold: int + :keyword alert_rule_template_name: The Name of the alert rule template used to create this + rule. + :paramtype alert_rule_template_name: str + :keyword description: The description of the alert rule. + :paramtype description: str + :keyword display_name: Required. The display name for alerts created by this alert rule. + :paramtype display_name: str + :keyword enabled: Required. Determines whether this alert rule is enabled or disabled. + :paramtype enabled: bool + :keyword suppression_duration: Required. The suppression (in ISO 8601 duration format) to wait + since last time this alert rule been triggered. + :paramtype suppression_duration: ~datetime.timedelta + :keyword suppression_enabled: Required. Determines whether the suppression for this alert rule + is enabled or disabled. + :paramtype suppression_enabled: bool + :keyword tactics: The tactics of the alert rule. + :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ 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 @@ -2800,40 +3385,40 @@ class ScheduledAlertRuleTemplate(AlertRuleTemplate): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param kind: Required. The alert rule kind.Constant filled by server. Possible values include: + :ivar kind: Required. The alert rule kind.Constant filled by server. Possible values include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion". - :type kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind - :param alert_rules_created_by_template_count: the number of alert rules that were created by + :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind + :ivar 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 + :vartype 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: + :ivar description: The description of the alert rule template. + :vartype description: str + :ivar display_name: The display name for alert rule template. + :vartype display_name: str + :ivar required_data_connectors: The required data connectors for this template. + :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :param status: The alert rule template status. Possible values include: "Installed", + :ivar 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: + :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :ivar query: The query that creates alerts for this rule. + :vartype query: str + :ivar query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to run. + :vartype query_frequency: ~datetime.timedelta + :ivar query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :vartype query_period: ~datetime.timedelta + :ivar 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 + :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :ivar 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] + :vartype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :ivar trigger_threshold: The threshold triggers this alert rule. + :vartype trigger_threshold: int + :ivar tactics: The tactics of the alert rule template. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] """ _validation = { @@ -2881,6 +3466,38 @@ def __init__( tactics: Optional[List[Union[str, "AttackTactic"]]] = None, **kwargs ): + """ + :keyword alert_rules_created_by_template_count: the number of alert rules that were created by + this template. + :paramtype alert_rules_created_by_template_count: int + :keyword description: The description of the alert rule template. + :paramtype description: str + :keyword display_name: The display name for alert rule template. + :paramtype display_name: str + :keyword required_data_connectors: The required data connectors for this template. + :paramtype required_data_connectors: + list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] + :keyword status: The alert rule template status. Possible values include: "Installed", + "Available", "NotAvailable". + :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus + :keyword query: The query that creates alerts for this rule. + :paramtype query: str + :keyword query_frequency: The frequency (in ISO 8601 duration format) for this alert rule to + run. + :paramtype query_frequency: ~datetime.timedelta + :keyword query_period: The period (in ISO 8601 duration format) that this alert rule looks at. + :paramtype query_period: ~datetime.timedelta + :keyword severity: The severity for alerts created by this alert rule. Possible values include: + "High", "Medium", "Low", "Informational". + :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity + :keyword trigger_operator: The operation against the threshold that triggers alert rule. + Possible values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :paramtype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator + :keyword trigger_threshold: The threshold triggers this alert rule. + :paramtype trigger_threshold: int + :keyword tactics: The tactics of the alert rule template. + :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + """ super(ScheduledAlertRuleTemplate, self).__init__(**kwargs) self.kind = 'Scheduled' # type: str self.alert_rules_created_by_template_count = alert_rules_created_by_template_count @@ -2914,11 +3531,11 @@ class Settings(ResourceWithEtag): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. Possible values include: "UebaSettings", "ToggleSettings". - :type kind: str or ~azure.mgmt.securityinsight.models.SettingKind + :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind """ _validation = { @@ -2946,6 +3563,10 @@ def __init__( etag: Optional[str] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + """ super(Settings, self).__init__(etag=etag, **kwargs) self.kind = 'Settings' # type: str @@ -2992,6 +3613,8 @@ def __init__( self, **kwargs ): + """ + """ super(ThreatIntelligence, self).__init__(**kwargs) self.confidence = None self.provider_name = None @@ -3014,17 +3637,19 @@ class TIDataConnector(DataConnector): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "Office365", "AmazonWebServicesCloudTrail", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection". - :type kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind - :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 + :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind + :ivar tenant_id: The tenant id to connect to, and get the data from. + :vartype tenant_id: str + :ivar tip_lookback_period: The lookback period for the feed to be imported. + :vartype tip_lookback_period: ~datetime.datetime + :ivar data_types: The available data types for the connector. + :vartype data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes """ _validation = { @@ -3041,6 +3666,7 @@ class TIDataConnector(DataConnector): 'etag': {'key': 'etag', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'tip_lookback_period': {'key': 'properties.tipLookbackPeriod', 'type': 'iso-8601'}, 'data_types': {'key': 'properties.dataTypes', 'type': 'TIDataConnectorDataTypes'}, } @@ -3049,32 +3675,48 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, + tip_lookback_period: Optional[datetime.datetime] = None, data_types: Optional["TIDataConnectorDataTypes"] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword tenant_id: The tenant id to connect to, and get the data from. + :paramtype tenant_id: str + :keyword tip_lookback_period: The lookback period for the feed to be imported. + :paramtype tip_lookback_period: ~datetime.datetime + :keyword data_types: The available data types for the connector. + :paramtype data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes + """ super(TIDataConnector, self).__init__(etag=etag, **kwargs) self.kind = 'ThreatIntelligence' # type: str self.tenant_id = tenant_id + self.tip_lookback_period = tip_lookback_period 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.DataConnectorDataTypeCommon + :ivar indicators: Data type for indicators connection. + :vartype indicators: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypesIndicators """ _attribute_map = { - 'indicators': {'key': 'indicators', 'type': 'DataConnectorDataTypeCommon'}, + 'indicators': {'key': 'indicators', 'type': 'TIDataConnectorDataTypesIndicators'}, } def __init__( self, *, - indicators: Optional["DataConnectorDataTypeCommon"] = None, + indicators: Optional["TIDataConnectorDataTypesIndicators"] = None, **kwargs ): + """ + :keyword indicators: Data type for indicators connection. + :paramtype indicators: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypesIndicators + """ super(TIDataConnectorDataTypes, self).__init__(**kwargs) self.indicators = indicators @@ -3082,9 +3724,9 @@ def __init__( class TIDataConnectorDataTypesIndicators(DataConnectorDataTypeCommon): """Data type for indicators connection. - :param state: Describe whether this data type connection is enabled or not. Possible values + :ivar 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 + :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ _attribute_map = { @@ -3097,6 +3739,11 @@ def __init__( state: Optional[Union[str, "DataTypeState"]] = None, **kwargs ): + """ + :keyword state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ super(TIDataConnectorDataTypesIndicators, self).__init__(state=state, **kwargs) @@ -3113,13 +3760,13 @@ class ToggleSettings(Settings): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. 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 + :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind + :ivar is_enabled: Determines whether the setting is enable or disabled. + :vartype is_enabled: bool """ _validation = { @@ -3145,6 +3792,12 @@ def __init__( is_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword is_enabled: Determines whether the setting is enable or disabled. + :paramtype is_enabled: bool + """ super(ToggleSettings, self).__init__(etag=etag, **kwargs) self.kind = 'ToggleSettings' # type: str self.is_enabled = is_enabled @@ -3163,17 +3816,17 @@ class UebaSettings(Settings): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param etag: Etag of the azure resource. - :type etag: str - :param kind: Required. The data connector kind.Constant filled by server. Possible values + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The data connector kind.Constant filled by server. Possible values include: "UebaSettings", "ToggleSettings". - :type kind: str or ~azure.mgmt.securityinsight.models.SettingKind + :vartype 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 + :ivar is_enabled: Determines whether User and Entity Behavior Analytics is enabled for this workspace. - :type is_enabled: bool + :vartype 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 @@ -3206,6 +3859,13 @@ def __init__( is_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword is_enabled: Determines whether User and Entity Behavior Analytics is enabled for this + workspace. + :paramtype is_enabled: bool + """ super(UebaSettings, self).__init__(etag=etag, **kwargs) self.kind = 'UebaSettings' # type: str self.atp_license_status = None @@ -3224,8 +3884,8 @@ class UserInfo(msrest.serialization.Model): :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 + :ivar object_id: Required. The object id of the user. + :vartype object_id: str """ _validation = { @@ -3246,6 +3906,10 @@ def __init__( object_id: str, **kwargs ): + """ + :keyword object_id: Required. The object id of the user. + :paramtype object_id: str + """ super(UserInfo, self).__init__(**kwargs) self.email = None self.name = None diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py index b97f5497911b..18c6b53da8a6 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_security_insights_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AlertRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AlertRuleKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The kind of the alert rule """ @@ -34,16 +19,20 @@ class AlertRuleKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_SECURITY_INCIDENT_CREATION = "MicrosoftSecurityIncidentCreation" FUSION = "Fusion" -class AlertSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The severity of the alert """ - HIGH = "High" #: High severity. - MEDIUM = "Medium" #: Medium severity. - LOW = "Low" #: Low severity. - INFORMATIONAL = "Informational" #: Informational severity. + #: High severity. + HIGH = "High" + #: Medium severity. + MEDIUM = "Medium" + #: Low severity. + LOW = "Low" + #: Informational severity. + INFORMATIONAL = "Informational" -class AttackTactic(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AttackTactic(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The severity for alerts created by this alert rule. """ @@ -60,17 +49,22 @@ class AttackTactic(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMMAND_AND_CONTROL = "CommandAndControl" IMPACT = "Impact" -class CaseSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CaseSeverity(with_metaclass(CaseInsensitiveEnumMeta, 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. + #: Critical severity. + CRITICAL = "Critical" + #: High severity. + HIGH = "High" + #: Medium severity. + MEDIUM = "Medium" + #: Low severity. + LOW = "Low" + #: Informational severity. + INFORMATIONAL = "Informational" -class DataConnectorKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataConnectorKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The kind of the data connector """ @@ -83,63 +77,80 @@ class DataConnectorKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AZURE_ADVANCED_THREAT_PROTECTION = "AzureAdvancedThreatProtection" MICROSOFT_DEFENDER_ADVANCED_THREAT_PROTECTION = "MicrosoftDefenderAdvancedThreatProtection" -class DataTypeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataTypeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Describe whether this data type connection is enabled or not. """ ENABLED = "Enabled" DISABLED = "Disabled" -class IncidentClassification(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IncidentClassification(with_metaclass(CaseInsensitiveEnumMeta, 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. + #: Incident classification was undetermined. + UNDETERMINED = "Undetermined" + #: Incident was true positive. + TRUE_POSITIVE = "TruePositive" + #: Incident was benign positive. + BENIGN_POSITIVE = "BenignPositive" + #: Incident was false positive. + FALSE_POSITIVE = "FalsePositive" -class IncidentClassificationReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IncidentClassificationReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The classification reason the incident was closed with """ - SUSPICIOUS_ACTIVITY = "SuspiciousActivity" #: Classification reason was suspicious activity. - SUSPICIOUS_BUT_EXPECTED = "SuspiciousButExpected" #: Classification reason was suspicious but expected. - INCORRECT_ALERT_LOGIC = "IncorrectAlertLogic" #: Classification reason was incorrect alert logic. - INACCURATE_DATA = "InaccurateData" #: Classification reason was inaccurate data. + #: Classification reason was suspicious activity. + SUSPICIOUS_ACTIVITY = "SuspiciousActivity" + #: Classification reason was suspicious but expected. + SUSPICIOUS_BUT_EXPECTED = "SuspiciousButExpected" + #: Classification reason was incorrect alert logic. + INCORRECT_ALERT_LOGIC = "IncorrectAlertLogic" + #: Classification reason was inaccurate data. + INACCURATE_DATA = "InaccurateData" -class IncidentLabelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IncidentLabelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the label """ - USER = "User" #: Label manually created by a user. - SYSTEM = "System" #: Label automatically created by the system. + #: Label manually created by a user. + USER = "User" + #: Label automatically created by the system. + SYSTEM = "System" -class IncidentSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IncidentSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The severity of the incident """ - HIGH = "High" #: High severity. - MEDIUM = "Medium" #: Medium severity. - LOW = "Low" #: Low severity. - INFORMATIONAL = "Informational" #: Informational severity. + #: High severity. + HIGH = "High" + #: Medium severity. + MEDIUM = "Medium" + #: Low severity. + LOW = "Low" + #: Informational severity. + INFORMATIONAL = "Informational" -class IncidentStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IncidentStatus(with_metaclass(CaseInsensitiveEnumMeta, 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. + #: An active incident which isn't being handled currently. + NEW = "New" + #: An active incident which is being handled. + ACTIVE = "Active" + #: A non-active incident. + CLOSED = "Closed" -class LicenseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LicenseStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Determines whether the tenant has ATP (Advanced Threat Protection) license. """ ENABLED = "Enabled" DISABLED = "Disabled" -class MicrosoftSecurityProductName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MicrosoftSecurityProductName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The alerts' productName on which the cases will be generated """ @@ -149,14 +160,14 @@ class MicrosoftSecurityProductName(with_metaclass(_CaseInsensitiveEnumMeta, str, AZURE_ACTIVE_DIRECTORY_IDENTITY_PROTECTION = "Azure Active Directory Identity Protection" AZURE_SECURITY_CENTER_FOR_IO_T = "Azure Security Center for IoT" -class SettingKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SettingKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The kind of the setting """ UEBA_SETTINGS = "UebaSettings" TOGGLE_SETTINGS = "ToggleSettings" -class StatusInMcas(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StatusInMcas(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Determines whether User and Entity Behavior Analytics is enabled from MCAS (Microsoft Cloud App Security). """ @@ -164,15 +175,18 @@ class StatusInMcas(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class TemplateStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TemplateStatus(with_metaclass(CaseInsensitiveEnumMeta, 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. + #: Alert rule template installed. and can not use more then once. + INSTALLED = "Installed" + #: Alert rule template is available. + AVAILABLE = "Available" + #: Alert rule template is not available. + NOT_AVAILABLE = "NotAvailable" -class TriggerOperator(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operation against the threshold that triggers alert rule. """ diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py index f941c6be9526..e6b787caab92 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/__init__.py @@ -6,22 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import Operations from ._alert_rules_operations import AlertRulesOperations from ._actions_operations import ActionsOperations from ._alert_rule_templates_operations import AlertRuleTemplatesOperations from ._bookmarks_operations import BookmarksOperations from ._data_connectors_operations import DataConnectorsOperations +from ._operations import Operations from ._incidents_operations import IncidentsOperations from ._incident_comments_operations import IncidentCommentsOperations __all__ = [ - 'Operations', 'AlertRulesOperations', 'ActionsOperations', 'AlertRuleTemplatesOperations', 'BookmarksOperations', 'DataConnectorsOperations', + 'Operations', 'IncidentsOperations', 'IncidentCommentsOperations', ] diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py index f8595befd039..257e847c5d3d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_actions_operations.py @@ -5,23 +5,189 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, 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.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer -from .. import models +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_by_alert_rule_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + rule_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), + "actionId": _SERIALIZER.url("action_id", action_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), + "actionId": _SERIALIZER.url("action_id", action_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), + "actionId": _SERIALIZER.url("action_id", action_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ActionsOperations(object): """ActionsOperations operations. @@ -37,7 +203,7 @@ class ActionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -45,14 +211,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_alert_rule( self, - resource_group_name, # type: str - workspace_name, # type: str - rule_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.ActionsList"] + resource_group_name: str, + workspace_name: str, + rule_id: str, + **kwargs: Any + ) -> Iterable["_models.ActionsList"]: """Gets all actions of alert rule. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -67,42 +233,40 @@ def list_by_alert_rule( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.ActionsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ActionsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActionsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_alert_rule.metadata['url'] # type: ignore - 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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_alert_rule_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + template_url=self.list_by_alert_rule.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_alert_rule_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ActionsList', pipeline_response) + deserialized = self._deserialize("ActionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,7 +284,196 @@ def get_next(next_link=None): 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'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + **kwargs: Any + ) -> "_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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + action_id=action_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + action: "_models.ActionRequest", + **kwargs: Any + ) -> "_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 action: The action. + :type action: ~azure.mgmt.securityinsight.models.ActionRequest + :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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(action, 'ActionRequest') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + action_id=action_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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) + + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + workspace_name: str, + rule_id: str, + action_id: str, + **kwargs: Any + ) -> 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 = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + action_id=action_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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}/actions/{actionId}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py index 2c286fadb5b7..94d604190629 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rule_templates_operations.py @@ -5,23 +5,97 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, 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.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace 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, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + alert_rule_template_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "alertRuleTemplateId": _SERIALIZER.url("alert_rule_template_id", alert_rule_template_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AlertRuleTemplatesOperations(object): """AlertRuleTemplatesOperations operations. @@ -37,7 +111,7 @@ class AlertRuleTemplatesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.AlertRuleTemplatesList"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.AlertRuleTemplatesList"]: """Gets all alert rule templates. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -60,45 +134,43 @@ def list( :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: An iterator like instance of either AlertRuleTemplatesList or the result of cls(response) + :return: An iterator like instance of either AlertRuleTemplatesList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.AlertRuleTemplatesList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleTemplatesList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleTemplatesList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AlertRuleTemplatesList', pipeline_response) + deserialized = self._deserialize("AlertRuleTemplatesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,19 +188,20 @@ def get_next(next_link=None): 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'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - alert_rule_template_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.AlertRuleTemplate" + resource_group_name: str, + workspace_name: str, + alert_rule_template_id: str, + **kwargs: Any + ) -> "_models.AlertRuleTemplate": """Gets the alert rule template. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -143,33 +216,23 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.AlertRuleTemplate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRuleTemplate"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleTemplate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + alert_rule_template_id=alert_rule_template_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,4 +246,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py index 9e23839b9f91..fb3e7090bc73 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py @@ -5,23 +5,181 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, 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.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace 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, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + rule_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + rule_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + rule_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AlertRulesOperations(object): """AlertRulesOperations operations. @@ -37,7 +195,7 @@ class AlertRulesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.AlertRulesList"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.AlertRulesList"]: """Gets all alert rules. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,41 +222,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.AlertRulesList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRulesList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRulesList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AlertRulesList', pipeline_response) + deserialized = self._deserialize("AlertRulesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,19 +271,20 @@ def get_next(next_link=None): 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'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - rule_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.AlertRule" + resource_group_name: str, + workspace_name: str, + rule_id: str, + **kwargs: Any + ) -> "_models.AlertRule": """Gets the alert rule. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -143,33 +299,23 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.AlertRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,17 +329,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - rule_id, # type: str - alert_rule, # type: "models.AlertRule" - **kwargs # type: Any - ): - # type: (...) -> "models.AlertRule" + resource_group_name: str, + workspace_name: str, + rule_id: str, + alert_rule: "_models.AlertRule", + **kwargs: Any + ) -> "_models.AlertRule": """Creates or updates the alert rule. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -210,38 +358,28 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.AlertRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AlertRule"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(alert_rule, 'AlertRule') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -259,16 +397,18 @@ def create_or_update( 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}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - workspace_name, # type: str - rule_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + rule_id: str, + **kwargs: Any + ) -> None: """Delete the alert rule. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -288,28 +428,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_id=rule_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -322,215 +452,3 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} # type: ignore - 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 = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get_action.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') - - 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}'} # type: ignore - - def create_or_update_action( - self, - resource_group_name, # type: str - workspace_name, # type: str - rule_id, # type: str - action_id, # type: str - action, # type: "models.ActionRequest" - **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 action: The action. - :type action: ~azure.mgmt.securityinsight.models.ActionRequest - :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 = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_action.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') - - 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) - - 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}'} # type: ignore - - 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 = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.delete_action.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') - - 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}'} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py index 0bc4430e4bac..7391edba5f08 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmarks_operations.py @@ -5,23 +5,181 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, 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.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace 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, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + bookmark_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + bookmark_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + bookmark_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BookmarksOperations(object): """BookmarksOperations operations. @@ -37,7 +195,7 @@ class BookmarksOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.BookmarkList"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.BookmarkList"]: """Gets all bookmarks. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,41 +222,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.BookmarkList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.BookmarkList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BookmarkList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BookmarkList', pipeline_response) + deserialized = self._deserialize("BookmarkList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,19 +271,20 @@ def get_next(next_link=None): 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'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - bookmark_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.Bookmark" + resource_group_name: str, + workspace_name: str, + bookmark_id: str, + **kwargs: Any + ) -> "_models.Bookmark": """Gets a bookmark. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -143,33 +299,23 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.Bookmark :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Bookmark"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Bookmark"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + bookmark_id=bookmark_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,17 +329,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - bookmark_id, # type: str - bookmark, # type: "models.Bookmark" - **kwargs # type: Any - ): - # type: (...) -> "models.Bookmark" + resource_group_name: str, + workspace_name: str, + bookmark_id: str, + bookmark: "_models.Bookmark", + **kwargs: Any + ) -> "_models.Bookmark": """Creates or updates the bookmark. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -210,38 +358,28 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Bookmark :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Bookmark"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Bookmark"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(bookmark, 'Bookmark') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + bookmark_id=bookmark_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -259,16 +397,18 @@ def create_or_update( 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}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - workspace_name, # type: str - bookmark_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + bookmark_id: str, + **kwargs: Any + ) -> None: """Delete the bookmark. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -288,28 +428,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + bookmark_id=bookmark_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -321,3 +451,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py index 288d81fdf9d4..4a5efe40dbc9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py @@ -5,23 +5,181 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, 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.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace 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, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + data_connector_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + data_connector_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + data_connector_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DataConnectorsOperations(object): """DataConnectorsOperations operations. @@ -37,7 +195,7 @@ class DataConnectorsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DataConnectorList"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.DataConnectorList"]: """Gets all data connectors. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,41 +222,38 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.DataConnectorList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectorList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectorList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataConnectorList', pipeline_response) + deserialized = self._deserialize("DataConnectorList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,19 +271,20 @@ def get_next(next_link=None): 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'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - data_connector_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.DataConnector" + resource_group_name: str, + workspace_name: str, + data_connector_id: str, + **kwargs: Any + ) -> "_models.DataConnector": """Gets a data connector. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -143,33 +299,23 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.DataConnector :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnector"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnector"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_id=data_connector_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,17 +329,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - data_connector_id, # type: str - data_connector, # type: "models.DataConnector" - **kwargs # type: Any - ): - # type: (...) -> "models.DataConnector" + resource_group_name: str, + workspace_name: str, + data_connector_id: str, + data_connector: "_models.DataConnector", + **kwargs: Any + ) -> "_models.DataConnector": """Creates or updates the data connector. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -210,38 +358,28 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.DataConnector :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnector"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnector"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_connector, 'DataConnector') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_id=data_connector_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -259,16 +397,18 @@ def create_or_update( 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}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - workspace_name, # type: str - data_connector_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + data_connector_id: str, + **kwargs: Any + ) -> None: """Delete the data connector. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -288,28 +428,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_connector_id=data_connector_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -321,3 +451,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py index cb4f6fa07e1e..148505907867 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py @@ -5,23 +5,163 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, 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.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace 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, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_incident_request( + subscription_id: str, + 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: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + incident_id: str, + incident_comment_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), + "incidentCommentId": _SERIALIZER.url("incident_comment_id", incident_comment_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_comment_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + incident_id: str, + incident_comment_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), + "incidentCommentId": _SERIALIZER.url("incident_comment_id", incident_comment_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class IncidentCommentsOperations(object): """IncidentCommentsOperations operations. @@ -37,7 +177,7 @@ class IncidentCommentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -45,18 +185,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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: (...) -> Iterable["models.IncidentCommentList"] + 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: Any + ) -> Iterable["_models.IncidentCommentList"]: """Gets all incident comments. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -81,50 +221,48 @@ def list_by_incident( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.IncidentCommentList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentCommentList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentCommentList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_incident.metadata['url'] # type: ignore - 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') - 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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_incident_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + template_url=self.list_by_incident.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_incident_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('IncidentCommentList', pipeline_response) + deserialized = self._deserialize("IncidentCommentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -142,20 +280,21 @@ def get_next(next_link=None): 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'} # type: ignore + @distributed_trace def get( 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" + resource_group_name: str, + workspace_name: str, + incident_id: str, + incident_comment_id: str, + **kwargs: Any + ) -> "_models.IncidentComment": """Gets an incident comment. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -172,34 +311,24 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.IncidentComment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentComment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentComment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + incident_comment_id=incident_comment_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -213,18 +342,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} # type: ignore + + @distributed_trace 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" + resource_group_name: str, + workspace_name: str, + incident_id: str, + incident_comment_id: str, + incident_comment: "_models.IncidentComment", + **kwargs: Any + ) -> "_models.IncidentComment": """Creates the incident comment. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -236,48 +367,36 @@ def create_comment( :type incident_id: str :param incident_comment_id: Incident comment ID. :type incident_comment_id: str - :param message: The comment message. - :type message: str + :param incident_comment: The incident comment. + :type incident_comment: ~azure.mgmt.securityinsight.models.IncidentComment :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"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentComment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - _incident_comment = models.IncidentComment(message=message) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_comment.metadata['url'] # type: ignore - 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) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _json = self._serialize.body(incident_comment, 'IncidentComment') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_comment_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + incident_comment_id=incident_comment_id, + content_type=content_type, + json=_json, + template_url=self.create_comment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -291,4 +410,6 @@ def create_comment( 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}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py index bd8b87ef8e01..63adecca8b5c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py @@ -5,23 +5,194 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, 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.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace 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, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + 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: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + incident_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + incident_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + incident_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IncidentsOperations(object): """IncidentsOperations operations. @@ -37,7 +208,7 @@ class IncidentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -45,17 +216,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace 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: (...) -> Iterable["models.IncidentList"] + 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: Any + ) -> Iterable["_models.IncidentList"]: """Gets all incidents. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -78,49 +249,46 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.IncidentList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.IncidentList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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) - # 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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + filter=filter, + orderby=orderby, + top=top, + skip_token=skip_token, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('IncidentList', pipeline_response) + deserialized = self._deserialize("IncidentList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -138,19 +306,20 @@ def get_next(next_link=None): 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'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - incident_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.Incident" + resource_group_name: str, + workspace_name: str, + incident_id: str, + **kwargs: Any + ) -> "_models.Incident": """Gets an incident. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -165,33 +334,23 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.Incident :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Incident"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Incident"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -205,17 +364,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - incident_id, # type: str - incident, # type: "models.Incident" - **kwargs # type: Any - ): - # type: (...) -> "models.Incident" + resource_group_name: str, + workspace_name: str, + incident_id: str, + incident: "_models.Incident", + **kwargs: Any + ) -> "_models.Incident": """Creates or updates the incident. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -232,38 +393,28 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Incident :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Incident"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Incident"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(incident, 'Incident') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -281,16 +432,18 @@ def create_or_update( 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}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - workspace_name, # type: str - incident_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + incident_id: str, + **kwargs: Any + ) -> None: """Delete the incident. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -310,28 +463,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - 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'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + incident_id=incident_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -343,3 +486,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py index 119a168c8bc7..5b4857506b63 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, 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.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace 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, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.SecurityInsights/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -37,7 +64,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.OperationsList"] + **kwargs: Any + ) -> Iterable["_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 @@ -57,35 +84,32 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationsList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationsList', pipeline_response) + deserialized = self._deserialize("OperationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +127,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data )