diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json b/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json index ac51c182a2ac..050100499267 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json +++ b/sdk/securityinsight/azure-mgmt-securityinsight/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "e432d9cc87bfed320d8feead4b448be9481c9181", + "commit": "8f19637f5d779aa364f1f7cfeeb2c2b7d4980ad9", "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/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/securityinsights/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/securityinsights/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py index d2ae6403da99..ff5c675cf1b3 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['SecurityInsights'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py index 68120f967f9f..519fb6ca53d8 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class SecurityInsightsConfiguration(Configuration): +class SecurityInsightsConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for SecurityInsights. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class SecurityInsightsConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(SecurityInsightsConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-06-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-securityinsight/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_metadata.json b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_metadata.json deleted file mode 100644 index f848734c87ec..000000000000 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_metadata.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "chosen_version": "2022-01-01-preview", - "total_api_version_list": ["2022-01-01-preview"], - "client": { - "name": "SecurityInsights", - "filename": "_security_insights", - "description": "API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SecurityInsightsConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SecurityInsightsConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The ID of the target subscription.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "alert_rules": "AlertRulesOperations", - "actions": "ActionsOperations", - "alert_rule_templates": "AlertRuleTemplatesOperations", - "automation_rules": "AutomationRulesOperations", - "incidents": "IncidentsOperations", - "bookmarks": "BookmarksOperations", - "bookmark_relations": "BookmarkRelationsOperations", - "bookmark": "BookmarkOperations", - "ip_geodata": "IPGeodataOperations", - "domain_whois": "DomainWhoisOperations", - "entities": "EntitiesOperations", - "entities_get_timeline": "EntitiesGetTimelineOperations", - "entities_relations": "EntitiesRelationsOperations", - "entity_relations": "EntityRelationsOperations", - "entity_queries": "EntityQueriesOperations", - "entity_query_templates": "EntityQueryTemplatesOperations", - "incident_comments": "IncidentCommentsOperations", - "incident_relations": "IncidentRelationsOperations", - "metadata": "MetadataOperations", - "office_consents": "OfficeConsentsOperations", - "sentinel_onboarding_states": "SentinelOnboardingStatesOperations", - "product_settings": "ProductSettingsOperations", - "source_control": "SourceControlOperations", - "source_controls": "SourceControlsOperations", - "threat_intelligence_indicator": "ThreatIntelligenceIndicatorOperations", - "threat_intelligence_indicators": "ThreatIntelligenceIndicatorsOperations", - "threat_intelligence_indicator_metrics": "ThreatIntelligenceIndicatorMetricsOperations", - "watchlists": "WatchlistsOperations", - "watchlist_items": "WatchlistItemsOperations", - "data_connectors": "DataConnectorsOperations", - "data_connectors_check_requirements": "DataConnectorsCheckRequirementsOperations", - "operations": "Operations" - } -} \ 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 9f661eb02ace..f1795144e199 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 @@ -7,21 +7,22 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import SecurityInsightsConfiguration -from .operations import ActionsOperations, AlertRuleTemplatesOperations, AlertRulesOperations, AutomationRulesOperations, BookmarkOperations, BookmarkRelationsOperations, BookmarksOperations, DataConnectorsCheckRequirementsOperations, DataConnectorsOperations, DomainWhoisOperations, EntitiesGetTimelineOperations, EntitiesOperations, EntitiesRelationsOperations, EntityQueriesOperations, EntityQueryTemplatesOperations, EntityRelationsOperations, IPGeodataOperations, IncidentCommentsOperations, IncidentRelationsOperations, IncidentsOperations, MetadataOperations, OfficeConsentsOperations, Operations, ProductSettingsOperations, SentinelOnboardingStatesOperations, SourceControlOperations, SourceControlsOperations, ThreatIntelligenceIndicatorMetricsOperations, ThreatIntelligenceIndicatorOperations, ThreatIntelligenceIndicatorsOperations, WatchlistItemsOperations, WatchlistsOperations +from .operations import ActionsOperations, AlertRuleTemplatesOperations, AlertRulesOperations, AutomationRulesOperations, BookmarkOperations, BookmarkRelationsOperations, BookmarksOperations, DataConnectorsCheckRequirementsOperations, DataConnectorsOperations, DomainWhoisOperations, EntitiesGetTimelineOperations, EntitiesOperations, EntitiesRelationsOperations, EntityQueriesOperations, EntityQueryTemplatesOperations, EntityRelationsOperations, IPGeodataOperations, IncidentCommentsOperations, IncidentRelationsOperations, IncidentsOperations, MetadataOperations, OfficeConsentsOperations, Operations, ProductSettingsOperations, SecurityMLAnalyticsSettingsOperations, SentinelOnboardingStatesOperations, SourceControlOperations, SourceControlsOperations, ThreatIntelligenceIndicatorMetricsOperations, ThreatIntelligenceIndicatorOperations, ThreatIntelligenceIndicatorsOperations, WatchlistItemsOperations, WatchlistsOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class SecurityInsights: +class SecurityInsights: # pylint: disable=too-many-instance-attributes """API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. :ivar alert_rules: AlertRulesOperations operations @@ -70,6 +71,9 @@ class SecurityInsights: :ivar sentinel_onboarding_states: SentinelOnboardingStatesOperations operations :vartype sentinel_onboarding_states: azure.mgmt.securityinsight.operations.SentinelOnboardingStatesOperations + :ivar security_ml_analytics_settings: SecurityMLAnalyticsSettingsOperations operations + :vartype security_ml_analytics_settings: + azure.mgmt.securityinsight.operations.SecurityMLAnalyticsSettingsOperations :ivar product_settings: ProductSettingsOperations operations :vartype product_settings: azure.mgmt.securityinsight.operations.ProductSettingsOperations :ivar source_control: SourceControlOperations operations @@ -101,8 +105,11 @@ class SecurityInsights: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -119,43 +126,110 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.alert_rules = AlertRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.actions = ActionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.alert_rule_templates = AlertRuleTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.automation_rules = AutomationRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.incidents = IncidentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bookmarks = BookmarksOperations(self._client, self._config, self._serialize, self._deserialize) - self.bookmark_relations = BookmarkRelationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bookmark = BookmarkOperations(self._client, self._config, self._serialize, self._deserialize) - self.ip_geodata = IPGeodataOperations(self._client, self._config, self._serialize, self._deserialize) - self.domain_whois = DomainWhoisOperations(self._client, self._config, self._serialize, self._deserialize) - self.entities = EntitiesOperations(self._client, self._config, self._serialize, self._deserialize) - self.entities_get_timeline = EntitiesGetTimelineOperations(self._client, self._config, self._serialize, self._deserialize) - self.entities_relations = EntitiesRelationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.entity_relations = EntityRelationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.entity_queries = EntityQueriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.entity_query_templates = EntityQueryTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.incident_comments = IncidentCommentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.incident_relations = IncidentRelationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.metadata = MetadataOperations(self._client, self._config, self._serialize, self._deserialize) - self.office_consents = OfficeConsentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.sentinel_onboarding_states = SentinelOnboardingStatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.product_settings = ProductSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.source_control = SourceControlOperations(self._client, self._config, self._serialize, self._deserialize) - self.source_controls = SourceControlsOperations(self._client, self._config, self._serialize, self._deserialize) - self.threat_intelligence_indicator = ThreatIntelligenceIndicatorOperations(self._client, self._config, self._serialize, self._deserialize) - self.threat_intelligence_indicators = ThreatIntelligenceIndicatorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.threat_intelligence_indicator_metrics = ThreatIntelligenceIndicatorMetricsOperations(self._client, self._config, self._serialize, self._deserialize) - self.watchlists = WatchlistsOperations(self._client, self._config, self._serialize, self._deserialize) - self.watchlist_items = WatchlistItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.data_connectors = DataConnectorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.data_connectors_check_requirements = DataConnectorsCheckRequirementsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.alert_rules = AlertRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.actions = ActionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.alert_rule_templates = AlertRuleTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.automation_rules = AutomationRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.incidents = IncidentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bookmarks = BookmarksOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bookmark_relations = BookmarkRelationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bookmark = BookmarkOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ip_geodata = IPGeodataOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.domain_whois = DomainWhoisOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entities = EntitiesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entities_get_timeline = EntitiesGetTimelineOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entities_relations = EntitiesRelationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entity_relations = EntityRelationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entity_queries = EntityQueriesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entity_query_templates = EntityQueryTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.incident_comments = IncidentCommentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.incident_relations = IncidentRelationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.metadata = MetadataOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.office_consents = OfficeConsentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sentinel_onboarding_states = SentinelOnboardingStatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.security_ml_analytics_settings = SecurityMLAnalyticsSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.product_settings = ProductSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.source_control = SourceControlOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.source_controls = SourceControlsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.threat_intelligence_indicator = ThreatIntelligenceIndicatorOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.threat_intelligence_indicators = ThreatIntelligenceIndicatorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.threat_intelligence_indicator_metrics = ThreatIntelligenceIndicatorMetricsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.watchlists = WatchlistsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.watchlist_items = WatchlistItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_connectors = DataConnectorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_connectors_check_requirements = DataConnectorsCheckRequirementsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_version.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_version.py index dfa6ee022f15..e5754a47ce68 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_version.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py index 56fe86756e38..52954b03f5fc 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._security_insights import SecurityInsights + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['SecurityInsights'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py index c9c59af56698..23a2cf533408 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class SecurityInsightsConfiguration(Configuration): +class SecurityInsightsConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for SecurityInsights. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class SecurityInsightsConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(SecurityInsightsConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-06-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-securityinsight/{}'.format(VERSION)) self._configure(**kwargs) 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 47cd3be5067c..9dc104d9889c 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 @@ -7,21 +7,22 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import SecurityInsightsConfiguration -from .operations import ActionsOperations, AlertRuleTemplatesOperations, AlertRulesOperations, AutomationRulesOperations, BookmarkOperations, BookmarkRelationsOperations, BookmarksOperations, DataConnectorsCheckRequirementsOperations, DataConnectorsOperations, DomainWhoisOperations, EntitiesGetTimelineOperations, EntitiesOperations, EntitiesRelationsOperations, EntityQueriesOperations, EntityQueryTemplatesOperations, EntityRelationsOperations, IPGeodataOperations, IncidentCommentsOperations, IncidentRelationsOperations, IncidentsOperations, MetadataOperations, OfficeConsentsOperations, Operations, ProductSettingsOperations, SentinelOnboardingStatesOperations, SourceControlOperations, SourceControlsOperations, ThreatIntelligenceIndicatorMetricsOperations, ThreatIntelligenceIndicatorOperations, ThreatIntelligenceIndicatorsOperations, WatchlistItemsOperations, WatchlistsOperations +from .operations import ActionsOperations, AlertRuleTemplatesOperations, AlertRulesOperations, AutomationRulesOperations, BookmarkOperations, BookmarkRelationsOperations, BookmarksOperations, DataConnectorsCheckRequirementsOperations, DataConnectorsOperations, DomainWhoisOperations, EntitiesGetTimelineOperations, EntitiesOperations, EntitiesRelationsOperations, EntityQueriesOperations, EntityQueryTemplatesOperations, EntityRelationsOperations, IPGeodataOperations, IncidentCommentsOperations, IncidentRelationsOperations, IncidentsOperations, MetadataOperations, OfficeConsentsOperations, Operations, ProductSettingsOperations, SecurityMLAnalyticsSettingsOperations, SentinelOnboardingStatesOperations, SourceControlOperations, SourceControlsOperations, ThreatIntelligenceIndicatorMetricsOperations, ThreatIntelligenceIndicatorOperations, ThreatIntelligenceIndicatorsOperations, WatchlistItemsOperations, WatchlistsOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class SecurityInsights: +class SecurityInsights: # pylint: disable=too-many-instance-attributes """API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. :ivar alert_rules: AlertRulesOperations operations @@ -74,6 +75,9 @@ class SecurityInsights: :ivar sentinel_onboarding_states: SentinelOnboardingStatesOperations operations :vartype sentinel_onboarding_states: azure.mgmt.securityinsight.aio.operations.SentinelOnboardingStatesOperations + :ivar security_ml_analytics_settings: SecurityMLAnalyticsSettingsOperations operations + :vartype security_ml_analytics_settings: + azure.mgmt.securityinsight.aio.operations.SecurityMLAnalyticsSettingsOperations :ivar product_settings: ProductSettingsOperations operations :vartype product_settings: azure.mgmt.securityinsight.aio.operations.ProductSettingsOperations :ivar source_control: SourceControlOperations operations @@ -105,8 +109,11 @@ class SecurityInsights: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -123,38 +130,105 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.alert_rules = AlertRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.actions = ActionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.alert_rule_templates = AlertRuleTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.automation_rules = AutomationRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.incidents = IncidentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bookmarks = BookmarksOperations(self._client, self._config, self._serialize, self._deserialize) - self.bookmark_relations = BookmarkRelationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bookmark = BookmarkOperations(self._client, self._config, self._serialize, self._deserialize) - self.ip_geodata = IPGeodataOperations(self._client, self._config, self._serialize, self._deserialize) - self.domain_whois = DomainWhoisOperations(self._client, self._config, self._serialize, self._deserialize) - self.entities = EntitiesOperations(self._client, self._config, self._serialize, self._deserialize) - self.entities_get_timeline = EntitiesGetTimelineOperations(self._client, self._config, self._serialize, self._deserialize) - self.entities_relations = EntitiesRelationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.entity_relations = EntityRelationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.entity_queries = EntityQueriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.entity_query_templates = EntityQueryTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.incident_comments = IncidentCommentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.incident_relations = IncidentRelationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.metadata = MetadataOperations(self._client, self._config, self._serialize, self._deserialize) - self.office_consents = OfficeConsentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.sentinel_onboarding_states = SentinelOnboardingStatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.product_settings = ProductSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.source_control = SourceControlOperations(self._client, self._config, self._serialize, self._deserialize) - self.source_controls = SourceControlsOperations(self._client, self._config, self._serialize, self._deserialize) - self.threat_intelligence_indicator = ThreatIntelligenceIndicatorOperations(self._client, self._config, self._serialize, self._deserialize) - self.threat_intelligence_indicators = ThreatIntelligenceIndicatorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.threat_intelligence_indicator_metrics = ThreatIntelligenceIndicatorMetricsOperations(self._client, self._config, self._serialize, self._deserialize) - self.watchlists = WatchlistsOperations(self._client, self._config, self._serialize, self._deserialize) - self.watchlist_items = WatchlistItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.data_connectors = DataConnectorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.data_connectors_check_requirements = DataConnectorsCheckRequirementsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.alert_rules = AlertRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.actions = ActionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.alert_rule_templates = AlertRuleTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.automation_rules = AutomationRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.incidents = IncidentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bookmarks = BookmarksOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bookmark_relations = BookmarkRelationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.bookmark = BookmarkOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ip_geodata = IPGeodataOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.domain_whois = DomainWhoisOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entities = EntitiesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entities_get_timeline = EntitiesGetTimelineOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entities_relations = EntitiesRelationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entity_relations = EntityRelationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entity_queries = EntityQueriesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.entity_query_templates = EntityQueryTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.incident_comments = IncidentCommentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.incident_relations = IncidentRelationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.metadata = MetadataOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.office_consents = OfficeConsentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.sentinel_onboarding_states = SentinelOnboardingStatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.security_ml_analytics_settings = SecurityMLAnalyticsSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.product_settings = ProductSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.source_control = SourceControlOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.source_controls = SourceControlsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.threat_intelligence_indicator = ThreatIntelligenceIndicatorOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.threat_intelligence_indicators = ThreatIntelligenceIndicatorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.threat_intelligence_indicator_metrics = ThreatIntelligenceIndicatorMetricsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.watchlists = WatchlistsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.watchlist_items = WatchlistItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_connectors = DataConnectorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_connectors_check_requirements = DataConnectorsCheckRequirementsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( 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 efbc70ef30fa..d72f9ec4f9b5 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 @@ -27,6 +27,7 @@ from ._metadata_operations import MetadataOperations from ._office_consents_operations import OfficeConsentsOperations from ._sentinel_onboarding_states_operations import SentinelOnboardingStatesOperations +from ._security_ml_analytics_settings_operations import SecurityMLAnalyticsSettingsOperations from ._product_settings_operations import ProductSettingsOperations from ._source_control_operations import SourceControlOperations from ._source_controls_operations import SourceControlsOperations @@ -39,6 +40,9 @@ from ._data_connectors_check_requirements_operations import DataConnectorsCheckRequirementsOperations from ._operations import Operations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AlertRulesOperations', 'ActionsOperations', @@ -61,6 +65,7 @@ 'MetadataOperations', 'OfficeConsentsOperations', 'SentinelOnboardingStatesOperations', + 'SecurityMLAnalyticsSettingsOperations', 'ProductSettingsOperations', 'SourceControlOperations', 'SourceControlsOperations', @@ -73,3 +78,5 @@ 'DataConnectorsCheckRequirementsOperations', 'Operations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file 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 4e343581f2c2..f65e2d5a64b1 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ActionsOperations: - """ActionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`actions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_alert_rule( @@ -53,7 +51,7 @@ def list_by_alert_rule( workspace_name: str, rule_id: str, **kwargs: Any - ) -> AsyncIterable["_models.ActionsList"]: + ) -> AsyncIterable[_models.ActionsList]: """Gets all actions of alert rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -67,11 +65,16 @@ 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"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ActionsList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -80,10 +83,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, rule_id=rule_id, + api_version=api_version, template_url=self.list_by_alert_rule.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -92,10 +98,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, rule_id=rule_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -109,7 +118,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,7 +135,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_alert_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions'} # type: ignore + list_by_alert_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions"} # type: ignore @distributed_trace_async async def get( @@ -132,7 +145,7 @@ async def get( rule_id: str, action_id: str, **kwargs: Any - ) -> "_models.ActionResponse": + ) -> _models.ActionResponse: """Gets the action of alert rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -148,11 +161,16 @@ async def get( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ActionResponse] request = build_get_request( @@ -161,12 +179,19 @@ async def get( workspace_name=workspace_name, rule_id=rule_id, action_id=action_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -180,7 +205,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}"} # type: ignore @distributed_trace_async @@ -190,9 +215,9 @@ async def create_or_update( workspace_name: str, rule_id: str, action_id: str, - action: "_models.ActionRequest", + action: _models.ActionRequest, **kwargs: Any - ) -> "_models.ActionResponse": + ) -> _models.ActionResponse: """Creates or updates the action of alert rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -210,13 +235,17 @@ async def create_or_update( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ActionResponse] _json = self._serialize.body(action, 'ActionRequest') @@ -226,14 +255,21 @@ async def create_or_update( workspace_name=workspace_name, rule_id=rule_id, action_id=action_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -251,11 +287,11 @@ async def create_or_update( 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 + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -278,11 +314,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -291,12 +332,19 @@ async def delete( workspace_name=workspace_name, rule_id=rule_id, action_id=action_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -306,5 +354,5 @@ async def delete( 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 + 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 92357a098536..c868b1d03221 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AlertRuleTemplatesOperations: - """AlertRuleTemplatesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`alert_rule_templates` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -52,7 +50,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AlertRuleTemplatesList"]: + ) -> AsyncIterable[_models.AlertRuleTemplatesList]: """Gets all alert rule templates. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,11 +64,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.AlertRuleTemplatesList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleTemplatesList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AlertRuleTemplatesList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,10 +81,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -89,10 +95,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -106,7 +115,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -119,7 +132,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates"} # type: ignore @distributed_trace_async async def get( @@ -128,7 +141,7 @@ async def get( workspace_name: str, alert_rule_template_id: str, **kwargs: Any - ) -> "_models.AlertRuleTemplate": + ) -> _models.AlertRuleTemplate: """Gets the alert rule template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -142,11 +155,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.AlertRuleTemplate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleTemplate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AlertRuleTemplate] request = build_get_request( @@ -154,12 +172,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, alert_rule_template_id=alert_rule_template_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -173,5 +198,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_alert_rules_operations.py index 6cb30a37a8a0..09b58a5e3775 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AlertRulesOperations: - """AlertRulesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`alert_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -52,7 +50,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AlertRulesList"]: + ) -> AsyncIterable[_models.AlertRulesList]: """Gets all alert rules. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,11 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.AlertRulesList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRulesList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AlertRulesList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -77,10 +80,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,10 +94,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -105,7 +114,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,7 +131,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules"} # type: ignore @distributed_trace_async async def get( @@ -127,7 +140,7 @@ async def get( workspace_name: str, rule_id: str, **kwargs: Any - ) -> "_models.AlertRule": + ) -> _models.AlertRule: """Gets the alert rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,11 +154,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.AlertRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AlertRule] request = build_get_request( @@ -153,12 +171,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, rule_id=rule_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,7 +197,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}"} # type: ignore @distributed_trace_async @@ -181,9 +206,9 @@ async def create_or_update( resource_group_name: str, workspace_name: str, rule_id: str, - alert_rule: "_models.AlertRule", + alert_rule: _models.AlertRule, **kwargs: Any - ) -> "_models.AlertRule": + ) -> _models.AlertRule: """Creates or updates the alert rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -199,13 +224,17 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AlertRule] _json = self._serialize.body(alert_rule, 'AlertRule') @@ -214,14 +243,21 @@ async def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, rule_id=rule_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -239,11 +275,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -263,11 +299,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -275,12 +316,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, rule_id=rule_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -290,5 +338,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py index 2a601fc35fa7..18fc491e93f6 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_automation_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AutomationRulesOperations: - """AutomationRulesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`automation_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get( @@ -53,7 +51,7 @@ async def get( workspace_name: str, automation_rule_id: str, **kwargs: Any - ) -> "_models.AutomationRule": + ) -> _models.AutomationRule: """Gets the automation rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -67,11 +65,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.AutomationRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AutomationRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationRule] request = build_get_request( @@ -79,12 +82,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, automation_rule_id=automation_rule_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,7 +108,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}"} # type: ignore @distributed_trace_async @@ -107,9 +117,9 @@ async def create_or_update( resource_group_name: str, workspace_name: str, automation_rule_id: str, - automation_rule_to_upsert: Optional["_models.AutomationRule"] = None, + automation_rule_to_upsert: Optional[_models.AutomationRule] = None, **kwargs: Any - ) -> "_models.AutomationRule": + ) -> _models.AutomationRule: """Creates or updates the automation rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -118,20 +128,24 @@ async def create_or_update( :type workspace_name: str :param automation_rule_id: Automation rule ID. :type automation_rule_id: str - :param automation_rule_to_upsert: The automation rule. + :param automation_rule_to_upsert: The automation rule. Default value is None. :type automation_rule_to_upsert: ~azure.mgmt.securityinsight.models.AutomationRule :keyword callable cls: A custom type or function that will be passed the direct response :return: AutomationRule, or the result of cls(response) :rtype: ~azure.mgmt.securityinsight.models.AutomationRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AutomationRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationRule] if automation_rule_to_upsert is not None: _json = self._serialize.body(automation_rule_to_upsert, 'AutomationRule') @@ -143,14 +157,21 @@ async def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, automation_rule_id=automation_rule_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -168,7 +189,7 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}"} # type: ignore @distributed_trace_async @@ -192,11 +213,16 @@ async def delete( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Any] request = build_delete_request( @@ -204,12 +230,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, automation_rule_id=automation_rule_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -227,7 +260,7 @@ async def delete( return deserialized - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}"} # type: ignore @distributed_trace @@ -236,7 +269,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AutomationRulesList"]: + ) -> AsyncIterable[_models.AutomationRulesList]: """Gets all automation rules. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -249,11 +282,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.AutomationRulesList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AutomationRulesList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationRulesList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -261,10 +299,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -272,10 +313,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -289,7 +333,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -302,4 +350,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py index fa6c70904179..8fa2104b0491 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class BookmarkOperations: - """BookmarkOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`bookmark` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def expand( @@ -50,9 +48,9 @@ async def expand( resource_group_name: str, workspace_name: str, bookmark_id: str, - parameters: "_models.BookmarkExpandParameters", + parameters: _models.BookmarkExpandParameters, **kwargs: Any - ) -> "_models.BookmarkExpandResponse": + ) -> _models.BookmarkExpandResponse: """Expand an bookmark. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,13 +67,17 @@ async def expand( :rtype: ~azure.mgmt.securityinsight.models.BookmarkExpandResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BookmarkExpandResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BookmarkExpandResponse] _json = self._serialize.body(parameters, 'BookmarkExpandParameters') @@ -84,14 +86,21 @@ async def expand( resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.expand.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,5 +114,5 @@ async def expand( return deserialized - expand.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/expand'} # type: ignore + expand.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/expand"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py index 41c9442680cb..2dd0d4f0af43 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_bookmark_relations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class BookmarkRelationsOperations: - """BookmarkRelationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`bookmark_relations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -57,7 +55,7 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RelationList"]: + ) -> AsyncIterable[_models.RelationList]: """Gets all bookmark relations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,15 +64,17 @@ def list( :type workspace_name: str :param bookmark_id: Bookmark ID. :type bookmark_id: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RelationList or the result of cls(response) @@ -82,11 +82,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.RelationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RelationList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RelationList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -95,14 +100,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -111,14 +119,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -132,7 +143,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -145,7 +160,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations"} # type: ignore @distributed_trace_async async def get( @@ -155,7 +170,7 @@ async def get( bookmark_id: str, relation_name: str, **kwargs: Any - ) -> "_models.Relation": + ) -> _models.Relation: """Gets a bookmark relation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -171,11 +186,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.Relation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Relation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Relation] request = build_get_request( @@ -184,12 +204,19 @@ async def get( workspace_name=workspace_name, bookmark_id=bookmark_id, relation_name=relation_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -203,7 +230,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}"} # type: ignore @distributed_trace_async @@ -213,9 +240,9 @@ async def create_or_update( workspace_name: str, bookmark_id: str, relation_name: str, - relation: "_models.Relation", + relation: _models.Relation, **kwargs: Any - ) -> "_models.Relation": + ) -> _models.Relation: """Creates the bookmark relation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -233,13 +260,17 @@ async def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Relation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Relation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Relation] _json = self._serialize.body(relation, 'Relation') @@ -249,14 +280,21 @@ async def create_or_update( workspace_name=workspace_name, bookmark_id=bookmark_id, relation_name=relation_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -274,11 +312,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -301,11 +339,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -314,12 +357,19 @@ async def delete( workspace_name=workspace_name, bookmark_id=bookmark_id, relation_name=relation_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -329,5 +379,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}"} # 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 0472c8113b26..0e0171d37964 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class BookmarksOperations: - """BookmarksOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`bookmarks` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -52,7 +50,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BookmarkList"]: + ) -> AsyncIterable[_models.BookmarkList]: """Gets all bookmarks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,11 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.BookmarkList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BookmarkList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.BookmarkList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -77,10 +80,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,10 +94,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -105,7 +114,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,7 +131,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks"} # type: ignore @distributed_trace_async async def get( @@ -127,7 +140,7 @@ async def get( workspace_name: str, bookmark_id: str, **kwargs: Any - ) -> "_models.Bookmark": + ) -> _models.Bookmark: """Gets a bookmark. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,11 +154,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.Bookmark :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Bookmark"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Bookmark] request = build_get_request( @@ -153,12 +171,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,7 +197,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}"} # type: ignore @distributed_trace_async @@ -181,9 +206,9 @@ async def create_or_update( resource_group_name: str, workspace_name: str, bookmark_id: str, - bookmark: "_models.Bookmark", + bookmark: _models.Bookmark, **kwargs: Any - ) -> "_models.Bookmark": + ) -> _models.Bookmark: """Creates or updates the bookmark. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -199,13 +224,17 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Bookmark] _json = self._serialize.body(bookmark, 'Bookmark') @@ -214,14 +243,21 @@ async def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -239,11 +275,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -263,11 +299,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -275,12 +316,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -290,5 +338,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py index 829eb1c4b928..384e7fbf8eb6 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_check_requirements_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class DataConnectorsCheckRequirementsOperations: - """DataConnectorsCheckRequirementsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`data_connectors_check_requirements` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def post( self, resource_group_name: str, workspace_name: str, - data_connectors_check_requirements: "_models.DataConnectorsCheckRequirements", + data_connectors_check_requirements: _models.DataConnectorsCheckRequirements, **kwargs: Any - ) -> "_models.DataConnectorRequirementsState": + ) -> _models.DataConnectorRequirementsState: """Get requirements state for a data connector type. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,13 +64,17 @@ async def post( :rtype: ~azure.mgmt.securityinsight.models.DataConnectorRequirementsState :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectorRequirementsState"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataConnectorRequirementsState] _json = self._serialize.body(data_connectors_check_requirements, 'DataConnectorsCheckRequirements') @@ -80,14 +82,21 @@ async def post( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,5 +110,5 @@ async def post( return deserialized - post.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorsCheckRequirements'} # type: ignore + post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorsCheckRequirements"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_data_connectors_operations.py index 2d98e622cdf1..29904cf11185 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class DataConnectorsOperations: - """DataConnectorsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`data_connectors` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -52,7 +50,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DataConnectorList"]: + ) -> AsyncIterable[_models.DataConnectorList]: """Gets all data connectors. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,11 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.DataConnectorList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectorList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataConnectorList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -77,10 +80,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,10 +94,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -105,7 +114,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,7 +131,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors"} # type: ignore @distributed_trace_async async def get( @@ -127,7 +140,7 @@ async def get( workspace_name: str, data_connector_id: str, **kwargs: Any - ) -> "_models.DataConnector": + ) -> _models.DataConnector: """Gets a data connector. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,11 +154,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.DataConnector :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnector"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataConnector] request = build_get_request( @@ -153,12 +171,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, data_connector_id=data_connector_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,7 +197,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}"} # type: ignore @distributed_trace_async @@ -181,9 +206,9 @@ async def create_or_update( resource_group_name: str, workspace_name: str, data_connector_id: str, - data_connector: "_models.DataConnector", + data_connector: _models.DataConnector, **kwargs: Any - ) -> "_models.DataConnector": + ) -> _models.DataConnector: """Creates or updates the data connector. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -199,13 +224,17 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataConnector] _json = self._serialize.body(data_connector, 'DataConnector') @@ -214,14 +243,21 @@ async def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, data_connector_id=data_connector_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -239,11 +275,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -263,11 +299,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -275,12 +316,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, data_connector_id=data_connector_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -290,16 +338,16 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}"} # type: ignore @distributed_trace_async - async def connect( + async def connect( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, data_connector_id: str, - connect_body: "_models.DataConnectorConnectBody", + connect_body: _models.DataConnectorConnectBody, **kwargs: Any ) -> None: """Connects a data connector. @@ -317,13 +365,17 @@ async def connect( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(connect_body, 'DataConnectorConnectBody') @@ -332,14 +384,21 @@ async def connect( resource_group_name=resource_group_name, workspace_name=workspace_name, data_connector_id=data_connector_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.connect.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -349,11 +408,11 @@ async def connect( if cls: return cls(pipeline_response, None, {}) - connect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/connect'} # type: ignore + connect.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/connect"} # type: ignore @distributed_trace_async - async def disconnect( + async def disconnect( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -373,11 +432,16 @@ async def disconnect( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_disconnect_request( @@ -385,12 +449,19 @@ async def disconnect( resource_group_name=resource_group_name, workspace_name=workspace_name, data_connector_id=data_connector_id, + api_version=api_version, template_url=self.disconnect.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -400,5 +471,5 @@ async def disconnect( if cls: return cls(pipeline_response, None, {}) - disconnect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/disconnect'} # type: ignore + disconnect.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/disconnect"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py index 9cc726720581..4f20ef8fcc95 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_domain_whois_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class DomainWhoisOperations: - """DomainWhoisOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`domain_whois` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get( @@ -50,7 +48,7 @@ async def get( resource_group_name: str, domain: str, **kwargs: Any - ) -> "_models.EnrichmentDomainWhois": + ) -> _models.EnrichmentDomainWhois: """Get whois information for a single domain name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -62,23 +60,35 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhois :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnrichmentDomainWhois"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EnrichmentDomainWhois] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, domain=domain, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -92,5 +102,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/domain/whois/'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/domain/whois/"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py index 3457145c9c96..b4c43779eaeb 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_get_timeline_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class EntitiesGetTimelineOperations: - """EntitiesGetTimelineOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`entities_get_timeline` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def list( @@ -50,9 +48,9 @@ async def list( resource_group_name: str, workspace_name: str, entity_id: str, - parameters: "_models.EntityTimelineParameters", + parameters: _models.EntityTimelineParameters, **kwargs: Any - ) -> "_models.EntityTimelineResponse": + ) -> _models.EntityTimelineResponse: """Timeline for an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,13 +67,17 @@ async def list( :rtype: ~azure.mgmt.securityinsight.models.EntityTimelineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityTimelineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityTimelineResponse] _json = self._serialize.body(parameters, 'EntityTimelineParameters') @@ -84,14 +86,21 @@ async def list( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,5 +114,5 @@ async def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getTimeline'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getTimeline"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py index 5511fb5cef9c..83aab7335012 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class EntitiesOperations: - """EntitiesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`entities` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -52,7 +50,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncIterable["_models.EntityList"]: + ) -> AsyncIterable[_models.EntityList]: """Gets all entities. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -64,11 +62,16 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.EntityList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -76,10 +79,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -87,10 +93,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -104,7 +113,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,7 +130,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities"} # type: ignore @distributed_trace_async async def get( @@ -126,7 +139,7 @@ async def get( workspace_name: str, entity_id: str, **kwargs: Any - ) -> "_models.Entity": + ) -> _models.Entity: """Gets an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -140,11 +153,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.Entity :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Entity"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Entity] request = build_get_request( @@ -152,12 +170,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -171,7 +196,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}"} # type: ignore @distributed_trace_async @@ -180,9 +205,9 @@ async def expand( resource_group_name: str, workspace_name: str, entity_id: str, - parameters: "_models.EntityExpandParameters", + parameters: _models.EntityExpandParameters, **kwargs: Any - ) -> "_models.EntityExpandResponse": + ) -> _models.EntityExpandResponse: """Expands an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -198,13 +223,17 @@ async def expand( :rtype: ~azure.mgmt.securityinsight.models.EntityExpandResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityExpandResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityExpandResponse] _json = self._serialize.body(parameters, 'EntityExpandParameters') @@ -213,14 +242,21 @@ async def expand( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.expand.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -234,7 +270,7 @@ async def expand( return deserialized - expand.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/expand'} # type: ignore + expand.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/expand"} # type: ignore @distributed_trace_async @@ -245,7 +281,7 @@ async def queries( entity_id: str, kind: Union[str, "_models.EntityItemQueryKind"], **kwargs: Any - ) -> "_models.GetQueriesResponse": + ) -> _models.GetQueriesResponse: """Get Insights and Activities for an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -261,11 +297,16 @@ async def queries( :rtype: ~azure.mgmt.securityinsight.models.GetQueriesResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GetQueriesResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.GetQueriesResponse] request = build_queries_request( @@ -273,13 +314,20 @@ async def queries( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, kind=kind, template_url=self.queries.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -293,7 +341,7 @@ async def queries( return deserialized - queries.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/queries'} # type: ignore + queries.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/queries"} # type: ignore @distributed_trace_async @@ -302,9 +350,9 @@ async def get_insights( resource_group_name: str, workspace_name: str, entity_id: str, - parameters: "_models.EntityGetInsightsParameters", + parameters: _models.EntityGetInsightsParameters, **kwargs: Any - ) -> "_models.EntityGetInsightsResponse": + ) -> _models.EntityGetInsightsResponse: """Execute Insights for an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -320,13 +368,17 @@ async def get_insights( :rtype: ~azure.mgmt.securityinsight.models.EntityGetInsightsResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityGetInsightsResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityGetInsightsResponse] _json = self._serialize.body(parameters, 'EntityGetInsightsParameters') @@ -335,14 +387,21 @@ async def get_insights( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.get_insights.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -356,5 +415,5 @@ async def get_insights( return deserialized - get_insights.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getInsights'} # type: ignore + get_insights.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getInsights"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py index 7020543e5f46..7d17d4276524 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entities_relations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class EntitiesRelationsOperations: - """EntitiesRelationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`entities_relations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -57,7 +54,7 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RelationList"]: + ) -> AsyncIterable[_models.RelationList]: """Gets all relations of an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,15 +63,17 @@ def list( :type workspace_name: str :param entity_id: entity ID. :type entity_id: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RelationList or the result of cls(response) @@ -82,11 +81,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.RelationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RelationList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RelationList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -95,14 +99,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -111,14 +118,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -132,7 +142,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -145,4 +159,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py index c37f2c16e737..f915a0b0a466 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_queries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,54 +25,57 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class EntityQueriesOperations: - """EntityQueriesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`entity_queries` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, resource_group_name: str, workspace_name: str, - kind: Optional[Union[str, "_models.Enum12"]] = None, + kind: Optional[Union[str, "_models.Enum13"]] = None, **kwargs: Any - ) -> AsyncIterable["_models.EntityQueryList"]: + ) -> AsyncIterable[_models.EntityQueryList]: """Gets all entity queries. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param kind: The entity query kind we want to fetch. - :type kind: str or ~azure.mgmt.securityinsight.models.Enum12 + :param kind: The entity query kind we want to fetch. Default value is None. + :type kind: str or ~azure.mgmt.securityinsight.models.Enum13 :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EntityQueryList or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.EntityQueryList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityQueryList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityQueryList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -80,11 +83,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, kind=kind, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -92,11 +98,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, kind=kind, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -110,7 +119,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -123,7 +136,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries"} # type: ignore @distributed_trace_async async def get( @@ -132,7 +145,7 @@ async def get( workspace_name: str, entity_query_id: str, **kwargs: Any - ) -> "_models.EntityQuery": + ) -> _models.EntityQuery: """Gets an entity query. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -146,11 +159,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.EntityQuery :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityQuery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityQuery] request = build_get_request( @@ -158,12 +176,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_query_id=entity_query_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,7 +202,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}"} # type: ignore @distributed_trace_async @@ -186,9 +211,9 @@ async def create_or_update( resource_group_name: str, workspace_name: str, entity_query_id: str, - entity_query: "_models.CustomEntityQuery", + entity_query: _models.CustomEntityQuery, **kwargs: Any - ) -> "_models.EntityQuery": + ) -> _models.EntityQuery: """Creates or updates the entity query. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -204,13 +229,17 @@ async def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.EntityQuery :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityQuery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityQuery] _json = self._serialize.body(entity_query, 'CustomEntityQuery') @@ -219,14 +248,21 @@ async def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_query_id=entity_query_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -244,11 +280,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -268,11 +304,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -280,12 +321,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_query_id=entity_query_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -295,5 +343,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py index dcf9756ea2a6..4131de79fc54 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_query_templates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class EntityQueryTemplatesOperations: - """EntityQueryTemplatesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`entity_query_templates` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -53,14 +51,15 @@ def list( workspace_name: str, kind: Optional[str] = "Activity", **kwargs: Any - ) -> AsyncIterable["_models.EntityQueryTemplateList"]: + ) -> AsyncIterable[_models.EntityQueryTemplateList]: """Gets all entity query templates. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param kind: The entity template query kind we want to fetch. The default value is "Activity". + :param kind: The entity template query kind we want to fetch. Known values are "Activity" or + None. Default value is "Activity". :type kind: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EntityQueryTemplateList or the result of @@ -69,11 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.EntityQueryTemplateList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityQueryTemplateList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityQueryTemplateList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -81,11 +85,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, kind=kind, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -93,11 +100,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, kind=kind, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -111,7 +121,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -124,7 +138,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates"} # type: ignore @distributed_trace_async async def get( @@ -133,7 +147,7 @@ async def get( workspace_name: str, entity_query_template_id: str, **kwargs: Any - ) -> "_models.EntityQueryTemplate": + ) -> _models.EntityQueryTemplate: """Gets an entity query. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -147,11 +161,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.EntityQueryTemplate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityQueryTemplate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityQueryTemplate] request = build_get_request( @@ -159,12 +178,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_query_template_id=entity_query_template_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -178,5 +204,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates/{entityQueryTemplateId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates/{entityQueryTemplateId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py index 51b4c83332d4..9991a0d33dcf 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_entity_relations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class EntityRelationsOperations: - """EntityRelationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`entity_relations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_relation( @@ -52,7 +50,7 @@ async def get_relation( entity_id: str, relation_name: str, **kwargs: Any - ) -> "_models.Relation": + ) -> _models.Relation: """Gets an entity relation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -68,11 +66,16 @@ async def get_relation( :rtype: ~azure.mgmt.securityinsight.models.Relation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Relation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Relation] request = build_get_relation_request( @@ -81,12 +84,19 @@ async def get_relation( workspace_name=workspace_name, entity_id=entity_id, relation_name=relation_name, + api_version=api_version, template_url=self.get_relation.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,5 +110,5 @@ async def get_relation( return deserialized - get_relation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations/{relationName}'} # type: ignore + get_relation.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations/{relationName}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_comments_operations.py index 78fed82158bb..fa4024ef009d 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class IncidentCommentsOperations: - """IncidentCommentsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`incident_comments` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -57,7 +55,7 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.IncidentCommentList"]: + ) -> AsyncIterable[_models.IncidentCommentList]: """Gets all incident comments. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,15 +64,17 @@ def list( :type workspace_name: str :param incident_id: Incident ID. :type incident_id: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IncidentCommentList or the result of cls(response) @@ -82,11 +82,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.IncidentCommentList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentCommentList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentCommentList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -95,14 +100,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -111,14 +119,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -132,7 +143,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -145,7 +160,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments"} # type: ignore @distributed_trace_async async def get( @@ -155,7 +170,7 @@ async def get( incident_id: str, incident_comment_id: str, **kwargs: Any - ) -> "_models.IncidentComment": + ) -> _models.IncidentComment: """Gets an incident comment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -171,11 +186,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.IncidentComment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentComment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentComment] request = build_get_request( @@ -184,12 +204,19 @@ async def get( workspace_name=workspace_name, incident_id=incident_id, incident_comment_id=incident_comment_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -203,7 +230,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}"} # type: ignore @distributed_trace_async @@ -213,9 +240,9 @@ async def create_or_update( workspace_name: str, incident_id: str, incident_comment_id: str, - incident_comment: "_models.IncidentComment", + incident_comment: _models.IncidentComment, **kwargs: Any - ) -> "_models.IncidentComment": + ) -> _models.IncidentComment: """Creates or updates the incident comment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -233,13 +260,17 @@ async def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.IncidentComment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentComment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentComment] _json = self._serialize.body(incident_comment, 'IncidentComment') @@ -249,14 +280,21 @@ async def create_or_update( workspace_name=workspace_name, incident_id=incident_id, incident_comment_id=incident_comment_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -274,11 +312,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -301,11 +339,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -314,12 +357,19 @@ async def delete( workspace_name=workspace_name, incident_id=incident_id, incident_comment_id=incident_comment_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -329,5 +379,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py index db7350326ccd..33699694f140 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incident_relations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class IncidentRelationsOperations: - """IncidentRelationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`incident_relations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -57,7 +55,7 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RelationList"]: + ) -> AsyncIterable[_models.RelationList]: """Gets all incident relations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,15 +64,17 @@ def list( :type workspace_name: str :param incident_id: Incident ID. :type incident_id: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RelationList or the result of cls(response) @@ -82,11 +82,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.RelationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RelationList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RelationList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -95,14 +100,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -111,14 +119,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -132,7 +143,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -145,7 +160,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations"} # type: ignore @distributed_trace_async async def get( @@ -155,7 +170,7 @@ async def get( incident_id: str, relation_name: str, **kwargs: Any - ) -> "_models.Relation": + ) -> _models.Relation: """Gets an incident relation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -171,11 +186,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.Relation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Relation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Relation] request = build_get_request( @@ -184,12 +204,19 @@ async def get( workspace_name=workspace_name, incident_id=incident_id, relation_name=relation_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -203,7 +230,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}"} # type: ignore @distributed_trace_async @@ -213,9 +240,9 @@ async def create_or_update( workspace_name: str, incident_id: str, relation_name: str, - relation: "_models.Relation", + relation: _models.Relation, **kwargs: Any - ) -> "_models.Relation": + ) -> _models.Relation: """Creates or updates the incident relation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -233,13 +260,17 @@ async def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Relation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Relation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Relation] _json = self._serialize.body(relation, 'Relation') @@ -249,14 +280,21 @@ async def create_or_update( workspace_name=workspace_name, incident_id=incident_id, relation_name=relation_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -274,11 +312,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -301,11 +339,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -314,12 +357,19 @@ async def delete( workspace_name=workspace_name, incident_id=incident_id, relation_name=relation_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -329,5 +379,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_incidents_operations.py index abdb8ab892a8..4e3e9b99d48d 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class IncidentsOperations: - """IncidentsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`incidents` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def run_playbook( @@ -52,7 +50,7 @@ async def run_playbook( resource_group_name: str, workspace_name: str, incident_identifier: str, - request_body: Optional["_models.ManualTriggerRequestBody"] = None, + request_body: Optional[_models.ManualTriggerRequestBody] = None, **kwargs: Any ) -> Any: """Triggers playbook on a specific incident. @@ -63,20 +61,24 @@ async def run_playbook( :type workspace_name: str :param incident_identifier: :type incident_identifier: str - :param request_body: + :param request_body: Default value is None. :type request_body: ~azure.mgmt.securityinsight.models.ManualTriggerRequestBody :keyword callable cls: A custom type or function that will be passed the direct response :return: any, or the result of cls(response) :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Any] if request_body is not None: _json = self._serialize.body(request_body, 'ManualTriggerRequestBody') @@ -88,14 +90,21 @@ async def run_playbook( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_identifier=incident_identifier, + api_version=api_version, content_type=content_type, json=_json, template_url=self.run_playbook.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -109,7 +118,7 @@ async def run_playbook( return deserialized - run_playbook.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentIdentifier}/runPlaybook'} # type: ignore + run_playbook.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentIdentifier}/runPlaybook"} # type: ignore @distributed_trace @@ -122,22 +131,24 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.IncidentList"]: + ) -> AsyncIterable[_models.IncidentList]: """Gets all incidents. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IncidentList or the result of cls(response) @@ -145,11 +156,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.IncidentList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -157,14 +173,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -172,14 +191,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -193,7 +215,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -206,7 +232,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents"} # type: ignore @distributed_trace_async async def get( @@ -215,7 +241,7 @@ async def get( workspace_name: str, incident_id: str, **kwargs: Any - ) -> "_models.Incident": + ) -> _models.Incident: """Gets an incident. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -229,11 +255,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.Incident :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Incident"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Incident] request = build_get_request( @@ -241,12 +272,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -260,7 +298,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}"} # type: ignore @distributed_trace_async @@ -269,9 +307,9 @@ async def create_or_update( resource_group_name: str, workspace_name: str, incident_id: str, - incident: "_models.Incident", + incident: _models.Incident, **kwargs: Any - ) -> "_models.Incident": + ) -> _models.Incident: """Creates or updates the incident. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -287,13 +325,17 @@ 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"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Incident] _json = self._serialize.body(incident, 'Incident') @@ -302,14 +344,21 @@ async def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -327,11 +376,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -351,11 +400,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -363,12 +417,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -378,7 +439,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}"} # type: ignore @distributed_trace_async @@ -387,9 +448,9 @@ async def create_team( resource_group_name: str, workspace_name: str, incident_id: str, - team_properties: "_models.TeamProperties", + team_properties: _models.TeamProperties, **kwargs: Any - ) -> "_models.TeamInformation": + ) -> _models.TeamInformation: """Creates a Microsoft team to investigate the incident by sharing information and insights between participants. @@ -406,13 +467,17 @@ async def create_team( :rtype: ~azure.mgmt.securityinsight.models.TeamInformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TeamInformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TeamInformation] _json = self._serialize.body(team_properties, 'TeamProperties') @@ -421,14 +486,21 @@ async def create_team( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_team.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -442,7 +514,7 @@ async def create_team( return deserialized - create_team.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/createTeam'} # type: ignore + create_team.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/createTeam"} # type: ignore @distributed_trace_async @@ -452,7 +524,7 @@ async def list_alerts( workspace_name: str, incident_id: str, **kwargs: Any - ) -> "_models.IncidentAlertList": + ) -> _models.IncidentAlertList: """Gets all incident alerts. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -466,11 +538,16 @@ async def list_alerts( :rtype: ~azure.mgmt.securityinsight.models.IncidentAlertList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentAlertList] request = build_list_alerts_request( @@ -478,12 +555,19 @@ async def list_alerts( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, template_url=self.list_alerts.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -497,7 +581,7 @@ async def list_alerts( return deserialized - list_alerts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/alerts'} # type: ignore + list_alerts.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/alerts"} # type: ignore @distributed_trace_async @@ -507,7 +591,7 @@ async def list_bookmarks( workspace_name: str, incident_id: str, **kwargs: Any - ) -> "_models.IncidentBookmarkList": + ) -> _models.IncidentBookmarkList: """Gets all incident bookmarks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -521,11 +605,16 @@ async def list_bookmarks( :rtype: ~azure.mgmt.securityinsight.models.IncidentBookmarkList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentBookmarkList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentBookmarkList] request = build_list_bookmarks_request( @@ -533,12 +622,19 @@ async def list_bookmarks( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, template_url=self.list_bookmarks.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -552,7 +648,7 @@ async def list_bookmarks( return deserialized - list_bookmarks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/bookmarks'} # type: ignore + list_bookmarks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/bookmarks"} # type: ignore @distributed_trace_async @@ -562,7 +658,7 @@ async def list_entities( workspace_name: str, incident_id: str, **kwargs: Any - ) -> "_models.IncidentEntitiesResponse": + ) -> _models.IncidentEntitiesResponse: """Gets all incident related entities. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -576,11 +672,16 @@ async def list_entities( :rtype: ~azure.mgmt.securityinsight.models.IncidentEntitiesResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentEntitiesResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentEntitiesResponse] request = build_list_entities_request( @@ -588,12 +689,19 @@ async def list_entities( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, template_url=self.list_entities.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -607,5 +715,5 @@ async def list_entities( return deserialized - list_entities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/entities'} # type: ignore + list_entities.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/entities"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py index 4f3ff301dca2..7cbe3b647640 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_ip_geodata_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class IPGeodataOperations: - """IPGeodataOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`ip_geodata` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get( @@ -50,7 +48,7 @@ async def get( resource_group_name: str, ip_address: str, **kwargs: Any - ) -> "_models.EnrichmentIpGeodata": + ) -> _models.EnrichmentIpGeodata: """Get geodata for a single IP address. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -62,23 +60,35 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.EnrichmentIpGeodata :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnrichmentIpGeodata"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EnrichmentIpGeodata] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, ip_address=ip_address, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -92,5 +102,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/ip/geodata/'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/ip/geodata/"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py index f81e9a47d3a9..088327574488 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_metadata_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MetadataOperations: - """MetadataOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`metadata` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -56,21 +54,22 @@ def list( top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.MetadataList"]: + ) -> AsyncIterable[_models.MetadataList]: """List of all metadata. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip: Used to skip n elements in the OData query (offset). Returns a nextLink to the - next page of results if there are any left. + next page of results if there are any left. Default value is None. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetadataList or the result of cls(response) @@ -78,11 +77,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.MetadataList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MetadataList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -90,14 +94,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip=skip, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -105,14 +112,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip=skip, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -126,7 +136,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -139,7 +153,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata"} # type: ignore @distributed_trace_async async def get( @@ -148,7 +162,7 @@ async def get( workspace_name: str, metadata_name: str, **kwargs: Any - ) -> "_models.MetadataModel": + ) -> _models.MetadataModel: """Get a Metadata. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -162,11 +176,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.MetadataModel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataModel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MetadataModel] request = build_get_request( @@ -174,12 +193,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, metadata_name=metadata_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -193,11 +219,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -217,11 +243,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -229,12 +260,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, metadata_name=metadata_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -244,7 +282,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}"} # type: ignore @distributed_trace_async @@ -253,9 +291,9 @@ async def create( resource_group_name: str, workspace_name: str, metadata_name: str, - metadata: "_models.MetadataModel", + metadata: _models.MetadataModel, **kwargs: Any - ) -> "_models.MetadataModel": + ) -> _models.MetadataModel: """Create a Metadata. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -271,13 +309,17 @@ async def create( :rtype: ~azure.mgmt.securityinsight.models.MetadataModel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataModel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MetadataModel] _json = self._serialize.body(metadata, 'MetadataModel') @@ -286,14 +328,21 @@ async def create( resource_group_name=resource_group_name, workspace_name=workspace_name, metadata_name=metadata_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -311,7 +360,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}"} # type: ignore @distributed_trace_async @@ -320,9 +369,9 @@ async def update( resource_group_name: str, workspace_name: str, metadata_name: str, - metadata_patch: "_models.MetadataPatch", + metadata_patch: _models.MetadataPatch, **kwargs: Any - ) -> "_models.MetadataModel": + ) -> _models.MetadataModel: """Update an existing Metadata. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -338,13 +387,17 @@ async def update( :rtype: ~azure.mgmt.securityinsight.models.MetadataModel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataModel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MetadataModel] _json = self._serialize.body(metadata_patch, 'MetadataPatch') @@ -353,14 +406,21 @@ async def update( resource_group_name=resource_group_name, workspace_name=workspace_name, metadata_name=metadata_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -374,5 +434,5 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py index bac11a921e22..987459cbe16f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_office_consents_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class OfficeConsentsOperations: - """OfficeConsentsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`office_consents` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -52,7 +50,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OfficeConsentList"]: + ) -> AsyncIterable[_models.OfficeConsentList]: """Gets all office365 consents. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,11 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.OfficeConsentList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OfficeConsentList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OfficeConsentList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -77,10 +80,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,10 +94,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -105,7 +114,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,7 +131,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents"} # type: ignore @distributed_trace_async async def get( @@ -127,7 +140,7 @@ async def get( workspace_name: str, consent_id: str, **kwargs: Any - ) -> "_models.OfficeConsent": + ) -> _models.OfficeConsent: """Gets an office365 consent. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,11 +154,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.OfficeConsent :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OfficeConsent"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OfficeConsent] request = build_get_request( @@ -153,12 +171,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, consent_id=consent_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,11 +197,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -196,11 +221,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -208,12 +238,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, consent_id=consent_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -223,5 +260,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_operations.py index b90699594bfe..3c7e94e6136e 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationsList"]: + ) -> 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 @@ -59,27 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.OperationsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationsList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationsList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -93,7 +101,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,4 +118,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.SecurityInsights/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.SecurityInsights/operations"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_patch.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py index 9e75a1d2a790..93b83b482606 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_product_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ProductSettingsOperations: - """ProductSettingsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`product_settings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def list( @@ -50,7 +48,7 @@ async def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> "_models.SettingList": + ) -> _models.SettingList: """List of all the settings. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -62,23 +60,35 @@ async def list( :rtype: ~azure.mgmt.securityinsight.models.SettingList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SettingList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SettingList] request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -92,7 +102,7 @@ async def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings"} # type: ignore @distributed_trace_async @@ -102,7 +112,7 @@ async def get( workspace_name: str, settings_name: str, **kwargs: Any - ) -> "_models.Settings": + ) -> _models.Settings: """Gets a setting. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -116,11 +126,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.Settings :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Settings"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Settings] request = build_get_request( @@ -128,12 +143,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, settings_name=settings_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -147,11 +169,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -171,11 +193,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -183,12 +210,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, settings_name=settings_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -198,7 +232,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}"} # type: ignore @distributed_trace_async @@ -207,9 +241,9 @@ async def update( resource_group_name: str, workspace_name: str, settings_name: str, - settings: "_models.Settings", + settings: _models.Settings, **kwargs: Any - ) -> "_models.Settings": + ) -> _models.Settings: """Updates setting. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -225,13 +259,17 @@ async def update( :rtype: ~azure.mgmt.securityinsight.models.Settings :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Settings"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Settings] _json = self._serialize.body(settings, 'Settings') @@ -240,14 +278,21 @@ async def update( resource_group_name=resource_group_name, workspace_name=workspace_name, settings_name=settings_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -261,5 +306,5 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_security_ml_analytics_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_security_ml_analytics_settings_operations.py new file mode 100644 index 000000000000..fe7de722b7f1 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_security_ml_analytics_settings_operations.py @@ -0,0 +1,344 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._security_ml_analytics_settings_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SecurityMLAnalyticsSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`security_ml_analytics_settings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.SecurityMLAnalyticsSettingsList]: + """Gets all Security ML Analytics Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityMLAnalyticsSettingsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSettingsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityMLAnalyticsSettingsList] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityMLAnalyticsSettingsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + settings_resource_name: str, + **kwargs: Any + ) -> _models.SecurityMLAnalyticsSetting: + """Gets the Security ML Analytics Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param settings_resource_name: Security ML Analytics Settings resource name. + :type settings_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityMLAnalyticsSetting, or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSetting + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityMLAnalyticsSetting] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + settings_resource_name=settings_resource_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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('SecurityMLAnalyticsSetting', 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/securityMLAnalyticsSettings/{settingsResourceName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + settings_resource_name: str, + security_ml_analytics_setting: _models.SecurityMLAnalyticsSetting, + **kwargs: Any + ) -> _models.SecurityMLAnalyticsSetting: + """Creates or updates the Security ML Analytics Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param settings_resource_name: Security ML Analytics Settings resource name. + :type settings_resource_name: str + :param security_ml_analytics_setting: The security ML Analytics setting. + :type security_ml_analytics_setting: + ~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSetting + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityMLAnalyticsSetting, or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSetting + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityMLAnalyticsSetting] + + _json = self._serialize.body(security_ml_analytics_setting, 'SecurityMLAnalyticsSetting') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + settings_resource_name=settings_resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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('SecurityMLAnalyticsSetting', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SecurityMLAnalyticsSetting', 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/securityMLAnalyticsSettings/{settingsResourceName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + settings_resource_name: str, + **kwargs: Any + ) -> None: + """Delete the Security ML Analytics Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param settings_resource_name: Security ML Analytics Settings resource name. + :type settings_resource_name: 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 + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + settings_resource_name=settings_resource_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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/securityMLAnalyticsSettings/{settingsResourceName}"} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py index 2bf8900a5263..d28d42333db9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_sentinel_onboarding_states_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SentinelOnboardingStatesOperations: - """SentinelOnboardingStatesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`sentinel_onboarding_states` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get( @@ -51,7 +49,7 @@ async def get( workspace_name: str, sentinel_onboarding_state_name: str, **kwargs: Any - ) -> "_models.SentinelOnboardingState": + ) -> _models.SentinelOnboardingState: """Get Sentinel onboarding state. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,11 +63,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.SentinelOnboardingState :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SentinelOnboardingState"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SentinelOnboardingState] request = build_get_request( @@ -77,12 +80,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, sentinel_onboarding_state_name=sentinel_onboarding_state_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -96,7 +106,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}"} # type: ignore @distributed_trace_async @@ -105,9 +115,9 @@ async def create( resource_group_name: str, workspace_name: str, sentinel_onboarding_state_name: str, - sentinel_onboarding_state_parameter: Optional["_models.SentinelOnboardingState"] = None, + sentinel_onboarding_state_parameter: Optional[_models.SentinelOnboardingState] = None, **kwargs: Any - ) -> "_models.SentinelOnboardingState": + ) -> _models.SentinelOnboardingState: """Create Sentinel onboarding state. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -116,7 +126,8 @@ async def create( :type workspace_name: str :param sentinel_onboarding_state_name: The Sentinel onboarding state name. Supports - default. :type sentinel_onboarding_state_name: str - :param sentinel_onboarding_state_parameter: The Sentinel onboarding state parameter. + :param sentinel_onboarding_state_parameter: The Sentinel onboarding state parameter. Default + value is None. :type sentinel_onboarding_state_parameter: ~azure.mgmt.securityinsight.models.SentinelOnboardingState :keyword callable cls: A custom type or function that will be passed the direct response @@ -124,13 +135,17 @@ async def create( :rtype: ~azure.mgmt.securityinsight.models.SentinelOnboardingState :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SentinelOnboardingState"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SentinelOnboardingState] if sentinel_onboarding_state_parameter is not None: _json = self._serialize.body(sentinel_onboarding_state_parameter, 'SentinelOnboardingState') @@ -142,14 +157,21 @@ async def create( resource_group_name=resource_group_name, workspace_name=workspace_name, sentinel_onboarding_state_name=sentinel_onboarding_state_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -167,11 +189,11 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -191,11 +213,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -203,12 +230,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, sentinel_onboarding_state_name=sentinel_onboarding_state_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -218,7 +252,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}"} # type: ignore @distributed_trace_async @@ -227,7 +261,7 @@ async def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> "_models.SentinelOnboardingStatesList": + ) -> _models.SentinelOnboardingStatesList: """Gets all Sentinel onboarding states. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -239,23 +273,35 @@ async def list( :rtype: ~azure.mgmt.securityinsight.models.SentinelOnboardingStatesList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SentinelOnboardingStatesList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SentinelOnboardingStatesList] request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -269,5 +315,5 @@ async def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py index 620642d549b1..98021a8dfb9d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_control_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SourceControlOperations: - """SourceControlOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`source_control` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_repositories( @@ -53,7 +50,7 @@ def list_repositories( workspace_name: str, repo_type: Union[str, "_models.RepoType"], **kwargs: Any - ) -> AsyncIterable["_models.RepoList"]: + ) -> AsyncIterable[_models.RepoList]: """Gets a list of repositories metadata. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -67,13 +64,17 @@ def list_repositories( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.RepoList] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RepoList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RepoList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: _json = self._serialize.body(repo_type, 'str') @@ -82,12 +83,15 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.list_repositories.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: _json = self._serialize.body(repo_type, 'str') @@ -96,12 +100,15 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -115,7 +122,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -128,4 +139,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_repositories.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/listRepositories'} # type: ignore + list_repositories.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/listRepositories"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py index b0c9609b7f9c..cfa62d72b5b3 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_source_controls_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SourceControlsOperations: - """SourceControlsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`source_controls` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -52,7 +50,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SourceControlList"]: + ) -> AsyncIterable[_models.SourceControlList]: """Gets all source controls, without source control items. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,11 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.SourceControlList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -77,10 +80,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,10 +94,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -105,7 +114,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,7 +131,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols"} # type: ignore @distributed_trace_async async def get( @@ -127,7 +140,7 @@ async def get( workspace_name: str, source_control_id: str, **kwargs: Any - ) -> "_models.SourceControl": + ) -> _models.SourceControl: """Gets a source control byt its identifier. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,11 +154,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.SourceControl :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] request = build_get_request( @@ -153,12 +171,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, source_control_id=source_control_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,11 +197,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -196,11 +221,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -208,12 +238,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, source_control_id=source_control_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -223,7 +260,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}"} # type: ignore @distributed_trace_async @@ -232,9 +269,9 @@ async def create( resource_group_name: str, workspace_name: str, source_control_id: str, - source_control: "_models.SourceControl", + source_control: _models.SourceControl, **kwargs: Any - ) -> "_models.SourceControl": + ) -> _models.SourceControl: """Creates a source control. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -250,13 +287,17 @@ async def create( :rtype: ~azure.mgmt.securityinsight.models.SourceControl :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] _json = self._serialize.body(source_control, 'SourceControl') @@ -265,14 +306,21 @@ async def create( resource_group_name=resource_group_name, workspace_name=workspace_name, source_control_id=source_control_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -290,5 +338,5 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py index 6125e037a3d6..45cf3be17406 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_metrics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,14 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ThreatIntelligenceIndicatorMetricsOperations: - """ThreatIntelligenceIndicatorMetricsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`threat_intelligence_indicator_metrics` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def list( @@ -50,7 +48,7 @@ async def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> "_models.ThreatIntelligenceMetricsList": + ) -> _models.ThreatIntelligenceMetricsList: """Get threat intelligence indicators metrics (Indicators counts by Type, Threat Type, Source). :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -62,23 +60,35 @@ async def list( :rtype: ~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricsList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceMetricsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceMetricsList] request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -92,5 +102,5 @@ async def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/metrics'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/metrics"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py index fa99db7ecf20..ddd1d61ef1d9 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicator_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,35 +25,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ThreatIntelligenceIndicatorOperations: - """ThreatIntelligenceIndicatorOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`threat_intelligence_indicator` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def create_indicator( self, resource_group_name: str, workspace_name: str, - threat_intelligence_properties: "_models.ThreatIntelligenceIndicatorModel", + threat_intelligence_properties: _models.ThreatIntelligenceIndicatorModel, **kwargs: Any - ) -> "_models.ThreatIntelligenceInformation": + ) -> _models.ThreatIntelligenceInformation: """Create a new threat intelligence indicator. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,13 +67,17 @@ async def create_indicator( :rtype: ~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformation] _json = self._serialize.body(threat_intelligence_properties, 'ThreatIntelligenceIndicatorModel') @@ -83,14 +85,21 @@ async def create_indicator( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_indicator.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -108,7 +117,7 @@ async def create_indicator( return deserialized - create_indicator.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/createIndicator'} # type: ignore + create_indicator.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/createIndicator"} # type: ignore @distributed_trace_async @@ -118,7 +127,7 @@ async def get( workspace_name: str, name: str, **kwargs: Any - ) -> "_models.ThreatIntelligenceInformation": + ) -> _models.ThreatIntelligenceInformation: """View a threat intelligence indicator by name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -132,11 +141,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformation] request = build_get_request( @@ -144,12 +158,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -163,7 +184,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}"} # type: ignore @distributed_trace_async @@ -172,9 +193,9 @@ async def create( resource_group_name: str, workspace_name: str, name: str, - threat_intelligence_properties: "_models.ThreatIntelligenceIndicatorModel", + threat_intelligence_properties: _models.ThreatIntelligenceIndicatorModel, **kwargs: Any - ) -> "_models.ThreatIntelligenceInformation": + ) -> _models.ThreatIntelligenceInformation: """Update a threat Intelligence indicator. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -192,13 +213,17 @@ async def create( :rtype: ~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformation] _json = self._serialize.body(threat_intelligence_properties, 'ThreatIntelligenceIndicatorModel') @@ -207,14 +232,21 @@ async def create( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -232,11 +264,11 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -256,11 +288,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -268,12 +305,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -283,7 +327,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}"} # type: ignore @distributed_trace @@ -291,9 +335,9 @@ def query_indicators( self, resource_group_name: str, workspace_name: str, - threat_intelligence_filtering_criteria: "_models.ThreatIntelligenceFilteringCriteria", + threat_intelligence_filtering_criteria: _models.ThreatIntelligenceFilteringCriteria, **kwargs: Any - ) -> AsyncIterable["_models.ThreatIntelligenceInformationList"]: + ) -> AsyncIterable[_models.ThreatIntelligenceInformationList]: """Query threat intelligence indicators as per filtering criteria. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -311,13 +355,17 @@ def query_indicators( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.ThreatIntelligenceInformationList] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformationList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: _json = self._serialize.body(threat_intelligence_filtering_criteria, 'ThreatIntelligenceFilteringCriteria') @@ -326,12 +374,15 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.query_indicators.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: _json = self._serialize.body(threat_intelligence_filtering_criteria, 'ThreatIntelligenceFilteringCriteria') @@ -340,12 +391,15 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -359,7 +413,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -372,15 +430,15 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - query_indicators.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/queryIndicators'} # type: ignore + query_indicators.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/queryIndicators"} # type: ignore @distributed_trace_async - async def append_tags( + async def append_tags( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, - threat_intelligence_append_tags: "_models.ThreatIntelligenceAppendTags", + threat_intelligence_append_tags: _models.ThreatIntelligenceAppendTags, **kwargs: Any ) -> None: """Append tags to a threat intelligence indicator. @@ -399,13 +457,17 @@ async def append_tags( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(threat_intelligence_append_tags, 'ThreatIntelligenceAppendTags') @@ -414,14 +476,21 @@ async def append_tags( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.append_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +500,7 @@ async def append_tags( if cls: return cls(pipeline_response, None, {}) - append_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/appendTags'} # type: ignore + append_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/appendTags"} # type: ignore @distributed_trace_async @@ -440,9 +509,9 @@ async def replace_tags( resource_group_name: str, workspace_name: str, name: str, - threat_intelligence_replace_tags: "_models.ThreatIntelligenceIndicatorModel", + threat_intelligence_replace_tags: _models.ThreatIntelligenceIndicatorModel, **kwargs: Any - ) -> "_models.ThreatIntelligenceInformation": + ) -> _models.ThreatIntelligenceInformation: """Replace tags added to a threat intelligence indicator. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -460,13 +529,17 @@ async def replace_tags( :rtype: ~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformation] _json = self._serialize.body(threat_intelligence_replace_tags, 'ThreatIntelligenceIndicatorModel') @@ -475,14 +548,21 @@ async def replace_tags( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.replace_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -496,5 +576,5 @@ async def replace_tags( return deserialized - replace_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/replaceTags'} # type: ignore + replace_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/replaceTags"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py index 7bdd2d89a7d8..8f6a876ad339 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_threat_intelligence_indicators_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +24,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ThreatIntelligenceIndicatorsOperations: - """ThreatIntelligenceIndicatorsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`threat_intelligence_indicators` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -56,22 +53,24 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ThreatIntelligenceInformationList"]: + ) -> AsyncIterable[_models.ThreatIntelligenceInformationList]: """Get all threat intelligence indicators. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ThreatIntelligenceInformationList or the result of @@ -80,11 +79,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.ThreatIntelligenceInformationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformationList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformationList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -92,14 +96,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -107,14 +114,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +138,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -141,4 +155,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py index 969b56b7440c..1a4705e0f278 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlist_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class WatchlistItemsOperations: - """WatchlistItemsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`watchlist_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -54,7 +52,7 @@ def list( watchlist_alias: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.WatchlistItemList"]: + ) -> AsyncIterable[_models.WatchlistItemList]: """Gets all watchlist Items. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,6 +64,7 @@ def list( :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WatchlistItemList or the result of cls(response) @@ -73,11 +72,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.WatchlistItemList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WatchlistItemList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.WatchlistItemList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -86,11 +90,14 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, watchlist_alias=watchlist_alias, + api_version=api_version, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -99,11 +106,14 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, watchlist_alias=watchlist_alias, + api_version=api_version, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -117,7 +127,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,7 +144,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems"} # type: ignore @distributed_trace_async async def get( @@ -140,7 +154,7 @@ async def get( watchlist_alias: str, watchlist_item_id: str, **kwargs: Any - ) -> "_models.WatchlistItem": + ) -> _models.WatchlistItem: """Gets a watchlist, without its watchlist items. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -156,11 +170,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.WatchlistItem :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WatchlistItem"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.WatchlistItem] request = build_get_request( @@ -169,12 +188,19 @@ async def get( workspace_name=workspace_name, watchlist_alias=watchlist_alias, watchlist_item_id=watchlist_item_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -188,11 +214,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -215,11 +241,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -228,12 +259,19 @@ async def delete( workspace_name=workspace_name, watchlist_alias=watchlist_alias, watchlist_item_id=watchlist_item_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -243,7 +281,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}"} # type: ignore @distributed_trace_async @@ -253,9 +291,9 @@ async def create_or_update( workspace_name: str, watchlist_alias: str, watchlist_item_id: str, - watchlist_item: "_models.WatchlistItem", + watchlist_item: _models.WatchlistItem, **kwargs: Any - ) -> "_models.WatchlistItem": + ) -> _models.WatchlistItem: """Creates or updates a watchlist item. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -273,13 +311,17 @@ async def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.WatchlistItem :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WatchlistItem"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.WatchlistItem] _json = self._serialize.body(watchlist_item, 'WatchlistItem') @@ -289,14 +331,21 @@ async def create_or_update( workspace_name=workspace_name, watchlist_alias=watchlist_alias, watchlist_item_id=watchlist_item_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -314,5 +363,5 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py index 5ac6b44a7384..6910ff5929ea 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/aio/operations/_watchlists_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -25,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class WatchlistsOperations: - """WatchlistsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.aio.SecurityInsights`'s + :attr:`watchlists` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -53,7 +51,7 @@ def list( workspace_name: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.WatchlistList"]: + ) -> AsyncIterable[_models.WatchlistList]: """Gets all watchlists, without watchlist items. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,6 +61,7 @@ def list( :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WatchlistList or the result of cls(response) @@ -70,11 +69,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.securityinsight.models.WatchlistList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WatchlistList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.WatchlistList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -82,11 +86,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -94,11 +101,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -112,7 +122,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -125,7 +139,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists"} # type: ignore @distributed_trace_async async def get( @@ -134,7 +148,7 @@ async def get( workspace_name: str, watchlist_alias: str, **kwargs: Any - ) -> "_models.Watchlist": + ) -> _models.Watchlist: """Gets a watchlist, without its watchlist items. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -148,11 +162,16 @@ async def get( :rtype: ~azure.mgmt.securityinsight.models.Watchlist :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Watchlist"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Watchlist] request = build_get_request( @@ -160,12 +179,19 @@ async def get( resource_group_name=resource_group_name, workspace_name=workspace_name, watchlist_alias=watchlist_alias, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -179,11 +205,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -203,11 +229,16 @@ async def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -215,12 +246,19 @@ async def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, watchlist_alias=watchlist_alias, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -235,7 +273,7 @@ async def delete( if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}"} # type: ignore @distributed_trace_async @@ -244,9 +282,9 @@ async def create_or_update( resource_group_name: str, workspace_name: str, watchlist_alias: str, - watchlist: "_models.Watchlist", + watchlist: _models.Watchlist, **kwargs: Any - ) -> "_models.Watchlist": + ) -> _models.Watchlist: """Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and contentType properties. The rawContent is mainly used for @@ -267,13 +305,17 @@ async def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Watchlist :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Watchlist"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Watchlist] _json = self._serialize.body(watchlist, 'Watchlist') @@ -282,14 +324,21 @@ async def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, watchlist_alias=watchlist_alias, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -310,5 +359,5 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}"} # type: ignore 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 ceebdbb68eb3..c7fdf89cb3b6 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 @@ -41,10 +41,14 @@ from ._models_py3 import AlertRulesList from ._models_py3 import AlertsDataTypeOfDataConnector from ._models_py3 import Anomalies +from ._models_py3 import AnomalySecurityMLAnalyticsSettings +from ._models_py3 import AnomalyTimelineItem from ._models_py3 import AutomationRule from ._models_py3 import AutomationRuleAction from ._models_py3 import AutomationRuleCondition from ._models_py3 import AutomationRuleModifyPropertiesAction +from ._models_py3 import AutomationRulePropertyArrayChangedValuesCondition +from ._models_py3 import AutomationRulePropertyValuesChangedCondition from ._models_py3 import AutomationRulePropertyValuesCondition from ._models_py3 import AutomationRuleRunPlaybookAction from ._models_py3 import AutomationRuleTriggeringLogic @@ -162,7 +166,7 @@ from ._models_py3 import FusionTemplateSourceSubType from ._models_py3 import FusionTemplateSubTypeSeverityFilter from ._models_py3 import GeoLocation -from ._models_py3 import GetInsightsError +from ._models_py3 import GetInsightsErrorKind from ._models_py3 import GetInsightsResultsMetadata from ._models_py3 import GetQueriesResponse from ._models_py3 import GitHubResourceInfo @@ -294,6 +298,8 @@ from ._models_py3 import PlaybookActionProperties from ._models_py3 import ProcessEntity from ._models_py3 import ProcessEntityProperties +from ._models_py3 import PropertyArrayChangedConditionProperties +from ._models_py3 import PropertyChangedConditionProperties from ._models_py3 import PropertyConditionProperties from ._models_py3 import QueryBasedAlertRuleTemplateProperties from ._models_py3 import RegistryKeyEntity @@ -321,11 +327,13 @@ from ._models_py3 import SecurityAlertTimelineItem from ._models_py3 import SecurityGroupEntity from ._models_py3 import SecurityGroupEntityProperties +from ._models_py3 import SecurityMLAnalyticsSetting +from ._models_py3 import SecurityMLAnalyticsSettingsDataSource +from ._models_py3 import SecurityMLAnalyticsSettingsList from ._models_py3 import SentinelOnboardingState from ._models_py3 import SentinelOnboardingStatesList from ._models_py3 import SettingList from ._models_py3 import Settings -from ._models_py3 import Sku from ._models_py3 import SourceControl from ._models_py3 import SourceControlList from ._models_py3 import SubmissionMailEntity @@ -387,6 +395,10 @@ AlertStatus, AntispamMailDirection, AttackTactic, + AutomationRulePropertyArrayChangedConditionSupportedArrayType, + AutomationRulePropertyArrayChangedConditionSupportedChangeType, + AutomationRulePropertyChangedConditionSupportedChangedType, + AutomationRulePropertyChangedConditionSupportedPropertyType, AutomationRulePropertyConditionSupportedOperator, AutomationRulePropertyConditionSupportedProperty, ConditionType, @@ -410,13 +422,15 @@ EntityItemQueryKind, EntityKind, EntityMappingType, + EntityProviders, EntityQueryKind, EntityQueryTemplateKind, EntityTimelineKind, EntityType, - Enum12, + Enum13, EventGroupingAggregationKind, FileHashAlgorithm, + GetInsightsError, IncidentClassification, IncidentClassificationReason, IncidentLabelType, @@ -436,9 +450,10 @@ RegistryHive, RegistryValueKind, RepoType, + SecurityMLAnalyticsSettingsKind, SettingKind, SettingType, - SkuKind, + SettingsStatus, SourceKind, SourceType, SupportTier, @@ -451,7 +466,9 @@ UebaDataSources, Version, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AADCheckRequirements', 'AADCheckRequirementsProperties', @@ -488,10 +505,14 @@ 'AlertRulesList', 'AlertsDataTypeOfDataConnector', 'Anomalies', + 'AnomalySecurityMLAnalyticsSettings', + 'AnomalyTimelineItem', 'AutomationRule', 'AutomationRuleAction', 'AutomationRuleCondition', 'AutomationRuleModifyPropertiesAction', + 'AutomationRulePropertyArrayChangedValuesCondition', + 'AutomationRulePropertyValuesChangedCondition', 'AutomationRulePropertyValuesCondition', 'AutomationRuleRunPlaybookAction', 'AutomationRuleTriggeringLogic', @@ -609,7 +630,7 @@ 'FusionTemplateSourceSubType', 'FusionTemplateSubTypeSeverityFilter', 'GeoLocation', - 'GetInsightsError', + 'GetInsightsErrorKind', 'GetInsightsResultsMetadata', 'GetQueriesResponse', 'GitHubResourceInfo', @@ -741,6 +762,8 @@ 'PlaybookActionProperties', 'ProcessEntity', 'ProcessEntityProperties', + 'PropertyArrayChangedConditionProperties', + 'PropertyChangedConditionProperties', 'PropertyConditionProperties', 'QueryBasedAlertRuleTemplateProperties', 'RegistryKeyEntity', @@ -768,11 +791,13 @@ 'SecurityAlertTimelineItem', 'SecurityGroupEntity', 'SecurityGroupEntityProperties', + 'SecurityMLAnalyticsSetting', + 'SecurityMLAnalyticsSettingsDataSource', + 'SecurityMLAnalyticsSettingsList', 'SentinelOnboardingState', 'SentinelOnboardingStatesList', 'SettingList', 'Settings', - 'Sku', 'SourceControl', 'SourceControlList', 'SubmissionMailEntity', @@ -831,6 +856,10 @@ 'AlertStatus', 'AntispamMailDirection', 'AttackTactic', + 'AutomationRulePropertyArrayChangedConditionSupportedArrayType', + 'AutomationRulePropertyArrayChangedConditionSupportedChangeType', + 'AutomationRulePropertyChangedConditionSupportedChangedType', + 'AutomationRulePropertyChangedConditionSupportedPropertyType', 'AutomationRulePropertyConditionSupportedOperator', 'AutomationRulePropertyConditionSupportedProperty', 'ConditionType', @@ -854,13 +883,15 @@ 'EntityItemQueryKind', 'EntityKind', 'EntityMappingType', + 'EntityProviders', 'EntityQueryKind', 'EntityQueryTemplateKind', 'EntityTimelineKind', 'EntityType', - 'Enum12', + 'Enum13', 'EventGroupingAggregationKind', 'FileHashAlgorithm', + 'GetInsightsError', 'IncidentClassification', 'IncidentClassificationReason', 'IncidentLabelType', @@ -880,9 +911,10 @@ 'RegistryHive', 'RegistryValueKind', 'RepoType', + 'SecurityMLAnalyticsSettingsKind', 'SettingKind', 'SettingType', - 'SkuKind', + 'SettingsStatus', 'SourceKind', 'SourceType', 'SupportTier', @@ -895,3 +927,5 @@ 'UebaDataSources', 'Version', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file 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 fa483026a0e8..bf31051170dc 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 @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._security_insights_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class DataConnectorsCheckRequirements(msrest.serialization.Model): @@ -23,12 +25,11 @@ class DataConnectorsCheckRequirements(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind """ @@ -60,12 +61,11 @@ class AADCheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -273,8 +273,8 @@ class DataConnector(ResourceWithEtag): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -337,8 +337,8 @@ class AADDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -374,7 +374,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs ): """ @@ -405,7 +405,7 @@ class DataConnectorWithAlertsProperties(msrest.serialization.Model): def __init__( self, *, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs ): """ @@ -440,7 +440,7 @@ def __init__( self, *, tenant_id: str, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs ): """ @@ -460,12 +460,11 @@ class AATPCheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -545,8 +544,8 @@ class AATPDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -582,7 +581,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs ): """ @@ -623,7 +622,7 @@ def __init__( self, *, tenant_id: str, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs ): """ @@ -658,9 +657,9 @@ class Entity(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -714,9 +713,9 @@ class AccountEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -1222,7 +1221,7 @@ class ActionsList(msrest.serialization.Model): def __init__( self, *, - value: List["ActionResponse"], + value: List["_models.ActionResponse"], **kwargs ): """ @@ -1257,7 +1256,7 @@ class CustomEntityQuery(ResourceWithEtag): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. the entity query kind.Constant filled by server. Possible values include: + :ivar kind: Required. the entity query kind.Constant filled by server. Known values are: "Activity". :vartype kind: str or ~azure.mgmt.securityinsight.models.CustomEntityQueryKind """ @@ -1317,7 +1316,7 @@ class ActivityCustomEntityQuery(CustomEntityQuery): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. the entity query kind.Constant filled by server. Possible values include: + :ivar kind: Required. the entity query kind.Constant filled by server. Known values are: "Activity". :vartype kind: str or ~azure.mgmt.securityinsight.models.CustomEntityQueryKind :ivar title: The entity query title. @@ -1329,9 +1328,9 @@ class ActivityCustomEntityQuery(CustomEntityQuery): :ivar query_definitions: The Activity query definitions. :vartype query_definitions: ~azure.mgmt.securityinsight.models.ActivityEntityQueriesPropertiesQueryDefinitions - :ivar input_entity_type: The type of the query's source entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", + :ivar input_entity_type: The type of the query's source entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType :ivar required_input_fields_sets: List of the fields of the source entity that are required to @@ -1386,8 +1385,8 @@ def __init__( title: Optional[str] = None, content: Optional[str] = None, description: Optional[str] = None, - query_definitions: Optional["ActivityEntityQueriesPropertiesQueryDefinitions"] = None, - input_entity_type: Optional[Union[str, "EntityType"]] = None, + query_definitions: Optional["_models.ActivityEntityQueriesPropertiesQueryDefinitions"] = None, + input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, required_input_fields_sets: Optional[List[List[str]]] = None, entities_filter: Optional[Dict[str, List[str]]] = None, template_name: Optional[str] = None, @@ -1406,9 +1405,9 @@ def __init__( :keyword query_definitions: The Activity query definitions. :paramtype query_definitions: ~azure.mgmt.securityinsight.models.ActivityEntityQueriesPropertiesQueryDefinitions - :keyword input_entity_type: The type of the query's source entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", + :keyword input_entity_type: The type of the query's source entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :paramtype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType :keyword required_input_fields_sets: List of the fields of the source entity that are required @@ -1484,7 +1483,7 @@ class EntityQuery(ResourceWithEtag): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. the entity query kind.Constant filled by server. Possible values include: + :ivar kind: Required. the entity query kind.Constant filled by server. Known values are: "Expansion", "Insight", "Activity". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryKind """ @@ -1544,7 +1543,7 @@ class ActivityEntityQuery(EntityQuery): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. the entity query kind.Constant filled by server. Possible values include: + :ivar kind: Required. the entity query kind.Constant filled by server. Known values are: "Expansion", "Insight", "Activity". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryKind :ivar title: The entity query title. @@ -1556,9 +1555,9 @@ class ActivityEntityQuery(EntityQuery): :ivar query_definitions: The Activity query definitions. :vartype query_definitions: ~azure.mgmt.securityinsight.models.ActivityEntityQueriesPropertiesQueryDefinitions - :ivar input_entity_type: The type of the query's source entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", + :ivar input_entity_type: The type of the query's source entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType :ivar required_input_fields_sets: List of the fields of the source entity that are required to @@ -1613,8 +1612,8 @@ def __init__( title: Optional[str] = None, content: Optional[str] = None, description: Optional[str] = None, - query_definitions: Optional["ActivityEntityQueriesPropertiesQueryDefinitions"] = None, - input_entity_type: Optional[Union[str, "EntityType"]] = None, + query_definitions: Optional["_models.ActivityEntityQueriesPropertiesQueryDefinitions"] = None, + input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, required_input_fields_sets: Optional[List[List[str]]] = None, entities_filter: Optional[Dict[str, List[str]]] = None, template_name: Optional[str] = None, @@ -1633,9 +1632,9 @@ def __init__( :keyword query_definitions: The Activity query definitions. :paramtype query_definitions: ~azure.mgmt.securityinsight.models.ActivityEntityQueriesPropertiesQueryDefinitions - :keyword input_entity_type: The type of the query's source entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", + :keyword input_entity_type: The type of the query's source entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :paramtype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType :keyword required_input_fields_sets: List of the fields of the source entity that are required @@ -1684,8 +1683,8 @@ class EntityQueryTemplate(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. the entity query template kind.Constant filled by server. Possible values - include: "Activity". + :ivar kind: Required. the entity query template kind.Constant filled by server. Known values + are: "Activity". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryTemplateKind """ @@ -1737,8 +1736,8 @@ class ActivityEntityQueryTemplate(EntityQueryTemplate): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. the entity query template kind.Constant filled by server. Possible values - include: "Activity". + :ivar kind: Required. the entity query template kind.Constant filled by server. Known values + are: "Activity". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryTemplateKind :ivar title: The entity query title. :vartype title: str @@ -1751,9 +1750,9 @@ class ActivityEntityQueryTemplate(EntityQueryTemplate): ~azure.mgmt.securityinsight.models.ActivityEntityQueryTemplatePropertiesQueryDefinitions :ivar data_types: List of required data types for the given entity query template. :vartype data_types: list[~azure.mgmt.securityinsight.models.DataTypeDefinitions] - :ivar input_entity_type: The type of the query's source entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", + :ivar input_entity_type: The type of the query's source entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType :ivar required_input_fields_sets: List of the fields of the source entity that are required to @@ -1793,9 +1792,9 @@ def __init__( title: Optional[str] = None, content: Optional[str] = None, description: Optional[str] = None, - query_definitions: Optional["ActivityEntityQueryTemplatePropertiesQueryDefinitions"] = None, - data_types: Optional[List["DataTypeDefinitions"]] = None, - input_entity_type: Optional[Union[str, "EntityType"]] = None, + query_definitions: Optional["_models.ActivityEntityQueryTemplatePropertiesQueryDefinitions"] = None, + data_types: Optional[List["_models.DataTypeDefinitions"]] = None, + input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, required_input_fields_sets: Optional[List[List[str]]] = None, entities_filter: Optional[Dict[str, List[str]]] = None, **kwargs @@ -1812,9 +1811,9 @@ def __init__( ~azure.mgmt.securityinsight.models.ActivityEntityQueryTemplatePropertiesQueryDefinitions :keyword data_types: List of required data types for the given entity query template. :paramtype data_types: list[~azure.mgmt.securityinsight.models.DataTypeDefinitions] - :keyword input_entity_type: The type of the query's source entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", + :keyword input_entity_type: The type of the query's source entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :paramtype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType :keyword required_input_fields_sets: List of the fields of the source entity that are required @@ -1873,12 +1872,12 @@ class EntityTimelineItem(msrest.serialization.Model): """Entity timeline Item. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ActivityTimelineItem, BookmarkTimelineItem, SecurityAlertTimelineItem. + sub-classes are: ActivityTimelineItem, AnomalyTimelineItem, BookmarkTimelineItem, SecurityAlertTimelineItem. All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The entity query kind type.Constant filled by server. Possible values - include: "Activity", "Bookmark", "SecurityAlert". + :ivar kind: Required. The entity query kind type.Constant filled by server. Known values are: + "Activity", "Bookmark", "SecurityAlert", "Anomaly". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind """ @@ -1891,7 +1890,7 @@ class EntityTimelineItem(msrest.serialization.Model): } _subtype_map = { - 'kind': {'Activity': 'ActivityTimelineItem', 'Bookmark': 'BookmarkTimelineItem', 'SecurityAlert': 'SecurityAlertTimelineItem'} + 'kind': {'Activity': 'ActivityTimelineItem', 'Anomaly': 'AnomalyTimelineItem', 'Bookmark': 'BookmarkTimelineItem', 'SecurityAlert': 'SecurityAlertTimelineItem'} } def __init__( @@ -1909,8 +1908,8 @@ class ActivityTimelineItem(EntityTimelineItem): All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The entity query kind type.Constant filled by server. Possible values - include: "Activity", "Bookmark", "SecurityAlert". + :ivar kind: Required. The entity query kind type.Constant filled by server. Known values are: + "Activity", "Bookmark", "SecurityAlert", "Anomaly". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind :ivar query_id: Required. The activity query id. :vartype query_id: str @@ -2064,8 +2063,8 @@ class AlertRule(ResourceWithEtag): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind """ @@ -2131,7 +2130,7 @@ class AlertRulesList(msrest.serialization.Model): def __init__( self, *, - value: List["AlertRule"], + value: List["_models.AlertRule"], **kwargs ): """ @@ -2164,8 +2163,8 @@ class AlertRuleTemplate(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind """ @@ -2251,8 +2250,8 @@ class AlertRuleTemplatePropertiesBase(msrest.serialization.Model): :ivar required_data_connectors: The required data sources for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus """ @@ -2277,8 +2276,8 @@ def __init__( alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, **kwargs ): """ @@ -2292,8 +2291,8 @@ def __init__( :keyword required_data_connectors: The required data sources for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus """ super(AlertRuleTemplatePropertiesBase, self).__init__(**kwargs) @@ -2332,7 +2331,7 @@ class AlertRuleTemplatesList(msrest.serialization.Model): def __init__( self, *, - value: List["AlertRuleTemplate"], + value: List["_models.AlertRuleTemplate"], **kwargs ): """ @@ -2363,8 +2362,8 @@ class AlertRuleTemplateWithMitreProperties(AlertRuleTemplatePropertiesBase): :ivar required_data_connectors: The required data sources for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :ivar tactics: The tactics of the alert rule. :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] @@ -2395,9 +2394,9 @@ def __init__( alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, **kwargs ): @@ -2412,8 +2411,8 @@ def __init__( :keyword required_data_connectors: The required data sources for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :keyword tactics: The tactics of the alert rule. :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] @@ -2445,7 +2444,7 @@ class AlertsDataTypeOfDataConnector(msrest.serialization.Model): def __init__( self, *, - alerts: "DataConnectorDataTypeCommon", + alerts: "_models.DataConnectorDataTypeCommon", **kwargs ): """ @@ -2479,8 +2478,8 @@ class Settings(ResourceWithEtag): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the setting.Constant filled by server. Possible values - include: "Anomalies", "EyesOn", "EntityAnalytics", "Ueba". + :ivar kind: Required. The kind of the setting.Constant filled by server. Known values are: + "Anomalies", "EyesOn", "EntityAnalytics", "Ueba". :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind """ @@ -2539,8 +2538,8 @@ class Anomalies(Settings): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the setting.Constant filled by server. Possible values - include: "Anomalies", "EyesOn", "EntityAnalytics", "Ueba". + :ivar kind: Required. The kind of the setting.Constant filled by server. Known values are: + "Anomalies", "EyesOn", "EntityAnalytics", "Ueba". :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind :ivar is_enabled: Determines whether the setting is enable or disabled. :vartype is_enabled: bool @@ -2580,18 +2579,355 @@ def __init__( self.is_enabled = None +class SecurityMLAnalyticsSetting(ResourceWithEtag): + """Security ML Analytics Setting. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AnomalySecurityMLAnalyticsSettings. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The kind of security ML Analytics Settings.Constant filled by server. + Known values are: "Anomaly". + :vartype kind: str or ~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSettingsKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'Anomaly': 'AnomalySecurityMLAnalyticsSettings'} + } + + def __init__( + self, + *, + etag: Optional[str] = None, + **kwargs + ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + """ + super(SecurityMLAnalyticsSetting, self).__init__(etag=etag, **kwargs) + self.kind = 'SecurityMLAnalyticsSetting' # type: str + + +class AnomalySecurityMLAnalyticsSettings(SecurityMLAnalyticsSetting): + """Represents Anomaly Security ML Analytics Settings. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData + :ivar etag: Etag of the azure resource. + :vartype etag: str + :ivar kind: Required. The kind of security ML Analytics Settings.Constant filled by server. + Known values are: "Anomaly". + :vartype kind: str or ~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSettingsKind + :ivar description: The description of the SecurityMLAnalyticsSettings. + :vartype description: str + :ivar display_name: The display name for settings created by this SecurityMLAnalyticsSettings. + :vartype display_name: str + :ivar enabled: Determines whether this settings is enabled or disabled. + :vartype enabled: bool + :ivar last_modified_utc: The last time that this SecurityMLAnalyticsSettings has been modified. + :vartype last_modified_utc: ~datetime.datetime + :ivar required_data_connectors: The required data sources for this SecurityMLAnalyticsSettings. + :vartype required_data_connectors: + list[~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSettingsDataSource] + :ivar tactics: The tactics of the SecurityMLAnalyticsSettings. + :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :ivar techniques: The techniques of the SecurityMLAnalyticsSettings. + :vartype techniques: list[str] + :ivar anomaly_version: The anomaly version of the AnomalySecurityMLAnalyticsSettings. + :vartype anomaly_version: str + :ivar customizable_observations: The customizable observations of the + AnomalySecurityMLAnalyticsSettings. + :vartype customizable_observations: any + :ivar frequency: The frequency that this SecurityMLAnalyticsSettings will be run. + :vartype frequency: ~datetime.timedelta + :ivar settings_status: The anomaly SecurityMLAnalyticsSettings status. Known values are: + "Production", "Flighting". + :vartype settings_status: str or ~azure.mgmt.securityinsight.models.SettingsStatus + :ivar is_default_settings: Determines whether this anomaly security ml analytics settings is a + default settings. + :vartype is_default_settings: bool + :ivar anomaly_settings_version: The anomaly settings version of the Anomaly security ml + analytics settings that dictates whether job version gets updated or not. + :vartype anomaly_settings_version: int + :ivar settings_definition_id: The anomaly settings definition Id. + :vartype settings_definition_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'kind': {'required': True}, + 'last_modified_utc': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, + 'last_modified_utc': {'key': 'properties.lastModifiedUtc', 'type': 'iso-8601'}, + 'required_data_connectors': {'key': 'properties.requiredDataConnectors', 'type': '[SecurityMLAnalyticsSettingsDataSource]'}, + 'tactics': {'key': 'properties.tactics', 'type': '[str]'}, + 'techniques': {'key': 'properties.techniques', 'type': '[str]'}, + 'anomaly_version': {'key': 'properties.anomalyVersion', 'type': 'str'}, + 'customizable_observations': {'key': 'properties.customizableObservations', 'type': 'object'}, + 'frequency': {'key': 'properties.frequency', 'type': 'duration'}, + 'settings_status': {'key': 'properties.settingsStatus', 'type': 'str'}, + 'is_default_settings': {'key': 'properties.isDefaultSettings', 'type': 'bool'}, + 'anomaly_settings_version': {'key': 'properties.anomalySettingsVersion', 'type': 'int'}, + 'settings_definition_id': {'key': 'properties.settingsDefinitionId', 'type': 'str'}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + enabled: Optional[bool] = None, + required_data_connectors: Optional[List["_models.SecurityMLAnalyticsSettingsDataSource"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, + techniques: Optional[List[str]] = None, + anomaly_version: Optional[str] = None, + customizable_observations: Optional[Any] = None, + frequency: Optional[datetime.timedelta] = None, + settings_status: Optional[Union[str, "_models.SettingsStatus"]] = None, + is_default_settings: Optional[bool] = None, + anomaly_settings_version: Optional[int] = None, + settings_definition_id: Optional[str] = None, + **kwargs + ): + """ + :keyword etag: Etag of the azure resource. + :paramtype etag: str + :keyword description: The description of the SecurityMLAnalyticsSettings. + :paramtype description: str + :keyword display_name: The display name for settings created by this + SecurityMLAnalyticsSettings. + :paramtype display_name: str + :keyword enabled: Determines whether this settings is enabled or disabled. + :paramtype enabled: bool + :keyword required_data_connectors: The required data sources for this + SecurityMLAnalyticsSettings. + :paramtype required_data_connectors: + list[~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSettingsDataSource] + :keyword tactics: The tactics of the SecurityMLAnalyticsSettings. + :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] + :keyword techniques: The techniques of the SecurityMLAnalyticsSettings. + :paramtype techniques: list[str] + :keyword anomaly_version: The anomaly version of the AnomalySecurityMLAnalyticsSettings. + :paramtype anomaly_version: str + :keyword customizable_observations: The customizable observations of the + AnomalySecurityMLAnalyticsSettings. + :paramtype customizable_observations: any + :keyword frequency: The frequency that this SecurityMLAnalyticsSettings will be run. + :paramtype frequency: ~datetime.timedelta + :keyword settings_status: The anomaly SecurityMLAnalyticsSettings status. Known values are: + "Production", "Flighting". + :paramtype settings_status: str or ~azure.mgmt.securityinsight.models.SettingsStatus + :keyword is_default_settings: Determines whether this anomaly security ml analytics settings is + a default settings. + :paramtype is_default_settings: bool + :keyword anomaly_settings_version: The anomaly settings version of the Anomaly security ml + analytics settings that dictates whether job version gets updated or not. + :paramtype anomaly_settings_version: int + :keyword settings_definition_id: The anomaly settings definition Id. + :paramtype settings_definition_id: str + """ + super(AnomalySecurityMLAnalyticsSettings, self).__init__(etag=etag, **kwargs) + self.kind = 'Anomaly' # type: str + self.description = description + self.display_name = display_name + self.enabled = enabled + self.last_modified_utc = None + self.required_data_connectors = required_data_connectors + self.tactics = tactics + self.techniques = techniques + self.anomaly_version = anomaly_version + self.customizable_observations = customizable_observations + self.frequency = frequency + self.settings_status = settings_status + self.is_default_settings = is_default_settings + self.anomaly_settings_version = anomaly_settings_version + self.settings_definition_id = settings_definition_id + + +class AnomalyTimelineItem(EntityTimelineItem): + """Represents anomaly timeline item. + + All required parameters must be populated in order to send to Azure. + + :ivar kind: Required. The entity query kind type.Constant filled by server. Known values are: + "Activity", "Bookmark", "SecurityAlert", "Anomaly". + :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind + :ivar azure_resource_id: Required. The anomaly azure resource id. + :vartype azure_resource_id: str + :ivar product_name: The anomaly product name. + :vartype product_name: str + :ivar description: The anomaly description. + :vartype description: str + :ivar display_name: Required. The anomaly name. + :vartype display_name: str + :ivar end_time_utc: Required. The anomaly end time. + :vartype end_time_utc: ~datetime.datetime + :ivar start_time_utc: Required. The anomaly start time. + :vartype start_time_utc: ~datetime.datetime + :ivar time_generated: Required. The anomaly generated time. + :vartype time_generated: ~datetime.datetime + :ivar vendor: The name of the anomaly vendor. + :vartype vendor: str + :ivar intent: The intent of the anomaly. + :vartype intent: str + :ivar techniques: The techniques of the anomaly. + :vartype techniques: list[str] + :ivar reasons: The reasons that cause the anomaly. + :vartype reasons: list[str] + """ + + _validation = { + 'kind': {'required': True}, + 'azure_resource_id': {'required': True}, + 'display_name': {'required': True}, + 'end_time_utc': {'required': True}, + 'start_time_utc': {'required': True}, + 'time_generated': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'azure_resource_id': {'key': 'azureResourceId', 'type': 'str'}, + 'product_name': {'key': 'productName', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'end_time_utc': {'key': 'endTimeUtc', 'type': 'iso-8601'}, + 'start_time_utc': {'key': 'startTimeUtc', 'type': 'iso-8601'}, + 'time_generated': {'key': 'timeGenerated', 'type': 'iso-8601'}, + 'vendor': {'key': 'vendor', 'type': 'str'}, + 'intent': {'key': 'intent', 'type': 'str'}, + 'techniques': {'key': 'techniques', 'type': '[str]'}, + 'reasons': {'key': 'reasons', 'type': '[str]'}, + } + + def __init__( + self, + *, + azure_resource_id: str, + display_name: str, + end_time_utc: datetime.datetime, + start_time_utc: datetime.datetime, + time_generated: datetime.datetime, + product_name: Optional[str] = None, + description: Optional[str] = None, + vendor: Optional[str] = None, + intent: Optional[str] = None, + techniques: Optional[List[str]] = None, + reasons: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword azure_resource_id: Required. The anomaly azure resource id. + :paramtype azure_resource_id: str + :keyword product_name: The anomaly product name. + :paramtype product_name: str + :keyword description: The anomaly description. + :paramtype description: str + :keyword display_name: Required. The anomaly name. + :paramtype display_name: str + :keyword end_time_utc: Required. The anomaly end time. + :paramtype end_time_utc: ~datetime.datetime + :keyword start_time_utc: Required. The anomaly start time. + :paramtype start_time_utc: ~datetime.datetime + :keyword time_generated: Required. The anomaly generated time. + :paramtype time_generated: ~datetime.datetime + :keyword vendor: The name of the anomaly vendor. + :paramtype vendor: str + :keyword intent: The intent of the anomaly. + :paramtype intent: str + :keyword techniques: The techniques of the anomaly. + :paramtype techniques: list[str] + :keyword reasons: The reasons that cause the anomaly. + :paramtype reasons: list[str] + """ + super(AnomalyTimelineItem, self).__init__(**kwargs) + self.kind = 'Anomaly' # type: str + self.azure_resource_id = azure_resource_id + self.product_name = product_name + self.description = description + self.display_name = display_name + self.end_time_utc = end_time_utc + self.start_time_utc = start_time_utc + self.time_generated = time_generated + self.vendor = vendor + self.intent = intent + self.techniques = techniques + self.reasons = reasons + + class ASCCheckRequirements(DataConnectorsCheckRequirements): """Represents ASC (Azure Security Center) requirements check request. All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar subscription_id: The subscription id to connect to, and get the data from. :vartype subscription_id: str @@ -2641,8 +2977,8 @@ class ASCDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -2677,7 +3013,7 @@ def __init__( self, *, etag: Optional[str] = None, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, subscription_id: Optional[str] = None, **kwargs ): @@ -2712,7 +3048,7 @@ class ASCDataConnectorProperties(DataConnectorWithAlertsProperties): def __init__( self, *, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, subscription_id: Optional[str] = None, **kwargs ): @@ -2800,8 +3136,8 @@ def __init__( *, display_name: str, order: int, - triggering_logic: "AutomationRuleTriggeringLogic", - actions: List["AutomationRuleAction"], + triggering_logic: "_models.AutomationRuleTriggeringLogic", + actions: List["_models.AutomationRuleAction"], etag: Optional[str] = None, **kwargs ): @@ -2839,7 +3175,7 @@ class AutomationRuleAction(msrest.serialization.Model): :ivar order: Required. :vartype order: int :ivar action_type: Required. The type of the automation rule action.Constant filled by server. - Possible values include: "ModifyProperties", "RunPlaybook". + Known values are: "ModifyProperties", "RunPlaybook". :vartype action_type: str or ~azure.mgmt.securityinsight.models.ActionType """ @@ -2876,11 +3212,12 @@ class AutomationRuleCondition(msrest.serialization.Model): """Describes an automation rule condition. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: PropertyConditionProperties. + sub-classes are: PropertyConditionProperties, PropertyArrayChangedConditionProperties, PropertyChangedConditionProperties. All required parameters must be populated in order to send to Azure. - :ivar condition_type: Required. Constant filled by server. Possible values include: "Property". + :ivar condition_type: Required. Constant filled by server. Known values are: "Property", + "PropertyChanged", "PropertyArrayChanged". :vartype condition_type: str or ~azure.mgmt.securityinsight.models.ConditionType """ @@ -2893,7 +3230,7 @@ class AutomationRuleCondition(msrest.serialization.Model): } _subtype_map = { - 'condition_type': {'Property': 'PropertyConditionProperties'} + 'condition_type': {'Property': 'PropertyConditionProperties', 'PropertyArrayChanged': 'PropertyArrayChangedConditionProperties', 'PropertyChanged': 'PropertyChangedConditionProperties'} } def __init__( @@ -2914,7 +3251,7 @@ class AutomationRuleModifyPropertiesAction(AutomationRuleAction): :ivar order: Required. :vartype order: int :ivar action_type: Required. The type of the automation rule action.Constant filled by server. - Possible values include: "ModifyProperties", "RunPlaybook". + Known values are: "ModifyProperties", "RunPlaybook". :vartype action_type: str or ~azure.mgmt.securityinsight.models.ActionType :ivar action_configuration: :vartype action_configuration: ~azure.mgmt.securityinsight.models.IncidentPropertiesAction @@ -2935,7 +3272,7 @@ def __init__( self, *, order: int, - action_configuration: Optional["IncidentPropertiesAction"] = None, + action_configuration: Optional["_models.IncidentPropertiesAction"] = None, **kwargs ): """ @@ -2949,26 +3286,117 @@ def __init__( self.action_configuration = action_configuration +class AutomationRulePropertyArrayChangedValuesCondition(msrest.serialization.Model): + """AutomationRulePropertyArrayChangedValuesCondition. + + :ivar array_type: Known values are: "Alerts", "Labels", "Tactics", "Comments". + :vartype array_type: str or + ~azure.mgmt.securityinsight.models.AutomationRulePropertyArrayChangedConditionSupportedArrayType + :ivar change_type: Known values are: "Added". + :vartype change_type: str or + ~azure.mgmt.securityinsight.models.AutomationRulePropertyArrayChangedConditionSupportedChangeType + """ + + _attribute_map = { + 'array_type': {'key': 'arrayType', 'type': 'str'}, + 'change_type': {'key': 'changeType', 'type': 'str'}, + } + + def __init__( + self, + *, + array_type: Optional[Union[str, "_models.AutomationRulePropertyArrayChangedConditionSupportedArrayType"]] = None, + change_type: Optional[Union[str, "_models.AutomationRulePropertyArrayChangedConditionSupportedChangeType"]] = None, + **kwargs + ): + """ + :keyword array_type: Known values are: "Alerts", "Labels", "Tactics", "Comments". + :paramtype array_type: str or + ~azure.mgmt.securityinsight.models.AutomationRulePropertyArrayChangedConditionSupportedArrayType + :keyword change_type: Known values are: "Added". + :paramtype change_type: str or + ~azure.mgmt.securityinsight.models.AutomationRulePropertyArrayChangedConditionSupportedChangeType + """ + super(AutomationRulePropertyArrayChangedValuesCondition, self).__init__(**kwargs) + self.array_type = array_type + self.change_type = change_type + + +class AutomationRulePropertyValuesChangedCondition(msrest.serialization.Model): + """AutomationRulePropertyValuesChangedCondition. + + :ivar property_name: Known values are: "IncidentSeverity", "IncidentStatus", "IncidentOwner". + :vartype property_name: str or + ~azure.mgmt.securityinsight.models.AutomationRulePropertyChangedConditionSupportedPropertyType + :ivar change_type: Known values are: "ChangedFrom", "ChangedTo". + :vartype change_type: str or + ~azure.mgmt.securityinsight.models.AutomationRulePropertyChangedConditionSupportedChangedType + :ivar operator: Known values are: "Equals", "NotEquals", "Contains", "NotContains", + "StartsWith", "NotStartsWith", "EndsWith", "NotEndsWith". + :vartype operator: str or + ~azure.mgmt.securityinsight.models.AutomationRulePropertyConditionSupportedOperator + :ivar property_values: + :vartype property_values: list[str] + """ + + _attribute_map = { + 'property_name': {'key': 'propertyName', 'type': 'str'}, + 'change_type': {'key': 'changeType', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'property_values': {'key': 'propertyValues', 'type': '[str]'}, + } + + def __init__( + self, + *, + property_name: Optional[Union[str, "_models.AutomationRulePropertyChangedConditionSupportedPropertyType"]] = None, + change_type: Optional[Union[str, "_models.AutomationRulePropertyChangedConditionSupportedChangedType"]] = None, + operator: Optional[Union[str, "_models.AutomationRulePropertyConditionSupportedOperator"]] = None, + property_values: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword property_name: Known values are: "IncidentSeverity", "IncidentStatus", + "IncidentOwner". + :paramtype property_name: str or + ~azure.mgmt.securityinsight.models.AutomationRulePropertyChangedConditionSupportedPropertyType + :keyword change_type: Known values are: "ChangedFrom", "ChangedTo". + :paramtype change_type: str or + ~azure.mgmt.securityinsight.models.AutomationRulePropertyChangedConditionSupportedChangedType + :keyword operator: Known values are: "Equals", "NotEquals", "Contains", "NotContains", + "StartsWith", "NotStartsWith", "EndsWith", "NotEndsWith". + :paramtype operator: str or + ~azure.mgmt.securityinsight.models.AutomationRulePropertyConditionSupportedOperator + :keyword property_values: + :paramtype property_values: list[str] + """ + super(AutomationRulePropertyValuesChangedCondition, self).__init__(**kwargs) + self.property_name = property_name + self.change_type = change_type + self.operator = operator + self.property_values = property_values + + class AutomationRulePropertyValuesCondition(msrest.serialization.Model): """AutomationRulePropertyValuesCondition. - :ivar property_name: The property to evaluate in an automation rule property condition. - Possible values include: "IncidentTitle", "IncidentDescription", "IncidentSeverity", - "IncidentStatus", "IncidentRelatedAnalyticRuleIds", "IncidentTactics", "IncidentLabel", - "IncidentProviderName", "AccountAadTenantId", "AccountAadUserId", "AccountName", - "AccountNTDomain", "AccountPUID", "AccountSid", "AccountObjectGuid", "AccountUPNSuffix", - "AlertProductNames", "AzureResourceResourceId", "AzureResourceSubscriptionId", - "CloudApplicationAppId", "CloudApplicationAppName", "DNSDomainName", "FileDirectory", - "FileName", "FileHashValue", "HostAzureID", "HostName", "HostNetBiosName", "HostNTDomain", - "HostOSVersion", "IoTDeviceId", "IoTDeviceName", "IoTDeviceType", "IoTDeviceVendor", - "IoTDeviceModel", "IoTDeviceOperatingSystem", "IPAddress", "MailboxDisplayName", - "MailboxPrimaryAddress", "MailboxUPN", "MailMessageDeliveryAction", - "MailMessageDeliveryLocation", "MailMessageRecipient", "MailMessageSenderIP", - "MailMessageSubject", "MailMessageP1Sender", "MailMessageP2Sender", "MalwareCategory", - "MalwareName", "ProcessCommandLine", "ProcessId", "RegistryKey", "RegistryValueData", "Url". + :ivar property_name: The property to evaluate in an automation rule property condition. Known + values are: "IncidentTitle", "IncidentDescription", "IncidentSeverity", "IncidentStatus", + "IncidentRelatedAnalyticRuleIds", "IncidentTactics", "IncidentLabel", "IncidentProviderName", + "AccountAadTenantId", "AccountAadUserId", "AccountName", "AccountNTDomain", "AccountPUID", + "AccountSid", "AccountObjectGuid", "AccountUPNSuffix", "AlertProductNames", + "AzureResourceResourceId", "AzureResourceSubscriptionId", "CloudApplicationAppId", + "CloudApplicationAppName", "DNSDomainName", "FileDirectory", "FileName", "FileHashValue", + "HostAzureID", "HostName", "HostNetBiosName", "HostNTDomain", "HostOSVersion", "IoTDeviceId", + "IoTDeviceName", "IoTDeviceType", "IoTDeviceVendor", "IoTDeviceModel", + "IoTDeviceOperatingSystem", "IPAddress", "MailboxDisplayName", "MailboxPrimaryAddress", + "MailboxUPN", "MailMessageDeliveryAction", "MailMessageDeliveryLocation", + "MailMessageRecipient", "MailMessageSenderIP", "MailMessageSubject", "MailMessageP1Sender", + "MailMessageP2Sender", "MalwareCategory", "MalwareName", "ProcessCommandLine", "ProcessId", + "RegistryKey", "RegistryValueData", "Url". :vartype property_name: str or ~azure.mgmt.securityinsight.models.AutomationRulePropertyConditionSupportedProperty - :ivar operator: Possible values include: "Equals", "NotEquals", "Contains", "NotContains", + :ivar operator: Known values are: "Equals", "NotEquals", "Contains", "NotContains", "StartsWith", "NotStartsWith", "EndsWith", "NotEndsWith". :vartype operator: str or ~azure.mgmt.securityinsight.models.AutomationRulePropertyConditionSupportedOperator @@ -2985,29 +3413,29 @@ class AutomationRulePropertyValuesCondition(msrest.serialization.Model): def __init__( self, *, - property_name: Optional[Union[str, "AutomationRulePropertyConditionSupportedProperty"]] = None, - operator: Optional[Union[str, "AutomationRulePropertyConditionSupportedOperator"]] = None, + property_name: Optional[Union[str, "_models.AutomationRulePropertyConditionSupportedProperty"]] = None, + operator: Optional[Union[str, "_models.AutomationRulePropertyConditionSupportedOperator"]] = None, property_values: Optional[List[str]] = None, **kwargs ): """ :keyword property_name: The property to evaluate in an automation rule property condition. - Possible values include: "IncidentTitle", "IncidentDescription", "IncidentSeverity", - "IncidentStatus", "IncidentRelatedAnalyticRuleIds", "IncidentTactics", "IncidentLabel", - "IncidentProviderName", "AccountAadTenantId", "AccountAadUserId", "AccountName", - "AccountNTDomain", "AccountPUID", "AccountSid", "AccountObjectGuid", "AccountUPNSuffix", - "AlertProductNames", "AzureResourceResourceId", "AzureResourceSubscriptionId", - "CloudApplicationAppId", "CloudApplicationAppName", "DNSDomainName", "FileDirectory", - "FileName", "FileHashValue", "HostAzureID", "HostName", "HostNetBiosName", "HostNTDomain", - "HostOSVersion", "IoTDeviceId", "IoTDeviceName", "IoTDeviceType", "IoTDeviceVendor", - "IoTDeviceModel", "IoTDeviceOperatingSystem", "IPAddress", "MailboxDisplayName", - "MailboxPrimaryAddress", "MailboxUPN", "MailMessageDeliveryAction", - "MailMessageDeliveryLocation", "MailMessageRecipient", "MailMessageSenderIP", - "MailMessageSubject", "MailMessageP1Sender", "MailMessageP2Sender", "MalwareCategory", - "MalwareName", "ProcessCommandLine", "ProcessId", "RegistryKey", "RegistryValueData", "Url". + Known values are: "IncidentTitle", "IncidentDescription", "IncidentSeverity", "IncidentStatus", + "IncidentRelatedAnalyticRuleIds", "IncidentTactics", "IncidentLabel", "IncidentProviderName", + "AccountAadTenantId", "AccountAadUserId", "AccountName", "AccountNTDomain", "AccountPUID", + "AccountSid", "AccountObjectGuid", "AccountUPNSuffix", "AlertProductNames", + "AzureResourceResourceId", "AzureResourceSubscriptionId", "CloudApplicationAppId", + "CloudApplicationAppName", "DNSDomainName", "FileDirectory", "FileName", "FileHashValue", + "HostAzureID", "HostName", "HostNetBiosName", "HostNTDomain", "HostOSVersion", "IoTDeviceId", + "IoTDeviceName", "IoTDeviceType", "IoTDeviceVendor", "IoTDeviceModel", + "IoTDeviceOperatingSystem", "IPAddress", "MailboxDisplayName", "MailboxPrimaryAddress", + "MailboxUPN", "MailMessageDeliveryAction", "MailMessageDeliveryLocation", + "MailMessageRecipient", "MailMessageSenderIP", "MailMessageSubject", "MailMessageP1Sender", + "MailMessageP2Sender", "MalwareCategory", "MalwareName", "ProcessCommandLine", "ProcessId", + "RegistryKey", "RegistryValueData", "Url". :paramtype property_name: str or ~azure.mgmt.securityinsight.models.AutomationRulePropertyConditionSupportedProperty - :keyword operator: Possible values include: "Equals", "NotEquals", "Contains", "NotContains", + :keyword operator: Known values are: "Equals", "NotEquals", "Contains", "NotContains", "StartsWith", "NotStartsWith", "EndsWith", "NotEndsWith". :paramtype operator: str or ~azure.mgmt.securityinsight.models.AutomationRulePropertyConditionSupportedOperator @@ -3028,7 +3456,7 @@ class AutomationRuleRunPlaybookAction(AutomationRuleAction): :ivar order: Required. :vartype order: int :ivar action_type: Required. The type of the automation rule action.Constant filled by server. - Possible values include: "ModifyProperties", "RunPlaybook". + Known values are: "ModifyProperties", "RunPlaybook". :vartype action_type: str or ~azure.mgmt.securityinsight.models.ActionType :ivar action_configuration: :vartype action_configuration: ~azure.mgmt.securityinsight.models.PlaybookActionProperties @@ -3049,7 +3477,7 @@ def __init__( self, *, order: int, - action_configuration: Optional["PlaybookActionProperties"] = None, + action_configuration: Optional["_models.PlaybookActionProperties"] = None, **kwargs ): """ @@ -3080,7 +3508,7 @@ class AutomationRulesList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AutomationRule"]] = None, + value: Optional[List["_models.AutomationRule"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -3105,9 +3533,9 @@ class AutomationRuleTriggeringLogic(msrest.serialization.Model): :ivar expiration_time_utc: Determines when the automation rule should automatically expire and be disabled. :vartype expiration_time_utc: ~datetime.datetime - :ivar triggers_on: Required. Possible values include: "Incidents". + :ivar triggers_on: Required. Known values are: "Incidents". :vartype triggers_on: str or ~azure.mgmt.securityinsight.models.TriggersOn - :ivar triggers_when: Required. Possible values include: "Created". + :ivar triggers_when: Required. Known values are: "Created", "Updated". :vartype triggers_when: str or ~azure.mgmt.securityinsight.models.TriggersWhen :ivar conditions: The conditions to evaluate to determine if the automation rule should be triggered on a given object. @@ -3133,10 +3561,10 @@ def __init__( self, *, is_enabled: bool, - triggers_on: Union[str, "TriggersOn"], - triggers_when: Union[str, "TriggersWhen"], + triggers_on: Union[str, "_models.TriggersOn"], + triggers_when: Union[str, "_models.TriggersWhen"], expiration_time_utc: Optional[datetime.datetime] = None, - conditions: Optional[List["AutomationRuleCondition"]] = None, + conditions: Optional[List["_models.AutomationRuleCondition"]] = None, **kwargs ): """ @@ -3145,9 +3573,9 @@ def __init__( :keyword expiration_time_utc: Determines when the automation rule should automatically expire and be disabled. :paramtype expiration_time_utc: ~datetime.datetime - :keyword triggers_on: Required. Possible values include: "Incidents". + :keyword triggers_on: Required. Known values are: "Incidents". :paramtype triggers_on: str or ~azure.mgmt.securityinsight.models.TriggersOn - :keyword triggers_when: Required. Possible values include: "Created". + :keyword triggers_when: Required. Known values are: "Created", "Updated". :paramtype triggers_when: str or ~azure.mgmt.securityinsight.models.TriggersWhen :keyword conditions: The conditions to evaluate to determine if the automation rule should be triggered on a given object. @@ -3201,12 +3629,11 @@ class AwsCloudTrailCheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind """ @@ -3248,8 +3675,8 @@ class AwsCloudTrailDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -3286,7 +3713,7 @@ def __init__( *, etag: Optional[str] = None, aws_role_arn: Optional[str] = None, - data_types: Optional["AwsCloudTrailDataConnectorDataTypes"] = None, + data_types: Optional["_models.AwsCloudTrailDataConnectorDataTypes"] = None, **kwargs ): """ @@ -3324,7 +3751,7 @@ class AwsCloudTrailDataConnectorDataTypes(msrest.serialization.Model): def __init__( self, *, - logs: "AwsCloudTrailDataConnectorDataTypesLogs", + logs: "_models.AwsCloudTrailDataConnectorDataTypesLogs", **kwargs ): """ @@ -3340,8 +3767,8 @@ class DataConnectorDataTypeCommon(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -3356,12 +3783,12 @@ class DataConnectorDataTypeCommon(msrest.serialization.Model): def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(DataConnectorDataTypeCommon, self).__init__(**kwargs) @@ -3373,8 +3800,8 @@ class AwsCloudTrailDataConnectorDataTypesLogs(DataConnectorDataTypeCommon): All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -3389,12 +3816,12 @@ class AwsCloudTrailDataConnectorDataTypesLogs(DataConnectorDataTypeCommon): def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(AwsCloudTrailDataConnectorDataTypesLogs, self).__init__(state=state, **kwargs) @@ -3406,12 +3833,11 @@ class AwsS3CheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind """ @@ -3453,8 +3879,8 @@ class AwsS3DataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -3498,7 +3924,7 @@ def __init__( destination_table: Optional[str] = None, sqs_urls: Optional[List[str]] = None, role_arn: Optional[str] = None, - data_types: Optional["AwsS3DataConnectorDataTypes"] = None, + data_types: Optional["_models.AwsS3DataConnectorDataTypes"] = None, **kwargs ): """ @@ -3541,7 +3967,7 @@ class AwsS3DataConnectorDataTypes(msrest.serialization.Model): def __init__( self, *, - logs: "AwsS3DataConnectorDataTypesLogs", + logs: "_models.AwsS3DataConnectorDataTypesLogs", **kwargs ): """ @@ -3557,8 +3983,8 @@ class AwsS3DataConnectorDataTypesLogs(DataConnectorDataTypeCommon): All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -3573,12 +3999,12 @@ class AwsS3DataConnectorDataTypesLogs(DataConnectorDataTypeCommon): def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(AwsS3DataConnectorDataTypesLogs, self).__init__(state=state, **kwargs) @@ -3634,9 +4060,9 @@ class AzureResourceEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -3820,20 +4246,20 @@ def __init__( *, etag: Optional[str] = None, created: Optional[datetime.datetime] = None, - created_by: Optional["UserInfo"] = None, + created_by: Optional["_models.UserInfo"] = None, display_name: Optional[str] = None, labels: Optional[List[str]] = None, notes: Optional[str] = None, query: Optional[str] = None, query_result: Optional[str] = None, updated: Optional[datetime.datetime] = None, - updated_by: Optional["UserInfo"] = None, + updated_by: Optional["_models.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, - entity_mappings: Optional[List["BookmarkEntityMappings"]] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + incident_info: Optional["_models.IncidentInfo"] = None, + entity_mappings: Optional[List["_models.BookmarkEntityMappings"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, **kwargs ): @@ -3910,7 +4336,7 @@ def __init__( self, *, entity_type: Optional[str] = None, - field_mappings: Optional[List["EntityFieldMapping"]] = None, + field_mappings: Optional[List["_models.EntityFieldMapping"]] = None, **kwargs ): """ @@ -3984,8 +4410,8 @@ class BookmarkExpandResponse(msrest.serialization.Model): def __init__( self, *, - meta_data: Optional["ExpansionResultsMetadata"] = None, - value: Optional["BookmarkExpandResponseValue"] = None, + meta_data: Optional["_models.ExpansionResultsMetadata"] = None, + value: Optional["_models.BookmarkExpandResponseValue"] = None, **kwargs ): """ @@ -4016,8 +4442,8 @@ class BookmarkExpandResponseValue(msrest.serialization.Model): def __init__( self, *, - entities: Optional[List["Entity"]] = None, - edges: Optional[List["ConnectedEntity"]] = None, + entities: Optional[List["_models.Entity"]] = None, + edges: Optional[List["_models.ConnectedEntity"]] = None, **kwargs ): """ @@ -4057,7 +4483,7 @@ class BookmarkList(msrest.serialization.Model): def __init__( self, *, - value: List["Bookmark"], + value: List["_models.Bookmark"], **kwargs ): """ @@ -4074,8 +4500,8 @@ class BookmarkTimelineItem(EntityTimelineItem): All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The entity query kind type.Constant filled by server. Possible values - include: "Activity", "Bookmark", "SecurityAlert". + :ivar kind: Required. The entity query kind type.Constant filled by server. Known values are: + "Activity", "Bookmark", "SecurityAlert", "Anomaly". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind :ivar azure_resource_id: Required. The bookmark azure resource id. :vartype azure_resource_id: str @@ -4121,7 +4547,7 @@ def __init__( end_time_utc: Optional[datetime.datetime] = None, start_time_utc: Optional[datetime.datetime] = None, event_time: Optional[datetime.datetime] = None, - created_by: Optional["UserInfo"] = None, + created_by: Optional["_models.UserInfo"] = None, labels: Optional[List[str]] = None, **kwargs ): @@ -4219,9 +4645,9 @@ class CloudApplicationEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -4383,8 +4809,8 @@ class CodelessApiPollingDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -4421,8 +4847,8 @@ def __init__( self, *, etag: Optional[str] = None, - connector_ui_config: Optional["CodelessUiConnectorConfigProperties"] = None, - polling_config: Optional["CodelessConnectorPollingConfigProperties"] = None, + connector_ui_config: Optional["_models.CodelessUiConnectorConfigProperties"] = None, + polling_config: Optional["_models.CodelessConnectorPollingConfigProperties"] = None, **kwargs ): """ @@ -4600,11 +5026,11 @@ class CodelessConnectorPollingConfigProperties(msrest.serialization.Model): def __init__( self, *, - auth: "CodelessConnectorPollingAuthProperties", - request: "CodelessConnectorPollingRequestProperties", + auth: "_models.CodelessConnectorPollingAuthProperties", + request: "_models.CodelessConnectorPollingRequestProperties", is_active: Optional[bool] = None, - paging: Optional["CodelessConnectorPollingPagingProperties"] = None, - response: Optional["CodelessConnectorPollingResponseProperties"] = None, + paging: Optional["_models.CodelessConnectorPollingPagingProperties"] = None, + response: Optional["_models.CodelessConnectorPollingResponseProperties"] = None, **kwargs ): """ @@ -4974,13 +5400,13 @@ def __init__( publisher: str, description_markdown: str, graph_queries_table_name: str, - graph_queries: List["CodelessUiConnectorConfigPropertiesGraphQueriesItem"], - sample_queries: List["CodelessUiConnectorConfigPropertiesSampleQueriesItem"], - data_types: List["CodelessUiConnectorConfigPropertiesDataTypesItem"], - connectivity_criteria: List["CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem"], - availability: "Availability", - permissions: "Permissions", - instruction_steps: List["CodelessUiConnectorConfigPropertiesInstructionStepsItem"], + graph_queries: List["_models.CodelessUiConnectorConfigPropertiesGraphQueriesItem"], + sample_queries: List["_models.CodelessUiConnectorConfigPropertiesSampleQueriesItem"], + data_types: List["_models.CodelessUiConnectorConfigPropertiesDataTypesItem"], + connectivity_criteria: List["_models.CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem"], + availability: "_models.Availability", + permissions: "_models.Permissions", + instruction_steps: List["_models.CodelessUiConnectorConfigPropertiesInstructionStepsItem"], custom_image: Optional[str] = None, **kwargs ): @@ -5035,7 +5461,7 @@ def __init__( class ConnectivityCriteria(msrest.serialization.Model): """Setting for the connector check connectivity. - :ivar type: type of connectivity. Possible values include: "IsConnectedQuery". + :ivar type: type of connectivity. Known values are: "IsConnectedQuery". :vartype type: str or ~azure.mgmt.securityinsight.models.ConnectivityType :ivar value: Queries for checking connectivity. :vartype value: list[str] @@ -5049,12 +5475,12 @@ class ConnectivityCriteria(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ConnectivityType"]] = None, + type: Optional[Union[str, "_models.ConnectivityType"]] = None, value: Optional[List[str]] = None, **kwargs ): """ - :keyword type: type of connectivity. Possible values include: "IsConnectedQuery". + :keyword type: type of connectivity. Known values are: "IsConnectedQuery". :paramtype type: str or ~azure.mgmt.securityinsight.models.ConnectivityType :keyword value: Queries for checking connectivity. :paramtype value: list[str] @@ -5067,7 +5493,7 @@ def __init__( class CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem(ConnectivityCriteria): """CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem. - :ivar type: type of connectivity. Possible values include: "IsConnectedQuery". + :ivar type: type of connectivity. Known values are: "IsConnectedQuery". :vartype type: str or ~azure.mgmt.securityinsight.models.ConnectivityType :ivar value: Queries for checking connectivity. :vartype value: list[str] @@ -5081,12 +5507,12 @@ class CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem(ConnectivityCr def __init__( self, *, - type: Optional[Union[str, "ConnectivityType"]] = None, + type: Optional[Union[str, "_models.ConnectivityType"]] = None, value: Optional[List[str]] = None, **kwargs ): """ - :keyword type: type of connectivity. Possible values include: "IsConnectedQuery". + :keyword type: type of connectivity. Known values are: "IsConnectedQuery". :paramtype type: str or ~azure.mgmt.securityinsight.models.ConnectivityType :keyword value: Queries for checking connectivity. :paramtype value: list[str] @@ -5258,7 +5684,7 @@ def __init__( *, title: Optional[str] = None, description: Optional[str] = None, - instructions: Optional[List["InstructionStepsInstructionsItem"]] = None, + instructions: Optional[List["_models.InstructionStepsInstructionsItem"]] = None, **kwargs ): """ @@ -5299,7 +5725,7 @@ def __init__( *, title: Optional[str] = None, description: Optional[str] = None, - instructions: Optional[List["InstructionStepsInstructionsItem"]] = None, + instructions: Optional[List["_models.InstructionStepsInstructionsItem"]] = None, **kwargs ): """ @@ -5396,8 +5822,8 @@ class CodelessUiDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -5430,7 +5856,7 @@ def __init__( self, *, etag: Optional[str] = None, - connector_ui_config: Optional["CodelessUiConnectorConfigProperties"] = None, + connector_ui_config: Optional["_models.CodelessUiConnectorConfigProperties"] = None, **kwargs ): """ @@ -5484,7 +5910,7 @@ class ConnectorInstructionModelBase(msrest.serialization.Model): :ivar parameters: The parameters for the setting. :vartype parameters: any - :ivar type: Required. The kind of the setting. Possible values include: "CopyableLabel", + :ivar type: Required. The kind of the setting. Known values are: "CopyableLabel", "InstructionStepsGroup", "InfoMessage". :vartype type: str or ~azure.mgmt.securityinsight.models.SettingType """ @@ -5501,14 +5927,14 @@ class ConnectorInstructionModelBase(msrest.serialization.Model): def __init__( self, *, - type: Union[str, "SettingType"], + type: Union[str, "_models.SettingType"], parameters: Optional[Any] = None, **kwargs ): """ :keyword parameters: The parameters for the setting. :paramtype parameters: any - :keyword type: Required. The kind of the setting. Possible values include: "CopyableLabel", + :keyword type: Required. The kind of the setting. Known values are: "CopyableLabel", "InstructionStepsGroup", "InfoMessage". :paramtype type: str or ~azure.mgmt.securityinsight.models.SettingType """ @@ -5520,7 +5946,7 @@ def __init__( class ContentPathMap(msrest.serialization.Model): """The mapping of content type to a repo path. - :ivar content_type: Content type. Possible values include: "AnalyticRule", "Workbook". + :ivar content_type: Content type. Known values are: "AnalyticRule", "Workbook". :vartype content_type: str or ~azure.mgmt.securityinsight.models.ContentType :ivar path: The path to the content. :vartype path: str @@ -5534,12 +5960,12 @@ class ContentPathMap(msrest.serialization.Model): def __init__( self, *, - content_type: Optional[Union[str, "ContentType"]] = None, + content_type: Optional[Union[str, "_models.ContentType"]] = None, path: Optional[str] = None, **kwargs ): """ - :keyword content_type: Content type. Possible values include: "AnalyticRule", "Workbook". + :keyword content_type: Content type. Known values are: "AnalyticRule", "Workbook". :paramtype content_type: str or ~azure.mgmt.securityinsight.models.ContentType :keyword path: The path to the content. :paramtype path: str @@ -5614,11 +6040,20 @@ def __init__( class DataConnectorConnectBody(msrest.serialization.Model): """Represents Codeless API Polling data connector. - :ivar kind: The authentication kind used to poll the data. Possible values include: "Basic", - "OAuth2", "APIKey". + :ivar kind: The authentication kind used to poll the data. Known values are: "Basic", "OAuth2", + "APIKey". :vartype kind: str or ~azure.mgmt.securityinsight.models.ConnectAuthKind :ivar api_key: The API key of the audit server. :vartype api_key: str + :ivar data_collection_endpoint: Used in v2 logs connector. Represents the data collection + ingestion endpoint in log analytics. + :vartype data_collection_endpoint: str + :ivar data_collection_rule_immutable_id: Used in v2 logs connector. The data collection rule + immutable id, the rule defines the transformation and data destination. + :vartype data_collection_rule_immutable_id: str + :ivar output_stream: Used in v2 logs connector. The stream we are sending the data to, this is + the name of the streamDeclarations defined in the DCR. + :vartype output_stream: str :ivar client_secret: The client secret of the OAuth 2.0 application. :vartype client_secret: str :ivar client_id: The client id of the OAuth 2.0 application. @@ -5636,6 +6071,9 @@ class DataConnectorConnectBody(msrest.serialization.Model): _attribute_map = { 'kind': {'key': 'kind', 'type': 'str'}, 'api_key': {'key': 'apiKey', 'type': 'str'}, + 'data_collection_endpoint': {'key': 'dataCollectionEndpoint', 'type': 'str'}, + 'data_collection_rule_immutable_id': {'key': 'dataCollectionRuleImmutableId', 'type': 'str'}, + 'output_stream': {'key': 'outputStream', 'type': 'str'}, 'client_secret': {'key': 'clientSecret', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, 'authorization_code': {'key': 'authorizationCode', 'type': 'str'}, @@ -5647,8 +6085,11 @@ class DataConnectorConnectBody(msrest.serialization.Model): def __init__( self, *, - kind: Optional[Union[str, "ConnectAuthKind"]] = None, + kind: Optional[Union[str, "_models.ConnectAuthKind"]] = None, api_key: Optional[str] = None, + data_collection_endpoint: Optional[str] = None, + data_collection_rule_immutable_id: Optional[str] = None, + output_stream: Optional[str] = None, client_secret: Optional[str] = None, client_id: Optional[str] = None, authorization_code: Optional[str] = None, @@ -5658,11 +6099,20 @@ def __init__( **kwargs ): """ - :keyword kind: The authentication kind used to poll the data. Possible values include: "Basic", + :keyword kind: The authentication kind used to poll the data. Known values are: "Basic", "OAuth2", "APIKey". :paramtype kind: str or ~azure.mgmt.securityinsight.models.ConnectAuthKind :keyword api_key: The API key of the audit server. :paramtype api_key: str + :keyword data_collection_endpoint: Used in v2 logs connector. Represents the data collection + ingestion endpoint in log analytics. + :paramtype data_collection_endpoint: str + :keyword data_collection_rule_immutable_id: Used in v2 logs connector. The data collection rule + immutable id, the rule defines the transformation and data destination. + :paramtype data_collection_rule_immutable_id: str + :keyword output_stream: Used in v2 logs connector. The stream we are sending the data to, this + is the name of the streamDeclarations defined in the DCR. + :paramtype output_stream: str :keyword client_secret: The client secret of the OAuth 2.0 application. :paramtype client_secret: str :keyword client_id: The client id of the OAuth 2.0 application. @@ -5680,6 +6130,9 @@ def __init__( super(DataConnectorConnectBody, self).__init__(**kwargs) self.kind = kind self.api_key = api_key + self.data_collection_endpoint = data_collection_endpoint + self.data_collection_rule_immutable_id = data_collection_rule_immutable_id + self.output_stream = output_stream self.client_secret = client_secret self.client_id = client_id self.authorization_code = authorization_code @@ -5714,7 +6167,7 @@ class DataConnectorList(msrest.serialization.Model): def __init__( self, *, - value: List["DataConnector"], + value: List["_models.DataConnector"], **kwargs ): """ @@ -5729,12 +6182,12 @@ def __init__( class DataConnectorRequirementsState(msrest.serialization.Model): """Data connector requirements status. - :ivar authorization_state: Authorization state for this connector. Possible values include: - "Valid", "Invalid". + :ivar authorization_state: Authorization state for this connector. Known values are: "Valid", + "Invalid". :vartype authorization_state: str or ~azure.mgmt.securityinsight.models.DataConnectorAuthorizationState - :ivar license_state: License state for this connector. Possible values include: "Valid", - "Invalid", "Unknown". + :ivar license_state: License state for this connector. Known values are: "Valid", "Invalid", + "Unknown". :vartype license_state: str or ~azure.mgmt.securityinsight.models.DataConnectorLicenseState """ @@ -5746,17 +6199,17 @@ class DataConnectorRequirementsState(msrest.serialization.Model): def __init__( self, *, - authorization_state: Optional[Union[str, "DataConnectorAuthorizationState"]] = None, - license_state: Optional[Union[str, "DataConnectorLicenseState"]] = None, + authorization_state: Optional[Union[str, "_models.DataConnectorAuthorizationState"]] = None, + license_state: Optional[Union[str, "_models.DataConnectorLicenseState"]] = None, **kwargs ): """ - :keyword authorization_state: Authorization state for this connector. Possible values include: + :keyword authorization_state: Authorization state for this connector. Known values are: "Valid", "Invalid". :paramtype authorization_state: str or ~azure.mgmt.securityinsight.models.DataConnectorAuthorizationState - :keyword license_state: License state for this connector. Possible values include: "Valid", - "Invalid", "Unknown". + :keyword license_state: License state for this connector. Known values are: "Valid", "Invalid", + "Unknown". :paramtype license_state: str or ~azure.mgmt.securityinsight.models.DataConnectorLicenseState """ super(DataConnectorRequirementsState, self).__init__(**kwargs) @@ -5794,10 +6247,10 @@ class Deployment(msrest.serialization.Model): :ivar deployment_id: Deployment identifier. :vartype deployment_id: str - :ivar deployment_state: Current status of the deployment. Possible values include: - "In_Progress", "Completed", "Queued", "Canceling". + :ivar deployment_state: Current status of the deployment. Known values are: "In_Progress", + "Completed", "Queued", "Canceling". :vartype deployment_state: str or ~azure.mgmt.securityinsight.models.DeploymentState - :ivar deployment_result: The outcome of the deployment. Possible values include: "Success", + :ivar deployment_result: The outcome of the deployment. Known values are: "Success", "Canceled", "Failed". :vartype deployment_result: str or ~azure.mgmt.securityinsight.models.DeploymentResult :ivar deployment_time: The time when the deployment finished. @@ -5818,8 +6271,8 @@ def __init__( self, *, deployment_id: Optional[str] = None, - deployment_state: Optional[Union[str, "DeploymentState"]] = None, - deployment_result: Optional[Union[str, "DeploymentResult"]] = None, + deployment_state: Optional[Union[str, "_models.DeploymentState"]] = None, + deployment_result: Optional[Union[str, "_models.DeploymentResult"]] = None, deployment_time: Optional[datetime.datetime] = None, deployment_logs_url: Optional[str] = None, **kwargs @@ -5827,10 +6280,10 @@ def __init__( """ :keyword deployment_id: Deployment identifier. :paramtype deployment_id: str - :keyword deployment_state: Current status of the deployment. Possible values include: - "In_Progress", "Completed", "Queued", "Canceling". + :keyword deployment_state: Current status of the deployment. Known values are: "In_Progress", + "Completed", "Queued", "Canceling". :paramtype deployment_state: str or ~azure.mgmt.securityinsight.models.DeploymentState - :keyword deployment_result: The outcome of the deployment. Possible values include: "Success", + :keyword deployment_result: The outcome of the deployment. Known values are: "Success", "Canceled", "Failed". :paramtype deployment_result: str or ~azure.mgmt.securityinsight.models.DeploymentResult :keyword deployment_time: The time when the deployment finished. @@ -5849,8 +6302,8 @@ def __init__( class DeploymentInfo(msrest.serialization.Model): """Information regarding a deployment. - :ivar deployment_fetch_status: Status while fetching the last deployment. Possible values - include: "Success", "Unauthorized", "NotFound". + :ivar deployment_fetch_status: Status while fetching the last deployment. Known values are: + "Success", "Unauthorized", "NotFound". :vartype deployment_fetch_status: str or ~azure.mgmt.securityinsight.models.DeploymentFetchStatus :ivar deployment: Deployment information. @@ -5868,14 +6321,14 @@ class DeploymentInfo(msrest.serialization.Model): def __init__( self, *, - deployment_fetch_status: Optional[Union[str, "DeploymentFetchStatus"]] = None, - deployment: Optional["Deployment"] = None, + deployment_fetch_status: Optional[Union[str, "_models.DeploymentFetchStatus"]] = None, + deployment: Optional["_models.Deployment"] = None, message: Optional[str] = None, **kwargs ): """ - :keyword deployment_fetch_status: Status while fetching the last deployment. Possible values - include: "Success", "Unauthorized", "NotFound". + :keyword deployment_fetch_status: Status while fetching the last deployment. Known values are: + "Success", "Unauthorized", "NotFound". :paramtype deployment_fetch_status: str or ~azure.mgmt.securityinsight.models.DeploymentFetchStatus :keyword deployment: Deployment information. @@ -5907,9 +6360,9 @@ class DnsEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -6031,12 +6484,11 @@ class Dynamics365CheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -6116,8 +6568,8 @@ class Dynamics365DataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -6153,7 +6605,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["Dynamics365DataConnectorDataTypes"] = None, + data_types: Optional["_models.Dynamics365DataConnectorDataTypes"] = None, **kwargs ): """ @@ -6191,7 +6643,7 @@ class Dynamics365DataConnectorDataTypes(msrest.serialization.Model): def __init__( self, *, - dynamics365_cds_activities: "Dynamics365DataConnectorDataTypesDynamics365CdsActivities", + dynamics365_cds_activities: "_models.Dynamics365DataConnectorDataTypesDynamics365CdsActivities", **kwargs ): """ @@ -6208,8 +6660,8 @@ class Dynamics365DataConnectorDataTypesDynamics365CdsActivities(DataConnectorDat All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -6224,12 +6676,12 @@ class Dynamics365DataConnectorDataTypesDynamics365CdsActivities(DataConnectorDat def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(Dynamics365DataConnectorDataTypesDynamics365CdsActivities, self).__init__(state=state, **kwargs) @@ -6260,7 +6712,7 @@ def __init__( self, *, tenant_id: str, - data_types: "Dynamics365DataConnectorDataTypes", + data_types: "_models.Dynamics365DataConnectorDataTypes", **kwargs ): """ @@ -6307,7 +6759,7 @@ def __init__( created: Optional[datetime.datetime] = None, updated: Optional[datetime.datetime] = None, expires: Optional[datetime.datetime] = None, - parsed_whois: Optional["EnrichmentDomainWhoisDetails"] = None, + parsed_whois: Optional["_models.EnrichmentDomainWhoisDetails"] = None, **kwargs ): """ @@ -6444,10 +6896,10 @@ class EnrichmentDomainWhoisContacts(msrest.serialization.Model): def __init__( self, *, - admin: Optional["EnrichmentDomainWhoisContact"] = None, - billing: Optional["EnrichmentDomainWhoisContact"] = None, - registrant: Optional["EnrichmentDomainWhoisContact"] = None, - tech: Optional["EnrichmentDomainWhoisContact"] = None, + admin: Optional["_models.EnrichmentDomainWhoisContact"] = None, + billing: Optional["_models.EnrichmentDomainWhoisContact"] = None, + registrant: Optional["_models.EnrichmentDomainWhoisContact"] = None, + tech: Optional["_models.EnrichmentDomainWhoisContact"] = None, **kwargs ): """ @@ -6490,8 +6942,8 @@ class EnrichmentDomainWhoisDetails(msrest.serialization.Model): def __init__( self, *, - registrar: Optional["EnrichmentDomainWhoisRegistrarDetails"] = None, - contacts: Optional["EnrichmentDomainWhoisContacts"] = None, + registrar: Optional["_models.EnrichmentDomainWhoisRegistrarDetails"] = None, + contacts: Optional["_models.EnrichmentDomainWhoisContacts"] = None, name_servers: Optional[List[str]] = None, statuses: Optional[List[str]] = None, **kwargs @@ -6737,11 +7189,11 @@ class EntityAnalytics(Settings): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the setting.Constant filled by server. Possible values - include: "Anomalies", "EyesOn", "EntityAnalytics", "Ueba". + :ivar kind: Required. The kind of the setting.Constant filled by server. Known values are: + "Anomalies", "EyesOn", "EntityAnalytics", "Ueba". :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind - :ivar is_enabled: Determines whether the setting is enable or disabled. - :vartype is_enabled: bool + :ivar entity_providers: The relevant entity providers that are synced. + :vartype entity_providers: list[str or ~azure.mgmt.securityinsight.models.EntityProviders] """ _validation = { @@ -6750,7 +7202,6 @@ class EntityAnalytics(Settings): 'type': {'readonly': True}, 'system_data': {'readonly': True}, 'kind': {'required': True}, - 'is_enabled': {'readonly': True}, } _attribute_map = { @@ -6760,22 +7211,25 @@ class EntityAnalytics(Settings): 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'etag': {'key': 'etag', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, - 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, + 'entity_providers': {'key': 'properties.entityProviders', 'type': '[str]'}, } def __init__( self, *, etag: Optional[str] = None, + entity_providers: Optional[List[Union[str, "_models.EntityProviders"]]] = None, **kwargs ): """ :keyword etag: Etag of the azure resource. :paramtype etag: str + :keyword entity_providers: The relevant entity providers that are synced. + :paramtype entity_providers: list[str or ~azure.mgmt.securityinsight.models.EntityProviders] """ super(EntityAnalytics, self).__init__(etag=etag, **kwargs) self.kind = 'EntityAnalytics' # type: str - self.is_enabled = None + self.entity_providers = entity_providers class EntityEdges(msrest.serialization.Model): @@ -6872,8 +7326,8 @@ class EntityExpandResponse(msrest.serialization.Model): def __init__( self, *, - meta_data: Optional["ExpansionResultsMetadata"] = None, - value: Optional["EntityExpandResponseValue"] = None, + meta_data: Optional["_models.ExpansionResultsMetadata"] = None, + value: Optional["_models.EntityExpandResponseValue"] = None, **kwargs ): """ @@ -6904,8 +7358,8 @@ class EntityExpandResponseValue(msrest.serialization.Model): def __init__( self, *, - entities: Optional[List["Entity"]] = None, - edges: Optional[List["EntityEdges"]] = None, + entities: Optional[List["_models.Entity"]] = None, + edges: Optional[List["_models.EntityEdges"]] = None, **kwargs ): """ @@ -7028,8 +7482,8 @@ class EntityGetInsightsResponse(msrest.serialization.Model): def __init__( self, *, - meta_data: Optional["GetInsightsResultsMetadata"] = None, - value: Optional[List["EntityInsightItem"]] = None, + meta_data: Optional["_models.GetInsightsResultsMetadata"] = None, + value: Optional[List["_models.EntityInsightItem"]] = None, **kwargs ): """ @@ -7068,9 +7522,9 @@ def __init__( self, *, query_id: Optional[str] = None, - query_time_interval: Optional["EntityInsightItemQueryTimeInterval"] = None, - table_query_results: Optional["InsightsTableResult"] = None, - chart_query_results: Optional[List["InsightsTableResult"]] = None, + query_time_interval: Optional["_models.EntityInsightItemQueryTimeInterval"] = None, + table_query_results: Optional["_models.InsightsTableResult"] = None, + chart_query_results: Optional[List["_models.InsightsTableResult"]] = None, **kwargs ): """ @@ -7149,7 +7603,7 @@ class EntityList(msrest.serialization.Model): def __init__( self, *, - value: List["Entity"], + value: List["_models.Entity"], **kwargs ): """ @@ -7164,9 +7618,9 @@ def __init__( class EntityMapping(msrest.serialization.Model): """Single entity mapping for the alert rule. - :ivar entity_type: The V3 type of the mapped entity. Possible values include: "Account", - "Host", "IP", "Malware", "File", "Process", "CloudApplication", "DNS", "AzureResource", - "FileHash", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "Mailbox", "MailCluster", + :ivar entity_type: The V3 type of the mapped entity. Known values are: "Account", "Host", "IP", + "Malware", "File", "Process", "CloudApplication", "DNS", "AzureResource", "FileHash", + "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "Mailbox", "MailCluster", "MailMessage", "SubmissionMail". :vartype entity_type: str or ~azure.mgmt.securityinsight.models.EntityMappingType :ivar field_mappings: array of field mappings for the given entity mapping. @@ -7181,14 +7635,14 @@ class EntityMapping(msrest.serialization.Model): def __init__( self, *, - entity_type: Optional[Union[str, "EntityMappingType"]] = None, - field_mappings: Optional[List["FieldMapping"]] = None, + entity_type: Optional[Union[str, "_models.EntityMappingType"]] = None, + field_mappings: Optional[List["_models.FieldMapping"]] = None, **kwargs ): """ - :keyword entity_type: The V3 type of the mapped entity. Possible values include: "Account", - "Host", "IP", "Malware", "File", "Process", "CloudApplication", "DNS", "AzureResource", - "FileHash", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "Mailbox", "MailCluster", + :keyword entity_type: The V3 type of the mapped entity. Known values are: "Account", "Host", + "IP", "Malware", "File", "Process", "CloudApplication", "DNS", "AzureResource", "FileHash", + "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "Mailbox", "MailCluster", "MailMessage", "SubmissionMail". :paramtype entity_type: str or ~azure.mgmt.securityinsight.models.EntityMappingType :keyword field_mappings: array of field mappings for the given entity mapping. @@ -7215,8 +7669,8 @@ class EntityQueryItem(msrest.serialization.Model): :vartype name: str :ivar type: ARM Type. :vartype type: str - :ivar kind: Required. The kind of the entity query.Constant filled by server. Possible values - include: "Expansion", "Insight", "Activity". + :ivar kind: Required. The kind of the entity query.Constant filled by server. Known values are: + "Expansion", "Insight", "Activity". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryKind """ @@ -7262,8 +7716,8 @@ class EntityQueryItemProperties(msrest.serialization.Model): :ivar data_types: Data types for template. :vartype data_types: list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] - :ivar input_entity_type: The type of the entity. Possible values include: "Account", "Host", - "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", + :ivar input_entity_type: The type of the entity. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType @@ -7283,8 +7737,8 @@ class EntityQueryItemProperties(msrest.serialization.Model): def __init__( self, *, - data_types: Optional[List["EntityQueryItemPropertiesDataTypesItem"]] = None, - input_entity_type: Optional[Union[str, "EntityType"]] = None, + data_types: Optional[List["_models.EntityQueryItemPropertiesDataTypesItem"]] = None, + input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, required_input_fields_sets: Optional[List[List[str]]] = None, entities_filter: Optional[Any] = None, **kwargs @@ -7293,7 +7747,7 @@ def __init__( :keyword data_types: Data types for template. :paramtype data_types: list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] - :keyword input_entity_type: The type of the entity. Possible values include: "Account", "Host", + :keyword input_entity_type: The type of the entity. Known values are: "Account", "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". @@ -7361,7 +7815,7 @@ class EntityQueryList(msrest.serialization.Model): def __init__( self, *, - value: List["EntityQuery"], + value: List["_models.EntityQuery"], **kwargs ): """ @@ -7399,7 +7853,7 @@ class EntityQueryTemplateList(msrest.serialization.Model): def __init__( self, *, - value: List["EntityQueryTemplate"], + value: List["_models.EntityQueryTemplate"], **kwargs ): """ @@ -7444,7 +7898,7 @@ def __init__( *, start_time: datetime.datetime, end_time: datetime.datetime, - kinds: Optional[List[Union[str, "EntityTimelineKind"]]] = None, + kinds: Optional[List[Union[str, "_models.EntityTimelineKind"]]] = None, number_of_bucket: Optional[int] = None, **kwargs ): @@ -7484,8 +7938,8 @@ class EntityTimelineResponse(msrest.serialization.Model): def __init__( self, *, - meta_data: Optional["TimelineResultsMetadata"] = None, - value: Optional[List["EntityTimelineItem"]] = None, + meta_data: Optional["_models.TimelineResultsMetadata"] = None, + value: Optional[List["_models.EntityTimelineItem"]] = None, **kwargs ): """ @@ -7502,8 +7956,8 @@ def __init__( class EventGroupingSettings(msrest.serialization.Model): """Event grouping settings property bag. - :ivar aggregation_kind: The event grouping aggregation kinds. Possible values include: - "SingleAlert", "AlertPerResult". + :ivar aggregation_kind: The event grouping aggregation kinds. Known values are: "SingleAlert", + "AlertPerResult". :vartype aggregation_kind: str or ~azure.mgmt.securityinsight.models.EventGroupingAggregationKind """ @@ -7515,11 +7969,11 @@ class EventGroupingSettings(msrest.serialization.Model): def __init__( self, *, - aggregation_kind: Optional[Union[str, "EventGroupingAggregationKind"]] = None, + aggregation_kind: Optional[Union[str, "_models.EventGroupingAggregationKind"]] = None, **kwargs ): """ - :keyword aggregation_kind: The event grouping aggregation kinds. Possible values include: + :keyword aggregation_kind: The event grouping aggregation kinds. Known values are: "SingleAlert", "AlertPerResult". :paramtype aggregation_kind: str or ~azure.mgmt.securityinsight.models.EventGroupingAggregationKind @@ -7548,16 +8002,16 @@ class ExpansionEntityQuery(EntityQuery): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. the entity query kind.Constant filled by server. Possible values include: + :ivar kind: Required. the entity query kind.Constant filled by server. Known values are: "Expansion", "Insight", "Activity". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryKind :ivar data_sources: List of the data sources that are required to run the query. :vartype data_sources: list[str] :ivar display_name: The query display name. :vartype display_name: str - :ivar input_entity_type: The type of the query's source entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", + :ivar input_entity_type: The type of the query's source entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType :ivar input_fields: List of the fields of the source entity that are required to run the query. @@ -7597,9 +8051,9 @@ def __init__( etag: Optional[str] = None, data_sources: Optional[List[str]] = None, display_name: Optional[str] = None, - input_entity_type: Optional[Union[str, "EntityType"]] = None, + input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, input_fields: Optional[List[str]] = None, - output_entity_types: Optional[List[Union[str, "EntityType"]]] = None, + output_entity_types: Optional[List[Union[str, "_models.EntityType"]]] = None, query_template: Optional[str] = None, **kwargs ): @@ -7610,9 +8064,9 @@ def __init__( :paramtype data_sources: list[str] :keyword display_name: The query display name. :paramtype display_name: str - :keyword input_entity_type: The type of the query's source entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", - "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", + :keyword input_entity_type: The type of the query's source entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", + "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :paramtype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType :keyword input_fields: List of the fields of the source entity that are required to run the @@ -7646,11 +8100,10 @@ class ExpansionResultAggregation(msrest.serialization.Model): :vartype count: int :ivar display_name: The display name of the aggregation by type. :vartype display_name: str - :ivar entity_kind: Required. The kind of the aggregated entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", - "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", - "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", - "SubmissionMail". + :ivar entity_kind: Required. The kind of the aggregated entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", + "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKind """ @@ -7670,7 +8123,7 @@ def __init__( self, *, count: int, - entity_kind: Union[str, "EntityKind"], + entity_kind: Union[str, "_models.EntityKind"], aggregation_type: Optional[str] = None, display_name: Optional[str] = None, **kwargs @@ -7683,11 +8136,10 @@ def __init__( :paramtype count: int :keyword display_name: The display name of the aggregation by type. :paramtype display_name: str - :keyword entity_kind: Required. The kind of the aggregated entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", - "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", - "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", - "SubmissionMail". + :keyword entity_kind: Required. The kind of the aggregated entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", + "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :paramtype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKind """ super(ExpansionResultAggregation, self).__init__(**kwargs) @@ -7711,7 +8163,7 @@ class ExpansionResultsMetadata(msrest.serialization.Model): def __init__( self, *, - aggregations: Optional[List["ExpansionResultAggregation"]] = None, + aggregations: Optional[List["_models.ExpansionResultAggregation"]] = None, **kwargs ): """ @@ -7742,8 +8194,8 @@ class EyesOn(Settings): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the setting.Constant filled by server. Possible values - include: "Anomalies", "EyesOn", "EntityAnalytics", "Ueba". + :ivar kind: Required. The kind of the setting.Constant filled by server. Known values are: + "Anomalies", "EyesOn", "EntityAnalytics", "Ueba". :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind :ivar is_enabled: Determines whether the setting is enable or disabled. :vartype is_enabled: bool @@ -7833,9 +8285,9 @@ class FileEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -7969,9 +8421,9 @@ class FileHashEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -7981,8 +8433,8 @@ class FileHashEntity(Entity): :ivar friendly_name: The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. :vartype friendly_name: str - :ivar algorithm: The hash algorithm type. Possible values include: "Unknown", "MD5", "SHA1", - "SHA256", "SHA256AC". + :ivar algorithm: The hash algorithm type. Known values are: "Unknown", "MD5", "SHA1", "SHA256", + "SHA256AC". :vartype algorithm: str or ~azure.mgmt.securityinsight.models.FileHashAlgorithm :ivar hash_value: The file hash value. :vartype hash_value: str @@ -8037,8 +8489,8 @@ class FileHashEntityProperties(EntityCommonProperties): :ivar friendly_name: The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. :vartype friendly_name: str - :ivar algorithm: The hash algorithm type. Possible values include: "Unknown", "MD5", "SHA1", - "SHA256", "SHA256AC". + :ivar algorithm: The hash algorithm type. Known values are: "Unknown", "MD5", "SHA1", "SHA256", + "SHA256AC". :vartype algorithm: str or ~azure.mgmt.securityinsight.models.FileHashAlgorithm :ivar hash_value: The file hash value. :vartype hash_value: str @@ -8089,8 +8541,8 @@ class FusionAlertRule(AlertRule): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. @@ -8108,8 +8560,8 @@ class FusionAlertRule(AlertRule): list[~azure.mgmt.securityinsight.models.FusionScenarioExclusionPattern] :ivar last_modified_utc: The last time that this alert has been modified. :vartype last_modified_utc: ~datetime.datetime - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar tactics: The tactics of the alert rule. :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] @@ -8156,8 +8608,8 @@ def __init__( etag: Optional[str] = None, alert_rule_template_name: Optional[str] = None, enabled: Optional[bool] = None, - source_settings: Optional[List["FusionSourceSettings"]] = None, - scenario_exclusion_patterns: Optional[List["FusionScenarioExclusionPattern"]] = None, + source_settings: Optional[List["_models.FusionSourceSettings"]] = None, + scenario_exclusion_patterns: Optional[List["_models.FusionScenarioExclusionPattern"]] = None, **kwargs ): """ @@ -8206,8 +8658,8 @@ class FusionAlertRuleTemplate(AlertRuleTemplate): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar alert_rules_created_by_template_count: the number of alert rules that were created by @@ -8224,11 +8676,11 @@ class FusionAlertRuleTemplate(AlertRuleTemplate): :ivar required_data_connectors: The required data connectors for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar tactics: The tactics of the alert rule template. :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] @@ -8273,12 +8725,12 @@ def __init__( alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, - severity: Optional[Union[str, "AlertSeverity"]] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, - source_settings: Optional[List["FusionTemplateSourceSetting"]] = None, + source_settings: Optional[List["_models.FusionTemplateSourceSetting"]] = None, **kwargs ): """ @@ -8292,10 +8744,10 @@ def __init__( :keyword required_data_connectors: The required data connectors for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus - :keyword severity: The severity for alerts created by this alert rule. Possible values include: + :keyword severity: The severity for alerts created by this alert rule. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :keyword tactics: The tactics of the alert rule template. @@ -8393,7 +8845,7 @@ def __init__( *, enabled: bool, source_name: str, - source_sub_types: Optional[List["FusionSourceSubTypeSetting"]] = None, + source_sub_types: Optional[List["_models.FusionSourceSubTypeSetting"]] = None, **kwargs ): """ @@ -8454,7 +8906,7 @@ def __init__( *, enabled: bool, source_sub_type_name: str, - severity_filters: "FusionSubTypeSeverityFilter", + severity_filters: "_models.FusionSubTypeSeverityFilter", **kwargs ): """ @@ -8500,7 +8952,7 @@ class FusionSubTypeSeverityFilter(msrest.serialization.Model): def __init__( self, *, - filters: Optional[List["FusionSubTypeSeverityFiltersItem"]] = None, + filters: Optional[List["_models.FusionSubTypeSeverityFiltersItem"]] = None, **kwargs ): """ @@ -8519,7 +8971,7 @@ class FusionSubTypeSeverityFiltersItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar severity: Required. The Severity for a given source subtype consumed in Fusion detection. - Possible values include: "High", "Medium", "Low", "Informational". + Known values are: "High", "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar enabled: Required. Determines whether this severity is enabled or disabled for this source subtype consumed in Fusion detection. @@ -8539,13 +8991,13 @@ class FusionSubTypeSeverityFiltersItem(msrest.serialization.Model): def __init__( self, *, - severity: Union[str, "AlertSeverity"], + severity: Union[str, "_models.AlertSeverity"], enabled: bool, **kwargs ): """ :keyword severity: Required. The Severity for a given source subtype consumed in Fusion - detection. Possible values include: "High", "Medium", "Low", "Informational". + detection. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :keyword enabled: Required. Determines whether this severity is enabled or disabled for this source subtype consumed in Fusion detection. @@ -8581,7 +9033,7 @@ def __init__( self, *, source_name: str, - source_sub_types: Optional[List["FusionTemplateSourceSubType"]] = None, + source_sub_types: Optional[List["_models.FusionTemplateSourceSubType"]] = None, **kwargs ): """ @@ -8632,7 +9084,7 @@ def __init__( self, *, source_sub_type_name: str, - severity_filter: "FusionTemplateSubTypeSeverityFilter", + severity_filter: "_models.FusionTemplateSubTypeSeverityFilter", **kwargs ): """ @@ -8676,7 +9128,7 @@ def __init__( self, *, is_supported: bool, - severity_filters: Optional[List[Union[str, "AlertSeverity"]]] = None, + severity_filters: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, **kwargs ): """ @@ -8754,15 +9206,13 @@ def __init__( self.state = None -class GetInsightsError(msrest.serialization.Model): +class GetInsightsErrorKind(msrest.serialization.Model): """GetInsights Query Errors. - 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 kind: the query kind. Has constant value: "Insight". - :vartype kind: str + :ivar kind: Required. the query kind. Known values are: "Insight". + :vartype kind: str or ~azure.mgmt.securityinsight.models.GetInsightsError :ivar query_id: the query id. :vartype query_id: str :ivar error_message: Required. the error message. @@ -8770,7 +9220,7 @@ class GetInsightsError(msrest.serialization.Model): """ _validation = { - 'kind': {'required': True, 'constant': True}, + 'kind': {'required': True}, 'error_message': {'required': True}, } @@ -8780,22 +9230,24 @@ class GetInsightsError(msrest.serialization.Model): 'error_message': {'key': 'errorMessage', 'type': 'str'}, } - kind = "Insight" - def __init__( self, *, + kind: Union[str, "_models.GetInsightsError"], error_message: str, query_id: Optional[str] = None, **kwargs ): """ + :keyword kind: Required. the query kind. Known values are: "Insight". + :paramtype kind: str or ~azure.mgmt.securityinsight.models.GetInsightsError :keyword query_id: the query id. :paramtype query_id: str :keyword error_message: Required. the error message. :paramtype error_message: str """ - super(GetInsightsError, self).__init__(**kwargs) + super(GetInsightsErrorKind, self).__init__(**kwargs) + self.kind = kind self.query_id = query_id self.error_message = error_message @@ -8808,7 +9260,7 @@ class GetInsightsResultsMetadata(msrest.serialization.Model): :ivar total_count: Required. the total items found for the insights request. :vartype total_count: int :ivar errors: information about the failed queries. - :vartype errors: list[~azure.mgmt.securityinsight.models.GetInsightsError] + :vartype errors: list[~azure.mgmt.securityinsight.models.GetInsightsErrorKind] """ _validation = { @@ -8817,21 +9269,21 @@ class GetInsightsResultsMetadata(msrest.serialization.Model): _attribute_map = { 'total_count': {'key': 'totalCount', 'type': 'int'}, - 'errors': {'key': 'errors', 'type': '[GetInsightsError]'}, + 'errors': {'key': 'errors', 'type': '[GetInsightsErrorKind]'}, } def __init__( self, *, total_count: int, - errors: Optional[List["GetInsightsError"]] = None, + errors: Optional[List["_models.GetInsightsErrorKind"]] = None, **kwargs ): """ :keyword total_count: Required. the total items found for the insights request. :paramtype total_count: int :keyword errors: information about the failed queries. - :paramtype errors: list[~azure.mgmt.securityinsight.models.GetInsightsError] + :paramtype errors: list[~azure.mgmt.securityinsight.models.GetInsightsErrorKind] """ super(GetInsightsResultsMetadata, self).__init__(**kwargs) self.total_count = total_count @@ -8852,7 +9304,7 @@ class GetQueriesResponse(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["EntityQueryItem"]] = None, + value: Optional[List["_models.EntityQueryItem"]] = None, **kwargs ): """ @@ -8902,7 +9354,7 @@ class GroupingConfiguration(msrest.serialization.Model): :vartype lookback_duration: ~datetime.timedelta :ivar matching_method: Required. Grouping matching method. When method is Selected at least one of groupByEntities, groupByAlertDetails, groupByCustomDetails must be provided and not empty. - Possible values include: "AllEntities", "AnyAlert", "Selected". + Known values are: "AllEntities", "AnyAlert", "Selected". :vartype matching_method: str or ~azure.mgmt.securityinsight.models.MatchingMethod :ivar group_by_entities: A list of entity types to group by (when matchingMethod is Selected). Only entities defined in the current alert rule may be used. @@ -8938,9 +9390,9 @@ def __init__( enabled: bool, reopen_closed_incident: bool, lookback_duration: datetime.timedelta, - matching_method: Union[str, "MatchingMethod"], - group_by_entities: Optional[List[Union[str, "EntityMappingType"]]] = None, - group_by_alert_details: Optional[List[Union[str, "AlertDetail"]]] = None, + matching_method: Union[str, "_models.MatchingMethod"], + group_by_entities: Optional[List[Union[str, "_models.EntityMappingType"]]] = None, + group_by_alert_details: Optional[List[Union[str, "_models.AlertDetail"]]] = None, group_by_custom_details: Optional[List[str]] = None, **kwargs ): @@ -8954,7 +9406,7 @@ def __init__( :paramtype lookback_duration: ~datetime.timedelta :keyword matching_method: Required. Grouping matching method. When method is Selected at least one of groupByEntities, groupByAlertDetails, groupByCustomDetails must be provided and not - empty. Possible values include: "AllEntities", "AnyAlert", "Selected". + empty. Known values are: "AllEntities", "AnyAlert", "Selected". :paramtype matching_method: str or ~azure.mgmt.securityinsight.models.MatchingMethod :keyword group_by_entities: A list of entity types to group by (when matchingMethod is Selected). Only entities defined in the current alert rule may be used. @@ -8994,9 +9446,9 @@ class HostEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -9021,8 +9473,8 @@ class HostEntity(Entity): :vartype nt_domain: str :ivar oms_agent_id: The OMS agent id, if the host has OMS agent installed. :vartype oms_agent_id: str - :ivar os_family: The operating system type. Possible values include: "Linux", "Windows", - "Android", "IOS", "Unknown". + :ivar os_family: The operating system type. Known values are: "Linux", "Windows", "Android", + "IOS", "Unknown". :vartype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily :ivar os_version: A free text representation of the operating system. This field is meant to hold specific versions the are more fine grained than OSFamily or future values not supported @@ -9070,12 +9522,12 @@ class HostEntity(Entity): def __init__( self, *, - os_family: Optional[Union[str, "OSFamily"]] = None, + os_family: Optional[Union[str, "_models.OSFamily"]] = None, **kwargs ): """ - :keyword os_family: The operating system type. Possible values include: "Linux", "Windows", - "Android", "IOS", "Unknown". + :keyword os_family: The operating system type. Known values are: "Linux", "Windows", "Android", + "IOS", "Unknown". :paramtype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily """ super(HostEntity, self).__init__(**kwargs) @@ -9119,8 +9571,8 @@ class HostEntityProperties(EntityCommonProperties): :vartype nt_domain: str :ivar oms_agent_id: The OMS agent id, if the host has OMS agent installed. :vartype oms_agent_id: str - :ivar os_family: The operating system type. Possible values include: "Linux", "Windows", - "Android", "IOS", "Unknown". + :ivar os_family: The operating system type. Known values are: "Linux", "Windows", "Android", + "IOS", "Unknown". :vartype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily :ivar os_version: A free text representation of the operating system. This field is meant to hold specific versions the are more fine grained than OSFamily or future values not supported @@ -9158,12 +9610,12 @@ class HostEntityProperties(EntityCommonProperties): def __init__( self, *, - os_family: Optional[Union[str, "OSFamily"]] = None, + os_family: Optional[Union[str, "_models.OSFamily"]] = None, **kwargs ): """ - :keyword os_family: The operating system type. Possible values include: "Linux", "Windows", - "Android", "IOS", "Unknown". + :keyword os_family: The operating system type. Known values are: "Linux", "Windows", "Android", + "IOS", "Unknown". :paramtype os_family: str or ~azure.mgmt.securityinsight.models.OSFamily """ super(HostEntityProperties, self).__init__(**kwargs) @@ -9196,9 +9648,9 @@ class HuntingBookmark(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -9267,7 +9719,7 @@ def __init__( self, *, created: Optional[datetime.datetime] = None, - created_by: Optional["UserInfo"] = None, + created_by: Optional["_models.UserInfo"] = None, display_name: Optional[str] = None, event_time: Optional[datetime.datetime] = None, labels: Optional[List[str]] = None, @@ -9275,8 +9727,8 @@ def __init__( query: Optional[str] = None, query_result: Optional[str] = None, updated: Optional[datetime.datetime] = None, - updated_by: Optional["UserInfo"] = None, - incident_info: Optional["IncidentInfo"] = None, + updated_by: Optional["_models.UserInfo"] = None, + incident_info: Optional["_models.IncidentInfo"] = None, **kwargs ): """ @@ -9386,14 +9838,14 @@ def __init__( display_name: str, query: str, created: Optional[datetime.datetime] = None, - created_by: Optional["UserInfo"] = None, + created_by: Optional["_models.UserInfo"] = None, event_time: Optional[datetime.datetime] = None, labels: Optional[List[str]] = None, notes: Optional[str] = None, query_result: Optional[str] = None, updated: Optional[datetime.datetime] = None, - updated_by: Optional["UserInfo"] = None, - incident_info: Optional["IncidentInfo"] = None, + updated_by: Optional["_models.UserInfo"] = None, + incident_info: Optional["_models.IncidentInfo"] = None, **kwargs ): """ @@ -9454,13 +9906,13 @@ class Incident(ResourceWithEtag): :vartype etag: str :ivar additional_data: Additional data on the incident. :vartype additional_data: ~azure.mgmt.securityinsight.models.IncidentAdditionalData - :ivar classification: The reason the incident was closed. Possible values include: - "Undetermined", "TruePositive", "BenignPositive", "FalsePositive". + :ivar classification: The reason the incident was closed. Known values are: "Undetermined", + "TruePositive", "BenignPositive", "FalsePositive". :vartype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification :ivar classification_comment: Describes the reason the incident was closed. :vartype classification_comment: str - :ivar classification_reason: The classification reason the incident was closed with. Possible - values include: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", + :ivar classification_reason: The classification reason the incident was closed with. Known + values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", "InaccurateData". :vartype classification_reason: str or ~azure.mgmt.securityinsight.models.IncidentClassificationReason @@ -9489,10 +9941,10 @@ class Incident(ResourceWithEtag): :ivar related_analytic_rule_ids: List of resource ids of Analytic rules related to the incident. :vartype related_analytic_rule_ids: list[str] - :ivar severity: The severity of the incident. Possible values include: "High", "Medium", "Low", + :ivar severity: The severity of the incident. Known values are: "High", "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity - :ivar status: The status of the incident. Possible values include: "New", "Active", "Closed". + :ivar status: The status of the incident. Known values are: "New", "Active", "Closed". :vartype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus :ivar team_information: Describes a team for the incident. :vartype team_information: ~azure.mgmt.securityinsight.models.TeamInformation @@ -9545,32 +9997,32 @@ def __init__( self, *, etag: Optional[str] = None, - classification: Optional[Union[str, "IncidentClassification"]] = None, + classification: Optional[Union[str, "_models.IncidentClassification"]] = None, classification_comment: Optional[str] = None, - classification_reason: Optional[Union[str, "IncidentClassificationReason"]] = None, + classification_reason: Optional[Union[str, "_models.IncidentClassificationReason"]] = None, description: Optional[str] = None, first_activity_time_utc: Optional[datetime.datetime] = None, - labels: Optional[List["IncidentLabel"]] = None, + labels: Optional[List["_models.IncidentLabel"]] = None, provider_name: Optional[str] = None, provider_incident_id: Optional[str] = None, last_activity_time_utc: Optional[datetime.datetime] = None, - owner: Optional["IncidentOwnerInfo"] = None, - severity: Optional[Union[str, "IncidentSeverity"]] = None, - status: Optional[Union[str, "IncidentStatus"]] = None, - team_information: Optional["TeamInformation"] = None, + owner: Optional["_models.IncidentOwnerInfo"] = None, + severity: Optional[Union[str, "_models.IncidentSeverity"]] = None, + status: Optional[Union[str, "_models.IncidentStatus"]] = None, + team_information: Optional["_models.TeamInformation"] = None, title: Optional[str] = None, **kwargs ): """ :keyword etag: Etag of the azure resource. :paramtype etag: str - :keyword classification: The reason the incident was closed. Possible values include: - "Undetermined", "TruePositive", "BenignPositive", "FalsePositive". + :keyword classification: The reason the incident was closed. Known values are: "Undetermined", + "TruePositive", "BenignPositive", "FalsePositive". :paramtype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification :keyword classification_comment: Describes the reason the incident was closed. :paramtype classification_comment: str - :keyword classification_reason: The classification reason the incident was closed with. - Possible values include: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", + :keyword classification_reason: The classification reason the incident was closed with. Known + values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", "InaccurateData". :paramtype classification_reason: str or ~azure.mgmt.securityinsight.models.IncidentClassificationReason @@ -9588,11 +10040,10 @@ def __init__( :paramtype last_activity_time_utc: ~datetime.datetime :keyword owner: Describes a user that the incident is assigned to. :paramtype owner: ~azure.mgmt.securityinsight.models.IncidentOwnerInfo - :keyword severity: The severity of the incident. Possible values include: "High", "Medium", - "Low", "Informational". + :keyword severity: The severity of the incident. Known values are: "High", "Medium", "Low", + "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity - :keyword status: The status of the incident. Possible values include: "New", "Active", - "Closed". + :keyword status: The status of the incident. Known values are: "New", "Active", "Closed". :paramtype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus :keyword team_information: Describes a team for the incident. :paramtype team_information: ~azure.mgmt.securityinsight.models.TeamInformation @@ -9700,7 +10151,7 @@ class IncidentAlertList(msrest.serialization.Model): def __init__( self, *, - value: List["SecurityAlert"], + value: List["_models.SecurityAlert"], **kwargs ): """ @@ -9731,7 +10182,7 @@ class IncidentBookmarkList(msrest.serialization.Model): def __init__( self, *, - value: List["HuntingBookmark"], + value: List["_models.HuntingBookmark"], **kwargs ): """ @@ -9838,7 +10289,7 @@ class IncidentCommentList(msrest.serialization.Model): def __init__( self, *, - value: List["IncidentComment"], + value: List["_models.IncidentComment"], **kwargs ): """ @@ -9875,7 +10326,7 @@ def __init__( self, *, create_incident: bool, - grouping_configuration: Optional["GroupingConfiguration"] = None, + grouping_configuration: Optional["_models.GroupingConfiguration"] = None, **kwargs ): """ @@ -9908,8 +10359,8 @@ class IncidentEntitiesResponse(msrest.serialization.Model): def __init__( self, *, - entities: Optional[List["Entity"]] = None, - meta_data: Optional[List["IncidentEntitiesResultsMetadata"]] = None, + entities: Optional[List["_models.Entity"]] = None, + meta_data: Optional[List["_models.IncidentEntitiesResultsMetadata"]] = None, **kwargs ): """ @@ -9931,11 +10382,10 @@ class IncidentEntitiesResultsMetadata(msrest.serialization.Model): :ivar count: Required. Total number of aggregations of the given kind in the incident related entities result. :vartype count: int - :ivar entity_kind: Required. The kind of the aggregated entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", - "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", - "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", - "SubmissionMail". + :ivar entity_kind: Required. The kind of the aggregated entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", + "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKind """ @@ -9953,18 +10403,17 @@ def __init__( self, *, count: int, - entity_kind: Union[str, "EntityKind"], + entity_kind: Union[str, "_models.EntityKind"], **kwargs ): """ :keyword count: Required. Total number of aggregations of the given kind in the incident related entities result. :paramtype count: int - :keyword entity_kind: Required. The kind of the aggregated entity. Possible values include: - "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", - "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", - "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", - "SubmissionMail". + :keyword entity_kind: Required. The kind of the aggregated entity. Known values are: "Account", + "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", "Ip", + "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", + "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :paramtype entity_kind: str or ~azure.mgmt.securityinsight.models.EntityKind """ super(IncidentEntitiesResultsMetadata, self).__init__(**kwargs) @@ -9977,7 +10426,7 @@ class IncidentInfo(msrest.serialization.Model): :ivar incident_id: Incident Id. :vartype incident_id: str - :ivar severity: The severity of the incident. Possible values include: "High", "Medium", "Low", + :ivar severity: The severity of the incident. Known values are: "High", "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity :ivar title: The title of the incident. @@ -9997,7 +10446,7 @@ def __init__( self, *, incident_id: Optional[str] = None, - severity: Optional[Union[str, "IncidentSeverity"]] = None, + severity: Optional[Union[str, "_models.IncidentSeverity"]] = None, title: Optional[str] = None, relation_name: Optional[str] = None, **kwargs @@ -10005,8 +10454,8 @@ def __init__( """ :keyword incident_id: Incident Id. :paramtype incident_id: str - :keyword severity: The severity of the incident. Possible values include: "High", "Medium", - "Low", "Informational". + :keyword severity: The severity of the incident. Known values are: "High", "Medium", "Low", + "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity :keyword title: The title of the incident. :paramtype title: str @@ -10029,7 +10478,7 @@ class IncidentLabel(msrest.serialization.Model): :ivar label_name: Required. The name of the label. :vartype label_name: str - :ivar label_type: The type of the label. Possible values include: "User", "AutoAssigned". + :ivar label_type: The type of the label. Known values are: "User", "AutoAssigned". :vartype label_type: str or ~azure.mgmt.securityinsight.models.IncidentLabelType """ @@ -10084,7 +10533,7 @@ class IncidentList(msrest.serialization.Model): def __init__( self, *, - value: List["Incident"], + value: List["_models.Incident"], **kwargs ): """ @@ -10099,8 +10548,6 @@ def __init__( class IncidentOwnerInfo(msrest.serialization.Model): """Information on the user an incident is assigned to. - Variables are only populated by the server, and will be ignored when sending a request. - :ivar email: The email of the user the incident is assigned to. :vartype email: str :ivar assigned_to: The name of the user the incident is assigned to. @@ -10109,15 +10556,11 @@ class IncidentOwnerInfo(msrest.serialization.Model): :vartype object_id: str :ivar user_principal_name: The user principal name of the user the incident is assigned to. :vartype user_principal_name: str - :ivar owner_type: The type of the owner the incident is assigned to. Possible values include: + :ivar owner_type: The type of the owner the incident is assigned to. Known values are: "Unknown", "User", "Group". :vartype owner_type: str or ~azure.mgmt.securityinsight.models.OwnerType """ - _validation = { - 'owner_type': {'readonly': True}, - } - _attribute_map = { 'email': {'key': 'email', 'type': 'str'}, 'assigned_to': {'key': 'assignedTo', 'type': 'str'}, @@ -10133,6 +10576,7 @@ def __init__( assigned_to: Optional[str] = None, object_id: Optional[str] = None, user_principal_name: Optional[str] = None, + owner_type: Optional[Union[str, "_models.OwnerType"]] = None, **kwargs ): """ @@ -10144,28 +10588,31 @@ def __init__( :paramtype object_id: str :keyword user_principal_name: The user principal name of the user the incident is assigned to. :paramtype user_principal_name: str + :keyword owner_type: The type of the owner the incident is assigned to. Known values are: + "Unknown", "User", "Group". + :paramtype owner_type: str or ~azure.mgmt.securityinsight.models.OwnerType """ super(IncidentOwnerInfo, self).__init__(**kwargs) self.email = email self.assigned_to = assigned_to self.object_id = object_id self.user_principal_name = user_principal_name - self.owner_type = None + self.owner_type = owner_type class IncidentPropertiesAction(msrest.serialization.Model): """IncidentPropertiesAction. - :ivar severity: The severity of the incident. Possible values include: "High", "Medium", "Low", + :ivar severity: The severity of the incident. Known values are: "High", "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity - :ivar status: The status of the incident. Possible values include: "New", "Active", "Closed". + :ivar status: The status of the incident. Known values are: "New", "Active", "Closed". :vartype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus - :ivar classification: The reason the incident was closed. Possible values include: - "Undetermined", "TruePositive", "BenignPositive", "FalsePositive". + :ivar classification: The reason the incident was closed. Known values are: "Undetermined", + "TruePositive", "BenignPositive", "FalsePositive". :vartype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification - :ivar classification_reason: The classification reason the incident was closed with. Possible - values include: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", + :ivar classification_reason: The classification reason the incident was closed with. Known + values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", "InaccurateData". :vartype classification_reason: str or ~azure.mgmt.securityinsight.models.IncidentClassificationReason @@ -10190,27 +10637,26 @@ class IncidentPropertiesAction(msrest.serialization.Model): def __init__( self, *, - severity: Optional[Union[str, "IncidentSeverity"]] = None, - status: Optional[Union[str, "IncidentStatus"]] = None, - classification: Optional[Union[str, "IncidentClassification"]] = None, - classification_reason: Optional[Union[str, "IncidentClassificationReason"]] = None, + severity: Optional[Union[str, "_models.IncidentSeverity"]] = None, + status: Optional[Union[str, "_models.IncidentStatus"]] = None, + classification: Optional[Union[str, "_models.IncidentClassification"]] = None, + classification_reason: Optional[Union[str, "_models.IncidentClassificationReason"]] = None, classification_comment: Optional[str] = None, - owner: Optional["IncidentOwnerInfo"] = None, - labels: Optional[List["IncidentLabel"]] = None, + owner: Optional["_models.IncidentOwnerInfo"] = None, + labels: Optional[List["_models.IncidentLabel"]] = None, **kwargs ): """ - :keyword severity: The severity of the incident. Possible values include: "High", "Medium", - "Low", "Informational". + :keyword severity: The severity of the incident. Known values are: "High", "Medium", "Low", + "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.IncidentSeverity - :keyword status: The status of the incident. Possible values include: "New", "Active", - "Closed". + :keyword status: The status of the incident. Known values are: "New", "Active", "Closed". :paramtype status: str or ~azure.mgmt.securityinsight.models.IncidentStatus - :keyword classification: The reason the incident was closed. Possible values include: - "Undetermined", "TruePositive", "BenignPositive", "FalsePositive". + :keyword classification: The reason the incident was closed. Known values are: "Undetermined", + "TruePositive", "BenignPositive", "FalsePositive". :paramtype classification: str or ~azure.mgmt.securityinsight.models.IncidentClassification - :keyword classification_reason: The classification reason the incident was closed with. - Possible values include: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", + :keyword classification_reason: The classification reason the incident was closed with. Known + values are: "SuspiciousActivity", "SuspiciousButExpected", "IncorrectAlertLogic", "InaccurateData". :paramtype classification_reason: str or ~azure.mgmt.securityinsight.models.IncidentClassificationReason @@ -10244,8 +10690,8 @@ class InsightQueryItem(EntityQueryItem): :vartype name: str :ivar type: ARM Type. :vartype type: str - :ivar kind: Required. The kind of the entity query.Constant filled by server. Possible values - include: "Expansion", "Insight", "Activity". + :ivar kind: Required. The kind of the entity query.Constant filled by server. Known values are: + "Expansion", "Insight", "Activity". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityQueryKind :ivar properties: Properties bag for InsightQueryItem. :vartype properties: ~azure.mgmt.securityinsight.models.InsightQueryItemProperties @@ -10269,7 +10715,7 @@ def __init__( *, name: Optional[str] = None, type: Optional[str] = None, - properties: Optional["InsightQueryItemProperties"] = None, + properties: Optional["_models.InsightQueryItemProperties"] = None, **kwargs ): """ @@ -10291,8 +10737,8 @@ class InsightQueryItemProperties(EntityQueryItemProperties): :ivar data_types: Data types for template. :vartype data_types: list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] - :ivar input_entity_type: The type of the entity. Possible values include: "Account", "Host", - "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", + :ivar input_entity_type: The type of the entity. Known values are: "Account", "Host", "File", + "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype input_entity_type: str or ~azure.mgmt.securityinsight.models.EntityType @@ -10339,25 +10785,25 @@ class InsightQueryItemProperties(EntityQueryItemProperties): def __init__( self, *, - data_types: Optional[List["EntityQueryItemPropertiesDataTypesItem"]] = None, - input_entity_type: Optional[Union[str, "EntityType"]] = None, + data_types: Optional[List["_models.EntityQueryItemPropertiesDataTypesItem"]] = None, + input_entity_type: Optional[Union[str, "_models.EntityType"]] = None, required_input_fields_sets: Optional[List[List[str]]] = None, entities_filter: Optional[Any] = None, display_name: Optional[str] = None, description: Optional[str] = None, base_query: Optional[str] = None, - table_query: Optional["InsightQueryItemPropertiesTableQuery"] = None, + table_query: Optional["_models.InsightQueryItemPropertiesTableQuery"] = None, chart_query: Optional[Any] = None, - additional_query: Optional["InsightQueryItemPropertiesAdditionalQuery"] = None, - default_time_range: Optional["InsightQueryItemPropertiesDefaultTimeRange"] = None, - reference_time_range: Optional["InsightQueryItemPropertiesReferenceTimeRange"] = None, + additional_query: Optional["_models.InsightQueryItemPropertiesAdditionalQuery"] = None, + default_time_range: Optional["_models.InsightQueryItemPropertiesDefaultTimeRange"] = None, + reference_time_range: Optional["_models.InsightQueryItemPropertiesReferenceTimeRange"] = None, **kwargs ): """ :keyword data_types: Data types for template. :paramtype data_types: list[~azure.mgmt.securityinsight.models.EntityQueryItemPropertiesDataTypesItem] - :keyword input_entity_type: The type of the entity. Possible values include: "Account", "Host", + :keyword input_entity_type: The type of the entity. Known values are: "Account", "Host", "File", "AzureResource", "CloudApplication", "DNS", "FileHash", "IP", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "URL", "IoTDevice", "SecurityAlert", "HuntingBookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". @@ -10505,8 +10951,8 @@ class InsightQueryItemPropertiesTableQuery(msrest.serialization.Model): def __init__( self, *, - columns_definitions: Optional[List["InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem"]] = None, - queries_definitions: Optional[List["InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem"]] = None, + columns_definitions: Optional[List["_models.InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem"]] = None, + queries_definitions: Optional[List["_models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem"]] = None, **kwargs ): """ @@ -10527,7 +10973,7 @@ class InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem(msrest.serializ :ivar header: Insight column header. :vartype header: str - :ivar output_type: Insights Column type. Possible values include: "Number", "String", "Date", + :ivar output_type: Insights Column type. Known values are: "Number", "String", "Date", "Entity". :vartype output_type: str or ~azure.mgmt.securityinsight.models.OutputType :ivar support_deep_link: Is query supports deep-link. @@ -10544,15 +10990,15 @@ def __init__( self, *, header: Optional[str] = None, - output_type: Optional[Union[str, "OutputType"]] = None, + output_type: Optional[Union[str, "_models.OutputType"]] = None, support_deep_link: Optional[bool] = None, **kwargs ): """ :keyword header: Insight column header. :paramtype header: str - :keyword output_type: Insights Column type. Possible values include: "Number", "String", - "Date", "Entity". + :keyword output_type: Insights Column type. Known values are: "Number", "String", "Date", + "Entity". :paramtype output_type: str or ~azure.mgmt.securityinsight.models.OutputType :keyword support_deep_link: Is query supports deep-link. :paramtype support_deep_link: bool @@ -10590,7 +11036,7 @@ def __init__( filter: Optional[str] = None, summarize: Optional[str] = None, project: Optional[str] = None, - link_columns_definitions: Optional[List["InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem"]] = None, + link_columns_definitions: Optional[List["_models.InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem"]] = None, **kwargs ): """ @@ -10660,7 +11106,7 @@ class InsightsTableResult(msrest.serialization.Model): def __init__( self, *, - columns: Optional[List["InsightsTableResultColumnsItem"]] = None, + columns: Optional[List["_models.InsightsTableResultColumnsItem"]] = None, rows: Optional[List[List[str]]] = None, **kwargs ): @@ -10714,7 +11160,7 @@ class InstructionStepsInstructionsItem(ConnectorInstructionModelBase): :ivar parameters: The parameters for the setting. :vartype parameters: any - :ivar type: Required. The kind of the setting. Possible values include: "CopyableLabel", + :ivar type: Required. The kind of the setting. Known values are: "CopyableLabel", "InstructionStepsGroup", "InfoMessage". :vartype type: str or ~azure.mgmt.securityinsight.models.SettingType """ @@ -10731,14 +11177,14 @@ class InstructionStepsInstructionsItem(ConnectorInstructionModelBase): def __init__( self, *, - type: Union[str, "SettingType"], + type: Union[str, "_models.SettingType"], parameters: Optional[Any] = None, **kwargs ): """ :keyword parameters: The parameters for the setting. :paramtype parameters: any - :keyword type: Required. The kind of the setting. Possible values include: "CopyableLabel", + :keyword type: Required. The kind of the setting. Known values are: "CopyableLabel", "InstructionStepsGroup", "InfoMessage". :paramtype type: str or ~azure.mgmt.securityinsight.models.SettingType """ @@ -10751,12 +11197,11 @@ class IoTCheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar subscription_id: The subscription id to connect to, and get the data from. :vartype subscription_id: str @@ -10806,8 +11251,8 @@ class IoTDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -10842,7 +11287,7 @@ def __init__( self, *, etag: Optional[str] = None, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, subscription_id: Optional[str] = None, **kwargs ): @@ -10877,7 +11322,7 @@ class IoTDataConnectorProperties(DataConnectorWithAlertsProperties): def __init__( self, *, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, subscription_id: Optional[str] = None, **kwargs ): @@ -10909,9 +11354,9 @@ class IoTDeviceEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -11175,9 +11620,9 @@ class IpEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -11301,9 +11746,9 @@ class MailboxEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -11439,9 +11884,9 @@ class MailClusterEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -11687,9 +12132,9 @@ class MailMessageEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -11744,16 +12189,16 @@ class MailMessageEntity(Entity): :vartype body_fingerprint_bin4: int :ivar body_fingerprint_bin5: The bodyFingerprintBin5. :vartype body_fingerprint_bin5: int - :ivar antispam_direction: The directionality of this mail message. Possible values include: - "Unknown", "Inbound", "Outbound", "Intraorg". + :ivar antispam_direction: The directionality of this mail message. Known values are: "Unknown", + "Inbound", "Outbound", "Intraorg". :vartype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection :ivar delivery_action: The delivery action of this mail message like Delivered, Blocked, - Replaced etc. Possible values include: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", + Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", "Replaced". :vartype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction :ivar delivery_location: The delivery location of this mail message like Inbox, JunkFolder etc. - Possible values include: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", - "External", "Failed", "Dropped", "Forwarded". + Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", "External", + "Failed", "Dropped", "Forwarded". :vartype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation """ @@ -11827,9 +12272,9 @@ def __init__( body_fingerprint_bin3: Optional[int] = None, body_fingerprint_bin4: Optional[int] = None, body_fingerprint_bin5: Optional[int] = None, - antispam_direction: Optional[Union[str, "AntispamMailDirection"]] = None, - delivery_action: Optional[Union[str, "DeliveryAction"]] = None, - delivery_location: Optional[Union[str, "DeliveryLocation"]] = None, + antispam_direction: Optional[Union[str, "_models.AntispamMailDirection"]] = None, + delivery_action: Optional[Union[str, "_models.DeliveryAction"]] = None, + delivery_location: Optional[Union[str, "_models.DeliveryLocation"]] = None, **kwargs ): """ @@ -11843,15 +12288,15 @@ def __init__( :paramtype body_fingerprint_bin4: int :keyword body_fingerprint_bin5: The bodyFingerprintBin5. :paramtype body_fingerprint_bin5: int - :keyword antispam_direction: The directionality of this mail message. Possible values include: + :keyword antispam_direction: The directionality of this mail message. Known values are: "Unknown", "Inbound", "Outbound", "Intraorg". :paramtype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection :keyword delivery_action: The delivery action of this mail message like Delivered, Blocked, - Replaced etc. Possible values include: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", + Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", "Replaced". :paramtype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction :keyword delivery_location: The delivery location of this mail message like Inbox, JunkFolder - etc. Possible values include: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", + etc. Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", "External", "Failed", "Dropped", "Forwarded". :paramtype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation """ @@ -11942,16 +12387,16 @@ class MailMessageEntityProperties(EntityCommonProperties): :vartype body_fingerprint_bin4: int :ivar body_fingerprint_bin5: The bodyFingerprintBin5. :vartype body_fingerprint_bin5: int - :ivar antispam_direction: The directionality of this mail message. Possible values include: - "Unknown", "Inbound", "Outbound", "Intraorg". + :ivar antispam_direction: The directionality of this mail message. Known values are: "Unknown", + "Inbound", "Outbound", "Intraorg". :vartype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection :ivar delivery_action: The delivery action of this mail message like Delivered, Blocked, - Replaced etc. Possible values include: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", + Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", "Replaced". :vartype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction :ivar delivery_location: The delivery location of this mail message like Inbox, JunkFolder etc. - Possible values include: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", - "External", "Failed", "Dropped", "Forwarded". + Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", "External", + "Failed", "Dropped", "Forwarded". :vartype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation """ @@ -12015,9 +12460,9 @@ def __init__( body_fingerprint_bin3: Optional[int] = None, body_fingerprint_bin4: Optional[int] = None, body_fingerprint_bin5: Optional[int] = None, - antispam_direction: Optional[Union[str, "AntispamMailDirection"]] = None, - delivery_action: Optional[Union[str, "DeliveryAction"]] = None, - delivery_location: Optional[Union[str, "DeliveryLocation"]] = None, + antispam_direction: Optional[Union[str, "_models.AntispamMailDirection"]] = None, + delivery_action: Optional[Union[str, "_models.DeliveryAction"]] = None, + delivery_location: Optional[Union[str, "_models.DeliveryLocation"]] = None, **kwargs ): """ @@ -12031,15 +12476,15 @@ def __init__( :paramtype body_fingerprint_bin4: int :keyword body_fingerprint_bin5: The bodyFingerprintBin5. :paramtype body_fingerprint_bin5: int - :keyword antispam_direction: The directionality of this mail message. Possible values include: + :keyword antispam_direction: The directionality of this mail message. Known values are: "Unknown", "Inbound", "Outbound", "Intraorg". :paramtype antispam_direction: str or ~azure.mgmt.securityinsight.models.AntispamMailDirection :keyword delivery_action: The delivery action of this mail message like Delivered, Blocked, - Replaced etc. Possible values include: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", + Replaced etc. Known values are: "Unknown", "DeliveredAsSpam", "Delivered", "Blocked", "Replaced". :paramtype delivery_action: str or ~azure.mgmt.securityinsight.models.DeliveryAction :keyword delivery_location: The delivery location of this mail message like Inbox, JunkFolder - etc. Possible values include: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", + etc. Known values are: "Unknown", "Inbox", "JunkFolder", "DeletedFolder", "Quarantine", "External", "Failed", "Dropped", "Forwarded". :paramtype delivery_location: str or ~azure.mgmt.securityinsight.models.DeliveryLocation """ @@ -12089,9 +12534,9 @@ class MalwareEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -12247,12 +12692,11 @@ class MCASCheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -12332,8 +12776,8 @@ class MCASDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -12369,7 +12813,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["MCASDataConnectorDataTypes"] = None, + data_types: Optional["_models.MCASDataConnectorDataTypes"] = None, **kwargs ): """ @@ -12409,8 +12853,8 @@ class MCASDataConnectorDataTypes(AlertsDataTypeOfDataConnector): def __init__( self, *, - alerts: "DataConnectorDataTypeCommon", - discovery_logs: Optional["DataConnectorDataTypeCommon"] = None, + alerts: "_models.DataConnectorDataTypeCommon", + discovery_logs: Optional["_models.DataConnectorDataTypeCommon"] = None, **kwargs ): """ @@ -12448,7 +12892,7 @@ def __init__( self, *, tenant_id: str, - data_types: "MCASDataConnectorDataTypes", + data_types: "_models.MCASDataConnectorDataTypes", **kwargs ): """ @@ -12467,12 +12911,11 @@ class MDATPCheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -12552,8 +12995,8 @@ class MDATPDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -12589,7 +13032,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs ): """ @@ -12630,7 +13073,7 @@ def __init__( self, *, tenant_id: str, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs ): """ @@ -12720,7 +13163,7 @@ class MetadataDependencies(msrest.serialization.Model): :ivar content_id: Id of the content item we depend on. :vartype content_id: str - :ivar kind: Type of the content item we depend on. Possible values include: "DataConnector", + :ivar kind: Type of the content item we depend on. Known values are: "DataConnector", "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", @@ -12732,8 +13175,8 @@ class MetadataDependencies(msrest.serialization.Model): :vartype version: str :ivar name: Name of the content item. :vartype name: str - :ivar operator: Operator used for list of dependencies in criteria array. Possible values - include: "AND", "OR". + :ivar operator: Operator used for list of dependencies in criteria array. Known values are: + "AND", "OR". :vartype operator: str or ~azure.mgmt.securityinsight.models.Operator :ivar criteria: This is the list of dependencies we must fulfill, according to the AND/OR operator. @@ -12753,17 +13196,17 @@ def __init__( self, *, content_id: Optional[str] = None, - kind: Optional[Union[str, "Kind"]] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, version: Optional[str] = None, name: Optional[str] = None, - operator: Optional[Union[str, "Operator"]] = None, - criteria: Optional[List["MetadataDependencies"]] = None, + operator: Optional[Union[str, "_models.Operator"]] = None, + criteria: Optional[List["_models.MetadataDependencies"]] = None, **kwargs ): """ :keyword content_id: Id of the content item we depend on. :paramtype content_id: str - :keyword kind: Type of the content item we depend on. Possible values include: "DataConnector", + :keyword kind: Type of the content item we depend on. Known values are: "DataConnector", "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", @@ -12775,8 +13218,8 @@ def __init__( :paramtype version: str :keyword name: Name of the content item. :paramtype name: str - :keyword operator: Operator used for list of dependencies in criteria array. Possible values - include: "AND", "OR". + :keyword operator: Operator used for list of dependencies in criteria array. Known values are: + "AND", "OR". :paramtype operator: str or ~azure.mgmt.securityinsight.models.Operator :keyword criteria: This is the list of dependencies we must fulfill, according to the AND/OR operator. @@ -12817,7 +13260,7 @@ class MetadataList(msrest.serialization.Model): def __init__( self, *, - value: List["MetadataModel"], + value: List["_models.MetadataModel"], **kwargs ): """ @@ -12858,7 +13301,7 @@ class MetadataModel(ResourceWithEtag): 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version checks. :vartype version: str - :ivar kind: The kind of content the metadata is for. Possible values include: "DataConnector", + :ivar kind: The kind of content the metadata is for. Known values are: "DataConnector", "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", @@ -12943,12 +13386,12 @@ def __init__( content_id: Optional[str] = None, parent_id: Optional[str] = None, version: Optional[str] = None, - kind: Optional[Union[str, "Kind"]] = None, - source: Optional["MetadataSource"] = None, - author: Optional["MetadataAuthor"] = None, - support: Optional["MetadataSupport"] = None, - dependencies: Optional["MetadataDependencies"] = None, - categories: Optional["MetadataCategories"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + categories: Optional["_models.MetadataCategories"] = None, providers: Optional[List[str]] = None, first_publish_date: Optional[datetime.date] = None, last_publish_date: Optional[datetime.date] = None, @@ -12975,8 +13418,8 @@ def __init__( 1.0, 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version checks. :paramtype version: str - :keyword kind: The kind of content the metadata is for. Possible values include: - "DataConnector", "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + :keyword kind: The kind of content the metadata is for. Known values are: "DataConnector", + "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", "AutomationRule". @@ -13069,7 +13512,7 @@ class MetadataPatch(ResourceWithEtag): 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version checks. :vartype version: str - :ivar kind: The kind of content the metadata is for. Possible values include: "DataConnector", + :ivar kind: The kind of content the metadata is for. Known values are: "DataConnector", "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", @@ -13154,12 +13597,12 @@ def __init__( content_id: Optional[str] = None, parent_id: Optional[str] = None, version: Optional[str] = None, - kind: Optional[Union[str, "Kind"]] = None, - source: Optional["MetadataSource"] = None, - author: Optional["MetadataAuthor"] = None, - support: Optional["MetadataSupport"] = None, - dependencies: Optional["MetadataDependencies"] = None, - categories: Optional["MetadataCategories"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + source: Optional["_models.MetadataSource"] = None, + author: Optional["_models.MetadataAuthor"] = None, + support: Optional["_models.MetadataSupport"] = None, + dependencies: Optional["_models.MetadataDependencies"] = None, + categories: Optional["_models.MetadataCategories"] = None, providers: Optional[List[str]] = None, first_publish_date: Optional[datetime.date] = None, last_publish_date: Optional[datetime.date] = None, @@ -13186,8 +13629,8 @@ def __init__( 1.0, 1.0.0, 1.0.0.0), following ARM template best practices. Can also be any string, but then we cannot guarantee any version checks. :paramtype version: str - :keyword kind: The kind of content the metadata is for. Possible values include: - "DataConnector", "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", + :keyword kind: The kind of content the metadata is for. Known values are: "DataConnector", + "DataType", "Workbook", "WorkbookTemplate", "Playbook", "PlaybookTemplate", "AnalyticsRuleTemplate", "AnalyticsRule", "HuntingQuery", "InvestigationQuery", "Parser", "Watchlist", "WatchlistTemplate", "Solution", "AzureFunction", "LogicAppsCustomConnector", "AutomationRule". @@ -13256,7 +13699,7 @@ class MetadataSource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar kind: Required. Source type of the content. Possible values include: "LocalWorkspace", + :ivar kind: Required. Source type of the content. Known values are: "LocalWorkspace", "Community", "Solution", "SourceRepository". :vartype kind: str or ~azure.mgmt.securityinsight.models.SourceKind :ivar name: Name of the content source. The repo name, solution name, LA workspace name etc. @@ -13278,13 +13721,13 @@ class MetadataSource(msrest.serialization.Model): def __init__( self, *, - kind: Union[str, "SourceKind"], + kind: Union[str, "_models.SourceKind"], name: Optional[str] = None, source_id: Optional[str] = None, **kwargs ): """ - :keyword kind: Required. Source type of the content. Possible values include: "LocalWorkspace", + :keyword kind: Required. Source type of the content. Known values are: "LocalWorkspace", "Community", "Solution", "SourceRepository". :paramtype kind: str or ~azure.mgmt.securityinsight.models.SourceKind :keyword name: Name of the content source. The repo name, solution name, LA workspace name @@ -13304,7 +13747,7 @@ class MetadataSupport(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar tier: Required. Type of support for content item. Possible values include: "Microsoft", + :ivar tier: Required. Type of support for content item. Known values are: "Microsoft", "Partner", "Community". :vartype tier: str or ~azure.mgmt.securityinsight.models.SupportTier :ivar name: Name of the support contact. Company or person. @@ -13329,15 +13772,15 @@ class MetadataSupport(msrest.serialization.Model): def __init__( self, *, - tier: Union[str, "SupportTier"], + tier: Union[str, "_models.SupportTier"], name: Optional[str] = None, email: Optional[str] = None, link: Optional[str] = None, **kwargs ): """ - :keyword tier: Required. Type of support for content item. Possible values include: - "Microsoft", "Partner", "Community". + :keyword tier: Required. Type of support for content item. Known values are: "Microsoft", + "Partner", "Community". :paramtype tier: str or ~azure.mgmt.securityinsight.models.SupportTier :keyword name: Name of the support contact. Company or person. :paramtype name: str @@ -13373,8 +13816,8 @@ class MicrosoftSecurityIncidentCreationAlertRule(AlertRule): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. @@ -13382,8 +13825,8 @@ class MicrosoftSecurityIncidentCreationAlertRule(AlertRule): :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be generated. :vartype display_names_exclude_filter: list[str] - :ivar product_filter: The alerts' productName on which the cases will be generated. Possible - values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + :ivar product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat Protection". :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName @@ -13434,8 +13877,8 @@ def __init__( etag: Optional[str] = None, display_names_filter: Optional[List[str]] = None, display_names_exclude_filter: Optional[List[str]] = None, - product_filter: Optional[Union[str, "MicrosoftSecurityProductName"]] = None, - severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, + product_filter: Optional[Union[str, "_models.MicrosoftSecurityProductName"]] = None, + severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, alert_rule_template_name: Optional[str] = None, description: Optional[str] = None, display_name: Optional[str] = None, @@ -13450,8 +13893,8 @@ def __init__( :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be generated. :paramtype display_names_exclude_filter: list[str] - :keyword product_filter: The alerts' productName on which the cases will be generated. Possible - values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + :keyword product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat Protection". :paramtype product_filter: str or @@ -13492,10 +13935,9 @@ class MicrosoftSecurityIncidentCreationAlertRuleCommonProperties(msrest.serializ generated. :vartype display_names_exclude_filter: list[str] :ivar product_filter: Required. The alerts' productName on which the cases will be generated. - Possible values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure - Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security - Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat - Protection". + Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced + Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for + IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat Protection". :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName :ivar severities_filter: the alerts' severities on which the cases will be generated. :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] @@ -13515,10 +13957,10 @@ class MicrosoftSecurityIncidentCreationAlertRuleCommonProperties(msrest.serializ def __init__( self, *, - product_filter: Union[str, "MicrosoftSecurityProductName"], + product_filter: Union[str, "_models.MicrosoftSecurityProductName"], display_names_filter: Optional[List[str]] = None, display_names_exclude_filter: Optional[List[str]] = None, - severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, + severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, **kwargs ): """ @@ -13528,10 +13970,10 @@ def __init__( generated. :paramtype display_names_exclude_filter: list[str] :keyword product_filter: Required. The alerts' productName on which the cases will be - generated. Possible values include: "Microsoft Cloud App Security", "Azure Security Center", - "Azure Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure - Security Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced - Threat Protection". + generated. Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure + Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security + Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat + Protection". :paramtype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName :keyword severities_filter: the alerts' severities on which the cases will be generated. @@ -13557,10 +13999,9 @@ class MicrosoftSecurityIncidentCreationAlertRuleProperties(MicrosoftSecurityInci generated. :vartype display_names_exclude_filter: list[str] :ivar product_filter: Required. The alerts' productName on which the cases will be generated. - Possible values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure - Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security - Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat - Protection". + Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced + Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for + IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat Protection". :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName :ivar severities_filter: the alerts' severities on which the cases will be generated. :vartype severities_filter: list[str or ~azure.mgmt.securityinsight.models.AlertSeverity] @@ -13598,12 +14039,12 @@ class MicrosoftSecurityIncidentCreationAlertRuleProperties(MicrosoftSecurityInci def __init__( self, *, - product_filter: Union[str, "MicrosoftSecurityProductName"], + product_filter: Union[str, "_models.MicrosoftSecurityProductName"], display_name: str, enabled: bool, display_names_filter: Optional[List[str]] = None, display_names_exclude_filter: Optional[List[str]] = None, - severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, + severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, alert_rule_template_name: Optional[str] = None, description: Optional[str] = None, **kwargs @@ -13615,10 +14056,10 @@ def __init__( generated. :paramtype display_names_exclude_filter: list[str] :keyword product_filter: Required. The alerts' productName on which the cases will be - generated. Possible values include: "Microsoft Cloud App Security", "Azure Security Center", - "Azure Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure - Security Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced - Threat Protection". + generated. Known values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure + Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security + Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat + Protection". :paramtype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName :keyword severities_filter: the alerts' severities on which the cases will be generated. @@ -13659,8 +14100,8 @@ class MicrosoftSecurityIncidentCreationAlertRuleTemplate(AlertRuleTemplate): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar alert_rules_created_by_template_count: the number of alert rules that were created by @@ -13677,16 +14118,16 @@ class MicrosoftSecurityIncidentCreationAlertRuleTemplate(AlertRuleTemplate): :ivar required_data_connectors: The required data sources for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. :vartype display_names_filter: list[str] :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be generated. :vartype display_names_exclude_filter: list[str] - :ivar product_filter: The alerts' productName on which the cases will be generated. Possible - values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + :ivar product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat Protection". :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName @@ -13729,12 +14170,12 @@ def __init__( alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, display_names_filter: Optional[List[str]] = None, display_names_exclude_filter: Optional[List[str]] = None, - product_filter: Optional[Union[str, "MicrosoftSecurityProductName"]] = None, - severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, + product_filter: Optional[Union[str, "_models.MicrosoftSecurityProductName"]] = None, + severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, **kwargs ): """ @@ -13748,16 +14189,16 @@ def __init__( :keyword required_data_connectors: The required data sources for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. :paramtype display_names_filter: list[str] :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be generated. :paramtype display_names_exclude_filter: list[str] - :keyword product_filter: The alerts' productName on which the cases will be generated. Possible - values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + :keyword product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat Protection". :paramtype product_filter: str or @@ -13799,16 +14240,16 @@ class MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties(AlertRuleTemp :ivar required_data_connectors: The required data sources for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :ivar display_names_filter: the alerts' displayNames on which the cases will be generated. :vartype display_names_filter: list[str] :ivar display_names_exclude_filter: the alerts' displayNames on which the cases will not be generated. :vartype display_names_exclude_filter: list[str] - :ivar product_filter: The alerts' productName on which the cases will be generated. Possible - values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + :ivar product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat Protection". :vartype product_filter: str or ~azure.mgmt.securityinsight.models.MicrosoftSecurityProductName @@ -13841,12 +14282,12 @@ def __init__( alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, display_names_filter: Optional[List[str]] = None, display_names_exclude_filter: Optional[List[str]] = None, - product_filter: Optional[Union[str, "MicrosoftSecurityProductName"]] = None, - severities_filter: Optional[List[Union[str, "AlertSeverity"]]] = None, + product_filter: Optional[Union[str, "_models.MicrosoftSecurityProductName"]] = None, + severities_filter: Optional[List[Union[str, "_models.AlertSeverity"]]] = None, **kwargs ): """ @@ -13860,16 +14301,16 @@ def __init__( :keyword required_data_connectors: The required data sources for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :keyword display_names_filter: the alerts' displayNames on which the cases will be generated. :paramtype display_names_filter: list[str] :keyword display_names_exclude_filter: the alerts' displayNames on which the cases will not be generated. :paramtype display_names_exclude_filter: list[str] - :keyword product_filter: The alerts' productName on which the cases will be generated. Possible - values include: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat + :keyword product_filter: The alerts' productName on which the cases will be generated. Known + values are: "Microsoft Cloud App Security", "Azure Security Center", "Azure Advanced Threat Protection", "Azure Active Directory Identity Protection", "Azure Security Center for IoT", "Office 365 Advanced Threat Protection", "Microsoft Defender Advanced Threat Protection". :paramtype product_filter: str or @@ -13904,8 +14345,8 @@ class MLBehaviorAnalyticsAlertRule(AlertRule): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. @@ -13918,8 +14359,8 @@ class MLBehaviorAnalyticsAlertRule(AlertRule): :vartype enabled: bool :ivar last_modified_utc: The last time that this alert rule has been modified. :vartype last_modified_utc: ~datetime.datetime - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar tactics: The tactics of the alert rule. :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] @@ -14005,8 +14446,8 @@ class MLBehaviorAnalyticsAlertRuleTemplate(AlertRuleTemplate): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar alert_rules_created_by_template_count: the number of alert rules that were created by @@ -14023,15 +14464,15 @@ class MLBehaviorAnalyticsAlertRuleTemplate(AlertRuleTemplate): :ivar required_data_connectors: The required data sources for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :ivar tactics: The tactics of the alert rule. :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :ivar techniques: The techniques of the alert rule. :vartype techniques: list[str] - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity """ @@ -14069,11 +14510,11 @@ def __init__( alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, - severity: Optional[Union[str, "AlertSeverity"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, **kwargs ): """ @@ -14087,14 +14528,14 @@ def __init__( :keyword required_data_connectors: The required data sources for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :keyword tactics: The tactics of the alert rule. :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :keyword techniques: The techniques of the alert rule. :paramtype techniques: list[str] - :keyword severity: The severity for alerts created by this alert rule. Possible values include: + :keyword severity: The severity for alerts created by this alert rule. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity """ @@ -14133,15 +14574,15 @@ class MLBehaviorAnalyticsAlertRuleTemplateProperties(AlertRuleTemplateWithMitreP :ivar required_data_connectors: The required data sources for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :ivar tactics: The tactics of the alert rule. :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :ivar techniques: The techniques of the alert rule. :vartype techniques: list[str] - :ivar severity: Required. The severity for alerts created by this alert rule. Possible values - include: "High", "Medium", "Low", "Informational". + :ivar severity: Required. The severity for alerts created by this alert rule. Known values are: + "High", "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity """ @@ -14167,13 +14608,13 @@ class MLBehaviorAnalyticsAlertRuleTemplateProperties(AlertRuleTemplateWithMitreP def __init__( self, *, - severity: Union[str, "AlertSeverity"], + severity: Union[str, "_models.AlertSeverity"], alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, **kwargs ): @@ -14188,15 +14629,15 @@ def __init__( :keyword required_data_connectors: The required data sources for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :keyword tactics: The tactics of the alert rule. :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :keyword techniques: The techniques of the alert rule. :paramtype techniques: list[str] - :keyword severity: Required. The severity for alerts created by this alert rule. Possible - values include: "High", "Medium", "Low", "Informational". + :keyword severity: Required. The severity for alerts created by this alert rule. Known values + are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity """ super(MLBehaviorAnalyticsAlertRuleTemplateProperties, self).__init__(alert_rules_created_by_template_count=alert_rules_created_by_template_count, description=description, display_name=display_name, required_data_connectors=required_data_connectors, status=status, tactics=tactics, techniques=techniques, **kwargs) @@ -14209,12 +14650,11 @@ class MSTICheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -14294,8 +14734,8 @@ class MSTIDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -14331,7 +14771,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["MSTIDataConnectorDataTypes"] = None, + data_types: Optional["_models.MSTIDataConnectorDataTypes"] = None, **kwargs ): """ @@ -14376,8 +14816,8 @@ class MSTIDataConnectorDataTypes(msrest.serialization.Model): def __init__( self, *, - bing_safety_phishing_url: "MSTIDataConnectorDataTypesBingSafetyPhishingURL", - microsoft_emerging_threat_feed: "MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed", + bing_safety_phishing_url: "_models.MSTIDataConnectorDataTypesBingSafetyPhishingURL", + microsoft_emerging_threat_feed: "_models.MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed", **kwargs ): """ @@ -14400,8 +14840,8 @@ class MSTIDataConnectorDataTypesBingSafetyPhishingURL(DataConnectorDataTypeCommo All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState :ivar lookback_period: Required. lookback period. :vartype lookback_period: str @@ -14420,13 +14860,13 @@ class MSTIDataConnectorDataTypesBingSafetyPhishingURL(DataConnectorDataTypeCommo def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], lookback_period: str, **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState :keyword lookback_period: Required. lookback period. :paramtype lookback_period: str @@ -14440,8 +14880,8 @@ class MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed(DataConnectorDataTyp All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState :ivar lookback_period: Required. lookback period. :vartype lookback_period: str @@ -14460,13 +14900,13 @@ class MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed(DataConnectorDataTyp def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], lookback_period: str, **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState :keyword lookback_period: Required. lookback period. :paramtype lookback_period: str @@ -14500,7 +14940,7 @@ def __init__( self, *, tenant_id: str, - data_types: "MSTIDataConnectorDataTypes", + data_types: "_models.MSTIDataConnectorDataTypes", **kwargs ): """ @@ -14519,12 +14959,11 @@ class MtpCheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -14604,8 +15043,8 @@ class MTPDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -14641,7 +15080,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["MTPDataConnectorDataTypes"] = None, + data_types: Optional["_models.MTPDataConnectorDataTypes"] = None, **kwargs ): """ @@ -14678,7 +15117,7 @@ class MTPDataConnectorDataTypes(msrest.serialization.Model): def __init__( self, *, - incidents: "MTPDataConnectorDataTypesIncidents", + incidents: "_models.MTPDataConnectorDataTypesIncidents", **kwargs ): """ @@ -14695,8 +15134,8 @@ class MTPDataConnectorDataTypesIncidents(DataConnectorDataTypeCommon): All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -14711,12 +15150,12 @@ class MTPDataConnectorDataTypesIncidents(DataConnectorDataTypeCommon): def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(MTPDataConnectorDataTypesIncidents, self).__init__(state=state, **kwargs) @@ -14747,7 +15186,7 @@ def __init__( self, *, tenant_id: str, - data_types: "MTPDataConnectorDataTypes", + data_types: "_models.MTPDataConnectorDataTypes", **kwargs ): """ @@ -14780,8 +15219,8 @@ class NrtAlertRule(AlertRule): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. @@ -14809,8 +15248,8 @@ class NrtAlertRule(AlertRule): :ivar suppression_enabled: Determines whether the suppression for this alert rule is enabled or disabled. :vartype suppression_enabled: bool - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar incident_configuration: The settings of the incidents that created from alerts triggered by this analytics rule. @@ -14866,17 +15305,17 @@ def __init__( template_version: Optional[str] = None, description: Optional[str] = None, query: Optional[str] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, display_name: Optional[str] = None, enabled: Optional[bool] = None, suppression_duration: Optional[datetime.timedelta] = None, suppression_enabled: Optional[bool] = None, - severity: Optional[Union[str, "AlertSeverity"]] = None, - incident_configuration: Optional["IncidentConfiguration"] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + incident_configuration: Optional["_models.IncidentConfiguration"] = None, custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["EntityMapping"]] = None, - alert_details_override: Optional["AlertDetailsOverride"] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, **kwargs ): """ @@ -14906,7 +15345,7 @@ def __init__( :keyword suppression_enabled: Determines whether the suppression for this alert rule is enabled or disabled. :paramtype suppression_enabled: bool - :keyword severity: The severity for alerts created by this alert rule. Possible values include: + :keyword severity: The severity for alerts created by this alert rule. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :keyword incident_configuration: The settings of the incidents that created from alerts @@ -14958,8 +15397,8 @@ class NrtAlertRuleTemplate(AlertRuleTemplate): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar alert_rules_created_by_template_count: the number of alert rules that were created by @@ -14976,8 +15415,8 @@ class NrtAlertRuleTemplate(AlertRuleTemplate): :ivar required_data_connectors: The required data sources for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :ivar tactics: The tactics of the alert rule. :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] @@ -14985,8 +15424,8 @@ class NrtAlertRuleTemplate(AlertRuleTemplate): :vartype techniques: list[str] :ivar query: The query that creates alerts for this rule. :vartype query: str - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar version: The version of this template - in format , where all are numbers. For example <1.0.2>. @@ -15039,16 +15478,16 @@ def __init__( alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, query: Optional[str] = None, - severity: Optional[Union[str, "AlertSeverity"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, version: Optional[str] = None, custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["EntityMapping"]] = None, - alert_details_override: Optional["AlertDetailsOverride"] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, **kwargs ): """ @@ -15062,8 +15501,8 @@ def __init__( :keyword required_data_connectors: The required data sources for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :keyword tactics: The tactics of the alert rule. :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] @@ -15071,7 +15510,7 @@ def __init__( :paramtype techniques: list[str] :keyword query: The query that creates alerts for this rule. :paramtype query: str - :keyword severity: The severity for alerts created by this alert rule. Possible values include: + :keyword severity: The severity for alerts created by this alert rule. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :keyword version: The version of this template - in format , where all are numbers. For @@ -15109,8 +15548,8 @@ class QueryBasedAlertRuleTemplateProperties(msrest.serialization.Model): :ivar query: The query that creates alerts for this rule. :vartype query: str - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar version: The version of this template - in format , where all are numbers. For example <1.0.2>. @@ -15137,17 +15576,17 @@ def __init__( self, *, query: Optional[str] = None, - severity: Optional[Union[str, "AlertSeverity"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, version: Optional[str] = None, custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["EntityMapping"]] = None, - alert_details_override: Optional["AlertDetailsOverride"] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, **kwargs ): """ :keyword query: The query that creates alerts for this rule. :paramtype query: str - :keyword severity: The severity for alerts created by this alert rule. Possible values include: + :keyword severity: The severity for alerts created by this alert rule. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :keyword version: The version of this template - in format , where all are numbers. For @@ -15177,8 +15616,8 @@ class NrtAlertRuleTemplateProperties(AlertRuleTemplateWithMitreProperties, Query :ivar query: The query that creates alerts for this rule. :vartype query: str - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar version: The version of this template - in format , where all are numbers. For example <1.0.2>. @@ -15204,8 +15643,8 @@ class NrtAlertRuleTemplateProperties(AlertRuleTemplateWithMitreProperties, Query :ivar required_data_connectors: The required data sources for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :ivar tactics: The tactics of the alert rule. :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] @@ -15240,24 +15679,24 @@ def __init__( self, *, query: Optional[str] = None, - severity: Optional[Union[str, "AlertSeverity"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, version: Optional[str] = None, custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["EntityMapping"]] = None, - alert_details_override: Optional["AlertDetailsOverride"] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, **kwargs ): """ :keyword query: The query that creates alerts for this rule. :paramtype query: str - :keyword severity: The severity for alerts created by this alert rule. Possible values include: + :keyword severity: The severity for alerts created by this alert rule. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :keyword version: The version of this template - in format , where all are numbers. For @@ -15280,8 +15719,8 @@ def __init__( :keyword required_data_connectors: The required data sources for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :keyword tactics: The tactics of the alert rule. :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] @@ -15312,12 +15751,11 @@ class Office365ProjectCheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -15397,7 +15835,7 @@ class Office365ProjectConnectorDataTypes(msrest.serialization.Model): def __init__( self, *, - logs: "Office365ProjectConnectorDataTypesLogs", + logs: "_models.Office365ProjectConnectorDataTypesLogs", **kwargs ): """ @@ -15413,8 +15851,8 @@ class Office365ProjectConnectorDataTypesLogs(DataConnectorDataTypeCommon): All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -15429,12 +15867,12 @@ class Office365ProjectConnectorDataTypesLogs(DataConnectorDataTypeCommon): def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(Office365ProjectConnectorDataTypesLogs, self).__init__(state=state, **kwargs) @@ -15460,8 +15898,8 @@ class Office365ProjectDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -15497,7 +15935,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["Office365ProjectConnectorDataTypes"] = None, + data_types: Optional["_models.Office365ProjectConnectorDataTypes"] = None, **kwargs ): """ @@ -15539,7 +15977,7 @@ def __init__( self, *, tenant_id: str, - data_types: "Office365ProjectConnectorDataTypes", + data_types: "_models.Office365ProjectConnectorDataTypes", **kwargs ): """ @@ -15558,12 +15996,11 @@ class OfficeATPCheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -15643,8 +16080,8 @@ class OfficeATPDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -15680,7 +16117,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs ): """ @@ -15721,7 +16158,7 @@ def __init__( self, *, tenant_id: str, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs ): """ @@ -15817,7 +16254,7 @@ class OfficeConsentList(msrest.serialization.Model): def __init__( self, *, - value: List["OfficeConsent"], + value: List["_models.OfficeConsent"], **kwargs ): """ @@ -15849,8 +16286,8 @@ class OfficeDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -15886,7 +16323,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["OfficeDataConnectorDataTypes"] = None, + data_types: Optional["_models.OfficeDataConnectorDataTypes"] = None, **kwargs ): """ @@ -15931,9 +16368,9 @@ class OfficeDataConnectorDataTypes(msrest.serialization.Model): def __init__( self, *, - exchange: "OfficeDataConnectorDataTypesExchange", - share_point: "OfficeDataConnectorDataTypesSharePoint", - teams: "OfficeDataConnectorDataTypesTeams", + exchange: "_models.OfficeDataConnectorDataTypesExchange", + share_point: "_models.OfficeDataConnectorDataTypesSharePoint", + teams: "_models.OfficeDataConnectorDataTypesTeams", **kwargs ): """ @@ -15956,8 +16393,8 @@ class OfficeDataConnectorDataTypesExchange(DataConnectorDataTypeCommon): All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -15972,12 +16409,12 @@ class OfficeDataConnectorDataTypesExchange(DataConnectorDataTypeCommon): def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(OfficeDataConnectorDataTypesExchange, self).__init__(state=state, **kwargs) @@ -15988,8 +16425,8 @@ class OfficeDataConnectorDataTypesSharePoint(DataConnectorDataTypeCommon): All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -16004,12 +16441,12 @@ class OfficeDataConnectorDataTypesSharePoint(DataConnectorDataTypeCommon): def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(OfficeDataConnectorDataTypesSharePoint, self).__init__(state=state, **kwargs) @@ -16020,8 +16457,8 @@ class OfficeDataConnectorDataTypesTeams(DataConnectorDataTypeCommon): All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -16036,12 +16473,12 @@ class OfficeDataConnectorDataTypesTeams(DataConnectorDataTypeCommon): def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(OfficeDataConnectorDataTypesTeams, self).__init__(state=state, **kwargs) @@ -16072,7 +16509,7 @@ def __init__( self, *, tenant_id: str, - data_types: "OfficeDataConnectorDataTypes", + data_types: "_models.OfficeDataConnectorDataTypes", **kwargs ): """ @@ -16091,12 +16528,11 @@ class OfficeIRMCheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -16176,8 +16612,8 @@ class OfficeIRMDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -16213,7 +16649,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs ): """ @@ -16254,7 +16690,7 @@ def __init__( self, *, tenant_id: str, - data_types: Optional["AlertsDataTypeOfDataConnector"] = None, + data_types: Optional["_models.AlertsDataTypeOfDataConnector"] = None, **kwargs ): """ @@ -16274,12 +16710,11 @@ class OfficePowerBICheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -16359,7 +16794,7 @@ class OfficePowerBIConnectorDataTypes(msrest.serialization.Model): def __init__( self, *, - logs: "OfficePowerBIConnectorDataTypesLogs", + logs: "_models.OfficePowerBIConnectorDataTypesLogs", **kwargs ): """ @@ -16375,8 +16810,8 @@ class OfficePowerBIConnectorDataTypesLogs(DataConnectorDataTypeCommon): All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -16391,12 +16826,12 @@ class OfficePowerBIConnectorDataTypesLogs(DataConnectorDataTypeCommon): def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(OfficePowerBIConnectorDataTypesLogs, self).__init__(state=state, **kwargs) @@ -16422,8 +16857,8 @@ class OfficePowerBIDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -16459,7 +16894,7 @@ def __init__( *, etag: Optional[str] = None, tenant_id: Optional[str] = None, - data_types: Optional["OfficePowerBIConnectorDataTypes"] = None, + data_types: Optional["_models.OfficePowerBIConnectorDataTypes"] = None, **kwargs ): """ @@ -16501,7 +16936,7 @@ def __init__( self, *, tenant_id: str, - data_types: "OfficePowerBIConnectorDataTypes", + data_types: "_models.OfficePowerBIConnectorDataTypes", **kwargs ): """ @@ -16537,7 +16972,7 @@ class Operation(msrest.serialization.Model): def __init__( self, *, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, name: Optional[str] = None, origin: Optional[str] = None, is_data_action: Optional[bool] = None, @@ -16632,7 +17067,7 @@ class OperationsList(msrest.serialization.Model): def __init__( self, *, - value: List["Operation"], + value: List["_models.Operation"], **kwargs ): """ @@ -16662,8 +17097,8 @@ class Permissions(msrest.serialization.Model): def __init__( self, *, - resource_provider: Optional[List["PermissionsResourceProviderItem"]] = None, - customs: Optional[List["PermissionsCustomsItem"]] = None, + resource_provider: Optional[List["_models.PermissionsResourceProviderItem"]] = None, + customs: Optional[List["_models.PermissionsCustomsItem"]] = None, **kwargs ): """ @@ -16711,8 +17146,8 @@ def __init__( class ResourceProvider(msrest.serialization.Model): """Resource provider permissions required for the connector. - :ivar provider: Provider name. Possible values include: - "Microsoft.OperationalInsights/solutions", "Microsoft.OperationalInsights/workspaces", + :ivar provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", + "Microsoft.OperationalInsights/workspaces", "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", "Microsoft.OperationalInsights/workspaces/sharedKeys", "Microsoft.Authorization/policyAssignments". @@ -16721,8 +17156,8 @@ class ResourceProvider(msrest.serialization.Model): :vartype permissions_display_text: str :ivar provider_display_name: Permission provider display name. :vartype provider_display_name: str - :ivar scope: Permission provider scope. Possible values include: "ResourceGroup", - "Subscription", "Workspace". + :ivar scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", + "Workspace". :vartype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope :ivar required_permissions: Required permissions for the connector. :vartype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions @@ -16739,16 +17174,16 @@ class ResourceProvider(msrest.serialization.Model): def __init__( self, *, - provider: Optional[Union[str, "ProviderName"]] = None, + provider: Optional[Union[str, "_models.ProviderName"]] = None, permissions_display_text: Optional[str] = None, provider_display_name: Optional[str] = None, - scope: Optional[Union[str, "PermissionProviderScope"]] = None, - required_permissions: Optional["RequiredPermissions"] = None, + scope: Optional[Union[str, "_models.PermissionProviderScope"]] = None, + required_permissions: Optional["_models.RequiredPermissions"] = None, **kwargs ): """ - :keyword provider: Provider name. Possible values include: - "Microsoft.OperationalInsights/solutions", "Microsoft.OperationalInsights/workspaces", + :keyword provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", + "Microsoft.OperationalInsights/workspaces", "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", "Microsoft.OperationalInsights/workspaces/sharedKeys", "Microsoft.Authorization/policyAssignments". @@ -16757,8 +17192,8 @@ def __init__( :paramtype permissions_display_text: str :keyword provider_display_name: Permission provider display name. :paramtype provider_display_name: str - :keyword scope: Permission provider scope. Possible values include: "ResourceGroup", - "Subscription", "Workspace". + :keyword scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", + "Workspace". :paramtype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope :keyword required_permissions: Required permissions for the connector. :paramtype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions @@ -16774,8 +17209,8 @@ def __init__( class PermissionsResourceProviderItem(ResourceProvider): """PermissionsResourceProviderItem. - :ivar provider: Provider name. Possible values include: - "Microsoft.OperationalInsights/solutions", "Microsoft.OperationalInsights/workspaces", + :ivar provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", + "Microsoft.OperationalInsights/workspaces", "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", "Microsoft.OperationalInsights/workspaces/sharedKeys", "Microsoft.Authorization/policyAssignments". @@ -16784,8 +17219,8 @@ class PermissionsResourceProviderItem(ResourceProvider): :vartype permissions_display_text: str :ivar provider_display_name: Permission provider display name. :vartype provider_display_name: str - :ivar scope: Permission provider scope. Possible values include: "ResourceGroup", - "Subscription", "Workspace". + :ivar scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", + "Workspace". :vartype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope :ivar required_permissions: Required permissions for the connector. :vartype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions @@ -16802,16 +17237,16 @@ class PermissionsResourceProviderItem(ResourceProvider): def __init__( self, *, - provider: Optional[Union[str, "ProviderName"]] = None, + provider: Optional[Union[str, "_models.ProviderName"]] = None, permissions_display_text: Optional[str] = None, provider_display_name: Optional[str] = None, - scope: Optional[Union[str, "PermissionProviderScope"]] = None, - required_permissions: Optional["RequiredPermissions"] = None, + scope: Optional[Union[str, "_models.PermissionProviderScope"]] = None, + required_permissions: Optional["_models.RequiredPermissions"] = None, **kwargs ): """ - :keyword provider: Provider name. Possible values include: - "Microsoft.OperationalInsights/solutions", "Microsoft.OperationalInsights/workspaces", + :keyword provider: Provider name. Known values are: "Microsoft.OperationalInsights/solutions", + "Microsoft.OperationalInsights/workspaces", "Microsoft.OperationalInsights/workspaces/datasources", "microsoft.aadiam/diagnosticSettings", "Microsoft.OperationalInsights/workspaces/sharedKeys", "Microsoft.Authorization/policyAssignments". @@ -16820,8 +17255,8 @@ def __init__( :paramtype permissions_display_text: str :keyword provider_display_name: Permission provider display name. :paramtype provider_display_name: str - :keyword scope: Permission provider scope. Possible values include: "ResourceGroup", - "Subscription", "Workspace". + :keyword scope: Permission provider scope. Known values are: "ResourceGroup", "Subscription", + "Workspace". :paramtype scope: str or ~azure.mgmt.securityinsight.models.PermissionProviderScope :keyword required_permissions: Required permissions for the connector. :paramtype required_permissions: ~azure.mgmt.securityinsight.models.RequiredPermissions @@ -16879,9 +17314,9 @@ class ProcessEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -16897,8 +17332,8 @@ class ProcessEntity(Entity): :vartype command_line: str :ivar creation_time_utc: The time when the process started to run. :vartype creation_time_utc: ~datetime.datetime - :ivar elevation_token: The elevation token associated with the process. Possible values - include: "Default", "Full", "Limited". + :ivar elevation_token: The elevation token associated with the process. Known values are: + "Default", "Full", "Limited". :vartype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken :ivar host_entity_id: The host entity id on which the process was running. :vartype host_entity_id: str @@ -16952,12 +17387,12 @@ class ProcessEntity(Entity): def __init__( self, *, - elevation_token: Optional[Union[str, "ElevationToken"]] = None, + elevation_token: Optional[Union[str, "_models.ElevationToken"]] = None, **kwargs ): """ - :keyword elevation_token: The elevation token associated with the process. Possible values - include: "Default", "Full", "Limited". + :keyword elevation_token: The elevation token associated with the process. Known values are: + "Default", "Full", "Limited". :paramtype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken """ super(ProcessEntity, self).__init__(**kwargs) @@ -16992,8 +17427,8 @@ class ProcessEntityProperties(EntityCommonProperties): :vartype command_line: str :ivar creation_time_utc: The time when the process started to run. :vartype creation_time_utc: ~datetime.datetime - :ivar elevation_token: The elevation token associated with the process. Possible values - include: "Default", "Full", "Limited". + :ivar elevation_token: The elevation token associated with the process. Known values are: + "Default", "Full", "Limited". :vartype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken :ivar host_entity_id: The host entity id on which the process was running. :vartype host_entity_id: str @@ -17037,12 +17472,12 @@ class ProcessEntityProperties(EntityCommonProperties): def __init__( self, *, - elevation_token: Optional[Union[str, "ElevationToken"]] = None, + elevation_token: Optional[Union[str, "_models.ElevationToken"]] = None, **kwargs ): """ - :keyword elevation_token: The elevation token associated with the process. Possible values - include: "Default", "Full", "Limited". + :keyword elevation_token: The elevation token associated with the process. Known values are: + "Default", "Full", "Limited". :paramtype elevation_token: str or ~azure.mgmt.securityinsight.models.ElevationToken """ super(ProcessEntityProperties, self).__init__(**kwargs) @@ -17057,12 +17492,89 @@ def __init__( self.process_id = None +class PropertyArrayChangedConditionProperties(AutomationRuleCondition): + """Describes an automation rule condition that evaluates an array property's value change. + + All required parameters must be populated in order to send to Azure. + + :ivar condition_type: Required. Constant filled by server. Known values are: "Property", + "PropertyChanged", "PropertyArrayChanged". + :vartype condition_type: str or ~azure.mgmt.securityinsight.models.ConditionType + :ivar condition_properties: + :vartype condition_properties: + ~azure.mgmt.securityinsight.models.AutomationRulePropertyArrayChangedValuesCondition + """ + + _validation = { + 'condition_type': {'required': True}, + } + + _attribute_map = { + 'condition_type': {'key': 'conditionType', 'type': 'str'}, + 'condition_properties': {'key': 'conditionProperties', 'type': 'AutomationRulePropertyArrayChangedValuesCondition'}, + } + + def __init__( + self, + *, + condition_properties: Optional["_models.AutomationRulePropertyArrayChangedValuesCondition"] = None, + **kwargs + ): + """ + :keyword condition_properties: + :paramtype condition_properties: + ~azure.mgmt.securityinsight.models.AutomationRulePropertyArrayChangedValuesCondition + """ + super(PropertyArrayChangedConditionProperties, self).__init__(**kwargs) + self.condition_type = 'PropertyArrayChanged' # type: str + self.condition_properties = condition_properties + + +class PropertyChangedConditionProperties(AutomationRuleCondition): + """Describes an automation rule condition that evaluates a property's value change. + + All required parameters must be populated in order to send to Azure. + + :ivar condition_type: Required. Constant filled by server. Known values are: "Property", + "PropertyChanged", "PropertyArrayChanged". + :vartype condition_type: str or ~azure.mgmt.securityinsight.models.ConditionType + :ivar condition_properties: + :vartype condition_properties: + ~azure.mgmt.securityinsight.models.AutomationRulePropertyValuesChangedCondition + """ + + _validation = { + 'condition_type': {'required': True}, + } + + _attribute_map = { + 'condition_type': {'key': 'conditionType', 'type': 'str'}, + 'condition_properties': {'key': 'conditionProperties', 'type': 'AutomationRulePropertyValuesChangedCondition'}, + } + + def __init__( + self, + *, + condition_properties: Optional["_models.AutomationRulePropertyValuesChangedCondition"] = None, + **kwargs + ): + """ + :keyword condition_properties: + :paramtype condition_properties: + ~azure.mgmt.securityinsight.models.AutomationRulePropertyValuesChangedCondition + """ + super(PropertyChangedConditionProperties, self).__init__(**kwargs) + self.condition_type = 'PropertyChanged' # type: str + self.condition_properties = condition_properties + + class PropertyConditionProperties(AutomationRuleCondition): """Describes an automation rule condition that evaluates a property's value. All required parameters must be populated in order to send to Azure. - :ivar condition_type: Required. Constant filled by server. Possible values include: "Property". + :ivar condition_type: Required. Constant filled by server. Known values are: "Property", + "PropertyChanged", "PropertyArrayChanged". :vartype condition_type: str or ~azure.mgmt.securityinsight.models.ConditionType :ivar condition_properties: :vartype condition_properties: @@ -17081,7 +17593,7 @@ class PropertyConditionProperties(AutomationRuleCondition): def __init__( self, *, - condition_properties: Optional["AutomationRulePropertyValuesCondition"] = None, + condition_properties: Optional["_models.AutomationRulePropertyValuesCondition"] = None, **kwargs ): """ @@ -17112,9 +17624,9 @@ class RegistryKeyEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -17124,10 +17636,10 @@ class RegistryKeyEntity(Entity): :ivar friendly_name: The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. :vartype friendly_name: str - :ivar hive: the hive that holds the registry key. Possible values include: - "HKEY_LOCAL_MACHINE", "HKEY_CLASSES_ROOT", "HKEY_CURRENT_CONFIG", "HKEY_USERS", - "HKEY_CURRENT_USER_LOCAL_SETTINGS", "HKEY_PERFORMANCE_DATA", "HKEY_PERFORMANCE_NLSTEXT", - "HKEY_PERFORMANCE_TEXT", "HKEY_A", "HKEY_CURRENT_USER". + :ivar hive: the hive that holds the registry key. Known values are: "HKEY_LOCAL_MACHINE", + "HKEY_CLASSES_ROOT", "HKEY_CURRENT_CONFIG", "HKEY_USERS", "HKEY_CURRENT_USER_LOCAL_SETTINGS", + "HKEY_PERFORMANCE_DATA", "HKEY_PERFORMANCE_NLSTEXT", "HKEY_PERFORMANCE_TEXT", "HKEY_A", + "HKEY_CURRENT_USER". :vartype hive: str or ~azure.mgmt.securityinsight.models.RegistryHive :ivar key: The registry key path. :vartype key: str @@ -17182,10 +17694,10 @@ class RegistryKeyEntityProperties(EntityCommonProperties): :ivar friendly_name: The graph item display name which is a short humanly readable description of the graph item instance. This property is optional and might be system generated. :vartype friendly_name: str - :ivar hive: the hive that holds the registry key. Possible values include: - "HKEY_LOCAL_MACHINE", "HKEY_CLASSES_ROOT", "HKEY_CURRENT_CONFIG", "HKEY_USERS", - "HKEY_CURRENT_USER_LOCAL_SETTINGS", "HKEY_PERFORMANCE_DATA", "HKEY_PERFORMANCE_NLSTEXT", - "HKEY_PERFORMANCE_TEXT", "HKEY_A", "HKEY_CURRENT_USER". + :ivar hive: the hive that holds the registry key. Known values are: "HKEY_LOCAL_MACHINE", + "HKEY_CLASSES_ROOT", "HKEY_CURRENT_CONFIG", "HKEY_USERS", "HKEY_CURRENT_USER_LOCAL_SETTINGS", + "HKEY_PERFORMANCE_DATA", "HKEY_PERFORMANCE_NLSTEXT", "HKEY_PERFORMANCE_TEXT", "HKEY_A", + "HKEY_CURRENT_USER". :vartype hive: str or ~azure.mgmt.securityinsight.models.RegistryHive :ivar key: The registry key path. :vartype key: str @@ -17234,9 +17746,9 @@ class RegistryValueEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -17253,8 +17765,8 @@ class RegistryValueEntity(Entity): :ivar value_name: The registry value name. :vartype value_name: str :ivar value_type: Specifies the data types to use when storing values in the registry, or - identifies the data type of a value in the registry. Possible values include: "None", - "Unknown", "String", "ExpandString", "Binary", "DWord", "MultiString", "QWord". + identifies the data type of a value in the registry. Known values are: "None", "Unknown", + "String", "ExpandString", "Binary", "DWord", "MultiString", "QWord". :vartype value_type: str or ~azure.mgmt.securityinsight.models.RegistryValueKind """ @@ -17320,8 +17832,8 @@ class RegistryValueEntityProperties(EntityCommonProperties): :ivar value_name: The registry value name. :vartype value_name: str :ivar value_type: Specifies the data types to use when storing values in the registry, or - identifies the data type of a value in the registry. Possible values include: "None", - "Unknown", "String", "ExpandString", "Binary", "DWord", "MultiString", "QWord". + identifies the data type of a value in the registry. Known values are: "None", "Unknown", + "String", "ExpandString", "Binary", "DWord", "MultiString", "QWord". :vartype value_type: str or ~azure.mgmt.securityinsight.models.RegistryValueKind """ @@ -17452,7 +17964,7 @@ class RelationList(msrest.serialization.Model): def __init__( self, *, - value: List["Relation"], + value: List["_models.Relation"], **kwargs ): """ @@ -17529,7 +18041,7 @@ class RepoList(msrest.serialization.Model): def __init__( self, *, - value: List["Repo"], + value: List["_models.Repo"], **kwargs ): """ @@ -17571,7 +18083,7 @@ def __init__( branch: Optional[str] = None, display_url: Optional[str] = None, deployment_logs_url: Optional[str] = None, - path_mapping: Optional[List["ContentPathMap"]] = None, + path_mapping: Optional[List["_models.ContentPathMap"]] = None, **kwargs ): """ @@ -17615,9 +18127,9 @@ class RepositoryResourceInfo(msrest.serialization.Model): def __init__( self, *, - webhook: Optional["Webhook"] = None, - git_hub_resource_info: Optional["GitHubResourceInfo"] = None, - azure_dev_ops_resource_info: Optional["AzureDevOpsResourceInfo"] = None, + webhook: Optional["_models.Webhook"] = None, + git_hub_resource_info: Optional["_models.GitHubResourceInfo"] = None, + azure_dev_ops_resource_info: Optional["_models.AzureDevOpsResourceInfo"] = None, **kwargs ): """ @@ -17702,8 +18214,8 @@ class ScheduledAlertRule(AlertRule): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar query: The query that creates alerts for this rule. @@ -17712,11 +18224,11 @@ class ScheduledAlertRule(AlertRule): :vartype query_frequency: ~datetime.timedelta :ivar query_period: The period (in ISO 8601 duration format) that this alert rule looks at. :vartype query_period: ~datetime.timedelta - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar trigger_operator: The operation against the threshold that triggers alert rule. Possible - values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :ivar trigger_operator: The operation against the threshold that triggers alert rule. Known + values are: "GreaterThan", "LessThan", "Equal", "NotEqual". :vartype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator :ivar trigger_threshold: The threshold triggers this alert rule. :vartype trigger_threshold: int @@ -17803,13 +18315,13 @@ def __init__( query: Optional[str] = None, query_frequency: Optional[datetime.timedelta] = None, query_period: Optional[datetime.timedelta] = None, - severity: Optional[Union[str, "AlertSeverity"]] = None, - trigger_operator: Optional[Union[str, "TriggerOperator"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + trigger_operator: Optional[Union[str, "_models.TriggerOperator"]] = None, trigger_threshold: Optional[int] = None, - event_grouping_settings: Optional["EventGroupingSettings"] = None, + event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["EntityMapping"]] = None, - alert_details_override: Optional["AlertDetailsOverride"] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, alert_rule_template_name: Optional[str] = None, template_version: Optional[str] = None, description: Optional[str] = None, @@ -17817,9 +18329,9 @@ def __init__( enabled: Optional[bool] = None, suppression_duration: Optional[datetime.timedelta] = None, suppression_enabled: Optional[bool] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, - incident_configuration: Optional["IncidentConfiguration"] = None, + incident_configuration: Optional["_models.IncidentConfiguration"] = None, **kwargs ): """ @@ -17832,11 +18344,11 @@ def __init__( :paramtype query_frequency: ~datetime.timedelta :keyword query_period: The period (in ISO 8601 duration format) that this alert rule looks at. :paramtype query_period: ~datetime.timedelta - :keyword severity: The severity for alerts created by this alert rule. Possible values include: + :keyword severity: The severity for alerts created by this alert rule. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :keyword trigger_operator: The operation against the threshold that triggers alert rule. - Possible values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :keyword trigger_operator: The operation against the threshold that triggers alert rule. Known + values are: "GreaterThan", "LessThan", "Equal", "NotEqual". :paramtype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator :keyword trigger_threshold: The threshold triggers this alert rule. :paramtype trigger_threshold: int @@ -17909,11 +18421,11 @@ class ScheduledAlertRuleCommonProperties(msrest.serialization.Model): :vartype query_frequency: ~datetime.timedelta :ivar query_period: The period (in ISO 8601 duration format) that this alert rule looks at. :vartype query_period: ~datetime.timedelta - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar trigger_operator: The operation against the threshold that triggers alert rule. Possible - values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :ivar trigger_operator: The operation against the threshold that triggers alert rule. Known + values are: "GreaterThan", "LessThan", "Equal", "NotEqual". :vartype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator :ivar trigger_threshold: The threshold triggers this alert rule. :vartype trigger_threshold: int @@ -17947,13 +18459,13 @@ def __init__( query: Optional[str] = None, query_frequency: Optional[datetime.timedelta] = None, query_period: Optional[datetime.timedelta] = None, - severity: Optional[Union[str, "AlertSeverity"]] = None, - trigger_operator: Optional[Union[str, "TriggerOperator"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + trigger_operator: Optional[Union[str, "_models.TriggerOperator"]] = None, trigger_threshold: Optional[int] = None, - event_grouping_settings: Optional["EventGroupingSettings"] = None, + event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["EntityMapping"]] = None, - alert_details_override: Optional["AlertDetailsOverride"] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, **kwargs ): """ @@ -17964,11 +18476,11 @@ def __init__( :paramtype query_frequency: ~datetime.timedelta :keyword query_period: The period (in ISO 8601 duration format) that this alert rule looks at. :paramtype query_period: ~datetime.timedelta - :keyword severity: The severity for alerts created by this alert rule. Possible values include: + :keyword severity: The severity for alerts created by this alert rule. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :keyword trigger_operator: The operation against the threshold that triggers alert rule. - Possible values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :keyword trigger_operator: The operation against the threshold that triggers alert rule. Known + values are: "GreaterThan", "LessThan", "Equal", "NotEqual". :paramtype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator :keyword trigger_threshold: The threshold triggers this alert rule. :paramtype trigger_threshold: int @@ -18008,11 +18520,11 @@ class ScheduledAlertRuleProperties(ScheduledAlertRuleCommonProperties): :vartype query_frequency: ~datetime.timedelta :ivar query_period: The period (in ISO 8601 duration format) that this alert rule looks at. :vartype query_period: ~datetime.timedelta - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar trigger_operator: The operation against the threshold that triggers alert rule. Possible - values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :ivar trigger_operator: The operation against the threshold that triggers alert rule. Known + values are: "GreaterThan", "LessThan", "Equal", "NotEqual". :vartype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator :ivar trigger_threshold: The threshold triggers this alert rule. :vartype trigger_threshold: int @@ -18095,19 +18607,19 @@ def __init__( query: Optional[str] = None, query_frequency: Optional[datetime.timedelta] = None, query_period: Optional[datetime.timedelta] = None, - severity: Optional[Union[str, "AlertSeverity"]] = None, - trigger_operator: Optional[Union[str, "TriggerOperator"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + trigger_operator: Optional[Union[str, "_models.TriggerOperator"]] = None, trigger_threshold: Optional[int] = None, - event_grouping_settings: Optional["EventGroupingSettings"] = None, + event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["EntityMapping"]] = None, - alert_details_override: Optional["AlertDetailsOverride"] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, alert_rule_template_name: Optional[str] = None, template_version: Optional[str] = None, description: Optional[str] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, - incident_configuration: Optional["IncidentConfiguration"] = None, + incident_configuration: Optional["_models.IncidentConfiguration"] = None, **kwargs ): """ @@ -18118,11 +18630,11 @@ def __init__( :paramtype query_frequency: ~datetime.timedelta :keyword query_period: The period (in ISO 8601 duration format) that this alert rule looks at. :paramtype query_period: ~datetime.timedelta - :keyword severity: The severity for alerts created by this alert rule. Possible values include: + :keyword severity: The severity for alerts created by this alert rule. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :keyword trigger_operator: The operation against the threshold that triggers alert rule. - Possible values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :keyword trigger_operator: The operation against the threshold that triggers alert rule. Known + values are: "GreaterThan", "LessThan", "Equal", "NotEqual". :paramtype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator :keyword trigger_threshold: The threshold triggers this alert rule. :paramtype trigger_threshold: int @@ -18193,8 +18705,8 @@ class ScheduledAlertRuleTemplate(AlertRuleTemplate): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar alert_rules_created_by_template_count: the number of alert rules that were created by @@ -18211,8 +18723,8 @@ class ScheduledAlertRuleTemplate(AlertRuleTemplate): :ivar required_data_connectors: The required data connectors for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :ivar query: The query that creates alerts for this rule. :vartype query: str @@ -18220,11 +18732,11 @@ class ScheduledAlertRuleTemplate(AlertRuleTemplate): :vartype query_frequency: ~datetime.timedelta :ivar query_period: The period (in ISO 8601 duration format) that this alert rule looks at. :vartype query_period: ~datetime.timedelta - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :ivar trigger_operator: The operation against the threshold that triggers alert rule. Possible - values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :ivar trigger_operator: The operation against the threshold that triggers alert rule. Known + values are: "GreaterThan", "LessThan", "Equal", "NotEqual". :vartype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator :ivar trigger_threshold: The threshold triggers this alert rule. :vartype trigger_threshold: int @@ -18290,21 +18802,21 @@ def __init__( alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, query: Optional[str] = None, query_frequency: Optional[datetime.timedelta] = None, query_period: Optional[datetime.timedelta] = None, - severity: Optional[Union[str, "AlertSeverity"]] = None, - trigger_operator: Optional[Union[str, "TriggerOperator"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, + trigger_operator: Optional[Union[str, "_models.TriggerOperator"]] = None, trigger_threshold: Optional[int] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, version: Optional[str] = None, - event_grouping_settings: Optional["EventGroupingSettings"] = None, + event_grouping_settings: Optional["_models.EventGroupingSettings"] = None, custom_details: Optional[Dict[str, str]] = None, - entity_mappings: Optional[List["EntityMapping"]] = None, - alert_details_override: Optional["AlertDetailsOverride"] = None, + entity_mappings: Optional[List["_models.EntityMapping"]] = None, + alert_details_override: Optional["_models.AlertDetailsOverride"] = None, **kwargs ): """ @@ -18318,8 +18830,8 @@ def __init__( :keyword required_data_connectors: The required data connectors for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :keyword query: The query that creates alerts for this rule. :paramtype query: str @@ -18328,11 +18840,11 @@ def __init__( :paramtype query_frequency: ~datetime.timedelta :keyword query_period: The period (in ISO 8601 duration format) that this alert rule looks at. :paramtype query_period: ~datetime.timedelta - :keyword severity: The severity for alerts created by this alert rule. Possible values include: + :keyword severity: The severity for alerts created by this alert rule. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity - :keyword trigger_operator: The operation against the threshold that triggers alert rule. - Possible values include: "GreaterThan", "LessThan", "Equal", "NotEqual". + :keyword trigger_operator: The operation against the threshold that triggers alert rule. Known + values are: "GreaterThan", "LessThan", "Equal", "NotEqual". :paramtype trigger_operator: str or ~azure.mgmt.securityinsight.models.TriggerOperator :keyword trigger_threshold: The threshold triggers this alert rule. :paramtype trigger_threshold: int @@ -18395,9 +18907,9 @@ class SecurityAlert(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -18413,8 +18925,8 @@ class SecurityAlert(Entity): :vartype alert_type: str :ivar compromised_entity: Display name of the main entity being reported on. :vartype compromised_entity: str - :ivar confidence_level: The confidence level of this alert. Possible values include: "Unknown", - "Low", "High". + :ivar confidence_level: The confidence level of this alert. Known values are: "Unknown", "Low", + "High". :vartype confidence_level: str or ~azure.mgmt.securityinsight.models.ConfidenceLevel :ivar confidence_reasons: The confidence reasons. :vartype confidence_reasons: @@ -18422,7 +18934,7 @@ class SecurityAlert(Entity): :ivar confidence_score: The confidence score of the alert. :vartype confidence_score: float :ivar confidence_score_status: The confidence score calculation status, i.e. indicating if - score calculation is pending for this alert, not applicable or final. Possible values include: + score calculation is pending for this alert, not applicable or final. Known values are: "NotApplicable", "InProcess", "NotFinal", "Final". :vartype confidence_score_status: str or ~azure.mgmt.securityinsight.models.ConfidenceScoreStatus @@ -18431,7 +18943,7 @@ class SecurityAlert(Entity): :ivar end_time_utc: The impact end time of the alert (the time of the last event contributing to the alert). :vartype end_time_utc: ~datetime.datetime - :ivar intent: Holds the alert intent stage(s) mapping for this alert. Possible values include: + :ivar intent: Holds the alert intent stage(s) mapping for this alert. Known values are: "Unknown", "Probing", "Exploitation", "Persistence", "PrivilegeEscalation", "DefenseEvasion", "CredentialAccess", "Discovery", "LateralMovement", "Execution", "Collection", "Exfiltration", "CommandAndControl", "Impact". @@ -18450,13 +18962,13 @@ class SecurityAlert(Entity): :vartype product_version: str :ivar remediation_steps: Manual action items to take to remediate the alert. :vartype remediation_steps: list[str] - :ivar severity: The severity of the alert. Possible values include: "High", "Medium", "Low", + :ivar severity: The severity of the alert. Known values are: "High", "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar start_time_utc: The impact start time of the alert (the time of the first event contributing to the alert). :vartype start_time_utc: ~datetime.datetime - :ivar status: The lifecycle status of the alert. Possible values include: "Unknown", "New", + :ivar status: The lifecycle status of the alert. Known values are: "Unknown", "New", "Resolved", "Dismissed", "InProgress". :vartype status: str or ~azure.mgmt.securityinsight.models.AlertStatus :ivar system_alert_id: Holds the product identifier of the alert for the product. @@ -18545,11 +19057,11 @@ class SecurityAlert(Entity): def __init__( self, *, - severity: Optional[Union[str, "AlertSeverity"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, **kwargs ): """ - :keyword severity: The severity of the alert. Possible values include: "High", "Medium", "Low", + :keyword severity: The severity of the alert. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity """ @@ -18601,8 +19113,8 @@ class SecurityAlertProperties(EntityCommonProperties): :vartype alert_type: str :ivar compromised_entity: Display name of the main entity being reported on. :vartype compromised_entity: str - :ivar confidence_level: The confidence level of this alert. Possible values include: "Unknown", - "Low", "High". + :ivar confidence_level: The confidence level of this alert. Known values are: "Unknown", "Low", + "High". :vartype confidence_level: str or ~azure.mgmt.securityinsight.models.ConfidenceLevel :ivar confidence_reasons: The confidence reasons. :vartype confidence_reasons: @@ -18610,7 +19122,7 @@ class SecurityAlertProperties(EntityCommonProperties): :ivar confidence_score: The confidence score of the alert. :vartype confidence_score: float :ivar confidence_score_status: The confidence score calculation status, i.e. indicating if - score calculation is pending for this alert, not applicable or final. Possible values include: + score calculation is pending for this alert, not applicable or final. Known values are: "NotApplicable", "InProcess", "NotFinal", "Final". :vartype confidence_score_status: str or ~azure.mgmt.securityinsight.models.ConfidenceScoreStatus @@ -18619,7 +19131,7 @@ class SecurityAlertProperties(EntityCommonProperties): :ivar end_time_utc: The impact end time of the alert (the time of the last event contributing to the alert). :vartype end_time_utc: ~datetime.datetime - :ivar intent: Holds the alert intent stage(s) mapping for this alert. Possible values include: + :ivar intent: Holds the alert intent stage(s) mapping for this alert. Known values are: "Unknown", "Probing", "Exploitation", "Persistence", "PrivilegeEscalation", "DefenseEvasion", "CredentialAccess", "Discovery", "LateralMovement", "Execution", "Collection", "Exfiltration", "CommandAndControl", "Impact". @@ -18638,13 +19150,13 @@ class SecurityAlertProperties(EntityCommonProperties): :vartype product_version: str :ivar remediation_steps: Manual action items to take to remediate the alert. :vartype remediation_steps: list[str] - :ivar severity: The severity of the alert. Possible values include: "High", "Medium", "Low", + :ivar severity: The severity of the alert. Known values are: "High", "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar start_time_utc: The impact start time of the alert (the time of the first event contributing to the alert). :vartype start_time_utc: ~datetime.datetime - :ivar status: The lifecycle status of the alert. Possible values include: "Unknown", "New", + :ivar status: The lifecycle status of the alert. Known values are: "Unknown", "New", "Resolved", "Dismissed", "InProgress". :vartype status: str or ~azure.mgmt.securityinsight.models.AlertStatus :ivar system_alert_id: Holds the product identifier of the alert for the product. @@ -18723,11 +19235,11 @@ class SecurityAlertProperties(EntityCommonProperties): def __init__( self, *, - severity: Optional[Union[str, "AlertSeverity"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, **kwargs ): """ - :keyword severity: The severity of the alert. Possible values include: "High", "Medium", "Low", + :keyword severity: The severity of the alert. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity """ @@ -18796,8 +19308,8 @@ class SecurityAlertTimelineItem(EntityTimelineItem): All required parameters must be populated in order to send to Azure. - :ivar kind: Required. The entity query kind type.Constant filled by server. Possible values - include: "Activity", "Bookmark", "SecurityAlert". + :ivar kind: Required. The entity query kind type.Constant filled by server. Known values are: + "Activity", "Bookmark", "SecurityAlert", "Anomaly". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind :ivar azure_resource_id: Required. The alert azure resource id. :vartype azure_resource_id: str @@ -18807,7 +19319,7 @@ class SecurityAlertTimelineItem(EntityTimelineItem): :vartype description: str :ivar display_name: Required. The alert name. :vartype display_name: str - :ivar severity: Required. The alert severity. Possible values include: "High", "Medium", "Low", + :ivar severity: Required. The alert severity. Known values are: "High", "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar end_time_utc: Required. The alert end time. @@ -18849,7 +19361,7 @@ def __init__( *, azure_resource_id: str, display_name: str, - severity: Union[str, "AlertSeverity"], + severity: Union[str, "_models.AlertSeverity"], end_time_utc: datetime.datetime, start_time_utc: datetime.datetime, time_generated: datetime.datetime, @@ -18867,8 +19379,8 @@ def __init__( :paramtype description: str :keyword display_name: Required. The alert name. :paramtype display_name: str - :keyword severity: Required. The alert severity. Possible values include: "High", "Medium", - "Low", "Informational". + :keyword severity: Required. The alert severity. Known values are: "High", "Medium", "Low", + "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :keyword end_time_utc: Required. The alert end time. :paramtype end_time_utc: ~datetime.datetime @@ -18910,9 +19422,9 @@ class SecurityGroupEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -19022,6 +19534,76 @@ def __init__( self.sid = None +class SecurityMLAnalyticsSettingsDataSource(msrest.serialization.Model): + """security ml analytics settings data sources. + + :ivar connector_id: The connector id that provides the following data types. + :vartype connector_id: str + :ivar data_types: The data types used by the security ml analytics settings. + :vartype data_types: list[str] + """ + + _attribute_map = { + 'connector_id': {'key': 'connectorId', 'type': 'str'}, + 'data_types': {'key': 'dataTypes', 'type': '[str]'}, + } + + def __init__( + self, + *, + connector_id: Optional[str] = None, + data_types: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword connector_id: The connector id that provides the following data types. + :paramtype connector_id: str + :keyword data_types: The data types used by the security ml analytics settings. + :paramtype data_types: list[str] + """ + super(SecurityMLAnalyticsSettingsDataSource, self).__init__(**kwargs) + self.connector_id = connector_id + self.data_types = data_types + + +class SecurityMLAnalyticsSettingsList(msrest.serialization.Model): + """List all the SecurityMLAnalyticsSettings. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: URL to fetch the next set of SecurityMLAnalyticsSettings. + :vartype next_link: str + :ivar value: Required. Array of SecurityMLAnalyticsSettings. + :vartype value: list[~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSetting] + """ + + _validation = { + 'next_link': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[SecurityMLAnalyticsSetting]'}, + } + + def __init__( + self, + *, + value: List["_models.SecurityMLAnalyticsSetting"], + **kwargs + ): + """ + :keyword value: Required. Array of SecurityMLAnalyticsSettings. + :paramtype value: list[~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSetting] + """ + super(SecurityMLAnalyticsSettingsList, self).__init__(**kwargs) + self.next_link = None + self.value = value + + class SentinelOnboardingState(ResourceWithEtag): """Sentinel onboarding state. @@ -19097,7 +19679,7 @@ class SentinelOnboardingStatesList(msrest.serialization.Model): def __init__( self, *, - value: List["SentinelOnboardingState"], + value: List["_models.SentinelOnboardingState"], **kwargs ): """ @@ -19128,7 +19710,7 @@ class SettingList(msrest.serialization.Model): def __init__( self, *, - value: List["Settings"], + value: List["_models.Settings"], **kwargs ): """ @@ -19139,38 +19721,6 @@ def __init__( self.value = value -class Sku(msrest.serialization.Model): - """The pricing tier of the solution. - - :ivar name: The kind of the tier. Possible values include: "PerGB", "CapacityReservation". - :vartype name: str or ~azure.mgmt.securityinsight.models.SkuKind - :ivar capacity_reservation_level: The amount of reservation level. - :vartype capacity_reservation_level: int - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'capacity_reservation_level': {'key': 'capacityReservationLevel', 'type': 'int'}, - } - - def __init__( - self, - *, - name: Optional[Union[str, "SkuKind"]] = None, - capacity_reservation_level: Optional[int] = None, - **kwargs - ): - """ - :keyword name: The kind of the tier. Possible values include: "PerGB", "CapacityReservation". - :paramtype name: str or ~azure.mgmt.securityinsight.models.SkuKind - :keyword capacity_reservation_level: The amount of reservation level. - :paramtype capacity_reservation_level: int - """ - super(Sku, self).__init__(**kwargs) - self.name = name - self.capacity_reservation_level = capacity_reservation_level - - class SourceControl(ResourceWithEtag): """Represents a SourceControl in Azure Security Insights. @@ -19191,14 +19741,14 @@ class SourceControl(ResourceWithEtag): :vartype etag: str :ivar id_properties_id: The id (a Guid) of the source control. :vartype id_properties_id: str - :ivar version: The version number associated with the source control. Possible values include: - "V1", "V2". + :ivar version: The version number associated with the source control. Known values are: "V1", + "V2". :vartype version: str or ~azure.mgmt.securityinsight.models.Version :ivar display_name: The display name of the source control. :vartype display_name: str :ivar description: A description of the source control. :vartype description: str - :ivar repo_type: The repository type of the source control. Possible values include: "Github", + :ivar repo_type: The repository type of the source control. Known values are: "Github", "DevOps". :vartype repo_type: str or ~azure.mgmt.securityinsight.models.RepoType :ivar content_types: Array of source control content types. @@ -19241,14 +19791,14 @@ def __init__( *, etag: Optional[str] = None, id_properties_id: Optional[str] = None, - version: Optional[Union[str, "Version"]] = None, + version: Optional[Union[str, "_models.Version"]] = None, display_name: Optional[str] = None, description: Optional[str] = None, - repo_type: Optional[Union[str, "RepoType"]] = None, - content_types: Optional[List[Union[str, "ContentType"]]] = None, - repository: Optional["Repository"] = None, - repository_resource_info: Optional["RepositoryResourceInfo"] = None, - last_deployment_info: Optional["DeploymentInfo"] = None, + repo_type: Optional[Union[str, "_models.RepoType"]] = None, + content_types: Optional[List[Union[str, "_models.ContentType"]]] = None, + repository: Optional["_models.Repository"] = None, + repository_resource_info: Optional["_models.RepositoryResourceInfo"] = None, + last_deployment_info: Optional["_models.DeploymentInfo"] = None, **kwargs ): """ @@ -19256,15 +19806,15 @@ def __init__( :paramtype etag: str :keyword id_properties_id: The id (a Guid) of the source control. :paramtype id_properties_id: str - :keyword version: The version number associated with the source control. Possible values - include: "V1", "V2". + :keyword version: The version number associated with the source control. Known values are: + "V1", "V2". :paramtype version: str or ~azure.mgmt.securityinsight.models.Version :keyword display_name: The display name of the source control. :paramtype display_name: str :keyword description: A description of the source control. :paramtype description: str - :keyword repo_type: The repository type of the source control. Possible values include: - "Github", "DevOps". + :keyword repo_type: The repository type of the source control. Known values are: "Github", + "DevOps". :paramtype repo_type: str or ~azure.mgmt.securityinsight.models.RepoType :keyword content_types: Array of source control content types. :paramtype content_types: list[str or ~azure.mgmt.securityinsight.models.ContentType] @@ -19315,7 +19865,7 @@ class SourceControlList(msrest.serialization.Model): def __init__( self, *, - value: List["SourceControl"], + value: List["_models.SourceControl"], **kwargs ): """ @@ -19345,9 +19895,9 @@ class SubmissionMailEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -19530,15 +20080,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.securityinsight.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.securityinsight.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime @@ -19557,25 +20107,25 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.securityinsight.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.securityinsight.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime @@ -19761,8 +20311,8 @@ class ThreatIntelligenceAlertRule(AlertRule): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar alert_rule_template_name: The Name of the alert rule template used to create this rule. @@ -19775,8 +20325,8 @@ class ThreatIntelligenceAlertRule(AlertRule): :vartype enabled: bool :ivar last_modified_utc: The last time that this alert has been modified. :vartype last_modified_utc: ~datetime.datetime - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity :ivar tactics: The tactics of the alert rule. :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] @@ -19862,8 +20412,8 @@ class ThreatIntelligenceAlertRuleTemplate(AlertRuleTemplate): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the alert rule.Constant filled by server. Possible values - include: "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", + :ivar kind: Required. The kind of the alert rule.Constant filled by server. Known values are: + "Scheduled", "MicrosoftSecurityIncidentCreation", "Fusion", "MLBehaviorAnalytics", "ThreatIntelligence", "NRT". :vartype kind: str or ~azure.mgmt.securityinsight.models.AlertRuleKind :ivar alert_rules_created_by_template_count: the number of alert rules that were created by @@ -19880,15 +20430,15 @@ class ThreatIntelligenceAlertRuleTemplate(AlertRuleTemplate): :ivar required_data_connectors: The required data sources for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :ivar tactics: The tactics of the alert rule. :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :ivar techniques: The techniques of the alert rule. :vartype techniques: list[str] - :ivar severity: The severity for alerts created by this alert rule. Possible values include: - "High", "Medium", "Low", "Informational". + :ivar severity: The severity for alerts created by this alert rule. Known values are: "High", + "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity """ @@ -19926,11 +20476,11 @@ def __init__( alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, - severity: Optional[Union[str, "AlertSeverity"]] = None, + severity: Optional[Union[str, "_models.AlertSeverity"]] = None, **kwargs ): """ @@ -19944,14 +20494,14 @@ def __init__( :keyword required_data_connectors: The required data sources for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :keyword tactics: The tactics of the alert rule. :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :keyword techniques: The techniques of the alert rule. :paramtype techniques: list[str] - :keyword severity: The severity for alerts created by this alert rule. Possible values include: + :keyword severity: The severity for alerts created by this alert rule. Known values are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity """ @@ -19990,15 +20540,15 @@ class ThreatIntelligenceAlertRuleTemplateProperties(AlertRuleTemplateWithMitrePr :ivar required_data_connectors: The required data sources for this template. :vartype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :ivar status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :ivar status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :vartype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :ivar tactics: The tactics of the alert rule. :vartype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :ivar techniques: The techniques of the alert rule. :vartype techniques: list[str] - :ivar severity: Required. The severity for alerts created by this alert rule. Possible values - include: "High", "Medium", "Low", "Informational". + :ivar severity: Required. The severity for alerts created by this alert rule. Known values are: + "High", "Medium", "Low", "Informational". :vartype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity """ @@ -20024,13 +20574,13 @@ class ThreatIntelligenceAlertRuleTemplateProperties(AlertRuleTemplateWithMitrePr def __init__( self, *, - severity: Union[str, "AlertSeverity"], + severity: Union[str, "_models.AlertSeverity"], alert_rules_created_by_template_count: Optional[int] = None, description: Optional[str] = None, display_name: Optional[str] = None, - required_data_connectors: Optional[List["AlertRuleTemplateDataSource"]] = None, - status: Optional[Union[str, "TemplateStatus"]] = None, - tactics: Optional[List[Union[str, "AttackTactic"]]] = None, + required_data_connectors: Optional[List["_models.AlertRuleTemplateDataSource"]] = None, + status: Optional[Union[str, "_models.TemplateStatus"]] = None, + tactics: Optional[List[Union[str, "_models.AttackTactic"]]] = None, techniques: Optional[List[str]] = None, **kwargs ): @@ -20045,15 +20595,15 @@ def __init__( :keyword required_data_connectors: The required data sources for this template. :paramtype required_data_connectors: list[~azure.mgmt.securityinsight.models.AlertRuleTemplateDataSource] - :keyword status: The alert rule template status. Possible values include: "Installed", - "Available", "NotAvailable". + :keyword status: The alert rule template status. Known values are: "Installed", "Available", + "NotAvailable". :paramtype status: str or ~azure.mgmt.securityinsight.models.TemplateStatus :keyword tactics: The tactics of the alert rule. :paramtype tactics: list[str or ~azure.mgmt.securityinsight.models.AttackTactic] :keyword techniques: The techniques of the alert rule. :paramtype techniques: list[str] - :keyword severity: Required. The severity for alerts created by this alert rule. Possible - values include: "High", "Medium", "Low", "Informational". + :keyword severity: Required. The severity for alerts created by this alert rule. Known values + are: "High", "Medium", "Low", "Informational". :paramtype severity: str or ~azure.mgmt.securityinsight.models.AlertSeverity """ super(ThreatIntelligenceAlertRuleTemplateProperties, self).__init__(alert_rules_created_by_template_count=alert_rules_created_by_template_count, description=description, display_name=display_name, required_data_connectors=required_data_connectors, status=status, tactics=tactics, techniques=techniques, **kwargs) @@ -20194,7 +20744,7 @@ def __init__( min_valid_until: Optional[str] = None, max_valid_until: Optional[str] = None, include_disabled: Optional[bool] = None, - sort_by: Optional[List["ThreatIntelligenceSortingCriteria"]] = None, + sort_by: Optional[List["_models.ThreatIntelligenceSortingCriteria"]] = None, sources: Optional[List[str]] = None, pattern_types: Optional[List[str]] = None, threat_types: Optional[List[str]] = None, @@ -20309,8 +20859,8 @@ class ThreatIntelligenceInformation(ResourceWithEtag): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "indicator". + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "indicator". :vartype kind: str or ~azure.mgmt.securityinsight.models.ThreatIntelligenceResourceKindEnum """ @@ -20369,8 +20919,8 @@ class ThreatIntelligenceIndicatorModel(ThreatIntelligenceInformation): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "indicator". + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "indicator". :vartype kind: str or ~azure.mgmt.securityinsight.models.ThreatIntelligenceResourceKindEnum :ivar additional_data: A bag of custom fields that should be part of the entity and will be presented to the user. @@ -20502,14 +21052,14 @@ def __init__( pattern: Optional[str] = None, pattern_type: Optional[str] = None, pattern_version: Optional[str] = None, - kill_chain_phases: Optional[List["ThreatIntelligenceKillChainPhase"]] = None, - parsed_pattern: Optional[List["ThreatIntelligenceParsedPattern"]] = None, + kill_chain_phases: Optional[List["_models.ThreatIntelligenceKillChainPhase"]] = None, + parsed_pattern: Optional[List["_models.ThreatIntelligenceParsedPattern"]] = None, external_id: Optional[str] = None, created_by_ref: Optional[str] = None, defanged: Optional[bool] = None, external_last_updated_time_utc: Optional[str] = None, - external_references: Optional[List["ThreatIntelligenceExternalReference"]] = None, - granular_markings: Optional[List["ThreatIntelligenceGranularMarkingModel"]] = None, + external_references: Optional[List["_models.ThreatIntelligenceExternalReference"]] = None, + granular_markings: Optional[List["_models.ThreatIntelligenceGranularMarkingModel"]] = None, labels: Optional[List[str]] = None, revoked: Optional[bool] = None, confidence: Optional[int] = None, @@ -20744,14 +21294,14 @@ def __init__( pattern: Optional[str] = None, pattern_type: Optional[str] = None, pattern_version: Optional[str] = None, - kill_chain_phases: Optional[List["ThreatIntelligenceKillChainPhase"]] = None, - parsed_pattern: Optional[List["ThreatIntelligenceParsedPattern"]] = None, + kill_chain_phases: Optional[List["_models.ThreatIntelligenceKillChainPhase"]] = None, + parsed_pattern: Optional[List["_models.ThreatIntelligenceParsedPattern"]] = None, external_id: Optional[str] = None, created_by_ref: Optional[str] = None, defanged: Optional[bool] = None, external_last_updated_time_utc: Optional[str] = None, - external_references: Optional[List["ThreatIntelligenceExternalReference"]] = None, - granular_markings: Optional[List["ThreatIntelligenceGranularMarkingModel"]] = None, + external_references: Optional[List["_models.ThreatIntelligenceExternalReference"]] = None, + granular_markings: Optional[List["_models.ThreatIntelligenceGranularMarkingModel"]] = None, labels: Optional[List[str]] = None, revoked: Optional[bool] = None, confidence: Optional[int] = None, @@ -20884,7 +21434,7 @@ class ThreatIntelligenceInformationList(msrest.serialization.Model): def __init__( self, *, - value: List["ThreatIntelligenceInformation"], + value: List["_models.ThreatIntelligenceInformation"], **kwargs ): """ @@ -20955,9 +21505,9 @@ def __init__( self, *, last_updated_time_utc: Optional[str] = None, - threat_type_metrics: Optional[List["ThreatIntelligenceMetricEntity"]] = None, - pattern_type_metrics: Optional[List["ThreatIntelligenceMetricEntity"]] = None, - source_metrics: Optional[List["ThreatIntelligenceMetricEntity"]] = None, + threat_type_metrics: Optional[List["_models.ThreatIntelligenceMetricEntity"]] = None, + pattern_type_metrics: Optional[List["_models.ThreatIntelligenceMetricEntity"]] = None, + source_metrics: Optional[List["_models.ThreatIntelligenceMetricEntity"]] = None, **kwargs ): """ @@ -21026,7 +21576,7 @@ class ThreatIntelligenceMetrics(msrest.serialization.Model): def __init__( self, *, - properties: Optional["ThreatIntelligenceMetric"] = None, + properties: Optional["_models.ThreatIntelligenceMetric"] = None, **kwargs ): """ @@ -21057,7 +21607,7 @@ class ThreatIntelligenceMetricsList(msrest.serialization.Model): def __init__( self, *, - value: List["ThreatIntelligenceMetrics"], + value: List["_models.ThreatIntelligenceMetrics"], **kwargs ): """ @@ -21087,7 +21637,7 @@ def __init__( self, *, pattern_type_key: Optional[str] = None, - pattern_type_values: Optional[List["ThreatIntelligenceParsedPatternTypeValue"]] = None, + pattern_type_values: Optional[List["_models.ThreatIntelligenceParsedPatternTypeValue"]] = None, **kwargs ): """ @@ -21139,8 +21689,8 @@ class ThreatIntelligenceSortingCriteria(msrest.serialization.Model): :ivar item_key: Column name. :vartype item_key: str - :ivar sort_order: Sorting order (ascending/descending/unsorted). Possible values include: - "unsorted", "ascending", "descending". + :ivar sort_order: Sorting order (ascending/descending/unsorted). Known values are: "unsorted", + "ascending", "descending". :vartype sort_order: str or ~azure.mgmt.securityinsight.models.ThreatIntelligenceSortingCriteriaEnum """ @@ -21154,13 +21704,13 @@ def __init__( self, *, item_key: Optional[str] = None, - sort_order: Optional[Union[str, "ThreatIntelligenceSortingCriteriaEnum"]] = None, + sort_order: Optional[Union[str, "_models.ThreatIntelligenceSortingCriteriaEnum"]] = None, **kwargs ): """ :keyword item_key: Column name. :paramtype item_key: str - :keyword sort_order: Sorting order (ascending/descending/unsorted). Possible values include: + :keyword sort_order: Sorting order (ascending/descending/unsorted). Known values are: "unsorted", "ascending", "descending". :paramtype sort_order: str or ~azure.mgmt.securityinsight.models.ThreatIntelligenceSortingCriteriaEnum @@ -21176,12 +21726,11 @@ class TICheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -21261,8 +21810,8 @@ class TIDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -21302,7 +21851,7 @@ def __init__( etag: Optional[str] = None, tenant_id: Optional[str] = None, tip_lookback_period: Optional[datetime.datetime] = None, - data_types: Optional["TIDataConnectorDataTypes"] = None, + data_types: Optional["_models.TIDataConnectorDataTypes"] = None, **kwargs ): """ @@ -21342,7 +21891,7 @@ class TIDataConnectorDataTypes(msrest.serialization.Model): def __init__( self, *, - indicators: "TIDataConnectorDataTypesIndicators", + indicators: "_models.TIDataConnectorDataTypesIndicators", **kwargs ): """ @@ -21358,8 +21907,8 @@ class TIDataConnectorDataTypesIndicators(DataConnectorDataTypeCommon): All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -21374,12 +21923,12 @@ class TIDataConnectorDataTypesIndicators(DataConnectorDataTypeCommon): def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(TIDataConnectorDataTypesIndicators, self).__init__(state=state, **kwargs) @@ -21413,7 +21962,7 @@ def __init__( self, *, tenant_id: str, - data_types: "TIDataConnectorDataTypes", + data_types: "_models.TIDataConnectorDataTypes", tip_lookback_period: Optional[datetime.datetime] = None, **kwargs ): @@ -21437,8 +21986,8 @@ class TimelineAggregation(msrest.serialization.Model): :ivar count: Required. the total items found for a kind. :vartype count: int - :ivar kind: Required. the query kind. Possible values include: "Activity", "Bookmark", - "SecurityAlert". + :ivar kind: Required. the query kind. Known values are: "Activity", "Bookmark", + "SecurityAlert", "Anomaly". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind """ @@ -21456,14 +22005,14 @@ def __init__( self, *, count: int, - kind: Union[str, "EntityTimelineKind"], + kind: Union[str, "_models.EntityTimelineKind"], **kwargs ): """ :keyword count: Required. the total items found for a kind. :paramtype count: int - :keyword kind: Required. the query kind. Possible values include: "Activity", "Bookmark", - "SecurityAlert". + :keyword kind: Required. the query kind. Known values are: "Activity", "Bookmark", + "SecurityAlert", "Anomaly". :paramtype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind """ super(TimelineAggregation, self).__init__(**kwargs) @@ -21476,8 +22025,8 @@ class TimelineError(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar kind: Required. the query kind. Possible values include: "Activity", "Bookmark", - "SecurityAlert". + :ivar kind: Required. the query kind. Known values are: "Activity", "Bookmark", + "SecurityAlert", "Anomaly". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind :ivar query_id: the query id. :vartype query_id: str @@ -21499,14 +22048,14 @@ class TimelineError(msrest.serialization.Model): def __init__( self, *, - kind: Union[str, "EntityTimelineKind"], + kind: Union[str, "_models.EntityTimelineKind"], error_message: str, query_id: Optional[str] = None, **kwargs ): """ - :keyword kind: Required. the query kind. Possible values include: "Activity", "Bookmark", - "SecurityAlert". + :keyword kind: Required. the query kind. Known values are: "Activity", "Bookmark", + "SecurityAlert", "Anomaly". :paramtype kind: str or ~azure.mgmt.securityinsight.models.EntityTimelineKind :keyword query_id: the query id. :paramtype query_id: str @@ -21547,8 +22096,8 @@ def __init__( self, *, total_count: int, - aggregations: List["TimelineAggregation"], - errors: Optional[List["TimelineError"]] = None, + aggregations: List["_models.TimelineAggregation"], + errors: Optional[List["_models.TimelineError"]] = None, **kwargs ): """ @@ -21571,12 +22120,11 @@ class TiTaxiiCheckRequirements(DataConnectorsCheckRequirements): All required parameters must be populated in order to send to Azure. :ivar kind: Required. Describes the kind of connector to be checked.Constant filled by server. - Possible values include: "AzureActiveDirectory", "AzureSecurityCenter", - "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", - "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", - "AmazonWebServicesS3", "AzureAdvancedThreatProtection", - "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", "MicrosoftThreatProtection", - "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". + Known values are: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", + "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", + "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", + "MicrosoftThreatProtection", "MicrosoftThreatIntelligence", "GenericUI", "APIPolling", "IOT". :vartype kind: str or ~azure.mgmt.securityinsight.models.DataConnectorKind :ivar tenant_id: The tenant id to connect to, and get the data from. :vartype tenant_id: str @@ -21656,8 +22204,8 @@ class TiTaxiiDataConnector(DataConnector): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The data connector kind.Constant filled by server. Possible values - include: "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", + :ivar kind: Required. The data connector kind.Constant filled by server. Known values are: + "AzureActiveDirectory", "AzureSecurityCenter", "MicrosoftCloudAppSecurity", "ThreatIntelligence", "ThreatIntelligenceTaxii", "Office365", "OfficeATP", "OfficeIRM", "Office365Project", "OfficePowerBI", "AmazonWebServicesCloudTrail", "AmazonWebServicesS3", "AzureAdvancedThreatProtection", "MicrosoftDefenderAdvancedThreatProtection", "Dynamics365", @@ -21679,7 +22227,7 @@ class TiTaxiiDataConnector(DataConnector): :vartype password: str :ivar taxii_lookback_period: The lookback period for the TAXII server. :vartype taxii_lookback_period: ~datetime.datetime - :ivar polling_frequency: The polling frequency for the TAXII server. Possible values include: + :ivar polling_frequency: The polling frequency for the TAXII server. Known values are: "OnceAMinute", "OnceAnHour", "OnceADay". :vartype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency :ivar data_types: The available data types for Threat Intelligence TAXII data connector. @@ -21725,8 +22273,8 @@ def __init__( user_name: Optional[str] = None, password: Optional[str] = None, taxii_lookback_period: Optional[datetime.datetime] = None, - polling_frequency: Optional[Union[str, "PollingFrequency"]] = None, - data_types: Optional["TiTaxiiDataConnectorDataTypes"] = None, + polling_frequency: Optional[Union[str, "_models.PollingFrequency"]] = None, + data_types: Optional["_models.TiTaxiiDataConnectorDataTypes"] = None, **kwargs ): """ @@ -21748,8 +22296,8 @@ def __init__( :paramtype password: str :keyword taxii_lookback_period: The lookback period for the TAXII server. :paramtype taxii_lookback_period: ~datetime.datetime - :keyword polling_frequency: The polling frequency for the TAXII server. Possible values - include: "OnceAMinute", "OnceAnHour", "OnceADay". + :keyword polling_frequency: The polling frequency for the TAXII server. Known values are: + "OnceAMinute", "OnceAnHour", "OnceADay". :paramtype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency :keyword data_types: The available data types for Threat Intelligence TAXII data connector. :paramtype data_types: ~azure.mgmt.securityinsight.models.TiTaxiiDataConnectorDataTypes @@ -21789,7 +22337,7 @@ class TiTaxiiDataConnectorDataTypes(msrest.serialization.Model): def __init__( self, *, - taxii_client: "TiTaxiiDataConnectorDataTypesTaxiiClient", + taxii_client: "_models.TiTaxiiDataConnectorDataTypesTaxiiClient", **kwargs ): """ @@ -21806,8 +22354,8 @@ class TiTaxiiDataConnectorDataTypesTaxiiClient(DataConnectorDataTypeCommon): All required parameters must be populated in order to send to Azure. - :ivar state: Required. Describe whether this data type connection is enabled or not. Possible - values include: "Enabled", "Disabled". + :ivar state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :vartype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ @@ -21822,12 +22370,12 @@ class TiTaxiiDataConnectorDataTypesTaxiiClient(DataConnectorDataTypeCommon): def __init__( self, *, - state: Union[str, "DataTypeState"], + state: Union[str, "_models.DataTypeState"], **kwargs ): """ - :keyword state: Required. Describe whether this data type connection is enabled or not. - Possible values include: "Enabled", "Disabled". + :keyword state: Required. Describe whether this data type connection is enabled or not. Known + values are: "Enabled", "Disabled". :paramtype state: str or ~azure.mgmt.securityinsight.models.DataTypeState """ super(TiTaxiiDataConnectorDataTypesTaxiiClient, self).__init__(state=state, **kwargs) @@ -21854,8 +22402,8 @@ class TiTaxiiDataConnectorProperties(DataConnectorTenantId): :vartype password: str :ivar taxii_lookback_period: The lookback period for the TAXII server. :vartype taxii_lookback_period: ~datetime.datetime - :ivar polling_frequency: Required. The polling frequency for the TAXII server. Possible values - include: "OnceAMinute", "OnceAnHour", "OnceADay". + :ivar polling_frequency: Required. The polling frequency for the TAXII server. Known values + are: "OnceAMinute", "OnceAnHour", "OnceADay". :vartype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency :ivar data_types: Required. The available data types for Threat Intelligence TAXII data connector. @@ -21885,8 +22433,8 @@ def __init__( self, *, tenant_id: str, - polling_frequency: Union[str, "PollingFrequency"], - data_types: "TiTaxiiDataConnectorDataTypes", + polling_frequency: Union[str, "_models.PollingFrequency"], + data_types: "_models.TiTaxiiDataConnectorDataTypes", workspace_id: Optional[str] = None, friendly_name: Optional[str] = None, taxii_server: Optional[str] = None, @@ -21913,8 +22461,8 @@ def __init__( :paramtype password: str :keyword taxii_lookback_period: The lookback period for the TAXII server. :paramtype taxii_lookback_period: ~datetime.datetime - :keyword polling_frequency: Required. The polling frequency for the TAXII server. Possible - values include: "OnceAMinute", "OnceAnHour", "OnceADay". + :keyword polling_frequency: Required. The polling frequency for the TAXII server. Known values + are: "OnceAMinute", "OnceAnHour", "OnceADay". :paramtype polling_frequency: str or ~azure.mgmt.securityinsight.models.PollingFrequency :keyword data_types: Required. The available data types for Threat Intelligence TAXII data connector. @@ -21952,8 +22500,8 @@ class Ueba(Settings): :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData :ivar etag: Etag of the azure resource. :vartype etag: str - :ivar kind: Required. The kind of the setting.Constant filled by server. Possible values - include: "Anomalies", "EyesOn", "EntityAnalytics", "Ueba". + :ivar kind: Required. The kind of the setting.Constant filled by server. Known values are: + "Anomalies", "EyesOn", "EntityAnalytics", "Ueba". :vartype kind: str or ~azure.mgmt.securityinsight.models.SettingKind :ivar data_sources: The relevant data sources that enriched by ueba. :vartype data_sources: list[str or ~azure.mgmt.securityinsight.models.UebaDataSources] @@ -21981,7 +22529,7 @@ def __init__( self, *, etag: Optional[str] = None, - data_sources: Optional[List[Union[str, "UebaDataSources"]]] = None, + data_sources: Optional[List[Union[str, "_models.UebaDataSources"]]] = None, **kwargs ): """ @@ -22013,9 +22561,9 @@ class UrlEntity(Entity): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.securityinsight.models.SystemData - :ivar kind: Required. The kind of the entity.Constant filled by server. Possible values - include: "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", - "FileHash", "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", + :ivar kind: Required. The kind of the entity.Constant filled by server. Known values are: + "Account", "Host", "File", "AzureResource", "CloudApplication", "DnsResolution", "FileHash", + "Ip", "Malware", "Process", "RegistryKey", "RegistryValue", "SecurityGroup", "Url", "IoTDevice", "SecurityAlert", "Bookmark", "MailCluster", "MailMessage", "Mailbox", "SubmissionMail". :vartype kind: str or ~azure.mgmt.securityinsight.models.EntityKind @@ -22167,8 +22715,8 @@ class Watchlist(ResourceWithEtag): :vartype provider: str :ivar source: The filename of the watchlist, called 'source'. :vartype source: str - :ivar source_type: The sourceType of the watchlist. Possible values include: "Local file", - "Remote storage". + :ivar source_type: The sourceType of the watchlist. Known values are: "Local file", "Remote + storage". :vartype source_type: str or ~azure.mgmt.securityinsight.models.SourceType :ivar created: The time the watchlist was created. :vartype created: ~datetime.datetime @@ -22254,11 +22802,11 @@ def __init__( display_name: Optional[str] = None, provider: Optional[str] = None, source: Optional[str] = None, - source_type: Optional[Union[str, "SourceType"]] = None, + source_type: Optional[Union[str, "_models.SourceType"]] = None, created: Optional[datetime.datetime] = None, updated: Optional[datetime.datetime] = None, - created_by: Optional["UserInfo"] = None, - updated_by: Optional["UserInfo"] = None, + created_by: Optional["_models.UserInfo"] = None, + updated_by: Optional["_models.UserInfo"] = None, description: Optional[str] = None, watchlist_type: Optional[str] = None, watchlist_alias: Optional[str] = None, @@ -22284,8 +22832,8 @@ def __init__( :paramtype provider: str :keyword source: The filename of the watchlist, called 'source'. :paramtype source: str - :keyword source_type: The sourceType of the watchlist. Possible values include: "Local file", - "Remote storage". + :keyword source_type: The sourceType of the watchlist. Known values are: "Local file", "Remote + storage". :paramtype source_type: str or ~azure.mgmt.securityinsight.models.SourceType :keyword created: The time the watchlist was created. :paramtype created: ~datetime.datetime @@ -22385,9 +22933,9 @@ class WatchlistItem(ResourceWithEtag): :ivar updated_by: Describes a user that updated the watchlist item. :vartype updated_by: ~azure.mgmt.securityinsight.models.UserInfo :ivar items_key_value: key-value pairs for a watchlist item. - :vartype items_key_value: any + :vartype items_key_value: dict[str, any] :ivar entity_mapping: key-value pairs for a watchlist item entity mapping. - :vartype entity_mapping: any + :vartype entity_mapping: dict[str, any] """ _validation = { @@ -22411,8 +22959,8 @@ class WatchlistItem(ResourceWithEtag): 'updated': {'key': 'properties.updated', 'type': 'iso-8601'}, 'created_by': {'key': 'properties.createdBy', 'type': 'UserInfo'}, 'updated_by': {'key': 'properties.updatedBy', 'type': 'UserInfo'}, - 'items_key_value': {'key': 'properties.itemsKeyValue', 'type': 'object'}, - 'entity_mapping': {'key': 'properties.entityMapping', 'type': 'object'}, + 'items_key_value': {'key': 'properties.itemsKeyValue', 'type': '{object}'}, + 'entity_mapping': {'key': 'properties.entityMapping', 'type': '{object}'}, } def __init__( @@ -22425,10 +22973,10 @@ def __init__( is_deleted: Optional[bool] = None, created: Optional[datetime.datetime] = None, updated: Optional[datetime.datetime] = None, - created_by: Optional["UserInfo"] = None, - updated_by: Optional["UserInfo"] = None, - items_key_value: Optional[Any] = None, - entity_mapping: Optional[Any] = None, + created_by: Optional["_models.UserInfo"] = None, + updated_by: Optional["_models.UserInfo"] = None, + items_key_value: Optional[Dict[str, Any]] = None, + entity_mapping: Optional[Dict[str, Any]] = None, **kwargs ): """ @@ -22451,9 +22999,9 @@ def __init__( :keyword updated_by: Describes a user that updated the watchlist item. :paramtype updated_by: ~azure.mgmt.securityinsight.models.UserInfo :keyword items_key_value: key-value pairs for a watchlist item. - :paramtype items_key_value: any + :paramtype items_key_value: dict[str, any] :keyword entity_mapping: key-value pairs for a watchlist item entity mapping. - :paramtype entity_mapping: any + :paramtype entity_mapping: dict[str, any] """ super(WatchlistItem, self).__init__(etag=etag, **kwargs) self.watchlist_item_type = watchlist_item_type @@ -22494,7 +23042,7 @@ class WatchlistItemList(msrest.serialization.Model): def __init__( self, *, - value: List["WatchlistItem"], + value: List["_models.WatchlistItem"], **kwargs ): """ @@ -22532,7 +23080,7 @@ class WatchlistList(msrest.serialization.Model): def __init__( self, *, - value: List["Watchlist"], + value: List["_models.Watchlist"], **kwargs ): """ diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_patch.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ 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 0cfb692aef18..871339246ed0 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 @@ -7,12 +7,11 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the automation rule action +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the automation rule action. """ #: Modify an object's properties. @@ -20,7 +19,7 @@ class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Run a playbook on an object. RUN_PLAYBOOK = "RunPlaybook" -class AlertDetail(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AlertDetail(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Alert detail """ @@ -29,7 +28,7 @@ class AlertDetail(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Alert severity. SEVERITY = "Severity" -class AlertRuleKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AlertRuleKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the alert rule """ @@ -40,7 +39,7 @@ class AlertRuleKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): THREAT_INTELLIGENCE = "ThreatIntelligence" NRT = "NRT" -class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AlertSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The severity of the alert """ @@ -53,7 +52,7 @@ class AlertSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Informational severity. INFORMATIONAL = "Informational" -class AlertStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AlertStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The lifecycle status of the alert. """ @@ -68,7 +67,7 @@ class AlertStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Alert is being handled. IN_PROGRESS = "InProgress" -class AntispamMailDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AntispamMailDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The directionality of this mail message """ @@ -81,7 +80,7 @@ class AntispamMailDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Intraorg. INTRAORG = "Intraorg" -class AttackTactic(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AttackTactic(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The severity for alerts created by this alert rule. """ @@ -103,7 +102,39 @@ class AttackTactic(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): IMPAIR_PROCESS_CONTROL = "ImpairProcessControl" INHIBIT_RESPONSE_FUNCTION = "InhibitResponseFunction" -class AutomationRulePropertyConditionSupportedOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AutomationRulePropertyArrayChangedConditionSupportedArrayType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + #: Evaluate the condition on the alerts. + ALERTS = "Alerts" + #: Evaluate the condition on the labels. + LABELS = "Labels" + #: Evaluate the condition on the tactics. + TACTICS = "Tactics" + #: Evaluate the condition on the comments. + COMMENTS = "Comments" + +class AutomationRulePropertyArrayChangedConditionSupportedChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + #: Evaluate the condition on items added to the array. + ADDED = "Added" + +class AutomationRulePropertyChangedConditionSupportedChangedType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + #: Evaluate the condition on the previous value of the property. + CHANGED_FROM = "ChangedFrom" + #: Evaluate the condition on the updated value of the property. + CHANGED_TO = "ChangedTo" + +class AutomationRulePropertyChangedConditionSupportedPropertyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + #: Evaluate the condition on the incident severity. + INCIDENT_SEVERITY = "IncidentSeverity" + #: Evaluate the condition on the incident status. + INCIDENT_STATUS = "IncidentStatus" + #: Evaluate the condition on the incident owner. + INCIDENT_OWNER = "IncidentOwner" + +class AutomationRulePropertyConditionSupportedOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Evaluates if the property equals at least one of the condition values. EQUALS = "Equals" @@ -122,8 +153,8 @@ class AutomationRulePropertyConditionSupportedOperator(with_metaclass(CaseInsens #: Evaluates if the property does not end with any of the condition values. NOT_ENDS_WITH = "NotEndsWith" -class AutomationRulePropertyConditionSupportedProperty(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The property to evaluate in an automation rule property condition +class AutomationRulePropertyConditionSupportedProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The property to evaluate in an automation rule property condition. """ #: The title of the incident. @@ -235,12 +266,16 @@ class AutomationRulePropertyConditionSupportedProperty(with_metaclass(CaseInsens #: The url. URL = "Url" -class ConditionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConditionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Evaluate an object property value. PROPERTY = "Property" + #: Evaluate an object property changed value. + PROPERTY_CHANGED = "PropertyChanged" + #: Evaluate an object array property changed value. + PROPERTY_ARRAY_CHANGED = "PropertyArrayChanged" -class ConfidenceLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConfidenceLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The confidence level of this alert. """ @@ -251,7 +286,7 @@ class ConfidenceLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: High confidence that the alert is true positive malicious. HIGH = "High" -class ConfidenceScoreStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConfidenceScoreStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The confidence score calculation status, i.e. indicating if score calculation is pending for this alert, not applicable or final. """ @@ -266,7 +301,7 @@ class ConfidenceScoreStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Final score was calculated and available. FINAL = "Final" -class ConnectAuthKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectAuthKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The authentication kind used to poll the data """ @@ -274,20 +309,20 @@ class ConnectAuthKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): O_AUTH2 = "OAuth2" API_KEY = "APIKey" -class ConnectivityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectivityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """type of connectivity """ IS_CONNECTED_QUERY = "IsConnectedQuery" -class ContentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The content type of a source control path. """ ANALYTIC_RULE = "AnalyticRule" WORKBOOK = "Workbook" -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -296,20 +331,20 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class CustomEntityQueryKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CustomEntityQueryKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the entity query that supports put request. """ ACTIVITY = "Activity" -class DataConnectorAuthorizationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DataConnectorAuthorizationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the state of user's authorization for a connector kind. """ VALID = "Valid" INVALID = "Invalid" -class DataConnectorKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DataConnectorKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the data connector """ @@ -334,7 +369,7 @@ class DataConnectorKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): API_POLLING = "APIPolling" IOT = "IOT" -class DataConnectorLicenseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DataConnectorLicenseState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the state of user's license for a connector kind. """ @@ -342,14 +377,14 @@ class DataConnectorLicenseState(with_metaclass(CaseInsensitiveEnumMeta, str, Enu INVALID = "Invalid" UNKNOWN = "Unknown" -class DataTypeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DataTypeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describe whether this data type connection is enabled or not. """ ENABLED = "Enabled" DISABLED = "Disabled" -class DeliveryAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeliveryAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The delivery action of this mail message like Delivered, Blocked, Replaced etc """ @@ -364,7 +399,7 @@ class DeliveryAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Replaced. REPLACED = "Replaced" -class DeliveryLocation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeliveryLocation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The delivery location of this mail message like Inbox, JunkFolder etc """ @@ -387,7 +422,7 @@ class DeliveryLocation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Forwarded. FORWARDED = "Forwarded" -class DeploymentFetchStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentFetchStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status while trying to fetch the deployment information. """ @@ -395,7 +430,7 @@ class DeploymentFetchStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNAUTHORIZED = "Unauthorized" NOT_FOUND = "NotFound" -class DeploymentResult(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status while trying to fetch the deployment information. """ @@ -403,7 +438,7 @@ class DeploymentResult(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CANCELED = "Canceled" FAILED = "Failed" -class DeploymentState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current state of the deployment. """ @@ -412,7 +447,7 @@ class DeploymentState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): QUEUED = "Queued" CANCELING = "Canceling" -class ElevationToken(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ElevationToken(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The elevation token associated with the process. """ @@ -423,12 +458,12 @@ class ElevationToken(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Limited elevation token. LIMITED = "Limited" -class EntityItemQueryKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EntityItemQueryKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: insight. INSIGHT = "Insight" -class EntityKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EntityKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the entity """ @@ -475,7 +510,7 @@ class EntityKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Entity represents submission mail in the system. SUBMISSION_MAIL = "SubmissionMail" -class EntityMappingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EntityMappingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The V3 type of the mapped entity """ @@ -516,7 +551,14 @@ class EntityMappingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Submission mail entity type. SUBMISSION_MAIL = "SubmissionMail" -class EntityQueryKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EntityProviders(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The entity provider that is synced. + """ + + ACTIVE_DIRECTORY = "ActiveDirectory" + AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" + +class EntityQueryKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the entity query """ @@ -524,13 +566,13 @@ class EntityQueryKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INSIGHT = "Insight" ACTIVITY = "Activity" -class EntityQueryTemplateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EntityQueryTemplateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the entity query template. """ ACTIVITY = "Activity" -class EntityTimelineKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EntityTimelineKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The entity query kind """ @@ -540,8 +582,10 @@ class EntityTimelineKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): BOOKMARK = "Bookmark" #: security alerts. SECURITY_ALERT = "SecurityAlert" + #: anomaly. + ANOMALY = "Anomaly" -class EntityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EntityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the entity """ @@ -588,19 +632,19 @@ class EntityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Entity represents submission mail in the system. SUBMISSION_MAIL = "SubmissionMail" -class Enum12(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Enum13(str, Enum, metaclass=CaseInsensitiveEnumMeta): EXPANSION = "Expansion" ACTIVITY = "Activity" -class EventGroupingAggregationKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class EventGroupingAggregationKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The event grouping aggregation kinds """ SINGLE_ALERT = "SingleAlert" ALERT_PER_RESULT = "AlertPerResult" -class FileHashAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class FileHashAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The hash algorithm type. """ @@ -615,7 +659,13 @@ class FileHashAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: SHA256 Authenticode hash type. SHA256_AC = "SHA256AC" -class IncidentClassification(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GetInsightsError(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """the query kind + """ + + INSIGHT = "Insight" + +class IncidentClassification(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason the incident was closed """ @@ -628,7 +678,7 @@ class IncidentClassification(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: Incident was false positive. FALSE_POSITIVE = "FalsePositive" -class IncidentClassificationReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IncidentClassificationReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The classification reason the incident was closed with """ @@ -641,7 +691,7 @@ class IncidentClassificationReason(with_metaclass(CaseInsensitiveEnumMeta, str, #: Classification reason was inaccurate data. INACCURATE_DATA = "InaccurateData" -class IncidentLabelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IncidentLabelType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the label """ @@ -650,7 +700,7 @@ class IncidentLabelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Label automatically created by the system. AUTO_ASSIGNED = "AutoAssigned" -class IncidentSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IncidentSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The severity of the incident """ @@ -663,7 +713,7 @@ class IncidentSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Informational severity. INFORMATIONAL = "Informational" -class IncidentStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IncidentStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the incident """ @@ -674,7 +724,7 @@ class IncidentStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: A non-active incident. CLOSED = "Closed" -class KillChainIntent(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KillChainIntent(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Holds the alert intent stage(s) mapping for this alert. """ @@ -747,7 +797,7 @@ class KillChainIntent(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: manipulation and others. IMPACT = "Impact" -class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of content the metadata is for. """ @@ -769,7 +819,7 @@ class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LOGIC_APPS_CUSTOM_CONNECTOR = "LogicAppsCustomConnector" AUTOMATION_RULE = "AutomationRule" -class MatchingMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MatchingMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Grouping matching method. When method is Selected at least one of groupByEntities, groupByAlertDetails, groupByCustomDetails must be provided and not empty. """ @@ -782,7 +832,7 @@ class MatchingMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: details match. SELECTED = "Selected" -class MicrosoftSecurityProductName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MicrosoftSecurityProductName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The alerts' productName on which the cases will be generated """ @@ -794,14 +844,14 @@ class MicrosoftSecurityProductName(with_metaclass(CaseInsensitiveEnumMeta, str, OFFICE365_ADVANCED_THREAT_PROTECTION = "Office 365 Advanced Threat Protection" MICROSOFT_DEFENDER_ADVANCED_THREAT_PROTECTION = "Microsoft Defender Advanced Threat Protection" -class Operator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Operator(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Operator used for list of dependencies in criteria array. """ AND_ENUM = "AND" OR_ENUM = "OR" -class OSFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. """ @@ -816,7 +866,7 @@ class OSFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Host with Unknown operating system. UNKNOWN = "Unknown" -class OutputType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Insights Column type. """ @@ -825,7 +875,7 @@ class OutputType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DATE = "Date" ENTITY = "Entity" -class OwnerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OwnerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the owner the incident is assigned to. """ @@ -836,7 +886,7 @@ class OwnerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The incident owner type is an AAD group. GROUP = "Group" -class PermissionProviderScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PermissionProviderScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Permission provider scope """ @@ -844,7 +894,7 @@ class PermissionProviderScope(with_metaclass(CaseInsensitiveEnumMeta, str, Enum) SUBSCRIPTION = "Subscription" WORKSPACE = "Workspace" -class PollingFrequency(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PollingFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The polling frequency for the TAXII server. """ @@ -855,7 +905,7 @@ class PollingFrequency(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Once a day. ONCE_A_DAY = "OnceADay" -class ProviderName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProviderName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provider name """ @@ -866,7 +916,7 @@ class ProviderName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_OPERATIONAL_INSIGHTS_WORKSPACES_SHARED_KEYS = "Microsoft.OperationalInsights/workspaces/sharedKeys" MICROSOFT_AUTHORIZATION_POLICY_ASSIGNMENTS = "Microsoft.Authorization/policyAssignments" -class RegistryHive(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RegistryHive(str, Enum, metaclass=CaseInsensitiveEnumMeta): """the hive that holds the registry key. """ @@ -891,7 +941,7 @@ class RegistryHive(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: HKEY_CURRENT_USER. HKEY_CURRENT_USER = "HKEY_CURRENT_USER" -class RegistryValueKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RegistryValueKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the data types to use when storing values in the registry, or identifies the data type of a value in the registry. """ @@ -913,14 +963,20 @@ class RegistryValueKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: QWord value type. Q_WORD = "QWord" -class RepoType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RepoType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of repository. """ GITHUB = "Github" DEV_OPS = "DevOps" -class SettingKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SecurityMLAnalyticsSettingsKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of security ML analytics settings + """ + + ANOMALY = "Anomaly" + +class SettingKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the setting """ @@ -929,7 +985,16 @@ class SettingKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENTITY_ANALYTICS = "EntityAnalytics" UEBA = "Ueba" -class SettingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SettingsStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The anomaly SecurityMLAnalyticsSettings status + """ + + #: Anomaly settings status in Production mode. + PRODUCTION = "Production" + #: Anomaly settings status in Flighting mode. + FLIGHTING = "Flighting" + +class SettingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the setting """ @@ -937,14 +1002,7 @@ class SettingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INSTRUCTION_STEPS_GROUP = "InstructionStepsGroup" INFO_MESSAGE = "InfoMessage" -class SkuKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The kind of the tier - """ - - PER_GB = "PerGB" - CAPACITY_RESERVATION = "CapacityReservation" - -class SourceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Source type of the content """ @@ -953,14 +1011,14 @@ class SourceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SOLUTION = "Solution" SOURCE_REPOSITORY = "SourceRepository" -class SourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The sourceType of the watchlist """ LOCAL_FILE = "Local file" REMOTE_STORAGE = "Remote storage" -class SupportTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SupportTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of support for content item """ @@ -968,7 +1026,7 @@ class SupportTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PARTNER = "Partner" COMMUNITY = "Community" -class TemplateStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TemplateStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The alert rule template status. """ @@ -979,14 +1037,14 @@ class TemplateStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Alert rule template is not available. NOT_AVAILABLE = "NotAvailable" -class ThreatIntelligenceResourceKindEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ThreatIntelligenceResourceKindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the threat intelligence entity """ #: Entity represents threat intelligence indicator in the system. INDICATOR = "indicator" -class ThreatIntelligenceSortingCriteriaEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ThreatIntelligenceSortingCriteriaEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sorting order (ascending/descending/unsorted). """ @@ -994,7 +1052,7 @@ class ThreatIntelligenceSortingCriteriaEnum(with_metaclass(CaseInsensitiveEnumMe ASCENDING = "ascending" DESCENDING = "descending" -class TriggerOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TriggerOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation against the threshold that triggers alert rule. """ @@ -1003,17 +1061,19 @@ class TriggerOperator(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): EQUAL = "Equal" NOT_EQUAL = "NotEqual" -class TriggersOn(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TriggersOn(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Trigger on Incidents. INCIDENTS = "Incidents" -class TriggersWhen(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TriggersWhen(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Trigger on created objects. CREATED = "Created" + #: Trigger on updated objects. + UPDATED = "Updated" -class UebaDataSources(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UebaDataSources(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The data source that enriched by ueba. """ @@ -1022,7 +1082,7 @@ class UebaDataSources(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SECURITY_EVENT = "SecurityEvent" SIGNIN_LOGS = "SigninLogs" -class Version(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Version(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The version of the source control. """ 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 efbc70ef30fa..d72f9ec4f9b5 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 @@ -27,6 +27,7 @@ from ._metadata_operations import MetadataOperations from ._office_consents_operations import OfficeConsentsOperations from ._sentinel_onboarding_states_operations import SentinelOnboardingStatesOperations +from ._security_ml_analytics_settings_operations import SecurityMLAnalyticsSettingsOperations from ._product_settings_operations import ProductSettingsOperations from ._source_control_operations import SourceControlOperations from ._source_controls_operations import SourceControlsOperations @@ -39,6 +40,9 @@ from ._data_connectors_check_requirements_operations import DataConnectorsCheckRequirementsOperations from ._operations import Operations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AlertRulesOperations', 'ActionsOperations', @@ -61,6 +65,7 @@ 'MetadataOperations', 'OfficeConsentsOperations', 'SentinelOnboardingStatesOperations', + 'SecurityMLAnalyticsSettingsOperations', 'ProductSettingsOperations', 'SourceControlOperations', 'SourceControlsOperations', @@ -73,3 +78,5 @@ 'DataConnectorsCheckRequirementsOperations', 'Operations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file 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 00ef5d0ac0bb..a95662a8ecd7 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,10 +34,14 @@ def build_list_by_alert_rule_request( rule_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -45,21 +49,19 @@ def build_list_by_alert_rule_request( "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -72,10 +74,14 @@ def build_get_request( action_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -84,21 +90,19 @@ def build_get_request( "actionId": _SERIALIZER.url("action_id", action_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -110,16 +114,19 @@ def build_create_or_update_request( rule_id: str, action_id: str, *, - json: JSONType = None, + json: Optional[_models.ActionRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -128,23 +135,21 @@ def build_create_or_update_request( "actionId": _SERIALIZER.url("action_id", action_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -159,10 +164,14 @@ def build_delete_request( action_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -171,45 +180,41 @@ def build_delete_request( "actionId": _SERIALIZER.url("action_id", action_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class ActionsOperations(object): - """ActionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ActionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`actions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_by_alert_rule( @@ -218,7 +223,7 @@ def list_by_alert_rule( workspace_name: str, rule_id: str, **kwargs: Any - ) -> Iterable["_models.ActionsList"]: + ) -> Iterable[_models.ActionsList]: """Gets all actions of alert rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -232,11 +237,16 @@ 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"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ActionsList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -245,10 +255,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, rule_id=rule_id, + api_version=api_version, template_url=self.list_by_alert_rule.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -257,10 +270,13 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, rule_id=rule_id, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -274,7 +290,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -287,7 +307,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_alert_rule.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions'} # type: ignore + list_by_alert_rule.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions"} # type: ignore @distributed_trace def get( @@ -297,7 +317,7 @@ def get( rule_id: str, action_id: str, **kwargs: Any - ) -> "_models.ActionResponse": + ) -> _models.ActionResponse: """Gets the action of alert rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -313,11 +333,16 @@ def get( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ActionResponse] request = build_get_request( @@ -326,12 +351,19 @@ def get( workspace_name=workspace_name, rule_id=rule_id, action_id=action_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -345,7 +377,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}"} # type: ignore @distributed_trace @@ -355,9 +387,9 @@ def create_or_update( workspace_name: str, rule_id: str, action_id: str, - action: "_models.ActionRequest", + action: _models.ActionRequest, **kwargs: Any - ) -> "_models.ActionResponse": + ) -> _models.ActionResponse: """Creates or updates the action of alert rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -375,13 +407,17 @@ def create_or_update( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ActionResponse] _json = self._serialize.body(action, 'ActionRequest') @@ -391,14 +427,21 @@ def create_or_update( workspace_name=workspace_name, rule_id=rule_id, action_id=action_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -416,11 +459,11 @@ def create_or_update( 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 + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -443,11 +486,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -456,12 +504,19 @@ def delete( workspace_name=workspace_name, rule_id=rule_id, action_id=action_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -471,5 +526,5 @@ def delete( 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 + 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 354a59dd3e2b..f5aac1245e34 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,8 +16,8 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +33,33 @@ def build_list_request( workspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -68,10 +71,14 @@ def build_get_request( alert_rule_template_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -79,45 +86,41 @@ def build_get_request( "alertRuleTemplateId": _SERIALIZER.url("alert_rule_template_id", alert_rule_template_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class AlertRuleTemplatesOperations(object): - """AlertRuleTemplatesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AlertRuleTemplatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`alert_rule_templates` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -125,7 +128,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> Iterable["_models.AlertRuleTemplatesList"]: + ) -> Iterable[_models.AlertRuleTemplatesList]: """Gets all alert rule templates. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -138,11 +141,16 @@ 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"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AlertRuleTemplatesList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -150,10 +158,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -161,10 +172,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -178,7 +192,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -191,7 +209,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates"} # type: ignore @distributed_trace def get( @@ -200,7 +218,7 @@ def get( workspace_name: str, alert_rule_template_id: str, **kwargs: Any - ) -> "_models.AlertRuleTemplate": + ) -> _models.AlertRuleTemplate: """Gets the alert rule template. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -214,11 +232,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.AlertRuleTemplate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRuleTemplate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AlertRuleTemplate] request = build_get_request( @@ -226,12 +249,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, alert_rule_template_id=alert_rule_template_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -245,5 +275,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_alert_rules_operations.py index 3c7164fe0539..f291872f618d 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,31 +33,33 @@ def build_list_request( workspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -69,10 +71,14 @@ def build_get_request( rule_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -80,21 +86,19 @@ def build_get_request( "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -105,16 +109,19 @@ def build_create_or_update_request( workspace_name: str, rule_id: str, *, - json: JSONType = None, + json: Optional[_models.AlertRule] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -122,23 +129,21 @@ def build_create_or_update_request( "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -152,10 +157,14 @@ def build_delete_request( rule_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -163,45 +172,41 @@ def build_delete_request( "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class AlertRulesOperations(object): - """AlertRulesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AlertRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`alert_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -209,7 +214,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> Iterable["_models.AlertRulesList"]: + ) -> Iterable[_models.AlertRulesList]: """Gets all alert rules. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -221,11 +226,16 @@ 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"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AlertRulesList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -233,10 +243,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -244,10 +257,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -261,7 +277,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -274,7 +294,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules"} # type: ignore @distributed_trace def get( @@ -283,7 +303,7 @@ def get( workspace_name: str, rule_id: str, **kwargs: Any - ) -> "_models.AlertRule": + ) -> _models.AlertRule: """Gets the alert rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -297,11 +317,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.AlertRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AlertRule] request = build_get_request( @@ -309,12 +334,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, rule_id=rule_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -328,7 +360,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}"} # type: ignore @distributed_trace @@ -337,9 +369,9 @@ def create_or_update( resource_group_name: str, workspace_name: str, rule_id: str, - alert_rule: "_models.AlertRule", + alert_rule: _models.AlertRule, **kwargs: Any - ) -> "_models.AlertRule": + ) -> _models.AlertRule: """Creates or updates the alert rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -355,13 +387,17 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.AlertRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AlertRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AlertRule] _json = self._serialize.body(alert_rule, 'AlertRule') @@ -370,14 +406,21 @@ def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, rule_id=rule_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -395,11 +438,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -419,11 +462,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,12 +479,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, rule_id=rule_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -446,5 +501,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py index fb448400225d..78afb4958bc2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_automation_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,10 +34,14 @@ def build_get_request( automation_rule_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -45,21 +49,19 @@ def build_get_request( "automationRuleId": _SERIALIZER.url("automation_rule_id", automation_rule_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -70,16 +72,19 @@ def build_create_or_update_request( workspace_name: str, automation_rule_id: str, *, - json: JSONType = None, + json: Optional[_models.AutomationRule] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -87,23 +92,21 @@ def build_create_or_update_request( "automationRuleId": _SERIALIZER.url("automation_rule_id", automation_rule_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -117,10 +120,14 @@ def build_delete_request( automation_rule_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -128,21 +135,19 @@ def build_delete_request( "automationRuleId": _SERIALIZER.url("automation_rule_id", automation_rule_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -153,55 +158,55 @@ def build_list_request( workspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class AutomationRulesOperations(object): - """AutomationRulesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AutomationRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`automation_rules` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def get( @@ -210,7 +215,7 @@ def get( workspace_name: str, automation_rule_id: str, **kwargs: Any - ) -> "_models.AutomationRule": + ) -> _models.AutomationRule: """Gets the automation rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -224,11 +229,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.AutomationRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AutomationRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationRule] request = build_get_request( @@ -236,12 +246,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, automation_rule_id=automation_rule_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -255,7 +272,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}"} # type: ignore @distributed_trace @@ -264,9 +281,9 @@ def create_or_update( resource_group_name: str, workspace_name: str, automation_rule_id: str, - automation_rule_to_upsert: Optional["_models.AutomationRule"] = None, + automation_rule_to_upsert: Optional[_models.AutomationRule] = None, **kwargs: Any - ) -> "_models.AutomationRule": + ) -> _models.AutomationRule: """Creates or updates the automation rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -275,20 +292,24 @@ def create_or_update( :type workspace_name: str :param automation_rule_id: Automation rule ID. :type automation_rule_id: str - :param automation_rule_to_upsert: The automation rule. + :param automation_rule_to_upsert: The automation rule. Default value is None. :type automation_rule_to_upsert: ~azure.mgmt.securityinsight.models.AutomationRule :keyword callable cls: A custom type or function that will be passed the direct response :return: AutomationRule, or the result of cls(response) :rtype: ~azure.mgmt.securityinsight.models.AutomationRule :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AutomationRule"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationRule] if automation_rule_to_upsert is not None: _json = self._serialize.body(automation_rule_to_upsert, 'AutomationRule') @@ -300,14 +321,21 @@ def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, automation_rule_id=automation_rule_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -325,7 +353,7 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}"} # type: ignore @distributed_trace @@ -349,11 +377,16 @@ def delete( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Any] request = build_delete_request( @@ -361,12 +394,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, automation_rule_id=automation_rule_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -384,7 +424,7 @@ def delete( return deserialized - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}"} # type: ignore @distributed_trace @@ -393,7 +433,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> Iterable["_models.AutomationRulesList"]: + ) -> Iterable[_models.AutomationRulesList]: """Gets all automation rules. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -405,11 +445,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.AutomationRulesList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AutomationRulesList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationRulesList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -417,10 +462,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -428,10 +476,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -445,7 +496,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -458,4 +513,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py index aaddca55bc74..2eb6f19c2314 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -32,16 +32,19 @@ def build_expand_request( workspace_name: str, bookmark_id: str, *, - json: JSONType = None, + json: Optional[_models.BookmarkExpandParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/expand') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/expand") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -49,49 +52,45 @@ def build_expand_request( "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class BookmarkOperations(object): - """BookmarkOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class BookmarkOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`bookmark` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def expand( @@ -99,9 +98,9 @@ def expand( resource_group_name: str, workspace_name: str, bookmark_id: str, - parameters: "_models.BookmarkExpandParameters", + parameters: _models.BookmarkExpandParameters, **kwargs: Any - ) -> "_models.BookmarkExpandResponse": + ) -> _models.BookmarkExpandResponse: """Expand an bookmark. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -118,13 +117,17 @@ def expand( :rtype: ~azure.mgmt.securityinsight.models.BookmarkExpandResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BookmarkExpandResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.BookmarkExpandResponse] _json = self._serialize.body(parameters, 'BookmarkExpandParameters') @@ -133,14 +136,21 @@ def expand( resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.expand.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -154,5 +164,5 @@ def expand( return deserialized - expand.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/expand'} # type: ignore + expand.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/expand"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py index b32cb1b62e54..82028373c205 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_bookmark_relations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -39,10 +39,14 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -50,29 +54,27 @@ def build_list_request( "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if orderby is not None: - query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _params['$top'] = _SERIALIZER.query("top", top, 'int') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -85,10 +87,14 @@ def build_get_request( relation_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -97,21 +103,19 @@ def build_get_request( "relationName": _SERIALIZER.url("relation_name", relation_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -123,16 +127,19 @@ def build_create_or_update_request( bookmark_id: str, relation_name: str, *, - json: JSONType = None, + json: Optional[_models.Relation] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -141,23 +148,21 @@ def build_create_or_update_request( "relationName": _SERIALIZER.url("relation_name", relation_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -172,10 +177,14 @@ def build_delete_request( relation_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -184,45 +193,41 @@ def build_delete_request( "relationName": _SERIALIZER.url("relation_name", relation_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class BookmarkRelationsOperations(object): - """BookmarkRelationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class BookmarkRelationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`bookmark_relations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -235,7 +240,7 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RelationList"]: + ) -> Iterable[_models.RelationList]: """Gets all bookmark relations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -244,26 +249,33 @@ def list( :type workspace_name: str :param bookmark_id: Bookmark ID. :type bookmark_id: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RelationList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.RelationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RelationList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RelationList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -272,14 +284,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -288,14 +303,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -309,7 +327,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -322,7 +344,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations"} # type: ignore @distributed_trace def get( @@ -332,7 +354,7 @@ def get( bookmark_id: str, relation_name: str, **kwargs: Any - ) -> "_models.Relation": + ) -> _models.Relation: """Gets a bookmark relation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -348,11 +370,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.Relation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Relation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Relation] request = build_get_request( @@ -361,12 +388,19 @@ def get( workspace_name=workspace_name, bookmark_id=bookmark_id, relation_name=relation_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -380,7 +414,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}"} # type: ignore @distributed_trace @@ -390,9 +424,9 @@ def create_or_update( workspace_name: str, bookmark_id: str, relation_name: str, - relation: "_models.Relation", + relation: _models.Relation, **kwargs: Any - ) -> "_models.Relation": + ) -> _models.Relation: """Creates the bookmark relation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -410,13 +444,17 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Relation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Relation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Relation] _json = self._serialize.body(relation, 'Relation') @@ -426,14 +464,21 @@ def create_or_update( workspace_name=workspace_name, bookmark_id=bookmark_id, relation_name=relation_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -451,11 +496,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -478,11 +523,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -491,12 +541,19 @@ def delete( workspace_name=workspace_name, bookmark_id=bookmark_id, relation_name=relation_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -506,5 +563,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}"} # 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 b01107ed6433..d95aa3794445 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,31 +33,33 @@ def build_list_request( workspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -69,10 +71,14 @@ def build_get_request( bookmark_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -80,21 +86,19 @@ def build_get_request( "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -105,16 +109,19 @@ def build_create_or_update_request( workspace_name: str, bookmark_id: str, *, - json: JSONType = None, + json: Optional[_models.Bookmark] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -122,23 +129,21 @@ def build_create_or_update_request( "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -152,10 +157,14 @@ def build_delete_request( bookmark_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -163,45 +172,41 @@ def build_delete_request( "bookmarkId": _SERIALIZER.url("bookmark_id", bookmark_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class BookmarksOperations(object): - """BookmarksOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class BookmarksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`bookmarks` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -209,7 +214,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> Iterable["_models.BookmarkList"]: + ) -> Iterable[_models.BookmarkList]: """Gets all bookmarks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -221,11 +226,16 @@ 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"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.BookmarkList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -233,10 +243,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -244,10 +257,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -261,7 +277,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -274,7 +294,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks"} # type: ignore @distributed_trace def get( @@ -283,7 +303,7 @@ def get( workspace_name: str, bookmark_id: str, **kwargs: Any - ) -> "_models.Bookmark": + ) -> _models.Bookmark: """Gets a bookmark. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -297,11 +317,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.Bookmark :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Bookmark"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Bookmark] request = build_get_request( @@ -309,12 +334,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -328,7 +360,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}"} # type: ignore @distributed_trace @@ -337,9 +369,9 @@ def create_or_update( resource_group_name: str, workspace_name: str, bookmark_id: str, - bookmark: "_models.Bookmark", + bookmark: _models.Bookmark, **kwargs: Any - ) -> "_models.Bookmark": + ) -> _models.Bookmark: """Creates or updates the bookmark. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -355,13 +387,17 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Bookmark :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Bookmark"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Bookmark] _json = self._serialize.body(bookmark, 'Bookmark') @@ -370,14 +406,21 @@ def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -395,11 +438,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -419,11 +462,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,12 +479,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, bookmark_id=bookmark_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -446,5 +501,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py index 14bb524776cc..eab1c4a4c393 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_check_requirements_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,74 +31,73 @@ def build_post_request( resource_group_name: str, workspace_name: str, *, - json: JSONType = None, + json: Optional[_models.DataConnectorsCheckRequirements] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorsCheckRequirements') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorsCheckRequirements") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class DataConnectorsCheckRequirementsOperations(object): - """DataConnectorsCheckRequirementsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class DataConnectorsCheckRequirementsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`data_connectors_check_requirements` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def post( self, resource_group_name: str, workspace_name: str, - data_connectors_check_requirements: "_models.DataConnectorsCheckRequirements", + data_connectors_check_requirements: _models.DataConnectorsCheckRequirements, **kwargs: Any - ) -> "_models.DataConnectorRequirementsState": + ) -> _models.DataConnectorRequirementsState: """Get requirements state for a data connector type. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -113,13 +112,17 @@ def post( :rtype: ~azure.mgmt.securityinsight.models.DataConnectorRequirementsState :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectorRequirementsState"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataConnectorRequirementsState] _json = self._serialize.body(data_connectors_check_requirements, 'DataConnectorsCheckRequirements') @@ -127,14 +130,21 @@ def post( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -148,5 +158,5 @@ def post( return deserialized - post.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorsCheckRequirements'} # type: ignore + post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorsCheckRequirements"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_data_connectors_operations.py index 34a2ddb5d1fa..796f9a74f26b 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,31 +33,33 @@ def build_list_request( workspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -69,10 +71,14 @@ def build_get_request( data_connector_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -80,21 +86,19 @@ def build_get_request( "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -105,16 +109,19 @@ def build_create_or_update_request( workspace_name: str, data_connector_id: str, *, - json: JSONType = None, + json: Optional[_models.DataConnector] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -122,23 +129,21 @@ def build_create_or_update_request( "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -152,10 +157,14 @@ def build_delete_request( data_connector_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -163,21 +172,19 @@ def build_delete_request( "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -188,16 +195,19 @@ def build_connect_request( workspace_name: str, data_connector_id: str, *, - json: JSONType = None, + json: Optional[_models.DataConnectorConnectBody] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/connect') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/connect") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -205,23 +215,21 @@ def build_connect_request( "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -235,10 +243,14 @@ def build_disconnect_request( data_connector_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/disconnect') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/disconnect") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -246,45 +258,41 @@ def build_disconnect_request( "dataConnectorId": _SERIALIZER.url("data_connector_id", data_connector_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class DataConnectorsOperations(object): - """DataConnectorsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class DataConnectorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`data_connectors` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -292,7 +300,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> Iterable["_models.DataConnectorList"]: + ) -> Iterable[_models.DataConnectorList]: """Gets all data connectors. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -304,11 +312,16 @@ 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"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataConnectorList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -316,10 +329,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -327,10 +343,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -344,7 +363,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -357,7 +380,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors"} # type: ignore @distributed_trace def get( @@ -366,7 +389,7 @@ def get( workspace_name: str, data_connector_id: str, **kwargs: Any - ) -> "_models.DataConnector": + ) -> _models.DataConnector: """Gets a data connector. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -380,11 +403,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.DataConnector :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnector"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataConnector] request = build_get_request( @@ -392,12 +420,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, data_connector_id=data_connector_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -411,7 +446,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}"} # type: ignore @distributed_trace @@ -420,9 +455,9 @@ def create_or_update( resource_group_name: str, workspace_name: str, data_connector_id: str, - data_connector: "_models.DataConnector", + data_connector: _models.DataConnector, **kwargs: Any - ) -> "_models.DataConnector": + ) -> _models.DataConnector: """Creates or updates the data connector. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -438,13 +473,17 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.DataConnector :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnector"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.DataConnector] _json = self._serialize.body(data_connector, 'DataConnector') @@ -453,14 +492,21 @@ def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, data_connector_id=data_connector_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -478,11 +524,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -502,11 +548,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -514,12 +565,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, data_connector_id=data_connector_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -529,16 +587,16 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}"} # type: ignore @distributed_trace - def connect( + def connect( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, data_connector_id: str, - connect_body: "_models.DataConnectorConnectBody", + connect_body: _models.DataConnectorConnectBody, **kwargs: Any ) -> None: """Connects a data connector. @@ -556,13 +614,17 @@ def connect( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(connect_body, 'DataConnectorConnectBody') @@ -571,14 +633,21 @@ def connect( resource_group_name=resource_group_name, workspace_name=workspace_name, data_connector_id=data_connector_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.connect.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -588,11 +657,11 @@ def connect( if cls: return cls(pipeline_response, None, {}) - connect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/connect'} # type: ignore + connect.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/connect"} # type: ignore @distributed_trace - def disconnect( + def disconnect( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -612,11 +681,16 @@ def disconnect( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_disconnect_request( @@ -624,12 +698,19 @@ def disconnect( resource_group_name=resource_group_name, workspace_name=workspace_name, data_connector_id=data_connector_id, + api_version=api_version, template_url=self.disconnect.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -639,5 +720,5 @@ def disconnect( if cls: return cls(pipeline_response, None, {}) - disconnect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/disconnect'} # type: ignore + disconnect.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/disconnect"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py index 676cf58be8a8..16567554ad99 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_domain_whois_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,55 +33,55 @@ def build_get_request( domain: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/domain/whois/') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/domain/whois/") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - query_parameters['domain'] = _SERIALIZER.query("domain", domain, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['domain'] = _SERIALIZER.query("domain", domain, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class DomainWhoisOperations(object): - """DomainWhoisOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class DomainWhoisOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`domain_whois` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def get( @@ -88,7 +89,7 @@ def get( resource_group_name: str, domain: str, **kwargs: Any - ) -> "_models.EnrichmentDomainWhois": + ) -> _models.EnrichmentDomainWhois: """Get whois information for a single domain name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -100,23 +101,35 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.EnrichmentDomainWhois :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnrichmentDomainWhois"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EnrichmentDomainWhois] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, domain=domain, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,5 +143,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/domain/whois/'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/domain/whois/"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py index 4da418ba23cf..4a59eb8909de 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_get_timeline_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -32,16 +32,19 @@ def build_list_request( workspace_name: str, entity_id: str, *, - json: JSONType = None, + json: Optional[_models.EntityTimelineParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getTimeline') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getTimeline") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -49,49 +52,45 @@ def build_list_request( "entityId": _SERIALIZER.url("entity_id", entity_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class EntitiesGetTimelineOperations(object): - """EntitiesGetTimelineOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class EntitiesGetTimelineOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`entities_get_timeline` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -99,9 +98,9 @@ def list( resource_group_name: str, workspace_name: str, entity_id: str, - parameters: "_models.EntityTimelineParameters", + parameters: _models.EntityTimelineParameters, **kwargs: Any - ) -> "_models.EntityTimelineResponse": + ) -> _models.EntityTimelineResponse: """Timeline for an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -118,13 +117,17 @@ def list( :rtype: ~azure.mgmt.securityinsight.models.EntityTimelineResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityTimelineResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityTimelineResponse] _json = self._serialize.body(parameters, 'EntityTimelineParameters') @@ -133,14 +136,21 @@ def list( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -154,5 +164,5 @@ def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getTimeline'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getTimeline"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py index f4f24dc3637a..4a1c5bdbecaf 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,31 +33,33 @@ def build_list_request( workspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -69,10 +71,14 @@ def build_get_request( entity_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -80,21 +86,19 @@ def build_get_request( "entityId": _SERIALIZER.url("entity_id", entity_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -105,16 +109,19 @@ def build_expand_request( workspace_name: str, entity_id: str, *, - json: JSONType = None, + json: Optional[_models.EntityExpandParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/expand') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/expand") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -122,23 +129,21 @@ def build_expand_request( "entityId": _SERIALIZER.url("entity_id", entity_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,10 +159,14 @@ def build_queries_request( kind: Union[str, "_models.EntityItemQueryKind"], **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/queries') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/queries") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -165,22 +174,20 @@ def build_queries_request( "entityId": _SERIALIZER.url("entity_id", entity_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - query_parameters['kind'] = _SERIALIZER.query("kind", kind, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['kind'] = _SERIALIZER.query("kind", kind, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -191,16 +198,19 @@ def build_get_insights_request( workspace_name: str, entity_id: str, *, - json: JSONType = None, + json: Optional[_models.EntityGetInsightsParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getInsights') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getInsights") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -208,49 +218,45 @@ def build_get_insights_request( "entityId": _SERIALIZER.url("entity_id", entity_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class EntitiesOperations(object): - """EntitiesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class EntitiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`entities` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -258,7 +264,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> Iterable["_models.EntityList"]: + ) -> Iterable[_models.EntityList]: """Gets all entities. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -270,11 +276,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.EntityList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -282,10 +293,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -293,10 +307,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -310,7 +327,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -323,7 +344,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities"} # type: ignore @distributed_trace def get( @@ -332,7 +353,7 @@ def get( workspace_name: str, entity_id: str, **kwargs: Any - ) -> "_models.Entity": + ) -> _models.Entity: """Gets an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -346,11 +367,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.Entity :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Entity"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Entity] request = build_get_request( @@ -358,12 +384,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -377,7 +410,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}"} # type: ignore @distributed_trace @@ -386,9 +419,9 @@ def expand( resource_group_name: str, workspace_name: str, entity_id: str, - parameters: "_models.EntityExpandParameters", + parameters: _models.EntityExpandParameters, **kwargs: Any - ) -> "_models.EntityExpandResponse": + ) -> _models.EntityExpandResponse: """Expands an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -404,13 +437,17 @@ def expand( :rtype: ~azure.mgmt.securityinsight.models.EntityExpandResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityExpandResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityExpandResponse] _json = self._serialize.body(parameters, 'EntityExpandParameters') @@ -419,14 +456,21 @@ def expand( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.expand.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -440,7 +484,7 @@ def expand( return deserialized - expand.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/expand'} # type: ignore + expand.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/expand"} # type: ignore @distributed_trace @@ -451,7 +495,7 @@ def queries( entity_id: str, kind: Union[str, "_models.EntityItemQueryKind"], **kwargs: Any - ) -> "_models.GetQueriesResponse": + ) -> _models.GetQueriesResponse: """Get Insights and Activities for an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -467,11 +511,16 @@ def queries( :rtype: ~azure.mgmt.securityinsight.models.GetQueriesResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GetQueriesResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.GetQueriesResponse] request = build_queries_request( @@ -479,13 +528,20 @@ def queries( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, kind=kind, template_url=self.queries.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -499,7 +555,7 @@ def queries( return deserialized - queries.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/queries'} # type: ignore + queries.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/queries"} # type: ignore @distributed_trace @@ -508,9 +564,9 @@ def get_insights( resource_group_name: str, workspace_name: str, entity_id: str, - parameters: "_models.EntityGetInsightsParameters", + parameters: _models.EntityGetInsightsParameters, **kwargs: Any - ) -> "_models.EntityGetInsightsResponse": + ) -> _models.EntityGetInsightsResponse: """Execute Insights for an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -526,13 +582,17 @@ def get_insights( :rtype: ~azure.mgmt.securityinsight.models.EntityGetInsightsResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityGetInsightsResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityGetInsightsResponse] _json = self._serialize.body(parameters, 'EntityGetInsightsParameters') @@ -541,14 +601,21 @@ def get_insights( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.get_insights.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -562,5 +629,5 @@ def get_insights( return deserialized - get_insights.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getInsights'} # type: ignore + get_insights.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getInsights"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py index 898c408c51b6..cf4cb6876b53 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entities_relations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,8 +16,8 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,10 +39,14 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -49,53 +54,49 @@ def build_list_request( "entityId": _SERIALIZER.url("entity_id", entity_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if orderby is not None: - query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _params['$top'] = _SERIALIZER.query("top", top, 'int') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class EntitiesRelationsOperations(object): - """EntitiesRelationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class EntitiesRelationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`entities_relations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -108,7 +109,7 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RelationList"]: + ) -> Iterable[_models.RelationList]: """Gets all relations of an entity. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -117,26 +118,33 @@ def list( :type workspace_name: str :param entity_id: entity ID. :type entity_id: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RelationList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.RelationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RelationList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RelationList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -145,14 +153,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -161,14 +172,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, entity_id=entity_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -182,7 +196,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -195,4 +213,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py index b51ff365430e..7702a60db748 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_queries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -32,36 +32,38 @@ def build_list_request( resource_group_name: str, workspace_name: str, *, - kind: Optional[Union[str, "_models.Enum12"]] = None, + kind: Optional[Union[str, "_models.Enum13"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if kind is not None: - query_parameters['kind'] = _SERIALIZER.query("kind", kind, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['kind'] = _SERIALIZER.query("kind", kind, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -73,10 +75,14 @@ def build_get_request( entity_query_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -84,21 +90,19 @@ def build_get_request( "entityQueryId": _SERIALIZER.url("entity_query_id", entity_query_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -109,16 +113,19 @@ def build_create_or_update_request( workspace_name: str, entity_query_id: str, *, - json: JSONType = None, + json: Optional[_models.CustomEntityQuery] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -126,23 +133,21 @@ def build_create_or_update_request( "entityQueryId": _SERIALIZER.url("entity_query_id", entity_query_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,10 +161,14 @@ def build_delete_request( entity_query_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -167,72 +176,73 @@ def build_delete_request( "entityQueryId": _SERIALIZER.url("entity_query_id", entity_query_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class EntityQueriesOperations(object): - """EntityQueriesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class EntityQueriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`entity_queries` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, resource_group_name: str, workspace_name: str, - kind: Optional[Union[str, "_models.Enum12"]] = None, + kind: Optional[Union[str, "_models.Enum13"]] = None, **kwargs: Any - ) -> Iterable["_models.EntityQueryList"]: + ) -> Iterable[_models.EntityQueryList]: """Gets all entity queries. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param kind: The entity query kind we want to fetch. - :type kind: str or ~azure.mgmt.securityinsight.models.Enum12 + :param kind: The entity query kind we want to fetch. Default value is None. + :type kind: str or ~azure.mgmt.securityinsight.models.Enum13 :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EntityQueryList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.EntityQueryList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityQueryList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityQueryList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -240,11 +250,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, kind=kind, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -252,11 +265,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, kind=kind, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -270,7 +286,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -283,7 +303,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries"} # type: ignore @distributed_trace def get( @@ -292,7 +312,7 @@ def get( workspace_name: str, entity_query_id: str, **kwargs: Any - ) -> "_models.EntityQuery": + ) -> _models.EntityQuery: """Gets an entity query. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -306,11 +326,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.EntityQuery :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityQuery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityQuery] request = build_get_request( @@ -318,12 +343,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_query_id=entity_query_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -337,7 +369,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}"} # type: ignore @distributed_trace @@ -346,9 +378,9 @@ def create_or_update( resource_group_name: str, workspace_name: str, entity_query_id: str, - entity_query: "_models.CustomEntityQuery", + entity_query: _models.CustomEntityQuery, **kwargs: Any - ) -> "_models.EntityQuery": + ) -> _models.EntityQuery: """Creates or updates the entity query. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -364,13 +396,17 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.EntityQuery :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityQuery"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityQuery] _json = self._serialize.body(entity_query, 'CustomEntityQuery') @@ -379,14 +415,21 @@ def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_query_id=entity_query_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -404,11 +447,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -428,11 +471,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -440,12 +488,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_query_id=entity_query_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -455,5 +510,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py index fb4339511615..6e7c72672f5f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_query_templates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,8 +16,8 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,33 +35,35 @@ def build_list_request( kind: Optional[str] = "Activity", **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if kind is not None: - query_parameters['kind'] = _SERIALIZER.query("kind", kind, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['kind'] = _SERIALIZER.query("kind", kind, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -72,10 +75,14 @@ def build_get_request( entity_query_template_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates/{entityQueryTemplateId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates/{entityQueryTemplateId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -83,45 +90,41 @@ def build_get_request( "entityQueryTemplateId": _SERIALIZER.url("entity_query_template_id", entity_query_template_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class EntityQueryTemplatesOperations(object): - """EntityQueryTemplatesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class EntityQueryTemplatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`entity_query_templates` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -130,14 +133,15 @@ def list( workspace_name: str, kind: Optional[str] = "Activity", **kwargs: Any - ) -> Iterable["_models.EntityQueryTemplateList"]: + ) -> Iterable[_models.EntityQueryTemplateList]: """Gets all entity query templates. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param kind: The entity template query kind we want to fetch. The default value is "Activity". + :param kind: The entity template query kind we want to fetch. Known values are "Activity" or + None. Default value is "Activity". :type kind: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either EntityQueryTemplateList or the result of @@ -146,11 +150,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.EntityQueryTemplateList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityQueryTemplateList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityQueryTemplateList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,11 +167,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, kind=kind, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -170,11 +182,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, kind=kind, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +203,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -201,7 +220,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates"} # type: ignore @distributed_trace def get( @@ -210,7 +229,7 @@ def get( workspace_name: str, entity_query_template_id: str, **kwargs: Any - ) -> "_models.EntityQueryTemplate": + ) -> _models.EntityQueryTemplate: """Gets an entity query. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -224,11 +243,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.EntityQueryTemplate :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EntityQueryTemplate"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EntityQueryTemplate] request = build_get_request( @@ -236,12 +260,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, entity_query_template_id=entity_query_template_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -255,5 +286,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates/{entityQueryTemplateId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueryTemplates/{entityQueryTemplateId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py index 51792ecc83f3..24601b7ef3ca 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_entity_relations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +34,14 @@ def build_get_relation_request( relation_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations/{relationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations/{relationName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -45,45 +50,41 @@ def build_get_relation_request( "relationName": _SERIALIZER.url("relation_name", relation_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class EntityRelationsOperations(object): - """EntityRelationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class EntityRelationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`entity_relations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def get_relation( @@ -93,7 +94,7 @@ def get_relation( entity_id: str, relation_name: str, **kwargs: Any - ) -> "_models.Relation": + ) -> _models.Relation: """Gets an entity relation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -109,11 +110,16 @@ def get_relation( :rtype: ~azure.mgmt.securityinsight.models.Relation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Relation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Relation] request = build_get_relation_request( @@ -122,12 +128,19 @@ def get_relation( workspace_name=workspace_name, entity_id=entity_id, relation_name=relation_name, + api_version=api_version, template_url=self.get_relation.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -141,5 +154,5 @@ def get_relation( return deserialized - get_relation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations/{relationName}'} # type: ignore + get_relation.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations/{relationName}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_comments_operations.py index f2b2677b2daf..370aac6be38a 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -39,10 +39,14 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -50,29 +54,27 @@ def build_list_request( "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if orderby is not None: - query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _params['$top'] = _SERIALIZER.query("top", top, 'int') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -85,10 +87,14 @@ def build_get_request( incident_comment_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -97,21 +103,19 @@ def build_get_request( "incidentCommentId": _SERIALIZER.url("incident_comment_id", incident_comment_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -123,16 +127,19 @@ def build_create_or_update_request( incident_id: str, incident_comment_id: str, *, - json: JSONType = None, + json: Optional[_models.IncidentComment] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -141,23 +148,21 @@ def build_create_or_update_request( "incidentCommentId": _SERIALIZER.url("incident_comment_id", incident_comment_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -172,10 +177,14 @@ def build_delete_request( incident_comment_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -184,45 +193,41 @@ def build_delete_request( "incidentCommentId": _SERIALIZER.url("incident_comment_id", incident_comment_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class IncidentCommentsOperations(object): - """IncidentCommentsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class IncidentCommentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`incident_comments` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -235,7 +240,7 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.IncidentCommentList"]: + ) -> Iterable[_models.IncidentCommentList]: """Gets all incident comments. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -244,26 +249,33 @@ def list( :type workspace_name: str :param incident_id: Incident ID. :type incident_id: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IncidentCommentList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.IncidentCommentList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentCommentList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentCommentList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -272,14 +284,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -288,14 +303,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -309,7 +327,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -322,7 +344,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments"} # type: ignore @distributed_trace def get( @@ -332,7 +354,7 @@ def get( incident_id: str, incident_comment_id: str, **kwargs: Any - ) -> "_models.IncidentComment": + ) -> _models.IncidentComment: """Gets an incident comment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -348,11 +370,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.IncidentComment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentComment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentComment] request = build_get_request( @@ -361,12 +388,19 @@ def get( workspace_name=workspace_name, incident_id=incident_id, incident_comment_id=incident_comment_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -380,7 +414,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}"} # type: ignore @distributed_trace @@ -390,9 +424,9 @@ def create_or_update( workspace_name: str, incident_id: str, incident_comment_id: str, - incident_comment: "_models.IncidentComment", + incident_comment: _models.IncidentComment, **kwargs: Any - ) -> "_models.IncidentComment": + ) -> _models.IncidentComment: """Creates or updates the incident comment. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -410,13 +444,17 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.IncidentComment :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentComment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentComment] _json = self._serialize.body(incident_comment, 'IncidentComment') @@ -426,14 +464,21 @@ def create_or_update( workspace_name=workspace_name, incident_id=incident_id, incident_comment_id=incident_comment_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -451,11 +496,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -478,11 +523,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -491,12 +541,19 @@ def delete( workspace_name=workspace_name, incident_id=incident_id, incident_comment_id=incident_comment_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -506,5 +563,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py index 0fc16b710278..d351ad6f04c0 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incident_relations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -39,10 +39,14 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -50,29 +54,27 @@ def build_list_request( "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if orderby is not None: - query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _params['$top'] = _SERIALIZER.query("top", top, 'int') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -85,10 +87,14 @@ def build_get_request( relation_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -97,21 +103,19 @@ def build_get_request( "relationName": _SERIALIZER.url("relation_name", relation_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -123,16 +127,19 @@ def build_create_or_update_request( incident_id: str, relation_name: str, *, - json: JSONType = None, + json: Optional[_models.Relation] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -141,23 +148,21 @@ def build_create_or_update_request( "relationName": _SERIALIZER.url("relation_name", relation_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -172,10 +177,14 @@ def build_delete_request( relation_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -184,45 +193,41 @@ def build_delete_request( "relationName": _SERIALIZER.url("relation_name", relation_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class IncidentRelationsOperations(object): - """IncidentRelationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class IncidentRelationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`incident_relations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -235,7 +240,7 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RelationList"]: + ) -> Iterable[_models.RelationList]: """Gets all incident relations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -244,26 +249,33 @@ def list( :type workspace_name: str :param incident_id: Incident ID. :type incident_id: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RelationList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.RelationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RelationList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RelationList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -272,14 +284,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -288,14 +303,17 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -309,7 +327,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -322,7 +344,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations"} # type: ignore @distributed_trace def get( @@ -332,7 +354,7 @@ def get( incident_id: str, relation_name: str, **kwargs: Any - ) -> "_models.Relation": + ) -> _models.Relation: """Gets an incident relation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -348,11 +370,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.Relation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Relation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Relation] request = build_get_request( @@ -361,12 +388,19 @@ def get( workspace_name=workspace_name, incident_id=incident_id, relation_name=relation_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -380,7 +414,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}"} # type: ignore @distributed_trace @@ -390,9 +424,9 @@ def create_or_update( workspace_name: str, incident_id: str, relation_name: str, - relation: "_models.Relation", + relation: _models.Relation, **kwargs: Any - ) -> "_models.Relation": + ) -> _models.Relation: """Creates or updates the incident relation. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -410,13 +444,17 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Relation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Relation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Relation] _json = self._serialize.body(relation, 'Relation') @@ -426,14 +464,21 @@ def create_or_update( workspace_name=workspace_name, incident_id=incident_id, relation_name=relation_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -451,11 +496,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -478,11 +523,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -491,12 +541,19 @@ def delete( workspace_name=workspace_name, incident_id=incident_id, relation_name=relation_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -506,5 +563,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/relations/{relationName}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_incidents_operations.py index 7020c3d063b6..855b8424d5cf 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,16 +33,19 @@ def build_run_playbook_request( workspace_name: str, incident_identifier: str, *, - json: JSONType = None, + json: Optional[_models.ManualTriggerRequestBody] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentIdentifier}/runPlaybook') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentIdentifier}/runPlaybook") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -50,23 +53,21 @@ def build_run_playbook_request( "incidentIdentifier": _SERIALIZER.url("incident_identifier", incident_identifier, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -84,39 +85,41 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if orderby is not None: - query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _params['$top'] = _SERIALIZER.query("top", top, 'int') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -128,10 +131,14 @@ def build_get_request( incident_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -139,21 +146,19 @@ def build_get_request( "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -164,16 +169,19 @@ def build_create_or_update_request( workspace_name: str, incident_id: str, *, - json: JSONType = None, + json: Optional[_models.Incident] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -181,23 +189,21 @@ def build_create_or_update_request( "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -211,10 +217,14 @@ def build_delete_request( incident_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -222,21 +232,19 @@ def build_delete_request( "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -247,16 +255,19 @@ def build_create_team_request( workspace_name: str, incident_id: str, *, - json: JSONType = None, + json: Optional[_models.TeamProperties] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/createTeam') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/createTeam") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -264,23 +275,21 @@ def build_create_team_request( "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -294,10 +303,14 @@ def build_list_alerts_request( incident_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/alerts') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/alerts") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -305,21 +318,19 @@ def build_list_alerts_request( "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -331,10 +342,14 @@ def build_list_bookmarks_request( incident_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/bookmarks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/bookmarks") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -342,21 +357,19 @@ def build_list_bookmarks_request( "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -368,10 +381,14 @@ def build_list_entities_request( incident_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/entities') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/entities") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -379,45 +396,41 @@ def build_list_entities_request( "incidentId": _SERIALIZER.url("incident_id", incident_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class IncidentsOperations(object): - """IncidentsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class IncidentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`incidents` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def run_playbook( @@ -425,7 +438,7 @@ def run_playbook( resource_group_name: str, workspace_name: str, incident_identifier: str, - request_body: Optional["_models.ManualTriggerRequestBody"] = None, + request_body: Optional[_models.ManualTriggerRequestBody] = None, **kwargs: Any ) -> Any: """Triggers playbook on a specific incident. @@ -436,20 +449,24 @@ def run_playbook( :type workspace_name: str :param incident_identifier: :type incident_identifier: str - :param request_body: + :param request_body: Default value is None. :type request_body: ~azure.mgmt.securityinsight.models.ManualTriggerRequestBody :keyword callable cls: A custom type or function that will be passed the direct response :return: any, or the result of cls(response) :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Any] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Any] if request_body is not None: _json = self._serialize.body(request_body, 'ManualTriggerRequestBody') @@ -461,14 +478,21 @@ def run_playbook( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_identifier=incident_identifier, + api_version=api_version, content_type=content_type, json=_json, template_url=self.run_playbook.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -482,7 +506,7 @@ def run_playbook( return deserialized - run_playbook.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentIdentifier}/runPlaybook'} # type: ignore + run_playbook.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentIdentifier}/runPlaybook"} # type: ignore @distributed_trace @@ -495,33 +519,40 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.IncidentList"]: + ) -> Iterable[_models.IncidentList]: """Gets all incidents. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either IncidentList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.IncidentList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -529,14 +560,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -544,14 +578,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -565,7 +602,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -578,7 +619,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents"} # type: ignore @distributed_trace def get( @@ -587,7 +628,7 @@ def get( workspace_name: str, incident_id: str, **kwargs: Any - ) -> "_models.Incident": + ) -> _models.Incident: """Gets an incident. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -601,11 +642,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.Incident :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Incident"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Incident] request = build_get_request( @@ -613,12 +659,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -632,7 +685,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}"} # type: ignore @distributed_trace @@ -641,9 +694,9 @@ def create_or_update( resource_group_name: str, workspace_name: str, incident_id: str, - incident: "_models.Incident", + incident: _models.Incident, **kwargs: Any - ) -> "_models.Incident": + ) -> _models.Incident: """Creates or updates the incident. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -659,13 +712,17 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Incident :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Incident"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Incident] _json = self._serialize.body(incident, 'Incident') @@ -674,14 +731,21 @@ def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -699,11 +763,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -723,11 +787,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -735,12 +804,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -750,7 +826,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}"} # type: ignore @distributed_trace @@ -759,9 +835,9 @@ def create_team( resource_group_name: str, workspace_name: str, incident_id: str, - team_properties: "_models.TeamProperties", + team_properties: _models.TeamProperties, **kwargs: Any - ) -> "_models.TeamInformation": + ) -> _models.TeamInformation: """Creates a Microsoft team to investigate the incident by sharing information and insights between participants. @@ -778,13 +854,17 @@ def create_team( :rtype: ~azure.mgmt.securityinsight.models.TeamInformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TeamInformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TeamInformation] _json = self._serialize.body(team_properties, 'TeamProperties') @@ -793,14 +873,21 @@ def create_team( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_team.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -814,7 +901,7 @@ def create_team( return deserialized - create_team.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/createTeam'} # type: ignore + create_team.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/createTeam"} # type: ignore @distributed_trace @@ -824,7 +911,7 @@ def list_alerts( workspace_name: str, incident_id: str, **kwargs: Any - ) -> "_models.IncidentAlertList": + ) -> _models.IncidentAlertList: """Gets all incident alerts. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -838,11 +925,16 @@ def list_alerts( :rtype: ~azure.mgmt.securityinsight.models.IncidentAlertList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentAlertList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentAlertList] request = build_list_alerts_request( @@ -850,12 +942,19 @@ def list_alerts( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, template_url=self.list_alerts.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -869,7 +968,7 @@ def list_alerts( return deserialized - list_alerts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/alerts'} # type: ignore + list_alerts.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/alerts"} # type: ignore @distributed_trace @@ -879,7 +978,7 @@ def list_bookmarks( workspace_name: str, incident_id: str, **kwargs: Any - ) -> "_models.IncidentBookmarkList": + ) -> _models.IncidentBookmarkList: """Gets all incident bookmarks. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -893,11 +992,16 @@ def list_bookmarks( :rtype: ~azure.mgmt.securityinsight.models.IncidentBookmarkList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentBookmarkList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentBookmarkList] request = build_list_bookmarks_request( @@ -905,12 +1009,19 @@ def list_bookmarks( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, template_url=self.list_bookmarks.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -924,7 +1035,7 @@ def list_bookmarks( return deserialized - list_bookmarks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/bookmarks'} # type: ignore + list_bookmarks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/bookmarks"} # type: ignore @distributed_trace @@ -934,7 +1045,7 @@ def list_entities( workspace_name: str, incident_id: str, **kwargs: Any - ) -> "_models.IncidentEntitiesResponse": + ) -> _models.IncidentEntitiesResponse: """Gets all incident related entities. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -948,11 +1059,16 @@ def list_entities( :rtype: ~azure.mgmt.securityinsight.models.IncidentEntitiesResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IncidentEntitiesResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.IncidentEntitiesResponse] request = build_list_entities_request( @@ -960,12 +1076,19 @@ def list_entities( resource_group_name=resource_group_name, workspace_name=workspace_name, incident_id=incident_id, + api_version=api_version, template_url=self.list_entities.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -979,5 +1102,5 @@ def list_entities( return deserialized - list_entities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/entities'} # type: ignore + list_entities.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/entities"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py index c6c0166e2246..5d32fe794e84 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_ip_geodata_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,55 +33,55 @@ def build_get_request( ip_address: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/ip/geodata/') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/ip/geodata/") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - query_parameters['ipAddress'] = _SERIALIZER.query("ip_address", ip_address, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['ipAddress'] = _SERIALIZER.query("ip_address", ip_address, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class IPGeodataOperations(object): - """IPGeodataOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class IPGeodataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`ip_geodata` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def get( @@ -88,7 +89,7 @@ def get( resource_group_name: str, ip_address: str, **kwargs: Any - ) -> "_models.EnrichmentIpGeodata": + ) -> _models.EnrichmentIpGeodata: """Get geodata for a single IP address. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -100,23 +101,35 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.EnrichmentIpGeodata :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.EnrichmentIpGeodata"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.EnrichmentIpGeodata] request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, ip_address=ip_address, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,5 +143,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/ip/geodata/'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/ip/geodata/"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py index 9d382342c203..fd6481b68bc7 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_metadata_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -38,39 +38,41 @@ def build_list_request( skip: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if orderby is not None: - query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _params['$top'] = _SERIALIZER.query("top", top, 'int') if skip is not None: - query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int') + _params['$skip'] = _SERIALIZER.query("skip", skip, 'int') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -82,10 +84,14 @@ def build_get_request( metadata_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -93,21 +99,19 @@ def build_get_request( "metadataName": _SERIALIZER.url("metadata_name", metadata_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -119,10 +123,14 @@ def build_delete_request( metadata_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -130,21 +138,19 @@ def build_delete_request( "metadataName": _SERIALIZER.url("metadata_name", metadata_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -155,16 +161,19 @@ def build_create_request( workspace_name: str, metadata_name: str, *, - json: JSONType = None, + json: Optional[_models.MetadataModel] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -172,23 +181,21 @@ def build_create_request( "metadataName": _SERIALIZER.url("metadata_name", metadata_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -201,16 +208,19 @@ def build_update_request( workspace_name: str, metadata_name: str, *, - json: JSONType = None, + json: Optional[_models.MetadataPatch] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -218,49 +228,45 @@ def build_update_request( "metadataName": _SERIALIZER.url("metadata_name", metadata_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class MetadataOperations(object): - """MetadataOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`metadata` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -272,32 +278,38 @@ def list( top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.MetadataList"]: + ) -> Iterable[_models.MetadataList]: """List of all metadata. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip: Used to skip n elements in the OData query (offset). Returns a nextLink to the - next page of results if there are any left. + next page of results if there are any left. Default value is None. :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MetadataList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.MetadataList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MetadataList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -305,14 +317,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip=skip, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -320,14 +335,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip=skip, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -341,7 +359,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -354,7 +376,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata"} # type: ignore @distributed_trace def get( @@ -363,7 +385,7 @@ def get( workspace_name: str, metadata_name: str, **kwargs: Any - ) -> "_models.MetadataModel": + ) -> _models.MetadataModel: """Get a Metadata. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -377,11 +399,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.MetadataModel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataModel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MetadataModel] request = build_get_request( @@ -389,12 +416,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, metadata_name=metadata_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -408,11 +442,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -432,11 +466,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -444,12 +483,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, metadata_name=metadata_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -459,7 +505,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}"} # type: ignore @distributed_trace @@ -468,9 +514,9 @@ def create( resource_group_name: str, workspace_name: str, metadata_name: str, - metadata: "_models.MetadataModel", + metadata: _models.MetadataModel, **kwargs: Any - ) -> "_models.MetadataModel": + ) -> _models.MetadataModel: """Create a Metadata. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -486,13 +532,17 @@ def create( :rtype: ~azure.mgmt.securityinsight.models.MetadataModel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataModel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MetadataModel] _json = self._serialize.body(metadata, 'MetadataModel') @@ -501,14 +551,21 @@ def create( resource_group_name=resource_group_name, workspace_name=workspace_name, metadata_name=metadata_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -526,7 +583,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}"} # type: ignore @distributed_trace @@ -535,9 +592,9 @@ def update( resource_group_name: str, workspace_name: str, metadata_name: str, - metadata_patch: "_models.MetadataPatch", + metadata_patch: _models.MetadataPatch, **kwargs: Any - ) -> "_models.MetadataModel": + ) -> _models.MetadataModel: """Update an existing Metadata. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -553,13 +610,17 @@ def update( :rtype: ~azure.mgmt.securityinsight.models.MetadataModel :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MetadataModel"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MetadataModel] _json = self._serialize.body(metadata_patch, 'MetadataPatch') @@ -568,14 +629,21 @@ def update( resource_group_name=resource_group_name, workspace_name=workspace_name, metadata_name=metadata_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -589,5 +657,5 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py index 3ee6ace19cfb..7612164c991f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_office_consents_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,8 +16,8 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +33,33 @@ def build_list_request( workspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -68,10 +71,14 @@ def build_get_request( consent_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -79,21 +86,19 @@ def build_get_request( "consentId": _SERIALIZER.url("consent_id", consent_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -105,10 +110,14 @@ def build_delete_request( consent_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -116,45 +125,41 @@ def build_delete_request( "consentId": _SERIALIZER.url("consent_id", consent_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class OfficeConsentsOperations(object): - """OfficeConsentsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class OfficeConsentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`office_consents` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -162,7 +167,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> Iterable["_models.OfficeConsentList"]: + ) -> Iterable[_models.OfficeConsentList]: """Gets all office365 consents. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -174,11 +179,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.OfficeConsentList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OfficeConsentList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OfficeConsentList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -186,10 +196,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -197,10 +210,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -214,7 +230,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -227,7 +247,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents"} # type: ignore @distributed_trace def get( @@ -236,7 +256,7 @@ def get( workspace_name: str, consent_id: str, **kwargs: Any - ) -> "_models.OfficeConsent": + ) -> _models.OfficeConsent: """Gets an office365 consent. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -250,11 +270,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.OfficeConsent :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OfficeConsent"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OfficeConsent] request = build_get_request( @@ -262,12 +287,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, consent_id=consent_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -281,11 +313,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -305,11 +337,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -317,12 +354,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, consent_id=consent_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -332,5 +376,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_operations.py index 9e9091290da3..19863283c922 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,8 +16,8 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,54 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.SecurityInsights/operations') + _url = kwargs.pop("template_url", "/providers/Microsoft.SecurityInsights/operations") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationsList"]: + ) -> 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 @@ -84,27 +85,38 @@ 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"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationsList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -118,7 +130,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -131,4 +147,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.SecurityInsights/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.SecurityInsights/operations"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_patch.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py index ab81a9ddbd5a..694ed97374e5 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_product_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -32,31 +32,33 @@ def build_list_request( workspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -68,10 +70,14 @@ def build_get_request( settings_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -79,21 +85,19 @@ def build_get_request( "settingsName": _SERIALIZER.url("settings_name", settings_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -105,10 +109,14 @@ def build_delete_request( settings_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -116,21 +124,19 @@ def build_delete_request( "settingsName": _SERIALIZER.url("settings_name", settings_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -141,16 +147,19 @@ def build_update_request( workspace_name: str, settings_name: str, *, - json: JSONType = None, + json: Optional[_models.Settings] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -158,49 +167,45 @@ def build_update_request( "settingsName": _SERIALIZER.url("settings_name", settings_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ProductSettingsOperations(object): - """ProductSettingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ProductSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`product_settings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -208,7 +213,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> "_models.SettingList": + ) -> _models.SettingList: """List of all the settings. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -220,23 +225,35 @@ def list( :rtype: ~azure.mgmt.securityinsight.models.SettingList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SettingList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SettingList] request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -250,7 +267,7 @@ def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings"} # type: ignore @distributed_trace @@ -260,7 +277,7 @@ def get( workspace_name: str, settings_name: str, **kwargs: Any - ) -> "_models.Settings": + ) -> _models.Settings: """Gets a setting. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -274,11 +291,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.Settings :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Settings"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Settings] request = build_get_request( @@ -286,12 +308,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, settings_name=settings_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -305,11 +334,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -329,11 +358,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -341,12 +375,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, settings_name=settings_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -356,7 +397,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}"} # type: ignore @distributed_trace @@ -365,9 +406,9 @@ def update( resource_group_name: str, workspace_name: str, settings_name: str, - settings: "_models.Settings", + settings: _models.Settings, **kwargs: Any - ) -> "_models.Settings": + ) -> _models.Settings: """Updates setting. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -383,13 +424,17 @@ def update( :rtype: ~azure.mgmt.securityinsight.models.Settings :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Settings"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Settings] _json = self._serialize.body(settings, 'Settings') @@ -398,14 +443,21 @@ def update( resource_group_name=resource_group_name, workspace_name=workspace_name, settings_name=settings_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -419,5 +471,5 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_security_ml_analytics_settings_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_security_ml_analytics_settings_operations.py new file mode 100644 index 000000000000..a6197f5af17d --- /dev/null +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_security_ml_analytics_settings_operations.py @@ -0,0 +1,508 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + settings_resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings/{settingsResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "settingsResourceName": _SERIALIZER.url("settings_resource_name", settings_resource_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + settings_resource_name: str, + *, + json: Optional[_models.SecurityMLAnalyticsSetting] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings/{settingsResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "settingsResourceName": _SERIALIZER.url("settings_resource_name", settings_resource_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + settings_resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings/{settingsResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), + "settingsResourceName": _SERIALIZER.url("settings_resource_name", settings_resource_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class SecurityMLAnalyticsSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`security_ml_analytics_settings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable[_models.SecurityMLAnalyticsSettingsList]: + """Gets all Security ML Analytics Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityMLAnalyticsSettingsList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSettingsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityMLAnalyticsSettingsList] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityMLAnalyticsSettingsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + workspace_name: str, + settings_resource_name: str, + **kwargs: Any + ) -> _models.SecurityMLAnalyticsSetting: + """Gets the Security ML Analytics Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param settings_resource_name: Security ML Analytics Settings resource name. + :type settings_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityMLAnalyticsSetting, or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSetting + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityMLAnalyticsSetting] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + settings_resource_name=settings_resource_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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('SecurityMLAnalyticsSetting', 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/securityMLAnalyticsSettings/{settingsResourceName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + settings_resource_name: str, + security_ml_analytics_setting: _models.SecurityMLAnalyticsSetting, + **kwargs: Any + ) -> _models.SecurityMLAnalyticsSetting: + """Creates or updates the Security ML Analytics Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param settings_resource_name: Security ML Analytics Settings resource name. + :type settings_resource_name: str + :param security_ml_analytics_setting: The security ML Analytics setting. + :type security_ml_analytics_setting: + ~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSetting + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityMLAnalyticsSetting, or the result of cls(response) + :rtype: ~azure.mgmt.securityinsight.models.SecurityMLAnalyticsSetting + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityMLAnalyticsSetting] + + _json = self._serialize.body(security_ml_analytics_setting, 'SecurityMLAnalyticsSetting') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + settings_resource_name=settings_resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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('SecurityMLAnalyticsSetting', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SecurityMLAnalyticsSetting', 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/securityMLAnalyticsSettings/{settingsResourceName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + settings_resource_name: str, + **kwargs: Any + ) -> None: + """Delete the Security ML Analytics Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param settings_resource_name: Security ML Analytics Settings resource name. + :type settings_resource_name: 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 + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + settings_resource_name=settings_resource_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + 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/securityMLAnalyticsSettings/{settingsResourceName}"} # type: ignore + diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py index 5a34592c2104..268f0da07f5f 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_sentinel_onboarding_states_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,10 +33,14 @@ def build_get_request( sentinel_onboarding_state_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -44,21 +48,19 @@ def build_get_request( "sentinelOnboardingStateName": _SERIALIZER.url("sentinel_onboarding_state_name", sentinel_onboarding_state_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -69,16 +71,19 @@ def build_create_request( workspace_name: str, sentinel_onboarding_state_name: str, *, - json: JSONType = None, + json: Optional[_models.SentinelOnboardingState] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -86,23 +91,21 @@ def build_create_request( "sentinelOnboardingStateName": _SERIALIZER.url("sentinel_onboarding_state_name", sentinel_onboarding_state_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -116,10 +119,14 @@ def build_delete_request( sentinel_onboarding_state_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -127,21 +134,19 @@ def build_delete_request( "sentinelOnboardingStateName": _SERIALIZER.url("sentinel_onboarding_state_name", sentinel_onboarding_state_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -152,55 +157,55 @@ def build_list_request( workspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class SentinelOnboardingStatesOperations(object): - """SentinelOnboardingStatesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SentinelOnboardingStatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`sentinel_onboarding_states` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def get( @@ -209,7 +214,7 @@ def get( workspace_name: str, sentinel_onboarding_state_name: str, **kwargs: Any - ) -> "_models.SentinelOnboardingState": + ) -> _models.SentinelOnboardingState: """Get Sentinel onboarding state. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -223,11 +228,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.SentinelOnboardingState :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SentinelOnboardingState"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SentinelOnboardingState] request = build_get_request( @@ -235,12 +245,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, sentinel_onboarding_state_name=sentinel_onboarding_state_name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -254,7 +271,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}"} # type: ignore @distributed_trace @@ -263,9 +280,9 @@ def create( resource_group_name: str, workspace_name: str, sentinel_onboarding_state_name: str, - sentinel_onboarding_state_parameter: Optional["_models.SentinelOnboardingState"] = None, + sentinel_onboarding_state_parameter: Optional[_models.SentinelOnboardingState] = None, **kwargs: Any - ) -> "_models.SentinelOnboardingState": + ) -> _models.SentinelOnboardingState: """Create Sentinel onboarding state. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -274,7 +291,8 @@ def create( :type workspace_name: str :param sentinel_onboarding_state_name: The Sentinel onboarding state name. Supports - default. :type sentinel_onboarding_state_name: str - :param sentinel_onboarding_state_parameter: The Sentinel onboarding state parameter. + :param sentinel_onboarding_state_parameter: The Sentinel onboarding state parameter. Default + value is None. :type sentinel_onboarding_state_parameter: ~azure.mgmt.securityinsight.models.SentinelOnboardingState :keyword callable cls: A custom type or function that will be passed the direct response @@ -282,13 +300,17 @@ def create( :rtype: ~azure.mgmt.securityinsight.models.SentinelOnboardingState :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SentinelOnboardingState"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SentinelOnboardingState] if sentinel_onboarding_state_parameter is not None: _json = self._serialize.body(sentinel_onboarding_state_parameter, 'SentinelOnboardingState') @@ -300,14 +322,21 @@ def create( resource_group_name=resource_group_name, workspace_name=workspace_name, sentinel_onboarding_state_name=sentinel_onboarding_state_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -325,11 +354,11 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -349,11 +378,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -361,12 +395,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, sentinel_onboarding_state_name=sentinel_onboarding_state_name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -376,7 +417,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates/{sentinelOnboardingStateName}"} # type: ignore @distributed_trace @@ -385,7 +426,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> "_models.SentinelOnboardingStatesList": + ) -> _models.SentinelOnboardingStatesList: """Gets all Sentinel onboarding states. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -397,23 +438,35 @@ def list( :rtype: ~azure.mgmt.securityinsight.models.SentinelOnboardingStatesList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SentinelOnboardingStatesList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SentinelOnboardingStatesList] request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -427,5 +480,5 @@ def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/onboardingStates"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py index 9cf418d75cbf..ff9897c9eda6 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_control_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -32,65 +32,64 @@ def build_list_repositories_request( resource_group_name: str, workspace_name: str, *, - json: JSONType = None, + json: Any = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/listRepositories') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/listRepositories") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class SourceControlOperations(object): - """SourceControlOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SourceControlOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`source_control` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list_repositories( @@ -99,7 +98,7 @@ def list_repositories( workspace_name: str, repo_type: Union[str, "_models.RepoType"], **kwargs: Any - ) -> Iterable["_models.RepoList"]: + ) -> Iterable[_models.RepoList]: """Gets a list of repositories metadata. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -113,13 +112,17 @@ def list_repositories( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.RepoList] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RepoList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RepoList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: _json = self._serialize.body(repo_type, 'str') @@ -128,12 +131,15 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.list_repositories.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: _json = self._serialize.body(repo_type, 'str') @@ -142,12 +148,15 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -161,7 +170,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -174,4 +187,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_repositories.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/listRepositories'} # type: ignore + list_repositories.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/listRepositories"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py index b65534263623..d41c73acfbd8 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_source_controls_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,31 +33,33 @@ def build_list_request( workspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -69,10 +71,14 @@ def build_get_request( source_control_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -80,21 +86,19 @@ def build_get_request( "sourceControlId": _SERIALIZER.url("source_control_id", source_control_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -106,10 +110,14 @@ def build_delete_request( source_control_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -117,21 +125,19 @@ def build_delete_request( "sourceControlId": _SERIALIZER.url("source_control_id", source_control_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -142,16 +148,19 @@ def build_create_request( workspace_name: str, source_control_id: str, *, - json: JSONType = None, + json: Optional[_models.SourceControl] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -159,49 +168,45 @@ def build_create_request( "sourceControlId": _SERIALIZER.url("source_control_id", source_control_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class SourceControlsOperations(object): - """SourceControlsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SourceControlsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`source_controls` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -209,7 +214,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> Iterable["_models.SourceControlList"]: + ) -> Iterable[_models.SourceControlList]: """Gets all source controls, without source control items. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -221,11 +226,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.SourceControlList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -233,10 +243,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -244,10 +257,13 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -261,7 +277,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -274,7 +294,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols"} # type: ignore @distributed_trace def get( @@ -283,7 +303,7 @@ def get( workspace_name: str, source_control_id: str, **kwargs: Any - ) -> "_models.SourceControl": + ) -> _models.SourceControl: """Gets a source control byt its identifier. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -297,11 +317,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.SourceControl :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] request = build_get_request( @@ -309,12 +334,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, source_control_id=source_control_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -328,11 +360,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -352,11 +384,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -364,12 +401,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, source_control_id=source_control_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -379,7 +423,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}"} # type: ignore @distributed_trace @@ -388,9 +432,9 @@ def create( resource_group_name: str, workspace_name: str, source_control_id: str, - source_control: "_models.SourceControl", + source_control: _models.SourceControl, **kwargs: Any - ) -> "_models.SourceControl": + ) -> _models.SourceControl: """Creates a source control. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -406,13 +450,17 @@ def create( :rtype: ~azure.mgmt.securityinsight.models.SourceControl :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl] _json = self._serialize.body(source_control, 'SourceControl') @@ -421,14 +469,21 @@ def create( resource_group_name=resource_group_name, workspace_name=workspace_name, source_control_id=source_control_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -446,5 +501,5 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py index b76ae48228e3..ec78f5f4e51c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_metrics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,55 +32,55 @@ def build_list_request( workspace_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/metrics') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/metrics") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class ThreatIntelligenceIndicatorMetricsOperations(object): - """ThreatIntelligenceIndicatorMetricsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ThreatIntelligenceIndicatorMetricsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`threat_intelligence_indicator_metrics` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -87,7 +88,7 @@ def list( resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> "_models.ThreatIntelligenceMetricsList": + ) -> _models.ThreatIntelligenceMetricsList: """Get threat intelligence indicators metrics (Indicators counts by Type, Threat Type, Source). :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -99,23 +100,35 @@ def list( :rtype: ~azure.mgmt.securityinsight.models.ThreatIntelligenceMetricsList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceMetricsList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceMetricsList] request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -129,5 +142,5 @@ def list( return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/metrics'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/metrics"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py index 8508565fb26e..de308cf1391b 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicator_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -32,39 +32,40 @@ def build_create_indicator_request( resource_group_name: str, workspace_name: str, *, - json: JSONType = None, + json: Optional[_models.ThreatIntelligenceIndicatorModel] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/createIndicator') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/createIndicator") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,10 +79,14 @@ def build_get_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -89,21 +94,19 @@ def build_get_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -114,16 +117,19 @@ def build_create_request( workspace_name: str, name: str, *, - json: JSONType = None, + json: Optional[_models.ThreatIntelligenceIndicatorModel] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -131,23 +137,21 @@ def build_create_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -161,10 +165,14 @@ def build_delete_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -172,21 +180,19 @@ def build_delete_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -196,39 +202,40 @@ def build_query_indicators_request( resource_group_name: str, workspace_name: str, *, - json: JSONType = None, + json: Optional[_models.ThreatIntelligenceFilteringCriteria] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/queryIndicators') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/queryIndicators") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -241,16 +248,19 @@ def build_append_tags_request( workspace_name: str, name: str, *, - json: JSONType = None, + json: Optional[_models.ThreatIntelligenceAppendTags] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/appendTags') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/appendTags") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -258,23 +268,21 @@ def build_append_tags_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -287,16 +295,19 @@ def build_replace_tags_request( workspace_name: str, name: str, *, - json: JSONType = None, + json: Optional[_models.ThreatIntelligenceIndicatorModel] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/replaceTags') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/replaceTags") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -304,58 +315,54 @@ def build_replace_tags_request( "name": _SERIALIZER.url("name", name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ThreatIntelligenceIndicatorOperations(object): - """ThreatIntelligenceIndicatorOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ThreatIntelligenceIndicatorOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`threat_intelligence_indicator` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def create_indicator( self, resource_group_name: str, workspace_name: str, - threat_intelligence_properties: "_models.ThreatIntelligenceIndicatorModel", + threat_intelligence_properties: _models.ThreatIntelligenceIndicatorModel, **kwargs: Any - ) -> "_models.ThreatIntelligenceInformation": + ) -> _models.ThreatIntelligenceInformation: """Create a new threat intelligence indicator. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -371,13 +378,17 @@ def create_indicator( :rtype: ~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformation] _json = self._serialize.body(threat_intelligence_properties, 'ThreatIntelligenceIndicatorModel') @@ -385,14 +396,21 @@ def create_indicator( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_indicator.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -410,7 +428,7 @@ def create_indicator( return deserialized - create_indicator.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/createIndicator'} # type: ignore + create_indicator.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/createIndicator"} # type: ignore @distributed_trace @@ -420,7 +438,7 @@ def get( workspace_name: str, name: str, **kwargs: Any - ) -> "_models.ThreatIntelligenceInformation": + ) -> _models.ThreatIntelligenceInformation: """View a threat intelligence indicator by name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -434,11 +452,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformation] request = build_get_request( @@ -446,12 +469,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -465,7 +495,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}"} # type: ignore @distributed_trace @@ -474,9 +504,9 @@ def create( resource_group_name: str, workspace_name: str, name: str, - threat_intelligence_properties: "_models.ThreatIntelligenceIndicatorModel", + threat_intelligence_properties: _models.ThreatIntelligenceIndicatorModel, **kwargs: Any - ) -> "_models.ThreatIntelligenceInformation": + ) -> _models.ThreatIntelligenceInformation: """Update a threat Intelligence indicator. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -494,13 +524,17 @@ def create( :rtype: ~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformation] _json = self._serialize.body(threat_intelligence_properties, 'ThreatIntelligenceIndicatorModel') @@ -509,14 +543,21 @@ def create( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -534,11 +575,11 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -558,11 +599,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -570,12 +616,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -585,7 +638,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}"} # type: ignore @distributed_trace @@ -593,9 +646,9 @@ def query_indicators( self, resource_group_name: str, workspace_name: str, - threat_intelligence_filtering_criteria: "_models.ThreatIntelligenceFilteringCriteria", + threat_intelligence_filtering_criteria: _models.ThreatIntelligenceFilteringCriteria, **kwargs: Any - ) -> Iterable["_models.ThreatIntelligenceInformationList"]: + ) -> Iterable[_models.ThreatIntelligenceInformationList]: """Query threat intelligence indicators as per filtering criteria. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -613,13 +666,17 @@ def query_indicators( ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.ThreatIntelligenceInformationList] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformationList] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: _json = self._serialize.body(threat_intelligence_filtering_criteria, 'ThreatIntelligenceFilteringCriteria') @@ -628,12 +685,15 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.query_indicators.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: _json = self._serialize.body(threat_intelligence_filtering_criteria, 'ThreatIntelligenceFilteringCriteria') @@ -642,12 +702,15 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, content_type=content_type, json=_json, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -661,7 +724,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -674,15 +741,15 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - query_indicators.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/queryIndicators'} # type: ignore + query_indicators.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/queryIndicators"} # type: ignore @distributed_trace - def append_tags( + def append_tags( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, - threat_intelligence_append_tags: "_models.ThreatIntelligenceAppendTags", + threat_intelligence_append_tags: _models.ThreatIntelligenceAppendTags, **kwargs: Any ) -> None: """Append tags to a threat intelligence indicator. @@ -701,13 +768,17 @@ def append_tags( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(threat_intelligence_append_tags, 'ThreatIntelligenceAppendTags') @@ -716,14 +787,21 @@ def append_tags( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.append_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -733,7 +811,7 @@ def append_tags( if cls: return cls(pipeline_response, None, {}) - append_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/appendTags'} # type: ignore + append_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/appendTags"} # type: ignore @distributed_trace @@ -742,9 +820,9 @@ def replace_tags( resource_group_name: str, workspace_name: str, name: str, - threat_intelligence_replace_tags: "_models.ThreatIntelligenceIndicatorModel", + threat_intelligence_replace_tags: _models.ThreatIntelligenceIndicatorModel, **kwargs: Any - ) -> "_models.ThreatIntelligenceInformation": + ) -> _models.ThreatIntelligenceInformation: """Replace tags added to a threat intelligence indicator. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -762,13 +840,17 @@ def replace_tags( :rtype: ~azure.mgmt.securityinsight.models.ThreatIntelligenceInformation :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformation"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformation] _json = self._serialize.body(threat_intelligence_replace_tags, 'ThreatIntelligenceIndicatorModel') @@ -777,14 +859,21 @@ def replace_tags( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.replace_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -798,5 +887,5 @@ def replace_tags( return deserialized - replace_tags.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/replaceTags'} # type: ignore + replace_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators/{name}/replaceTags"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py index 7bd02dedd690..cffdffce74b2 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_threat_intelligence_indicators_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,8 +16,8 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,63 +38,63 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if orderby is not None: - query_parameters['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _params['$top'] = _SERIALIZER.query("top", top, 'int') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) -class ThreatIntelligenceIndicatorsOperations(object): - """ThreatIntelligenceIndicatorsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ThreatIntelligenceIndicatorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`threat_intelligence_indicators` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -105,22 +106,24 @@ def list( top: Optional[int] = None, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.ThreatIntelligenceInformationList"]: + ) -> Iterable[_models.ThreatIntelligenceInformationList]: """Get all threat intelligence indicators. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param filter: Filters the results, based on a Boolean condition. Optional. + :param filter: Filters the results, based on a Boolean condition. Optional. Default value is + None. :type filter: str - :param orderby: Sorts the results. Optional. + :param orderby: Sorts the results. Optional. Default value is None. :type orderby: str - :param top: Returns only the first n results. Optional. + :param top: Returns only the first n results. Optional. Default value is None. :type top: int :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ThreatIntelligenceInformationList or the result of @@ -129,11 +132,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.ThreatIntelligenceInformationList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ThreatIntelligenceInformationList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ThreatIntelligenceInformationList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -141,14 +149,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -156,14 +167,17 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, filter=filter, orderby=orderby, top=top, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -177,7 +191,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -190,4 +208,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/threatIntelligence/main/indicators"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py index 0a3b37239494..6df29cac649d 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlist_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,10 +36,14 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -47,23 +51,21 @@ def build_list_request( "watchlistAlias": _SERIALIZER.url("watchlist_alias", watchlist_alias, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -76,10 +78,14 @@ def build_get_request( watchlist_item_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -88,21 +94,19 @@ def build_get_request( "watchlistItemId": _SERIALIZER.url("watchlist_item_id", watchlist_item_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -115,10 +119,14 @@ def build_delete_request( watchlist_item_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -127,21 +135,19 @@ def build_delete_request( "watchlistItemId": _SERIALIZER.url("watchlist_item_id", watchlist_item_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -153,16 +159,19 @@ def build_create_or_update_request( watchlist_alias: str, watchlist_item_id: str, *, - json: JSONType = None, + json: Optional[_models.WatchlistItem] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -171,49 +180,45 @@ def build_create_or_update_request( "watchlistItemId": _SERIALIZER.url("watchlist_item_id", watchlist_item_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class WatchlistItemsOperations(object): - """WatchlistItemsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class WatchlistItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`watchlist_items` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -223,7 +228,7 @@ def list( watchlist_alias: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.WatchlistItemList"]: + ) -> Iterable[_models.WatchlistItemList]: """Gets all watchlist Items. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -235,17 +240,23 @@ def list( :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WatchlistItemList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.WatchlistItemList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WatchlistItemList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.WatchlistItemList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -254,11 +265,14 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, watchlist_alias=watchlist_alias, + api_version=api_version, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -267,11 +281,14 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, workspace_name=workspace_name, watchlist_alias=watchlist_alias, + api_version=api_version, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -285,7 +302,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -298,7 +319,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems"} # type: ignore @distributed_trace def get( @@ -308,7 +329,7 @@ def get( watchlist_alias: str, watchlist_item_id: str, **kwargs: Any - ) -> "_models.WatchlistItem": + ) -> _models.WatchlistItem: """Gets a watchlist, without its watchlist items. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -324,11 +345,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.WatchlistItem :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WatchlistItem"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.WatchlistItem] request = build_get_request( @@ -337,12 +363,19 @@ def get( workspace_name=workspace_name, watchlist_alias=watchlist_alias, watchlist_item_id=watchlist_item_id, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -356,11 +389,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -383,11 +416,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -396,12 +434,19 @@ def delete( workspace_name=workspace_name, watchlist_alias=watchlist_alias, watchlist_item_id=watchlist_item_id, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -411,7 +456,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}"} # type: ignore @distributed_trace @@ -421,9 +466,9 @@ def create_or_update( workspace_name: str, watchlist_alias: str, watchlist_item_id: str, - watchlist_item: "_models.WatchlistItem", + watchlist_item: _models.WatchlistItem, **kwargs: Any - ) -> "_models.WatchlistItem": + ) -> _models.WatchlistItem: """Creates or updates a watchlist item. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -441,13 +486,17 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.WatchlistItem :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WatchlistItem"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.WatchlistItem] _json = self._serialize.body(watchlist_item, 'WatchlistItem') @@ -457,14 +506,21 @@ def create_or_update( workspace_name=workspace_name, watchlist_alias=watchlist_alias, watchlist_item_id=watchlist_item_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -482,5 +538,5 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}"} # type: ignore diff --git a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py index 228294423ebc..f88a5147162c 100644 --- a/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py +++ b/sdk/securityinsight/azure-mgmt-securityinsight/azure/mgmt/securityinsight/operations/_watchlists_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -15,13 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,33 +35,35 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _params['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -73,10 +75,14 @@ def build_get_request( watchlist_alias: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -84,21 +90,19 @@ def build_get_request( "watchlistAlias": _SERIALIZER.url("watchlist_alias", watchlist_alias, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -110,10 +114,14 @@ def build_delete_request( watchlist_alias: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01-preview" - accept = "application/json" + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -121,21 +129,19 @@ def build_delete_request( "watchlistAlias": _SERIALIZER.url("watchlist_alias", watchlist_alias, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, **kwargs ) @@ -146,16 +152,19 @@ def build_create_or_update_request( workspace_name: str, watchlist_alias: str, *, - json: JSONType = None, + json: Optional[_models.Watchlist] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - api_version = "2022-01-01-preview" - accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), @@ -163,49 +172,45 @@ def build_create_or_update_request( "watchlistAlias": _SERIALIZER.url("watchlist_alias", watchlist_alias, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class WatchlistsOperations(object): - """WatchlistsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class WatchlistsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.securityinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.securityinsight.SecurityInsights`'s + :attr:`watchlists` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( @@ -214,7 +219,7 @@ def list( workspace_name: str, skip_token: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.WatchlistList"]: + ) -> Iterable[_models.WatchlistList]: """Gets all watchlists, without watchlist items. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -224,17 +229,23 @@ def list( :param skip_token: Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. Optional. + Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WatchlistList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.securityinsight.models.WatchlistList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.WatchlistList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.WatchlistList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -242,11 +253,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, skip_token=skip_token, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -254,11 +268,14 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, workspace_name=workspace_name, + api_version=api_version, skip_token=skip_token, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -272,7 +289,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -285,7 +306,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists"} # type: ignore @distributed_trace def get( @@ -294,7 +315,7 @@ def get( workspace_name: str, watchlist_alias: str, **kwargs: Any - ) -> "_models.Watchlist": + ) -> _models.Watchlist: """Gets a watchlist, without its watchlist items. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -308,11 +329,16 @@ def get( :rtype: ~azure.mgmt.securityinsight.models.Watchlist :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Watchlist"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Watchlist] request = build_get_request( @@ -320,12 +346,19 @@ def get( resource_group_name=resource_group_name, workspace_name=workspace_name, watchlist_alias=watchlist_alias, + api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -339,11 +372,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -363,11 +396,16 @@ def delete( :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', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -375,12 +413,19 @@ def delete( resource_group_name=resource_group_name, workspace_name=workspace_name, watchlist_alias=watchlist_alias, + api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -395,7 +440,7 @@ def delete( if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}"} # type: ignore @distributed_trace @@ -404,9 +449,9 @@ def create_or_update( resource_group_name: str, workspace_name: str, watchlist_alias: str, - watchlist: "_models.Watchlist", + watchlist: _models.Watchlist, **kwargs: Any - ) -> "_models.Watchlist": + ) -> _models.Watchlist: """Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To create a Watchlist and its Items, we should call this endpoint with either rawContent or a valid SAR URI and contentType properties. The rawContent is mainly used for @@ -427,13 +472,17 @@ def create_or_update( :rtype: ~azure.mgmt.securityinsight.models.Watchlist :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Watchlist"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Watchlist] _json = self._serialize.body(watchlist, 'Watchlist') @@ -442,14 +491,21 @@ def create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, watchlist_alias=watchlist_alias, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -470,5 +526,5 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}"} # type: ignore