From d86bd4de7ff5bba1f3f3e596d9bba23e11c63da9 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 24 Aug 2021 07:33:32 +0000 Subject: [PATCH] CodeGen from PR 15761 in Azure/azure-rest-api-specs Merge 3291fc14aa322bb700c18ded7f537a8ebfe5dc08 into 21056051e0ceb137195559aeff9df03f56a5d9af --- .../azure-mgmt-securityinsight/MANIFEST.in | 1 + .../azure-mgmt-securityinsight/_meta.json | 11 + .../azure/mgmt/securityinsight/_metadata.json | 73 ++++- .../securityinsight/_security_insights.py | 30 +- .../securityinsight/aio/_security_insights.py | 29 +- .../aio/operations/__init__.py | 4 +- .../aio/operations/_actions_operations.py | 222 ++++++++++++- .../_alert_rule_templates_operations.py | 16 +- .../aio/operations/_alert_rules_operations.py | 236 +------------- .../aio/operations/_bookmarks_operations.py | 26 +- .../operations/_data_connectors_operations.py | 26 +- .../_incident_comments_operations.py | 32 +- .../aio/operations/_incidents_operations.py | 26 +- .../aio/operations/_operations.py | 10 +- .../mgmt/securityinsight/models/__init__.py | 20 +- .../mgmt/securityinsight/models/_models.py | 277 +++++----------- .../securityinsight/models/_models_py3.py | 301 +++++------------- .../models/_security_insights_enums.py | 104 +++--- .../securityinsight/operations/__init__.py | 4 +- .../operations/_actions_operations.py | 223 ++++++++++++- .../_alert_rule_templates_operations.py | 12 +- .../operations/_alert_rules_operations.py | 231 +------------- .../operations/_bookmarks_operations.py | 18 +- .../operations/_data_connectors_operations.py | 18 +- .../_incident_comments_operations.py | 26 +- .../operations/_incidents_operations.py | 18 +- .../securityinsight/operations/_operations.py | 8 +- 27 files changed, 908 insertions(+), 1094 deletions(-) create mode 100644 sdk/securityinsight/azure-mgmt-securityinsight/_meta.json diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/MANIFEST.in b/sdk/securityinsight/azure-mgmt-securityinsight/MANIFEST.in index a3cb07df87658..3a9b6517412bc 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/MANIFEST.in +++ b/sdk/securityinsight/azure-mgmt-securityinsight/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json b/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json new file mode 100644 index 0000000000000..57b5a58162a77 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "0e45df7785faa80de410a215a5873f3338e26a08", + "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 --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/securityinsights/resource-manager/readme.md" +} \ No newline at end of file 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 2c797fe0828e2..5c97a0fc4a1ed 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_metadata.json +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_metadata.json @@ -8,32 +8,35 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": 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\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"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\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "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,67 @@ }, "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=None, # type: Optional[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: Optional[str] = None,", + "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_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"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/_security_insights.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_security_insights.py index 8dc3a18483003..d84c23e6673c6 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 @@ -16,14 +16,15 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse 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 Operations from .operations import IncidentsOperations from .operations import IncidentCommentsOperations from . import models @@ -32,8 +33,6 @@ class SecurityInsights(object): """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 @@ -44,6 +43,8 @@ class SecurityInsights(object): :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 @@ -70,10 +71,9 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - 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( @@ -84,11 +84,31 @@ def __init__( 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, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + 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}$'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() 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 672821af56408..f52d3f784b367 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 @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -16,12 +17,12 @@ 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 Operations from .operations import IncidentsOperations from .operations import IncidentCommentsOperations from .. import models @@ -30,8 +31,6 @@ class SecurityInsights(object): """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 @@ -42,6 +41,8 @@ class SecurityInsights(object): :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 @@ -67,10 +68,9 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - 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( @@ -81,11 +81,30 @@ def __init__( 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) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + 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}$'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + 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 f941c6be95268..e6b787caab92b 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 5598d64a5155e..d3245fffc56ce 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,7 +5,7 @@ # 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 +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class ActionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -46,8 +46,8 @@ def list_by_alert_rule( 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,7 +62,7 @@ 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 } @@ -119,3 +119,213 @@ async def get_next(next_link=None): 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 + + 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', {})) + 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'), + '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.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( + 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', {})) + 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'), + '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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} # type: ignore + + 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', {})) + 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'), + '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.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 9592715682352..c1372027f2af9 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class AlertRuleTemplatesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,8 +45,8 @@ 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 @@ -59,7 +59,7 @@ def list( :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 } @@ -121,8 +121,8 @@ async def get( 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,7 +137,7 @@ 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 } 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 dc8d482b3bacb..a362dc477fe42 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class AlertRulesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,8 +45,8 @@ 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 @@ -59,7 +59,7 @@ def list( :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 } @@ -121,8 +121,8 @@ async def get( 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,7 +137,7 @@ 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 } @@ -184,9 +184,9 @@ async def create_or_update( 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,7 +203,7 @@ 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 } @@ -259,7 +259,7 @@ async def delete( resource_group_name: str, workspace_name: str, rule_id: str, - **kwargs + **kwargs: Any ) -> None: """Delete the alert rule. @@ -313,213 +313,3 @@ async def delete( return cls(pipeline_response, None, {}) 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 618342ea869f9..f804ab1327174 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class BookmarksOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,8 +45,8 @@ 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 @@ -59,7 +59,7 @@ def list( :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 } @@ -121,8 +121,8 @@ async def get( 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,7 +137,7 @@ 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 } @@ -184,9 +184,9 @@ async def create_or_update( 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,7 +203,7 @@ 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 } @@ -259,7 +259,7 @@ async def delete( resource_group_name: str, workspace_name: str, bookmark_id: str, - **kwargs + **kwargs: Any ) -> None: """Delete the bookmark. 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 e60e929f3ad2a..dd7fecb8c8b1c 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class DataConnectorsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,8 +45,8 @@ 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 @@ -59,7 +59,7 @@ def list( :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 } @@ -121,8 +121,8 @@ async def get( 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,7 +137,7 @@ 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 } @@ -184,9 +184,9 @@ async def create_or_update( 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,7 +203,7 @@ 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 } @@ -259,7 +259,7 @@ async def delete( resource_group_name: str, workspace_name: str, data_connector_id: str, - **kwargs + **kwargs: Any ) -> None: """Delete the data connector. 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 66801b1a0b8a0..d6a7892576a52 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class IncidentCommentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -50,8 +50,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 @@ -76,7 +76,7 @@ def list_by_incident( :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 } @@ -148,8 +148,8 @@ async def get( 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,7 +166,7 @@ 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 } @@ -215,9 +215,9 @@ async def create_comment( 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,20 +229,18 @@ 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" @@ -268,7 +266,7 @@ async def create_comment( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_incident_comment, 'IncidentComment') + 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) 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 b807274d9d3a3..a8a3c12ecfce9 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class IncidentsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -49,8 +49,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 @@ -73,7 +73,7 @@ def list( :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 } @@ -143,8 +143,8 @@ async def get( 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,7 +159,7 @@ 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 } @@ -206,9 +206,9 @@ async def create_or_update( 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,7 +225,7 @@ 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 } @@ -281,7 +281,7 @@ async def delete( resource_group_name: str, workspace_name: str, incident_id: str, - **kwargs + **kwargs: Any ) -> None: """Delete the incident. 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 a166ff37b8d7f..2923cda8ce3f0 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -43,8 +43,8 @@ def __init__(self, client, config, serializer, deserializer) -> None: 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 @@ -52,7 +52,7 @@ def list( :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 } 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 1bb2dbf0fa833..20a305a7ef588 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 @@ -59,6 +59,7 @@ 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 @@ -68,13 +69,10 @@ 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 @@ -129,6 +127,7 @@ from ._models import OfficeDataConnectorDataTypes # type: ignore from ._models import OfficeDataConnectorDataTypesExchange # type: ignore from ._models import OfficeDataConnectorDataTypesSharePoint # type: ignore + from ._models import OfficeDataConnectorDataTypesTeams # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore from ._models import OperationsList # type: ignore @@ -138,20 +137,16 @@ 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 ._security_insights_enums import ( AlertRuleKind, AlertSeverity, AttackTactic, - CaseSeverity, DataConnectorKind, DataTypeState, IncidentClassification, @@ -159,10 +154,7 @@ IncidentLabelType, IncidentSeverity, IncidentStatus, - LicenseStatus, MicrosoftSecurityProductName, - SettingKind, - StatusInMcas, TemplateStatus, TriggerOperator, ) @@ -220,6 +212,7 @@ 'OfficeDataConnectorDataTypes', 'OfficeDataConnectorDataTypesExchange', 'OfficeDataConnectorDataTypesSharePoint', + 'OfficeDataConnectorDataTypesTeams', 'Operation', 'OperationDisplay', 'OperationsList', @@ -229,18 +222,14 @@ 'ScheduledAlertRuleCommonProperties', 'ScheduledAlertRuleProperties', 'ScheduledAlertRuleTemplate', - 'Settings', 'TIDataConnector', 'TIDataConnectorDataTypes', 'TIDataConnectorDataTypesIndicators', 'ThreatIntelligence', - 'ToggleSettings', - 'UebaSettings', 'UserInfo', 'AlertRuleKind', 'AlertSeverity', 'AttackTactic', - 'CaseSeverity', 'DataConnectorKind', 'DataTypeState', 'IncidentClassification', @@ -248,10 +237,7 @@ 'IncidentLabelType', 'IncidentSeverity', 'IncidentStatus', - 'LicenseStatus', 'MicrosoftSecurityProductName', - 'SettingKind', - 'StatusInMcas', 'TemplateStatus', 'TriggerOperator', ] 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 index cc96121bf59e8..54c85caae24b4 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_models.py @@ -211,9 +211,8 @@ 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}. + :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 """ @@ -246,9 +245,8 @@ class ActionRequest(ResourceWithEtag): :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}. + :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 @@ -283,16 +281,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}. + :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. + :param trigger_uri: Required. Logic App Callback URL for this specific workflow. :type trigger_uri: str """ _validation = { 'logic_app_resource_id': {'required': True}, + 'trigger_uri': {'required': True}, } _attribute_map = { @@ -305,7 +303,7 @@ def __init__( **kwargs ): super(ActionRequestProperties, self).__init__(**kwargs) - self.trigger_uri = kwargs.get('trigger_uri', None) + self.trigger_uri = kwargs['trigger_uri'] class Resource(msrest.serialization.Model): @@ -356,9 +354,8 @@ class ActionResponse(Resource): :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}. + :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 @@ -394,9 +391,8 @@ 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}. + :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 @@ -806,11 +802,11 @@ 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 + :type logs: ~azure.mgmt.securityinsight.models.AwsCloudTrailDataConnectorDataTypesLogs """ _attribute_map = { - 'logs': {'key': 'logs', 'type': 'DataConnectorDataTypeCommon'}, + 'logs': {'key': 'logs', 'type': 'AwsCloudTrailDataConnectorDataTypesLogs'}, } def __init__( @@ -891,6 +887,12 @@ class Bookmark(ResourceWithEtag): :type updated: ~datetime.datetime :param updated_by: Describes a user that updated the bookmark. :type updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :param event_time: The bookmark event time. + :type event_time: ~datetime.datetime + :param query_start_time: The start time for the query. + :type query_start_time: ~datetime.datetime + :param query_end_time: The end time for the query. + :type query_end_time: ~datetime.datetime :param incident_info: Describes an incident that relates to bookmark. :type incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo """ @@ -915,6 +917,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'}, } @@ -932,6 +937,9 @@ def __init__( self.query_result = kwargs.get('query_result', None) self.updated = kwargs.get('updated', None) self.updated_by = kwargs.get('updated_by', None) + self.event_time = kwargs.get('event_time', None) + self.query_start_time = kwargs.get('query_start_time', None) + self.query_end_time = kwargs.get('query_end_time', None) self.incident_info = kwargs.get('incident_info', None) @@ -1057,7 +1065,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 = { @@ -1519,26 +1527,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. + :param incident_id: 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. + :param severity: The severity of the incident. Possible values include: "High", "Medium", + "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :param title: The title of the incident. :type title: str - :param relation_name: Required. Relation Name. + :param relation_name: 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'}, @@ -1551,10 +1550,10 @@ def __init__( **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'] + self.incident_id = kwargs.get('incident_id', None) + self.severity = kwargs.get('severity', None) + self.title = kwargs.get('title', None) + self.relation_name = kwargs.get('relation_name', None) class IncidentLabel(msrest.serialization.Model): @@ -2183,14 +2182,17 @@ 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 + :type exchange: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesExchange :param share_point: SharePoint data type connection. - :type share_point: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + :type share_point: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesSharePoint + :param teams: Teams data type connection. + :type 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__( @@ -2200,6 +2202,7 @@ def __init__( super(OfficeDataConnectorDataTypes, self).__init__(**kwargs) self.exchange = kwargs.get('exchange', None) self.share_point = kwargs.get('share_point', None) + self.teams = kwargs.get('teams', None) class OfficeDataConnectorDataTypesExchange(DataConnectorDataTypeCommon): @@ -2240,6 +2243,25 @@ def __init__( super(OfficeDataConnectorDataTypesSharePoint, self).__init__(**kwargs) +class OfficeDataConnectorDataTypesTeams(DataConnectorDataTypeCommon): + """Teams 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(OfficeDataConnectorDataTypesTeams, self).__init__(**kwargs) + + class Operation(msrest.serialization.Model): """Operation provided by provider. @@ -2247,11 +2269,14 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.securityinsight.models.OperationDisplay :param name: Name of the operation. :type name: str + :param origin: The origin of the operation. + :type origin: str """ _attribute_map = { 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'name': {'key': 'name', 'type': 'str'}, + 'origin': {'key': 'origin', 'type': 'str'}, } def __init__( @@ -2261,6 +2286,7 @@ def __init__( super(Operation, self).__init__(**kwargs) self.display = kwargs.get('display', None) self.name = kwargs.get('name', None) + self.origin = kwargs.get('origin', None) class OperationDisplay(msrest.serialization.Model): @@ -2647,56 +2673,6 @@ def __init__( 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. @@ -2770,6 +2746,8 @@ class TIDataConnector(DataConnector): :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 tip_lookback_period: The lookback period for the feed to be imported. + :type tip_lookback_period: ~datetime.datetime :param data_types: The available data types for the connector. :type data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes """ @@ -2788,6 +2766,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'}, } @@ -2798,6 +2777,7 @@ def __init__( super(TIDataConnector, self).__init__(**kwargs) self.kind = 'ThreatIntelligence' # type: str self.tenant_id = kwargs.get('tenant_id', None) + self.tip_lookback_period = kwargs.get('tip_lookback_period', None) self.data_types = kwargs.get('data_types', None) @@ -2805,11 +2785,11 @@ 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 + :type indicators: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypesIndicators """ _attribute_map = { - 'indicators': {'key': 'indicators', 'type': 'DataConnectorDataTypeCommon'}, + 'indicators': {'key': 'indicators', 'type': 'TIDataConnectorDataTypesIndicators'}, } def __init__( @@ -2839,113 +2819,6 @@ def __init__( 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. 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 d160c0d2b4376..10fbe3e81586a 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 @@ -228,9 +228,8 @@ 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}. + :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 """ @@ -265,9 +264,8 @@ class ActionRequest(ResourceWithEtag): :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}. + :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 @@ -306,16 +304,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}. + :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. + :param trigger_uri: Required. Logic App Callback URL for this specific workflow. :type trigger_uri: str """ _validation = { 'logic_app_resource_id': {'required': True}, + 'trigger_uri': {'required': True}, } _attribute_map = { @@ -327,7 +325,7 @@ def __init__( self, *, logic_app_resource_id: str, - trigger_uri: Optional[str] = None, + trigger_uri: str, **kwargs ): super(ActionRequestProperties, self).__init__(logic_app_resource_id=logic_app_resource_id, **kwargs) @@ -382,9 +380,8 @@ class ActionResponse(Resource): :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}. + :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 @@ -424,9 +421,8 @@ 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}. + :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 @@ -865,17 +861,17 @@ 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 + :type 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 ): super(AwsCloudTrailDataConnectorDataTypes, self).__init__(**kwargs) @@ -956,6 +952,12 @@ class Bookmark(ResourceWithEtag): :type updated: ~datetime.datetime :param updated_by: Describes a user that updated the bookmark. :type updated_by: ~azure.mgmt.securityinsight.models.UserInfo + :param event_time: The bookmark event time. + :type event_time: ~datetime.datetime + :param query_start_time: The start time for the query. + :type query_start_time: ~datetime.datetime + :param query_end_time: The end time for the query. + :type query_end_time: ~datetime.datetime :param incident_info: Describes an incident that relates to bookmark. :type incident_info: ~azure.mgmt.securityinsight.models.IncidentInfo """ @@ -980,6 +982,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,6 +1001,9 @@ 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 ): @@ -1009,6 +1017,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 @@ -1145,7 +1156,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 = { @@ -1636,26 +1647,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. + :param incident_id: 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. + :param severity: The severity of the incident. Possible values include: "High", "Medium", + "Low", "Informational". + :type severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity + :param title: The title of the incident. :type title: str - :param relation_name: Required. Relation Name. + :param relation_name: 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'}, @@ -1666,10 +1668,10 @@ class IncidentInfo(msrest.serialization.Model): def __init__( self, *, - incident_id: str, - severity: Union[str, "CaseSeverity"], - title: str, - relation_name: str, + incident_id: Optional[str] = None, + severity: Optional[Union[str, "IncidentSeverity"]] = None, + title: Optional[str] = None, + relation_name: Optional[str] = None, **kwargs ): super(IncidentInfo, self).__init__(**kwargs) @@ -2367,26 +2369,31 @@ 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 + :type exchange: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesExchange :param share_point: SharePoint data type connection. - :type share_point: ~azure.mgmt.securityinsight.models.DataConnectorDataTypeCommon + :type share_point: ~azure.mgmt.securityinsight.models.OfficeDataConnectorDataTypesSharePoint + :param teams: Teams data type connection. + :type 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, + exchange: Optional["OfficeDataConnectorDataTypesExchange"] = None, + share_point: Optional["OfficeDataConnectorDataTypesSharePoint"] = None, + teams: Optional["OfficeDataConnectorDataTypesTeams"] = None, **kwargs ): super(OfficeDataConnectorDataTypes, self).__init__(**kwargs) self.exchange = exchange self.share_point = share_point + self.teams = teams class OfficeDataConnectorDataTypesExchange(DataConnectorDataTypeCommon): @@ -2431,6 +2438,27 @@ def __init__( super(OfficeDataConnectorDataTypesSharePoint, self).__init__(state=state, **kwargs) +class OfficeDataConnectorDataTypesTeams(DataConnectorDataTypeCommon): + """Teams data type connection. + + :param state: Describe whether this data type connection is enabled or not. Possible values + include: "Enabled", "Disabled". + :type state: str or ~azure.mgmt.securityinsight.models.DataTypeState + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "DataTypeState"]] = None, + **kwargs + ): + super(OfficeDataConnectorDataTypesTeams, self).__init__(state=state, **kwargs) + + class Operation(msrest.serialization.Model): """Operation provided by provider. @@ -2438,11 +2466,14 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.securityinsight.models.OperationDisplay :param name: Name of the operation. :type name: str + :param origin: The origin of the operation. + :type origin: str """ _attribute_map = { 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'name': {'key': 'name', 'type': 'str'}, + 'origin': {'key': 'origin', 'type': 'str'}, } def __init__( @@ -2450,11 +2481,13 @@ def __init__( *, display: Optional["OperationDisplay"] = None, name: Optional[str] = None, + origin: Optional[str] = None, **kwargs ): super(Operation, self).__init__(**kwargs) self.display = display self.name = name + self.origin = origin class OperationDisplay(msrest.serialization.Model): @@ -2898,58 +2931,6 @@ def __init__( self.tactics = tactics -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, - *, - etag: Optional[str] = None, - **kwargs - ): - super(Settings, self).__init__(etag=etag, **kwargs) - self.kind = 'Settings' # type: str - - class ThreatIntelligence(msrest.serialization.Model): """ThreatIntelligence property bag. @@ -3023,6 +3004,8 @@ class TIDataConnector(DataConnector): :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 tip_lookback_period: The lookback period for the feed to be imported. + :type tip_lookback_period: ~datetime.datetime :param data_types: The available data types for the connector. :type data_types: ~azure.mgmt.securityinsight.models.TIDataConnectorDataTypes """ @@ -3041,6 +3024,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,12 +3033,14 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, + tip_lookback_period: Optional[datetime.datetime] = None, data_types: Optional["TIDataConnectorDataTypes"] = None, **kwargs ): 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 @@ -3062,17 +3048,17 @@ 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 + :type 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 ): super(TIDataConnectorDataTypes, self).__init__(**kwargs) @@ -3100,119 +3086,6 @@ def __init__( super(TIDataConnectorDataTypesIndicators, self).__init__(state=state, **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, - *, - etag: Optional[str] = None, - is_enabled: Optional[bool] = None, - **kwargs - ): - super(ToggleSettings, self).__init__(etag=etag, **kwargs) - self.kind = 'ToggleSettings' # type: str - self.is_enabled = is_enabled - - -class UebaSettings(Settings): - """Represents settings for User and Entity Behavior Analytics enablement. - - Variables are only populated by the server, and will be ignored when sending a request. - - 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, - *, - etag: Optional[str] = None, - is_enabled: Optional[bool] = None, - **kwargs - ): - super(UebaSettings, self).__init__(etag=etag, **kwargs) - self.kind = 'UebaSettings' # type: str - self.atp_license_status = None - self.is_enabled = is_enabled - self.status_in_mcas = None - - class UserInfo(msrest.serialization.Model): """User information that made some action. 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 b97f5497911bf..8f762bd520e68 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 @@ -38,10 +38,14 @@ 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)): """The severity for alerts created by this alert rule. @@ -60,16 +64,6 @@ class AttackTactic(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COMMAND_AND_CONTROL = "CommandAndControl" IMPACT = "Impact" -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. - class DataConnectorKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The kind of the data connector """ @@ -94,50 +88,60 @@ 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)): """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)): """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)): """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)): """The status of the incident """ - NEW = "New" #: An active incident which isn't being handled currently. - ACTIVE = "Active" #: An active incident which is being handled. - CLOSED = "Closed" #: A non-active incident. - -class LicenseStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Determines whether the tenant has ATP (Advanced Threat Protection) license. - """ - - ENABLED = "Enabled" - DISABLED = "Disabled" + #: 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 MicrosoftSecurityProductName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The alerts' productName on which the cases will be generated @@ -149,28 +153,16 @@ 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)): - """The kind of the setting - """ - - UEBA_SETTINGS = "UebaSettings" - TOGGLE_SETTINGS = "ToggleSettings" - -class StatusInMcas(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Determines whether User and Entity Behavior Analytics is enabled from MCAS (Microsoft Cloud App - Security). - """ - - ENABLED = "Enabled" - DISABLED = "Disabled" - 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)): """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 f941c6be95268..e6b787caab92b 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 f8595befd039a..6c962315df855 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 @@ -14,11 +14,11 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + 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]] @@ -37,7 +37,7 @@ class ActionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -52,7 +52,7 @@ def list_by_alert_rule( rule_id, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.ActionsList"] + # type: (...) -> 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,7 +67,7 @@ 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 } @@ -124,3 +124,216 @@ def get_next(next_link=None): 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 + + def get( + 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.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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} # type: ignore + + def create_or_update( + 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.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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} # type: ignore + + def delete( + 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.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.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 2c286fadb5b76..7336fff6a8f06 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class AlertRuleTemplatesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list( workspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.AlertRuleTemplatesList"] + # type: (...) -> Iterable["_models.AlertRuleTemplatesList"] """Gets all alert rule templates. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,7 +64,7 @@ def list( :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 } @@ -128,7 +128,7 @@ def get( alert_rule_template_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.AlertRuleTemplate" + # type: (...) -> "_models.AlertRuleTemplate" """Gets the alert rule template. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -143,7 +143,7 @@ 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 } 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 9e23839b9f918..ea7ea558f04c5 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class AlertRulesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list( workspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.AlertRulesList"] + # type: (...) -> Iterable["_models.AlertRulesList"] """Gets all alert rules. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,7 +64,7 @@ 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 } @@ -128,7 +128,7 @@ def get( rule_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.AlertRule" + # type: (...) -> "_models.AlertRule" """Gets the alert rule. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -143,7 +143,7 @@ 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 } @@ -190,10 +190,10 @@ def create_or_update( resource_group_name, # type: str workspace_name, # type: str rule_id, # type: str - alert_rule, # type: "models.AlertRule" + alert_rule, # type: "_models.AlertRule" **kwargs # type: Any ): - # type: (...) -> "models.AlertRule" + # type: (...) -> "_models.AlertRule" """Creates or updates the alert rule. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -210,7 +210,7 @@ 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 } @@ -321,216 +321,3 @@ def delete( return cls(pipeline_response, None, {}) 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 0bc4430e4bac8..ef3097e939274 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class BookmarksOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list( workspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.BookmarkList"] + # type: (...) -> Iterable["_models.BookmarkList"] """Gets all bookmarks. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,7 +64,7 @@ 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 } @@ -128,7 +128,7 @@ def get( bookmark_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Bookmark" + # type: (...) -> "_models.Bookmark" """Gets a bookmark. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -143,7 +143,7 @@ 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 } @@ -190,10 +190,10 @@ def create_or_update( resource_group_name, # type: str workspace_name, # type: str bookmark_id, # type: str - bookmark, # type: "models.Bookmark" + bookmark, # type: "_models.Bookmark" **kwargs # type: Any ): - # type: (...) -> "models.Bookmark" + # type: (...) -> "_models.Bookmark" """Creates or updates the bookmark. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -210,7 +210,7 @@ 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 } 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 288d81fdf9d47..7936b1a11ea44 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class DataConnectorsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,7 +51,7 @@ def list( workspace_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["models.DataConnectorList"] + # type: (...) -> Iterable["_models.DataConnectorList"] """Gets all data connectors. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -64,7 +64,7 @@ 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 } @@ -128,7 +128,7 @@ def get( data_connector_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DataConnector" + # type: (...) -> "_models.DataConnector" """Gets a data connector. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -143,7 +143,7 @@ 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 } @@ -190,10 +190,10 @@ def create_or_update( resource_group_name, # type: str workspace_name, # type: str data_connector_id, # type: str - data_connector, # type: "models.DataConnector" + data_connector, # type: "_models.DataConnector" **kwargs # type: Any ): - # type: (...) -> "models.DataConnector" + # type: (...) -> "_models.DataConnector" """Creates or updates the data connector. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -210,7 +210,7 @@ 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 } 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 cb4f6fa07e1eb..be9f248bc0b1a 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class IncidentCommentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -56,7 +56,7 @@ def list_by_incident( skip_token=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.IncidentCommentList"] + # type: (...) -> Iterable["_models.IncidentCommentList"] """Gets all incident comments. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -81,7 +81,7 @@ 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 } @@ -155,7 +155,7 @@ def get( incident_comment_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.IncidentComment" + # type: (...) -> "_models.IncidentComment" """Gets an incident comment. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -172,7 +172,7 @@ 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 } @@ -221,10 +221,10 @@ def create_comment( workspace_name, # type: str incident_id, # type: str incident_comment_id, # type: str - message=None, # type: Optional[str] + incident_comment, # type: "_models.IncidentComment" **kwargs # type: Any ): - # type: (...) -> "models.IncidentComment" + # type: (...) -> "_models.IncidentComment" """Creates the incident comment. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -236,20 +236,18 @@ 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" @@ -275,7 +273,7 @@ def create_comment( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_incident_comment, 'IncidentComment') + 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) 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 bd8b87ef8e014..e191a9edd93da 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class IncidentsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -55,7 +55,7 @@ def list( skip_token=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.IncidentList"] + # type: (...) -> Iterable["_models.IncidentList"] """Gets all incidents. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -78,7 +78,7 @@ 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 } @@ -150,7 +150,7 @@ def get( incident_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Incident" + # type: (...) -> "_models.Incident" """Gets an incident. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -165,7 +165,7 @@ 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 } @@ -212,10 +212,10 @@ def create_or_update( resource_group_name, # type: str workspace_name, # type: str incident_id, # type: str - incident, # type: "models.Incident" + incident, # type: "_models.Incident" **kwargs # type: Any ): - # type: (...) -> "models.Incident" + # type: (...) -> "_models.Incident" """Creates or updates the incident. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -232,7 +232,7 @@ 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 } 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 119a168c8bc7f..d0b1f1ef53528 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationsList"] + # type: (...) -> 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,7 +57,7 @@ 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 }