diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py deleted file mode 100644 index e95a015ca6b8..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._security_center import SecurityCenter -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "SecurityCenter", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py deleted file mode 100644 index 489cf11ee94e..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for SecurityCenter. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Azure subscription ID. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-01-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2021-01-15-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json deleted file mode 100644 index f6245c812961..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "chosen_version": "2021-01-15-preview", - "total_api_version_list": ["2021-01-15-preview"], - "client": { - "name": "SecurityCenter", - "filename": "_security_center", - "description": "API spec for Microsoft.Security (Azure Security Center) 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": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Azure subscription ID. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Azure subscription ID. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "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, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "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": { - "ingestion_settings": "IngestionSettingsOperations" - } -} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# 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/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py deleted file mode 100644 index b3b58422bcf3..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import SecurityCenterConfiguration -from .operations import IngestionSettingsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword - """API spec for Microsoft.Security (Azure Security Center) resource provider. - - :ivar ingestion_settings: IngestionSettingsOperations operations - :vartype ingestion_settings: - azure.mgmt.security.v2021_01_15_preview.operations.IngestionSettingsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Azure subscription ID. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2021-01-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.ingestion_settings = IngestionSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "SecurityCenter": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py deleted file mode 100644 index bd0df84f5319..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py +++ /dev/null @@ -1,30 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 List, cast - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py deleted file mode 100644 index caf312bd2d0b..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "6.0.0" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py deleted file mode 100644 index d9a53c22b3e6..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._security_center import SecurityCenter - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "SecurityCenter", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py deleted file mode 100644 index 582cd67d1264..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for SecurityCenter. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Azure subscription ID. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-01-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2021-01-15-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# 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/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py deleted file mode 100644 index ffce83283fa7..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import SecurityCenterConfiguration -from .operations import IngestionSettingsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword - """API spec for Microsoft.Security (Azure Security Center) resource provider. - - :ivar ingestion_settings: IngestionSettingsOperations operations - :vartype ingestion_settings: - azure.mgmt.security.v2021_01_15_preview.aio.operations.IngestionSettingsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Azure subscription ID. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2021-01-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.ingestion_settings = IngestionSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "SecurityCenter": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py deleted file mode 100644 index e0aa0c4329cb..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._ingestion_settings_operations import IngestionSettingsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "IngestionSettingsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py deleted file mode 100644 index 099b551f9e98..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py +++ /dev/null @@ -1,504 +0,0 @@ -# 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, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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._ingestion_settings_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_connection_strings_request, - build_list_request, - build_list_tokens_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class IngestionSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2021_01_15_preview.aio.SecurityCenter`'s - :attr:`ingestion_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, **kwargs: Any) -> AsyncIterable["_models.IngestionSetting"]: - """Settings for ingesting security data and logs to correlate with resources associated with the - subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IngestionSetting or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSettingList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - 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, - 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) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("IngestionSettingList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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}/providers/Microsoft.Security/ingestionSettings"} - - @distributed_trace_async - async def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSetting: - """Settings for ingesting security data and logs to correlate with resources associated with the - subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) - - request = build_get_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("IngestionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @overload - async def create( - self, - ingestion_setting_name: str, - ingestion_setting: _models.IngestionSetting, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Required. - :type ingestion_setting: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - ingestion_setting_name: str, - ingestion_setting: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Required. - :type ingestion_setting: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, ingestion_setting_name: str, ingestion_setting: Union[_models.IngestionSetting, IO], **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Is either a IngestionSetting type or a IO - type. Required. - :type ingestion_setting: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - 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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(ingestion_setting, (IO, bytes)): - _content = ingestion_setting - else: - _json = self._serialize.body(ingestion_setting, "IngestionSetting") - - request = build_create_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("IngestionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, ingestion_setting_name: str, **kwargs: Any - ) -> None: - """Deletes the ingestion settings for this subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_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, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @distributed_trace_async - async def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSettingToken: - """Returns the token that is used for correlating ingested telemetry with the resources in the - subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSettingToken or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSettingToken - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSettingToken] = kwargs.pop("cls", None) - - request = build_list_tokens_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_tokens.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("IngestionSettingToken", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_tokens.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens" - } - - @distributed_trace_async - async def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> _models.ConnectionStrings: - """Connection strings for ingesting security scan logs and data. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionStrings or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.ConnectionStrings - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.ConnectionStrings] = kwargs.pop("cls", None) - - request = build_list_connection_strings_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_connection_strings.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("ConnectionStrings", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_connection_strings.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings" - } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# 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/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py deleted file mode 100644 index 439fe0cadcea..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import CloudErrorBody -from ._models_py3 import ConnectionStrings -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import IngestionConnectionString -from ._models_py3 import IngestionSetting -from ._models_py3 import IngestionSettingList -from ._models_py3 import IngestionSettingToken -from ._models_py3 import Resource -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "CloudErrorBody", - "ConnectionStrings", - "ErrorAdditionalInfo", - "IngestionConnectionString", - "IngestionSetting", - "IngestionSettingList", - "IngestionSettingToken", - "Resource", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py deleted file mode 100644 index 3b276818e2d8..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py +++ /dev/null @@ -1,272 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import sys -from typing import Any, List, Optional, TYPE_CHECKING - -from ... import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class CloudErrorBody(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.security.v2021_01_15_preview.models.CloudErrorBody] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.security.v2021_01_15_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ConnectionStrings(_serialization.Model): - """Connection string for ingesting security data and logs. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Connection strings. Required. - :vartype value: list[~azure.mgmt.security.v2021_01_15_preview.models.IngestionConnectionString] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[IngestionConnectionString]"}, - } - - def __init__(self, *, value: List["_models.IngestionConnectionString"], **kwargs: Any) -> None: - """ - :keyword value: Connection strings. Required. - :paramtype value: - list[~azure.mgmt.security.v2021_01_15_preview.models.IngestionConnectionString] - """ - super().__init__(**kwargs) - self.value = value - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class IngestionConnectionString(_serialization.Model): - """Connection string for ingesting security data and logs. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: The region where ingested logs and data resides. - :vartype location: str - :ivar value: Connection string value. - :vartype value: str - """ - - _validation = { - "location": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.location = None - self.value = None - - -class Resource(_serialization.Model): - """Describes an Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class IngestionSetting(Resource): - """Configures how to correlate scan data and logs with resources associated with the subscription. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar properties: Ingestion setting data. - :vartype properties: JSON - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "object"}, - } - - def __init__(self, *, properties: Optional[JSON] = None, **kwargs: Any) -> None: - """ - :keyword properties: Ingestion setting data. - :paramtype properties: JSON - """ - super().__init__(**kwargs) - self.properties = properties - - -class IngestionSettingList(_serialization.Model): - """List of ingestion settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ingestion settings. - :vartype value: list[~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting] - :ivar next_link: The URI to fetch the next page. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[IngestionSetting]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class IngestionSettingToken(_serialization.Model): - """Configures how to correlate scan data and logs with resources associated with the subscription. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar token: The token is used for correlating security data and logs with the resources in the - subscription. - :vartype token: str - """ - - _validation = { - "token": {"readonly": True}, - } - - _attribute_map = { - "token": {"key": "token", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.token = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# 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/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py deleted file mode 100644 index e0aa0c4329cb..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._ingestion_settings_operations import IngestionSettingsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "IngestionSettingsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py deleted file mode 100644 index 904099fae7d9..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py +++ /dev/null @@ -1,680 +0,0 @@ -# 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, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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 ..._serialization import Serializer -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, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # 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(ingestion_setting_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # 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_request(ingestion_setting_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # 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, **kwargs) - - -def build_delete_request(ingestion_setting_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # 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) - - -def build_list_tokens_request(ingestion_setting_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_connection_strings_request( - ingestion_setting_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" - ), - "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class IngestionSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2021_01_15_preview.SecurityCenter`'s - :attr:`ingestion_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, **kwargs: Any) -> Iterable["_models.IngestionSetting"]: - """Settings for ingesting security data and logs to correlate with resources associated with the - subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IngestionSetting or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSettingList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - 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, - 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) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("IngestionSettingList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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}/providers/Microsoft.Security/ingestionSettings"} - - @distributed_trace - def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSetting: - """Settings for ingesting security data and logs to correlate with resources associated with the - subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) - - request = build_get_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("IngestionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @overload - def create( - self, - ingestion_setting_name: str, - ingestion_setting: _models.IngestionSetting, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Required. - :type ingestion_setting: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - ingestion_setting_name: str, - ingestion_setting: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Required. - :type ingestion_setting: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, ingestion_setting_name: str, ingestion_setting: Union[_models.IngestionSetting, IO], **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Is either a IngestionSetting type or a IO - type. Required. - :type ingestion_setting: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - 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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(ingestion_setting, (IO, bytes)): - _content = ingestion_setting - else: - _json = self._serialize.body(ingestion_setting, "IngestionSetting") - - request = build_create_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("IngestionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, ingestion_setting_name: str, **kwargs: Any - ) -> None: - """Deletes the ingestion settings for this subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_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, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @distributed_trace - def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSettingToken: - """Returns the token that is used for correlating ingested telemetry with the resources in the - subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSettingToken or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSettingToken - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSettingToken] = kwargs.pop("cls", None) - - request = build_list_tokens_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_tokens.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("IngestionSettingToken", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_tokens.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens" - } - - @distributed_trace - def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> _models.ConnectionStrings: - """Connection strings for ingesting security scan logs and data. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionStrings or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.ConnectionStrings - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.ConnectionStrings] = kwargs.pop("cls", None) - - request = build_list_connection_strings_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_connection_strings.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("ConnectionStrings", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_connection_strings.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings" - } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# 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/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/py.typed b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file